diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/MachineFunction.cpp | 21 | ||||
-rw-r--r-- | lib/Target/ARM/ARMConstantPoolValue.h | 7 |
2 files changed, 27 insertions, 1 deletions
diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp index 599efb8bd2..e6ae7dc224 100644 --- a/lib/CodeGen/MachineFunction.cpp +++ b/lib/CodeGen/MachineFunction.cpp @@ -539,10 +539,29 @@ void MachineJumpTableInfo::dump() const { print(*cerr.stream()); } const Type *MachineConstantPoolEntry::getType() const { if (isMachineConstantPoolEntry()) - return Val.MachineCPVal->getType(); + return Val.MachineCPVal->getType(); return Val.ConstVal->getType(); } + +unsigned MachineConstantPoolEntry::getRelocatationInfo() const { + if (isMachineConstantPoolEntry()) + return Val.MachineCPVal->getRelocatationInfo(); + + // FIXME: This API sucks. + + // If no relocations, return 0. + if (!Val.ConstVal->ContainsRelocations()) + return 0; + + // If it contains no global relocations, return 1. + if (!Val.ConstVal->ContainsRelocations(Reloc::Global)) + return 1; + + // Otherwise, it has general relocations. + return 2; +} + MachineConstantPool::~MachineConstantPool() { for (unsigned i = 0, e = Constants.size(); i != e; ++i) if (Constants[i].isMachineConstantPoolEntry()) diff --git a/lib/Target/ARM/ARMConstantPoolValue.h b/lib/Target/ARM/ARMConstantPoolValue.h index abf7339646..a9308898c8 100644 --- a/lib/Target/ARM/ARMConstantPoolValue.h +++ b/lib/Target/ARM/ARMConstantPoolValue.h @@ -65,6 +65,13 @@ public: bool isStub() const { return Kind == ARMCP::CPStub; } unsigned char getPCAdjustment() const { return PCAdjust; } + virtual unsigned getRelocatationInfo() const { + // FIXME: This is conservatively claiming that these entries require a + // relocation, we may be able to do better than this. + return 2; + } + + virtual int getExistingMachineCPValue(MachineConstantPool *CP, unsigned Alignment); |