summaryrefslogtreecommitdiff
path: root/include/llvm/BasicBlock.h
diff options
context:
space:
mode:
authorTorok Edwin <edwintorok@gmail.com>2008-12-11 10:36:07 +0000
committerTorok Edwin <edwintorok@gmail.com>2008-12-11 10:36:07 +0000
commit87f1e7796d02ea991bdbf084f312879988732a26 (patch)
treed12e5e05fcefa424417d93128bacc6cfe168ac2b /include/llvm/BasicBlock.h
parente1d44b59eea8ad574f0e9794e10b6bf3b564461b (diff)
downloadllvm-87f1e7796d02ea991bdbf084f312879988732a26.tar.gz
llvm-87f1e7796d02ea991bdbf084f312879988732a26.tar.bz2
llvm-87f1e7796d02ea991bdbf084f312879988732a26.tar.xz
introduce BasicBlock::getUniquePredecessor()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60872 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/BasicBlock.h')
-rw-r--r--include/llvm/BasicBlock.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h
index ff45800f1e..ee5ceb3683 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
///