summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-10-29 23:18:23 +0000
committerChris Lattner <sabre@nondot.org>2002-10-29 23:18:23 +0000
commit4623709bb7cde8166a0e65a3bdb61108a5b28a89 (patch)
tree5edc4931f722ca7af3e6089be3c2eca6ac5ae978 /llvm
parent632df28debe46556256c95831a8bc42f92f5c1a0 (diff)
downloadbcm5719-llvm-4623709bb7cde8166a0e65a3bdb61108a5b28a89.tar.gz
bcm5719-llvm-4623709bb7cde8166a0e65a3bdb61108a5b28a89.zip
Add capability to have machine instruction autoinsert when it is created
llvm-svn: 4424
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/CodeGen/MachineInstr.h20
-rw-r--r--llvm/include/llvm/CodeGen/MachineInstrBuilder.h10
2 files changed, 18 insertions, 12 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h
index 221340e6deb..048f884c66c 100644
--- a/llvm/include/llvm/CodeGen/MachineInstr.h
+++ b/llvm/include/llvm/CodeGen/MachineInstr.h
@@ -15,6 +15,7 @@
#include <vector>
class Value;
class Function;
+class MachineBasicBlock;
typedef int MachineOpCode;
@@ -239,19 +240,26 @@ public:
/// 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
/// 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);
- //
- // Support to rewrite a machine instruction in place: for now, simply
- // replace() and then set new operands with Set.*Operand methods below.
- //
+ /// MachineInstr ctor - Work exactly the same as the ctor above, except that
+ /// the MachineInstr is created and added to the end of the specified basic
+ /// 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);
- //
// The opcode.
//
+ const MachineOpCode getOpcode() const { return opCode; }
const MachineOpCode getOpCode() const { return opCode; }
//
diff --git a/llvm/include/llvm/CodeGen/MachineInstrBuilder.h b/llvm/include/llvm/CodeGen/MachineInstrBuilder.h
index 9b61abe4bae..909d101e90f 100644
--- a/llvm/include/llvm/CodeGen/MachineInstrBuilder.h
+++ b/llvm/include/llvm/CodeGen/MachineInstrBuilder.h
@@ -78,11 +78,9 @@ inline MachineInstrBuilder BuildMI(MachineOpCode Opcode, unsigned NumOperands) {
return MachineInstrBuilder(new MachineInstr(Opcode, NumOperands, true, true));
}
-#if 0
-inline MachineInstrBuilder BuildMI(MBasicBlock *BB, MachineOpCode Opcode,
- unsigned DestReg = 0) {
- return MachineInstrBuilder(new MachineInstr(BB, Opcode, DestReg));
+inline MachineInstrBuilder BuildMI(MachineBasicBlock *BB, MachineOpCode Opcode,
+ unsigned NumOperands) {
+ return MachineInstrBuilder(new MachineInstr(BB, Opcode, NumOperands));
}
-#endif
-
+
#endif
OpenPOWER on IntegriCloud