LLVM  4.0.0
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::LoopInfoBase< N, M > Class Template Reference

This class builds and contains all of the top-level loop structures in the specified function. More...

#include <LoopInfo.h>

Inheritance diagram for llvm::LoopInfoBase< N, M >:
[legend]

Public Types

typedef std::vector< LoopT * >
::const_iterator 
iterator
 iterator/begin/end - The interface to the top-level loops in the current function. More...
 
typedef std::vector< LoopT * >
::const_reverse_iterator 
reverse_iterator
 

Public Member Functions

 LoopInfoBase ()
 
 ~LoopInfoBase ()
 
 LoopInfoBase (LoopInfoBase &&Arg)
 
LoopInfoBaseoperator= (LoopInfoBase &&RHS)
 
void releaseMemory ()
 
iterator begin () const
 
iterator end () const
 
reverse_iterator rbegin () const
 
reverse_iterator rend () const
 
bool empty () const
 
LoopT * getLoopFor (const BlockT *BB) const
 Return the inner most loop that BB lives in. More...
 
const LoopT * operator[] (const BlockT *BB) const
 Same as getLoopFor. More...
 
unsigned getLoopDepth (const BlockT *BB) const
 Return the loop nesting level of the specified block. More...
 
bool isLoopHeader (const BlockT *BB) const
 
LoopT * removeLoop (iterator I)
 This removes the specified top-level loop from this loop info object. More...
 
void changeLoopFor (BlockT *BB, LoopT *L)
 Change the top-level loop that contains BB to the specified loop. More...
 
void changeTopLevelLoop (LoopT *OldLoop, LoopT *NewLoop)
 Replace the specified loop in the top-level loops list with the indicated loop. More...
 
void addTopLevelLoop (LoopT *New)
 This adds the specified loop to the collection of top-level loops. More...
 
void removeBlock (BlockT *BB)
 This method completely removes BB from all data structures, including all of the Loop objects it is nested in and our mapping from BasicBlocks to loops. More...
 
void analyze (const DominatorTreeBase< BlockT > &DomTree)
 Create the loop forest using a stable algorithm. More...
 
void print (raw_ostream &OS) const
 
void verify (const DominatorTreeBase< BlockT > &DomTree) const
 

Static Public Member Functions

static bool isNotAlreadyContainedIn (const LoopT *SubLoop, const LoopT *ParentLoop)
 

Friends

class LoopBase< BlockT, LoopT >
 
class LoopInfo
 

Detailed Description

template<class N, class M>
class llvm::LoopInfoBase< N, M >

This class builds and contains all of the top-level loop structures in the specified function.

Definition at line 60 of file LoopInfo.h.

Member Typedef Documentation

template<class N, class M>
typedef std::vector<LoopT *>::const_iterator llvm::LoopInfoBase< N, M >::iterator

iterator/begin/end - The interface to the top-level loops in the current function.

Definition at line 564 of file LoopInfo.h.

template<class N, class M>
typedef std::vector<LoopT *>::const_reverse_iterator llvm::LoopInfoBase< N, M >::reverse_iterator

Definition at line 566 of file LoopInfo.h.

Constructor & Destructor Documentation

template<class N, class M>
llvm::LoopInfoBase< N, M >::LoopInfoBase ( )
inline

Definition at line 531 of file LoopInfo.h.

template<class N, class M>
llvm::LoopInfoBase< N, M >::~LoopInfoBase ( )
inline

Definition at line 532 of file LoopInfo.h.

template<class N, class M>
llvm::LoopInfoBase< N, M >::LoopInfoBase ( LoopInfoBase< N, M > &&  Arg)
inline

Definition at line 534 of file LoopInfo.h.

Member Function Documentation

template<class N, class M>
void llvm::LoopInfoBase< N, M >::addTopLevelLoop ( LoopT *  New)
inline

This adds the specified loop to the collection of top-level loops.

Definition at line 629 of file LoopInfo.h.

Referenced by llvm::addClonedBlockToLoopInfo(), llvm::LPPassManager::addLoop(), llvm::MachineLoopInfo::addTopLevelLoop(), CloneLoopBlocks(), and llvm::cloneLoopWithPreheader().

template<class BlockT , class LoopT >
void llvm::LoopInfoBase< BlockT, LoopT >::analyze ( const DominatorTreeBase< BlockT > &  DomTree)

Create the loop forest using a stable algorithm.

Analyze LoopInfo discovers loops during a postorder DominatorTree traversal interleaved with backward CFG traversals within each subloop (discoverAndMapSubloop).

The backward traversal skips inner subloops, so this part of the algorithm is linear in the number of CFG edges. Subloop and Block vectors are then populated during a single forward CFG traversal (PopulateLoopDFS).

During the two CFG traversals each block is seen three times: 1) Discovered and mapped by a reverse CFG traversal. 2) Visited during a forward DFS CFG traversal. 3) Reverse-inserted in the loop in postorder following forward DFS.

The Block vectors are inclusive, so step 3 requires loop-depth number of insertions per block.

Definition at line 475 of file LoopInfoImpl.h.

