[llvm-commits] CVS: llvm/lib/VMCore/iSwitch.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat Aug 23 18:15:01 PDT 2003
Changes in directory llvm/lib/VMCore:
iSwitch.cpp updated: 1.6 -> 1.7
---
Log message:
Rename SwitchInst::dest_push_back -> addCase
Add new removeCase method
---
Diffs of the changes:
Index: llvm/lib/VMCore/iSwitch.cpp
diff -u llvm/lib/VMCore/iSwitch.cpp:1.6 llvm/lib/VMCore/iSwitch.cpp:1.7
--- llvm/lib/VMCore/iSwitch.cpp:1.6 Tue Sep 10 10:45:53 2002
+++ llvm/lib/VMCore/iSwitch.cpp Sat Aug 23 18:14:37 2003
@@ -25,7 +25,19 @@
}
}
-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);
}
More information about the llvm-commits
mailing list