diff options
author | Tanya Lattner <tonic@nondot.org> | 2004-05-23 19:35:12 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2004-05-23 19:35:12 +0000 |
commit | e6a4a7dbcfe75249d9d4fbfbb369f002777fd484 (patch) | |
tree | 32fa511bb3226e132fdf69b8fc4e58e46a2aa788 /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | 3e58f5880abb8245726602691bce4cd6c24cdb93 (diff) | |
download | bcm5719-llvm-e6a4a7dbcfe75249d9d4fbfbb369f002777fd484.tar.gz bcm5719-llvm-e6a4a7dbcfe75249d9d4fbfbb369f002777fd484.zip |
Adding support to clone MachineInstr
llvm-svn: 13661
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 38cd62e83f5..e1e44fd47e0 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -69,11 +69,29 @@ MachineInstr::MachineInstr(MachineBasicBlock *MBB, short opcode, 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 @@ void MachineInstr::replace(short opcode, unsigned numOperands) { Opcode = opcode; operands.clear(); operands.resize(numOperands, MachineOperand()); + } void MachineInstr::SetMachineOperandVal(unsigned i, |