mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
Add a new helper method to SwitchInst. Useful when you've got a BB from
somewhere (like the dominator graph) and would like to know which case it came from. llvm-svn: 30466
This commit is contained in:
parent
1efde528d6
commit
87f79d5d69
@ -1310,6 +1310,19 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// findCaseDest - Finds the unique case value for a given successor. Returns
|
||||
/// null if the successor is not found, not unique, or is the default case.
|
||||
ConstantInt *findCaseDest(BasicBlock *BB) {
|
||||
ConstantInt *CI = NULL;
|
||||
for (unsigned i = 1, e = getNumCases(); i != e; ++i) {
|
||||
if (getSuccessor(i) == BB) {
|
||||
if (CI) return NULL; // Multiple cases lead to BB.
|
||||
else CI = getCaseValue(i);
|
||||
}
|
||||
}
|
||||
return CI;
|
||||
}
|
||||
|
||||
/// addCase - Add an entry to the switch instruction...
|
||||
///
|
||||
void addCase(ConstantInt *OnVal, BasicBlock *Dest);
|
||||
|
Loading…
Reference in New Issue
Block a user