[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h MachineInstrBuilder.h

Chris Lattner lattner at cs.uiuc.edu
Tue Oct 29 17:19:00 PST 2002


Changes in directory llvm/include/llvm/CodeGen:

MachineInstr.h updated: 1.80 -> 1.81
MachineInstrBuilder.h updated: 1.2 -> 1.3

---
Log message:

Add capability to have machine instruction autoinsert when it is created


---
Diffs of the changes:

Index: llvm/include/llvm/CodeGen/MachineInstr.h
diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.80 llvm/include/llvm/CodeGen/MachineInstr.h:1.81
--- llvm/include/llvm/CodeGen/MachineInstr.h:1.80	Tue Oct 29 13:41:18 2002
+++ llvm/include/llvm/CodeGen/MachineInstr.h	Tue Oct 29 17:18:23 2002
@@ -15,6 +15,7 @@
 #include <vector>
 class Value;
 class Function;
+class MachineBasicBlock;
 
 typedef int MachineOpCode;
 
@@ -239,19 +240,26 @@
   /// 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; }
 
   //


Index: llvm/include/llvm/CodeGen/MachineInstrBuilder.h
diff -u llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.2 llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.3
--- llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.2	Mon Oct 28 15:43:42 2002
+++ llvm/include/llvm/CodeGen/MachineInstrBuilder.h	Tue Oct 29 17:18:23 2002
@@ -78,11 +78,9 @@
   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





More information about the llvm-commits mailing list