LLVM 20.0.0git
MachineModuleInfoImpls.cpp
Go to the documentation of this file.
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.
11//
12//===----------------------------------------------------------------------===//
13
15#include "llvm/ADT/DenseMap.h"
16#include "llvm/ADT/STLExtras.h"
17#include "llvm/MC/MCSymbol.h"
18
19using namespace llvm;
20
21//===----------------------------------------------------------------------===//
22// MachineModuleInfoMachO
23//===----------------------------------------------------------------------===//
24
25// Out of line virtual method.
26void MachineModuleInfoMachO::anchor() {}
27void MachineModuleInfoELF::anchor() {}
28void MachineModuleInfoCOFF::anchor() {}
29void MachineModuleInfoWasm::anchor() {}
30
31using PairTy = std::pair<MCSymbol *, MachineModuleInfoImpl::StubValueTy>;
32static int SortSymbolPair(const PairTy *LHS, const PairTy *RHS) {
33 return LHS->first->getName().compare(RHS->first->getName());
34}
35
38 MachineModuleInfoImpl::SymbolListTy List(Map.begin(), Map.end());
39
40 array_pod_sort(List.begin(), List.end(), SortSymbolPair);
41
42 Map.clear();
43 return List;
44}
45
46using ExprStubPairTy = std::pair<MCSymbol *, const MCExpr *>;
47static int SortAuthStubPair(const ExprStubPairTy *LHS,
48 const ExprStubPairTy *RHS) {
49 return LHS->first->getName().compare(RHS->first->getName());
50}
51
55 ExprStubs.end());
56
58
59 ExprStubs.clear();
60 return List;
61}
This file defines the DenseMap class.
static int SortSymbolPair(const PairTy *LHS, const PairTy *RHS)
std::pair< MCSymbol *, const MCExpr * > ExprStubPairTy
std::pair< MCSymbol *, MachineModuleInfoImpl::StubValueTy > PairTy
static int SortAuthStubPair(const ExprStubPairTy *LHS, const ExprStubPairTy *RHS)
This file contains some templates that are useful if you are working with the STL at all.
Value * RHS
Value * LHS
iterator begin()
Definition: DenseMap.h:75
iterator end()
Definition: DenseMap.h:84
std::vector< std::pair< MCSymbol *, StubValueTy > > SymbolListTy
static SymbolListTy getSortedStubs(DenseMap< MCSymbol *, StubValueTy > &)
Return the entries from a DenseMap in a deterministic sorted orer.
std::vector< std::pair< MCSymbol *, const MCExpr * > > ExprStubListTy
A variant of SymbolListTy where the stub is a generalized MCExpr.
static ExprStubListTy getSortedExprStubs(DenseMap< MCSymbol *, const MCExpr * > &)
Return the entries from a DenseMap in a deterministic sorted orer.
int compare(StringRef RHS) const
compare - Compare two strings; the result is negative, zero, or positive if this string is lexicograp...
Definition: StringRef.h:170
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:309
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
void array_pod_sort(IteratorTy Start, IteratorTy End)
array_pod_sort - This sorts an array with the specified start and end extent.
Definition: STLExtras.h:1607