References DFS(), llvm::discoverAndMapSubloop(), llvm::DominatorTreeBase< N >::dominates(), llvm::SmallVectorBase::empty(), llvm::DomTreeNodeBase< NodeT >::getBlock(), llvm::DominatorTreeBase< N >::getRootNode(), llvm::DominatorTreeBase< N >::isReachableFromEntry(), L, llvm::post_order(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and llvm::PopulateLoopsDFS< BlockT, LoopT >::traverse().

Referenced by llvm::OptimizationRemarkEmitter::OptimizationRemarkEmitter(), llvm::LoopAnalysis::run(), and llvm::LoopInfoBase< N, M >::verify().

template<class N, class M>
iterator llvm::LoopInfoBase< N, M >::begin ( ) const
inline

Definition at line 567 of file LoopInfo.h.

Referenced by llvm::MachineLoopInfo::begin(), and llvm::LoopSimplifyPass::run().

template<class N, class M>
void llvm::LoopInfoBase< N, M >::changeLoopFor ( BlockT *  BB,
LoopT *  L 
)
inline

Change the top-level loop that contains BB to the specified loop.

This should be used by transformations that restructure the loop hierarchy tree.

Definition at line 609 of file LoopInfo.h.

Referenced by llvm::MachineLoopInfo::changeLoopFor(), llvm::discoverAndMapSubloop(), and separateNestedLoop().

template<class N, class M>
void llvm::LoopInfoBase< N, M >::changeTopLevelLoop ( LoopT *  OldLoop,
LoopT *  NewLoop 
)
inline

Replace the specified loop in the top-level loops list with the indicated loop.

Definition at line 619 of file LoopInfo.h.

Referenced by llvm::MachineLoopInfo::changeTopLevelLoop(), and separateNestedLoop().

template<class N, class M>
bool llvm::LoopInfoBase< N, M >::empty ( ) const
inline
template<class N, class M>
iterator llvm::LoopInfoBase< N, M >::end ( ) const
inline

Definition at line 568 of file LoopInfo.h.

Referenced by llvm::MachineLoopInfo::end(), and llvm::LoopSimplifyPass::run().

template<class N, class M>
unsigned llvm::LoopInfoBase< N, M >::getLoopDepth ( const BlockT *  BB) const
inline

Return the loop nesting level of the specified block.

A depth of 0 means the block is not inside any loop.

Definition at line 584 of file LoopInfo.h.

Referenced by llvm::MachineLoopInfo::getLoopDepth().

template<class N, class M>
LoopT* llvm::LoopInfoBase< N, M >::getLoopFor ( const BlockT *  BB) const
inline
template<class N, class M>
bool llvm::LoopInfoBase< N, M >::isLoopHeader ( const BlockT *  BB) const
inline

Definition at line 590 of file LoopInfo.h.

Referenced by llvm::GetUnderlyingObjects(), and llvm::MachineLoopInfo::isLoopHeader().

template<class N, class M>
static bool llvm::LoopInfoBase< N, M >::isNotAlreadyContainedIn ( const LoopT *  SubLoop,
const LoopT *  ParentLoop 
)
inlinestatic

Definition at line 649 of file LoopInfo.h.

template<class N, class M>
LoopInfoBase& llvm::LoopInfoBase< N, M >::operator= ( LoopInfoBase< N, M > &&  RHS)
inline

Definition at line 540 of file LoopInfo.h.

template<class N, class M>
const LoopT* llvm::LoopInfoBase< N, M >::operator[] ( const BlockT *  BB) const
inline

Same as getLoopFor.

Definition at line 578 of file LoopInfo.h.

template<class BlockT , class LoopT >
void llvm::LoopInfoBase< BlockT, LoopT >::print ( raw_ostream OS) const

Definition at line 512 of file LoopInfoImpl.h.

References E, I, and i.

Referenced by llvm::LoopInfoWrapperPass::print().

template<class N, class M>
reverse_iterator llvm::LoopInfoBase< N, M >::rbegin ( ) const
inline

Definition at line 569 of file LoopInfo.h.

template<class N, class M>
void llvm::LoopInfoBase< N, M >::releaseMemory ( )
inline
template<class N, class M>
void llvm::LoopInfoBase< N, M >::removeBlock ( BlockT *  BB)
inline

This method completely removes BB from all data structures, including all of the Loop objects it is nested in and our mapping from BasicBlocks to loops.

Definition at line 637 of file LoopInfo.h.

Referenced by foldBlockIntoPredecessor(), llvm::MergeBlockIntoPredecessor(), llvm::MachineLoopInfo::removeBlock(), llvm::LoopDeletionPass::runImpl(), simplifyLoopCFG(), and simplifyOneLoop().

template<class N, class M>
LoopT* llvm::LoopInfoBase< N, M >::removeLoop ( iterator  I)
inline

This removes the specified top-level loop from this loop info object.

The loop is not deleted, as it will presumably be inserted into another loop.

Definition at line 598 of file LoopInfo.h.

Referenced by llvm::MachineLoopInfo::removeLoop().

template<class N, class M>
reverse_iterator llvm::LoopInfoBase< N, M >::rend ( ) const
inline

Definition at line 570 of file LoopInfo.h.

template<class BlockT , class LoopT >
void llvm::LoopInfoBase< BlockT, LoopT >::verify ( const DominatorTreeBase< BlockT > &  DomTree) const

Friends And Related Function Documentation

template<class N, class M>
friend class LoopBase< BlockT, LoopT >
friend

Definition at line 525 of file LoopInfo.h.

template<class N, class M>
friend class LoopInfo
friend

Definition at line 526 of file LoopInfo.h.


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