Final version of BuildMI for symmetry and because I want to use it
authorChris Lattner <sabre@nondot.org>
Fri, 13 Dec 2002 09:33:06 +0000 (09:33 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 13 Dec 2002 09:33:06 +0000 (09:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5000 91177308-0d34-0410-b5e6-96231b3b80d8

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.
 ///