summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/iSwitch.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-23 23:14:37 +0000
committerChris Lattner <sabre@nondot.org>2003-08-23 23:14:37 +0000
commit180e14cb87635e6ba7091b0dfe59d63a97f9da61 (patch)
tree0349d35ad1490944d41bbd7002ab7a16832726a5 /llvm/lib/VMCore/iSwitch.cpp
parentf1b1c5ec2ff02587a119afe38e8a3ca0b25cb85d (diff)
downloadbcm5719-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.cpp14
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);
+}
OpenPOWER on IntegriCloud