16#ifndef LLVM_ADT_POSTORDERITERATOR_H
17#define LLVM_ADT_POSTORDERITERATOR_H
57template<
class SetType,
bool External>
63 template <
typename NodeRef>
65 return Visited.insert(To).second;
73template<
class SetType>
84 template <
class NodeRef>
86 return Visited.insert(To).second;
93template <
class GraphT,
94 class SetType = SmallPtrSet<typename GraphTraits<GraphT>::NodeRef, 8>,
95 bool ExtStorage =
false,
class GT = GraphTraits<GraphT>>
105 using NodeRef =
typename GT::NodeRef;
106 using ChildItTy =
typename GT::ChildIteratorType;
114 this->
insertEdge(std::optional<NodeRef>(), BB);
115 VisitStack.
emplace_back(BB, GT::child_begin(BB), GT::child_end(BB));
123 if (this->
insertEdge(std::optional<NodeRef>(), BB)) {
124 VisitStack.
emplace_back(BB, GT::child_begin(BB), GT::child_end(BB));
129 po_iterator(SetType &S)
130 : po_iterator_storage<SetType, ExtStorage>(S) {
133 void traverseChild() {
136 if (std::get<1>(Entry) == std::get<2>(Entry))
138 NodeRef BB = *std::get<1>(Entry)++;
139 if (this->
insertEdge(std::optional<NodeRef>(std::get<0>(Entry)), BB)) {
141 VisitStack.
emplace_back(BB, GT::child_begin(BB), GT::child_end(BB));
159 return VisitStack == x.VisitStack;
174 if (!VisitStack.
empty())
198template <class T, class SetType = std::set<typename GraphTraits<T>::NodeRef>>
204template<
class T,
class SetType>
209template<
class T,
class SetType>
214template <
class T,
class SetType>
220template <class T, class SetType = std::set<typename GraphTraits<T>::NodeRef>,
221 bool External =
false>
243template <class T, class SetType = std::set<typename GraphTraits<T>::NodeRef>>
251template <
class T,
class SetType>
256template <
class T,
class SetType>
261template <
class T,
class SetType>
262iterator_range<ipo_ext_iterator<T, SetType>>
294template<
class GraphT,
class GT = GraphTraits<GraphT>>
296 using NodeRef =
typename GT::NodeRef;
301 void Initialize(
const GraphT &
G) {
BlockVerifier::State From
DenseMap< Block *, BlockRelaxAux > Blocks
This file defines the little GraphTraits<X> template class that should be specialized by classes that...
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
const_rpo_iterator end() const
const_rpo_iterator begin() const
ReversePostOrderTraversal(const GraphT &G)
typename VecTy::reverse_iterator rpo_iterator
typename VecTy::const_reverse_iterator const_rpo_iterator
reference emplace_back(ArgTypes &&... Args)
std::reverse_iterator< const_iterator > const_reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A range adaptor for a pair of iterators.
void finishPostorder(NodeRef BB)
po_iterator_storage(const po_iterator_storage &S)
bool insertEdge(std::optional< NodeRef > From, NodeRef To)
po_iterator_storage(SetType &VSet)
Default po_iterator_storage implementation with an internal set object.
bool insertEdge(std::optional< NodeRef > From, NodeRef To)
void finishPostorder(NodeRef BB)
static po_iterator end(const GraphT &G, SetType &S)
reference operator*() const
std::ptrdiff_t difference_type
static po_iterator end(const GraphT &G)
const value_type & reference
std::forward_iterator_tag iterator_category
NodeRef operator->() const
typename GT::NodeRef value_type
static po_iterator begin(const GraphT &G)
po_iterator & operator++()
po_iterator operator++(int)
bool operator==(const po_iterator &x) const
bool operator!=(const po_iterator &x) const
static po_iterator begin(const GraphT &G, SetType &S)
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
This is an optimization pass for GlobalISel generic memory operations.
ipo_iterator< T > ipo_end(const T &G)
iterator_range< po_ext_iterator< T, SetType > > post_order_ext(const T &G, SetType &S)
iterator_range< ipo_ext_iterator< T, SetType > > inverse_post_order_ext(const T &G, SetType &S)
ipo_ext_iterator< T, SetType > ipo_ext_begin(const T &G, SetType &S)
iterator_range< ipo_iterator< T > > inverse_post_order(const T &G)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
iterator_range< po_iterator< T > > post_order(const T &G)
po_ext_iterator< T, SetType > po_ext_end(T G, SetType &S)
po_iterator< T > po_begin(const T &G)
ipo_ext_iterator< T, SetType > ipo_ext_end(const T &G, SetType &S)
ipo_iterator< T > ipo_begin(const T &G)
po_iterator< T > po_end(const T &G)
po_ext_iterator< T, SetType > po_ext_begin(T G, SetType &S)
ipo_ext_iterator(const ipo_iterator< T, SetType, true > &V)
ipo_ext_iterator(const po_iterator< Inverse< T >, SetType, true > &V)
ipo_iterator(const po_iterator< Inverse< T >, SetType, External > &V)
po_ext_iterator(const po_iterator< T, SetType, true > &V)