Constify properlyDominates in the same manner as dominates.

Add constified overloads for findNearestCommonDominator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114834 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2010-09-27 16:33:31 +00:00
parent 48fd5a79e0
commit e6098b6205

View File

@ -361,8 +361,15 @@ public:
return dominatedBySlowTreeWalk(A, B);
}
inline bool properlyDominates(NodeT *A, NodeT *B) {
return properlyDominates(getNode(A), getNode(B));
inline bool properlyDominates(const NodeT *A, const NodeT *B) {
if (A == B)
return false;
// Cast away the const qualifiers here. This is ok since
// this function doesn't actually return the values returned
// from getNode.
return properlyDominates(getNode(const_cast<NodeT *>(A)),
getNode(const_cast<NodeT *>(B)));
}
bool dominatedBySlowTreeWalk(const DomTreeNodeBase<NodeT> *A,
@ -478,6 +485,13 @@ public:
return NULL;
}
const NodeT *findNearestCommonDominator(const NodeT *A, const NodeT *B) {
// Cast away the const qualifiers here. This is ok since
// const is re-introduced on the return type.
return findNearestCommonDominator(const_cast<NodeT *>(A),
const_cast<NodeT *>(B));
}
//===--------------------------------------------------------------------===//
// API to update (Post)DominatorTree information based on modifications to
// the CFG...
@ -767,7 +781,7 @@ public:
return DT->properlyDominates(A, B);
}
bool properlyDominates(BasicBlock *A, BasicBlock *B) const {
bool properlyDominates(const BasicBlock *A, const BasicBlock *B) const {
return DT->properlyDominates(A, B);
}
@ -777,6 +791,11 @@ public:
return DT->findNearestCommonDominator(A, B);
}
inline const BasicBlock *findNearestCommonDominator(const BasicBlock *A,
const BasicBlock *B) {
return DT->findNearestCommonDominator(A, B);
}
inline DomTreeNode *operator[](BasicBlock *BB) const {
return DT->getNode(BB);
}