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

151}

152

155 const Constant *Initializer) {

157}

158

164 Modifier, false);

165}

166

172}

173

178 bool AddCurrentAddress) {

180 AddCurrentAddress);

181}

182

184 return dyn_cast_or_null(CVal);

185}

186

188 return dyn_cast_or_null(CVal);

189}

190

192 Align Alignment) {

193 int index =

194 getExistingMachineCPValueImpl(CP, Alignment);

195 if (index != -1) {

197 CP->getConstants()[index].Val.MachineCPVal);

198 auto *Constant = cast(CPV);

199 Constant->GVars.insert(GVars.begin(), GVars.end());

200 }

201 return index;

202}

203

207}

208

210 ID.AddPointer(CVal);

211 for (const auto *GV : GVars)

212 ID.AddPointer(GV);

214}

215

219}

220

221

222

223

224

226 unsigned id, unsigned char PCAdj,

228 bool AddCurrentAddress)

230 AddCurrentAddress),

232

235 unsigned char PCAdj) {

237}

238

240 Align Alignment) {

241 return getExistingMachineCPValueImpl(CP, Alignment);

242}

243

247}

248

250 ID.AddString(S);

252}

253

255 O << S;

257}

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) {

281 return getExistingMachineCPValueImpl(CP, Alignment);

282}

283

285 const ARMConstantPoolMBB *ACPMBB = dyn_cast(ACPV);

286 return ACPMBB && ACPMBB->MBB == MBB &&

288}

289

291 ID.AddPointer(MBB);

293}

294

298}

#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

static ARMConstantPoolConstant * Create(const Constant *C, unsigned ID)

bool hasSameValue(ARMConstantPoolValue *ACPV) override

hasSameValue - Return true if this ARM constpool value can share the same constantpool entry as anoth...

void print(raw_ostream &O) const override

print - Implement operator<<

const BlockAddress * getBlockAddress() const

void addSelectionDAGCSEId(FoldingSetNodeID &ID) override

int getExistingMachineCPValue(MachineConstantPool *CP, Align Alignment) override

ARMConstantPoolMBB - ARM-specific constantpool value of a machine basic block.

int getExistingMachineCPValue(MachineConstantPool *CP, Align Alignment) override

void addSelectionDAGCSEId(FoldingSetNodeID &ID) override

static ARMConstantPoolMBB * Create(LLVMContext &C, const MachineBasicBlock *mbb, unsigned ID, unsigned char PCAdj)

bool hasSameValue(ARMConstantPoolValue *ACPV) override

hasSameValue - Return true if this ARM constpool value can share the same constantpool entry as anoth...

void print(raw_ostream &O) const override

print - Implement operator<<

ARMConstantPoolSymbol - ARM-specific constantpool values for external symbols.

void addSelectionDAGCSEId(FoldingSetNodeID &ID) override

bool hasSameValue(ARMConstantPoolValue *ACPV) override

hasSameValue - Return true if this ARM constpool value can share the same constantpool entry as anoth...

int getExistingMachineCPValue(MachineConstantPool *CP, Align Alignment) override

void print(raw_ostream &O) const override

print - Implement operator<<

static ARMConstantPoolSymbol * Create(LLVMContext &C, StringRef s, unsigned ID, unsigned char PCAdj)

ARMConstantPoolValue - ARM specific constantpool value.

int getExistingMachineCPValue(MachineConstantPool *CP, Align Alignment) override

ARMConstantPoolValue(Type *Ty, unsigned id, ARMCP::ARMCPKind Kind, unsigned char PCAdj, ARMCP::ARMCPModifier Modifier, bool AddCurrentAddress)

~ARMConstantPoolValue() override

void print(raw_ostream &O) const override

print - Implement operator<<

StringRef getModifierText() const

virtual bool hasSameValue(ARMConstantPoolValue *ACPV)

hasSameValue - Return true if this ARM constpool value can share the same constantpool entry as anoth...

void addSelectionDAGCSEId(FoldingSetNodeID &ID) override

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.

Abstract base class for all machine specific constantpool value subclasses.

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 IntegerType * getInt32Ty(LLVMContext &C)

LLVMContext & getContext() const

All values hold a context through their type.

StringRef getName() const

Return a constant reference to the value's name.

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.

@ C

The default llvm calling convention, compatible with C.

This is an optimization pass for GlobalISel generic memory operations.

raw_fd_ostream & errs()

This returns a reference to a raw_ostream for standard error.

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.