[llvm-commits] CVS: llvm/lib/Target/SparcV9/InternalGlobalMapper.cpp SparcV9AsmPrinter.cpp
LLVM
llvm at cs.uiuc.edu
Sat Jul 17 17:36:54 PDT 2004
Changes in directory llvm/lib/Target/SparcV9:
InternalGlobalMapper.cpp updated: 1.2 -> 1.3
SparcV9AsmPrinter.cpp updated: 1.115 -> 1.116
---
Log message:
bug 122: http://llvm.cs.uiuc.edu/PR122 :
- Replace ConstantPointerRef usage with GlobalValue usage
---
Diffs of the changes: (+6 -11)
Index: llvm/lib/Target/SparcV9/InternalGlobalMapper.cpp
diff -u llvm/lib/Target/SparcV9/InternalGlobalMapper.cpp:1.2 llvm/lib/Target/SparcV9/InternalGlobalMapper.cpp:1.3
--- llvm/lib/Target/SparcV9/InternalGlobalMapper.cpp:1.2 Tue Jun 8 15:08:30 2004
+++ llvm/lib/Target/SparcV9/InternalGlobalMapper.cpp Sat Jul 17 19:36:44 2004
@@ -42,7 +42,7 @@
// add a null.
if (GV.hasInternalLinkage () && GV.hasName ())
Vector.push_back (ConstantExpr::getCast
- (ConstantPointerRef::get (&GV), PointerType::get (Type::SByteTy)));
+ (&GV, PointerType::get (Type::SByteTy)));
else
Vector.push_back (ConstantPointerNull::get (PointerType::get
(Type::SByteTy)));
Index: llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp
diff -u llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp:1.115 llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp:1.116
--- llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp:1.115 Thu Jun 17 13:17:08 2004
+++ llvm/lib/Target/SparcV9/SparcV9AsmPrinter.cpp Sat Jul 17 19:36:44 2004
@@ -317,11 +317,8 @@
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 @@
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 @@
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;
More information about the llvm-commits
mailing list