llvm.org GIT mirror llvm / 131d19f
Rename SwitchInst::dest_push_back -> addCase Add new removeCase method git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8088 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 17 years ago
2 changed file(s) with 22 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
146146 return cast(Operands[1].get());
147147 }
148148
149 void dest_push_back(Constant *OnVal, BasicBlock *Dest);
149 /// addCase - Add an entry to the switch instruction...
150 ///
151 void addCase(Constant *OnVal, BasicBlock *Dest);
152
153 /// removeCase - This method removes the specified successor from the switch
154 /// instruction. Note that this cannot be used to remove the default
155 /// destination (successor #0).
156 ///
157 void removeCase(unsigned idx);
150158
151159 virtual const BasicBlock *getSuccessor(unsigned idx) const {
152160 assert(idx < getNumSuccessors() &&"Successor idx out of range for switch!");
2424 }
2525 }
2626
27 void SwitchInst::dest_push_back(Constant *OnVal, BasicBlock *Dest) {
27 /// addCase - Add an entry to the switch instruction...
28 ///
29 void SwitchInst::addCase(Constant *OnVal, BasicBlock *Dest) {
2830 Operands.push_back(Use((Value*)OnVal, this));
2931 Operands.push_back(Use((Value*)Dest, this));
3032 }
33
34 /// removeCase - This method removes the specified successor from the switch
35 /// instruction. Note that this cannot be used to remove the default
36 /// destination (successor #0).
37 ///
38 void SwitchInst::removeCase(unsigned idx) {
39 assert(idx != 0 && "Cannot remove the default case!");
40 assert(idx*2 < Operands.size() && "Successor index out of range!!!");
41 Operands.erase(Operands.begin()+idx*2, Operands.begin()+(idx+1)*2);
42 }