Remove internal helper fn
[oota-llvm.git] / include / llvm / CodeGen / MachineInstrBuilder.h
index 96f7359301176338df5c6c78667204e1c32ab02e..9a57150ca3aec60f1237aff1275a7c24eba0989a 100644 (file)
@@ -18,9 +18,9 @@
 
 #include "llvm/CodeGen/MachineInstr.h"
 
-struct MachineInstrBuilder {
+class MachineInstrBuilder {
   MachineInstr *MI;
-
+public:
   MachineInstrBuilder(MachineInstr *mi) : MI(mi) {}
 
   /// Allow automatic conversion to the machine instruction we are working on.
@@ -43,15 +43,21 @@ struct MachineInstrBuilder {
     return *this;
   }
 
-  /// addClobber - Assert that this MI is going to clobber a specific
-  /// register. Useful for instructions that always clobber certain hard regs.
-  /// (Same as addReg(RegNo, true) but shorter and more obvious).
+  /// addReg - Add an LLVM value that is to be used as a register...
   ///
-  const MachineInstrBuilder &addClobber(int RegNo) const {
-    MI->addRegOperand(RegNo, true);
+  const MachineInstrBuilder &addCCReg(Value *V,
+                                      MOTy::UseType Ty = MOTy::Use) const {
+    MI->addCCRegOperand(V, Ty);
     return *this;
   }
 
+  /// addRegDef - Add an LLVM value that is to be defined as a register... this
+  /// is the same as addReg(V, MOTy::Def).
+  ///
+  const MachineInstrBuilder &addRegDef(Value *V) const {
+    return addReg(V, MOTy::Def);
+  }
+
   /// addPCDisp - Add an LLVM value to be treated as a PC relative
   /// displacement...
   ///
@@ -81,6 +87,33 @@ struct MachineInstrBuilder {
     MI->addZeroExtImmOperand(Val);
     return *this;
   }
+
+  const MachineInstrBuilder &addMBB(MachineBasicBlock *MBB) const {
+    MI->addMachineBasicBlockOperand(MBB);
+    return *this;
+  }
+
+  const MachineInstrBuilder &addFrameIndex(unsigned Idx) const {
+    MI->addFrameIndexOperand(Idx);
+    return *this;
+  }
+
+  const MachineInstrBuilder &addConstantPoolIndex(unsigned Idx) const {
+    MI->addConstantPoolIndexOperand(Idx);
+    return *this;
+  }
+
+  const MachineInstrBuilder &addGlobalAddress(GlobalValue *GV,
+                                             bool isPCRelative = false) const {
+    MI->addGlobalAddressOperand(GV, isPCRelative);
+    return *this;
+  }
+
+  const MachineInstrBuilder &addExternalSymbol(const std::string &Name,
+                                              bool isPCRelative = false) const{
+    MI->addExternalSymbolOperand(Name, isPCRelative);
+    return *this;
+  }
 };
 
 /// BuildMI - Builder interface.  Specify how to create the initial instruction