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

Tanya Brethour tbrethou at cs.uiuc.edu
Sun May 23 15:59:09 PDT 2004


Changes in directory llvm/lib/CodeGen:

MachineInstr.cpp updated: 1.97 -> 1.98

---
Log message:

Fixed up my changes to add support for cloning Machine Instructions.


---
Diffs of the changes:  (+3 -2)

Index: llvm/lib/CodeGen/MachineInstr.cpp
diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.97 llvm/lib/CodeGen/MachineInstr.cpp:1.98
--- llvm/lib/CodeGen/MachineInstr.cpp:1.97	Sun May 23 14:35:04 2004
+++ llvm/lib/CodeGen/MachineInstr.cpp	Sun May 23 15:57:57 2004
@@ -73,7 +73,8 @@
 MachineInstr::MachineInstr(const MachineInstr &MI) {
   Opcode = MI.getOpcode();
   numImplicitRefs = MI.getNumImplicitRefs();
- 
+  operands.reserve(MI.getNumOperands());
+
   //Add operands
   for(unsigned i=0; i < MI.getNumOperands(); ++i)
     operands.push_back(MachineOperand(MI.getOperand(i)));
@@ -89,7 +90,7 @@
 ///all ways except the following: The instruction has no parent The
 ///instruction has no name
 MachineInstr* MachineInstr::clone() {
-  MachineInstr* newInst = new MachineInstr(*this);
+  return new MachineInstr(*this);
 }
 
 /// OperandComplete - Return true if it's illegal to add a new operand





More information about the llvm-commits mailing list