16 #ifndef LLVM_ADT_POSTORDERITERATOR_H 17 #define LLVM_ADT_POSTORDERITERATOR_H 57 template<
class SetType,
bool External>
63 template <
typename NodeRef>
65 return Visited.insert(To).second;
73 template<
class SetType>
85 return Visited.insert(To).second;
92 template <
class GraphT,
97 :
public std::iterator<std::forward_iterator_tag, typename GT::NodeRef>,
99 using super = std::iterator<std::forward_iterator_tag, typename GT::NodeRef>;
100 using NodeRef =
typename GT::NodeRef;
101 using ChildItTy =
typename GT::ChildIteratorType;
105 std::vector<std::pair<NodeRef, ChildItTy>> VisitStack;
109 VisitStack.push_back(std::make_pair(BB, GT::child_begin(BB)));
118 VisitStack.push_back(std::make_pair(BB, GT::child_begin(BB)));
127 void traverseChild() {
128 while (VisitStack.back().second != GT::child_end(VisitStack.back().first)) {
129 NodeRef BB = *VisitStack.back().second++;
132 VisitStack.push_back(std::make_pair(BB, GT::child_begin(BB)));
152 return VisitStack == x.VisitStack;
156 const NodeRef &
operator*()
const {
return VisitStack.back().first; }
166 VisitStack.pop_back();
167 if (!VisitStack.empty())
191 template <class T, class SetType = std::set<typename GraphTraits<T>::NodeRef>>
197 template<
class T,
class SetType>
202 template<
class T,
class SetType>
207 template <
class T,
class SetType>
213 template <class T, class SetType = std::set<typename GraphTraits<T>::NodeRef>,
214 bool External =
false>
236 template <class T, class SetType = std::set<typename GraphTraits<T>::NodeRef>>
244 template <
class T,
class SetType>
249 template <
class T,
class SetType>
254 template <
class T,
class SetType>
287 template<
class GraphT,
class GT = GraphTraits<GraphT>>
289 using NodeRef =
typename GT::NodeRef;
291 std::vector<NodeRef> Blocks;
293 void Initialize(NodeRef BB) {
312 #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)