Added LLVM copyright header (for lack of a better term).
[oota-llvm.git] / include / llvm / CodeGen / MachineInstr.h
index 721b513c747d0d5b4bd6d0186ae9e7ca459a569e..fc886d97f54830e7919067e89d2ea8bb013069f0 100644 (file)
@@ -1,7 +1,14 @@
-//===-- llvm/CodeGen/MachineInstr.h - MachineInstr class ---------*- C++ -*--=//
+//===-- llvm/CodeGen/MachineInstr.h - MachineInstr class --------*- C++ -*-===//
+// 
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// 
+//===----------------------------------------------------------------------===//
 //
 // This file contains the declaration of the MachineInstr class, which is the
-// basic representation for all target dependant machine instructions used by
+// basic representation for all target dependent machine instructions used by
 // the back end.
 //
 //===----------------------------------------------------------------------===//
@@ -12,7 +19,6 @@
 #include "llvm/Target/MRegisterInfo.h"
 #include "Support/Annotation.h"
 #include "Support/iterator"
-#include <set>
 
 class Value;
 class Function;
@@ -190,6 +196,8 @@ public:
   }
   
   const MachineOperand &operator=(const MachineOperand &MO) {
+    if (isExternalSymbol())             // if old operand had a symbol name,
+      delete SymbolName;                // release old memory
     immedVal = MO.immedVal;
     flags    = MO.flags;
     opType   = MO.opType;
@@ -344,10 +352,6 @@ class MachineInstr {
   std::vector<MachineOperand> operands; // the operands
   unsigned numImplicitRefs;             // number of implicit operands
 
-  // regsUsed - all machine registers used for this instruction, including regs
-  // used to save values across the instruction.  This is a bitset of registers.
-  std::set<int>    regsUsed;
-
   // OperandComplete - Return true if it's illegal to add a new operand
   bool OperandsComplete() const;
 
@@ -430,27 +434,10 @@ public:
     ++numImplicitRefs;
     addRegOperand(V, isDef, isDefAndUse);
   }
-  void setImplicitRef(unsigned i, Value* V, bool isDef=false,
-                      bool isDefAndUse=false) {
+  void setImplicitRef(unsigned i, Value* V) {
     assert(i < getNumImplicitRefs() && "setImplicitRef() out of range!");
     SetMachineOperandVal(i + getNumOperands(),
-                         MachineOperand::MO_VirtualRegister,
-                         V, isDef, isDefAndUse);
-  }
-
-  //
-  // Information about registers used in this instruction.
-  // 
-  const std::set<int> &getRegsUsed() const {
-    return regsUsed;
-  }
-  bool isRegUsed(int regNum) const {
-    return regsUsed.find(regNum) != regsUsed.end();
-  }
-  
-  // insertusedreg - Add a register to the Used registers set...
-  void insertUsedReg(unsigned Reg) {
-    regsUsed.insert((int) Reg);
+                         MachineOperand::MO_VirtualRegister, V);
   }
 
   //
@@ -534,7 +521,6 @@ public:
            "Trying to add an operand to a machine instr that is already done!");
     operands.push_back(MachineOperand(reg, MachineOperand::MO_MachineRegister,
                                       isDef ? MOTy::Def : MOTy::Use));
-    insertUsedReg(reg);
   }
 
   /// addMachineRegOperand - Add a virtual register operand to this MachineInstr
@@ -544,7 +530,6 @@ public:
            "Trying to add an operand to a machine instr that is already done!");
     operands.push_back(MachineOperand(reg, MachineOperand::MO_MachineRegister,
                                       UTy));
-    insertUsedReg(reg);
   }
 
   /// addZeroExtImmOperand - Add a zero extended constant argument to the
@@ -630,21 +615,18 @@ public:
   // 
   void SetMachineOperandVal     (unsigned i,
                                  MachineOperand::MachineOperandType operandType,
-                                 Value* V,
-                                 bool isDef=false,
-                                 bool isDefAndUse=false);
+                                 Value* V);
 
   void SetMachineOperandConst   (unsigned i,
                                  MachineOperand::MachineOperandType operandType,
                                  int64_t intValue);
 
-  void SetMachineOperandReg     (unsigned i,
-                                 int regNum,
-                                 bool isDef=false);
+  void SetMachineOperandReg(unsigned i, int regNum);
 
 
   unsigned substituteValue(const Value* oldVal, Value* newVal,
-                           bool defsOnly = true);
+                           bool defsOnly, bool notDefsAndUses,
+                           bool& someArgsWereIgnored);
 
   void setOperandHi32(unsigned i) { operands[i].markHi32(); }
   void setOperandLo32(unsigned i) { operands[i].markLo32(); }