16#ifndef LLVM_ADT_POSTORDERITERATOR_H
17#define LLVM_ADT_POSTORDERITERATOR_H
58template<
class SetType,
bool External>
64 template <
typename NodeRef>
66 return Visited.insert(To).second;
74template<
class SetType>
85 template <
class NodeRef>
87 return Visited.insert(To).second;
94template <
class GraphT,
95 class SetType = SmallPtrSet<typename GraphTraits<GraphT>::NodeRef, 8>,
96 bool ExtStorage =
false,
class GT = GraphTraits<GraphT>>
101 std::conditional_t<ExtStorage, std::input_iterator_tag,
102 std::forward_iterator_tag>;
109 using NodeRef =
typename GT::NodeRef;
110 using ChildItTy =
typename GT::ChildIteratorType;
118 this->
insertEdge(std::optional<NodeRef>(), BB);
119 VisitStack.
emplace_back(BB, GT::child_begin(BB), GT::child_end(BB));
127 if (this->
insertEdge(std::optional<NodeRef>(), BB)) {
128 VisitStack.
emplace_back(BB, GT::child_begin(BB), GT::child_end(BB));
133 po_iterator(SetType &S)
134 : po_iterator_storage<SetType, ExtStorage>(S) {
137 void traverseChild() {
140 if (std::get<1>(Entry) == std::get<2>(Entry))
142 NodeRef BB = *std::get<1>(Entry)++;
143 if (this->
insertEdge(std::optional<NodeRef>(std::get<0>(Entry)), BB)) {
145 VisitStack.
emplace_back(BB, GT::child_begin(BB), GT::child_end(BB));
163 return VisitStack == x.VisitStack;
178 if (!VisitStack.
empty())
202template <class T, class SetType = std::set<typename GraphTraits<T>::NodeRef>>
208template<
class T,
class SetType>
213template<
class T,
class SetType>
218template <
class T,
class SetType>
224template <class T, class SetType = std::set<typename GraphTraits<T>::NodeRef>,
225 bool External =
false>
247template <class T, class SetType = std::set<typename GraphTraits<T>::NodeRef>>
255template <
class T,
class SetType>
260template <
class T,
class SetType>
265template <
class T,
class SetType>
266iterator_range<ipo_ext_iterator<T, SetType>>
298template<
class GraphT,
class GT = GraphTraits<GraphT>>
300 using NodeRef =
typename GT::NodeRef;
305 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
NodeRef operator->() const
typename GT::NodeRef value_type
static po_iterator begin(const GraphT &G)
std::conditional_t< ExtStorage, std::input_iterator_tag, std::forward_iterator_tag > iterator_category
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)