|
LLVM 23.0.0git
|
Traverse the blocks in a loop using a depth-first search. More...
#include "llvm/Analysis/LoopIterator.h"
Public Member Functions | |
| LoopBlocksTraversal (LoopBlocksDFS &Storage, const LoopInfo *LInfo) | |
| iterator | begin () |
| Postorder traversal over the graph. | |
| iterator | end () |
| bool | insertEdge (std::optional< BasicBlock * >, BasicBlock *BB) |
| Called upon reaching a block via a CFG edge. | |
| void | finishPostorder (BasicBlock *BB) |
| Called each time the iterator advances, indicating a block's postorder. | |
| Public Member Functions inherited from llvm::PostOrderTraversalBase< LoopBlocksTraversal, GraphTraits< Function * > > | |
| 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< LoopBlocksTraversal, GraphTraits< Function * > > | |
| PostOrderTraversalBase ()=default | |
| LoopBlocksTraversal * | derived () |
| void | init (NodeRef Start) |
| Initialize post-order traversal at given start node. | |
Traverse the blocks in a loop using a depth-first search.
Definition at line 190 of file LoopIterator.h.
|
inline |
Definition at line 197 of file LoopIterator.h.
|
inline |
Postorder traversal over the graph.
This only needs to be done once. PostOrderTraversalBase "automatically" calls back to insertEdge and finishPostorder to record the DFS result.
Definition at line 203 of file LoopIterator.h.
References assert(), llvm::PostOrderTraversalBase< DerivedT, GraphTraits >::begin(), and llvm::PostOrderTraversalBase< LoopBlocksTraversal, GraphTraits< Function * > >::init().
|
inline |
Definition at line 209 of file LoopIterator.h.
References llvm::PostOrderTraversalBase< DerivedT, GraphTraits >::end().
|
inline |
Called each time the iterator advances, indicating a block's postorder.
Definition at line 224 of file LoopIterator.h.
References assert().
|
inline |
Called upon reaching a block via a CFG edge.
If this block is contained in the loop and has not been visited, then mark it preorder visited and return true (i.e., traverse the edge).
TODO: If anyone is interested, we could record preorder numbers here.
Definition at line 216 of file LoopIterator.h.