Fix miscompilations in the SparcV9 backend that were induced by this patch:
authorChris Lattner <sabre@nondot.org>
Mon, 18 Oct 2004 17:19:20 +0000 (17:19 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 18 Oct 2004 17:19:20 +0000 (17:19 +0000)
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20041011/019311.html

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17130 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineInstr.h

index d23252e5b80a8a92e3dfbd034b9df5e729dab1cd..d9a865e0a696feed89f210f0c106e4535a5affe5 100644 (file)
@@ -153,10 +153,20 @@ private:
   }
 
   MachineOperand(Value *V, MachineOperandType OpTy, UseType UseTy,
+                bool isPCRelative = false)
+    : flags(UseTy | (isPCRelative?PCRELATIVE:0)), opType(OpTy) {
+    assert(OpTy != MachineOperand::MO_GlobalAddress);
+    zeroContents();
+    contents.value = V;
+    extra.regNum = -1;
+  }
+
+  MachineOperand(GlobalValue *V, MachineOperandType OpTy, UseType UseTy,
                 bool isPCRelative = false, int Offset = 0)
     : flags(UseTy | (isPCRelative?PCRELATIVE:0)), opType(OpTy) {
+    assert(OpTy == MachineOperand::MO_GlobalAddress);
     zeroContents ();
-    contents.value = V;
+    contents.value = (Value*)V;
     extra.offset = Offset;
   }
 
@@ -642,7 +652,7 @@ public:
     assert(!OperandsComplete() &&
            "Trying to add an operand to a machine instr that is already done!");
     operands.push_back(
-      MachineOperand((Value*)GV, MachineOperand::MO_GlobalAddress,
+      MachineOperand(GV, MachineOperand::MO_GlobalAddress,
                      MachineOperand::Use, isPCRelative, Offset));
   }