Add BasicBlock level dominates(A,B) interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37493 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2007-06-07 18:39:40 +00:00
parent 9a51157db5
commit 259e6cf191

View File

@@ -170,11 +170,16 @@ protected:
} }
void updateDFSNumbers(); void updateDFSNumbers();
/// dominates - Returns true iff this dominates N. Note that this is not a /// dominates - Returns true iff this dominates N. Note that this is not a
/// constant time operation! /// constant time operation!
/// ///
inline bool dominates(const DomTreeNode *A, DomTreeNode *B) { inline bool dominates(const DomTreeNode *A, DomTreeNode *B) {
if (B == A) return true; // A node trivially dominates itself. if (B == A)
return true; // A node trivially dominates itself.
if (A == 0 || B == 0)
return false;
ETNode *NodeA = A->getETNode(); ETNode *NodeA = A->getETNode();
ETNode *NodeB = B->getETNode(); ETNode *NodeB = B->getETNode();
@@ -192,7 +197,14 @@ protected:
//return NodeB->DominatedBySlow(NodeA); //return NodeB->DominatedBySlow(NodeA);
return dominatedBySlowTreeWalk(A, B); return dominatedBySlowTreeWalk(A, B);
} }
inline bool dominates(BasicBlock *A, BasicBlock *B) {
if (A == B)
return true;
return dominates(getNode(A), getNode(B));
}
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
// API to update (Post)DominatorTree information based on modifications to // API to update (Post)DominatorTree information based on modifications to
// the CFG... // the CFG...