forked from OSchip/llvm-project
* Add assertions
* Add a nodeVisited method to the DF interator llvm-svn: 362
This commit is contained in:
parent
d7ff578767
commit
9f35277950
|
@ -108,9 +108,13 @@ public:
|
||||||
typedef SuccIterator<_Term, _BB> _Self;
|
typedef SuccIterator<_Term, _BB> _Self;
|
||||||
// TODO: This can be random access iterator, need operator+ and stuff tho
|
// TODO: This can be random access iterator, need operator+ and stuff tho
|
||||||
|
|
||||||
inline SuccIterator(_Term T) : Term(T), idx(0) {} // begin iterator
|
inline SuccIterator(_Term T) : Term(T), idx(0) { // begin iterator
|
||||||
inline SuccIterator(_Term T, bool)
|
assert(T && "getTerminator returned null!");
|
||||||
: Term(T), idx(Term->getNumSuccessors()) {} // end iterator
|
}
|
||||||
|
inline SuccIterator(_Term T, bool) // end iterator
|
||||||
|
: Term(T), idx(Term->getNumSuccessors()) {
|
||||||
|
assert(T && "getTerminator returned null!");
|
||||||
|
}
|
||||||
|
|
||||||
inline bool operator==(const _Self& x) const { return idx == x.idx; }
|
inline bool operator==(const _Self& x) const { return idx == x.idx; }
|
||||||
inline bool operator!=(const _Self& x) const { return !operator==(x); }
|
inline bool operator!=(const _Self& x) const { return !operator==(x); }
|
||||||
|
@ -287,6 +291,14 @@ public:
|
||||||
inline _Self operator++(int) { // Postincrement
|
inline _Self operator++(int) { // Postincrement
|
||||||
_Self tmp = *this; ++*this; return tmp;
|
_Self tmp = *this; ++*this; return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nodeVisited - return true if this iterator has already visited the
|
||||||
|
// specified node. This is public, and will probably be used to iterate over
|
||||||
|
// nodes that a depth first iteration did not find: ie unreachable nodes.
|
||||||
|
//
|
||||||
|
inline bool nodeVisited(NodeType *Node) const {
|
||||||
|
return Visited.count(Node) != 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline df_iterator df_begin(Method *M, bool Reverse = false) {
|
inline df_iterator df_begin(Method *M, bool Reverse = false) {
|
||||||
|
|
Loading…
Reference in New Issue