contents.SymbolName = new std::string(M.getSymbolName());
}
+
~MachineOperand() {
if (isExternalSymbol())
delete contents.SymbolName;
// OperandComplete - Return true if it's illegal to add a new operand
bool OperandsComplete() const;
- MachineInstr(const MachineInstr &); // DO NOT IMPLEMENT
+ //Constructor used by clone() method
+ MachineInstr(const MachineInstr&);
+
void operator=(const MachineInstr&); // DO NOT IMPLEMENT
// Intrusive list support
const MachineBasicBlock* getParent() const { return parent; }
MachineBasicBlock* getParent() { return parent; }
+ //void setParent(const MachineBasicBlock *MBB) { parent = MBB; }
+ void setParent(MachineBasicBlock *MBB) { parent = MBB; }
+
/// getOpcode - Returns the opcode of this MachineInstr.
///
const int getOpcode() const { return Opcode; }
MachineOperand::MO_VirtualRegister, V);
}
+ //Clone Instruction
+ //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* clone();
+
//
// Debugging support
//
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 {
Opcode = opcode;
operands.clear();
operands.resize(numOperands, MachineOperand());
+
}
void MachineInstr::SetMachineOperandVal(unsigned i,