15 #ifndef LLVM_ADT_POSTORDERITERATOR_H 16 #define LLVM_ADT_POSTORDERITERATOR_H 56 template<
class SetType,
bool External>
62 template <
typename NodeRef>
64 return Visited.insert(To).second;
72 template<
class SetType>
84 return Visited.insert(To).second;
91 template <
class GraphT,
96 :
public std::iterator<std::forward_iterator_tag, typename GT::NodeRef>,
98 using super = std::iterator<std::forward_iterator_tag, typename GT::NodeRef>;
99 using NodeRef =
typename GT::NodeRef;
100 using ChildItTy =
typename GT::ChildIteratorType;
104 std::vector<std::pair<NodeRef, ChildItTy>> VisitStack;
108 VisitStack.push_back(std::make_pair(BB, GT::child_begin(BB)));
117 VisitStack.push_back(std::make_pair(BB, GT::child_begin(BB)));
126 void traverseChild() {
127 while (VisitStack.back().second != GT::child_end(VisitStack.back().first)) {
128 NodeRef BB = *VisitStack.back().second++;
131 VisitStack.push_back(std::make_pair(BB, GT::child_begin(BB)));
151 return VisitStack == x.VisitStack;
155 const NodeRef &
operator*()
const {
return VisitStack.back().first; }
165 VisitStack.pop_back();
166 if (!VisitStack.empty())
190 template <class T, class SetType = std::set<typename GraphTraits<T>::NodeRef>>
196 template<
class T,
class SetType>
201 template<
class T,
class SetType>
206 template <
class T,
class SetType>
212 template <class T, class SetType = std::set<typename GraphTraits<T>::NodeRef>,
213 bool External =
false>
235 template <class T, class SetType = std::set<typename GraphTraits<T>::NodeRef>>
243 template <
class T,
class SetType>
248 template <
class T,
class SetType>
253 template <
class T,
class SetType>
286 template<
class GraphT,
class GT = GraphTraits<GraphT>>
288 using NodeRef =
typename GT::NodeRef;
290 std::vector<NodeRef> Blocks;
292 void Initialize(NodeRef BB) {
311 #endif // LLVM_ADT_POSTORDERITERATOR_H po_iterator & operator++()
po_ext_iterator< T, SetType > po_ext_end(T G, SetType &S)
static po_iterator end(GraphT G, SetType &S)
This class represents lattice values for constants.
ipo_ext_iterator(const ipo_iterator< T, SetType, true > &V)
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
static po_iterator begin(GraphT G)
ipo_ext_iterator(const po_iterator< Inverse< T >, SetType, true > &V)
po_iterator operator++(int)
bool operator==(const po_iterator &x) const
block Block Frequency true
po_ext_iterator(const po_iterator< T, SetType, true > &V)
static po_iterator begin(GraphT G, SetType &S)
bool insertEdge(Optional< NodeRef > From, NodeRef To)
ipo_iterator< T > ipo_end(const T &G)
ReversePostOrderTraversal(GraphT G)
void finishPostorder(NodeRef BB)
ipo_ext_iterator< T, SetType > ipo_ext_begin(const T &G, SetType &S)
void finishPostorder(NodeRef BB)
const_rpo_iterator end() const
ipo_ext_iterator< T, SetType > ipo_ext_end(const T &G, SetType &S)
static po_iterator end(GraphT G)
po_iterator_storage(const po_iterator_storage &S)
Default po_iterator_storage implementation with an internal set object.
po_iterator< T > po_end(const T &G)
iterator_range< po_iterator< T > > post_order(const T &G)
bool insertEdge(Optional< NodeRef > From, NodeRef To)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
BlockVerifier::State From
bool operator!=(const po_iterator &x) const
iterator_range< po_ext_iterator< T, SetType > > post_order_ext(const T &G, SetType &S)
NodeRef operator->() const
A range adaptor for a pair of iterators.
ipo_iterator< T > ipo_begin(const T &G)
const NodeRef & operator*() const
iterator_range< ipo_ext_iterator< T, SetType > > inverse_post_order_ext(const T &G, SetType &S)
typename std::vector< NodeRef >::const_reverse_iterator const_rpo_iterator
const_rpo_iterator begin() const
po_iterator_storage(SetType &VSet)
po_ext_iterator< T, SetType > po_ext_begin(T G, SetType &S)
typename std::vector< NodeRef >::reverse_iterator rpo_iterator
ipo_iterator(const po_iterator< Inverse< T >, SetType, External > &V)
typename super::pointer pointer
iterator_range< ipo_iterator< T > > inverse_post_order(const T &G)
OutputIt copy(R &&Range, OutputIt Out)
po_iterator< T > po_begin(const T &G)