1 //===- llvm/CodeGen/MachineModuleInfoImpls.cpp ----------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements object-file format specific implementations of
11 // MachineModuleInfoImpl.
13 //===----------------------------------------------------------------------===//
15 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
16 #include "llvm/ADT/DenseMap.h"
17 #include "llvm/MC/MCSymbol.h"
21 //===----------------------------------------------------------------------===//
22 // MachineModuleInfoMachO
23 //===----------------------------------------------------------------------===//
25 // Out of line virtual method.
26 void MachineModuleInfoMachO::anchor() {}
27 void MachineModuleInfoELF::anchor() {}
28 void MachineModuleInfoCOFF::anchor() {}
30 using PairTy = std::pair<MCSymbol *, MachineModuleInfoImpl::StubValueTy>;
31 static int SortSymbolPair(const PairTy *LHS, const PairTy *RHS) {
32 return LHS->first->getName().compare(RHS->first->getName());
35 MachineModuleInfoImpl::SymbolListTy MachineModuleInfoImpl::getSortedStubs(
36 DenseMap<MCSymbol *, MachineModuleInfoImpl::StubValueTy> &Map) {
37 MachineModuleInfoImpl::SymbolListTy List(Map.begin(), Map.end());
39 array_pod_sort(List.begin(), List.end(), SortSymbolPair);