Start using the new function cloning header
[oota-llvm.git] / lib / CodeGen / MachineInstr.cpp
index 5ec5c2ad05a02afa7278e4cae5d428abe4bcf351..ffd2e6e68f31b07f5eee8cb82fe6f970d0f07363 100644 (file)
@@ -5,8 +5,8 @@
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/CodeGen/MachineBasicBlock.h"
 #include "llvm/Value.h"
-#include "llvm/Target/MachineInstrInfo.h"  // FIXME: shouldn't need this!
 #include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/MachineInstrInfo.h"
 #include "llvm/Target/MRegisterInfo.h"
 using std::cerr;
 
@@ -98,12 +98,13 @@ MachineInstr::SetMachineOperandVal(unsigned i,
   operands[i].opType = opType;
   operands[i].value = V;
   operands[i].regNum = -1;
-  operands[i].flags = 0;
 
-  if (isdef || TargetInstrDescriptors[opCode].resultPos == (int) i)
-    operands[i].markDef();
   if (isDefAndUse)
-    operands[i].markDefAndUse();
+    operands[i].flags = MachineOperand::DEFUSEFLAG;
+  else if (isdef || TargetInstrDescriptors[opCode].resultPos == (int) i)
+    operands[i].flags = MachineOperand::DEFFLAG;
+  else
+    operands[i].flags = 0;
 }
 
 void
@@ -131,10 +132,12 @@ MachineInstr::SetMachineOperandReg(unsigned i,
   operands[i].opType = MachineOperand::MO_MachineRegister;
   operands[i].value = NULL;
   operands[i].regNum = regNum;
-  operands[i].flags = 0;
 
   if (isdef || TargetInstrDescriptors[opCode].resultPos == (int) i)
-    operands[i].markDef();
+    operands[i].flags = MachineOperand::DEFFLAG;
+  else
+    operands[i].flags = 0;
+
   insertUsedReg(regNum);
 }
 
@@ -265,7 +268,7 @@ static void print(const MachineOperand &MO, std::ostream &OS,
     OS << ")";
 }
 
-void MachineInstr::print(std::ostream &OS, const TargetMachine &TM) {
+void MachineInstr::print(std::ostream &OS, const TargetMachine &TM) const {
   unsigned StartOp = 0;
 
    // Specialize printing if op#0 is definition