MachineModuleInfoImpls.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //===- llvm/CodeGen/MachineModuleInfoImpls.cpp ----------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file implements object-file format specific implementations of
  10. // MachineModuleInfoImpl.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #include "llvm/CodeGen/MachineModuleInfoImpls.h"
  14. #include "llvm/ADT/DenseMap.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. void MachineModuleInfoCOFF::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. }