blob: 22d519e5d88fa38a95e99ac1780a0daa31971e79 [file] [log] [blame]
Chris Lattnerf3f54ff2009-09-16 06:03:48 +00001//===-- llvm/CodeGen/MachineModuleInfoImpls.cpp ---------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements object-file format specific implementations of
11// MachineModuleInfoImpl.
12//
13//===----------------------------------------------------------------------===//
14
15#include "llvm/CodeGen/MachineModuleInfoImpls.h"
16#include "llvm/MC/MCSymbol.h"
17using namespace llvm;
18
19//===----------------------------------------------------------------------===//
20// MachineModuleInfoMachO
21//===----------------------------------------------------------------------===//
22
23// Out of line virtual method.
Craig Topper2a6a08b2012-09-26 06:36:36 +000024void MachineModuleInfoMachO::anchor() {}
25void MachineModuleInfoELF::anchor() {}
Chris Lattnerf3f54ff2009-09-16 06:03:48 +000026
27static int SortSymbolPair(const void *LHS, const void *RHS) {
Bill Wendlinga810bdf2010-03-10 22:34:10 +000028 typedef std::pair<MCSymbol*, MachineModuleInfoImpl::StubValueTy> PairTy;
29 const MCSymbol *LHSS = ((const PairTy *)LHS)->first;
30 const MCSymbol *RHSS = ((const PairTy *)RHS)->first;
Chris Lattnerf3f54ff2009-09-16 06:03:48 +000031 return LHSS->getName().compare(RHSS->getName());
32}
33
Rafael Espindolad1294d92015-04-07 12:59:28 +000034MachineModuleInfoImpl::SymbolListTy MachineModuleInfoImpl::getSortedStubs(
35 DenseMap<MCSymbol *, MachineModuleInfoImpl::StubValueTy> &Map) {
Anton Korobeynikovae4ccc12010-02-15 22:35:59 +000036 MachineModuleInfoImpl::SymbolListTy List(Map.begin(), Map.end());
37
Benjamin Kramer6f3d4e92009-09-16 11:43:12 +000038 if (!List.empty())
39 qsort(&List[0], List.size(), sizeof(List[0]), SortSymbolPair);
Rafael Espindolad1294d92015-04-07 12:59:28 +000040
41 Map.clear();
Chris Lattnerf3f54ff2009-09-16 06:03:48 +000042 return List;
43}
44