[llvm-commits] CVS: llvm/lib/CodeGen/MachineInstr.cpp

Tanya Brethour tbrethou at cs.uiuc.edu
Sun May 23 14:36:08 PDT 2004


Changes in directory llvm/lib/CodeGen:

MachineInstr.cpp updated: 1.96 -> 1.97

---
Log message:

Adding support to clone MachineInstr



---
Diffs of the changes:  (+19 -0)

Index: llvm/lib/CodeGen/MachineInstr.cpp
diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.96 llvm/lib/CodeGen/MachineInstr.cpp:1.97
--- llvm/lib/CodeGen/MachineInstr.cpp:1.96	Wed Mar  3 13:07:27 2004
+++ llvm/lib/CodeGen/MachineInstr.cpp	Sun May 23 14:35:04 2004
@@ -69,11 +69,29 @@
   MBB->push_back(this);  // Add instruction to end of basic block!
 }
 
+///MachineInstr ctor - Copies MachineInstr arg exactly
+MachineInstr::MachineInstr(const MachineInstr &MI) {
+  Opcode = MI.getOpcode();
+  numImplicitRefs = MI.getNumImplicitRefs();
+ 
+  //Add operands
+  for(unsigned i=0; i < MI.getNumOperands(); ++i)
+    operands.push_back(MachineOperand(MI.getOperand(i)));
+}
+
+
 MachineInstr::~MachineInstr()
 {
   LeakDetector::removeGarbageObject(this);
 }
 
+///clone - Create a copy of 'this' instruction that is identical in
+///all ways except the following: The instruction has no parent The
+///instruction has no name
+MachineInstr* MachineInstr::clone() {
+  MachineInstr* newInst = new MachineInstr(*this);
+}
+
 /// OperandComplete - Return true if it's illegal to add a new operand
 ///
 bool MachineInstr::OperandsComplete() const {
@@ -93,6 +111,7 @@
   Opcode = opcode;
   operands.clear();
   operands.resize(numOperands, MachineOperand());
+
 }
 
 void MachineInstr::SetMachineOperandVal(unsigned i,





More information about the llvm-commits mailing list