llvm::PostOrderTraversal

Post-order traversal of a graph.

Synopsis

Declared in <llvm/ADT/PostOrderIterator.h>

template<
    typename GraphT,
    typename SetType = po_detail::DefaultSet<GraphT>>
class PostOrderTraversal
    : public PostOrderTraversalBase<PostOrderTraversal<GraphT, SetType>, GraphTraits<GraphT>>

Description

Traversal state lives in this object, not in the iterators, so its lifetime must outlive the iterators. Prefer:


for (BasicBlock *BB : post_order(F)) { ... }

Avoid binding a temporary traversal into make_filter_range; store the traversal object first. Only a single traversal is supported.

Base Classes

NameDescription
PostOrderTraversalBase<PostOrderTraversal<GraphT, SetType>, GraphTraits<GraphT>>CRTP base for a single post-order graph walk.

Types

NameDescription
iterator Input iterator yielding nodes in post-order during a single traversal.

Member Functions

NameDescription
PostOrderTraversal [constructor]Constructors
begin Iterator to the current post-order node, or end if none remain.
end Past-the-end iterator for this traversal.
finishPostorder Callback just before the iterator moves to the next block.
insertEdge insertEdge overloads

Protected Member Functions

NameDescription
derived Return this object cast to the CRTP derived type.
init Initialize post-order traversal at given start node.