Changes in directory llvm/lib/CodeGen:
MachineInstr.cpp updated: 1.120 -> 1.121 --- Log message: Remove redundancy and a level of indirection when creating machine operands --- Diffs of the changes: (+5 -21) MachineInstr.cpp | 26 +++++--------------------- 1 files changed, 5 insertions(+), 21 deletions(-) Index: llvm/lib/CodeGen/MachineInstr.cpp diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.120 llvm/lib/CodeGen/MachineInstr.cpp:1.121 --- llvm/lib/CodeGen/MachineInstr.cpp:1.120 Thu May 4 13:16:01 2006 +++ llvm/lib/CodeGen/MachineInstr.cpp Thu May 4 14:14:44 2006 @@ -43,7 +43,7 @@ /// MachineInstr::MachineInstr(short opcode, unsigned numOperands) : Opcode(opcode), parent(0) { - operands.reserve(numOperands); + Operands.reserve(numOperands); // Make sure that we get added to a machine basicblock LeakDetector::addGarbageObject(this); } @@ -55,7 +55,7 @@ unsigned numOperands) : Opcode(opcode), parent(0) { assert(MBB && "Cannot use inserting ctor with null basic block!"); - operands.reserve(numOperands); + Operands.reserve(numOperands); // Make sure that we get added to a machine basicblock LeakDetector::addGarbageObject(this); MBB->push_back(this); // Add instruction to end of basic block! @@ -65,11 +65,11 @@ /// MachineInstr::MachineInstr(const MachineInstr &MI) { Opcode = MI.getOpcode(); - operands.reserve(MI.getNumOperands()); + Operands.reserve(MI.getNumOperands()); // Add operands - for (unsigned i = 0; i < MI.getNumOperands(); ++i) - operands.push_back(MachineOperand(MI.getOperand(i))); + for (unsigned i = 0; i != MI.getNumOperands(); ++i) + Operands.push_back(MI.getOperand(i)); // Set parent, next, and prev to null parent = 0; @@ -82,13 +82,6 @@ LeakDetector::removeGarbageObject(this); } -/// clone - Create a copy of 'this' instruction that is identical in all ways -/// except the following: the new instruction has no parent and it has no name -/// -MachineInstr* MachineInstr::clone() const { - return new MachineInstr(*this); -} - /// removeFromParent - This method unlinks 'this' from the containing basic /// block, and returns it, but does not delete it. MachineInstr *MachineInstr::removeFromParent() { @@ -111,15 +104,6 @@ std::cerr << " " << *this; } -static inline std::ostream& OutputValue(std::ostream &os, const Value* val) { - os << "(val "; - os << (void*) val; // print address always - if (val && val->hasName()) - os << " " << val->getName(); // print name also, if available - os << ")"; - return os; -} - static inline void OutputReg(std::ostream &os, unsigned RegNo, const MRegisterInfo *MRI = 0) { if (!RegNo || MRegisterInfo::isPhysicalRegister(RegNo)) { _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits