MachineModuleInfoImpls.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. void MachineModuleInfoWasm::anchor() {}
  25. using PairTy = std::pair<MCSymbol *, MachineModuleInfoImpl::StubValueTy>;
  26. static int SortSymbolPair(const PairTy *LHS, const PairTy *RHS) {
  27. return LHS->first->getName().compare(RHS->first->getName());
  28. }
  29. MachineModuleInfoImpl::SymbolListTy MachineModuleInfoImpl::getSortedStubs(
  30. DenseMap<MCSymbol *, MachineModuleInfoImpl::StubValueTy> &Map) {
  31. MachineModuleInfoImpl::SymbolListTy List(Map.begin(), Map.end());
  32. array_pod_sort(List.begin(), List.end(), SortSymbolPair);
  33. Map.clear();
  34. return List;
  35. }