LLVM  8.0.1
Public Types | Public Member Functions | List of all members
llvm::LoopBlocksTraversal Class Reference

Traverse the blocks in a loop using a depth-first search. More...

#include "llvm/Analysis/LoopIterator.h"

Public Types

typedef po_iterator< BasicBlock *, LoopBlocksTraversal, truePOTIterator
 Graph traversal iterator. More...
 

Public Member Functions

 LoopBlocksTraversal (LoopBlocksDFS &Storage, LoopInfo *LInfo)
 
POTIterator begin ()
 Postorder traversal over the graph. More...
 
POTIterator end ()
 
bool visitPreorder (BasicBlock *BB)
 Called by po_iterator upon reaching a block via a CFG edge. More...
 
void finishPostorder (BasicBlock *BB)
 Called by po_iterator each time it advances, indicating a block's postorder. More...
 

Detailed Description

Traverse the blocks in a loop using a depth-first search.

Definition at line 201 of file LoopIterator.h.

Member Typedef Documentation

◆ POTIterator

Graph traversal iterator.

Definition at line 204 of file LoopIterator.h.

Constructor & Destructor Documentation

◆ LoopBlocksTraversal()

llvm::LoopBlocksTraversal::LoopBlocksTraversal ( LoopBlocksDFS Storage,
LoopInfo LInfo 
)
inline

Definition at line 211 of file LoopIterator.h.

Member Function Documentation

◆ begin()

POTIterator llvm::LoopBlocksTraversal::begin ( )
inline

Postorder traversal over the graph.

This only needs to be done once. po_iterator "automatically" calls back to visitPreorder and finishPostorder to record the DFS result.

Definition at line 217 of file LoopIterator.h.

References assert(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::LoopBase< BlockT, LoopT >::getNumBlocks(), and llvm::po_ext_begin().

Referenced by llvm::LoopBlocksDFS::perform().

◆ end()

POTIterator llvm::LoopBlocksTraversal::end ( )
inline

◆ finishPostorder()

void llvm::LoopBlocksTraversal::finishPostorder ( BasicBlock BB)
inline

Called by po_iterator each time it advances, indicating a block's postorder.

Definition at line 241 of file LoopIterator.h.

References assert(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count().

◆ visitPreorder()

bool llvm::LoopBlocksTraversal::visitPreorder ( BasicBlock BB)
inline

Called by po_iterator 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.

TODO: If anyone is interested, we could record preorder numbers here.

Definition at line 232 of file LoopIterator.h.

References llvm::LoopBase< BlockT, LoopT >::contains(), llvm::LoopInfoBase< BlockT, LoopT >::getLoopFor(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert().


The documentation for this class was generated from the following file: