MachineModuleInfoImpls.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //===-- llvm/CodeGen/MachineModuleInfoImpls.cpp ---------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file implements object-file format specific implementations of
  11. // MachineModuleInfoImpl.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #include "llvm/CodeGen/MachineModuleInfoImpls.h"
  15. #include "llvm/MC/MCSymbol.h"
  16. using namespace llvm;
  17. //===----------------------------------------------------------------------===//
  18. // MachineModuleInfoMachO
  19. //===----------------------------------------------------------------------===//
  20. // Out of line virtual method.
  21. void MachineModuleInfoMachO::anchor() {}
  22. void MachineModuleInfoELF::anchor() {}
  23. // HLSL Change: changed calling convention to __cdecl
  24. static int __cdecl SortSymbolPair(const void *LHS, const void *RHS) {
  25. typedef std::pair<MCSymbol*, MachineModuleInfoImpl::StubValueTy> PairTy;
  26. const MCSymbol *LHSS = ((const PairTy *)LHS)->first;
  27. const MCSymbol *RHSS = ((const PairTy *)RHS)->first;
  28. return LHSS->getName().compare(RHSS->getName());
  29. }
  30. MachineModuleInfoImpl::SymbolListTy MachineModuleInfoImpl::getSortedStubs(
  31. DenseMap<MCSymbol *, MachineModuleInfoImpl::StubValueTy> &Map) {
  32. MachineModuleInfoImpl::SymbolListTy List(Map.begin(), Map.end());
  33. if (!List.empty())
  34. qsort(&List[0], List.size(), sizeof(List[0]), SortSymbolPair);
  35. Map.clear();
  36. return List;
  37. }