Change "value" in MachineOperand to be a GlobalValue, as that is the only
authorChris Lattner <sabre@nondot.org>
Thu, 4 May 2006 17:02:51 +0000 (17:02 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 4 May 2006 17:02:51 +0000 (17:02 +0000)
thing that can be in it.  Remove a dead method.

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

include/llvm/CodeGen/MachineInstr.h
include/llvm/CodeGen/MachineInstrBuilder.h
lib/CodeGen/MachineInstr.cpp

index 1059b7c3d505f00260f397b5f065f71941eaead6..a0b8d1ad431bd69b4ed033acaf624f29ae499444 100644 (file)
@@ -74,15 +74,8 @@ public:
 
 private:
   union {
-    Value*  value;      // BasicBlockVal for a label operand.
-                        // ConstantVal for a non-address immediate.
-                        // Virtual register for an SSA operand,
-                        //   including hidden operands required for
-                        //   the generated machine code.
-                        // LLVM global for MO_GlobalAddress.
-
+    GlobalValue *GV;    // LLVM global for MO_GlobalAddress.
     int64_t immedVal;   // Constant value for an explicit constant
-
     MachineBasicBlock *MBB;     // For MO_MachineBasicBlock type
     const char *SymbolName;     // For MO_ExternalSymbol type
   } contents;
@@ -90,36 +83,32 @@ private:
   char flags;                   // see bit field definitions above
   MachineOperandType opType:8;  // Pack into 8 bits efficiently after flags.
   union {
-    int regNum;                 // register number for an explicit register
-                                // will be set for a value after reg allocation
-
-    int offset;                 // Offset to address of global or external, only
-                                // valid for MO_GlobalAddress, MO_ExternalSym
-                                // and MO_ConstantPoolIndex
+    int regNum;     // register number for an explicit register
+    int offset;     // Offset to address of global or external, only
+                    // valid for MO_GlobalAddress, MO_ExternalSym
+                    // and MO_ConstantPoolIndex
   } extra;
 
-  void zeroContents () {
-    memset (&contents, 0, sizeof (contents));
-    memset (&extra, 0, sizeof (extra));
+  void zeroContents() {
+    contents.immedVal = 0;
+    extra.offset = 0;
   }
 
   MachineOperand(int64_t ImmVal, MachineOperandType OpTy, int Offset = 0)
     : flags(0), opType(OpTy) {
-    zeroContents ();
     contents.immedVal = ImmVal;
     extra.offset = Offset;
   }
 
   MachineOperand(int Reg, MachineOperandType OpTy, UseType UseTy)
     : flags(UseTy), opType(OpTy) {
-    zeroContents ();
+    zeroContents();
     extra.regNum = Reg;
   }
 
   MachineOperand(GlobalValue *V, int Offset = 0)
     : flags(MachineOperand::Use), opType(MachineOperand::MO_GlobalAddress) {
-    zeroContents ();
-    contents.value = (Value*)V;
+    contents.GV = V;
     extra.offset = Offset;
   }
 
@@ -206,7 +195,7 @@ public:
   }
   GlobalValue *getGlobal() const {
     assert(isGlobalAddress() && "Wrong MachineOperand accessor");
-    return (GlobalValue*)contents.value;
+    return contents.GV;
   }
   int getOffset() const {
     assert((isGlobalAddress() || isExternalSymbol() || isConstantPoolIndex()) &&
@@ -476,10 +465,6 @@ public:
 
   // Access to set the operands when building the machine instruction
   //
-  void SetMachineOperandVal(unsigned i,
-                            MachineOperand::MachineOperandType operandType,
-                            Value* V);
-
   void SetMachineOperandConst(unsigned i,
                               MachineOperand::MachineOperandType operandType,
                               int intValue);
index c2944c0369630cdcfbf9b1085433a6afdbfa2b4f..384cb709679c2ca3c8d0ca066feac70de6e24c00 100644 (file)
@@ -8,13 +8,7 @@
 //===----------------------------------------------------------------------===//
 //
 // This file exposes a function named BuildMI, which is useful for dramatically
-// simplifying how MachineInstr's are created.  Instead of using code like this:
-//
-//   M = new MachineInstr(X86::ADDrr8);
-//   M->SetMachineOperandVal(0, MachineOperand::MO_VirtualRegister, argVal1);
-//   M->SetMachineOperandVal(1, MachineOperand::MO_VirtualRegister, argVal2);
-//
-// we can now use code like this:
+// simplifying how MachineInstr's are created.  It allows use of code like this:
 //
 //   M = BuildMI(X86::ADDrr8, 2).addReg(argVal1).addReg(argVal2);
 //
index e300993a10faf5b55dd476dc6166c87ceabe718a..dad1e1f2e789fac922c238bc20233b05f8f8226e 100644 (file)
@@ -107,33 +107,22 @@ bool MachineInstr::OperandsComplete() const {
   return false;
 }
 
-void MachineInstr::SetMachineOperandVal(unsigned i,
-                                        MachineOperand::MachineOperandType opTy,
-                                        Value* V) {
-  assert(i < operands.size());          // may be explicit or implicit op
-  operands[i].opType = opTy;
-  operands[i].contents.value = V;
-  operands[i].extra.regNum = -1;
-}
-
 void
 MachineInstr::SetMachineOperandConst(unsigned i,
                                      MachineOperand::MachineOperandType opTy,
                                      int intValue) {
-  assert(i < getNumOperands());          // must be explicit op
-
+  assert(i < getNumOperands());
   operands[i].opType = opTy;
-  operands[i].contents.value = NULL;
   operands[i].contents.immedVal = intValue;
   operands[i].extra.regNum = -1;
   operands[i].flags = 0;
 }
 
 void MachineInstr::SetMachineOperandReg(unsigned i, int regNum) {
-  assert(i < getNumOperands());          // must be explicit op
+  assert(i < getNumOperands());
 
   operands[i].opType = MachineOperand::MO_VirtualRegister;
-  operands[i].contents.value = NULL;
+  operands[i].contents.GV = NULL;
   operands[i].extra.regNum = regNum;
 }