unsigned numOperands,
OpCodeMask _opCodeMask = 0x0);
inline ~MachineInstr () {}
+
+ //
+ // Support to rewrite a machine instruction in place: for now, simply
+ // replace() and then set new operands with Set.*Operand methods below.
+ //
+ void replace (MachineOpCode _opCode,
+ unsigned numOperands,
+ OpCodeMask _opCodeMask = 0x0);
+
+ //
+ // The op code. Note that MachineOpCode is a target-specific type.
+ //
const MachineOpCode getOpCode () const { return opCode; }
//
{
}
+//
+// Support for replacing opcode and operands of a MachineInstr in place.
+// This only resets the size of the operand vector and initializes it.
+// The new operands must be set explicitly later.
+//
+void
+MachineInstr::replace(MachineOpCode _opCode,
+ unsigned numOperands,
+ OpCodeMask _opCodeMask)
+{
+ opCode = _opCode;
+ opCodeMask = _opCodeMask;
+ operands.clear();
+ operands.resize(numOperands);
+}
+
void
MachineInstr::SetMachineOperandVal(unsigned int i,
MachineOperand::MachineOperandType opType,