diff options
Diffstat (limited to 'contrib/llvm/lib/Target/ARM/ARMConstantPoolValue.h')
-rw-r--r-- | contrib/llvm/lib/Target/ARM/ARMConstantPoolValue.h | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/contrib/llvm/lib/Target/ARM/ARMConstantPoolValue.h b/contrib/llvm/lib/Target/ARM/ARMConstantPoolValue.h index c07331d..5f61832 100644 --- a/contrib/llvm/lib/Target/ARM/ARMConstantPoolValue.h +++ b/contrib/llvm/lib/Target/ARM/ARMConstantPoolValue.h @@ -24,6 +24,7 @@ namespace llvm { class BlockAddress; class Constant; class GlobalValue; +class GlobalVariable; class LLVMContext; class MachineBasicBlock; @@ -33,7 +34,8 @@ namespace ARMCP { CPExtSymbol, CPBlockAddress, CPLSDA, - CPMachineBasicBlock + CPMachineBasicBlock, + CPPromotedGlobal }; enum ARMCPModifier { @@ -43,6 +45,7 @@ namespace ARMCP { GOTTPOFF, /// Global Offset Table, Thread Pointer Offset TPOFF, /// Thread Pointer Offset SECREL, /// Section Relative (Windows TLS) + SBREL, /// Static Base Relative (RWPI) }; } @@ -89,7 +92,7 @@ public: ~ARMConstantPoolValue() override; ARMCP::ARMCPModifier getModifier() const { return Modifier; } - const char *getModifierText() const; + StringRef getModifierText() const; bool hasModifier() const { return Modifier != ARMCP::no_modifier; } bool mustAddCurrentAddress() const { return AddCurrentAddress; } @@ -102,7 +105,8 @@ public: bool isBlockAddress() const { return Kind == ARMCP::CPBlockAddress; } bool isLSDA() const { return Kind == ARMCP::CPLSDA; } bool isMachineBasicBlock() const{ return Kind == ARMCP::CPMachineBasicBlock; } - + bool isPromotedGlobal() const{ return Kind == ARMCP::CPPromotedGlobal; } + int getExistingMachineCPValue(MachineConstantPool *CP, unsigned Alignment) override; @@ -132,6 +136,7 @@ inline raw_ostream &operator<<(raw_ostream &O, const ARMConstantPoolValue &V) { /// Functions, and BlockAddresses. class ARMConstantPoolConstant : public ARMConstantPoolValue { const Constant *CVal; // Constant being loaded. + const GlobalVariable *GVar = nullptr; ARMConstantPoolConstant(const Constant *C, unsigned ID, @@ -145,11 +150,14 @@ class ARMConstantPoolConstant : public ARMConstantPoolValue { unsigned char PCAdj, ARMCP::ARMCPModifier Modifier, bool AddCurrentAddress); + ARMConstantPoolConstant(const GlobalVariable *GV, const Constant *Init); public: static ARMConstantPoolConstant *Create(const Constant *C, unsigned ID); static ARMConstantPoolConstant *Create(const GlobalValue *GV, ARMCP::ARMCPModifier Modifier); + static ARMConstantPoolConstant *Create(const GlobalVariable *GV, + const Constant *Initializer); static ARMConstantPoolConstant *Create(const Constant *C, unsigned ID, ARMCP::ARMCPKind Kind, unsigned char PCAdj); @@ -161,6 +169,12 @@ public: const GlobalValue *getGV() const; const BlockAddress *getBlockAddress() const; + const GlobalVariable *getPromotedGlobal() const { + return dyn_cast_or_null<GlobalVariable>(GVar); + } + const Constant *getPromotedGlobalInit() const { + return CVal; + } int getExistingMachineCPValue(MachineConstantPool *CP, unsigned Alignment) override; @@ -173,7 +187,8 @@ public: void print(raw_ostream &O) const override; static bool classof(const ARMConstantPoolValue *APV) { - return APV->isGlobalValue() || APV->isBlockAddress() || APV->isLSDA(); + return APV->isGlobalValue() || APV->isBlockAddress() || APV->isLSDA() || + APV->isPromotedGlobal(); } bool equals(const ARMConstantPoolConstant *A) const { @@ -186,15 +201,15 @@ public: class ARMConstantPoolSymbol : public ARMConstantPoolValue { const std::string S; // ExtSymbol being loaded. - ARMConstantPoolSymbol(LLVMContext &C, const char *s, unsigned id, + ARMConstantPoolSymbol(LLVMContext &C, StringRef s, unsigned id, unsigned char PCAdj, ARMCP::ARMCPModifier Modifier, bool AddCurrentAddress); public: - static ARMConstantPoolSymbol *Create(LLVMContext &C, const char *s, - unsigned ID, unsigned char PCAdj); + static ARMConstantPoolSymbol *Create(LLVMContext &C, StringRef s, unsigned ID, + unsigned char PCAdj); - const char *getSymbol() const { return S.c_str(); } + StringRef getSymbol() const { return S; } int getExistingMachineCPValue(MachineConstantPool *CP, unsigned Alignment) override; |