diff options
| author | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-07-09 12:30:29 +0000 |
|---|---|---|
| committer | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-07-09 12:30:29 +0000 |
| commit | a3697666ebafcc4b47adcc967aff1af27b4715c9 (patch) | |
| tree | 0f562d5856c444cb6fc5a533978c7394ca30894a /llvm/lib/Target | |
| parent | 24132e8983cfb1edfdf05492eb20d563119012be (diff) | |
| download | bcm5719-llvm-a3697666ebafcc4b47adcc967aff1af27b4715c9.tar.gz bcm5719-llvm-a3697666ebafcc4b47adcc967aff1af27b4715c9.zip | |
Added support for printing constant global references to
assembly.
llvm-svn: 2842
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/Sparc/EmitAssembly.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/Target/Sparc/EmitAssembly.cpp b/llvm/lib/Target/Sparc/EmitAssembly.cpp index b8f5b94d299..881a67e788c 100644 --- a/llvm/lib/Target/Sparc/EmitAssembly.cpp +++ b/llvm/lib/Target/Sparc/EmitAssembly.cpp @@ -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"); |

