diff options
Diffstat (limited to 'lib/Target/ARM/ARMConstantPoolValue.h')
| -rw-r--r-- | lib/Target/ARM/ARMConstantPoolValue.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/Target/ARM/ARMConstantPoolValue.h b/lib/Target/ARM/ARMConstantPoolValue.h index 61c521581f79..5139a18f9263 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.h +++ b/lib/Target/ARM/ARMConstantPoolValue.h @@ -1,4 +1,4 @@ -//===-- ARMConstantPoolValue.h - ARM constantpool value ---------*- C++ -*-===// +//===- ARMConstantPoolValue.h - ARM constantpool value ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -14,7 +14,9 @@ #ifndef LLVM_LIB_TARGET_ARM_ARMCONSTANTPOOLVALUE_H #define LLVM_LIB_TARGET_ARM_ARMCONSTANTPOOLVALUE_H +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/StringRef.h" +#include "llvm/ADT/iterator_range.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/Support/Casting.h" #include <string> @@ -28,6 +30,8 @@ class GlobalValue; class GlobalVariable; class LLVMContext; class MachineBasicBlock; +class raw_ostream; +class Type; namespace ARMCP { @@ -80,8 +84,8 @@ protected: for (unsigned i = 0, e = Constants.size(); i != e; ++i) { if (Constants[i].isMachineConstantPoolEntry() && (Constants[i].getAlignment() & AlignMask) == 0) { - ARMConstantPoolValue *CPV = - (ARMConstantPoolValue *)Constants[i].Val.MachineCPVal; + auto *CPV = + static_cast<ARMConstantPoolValue*>(Constants[i].Val.MachineCPVal); if (Derived *APC = dyn_cast<Derived>(CPV)) if (cast<Derived>(this)->equals(APC)) return i; @@ -139,7 +143,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; + SmallPtrSet<const GlobalVariable*, 1> GVars; ARMConstantPoolConstant(const Constant *C, unsigned ID, @@ -173,8 +177,10 @@ public: const GlobalValue *getGV() const; const BlockAddress *getBlockAddress() const; - const GlobalVariable *getPromotedGlobal() const { - return dyn_cast_or_null<GlobalVariable>(GVar); + using promoted_iterator = SmallPtrSet<const GlobalVariable *, 1>::iterator; + + iterator_range<promoted_iterator> promotedGlobals() { + return iterator_range<promoted_iterator>(GVars.begin(), GVars.end()); } const Constant *getPromotedGlobalInit() const { |
