mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 21:24:00 +00:00
add an API so target-independent codegen can determine if a constant
pool entry will require relocations against it. I implemented this conservatively for ARM, someone who is knowledgable about it should see if this can be improved. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76678 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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())
|
||||
|
Reference in New Issue
Block a user