LLVM 22.0.0git
llvm::LoopBlocksDFS Class Reference

Store the result of a depth first search within basic blocks contained by a single loop. More...

#include "llvm/Analysis/LoopIterator.h"

Public Types

typedef std::vector< BasicBlock * >::const_iterator POIterator
 Postorder list iterators.
typedef std::vector< BasicBlock * >::const_reverse_iterator RPOIterator

Public Member Functions

 LoopBlocksDFS (Loop *Container)
LoopgetLoop () const
void perform (const LoopInfo *LI)
 Traverse the loop blocks and store the DFS result.
bool isComplete () const
 Return true if postorder numbers are assigned to all loop blocks.
POIterator beginPostorder () const
 Iterate over the cached postorder blocks.
POIterator endPostorder () const
RPOIterator beginRPO () const
 Reverse iterate over the cached postorder blocks.
RPOIterator endRPO () const
bool hasPreorder (BasicBlock *BB) const
 Return true if this block has been preorder visited.
bool hasPostorder (BasicBlock *BB) const
 Return true if this block has a postorder number.
unsigned getPostorder (BasicBlock *BB) const
 Get a block's postorder number.
unsigned getRPO (BasicBlock *BB) const
 Get a block's reverse postorder number.
void clear ()

Friends

class LoopBlocksTraversal

Detailed Description

Store the result of a depth first search within basic blocks contained by a single loop.

TODO: This could be generalized for any CFG region, or the entire CFG.

Definition at line 97 of file LoopIterator.h.

Member Typedef Documentation

◆ POIterator

Postorder list iterators.

Definition at line 100 of file LoopIterator.h.

◆ RPOIterator

typedef std::vector<BasicBlock*>::const_reverse_iterator llvm::LoopBlocksDFS::RPOIterator

Definition at line 101 of file LoopIterator.h.

Constructor & Destructor Documentation

◆ LoopBlocksDFS()

llvm::LoopBlocksDFS::LoopBlocksDFS ( Loop * Container)
inline

Member Function Documentation

◆ beginPostorder()

POIterator llvm::LoopBlocksDFS::beginPostorder ( ) const
inline

Iterate over the cached postorder blocks.

Definition at line 129 of file LoopIterator.h.

References assert(), and isComplete().

◆ beginRPO()

RPOIterator llvm::LoopBlocksDFS::beginRPO ( ) const
inline

Reverse iterate over the cached postorder blocks.

Definition at line 136 of file LoopIterator.h.

References assert(), and isComplete().

Referenced by llvm::LoopVectorizationCostModel::collectValuesToIgnore(), llvm::DataDependenceGraph::DataDependenceGraph(), llvm::UnrollAndJamLoop(), and llvm::UnrollLoop().

◆ clear()

void llvm::LoopBlocksDFS::clear ( )
inline

Definition at line 164 of file LoopIterator.h.

◆ endPostorder()

POIterator llvm::LoopBlocksDFS::endPostorder ( ) const
inline

Definition at line 133 of file LoopIterator.h.

◆ endRPO()

◆ getLoop()

Loop * llvm::LoopBlocksDFS::getLoop ( ) const
inline

Definition at line 120 of file LoopIterator.h.

◆ getPostorder()

unsigned llvm::LoopBlocksDFS::getPostorder ( BasicBlock * BB) const
inline

Get a block's postorder number.

Definition at line 152 of file LoopIterator.h.

References assert(), and I.

Referenced by getRPO().

◆ getRPO()

unsigned llvm::LoopBlocksDFS::getRPO ( BasicBlock * BB) const
inline

Get a block's reverse postorder number.

Definition at line 160 of file LoopIterator.h.

References getPostorder().

◆ hasPostorder()

bool llvm::LoopBlocksDFS::hasPostorder ( BasicBlock * BB) const
inline

Return true if this block has a postorder number.

Definition at line 146 of file LoopIterator.h.

References I.

◆ hasPreorder()

bool llvm::LoopBlocksDFS::hasPreorder ( BasicBlock * BB) const
inline

Return true if this block has been preorder visited.

Definition at line 143 of file LoopIterator.h.

◆ isComplete()

bool llvm::LoopBlocksDFS::isComplete ( ) const
inline

Return true if postorder numbers are assigned to all loop blocks.

Definition at line 126 of file LoopIterator.h.

Referenced by beginPostorder(), and beginRPO().

◆ perform()

void LoopBlocksDFS::perform ( const LoopInfo * LI)

Traverse the loop blocks and store the DFS result.

Useful for clients that just want the final DFS result and don't need to visit blocks during the initial traversal.

Definition at line 1276 of file LoopInfo.cpp.

References llvm::LoopBlocksTraversal::begin(), llvm::LoopBlocksTraversal::end(), and LoopBlocksTraversal.

Referenced by llvm::LoopVectorizationCostModel::collectValuesToIgnore(), llvm::DataDependenceGraph::DataDependenceGraph(), llvm::UnrollAndJamLoop(), and llvm::UnrollLoop().

◆ LoopBlocksTraversal

friend class LoopBlocksTraversal
friend

Definition at line 103 of file LoopIterator.h.

References LoopBlocksTraversal.

Referenced by LoopBlocksTraversal, and perform().


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