llvm.org GIT mirror llvm / e8f1df6
Add routines to update or erase operands (and to do so without external assumptions about which operand number stores what operand). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3750 91177308-0d34-0410-b5e6-96231b3b80d8 Vikram S. Adve 18 years ago
3 changed file(s) with 16 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
3232 inline void setOperand(unsigned i, Value *Val) {
3333 assert(i < Operands.size() && "setOperand() out of range!");
3434 Operands[i] = Val;
35 }
36 inline void eraseOperand(unsigned i) {
37 assert(i < Operands.size() && "setOperand() out of range!");
38 Operands.erase(Operands.begin() + i);
3539 }
3640 inline unsigned getNumOperands() const { return Operands.size(); }
3741
149149
150150 Value *getPointerOperand() { return getOperand(0); }
151151 const Value *getPointerOperand() const { return getOperand(0); }
152 static unsigned getPointerOperandIndex() { return 0U; }
152153
153154 // Methods for support type inquiry through isa, cast, and dyn_cast:
154155 static inline bool classof(const LoadInst *) { return true; }
179180
180181 Value *getPointerOperand() { return getOperand(1); }
181182 const Value *getPointerOperand() const { return getOperand(1); }
183 static unsigned getPointerOperandIndex() { return 1U; }
182184
183185 // Methods for support type inquiry through isa, cast, and dyn_cast:
184186 static inline bool classof(const StoreInst *) { return true; }
237239 const Value *getPointerOperand() const {
238240 return getOperand(0);
239241 }
240
242 static unsigned getPointerOperandIndex() {
243 return 0U; // get index for modifying correct operand
244 }
245
241246 inline unsigned getNumIndices() const { // Note: always non-negative
242247 return getNumOperands() - 1;
243248 }
4141 void setIncomingValue(unsigned i, Value *V) {
4242 Operands[i*2] = V;
4343 }
44 inline unsigned getOperandNumForIncomingValue(unsigned i) {
45 return i*2;
46 }
4447
4548 /// getIncomingBlock - Return incoming basic block #x
4649 const BasicBlock *getIncomingBlock(unsigned i) const {
5154 }
5255 inline void setIncomingBlock(unsigned i, BasicBlock *BB) {
5356 Operands[i*2+1] = (Value*)BB;
57 }
58 inline unsigned getOperandNumForIncomingBlock(unsigned i) {
59 return i*2+1;
5460 }
5561
5662 /// addIncoming - Add an incoming value to the end of the PHI list