MachineModuleInfoImpls.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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/ADT/DenseMap.h"
  16. #include "llvm/MC/MCSymbol.h"
  17. using namespace llvm;
  18. //===----------------------------------------------------------------------===//
  19. // MachineModuleInfoMachO
  20. //===----------------------------------------------------------------------===//
  21. // Out of line virtual method.
  22. void MachineModuleInfoMachO::anchor() {}
  23. void MachineModuleInfoELF::anchor() {}
  24. using PairTy = std::pair<MCSymbol *, MachineModuleInfoImpl::StubValueTy>;
  25. static int SortSymbolPair(const PairTy *LHS, const PairTy *RHS) {
  26. return LHS->first->getName().compare(RHS->first->getName());
  27. }
  28. MachineModuleInfoImpl::SymbolListTy MachineModuleInfoImpl::getSortedStubs(
  29. DenseMap<MCSymbol *, MachineModuleInfoImpl::StubValueTy> &Map) {
  30. MachineModuleInfoImpl::SymbolListTy List(Map.begin(), Map.end());
  31. array_pod_sort(List.begin(), List.end(), SortSymbolPair);
  32. Map.clear();
  33. return List;
  34. }