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) {
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
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:
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