1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Rename SwitchInst::dest_push_back -> addCase

Add new removeCase method

llvm-svn: 8088
This commit is contained in:
Chris Lattner 2003-08-23 23:14:37 +00:00
parent aa004bbc69
commit 367cef7b75
2 changed files with 22 additions and 2 deletions

View File

@ -147,7 +147,15 @@ public:
return cast<BasicBlock>(Operands[1].get());
}
void dest_push_back(Constant *OnVal, BasicBlock *Dest);
/// addCase - Add an entry to the switch instruction...
///
void addCase(Constant *OnVal, BasicBlock *Dest);
/// 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 removeCase(unsigned idx);
virtual const BasicBlock *getSuccessor(unsigned idx) const {
assert(idx < getNumSuccessors() &&"Successor idx out of range for switch!");

View File

@ -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);
}