aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-18 22:10:57 +0000
committerChris Lattner <sabre@nondot.org>2003-08-18 22:10:57 +0000
commitfd4d8975cf0e7c288b4985b1751113154c7defcc (patch)
treed96129bf289d07cbf522255970825c60573ed3d2
parent134480cb1b2270251aa12e87fff32ec391d8d8f6 (diff)
Add new methods, update comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7962 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/Dominators.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 76f9111b8d..a6df556051 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -1,4 +1,4 @@
-//===- llvm/Analysis/Dominators.h - Dominator Info Calculation ---*- C++ -*--=//
+//===- llvm/Analysis/Dominators.h - Dominator Info Calculation --*- C++ -*-===//
//
// This file defines the following classes:
// 1. DominatorSet: Calculates the [reverse] dominator set for a function
@@ -46,7 +46,9 @@ public:
//===----------------------------------------------------------------------===//
//
// DominatorSet - Maintain a set<BasicBlock*> for every basic block in a
-// function, that represents the blocks that dominate the block.
+// function, that represents the blocks that dominate the block. If the block
+// is unreachable in this function, the set will be empty. This cannot happen
+// for reachable code, because every block dominates at least itself.
//
class DominatorSetBase : public DominatorBase {
public:
@@ -80,6 +82,12 @@ public:
return I->second;
}
+ /// isReachable - Return true if the specified basicblock is reachable. If
+ /// the block is reachable, we have dominator set information for it.
+ bool isReachable(BasicBlock *BB) const {
+ return !getDominators(BB).empty();
+ }
+
/// dominates - Return true if A dominates B.
///
inline bool dominates(BasicBlock *A, BasicBlock *B) const {