diff options
author | Edwin Török <edwintorok@gmail.com> | 2008-12-11 10:36:07 +0000 |
---|---|---|
committer | Edwin Török <edwintorok@gmail.com> | 2008-12-11 10:36:07 +0000 |
commit | 7275748f8176dfc03db77c000aa5979399fed875 (patch) | |
tree | d12e5e05fcefa424417d93128bacc6cfe168ac2b /include | |
parent | 64046a7ba73291426d3ba208397de0ff7fbd337c (diff) | |
download | external_llvm-7275748f8176dfc03db77c000aa5979399fed875.zip external_llvm-7275748f8176dfc03db77c000aa5979399fed875.tar.gz external_llvm-7275748f8176dfc03db77c000aa5979399fed875.tar.bz2 |
introduce BasicBlock::getUniquePredecessor()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60872 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/BasicBlock.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h index ff45800..ee5ceb3 100644 --- a/include/llvm/BasicBlock.h +++ b/include/llvm/BasicBlock.h @@ -134,6 +134,16 @@ public: return const_cast<BasicBlock*>(this)->getSinglePredecessor(); } + /// getUniquePredecessor - If this basic block has a unique predecessor block, + /// return the block, otherwise return a null pointer. + /// Note that unique predecessor doesn't mean single edge, there can be + /// multiple edges from the unique predecessor to this block (for example in + /// case of a switch statement with multiple cases having same destination). + BasicBlock *getUniquePredecessor(); + const BasicBlock *getUniquePredecessor() const { + return const_cast<BasicBlock*>(this)->getUniquePredecessor(); + } + //===--------------------------------------------------------------------===// /// Instruction iterator methods /// |