CPR Fixes
authorChris Lattner <sabre@nondot.org>
Sun, 18 Jul 2004 07:29:35 +0000 (07:29 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 18 Jul 2004 07:29:35 +0000 (07:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14961 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPC32AsmPrinter.cpp
lib/Target/PowerPC/PPC32ISelSimple.cpp
lib/Target/PowerPC/PPCAsmPrinter.cpp
lib/Target/PowerPC/PowerPCAsmPrinter.cpp
lib/Target/PowerPC/PowerPCISelSimple.cpp

index e8b3ca2161aabd6eeb24665b7cf3ac14d5f50707..184922157df5d85b4bec9b7170a36d228cbce09d 100644 (file)
@@ -161,10 +161,10 @@ void Printer::emitConstantValueOnly(const Constant *CV) {
     O << CI->getValue();
   else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
     O << CI->getValue();
-  else if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(CV))
+  else if (const GlobalValue *GV = dyn_cast<GlobalValue>(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<ConstantExpr>(CV)) {
     const TargetData &TD = TM.getTargetData();
     switch(CE->getOpcode()) {
index 3b53905237d17084be27a890e16f6d4c39f3fd7a..340cbe95ef0f944316b740ec972578754a688917 100644 (file)
@@ -520,8 +520,8 @@ void ISel::copyConstantToRegister(MachineBasicBlock *MBB,
   } else if (isa<ConstantPointerNull>(C)) {
     // Copy zero (null pointer) to the register.
     BuildMI(*MBB, IP, PPC32::LI, 1, R).addImm(0);
-  } else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(C)) {
-    unsigned AddrReg = getReg(CPR->getValue(), MBB, IP);
+  } else if (GlobalValue *GV = dyn_cast<GlobalValue>(C)) {
+    unsigned AddrReg = getReg(GV, MBB, IP);
     BuildMI(*MBB, IP, PPC32::OR, 2, R).addReg(AddrReg).addReg(AddrReg);
   } else {
     std::cerr << "Offending constant: " << *C << "\n";
@@ -2771,8 +2771,6 @@ void ISel::emitGEPOperation(MachineBasicBlock *MBB,
                             Value *Src, User::op_iterator IdxBegin,
                             User::op_iterator IdxEnd, unsigned TargetReg) {
   const TargetData &TD = TM.getTargetData();
-  if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Src))
-    Src = CPR->getValue();
 
   std::vector<Value*> GEPOps;
   GEPOps.resize(IdxEnd-IdxBegin+1);
index e8b3ca2161aabd6eeb24665b7cf3ac14d5f50707..184922157df5d85b4bec9b7170a36d228cbce09d 100644 (file)
@@ -161,10 +161,10 @@ void Printer::emitConstantValueOnly(const Constant *CV) {
     O << CI->getValue();
   else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
     O << CI->getValue();
-  else if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(CV))
+  else if (const GlobalValue *GV = dyn_cast<GlobalValue>(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<ConstantExpr>(CV)) {
     const TargetData &TD = TM.getTargetData();
     switch(CE->getOpcode()) {
index e8b3ca2161aabd6eeb24665b7cf3ac14d5f50707..184922157df5d85b4bec9b7170a36d228cbce09d 100644 (file)
@@ -161,10 +161,10 @@ void Printer::emitConstantValueOnly(const Constant *CV) {
     O << CI->getValue();
   else if (const ConstantUInt *CI = dyn_cast<ConstantUInt>(CV))
     O << CI->getValue();
-  else if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(CV))
+  else if (const GlobalValue *GV = dyn_cast<GlobalValue>(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<ConstantExpr>(CV)) {
     const TargetData &TD = TM.getTargetData();
     switch(CE->getOpcode()) {
index 3b53905237d17084be27a890e16f6d4c39f3fd7a..340cbe95ef0f944316b740ec972578754a688917 100644 (file)
@@ -520,8 +520,8 @@ void ISel::copyConstantToRegister(MachineBasicBlock *MBB,
   } else if (isa<ConstantPointerNull>(C)) {
     // Copy zero (null pointer) to the register.
     BuildMI(*MBB, IP, PPC32::LI, 1, R).addImm(0);
-  } else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(C)) {
-    unsigned AddrReg = getReg(CPR->getValue(), MBB, IP);
+  } else if (GlobalValue *GV = dyn_cast<GlobalValue>(C)) {
+    unsigned AddrReg = getReg(GV, MBB, IP);
     BuildMI(*MBB, IP, PPC32::OR, 2, R).addReg(AddrReg).addReg(AddrReg);
   } else {
     std::cerr << "Offending constant: " << *C << "\n";
@@ -2771,8 +2771,6 @@ void ISel::emitGEPOperation(MachineBasicBlock *MBB,
                             Value *Src, User::op_iterator IdxBegin,
                             User::op_iterator IdxEnd, unsigned TargetReg) {
   const TargetData &TD = TM.getTargetData();
-  if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Src))
-    Src = CPR->getValue();
 
   std::vector<Value*> GEPOps;
   GEPOps.resize(IdxEnd-IdxBegin+1);