From b56b3b5eeb0e7f84f68d044293840acf7259b3a1 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 18 Jul 2004 07:26:17 +0000 Subject: [PATCH] CPR fixes llvm-svn: 14960 --- lib/Target/SparcV8/InstSelectSimple.cpp | 7 +++---- lib/Target/SparcV8/SparcV8AsmPrinter.cpp | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Target/SparcV8/InstSelectSimple.cpp b/lib/Target/SparcV8/InstSelectSimple.cpp index bc1f6c40f73..ac33ef574b8 100644 --- a/lib/Target/SparcV8/InstSelectSimple.cpp +++ b/lib/Target/SparcV8/InstSelectSimple.cpp @@ -288,14 +288,13 @@ void V8ISel::copyConstantToRegister(MachineBasicBlock *MBB, } else if (isa(C)) { // Copy zero (null pointer) to the register. BuildMI (*MBB, IP, V8::ORri, 2, R).addReg (V8::G0).addSImm (0); - } else if (ConstantPointerRef *CPR = dyn_cast(C)) { + } else if (GlobalValue *GV = dyn_cast(C)) { // Copy it with a SETHI/OR pair; the JIT + asmwriter should recognize // that SETHI %reg,global == SETHI %reg,%hi(global) and // OR %reg,global,%reg == OR %reg,%lo(global),%reg. unsigned TmpReg = makeAnotherReg (C->getType ()); - BuildMI (*MBB, IP, V8::SETHIi, 1, TmpReg).addGlobalAddress (CPR->getValue()); - BuildMI (*MBB, IP, V8::ORri, 2, R).addReg (TmpReg) - .addGlobalAddress (CPR->getValue ()); + BuildMI (*MBB, IP, V8::SETHIi, 1, TmpReg).addGlobalAddress(GV); + BuildMI (*MBB, IP, V8::ORri, 2, R).addReg(TmpReg).addGlobalAddress(GV); } else { std::cerr << "Offending constant: " << *C << "\n"; assert (0 && "Can't copy this kind of constant into register yet"); diff --git a/lib/Target/SparcV8/SparcV8AsmPrinter.cpp b/lib/Target/SparcV8/SparcV8AsmPrinter.cpp index 34cdade711b..973d7e4f87b 100644 --- a/lib/Target/SparcV8/SparcV8AsmPrinter.cpp +++ b/lib/Target/SparcV8/SparcV8AsmPrinter.cpp @@ -143,10 +143,10 @@ void V8Printer::emitConstantValueOnly(const Constant *CV) { O << (unsigned long long)CI->getValue(); else if (const ConstantUInt *CI = dyn_cast(CV)) O << CI->getValue(); - else if (const ConstantPointerRef *CPR = dyn_cast(CV)) + else if (const GlobalValue *GV = dyn_cast(CV)) // This is a constant address for a global variable or function. Use the // name of the variable or function as the address value. - O << Mang->getValueName(CPR->getValue()); + O << Mang->getValueName(GV); else if (const ConstantExpr *CE = dyn_cast(CV)) { const TargetData &TD = TM.getTargetData(); switch(CE->getOpcode()) {