Final version of BuildMI for symmetry and because I want to use it
[oota-llvm.git] / include / llvm / CodeGen / MachineInstrBuilder.h
index 1d8edbe171a18839dd466d9bd031c96791e94ccf..96f7359301176338df5c6c78667204e1c32ab02e 100644 (file)
@@ -91,6 +91,17 @@ inline MachineInstrBuilder BuildMI(MachineOpCode Opcode, unsigned NumOperands) {
   return MachineInstrBuilder(new MachineInstr(Opcode, NumOperands, true, true));
 }
 
+/// BuildMI - This version of the builder also sets up the first "operand" as a
+/// destination virtual register.  NumOperands is the number of additional add*
+/// calls that are expected, it does not include the destination register.
+///
+inline MachineInstrBuilder BuildMI(MachineOpCode Opcode, unsigned NumOperands,
+                                   unsigned DestReg) {
+  return MachineInstrBuilder(new MachineInstr(Opcode, NumOperands+1,
+                                   true, true)).addReg(DestReg, MOTy::Def);
+}
+
+
 /// BuildMI - This version of the builder inserts the built MachineInstr into
 /// the specified MachineBasicBlock.
 ///