- Add new methods to LoopInfo: getLoopPreheader, addBasicBlockToLoop.
[oota-llvm.git] / include / llvm / User.h
index 6b1ece4dc2f9aa1a76c43ce17f9b782e2c73e011..1bd275a02b1ca6f7ab851d7c6379ccb10da80cb2 100644 (file)
@@ -17,9 +17,9 @@
 class User : public Value {
   User(const User &);             // Do not implement
 protected:
-  vector<Use> Operands;
+  std::vector<Use> Operands;
 public:
-  User(const Type *Ty, ValueTy vty, const string &name = "");
+  User(const Type *Ty, ValueTy vty, const std::string &name = "");
   virtual ~User() { dropAllReferences(); }
 
   inline Value *getOperand(unsigned i) { 
@@ -34,18 +34,22 @@ public:
     assert(i < Operands.size() && "setOperand() out of range!");
     Operands[i] = Val;
   }
+  inline void eraseOperand(unsigned i) {
+    assert(i < Operands.size() && "setOperand() out of range!");
+    Operands.erase(Operands.begin() + i);
+  }
   inline unsigned getNumOperands() const { return Operands.size(); }
 
   // ---------------------------------------------------------------------------
   // Operand Iterator interface...
   //
-  typedef vector<Use>::iterator       op_iterator;
-  typedef vector<Use>::const_iterator op_const_iterator;
+  typedef std::vector<Use>::iterator       op_iterator;
+  typedef std::vector<Use>::const_iterator const_op_iterator;
 
   inline op_iterator       op_begin()       { return Operands.begin(); }
-  inline op_const_iterator op_begin() const { return Operands.begin(); }
+  inline const_op_iterator op_begin() const { return Operands.begin(); }
   inline op_iterator       op_end()         { return Operands.end(); }
-  inline op_const_iterator op_end()   const { return Operands.end(); }
+  inline const_op_iterator op_end()   const { return Operands.end(); }
 
   // dropAllReferences() - This function is in charge of "letting go" of all
   // objects that this User refers to.  This allows one to
@@ -59,9 +63,9 @@ public:
     Operands.clear();
   }
 
-  // replaceUsesOfWith - Replaces all references to the "From" definition with
-  // references to the "To" definition.  (defined in Value.cpp)
-  //
+  /// replaceUsesOfWith - Replaces all references to the "From" definition with
+  /// references to the "To" definition.
+  ///
   void replaceUsesOfWith(Value *From, Value *To);
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -71,16 +75,6 @@ public:
            V->getValueType() == Value::ConstantVal ||
            V->getValueType() == Value::InstructionVal;
   }
-
-  // addOperand - This is a special purpose API that should not be used in most
-  // cases.  It adds an empty (null) operand to the instruction specified.  This
-  // is currently used by the back end as part of the "lowering" process... most
-  // optimizations will not handle instructions that are not in their normal
-  // form, so this method should be used with care.
-  //
-  void addOperand() {
-    Operands.push_back(Use(0, this));
-  }
 };
 
 #endif