diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-07-18 00:44:37 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-07-18 00:44:37 +0000 |
commit | 518310cb0d136906ff0a99d7a24cb460794de5bf (patch) | |
tree | d8ad6b32edf261c90ce2c190f4c74dc3d044502f /lib/Target/SparcV9/SparcV9AsmPrinter.cpp | |
parent | 593eb952281138e1877adbfb11b88b6e32fdd732 (diff) |
bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14953 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SparcV9/SparcV9AsmPrinter.cpp')
-rw-r--r-- | lib/Target/SparcV9/SparcV9AsmPrinter.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp index aa18345255..addcbdcc0c 100644 --- a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp +++ b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp @@ -317,11 +317,8 @@ void AsmPrinter::printSingleConstantValue(const Constant* CV) { toAsm << "\t" << TypeToDataDirective(CV->getType()) << "\t"; - 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. - assert(isa<GlobalValue>(CPR->getValue()) && "Unexpected non-global"); - toAsm << getID(CPR->getValue()) << "\n"; + if (const GlobalValue* GV = dyn_cast<GlobalValue>(CV)) { + toAsm << getID(GV) << "\n"; } else if (isa<ConstantPointerNull>(CV)) { // Null pointer value toAsm << "0\n"; @@ -480,7 +477,9 @@ std::string AsmPrinter::valToExprString(const Value* V, const TargetMachine& target) { std::string S; bool failed = false; - if (const Constant* CV = dyn_cast<Constant>(V)) { // symbolic or known + if (const GlobalValue* GV = dyn_cast<GlobalValue>(V)) { + S += getID(GV); + } else if (const Constant* CV = dyn_cast<Constant>(V)) { // symbolic or known if (const ConstantBool *CB = dyn_cast<ConstantBool>(CV)) S += std::string(CB == ConstantBool::True ? "1" : "0"); else if (const ConstantSInt *CI = dyn_cast<ConstantSInt>(CV)) @@ -491,14 +490,10 @@ std::string AsmPrinter::valToExprString(const Value* V, S += ftostr(CFP->getValue()); else if (isa<ConstantPointerNull>(CV)) S += "0"; - else if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(CV)) - S += valToExprString(CPR->getValue(), target); else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) S += ConstantExprToString(CE, target); else failed = true; - } else if (const GlobalValue* GV = dyn_cast<GlobalValue>(V)) { - S += getID(GV); } else failed = true; |