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 /// Darwin '$auth_ptr' stubs. The key is the stub symbol, like
40 /// "Lfoo$auth_ptr$ib$12". The value is the MCExpr representing that
41 /// signed pointer, something like "_foo@AUTH(ib, 12)".
43
44 virtual void anchor(); // Out of line virtual method.
45
46public:
48
50 assert(Sym && "Key cannot be null");
51 return GVStubs[Sym];
52 }
53
55 assert(Sym && "Key cannot be null");
56 return ThreadLocalGVStubs[Sym];
57 }
58
60 assert(Sym && "Key cannot be null");
61 return AuthPtrStubs[Sym];
62 }
63
64 /// Accessor methods to return the set of stubs in sorted order.
67 return getSortedStubs(ThreadLocalGVStubs);
68 }
69
71 return getSortedExprStubs(AuthPtrStubs);
72 }
73};
74
75/// MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation
76/// for ELF targets.
78 /// GVStubs - These stubs are used to materialize global addresses in PIC
79 /// mode.
81
82 /// AuthPtrStubs - These stubs are used to materialize signed addresses for
83 /// extern_weak symbols.
85
86 virtual void anchor(); // Out of line virtual method.
87
88public:
90
92 assert(Sym && "Key cannot be null");
93 return GVStubs[Sym];
94 }
95
97 assert(Sym && "Key cannot be null");
98 return AuthPtrStubs[Sym];
99 }
100
101 /// Accessor methods to return the set of stubs in sorted order.
102
104
106 return getSortedExprStubs(AuthPtrStubs);
107 }
108};
109
110/// MachineModuleInfoCOFF - This is a MachineModuleInfoImpl implementation
111/// for COFF targets.
113 /// GVStubs - These stubs are used to materialize global addresses in PIC
114 /// mode.
116
117 virtual void anchor(); // Out of line virtual method.
118
119public:
121
123 assert(Sym && "Key cannot be null");
124 return GVStubs[Sym];
125 }
126
127 /// Accessor methods to return the set of stubs in sorted order.
128
130};
131
132/// MachineModuleInfoWasm - This is a MachineModuleInfoImpl implementation
133/// for Wasm targets.
135 virtual void anchor(); // Out of line virtual method.
136
137public:
139
141};
142
143} // end namespace llvm
144
145#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:34
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.
MachineModuleInfoELF(const MachineModuleInfo &)
const MCExpr *& getAuthPtrStubEntry(MCSymbol *Sym)
StubValueTy & getGVStubEntry(MCSymbol *Sym)
SymbolListTy GetGVStubList()
Accessor methods to return the set of stubs in sorted order.
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.
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.
MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation for MachO targets.
const MCExpr *& getAuthPtrStubEntry(MCSymbol *Sym)
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