MachineModuleInfoImpls.cpp revision 198090
1228731Smav//===-- llvm/CodeGen/MachineModuleInfoImpls.cpp ---------------------------===// 2247463Smav// 3228731Smav// The LLVM Compiler Infrastructure 4228731Smav// 5228731Smav// This file is distributed under the University of Illinois Open Source 6228731Smav// License. See LICENSE.TXT for details. 7228731Smav// 8228731Smav//===----------------------------------------------------------------------===// 9228731Smav// 10228731Smav// This file implements object-file format specific implementations of 11228731Smav// MachineModuleInfoImpl. 12228731Smav// 13228731Smav//===----------------------------------------------------------------------===// 14228731Smav 15228731Smav#include "llvm/CodeGen/MachineModuleInfoImpls.h" 16228731Smav#include "llvm/MC/MCSymbol.h" 17228731Smavusing namespace llvm; 18228731Smav 19228731Smav//===----------------------------------------------------------------------===// 20228731Smav// MachineModuleInfoMachO 21228731Smav//===----------------------------------------------------------------------===// 22228731Smav 23228731Smav// Out of line virtual method. 24228731Smavvoid MachineModuleInfoMachO::Anchor() {} 25228731Smav 26228731Smav 27266347Sianstatic int SortSymbolPair(const void *LHS, const void *RHS) { 28228731Smav const MCSymbol *LHSS = 29228731Smav ((const std::pair<const MCSymbol*, const MCSymbol*>*)LHS)->first; 30228731Smav const MCSymbol *RHSS = 31228731Smav ((const std::pair<const MCSymbol*, const MCSymbol*>*)RHS)->first; 32228731Smav return LHSS->getName().compare(RHSS->getName()); 33228731Smav} 34228731Smav 35228731Smav/// GetSortedStubs - Return the entries from a DenseMap in a deterministic 36228731Smav/// sorted orer. 37228731SmavMachineModuleInfoMachO::SymbolListTy 38228731SmavMachineModuleInfoMachO::GetSortedStubs(const DenseMap<const MCSymbol*, 39247463Smav const MCSymbol*> &Map) { 40228731Smav MachineModuleInfoMachO::SymbolListTy List(Map.begin(), Map.end()); 41228731Smav if (!List.empty()) 42228731Smav qsort(&List[0], List.size(), sizeof(List[0]), SortSymbolPair); 43228731Smav return List; 44228731Smav} 45228731Smav 46228731Smav