[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / llvm / lib / CodeGen / MachineModuleInfoImpls.cpp
blob9c3b31935f6d601b630fe9a442bebd3b0ec947d5
1 //===- llvm/CodeGen/MachineModuleInfoImpls.cpp ----------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements object-file format specific implementations of
10 // MachineModuleInfoImpl.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
15 #include "llvm/ADT/DenseMap.h"
16 #include "llvm/MC/MCSymbol.h"
18 using namespace llvm;
20 //===----------------------------------------------------------------------===//
21 // MachineModuleInfoMachO
22 //===----------------------------------------------------------------------===//
24 // Out of line virtual method.
25 void MachineModuleInfoMachO::anchor() {}
26 void MachineModuleInfoELF::anchor() {}
27 void MachineModuleInfoCOFF::anchor() {}
28 void MachineModuleInfoWasm::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);
41 Map.clear();
42 return List;