|
LLVM 23.0.0git
|
CRTP base class for post-order traversal. More...
#include "llvm/ADT/PostOrderIterator.h"
Classes | |
| class | iterator |
Public Member Functions | |
| iterator | begin () |
| iterator | end () |
| bool | insertEdge (std::optional< NodeRef > From, NodeRef To) |
| Add edge and return whether To should be visited. | |
| void | finishPostorder (NodeRef) |
| Callback just before the iterator moves to the next block. | |
Protected Member Functions | |
| PostOrderTraversalBase ()=default | |
| DerivedT * | derived () |
| void | init (NodeRef Start) |
| Initialize post-order traversal at given start node. | |
CRTP base class for post-order traversal.
Storage for visited nodes must be provided by the sub-class, which must implement insertEdge(). Due to CRTP limitations, the sub-class must call init() with the start node before traversing; not calling init results in an empty iterator.
Sub-classes can observe the post-order traversal with finishPostorder(), which is called before the iterator moves to the next node, and also the pre-order traversal with insertEdge().
Unwanted graph nodes (e.g. from a previous traversal) can be skipped by returning false from insertEdge().
This class only supports a single traversal of the graph.
Definition at line 71 of file PostOrderIterator.h.
|
protecteddefault |
|
inline |
Definition at line 168 of file PostOrderIterator.h.
References derived().
Referenced by llvm::LoopBlocksTraversal::begin().
|
inlineprotected |
Definition at line 133 of file PostOrderIterator.h.
|
inline |
Definition at line 173 of file PostOrderIterator.h.
Referenced by llvm::LoopBlocksTraversal::end().
|
inline |
Callback just before the iterator moves to the next block.
Definition at line 182 of file PostOrderIterator.h.
|
inlineprotected |
Initialize post-order traversal at given start node.
Definition at line 136 of file PostOrderIterator.h.
References derived(), insertEdge(), and llvm::make_range().
Referenced by llvm::PostOrderTraversal< GraphT, SetType >::PostOrderTraversal().
| bool llvm::PostOrderTraversalBase< DerivedT, GraphTraits >::insertEdge | ( | std::optional< NodeRef > | From, |
| NodeRef | To ) |
Add edge and return whether To should be visited.
From is nullopt for the root node.
Referenced by init().