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

lib/Target/Sparc/InstSelectSimple.cpp
lib/Target/Sparc/SparcAsmPrinter.cpp
lib/Target/Sparc/SparcV8ISelSimple.cpp
lib/Target/SparcV8/InstSelectSimple.cpp
lib/Target/SparcV8/SparcV8AsmPrinter.cpp
lib/Target/SparcV8/SparcV8ISelSimple.cpp

index bc1f6c40f73ee971bc5caf09227d9003c671315c..ac33ef574b8ff7a40efda02c0fd02e0a440ea0e2 100644 (file)
@@ -288,14 +288,13 @@ void V8ISel::copyConstantToRegister(MachineBasicBlock *MBB,
   } else if (isa<ConstantPointerNull>(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<ConstantPointerRef>(C)) {
+  } else if (GlobalValue *GV = dyn_cast<GlobalValue>(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");
index 34cdade711b48752227bf9bda092202fcd7136b1..973d7e4f87baac916a70a9531cb186290803c6f9 100644 (file)
@@ -143,10 +143,10 @@ void V8Printer::emitConstantValueOnly(const Constant *CV) {
       O << (unsigned long long)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 bc1f6c40f73ee971bc5caf09227d9003c671315c..ac33ef574b8ff7a40efda02c0fd02e0a440ea0e2 100644 (file)
@@ -288,14 +288,13 @@ void V8ISel::copyConstantToRegister(MachineBasicBlock *MBB,
   } else if (isa<ConstantPointerNull>(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<ConstantPointerRef>(C)) {
+  } else if (GlobalValue *GV = dyn_cast<GlobalValue>(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");
index bc1f6c40f73ee971bc5caf09227d9003c671315c..ac33ef574b8ff7a40efda02c0fd02e0a440ea0e2 100644 (file)
@@ -288,14 +288,13 @@ void V8ISel::copyConstantToRegister(MachineBasicBlock *MBB,
   } else if (isa<ConstantPointerNull>(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<ConstantPointerRef>(C)) {
+  } else if (GlobalValue *GV = dyn_cast<GlobalValue>(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");
index 34cdade711b48752227bf9bda092202fcd7136b1..973d7e4f87baac916a70a9531cb186290803c6f9 100644 (file)
@@ -143,10 +143,10 @@ void V8Printer::emitConstantValueOnly(const Constant *CV) {
       O << (unsigned long long)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 bc1f6c40f73ee971bc5caf09227d9003c671315c..ac33ef574b8ff7a40efda02c0fd02e0a440ea0e2 100644 (file)
@@ -288,14 +288,13 @@ void V8ISel::copyConstantToRegister(MachineBasicBlock *MBB,
   } else if (isa<ConstantPointerNull>(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<ConstantPointerRef>(C)) {
+  } else if (GlobalValue *GV = dyn_cast<GlobalValue>(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");