diff options
| author | Chris Lattner <sabre@nondot.org> | 2003-08-23 23:14:37 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2003-08-23 23:14:37 +0000 |
| commit | 180e14cb87635e6ba7091b0dfe59d63a97f9da61 (patch) | |
| tree | 0349d35ad1490944d41bbd7002ab7a16832726a5 /llvm/lib/VMCore/iSwitch.cpp | |
| parent | f1b1c5ec2ff02587a119afe38e8a3ca0b25cb85d (diff) | |
| download | bcm5719-llvm-180e14cb87635e6ba7091b0dfe59d63a97f9da61.tar.gz bcm5719-llvm-180e14cb87635e6ba7091b0dfe59d63a97f9da61.zip | |
Rename SwitchInst::dest_push_back -> addCase
Add new removeCase method
llvm-svn: 8088
Diffstat (limited to 'llvm/lib/VMCore/iSwitch.cpp')
| -rw-r--r-- | llvm/lib/VMCore/iSwitch.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/iSwitch.cpp b/llvm/lib/VMCore/iSwitch.cpp index a63adfdfcfd..e1cb00e3ad6 100644 --- a/llvm/lib/VMCore/iSwitch.cpp +++ b/llvm/lib/VMCore/iSwitch.cpp @@ -25,7 +25,19 @@ SwitchInst::SwitchInst(const SwitchInst &SI) } } -void SwitchInst::dest_push_back(Constant *OnVal, BasicBlock *Dest) { +/// addCase - Add an entry to the switch instruction... +/// +void SwitchInst::addCase(Constant *OnVal, BasicBlock *Dest) { Operands.push_back(Use((Value*)OnVal, this)); Operands.push_back(Use((Value*)Dest, this)); } + +/// removeCase - This method removes the specified successor from the switch +/// instruction. Note that this cannot be used to remove the default +/// destination (successor #0). +/// +void SwitchInst::removeCase(unsigned idx) { + assert(idx != 0 && "Cannot remove the default case!"); + assert(idx*2 < Operands.size() && "Successor index out of range!!!"); + Operands.erase(Operands.begin()+idx*2, Operands.begin()+(idx+1)*2); +} |

