Add capability to have machine instruction autoinsert when it is created

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4424 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-10-29 23:18:23 +00:00
parent a3bbcb5b66
commit 7db458fb07
2 changed files with 18 additions and 12 deletions

View File

@ -15,6 +15,7 @@
#include <vector> #include <vector>
class Value; class Value;
class Function; class Function;
class MachineBasicBlock;
typedef int MachineOpCode; typedef int MachineOpCode;
@ -239,19 +240,26 @@ public:
/// MachineInstr ctor - This constructor only does a _reserve_ of the /// MachineInstr ctor - This constructor only does a _reserve_ of the
/// operands, not a resize for them. It is expected that if you use this that /// operands, not a resize for them. It is expected that if you use this that
/// you call add* methods below to fill up the operands, instead of the Set /// you call add* methods below to fill up the operands, instead of the Set
/// methods. /// methods. Eventually, the "resizing" ctors will be phased out.
/// ///
MachineInstr(MachineOpCode Opcode, unsigned numOperands, bool XX, bool YY); MachineInstr(MachineOpCode Opcode, unsigned numOperands, bool XX, bool YY);
// /// MachineInstr ctor - Work exactly the same as the ctor above, except that
// Support to rewrite a machine instruction in place: for now, simply /// the MachineInstr is created and added to the end of the specified basic
// replace() and then set new operands with Set.*Operand methods below. /// block.
// ///
MachineInstr(MachineBasicBlock *MBB, MachineOpCode Opcode, unsigned numOps);
/// replace - 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); void replace(MachineOpCode Opcode, unsigned numOperands);
//
// The opcode. // The opcode.
// //
const MachineOpCode getOpcode() const { return opCode; }
const MachineOpCode getOpCode() const { return opCode; } const MachineOpCode getOpCode() const { return opCode; }
// //

View File

@ -78,11 +78,9 @@ inline MachineInstrBuilder BuildMI(MachineOpCode Opcode, unsigned NumOperands) {
return MachineInstrBuilder(new MachineInstr(Opcode, NumOperands, true, true)); return MachineInstrBuilder(new MachineInstr(Opcode, NumOperands, true, true));
} }
#if 0 inline MachineInstrBuilder BuildMI(MachineBasicBlock *BB, MachineOpCode Opcode,
inline MachineInstrBuilder BuildMI(MBasicBlock *BB, MachineOpCode Opcode, unsigned NumOperands) {
unsigned DestReg = 0) { return MachineInstrBuilder(new MachineInstr(BB, Opcode, NumOperands));
return MachineInstrBuilder(new MachineInstr(BB, Opcode, DestReg));
} }
#endif
#endif #endif