LLVM API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Friends
llvm::LoopInfoBase< BlockT, LoopT > Class Template Reference

#include <LoopInfo.h>

Inheritance diagram for llvm::LoopInfoBase< BlockT, LoopT >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef std::vector< LoopT * >
::const_iterator 
iterator
typedef std::vector< LoopT * >
::const_reverse_iterator 
reverse_iterator

Public Member Functions

 LoopInfoBase ()
 ~LoopInfoBase ()
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
const LoopT * operator[] (const BlockT *BB) const
unsigned getLoopDepth (const BlockT *BB) const
bool isLoopHeader (BlockT *BB) const
LoopT * removeLoop (iterator I)
void changeLoopFor (BlockT *BB, LoopT *L)
void changeTopLevelLoop (LoopT *OldLoop, LoopT *NewLoop)
void addTopLevelLoop (LoopT *New)
void removeBlock (BlockT *BB)
void Analyze (DominatorTreeBase< BlockT > &DomTree)
 Create the loop forest using a stable algorithm.
void print (raw_ostream &OS) 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 BlockT, class LoopT>
class llvm::LoopInfoBase< BlockT, LoopT >

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

Definition at line 492 of file LoopInfo.h.


Member Typedef Documentation

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

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

Definition at line 517 of file LoopInfo.h.

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

Definition at line 519 of file LoopInfo.h.


Constructor & Destructor Documentation

template<class BlockT, class LoopT>
llvm::LoopInfoBase< BlockT, LoopT >::LoopInfoBase ( ) [inline]

Definition at line 502 of file LoopInfo.h.

template<class BlockT, class LoopT>
llvm::LoopInfoBase< BlockT, LoopT >::~LoopInfoBase ( ) [inline]

Definition at line 503 of file LoopInfo.h.


Member Function Documentation

template<class BlockT, class LoopT>
void llvm::LoopInfoBase< BlockT, LoopT >::addTopLevelLoop ( LoopT *  New) [inline]

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

Definition at line 589 of file LoopInfo.h.

Referenced by llvm::MachineLoopInfo::addTopLevelLoop(), llvm::LoopInfo::addTopLevelLoop(), and llvm::LoopInfo::updateUnloop().

template<class BlockT, class LoopT >
void llvm::LoopInfoBase< BlockT, LoopT >::Analyze ( 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 499 of file LoopInfoImpl.h.

References llvm::discoverAndMapSubloop(), llvm::DominatorTreeBase< NodeT >::dominates(), llvm::SmallVectorBase::empty(), llvm::DomTreeNodeBase< NodeT >::getBlock(), llvm::DominatorTreeBase< NodeT >::getRootNode(), llvm::DominatorTreeBase< NodeT >::isReachableFromEntry(), llvm::po_begin(), llvm::po_end(), and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().

Referenced by llvm::LoopInfo::runOnFunction().

template<class BlockT, class LoopT>
iterator llvm::LoopInfoBase< BlockT, LoopT >::begin ( ) const [inline]
template<class BlockT, class LoopT>
void llvm::LoopInfoBase< BlockT, LoopT >::changeLoopFor ( BlockT *  BB,
LoopT *  L 
) [inline]

changeLoopFor - 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 567 of file LoopInfo.h.

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

template<class BlockT, class LoopT>
void llvm::LoopInfoBase< BlockT, LoopT >::changeTopLevelLoop ( LoopT *  OldLoop,
LoopT *  NewLoop 
) [inline]

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

Definition at line 577 of file LoopInfo.h.

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

template<class BlockT, class LoopT>
bool llvm::LoopInfoBase< BlockT, LoopT >::empty ( ) const [inline]

Definition at line 524 of file LoopInfo.h.

Referenced by llvm::MachineLoopInfo::empty(), and llvm::LoopInfo::empty().

template<class BlockT, class LoopT>
iterator llvm::LoopInfoBase< BlockT, LoopT >::end ( ) const [inline]
template<class BlockT, class LoopT>
unsigned llvm::LoopInfoBase< BlockT, LoopT >::getLoopDepth ( const BlockT *  BB) const [inline]

getLoopDepth - Return the loop nesting level of the specified block. A depth of 0 means the block is not inside any loop.

Definition at line 542 of file LoopInfo.h.

Referenced by llvm::MachineLoopInfo::getLoopDepth(), and llvm::LoopInfo::getLoopDepth().

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

getLoopFor - Return the inner most loop that BB lives in. If a basic block is in no loop (for example the entry node), null is returned.

Definition at line 529 of file LoopInfo.h.

Referenced by llvm::discoverAndMapSubloop(), llvm::MachineLoopInfo::getLoopFor(), llvm::LoopInfo::getLoopFor(), llvm::MachineLoopInfo::operator[](), and llvm::LoopInfo::operator[]().

template<class BlockT, class LoopT>
bool llvm::LoopInfoBase< BlockT, LoopT >::isLoopHeader ( BlockT *  BB) const [inline]
template<class BlockT, class LoopT>
static bool llvm::LoopInfoBase< BlockT, LoopT >::isNotAlreadyContainedIn ( const LoopT *  SubLoop,
const LoopT *  ParentLoop 
) [inline, static]

Definition at line 609 of file LoopInfo.h.

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

operator[] - same as getLoopFor...

Definition at line 535 of file LoopInfo.h.

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

Definition at line 537 of file LoopInfoImpl.h.

References I.

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

template<class BlockT, class LoopT>
reverse_iterator llvm::LoopInfoBase< BlockT, LoopT >::rbegin ( ) const [inline]

Definition at line 522 of file LoopInfo.h.

Referenced by llvm::LoopInfo::rbegin().

template<class BlockT, class LoopT>
void llvm::LoopInfoBase< BlockT, LoopT >::releaseMemory ( ) [inline]
template<class BlockT, class LoopT>
void llvm::LoopInfoBase< BlockT, LoopT >::removeBlock ( BlockT *  BB) [inline]

removeBlock - 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 597 of file LoopInfo.h.

Referenced by llvm::MachineLoopInfo::removeBlock(), and llvm::LoopInfo::removeBlock().

template<class BlockT, class LoopT>
LoopT* llvm::LoopInfoBase< BlockT, LoopT >::removeLoop ( iterator  I) [inline]

removeLoop - 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 556 of file LoopInfo.h.

Referenced by llvm::MachineLoopInfo::removeLoop(), llvm::LoopInfo::removeLoop(), and llvm::LoopInfo::updateUnloop().

template<class BlockT, class LoopT>
reverse_iterator llvm::LoopInfoBase< BlockT, LoopT >::rend ( ) const [inline]

Definition at line 523 of file LoopInfo.h.

Referenced by llvm::LoopInfo::rend().


Friends And Related Function Documentation

template<class BlockT, class LoopT>
friend class LoopBase< BlockT, LoopT > [friend]

Definition at line 496 of file LoopInfo.h.

template<class BlockT, class LoopT>
friend class LoopInfo [friend]

Definition at line 497 of file LoopInfo.h.


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