LLVM API Documentation

MachineModuleInfoImpls.cpp
Go to the documentation of this file.
00001 //===-- llvm/CodeGen/MachineModuleInfoImpls.cpp ---------------------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file implements object-file format specific implementations of
00011 // MachineModuleInfoImpl.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
00016 #include "llvm/MC/MCSymbol.h"
00017 using namespace llvm;
00018 
00019 //===----------------------------------------------------------------------===//
00020 // MachineModuleInfoMachO
00021 //===----------------------------------------------------------------------===//
00022 
00023 // Out of line virtual method.
00024 void MachineModuleInfoMachO::anchor() {}
00025 void MachineModuleInfoELF::anchor() {}
00026 
00027 static int SortSymbolPair(const void *LHS, const void *RHS) {
00028   typedef std::pair<MCSymbol*, MachineModuleInfoImpl::StubValueTy> PairTy;
00029   const MCSymbol *LHSS = ((const PairTy *)LHS)->first;
00030   const MCSymbol *RHSS = ((const PairTy *)RHS)->first;
00031   return LHSS->getName().compare(RHSS->getName());
00032 }
00033 
00034 /// GetSortedStubs - Return the entries from a DenseMap in a deterministic
00035 /// sorted orer.
00036 MachineModuleInfoImpl::SymbolListTy
00037 MachineModuleInfoImpl::GetSortedStubs(const DenseMap<MCSymbol*,
00038                                       MachineModuleInfoImpl::StubValueTy>&Map) {
00039   MachineModuleInfoImpl::SymbolListTy List(Map.begin(), Map.end());
00040 
00041   if (!List.empty())
00042     qsort(&List[0], List.size(), sizeof(List[0]), SortSymbolPair);
00043   return List;
00044 }
00045