LLVM 19.0.0git
MachineModuleInfoImpls.h
Go to the documentation of this file.
1//===- llvm/CodeGen/MachineModuleInfoImpls.h --------------------*- C++ -*-===//
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 defines object-file format specific implementations of
10// MachineModuleInfoImpl.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
15#define LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
16
17#include "llvm/ADT/DenseMap.h"
18#include "llvm/ADT/SetVector.h"
20#include <cassert>
21
22namespace llvm {
23
24class MCSymbol;
25
26/// MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation
27/// for MachO targets.
29 /// GVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
30 /// "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra bit
31 /// is true if this GV is external.
33
34 /// ThreadLocalGVStubs - Darwin '$non_lazy_ptr' stubs. The key is something
35 /// like "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra
36 /// bit is true if this GV is external.
37 DenseMap<MCSymbol *, StubValueTy> ThreadLocalGVStubs;
38
39 virtual void anchor(); // Out of line virtual method.
40
41public:
43
45 assert(Sym && "Key cannot be null");
46 return GVStubs[Sym];
47 }
48
50 assert(Sym && "Key cannot be null");
51 return ThreadLocalGVStubs[Sym];
52 }
53
54 /// Accessor methods to return the set of stubs in sorted order.
57 return getSortedStubs(ThreadLocalGVStubs);
58 }
59};
60
61/// MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation
62/// for ELF targets.
64public:
65 struct AuthStubInfo {
67 };
68
69private:
70 /// GVStubs - These stubs are used to materialize global addresses in PIC
71 /// mode.
73
74 /// AuthPtrStubs - These stubs are used to materialize signed addresses for
75 /// extern_weak symbols.
77
78 virtual void anchor(); // Out of line virtual method.
79
80public:
82
84 assert(Sym && "Key cannot be null");
85 return GVStubs[Sym];
86 }
87
89 assert(Sym && "Key cannot be null");
90 return AuthPtrStubs[Sym];
91 }
92
93 /// Accessor methods to return the set of stubs in sorted order.
94
96
97 using AuthStubPairTy = std::pair<MCSymbol *, AuthStubInfo>;
98 typedef std::vector<AuthStubPairTy> AuthStubListTy;
99
101};
102
103/// MachineModuleInfoCOFF - This is a MachineModuleInfoImpl implementation
104/// for COFF targets.
106 /// GVStubs - These stubs are used to materialize global addresses in PIC
107 /// mode.
109
110 virtual void anchor(); // Out of line virtual method.
111
112public:
114
116 assert(Sym && "Key cannot be null");
117 return GVStubs[Sym];
118 }
119
120 /// Accessor methods to return the set of stubs in sorted order.
121
123};
124
125/// MachineModuleInfoWasm - This is a MachineModuleInfoImpl implementation
126/// for Wasm targets.
128 virtual void anchor(); // Out of line virtual method.
129
130public:
132
134};
135
136} // end namespace llvm
137
138#endif // LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
This file defines the DenseMap class.
Symbol * Sym
Definition: ELF_riscv.cpp:479
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements a set that has insertion order iteration characteristics.
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
MachineModuleInfoCOFF - This is a MachineModuleInfoImpl implementation for COFF targets.
StubValueTy & getGVStubEntry(MCSymbol *Sym)
SymbolListTy GetGVStubList()
Accessor methods to return the set of stubs in sorted order.
MachineModuleInfoCOFF(const MachineModuleInfo &)
MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation for ELF targets.
std::pair< MCSymbol *, AuthStubInfo > AuthStubPairTy
MachineModuleInfoELF(const MachineModuleInfo &)
AuthStubInfo & getAuthPtrStubEntry(MCSymbol *Sym)
StubValueTy & getGVStubEntry(MCSymbol *Sym)
SymbolListTy GetGVStubList()
Accessor methods to return the set of stubs in sorted order.
std::vector< AuthStubPairTy > AuthStubListTy
This class can be derived from and used by targets to hold private target-specific information for ea...
std::vector< std::pair< MCSymbol *, StubValueTy > > SymbolListTy
static SymbolListTy getSortedStubs(DenseMap< MCSymbol *, StubValueTy > &)
Return the entries from a DenseMap in a deterministic sorted orer.
MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation for MachO targets.
StubValueTy & getGVStubEntry(MCSymbol *Sym)
StubValueTy & getThreadLocalGVStubEntry(MCSymbol *Sym)
SymbolListTy GetGVStubList()
Accessor methods to return the set of stubs in sorted order.
MachineModuleInfoMachO(const MachineModuleInfo &)
MachineModuleInfoWasm - This is a MachineModuleInfoImpl implementation for Wasm targets.
MachineModuleInfoWasm(const MachineModuleInfo &)
SetVector< StringRef > MachineSymbolsUsed
This class contains meta information specific to a module.
PointerIntPair - This class implements a pair of a pointer and small integer.
A vector that has set insertion semantics.
Definition: SetVector.h:57
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18