LLVM: lib/Target/ARM/ARMConstantPoolValue.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
16#include "llvm/Config/llvm-config.h"
26
27using namespace llvm;
28
29
30
31
32
35 unsigned char PCAdj,
37 bool addCurrentAddress)
39 PCAdjust(PCAdj), Modifier(modifier),
40 AddCurrentAddress(addCurrentAddress) {}
41
44 unsigned char PCAdj,
46 bool addCurrentAddress)
48 LabelId(id), Kind(kind), PCAdjust(PCAdj), Modifier(modifier),
49 AddCurrentAddress(addCurrentAddress) {}
50
52
54 switch (Modifier) {
55
56
58 return "none";
60 return "tlsgd";
62 return "GOT_PREL";
64 return "gottpoff";
66 return "tpoff";
68 return "SBREL";
70 return "secrel32";
71 }
73}
74
76 Align Alignment) {
78}
79
80void
82 ID.AddInteger(LabelId);
83 ID.AddInteger(PCAdjust);
84}
85
86bool
88 if (ACPV->Kind == Kind &&
89 ACPV->PCAdjust == PCAdjust &&
90 ACPV->Modifier == Modifier &&
91 ACPV->LabelId == LabelId &&
92 ACPV->AddCurrentAddress == AddCurrentAddress) {
93
94
96 return true;
97 }
98 return false;
99}
100
101#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
103 errs() << " " << *this;
104}
105#endif
106
109 if (PCAdjust != 0) {
110 O << "-(LPC" << LabelId << "+" << (unsigned)PCAdjust;
111 if (AddCurrentAddress) O << "-.";
112 O << ")";
113 }
114}
115
116
117
118
119
120ARMConstantPoolConstant::ARMConstantPoolConstant(Type *Ty,
122 unsigned ID,
124 unsigned char PCAdj,
126 bool AddCurrentAddress)
128 CVal(C) {}
129
130ARMConstantPoolConstant::ARMConstantPoolConstant(const Constant *C,
131 unsigned ID,
133 unsigned char PCAdj,
135 bool AddCurrentAddress)
137 AddCurrentAddress),
138 CVal(C) {}
139
140ARMConstantPoolConstant::ARMConstantPoolConstant(const GlobalVariable *GV,
144 GVars.insert(GV);
145}
146
152
155 const Constant *Initializer) {
156 return new ARMConstantPoolConstant(GVar, Initializer);
157}
158
164 Modifier, false);
165}
166
170 return new ARMConstantPoolConstant(C, ID, Kind, PCAdj,
172}
173
178 bool AddCurrentAddress) {
179 return new ARMConstantPoolConstant(C, ID, Kind, PCAdj, Modifier,
180 AddCurrentAddress);
181}
182
186
190
192 Align Alignment) {
193 int index =
195 if (index != -1) {
197 CP->getConstants()[index].Val.MachineCPVal);
199 Constant->GVars.insert_range(GVars);
200 }
201 return index;
202}
203
208
210 ID.AddPointer(CVal);
211 for (const auto *GV : GVars)
212 ID.AddPointer(GV);
214}
215
217 O << CVal->getName();
219}
220
221
222
223
224
226 unsigned id, unsigned char PCAdj,
228 bool AddCurrentAddress)
230 AddCurrentAddress),
231 S(std::string(s)) {}
232
235 unsigned char PCAdj) {
237}
238
240 Align Alignment) {
242}
243
248
250 ID.AddString(S);
252}
253
258
259
260
261
262
263ARMConstantPoolMBB::ARMConstantPoolMBB(LLVMContext &C,
265 unsigned id, unsigned char PCAdj,
267 bool AddCurrentAddress)
269 Modifier, AddCurrentAddress),
270 MBB(mbb) {}
271
274 unsigned ID,
275 unsigned char PCAdj) {
277}
278
280 Align Alignment) {
282}
283
286 return ACPMBB && ACPMBB->MBB == MBB &&
288}
289
291 ID.AddPointer(MBB);
293}
294
Function Alias Analysis false
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
This file defines a hash set that can be used to remove duplication of nodes in a graph.
static SymbolRef::Type getType(const Symbol *Sym)
ARMConstantPoolConstant - ARM-specific constant pool values for Constants, Functions,...
const GlobalValue * getGV() const
Definition ARMConstantPoolValue.cpp:183
static ARMConstantPoolConstant * Create(const Constant *C, unsigned ID)
Definition ARMConstantPoolValue.cpp:148
bool hasSameValue(ARMConstantPoolValue *ACPV) override
hasSameValue - Return true if this ARM constpool value can share the same constantpool entry as anoth...
Definition ARMConstantPoolValue.cpp:204
void print(raw_ostream &O) const override
print - Implement operator<<
Definition ARMConstantPoolValue.cpp:216
const BlockAddress * getBlockAddress() const
Definition ARMConstantPoolValue.cpp:187
void addSelectionDAGCSEId(FoldingSetNodeID &ID) override
Definition ARMConstantPoolValue.cpp:209
int getExistingMachineCPValue(MachineConstantPool *CP, Align Alignment) override
Definition ARMConstantPoolValue.cpp:191
int getExistingMachineCPValue(MachineConstantPool *CP, Align Alignment) override
Definition ARMConstantPoolValue.cpp:279
void addSelectionDAGCSEId(FoldingSetNodeID &ID) override
Definition ARMConstantPoolValue.cpp:290
static ARMConstantPoolMBB * Create(LLVMContext &C, const MachineBasicBlock *mbb, unsigned ID, unsigned char PCAdj)
Definition ARMConstantPoolValue.cpp:272
bool hasSameValue(ARMConstantPoolValue *ACPV) override
hasSameValue - Return true if this ARM constpool value can share the same constantpool entry as anoth...
Definition ARMConstantPoolValue.cpp:284
void print(raw_ostream &O) const override
print - Implement operator<<
Definition ARMConstantPoolValue.cpp:295
void addSelectionDAGCSEId(FoldingSetNodeID &ID) override
Definition ARMConstantPoolValue.cpp:249
bool hasSameValue(ARMConstantPoolValue *ACPV) override
hasSameValue - Return true if this ARM constpool value can share the same constantpool entry as anoth...
Definition ARMConstantPoolValue.cpp:244
int getExistingMachineCPValue(MachineConstantPool *CP, Align Alignment) override
Definition ARMConstantPoolValue.cpp:239
void print(raw_ostream &O) const override
print - Implement operator<<
Definition ARMConstantPoolValue.cpp:254
static ARMConstantPoolSymbol * Create(LLVMContext &C, StringRef s, unsigned ID, unsigned char PCAdj)
Definition ARMConstantPoolValue.cpp:233
ARMConstantPoolValue - ARM specific constantpool value.
int getExistingMachineCPValue(MachineConstantPool *CP, Align Alignment) override
Definition ARMConstantPoolValue.cpp:75
ARMConstantPoolValue(Type *Ty, unsigned id, ARMCP::ARMCPKind Kind, unsigned char PCAdj, ARMCP::ARMCPModifier Modifier, bool AddCurrentAddress)
Definition ARMConstantPoolValue.cpp:33
void dump() const
Definition ARMConstantPoolValue.cpp:102
~ARMConstantPoolValue() override
void print(raw_ostream &O) const override
print - Implement operator<<
Definition ARMConstantPoolValue.cpp:107
int getExistingMachineCPValueImpl(MachineConstantPool *CP, Align Alignment)
StringRef getModifierText() const
Definition ARMConstantPoolValue.cpp:53
virtual bool hasSameValue(ARMConstantPoolValue *ACPV)
hasSameValue - Return true if this ARM constpool value can share the same constantpool entry as anoth...
Definition ARMConstantPoolValue.cpp:87
void addSelectionDAGCSEId(FoldingSetNodeID &ID) override
Definition ARMConstantPoolValue.cpp:81
The address of a basic block.
This is an important base class in LLVM.
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
This is an important class for using LLVM in a threaded context.
MachineConstantPoolValue(Type *ty)
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
LLVM_ABI LLVMContext & getContext() const
All values hold a context through their type.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ SECREL
Thread Pointer Offset.
@ GOT_PREL
Thread Local Storage (General Dynamic Mode)
@ SBREL
Section Relative (Windows TLS)
@ GOTTPOFF
Global Offset Table, PC Relative.
@ TPOFF
Global Offset Table, Thread Pointer Offset.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast - Return the argument parameter cast to the specified type.
auto dyn_cast_or_null(const Y &Val)
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
decltype(auto) cast(const From &Val)
cast - Return the argument parameter cast to the specified type.
LLVM_ABI Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
Implement std::hash so that hash_code can be used in STL containers.
This struct is a compact representation of a valid (non-zero power of two) alignment.