|
LLVM 23.0.0git
|
Post-order traversal of a graph. More...
#include "llvm/ADT/PostOrderIterator.h"
Public Member Functions | |
| PostOrderTraversal ()=default | |
| Default constructor for an empty traversal. | |
| PostOrderTraversal (const GraphT &G) | |
| Post-order traversal of the graph starting at the root node using an internal storage. | |
| bool | insertEdge (std::optional< NodeRef > From, NodeRef To) |
| Public Member Functions inherited from llvm::PostOrderTraversalBase< DerivedT, GraphTraits > | |
| 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. | |
Additional Inherited Members | |
| Protected Member Functions inherited from llvm::PostOrderTraversalBase< DerivedT, GraphTraits > | |
| PostOrderTraversalBase ()=default | |
| DerivedT * | derived () |
| void | init (NodeRef Start) |
| Initialize post-order traversal at given start node. | |
Post-order traversal of a graph.
Note: the traversal state is stored in this class, not in the iterators – the lifetime of PostOrderTraversal must exceed the lifetime of the iterators. Special care must be taken with range-based for-loops in combination with LLVM ranges:
// Fine: for (BasicBlock *BB : post_order(F)) { ... }
// Problematic! Lifetime of PostOrderTraversal ends before the loop is // entered, because make_filter_range only stores the iterators but not // the range object itself. for (BasicBlock *BB : make_filter_range(post_order(F), ...)) { ... } // Fixed: auto POT = post_order(F); for (BasicBlock *BB : make_filter_range(POT, ...)) { ... }
This class only supports a single traversal of the graph.
Definition at line 203 of file PostOrderIterator.h.
|
default |
Default constructor for an empty traversal.
|
inline |
Post-order traversal of the graph starting at the root node using an internal storage.
Definition at line 216 of file PostOrderIterator.h.
References G, and llvm::PostOrderTraversalBase< DerivedT, GraphTraits >::init().
|
inline |
Definition at line 220 of file PostOrderIterator.h.