mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-10 08:40:41 +00:00
Added support for printing constant global references to
assembly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2842 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d60aedef05
commit
ec0de5cb4b
@ -642,16 +642,22 @@ SparcModuleAsmPrinter::printSingleConstant(const Constant* CV)
|
||||
WriteAsOperand(toAsm, CV, false, false) << "\n";
|
||||
}
|
||||
}
|
||||
else if (const ConstantPointerRef* CPR = dyn_cast<ConstantPointerRef>(CV))
|
||||
{ // This is a constant address for a global variable or method.
|
||||
// Use the name of the variable or method as the address value.
|
||||
if (const GlobalVariable* GV = dyn_cast<GlobalVariable>(CPR->getValue()))
|
||||
toAsm << getID(GV);
|
||||
else if (const Function* F = dyn_cast<Function>(CPR->getValue()))
|
||||
toAsm << getID(F);
|
||||
else
|
||||
assert(0 && "Unexpected constant reference type");
|
||||
}
|
||||
else if (const ConstantPointer* CPP = dyn_cast<ConstantPointer>(CV))
|
||||
{
|
||||
assert(CPP->isNullValue() &&
|
||||
"Cannot yet print non-null pointer constants to assembly");
|
||||
toAsm << "0\n";
|
||||
}
|
||||
else if (isa<ConstantPointerRef>(CV))
|
||||
{
|
||||
assert(0 && "Cannot yet initialize pointer refs in assembly");
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(0 && "Unknown elementary type for constant");
|
||||
|
Loading…
x
Reference in New Issue
Block a user