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