LLVM API Documentation
#include <LoopInfo.h>

Public Types | |
| typedef std::vector< LoopT * > ::const_iterator | iterator |
| typedef std::vector< LoopT * > ::const_reverse_iterator | reverse_iterator |
| typedef std::vector< BlockT * > ::const_iterator | block_iterator |
| typedef std::pair< const BlockT *, const BlockT * > | Edge |
| Edge type. | |
Public Member Functions | |
| LoopBase () | |
| Loop ctor - This creates an empty loop. | |
| ~LoopBase () | |
| unsigned | getLoopDepth () const |
| BlockT * | getHeader () const |
| LoopT * | getParentLoop () const |
| void | setParentLoop (LoopT *L) |
| setParentLoop is a raw interface for bypassing addChildLoop. | |
| bool | contains (const LoopT *L) const |
| bool | contains (const BlockT *BB) const |
| template<class InstT > | |
| bool | contains (const InstT *Inst) const |
| const std::vector< LoopT * > & | getSubLoops () const |
| std::vector< LoopT * > & | getSubLoopsVector () |
| iterator | begin () const |
| iterator | end () const |
| reverse_iterator | rbegin () const |
| reverse_iterator | rend () const |
| bool | empty () const |
| const std::vector< BlockT * > & | getBlocks () const |
| std::vector< BlockT * > & | getBlocksVector () |
| block_iterator | block_begin () const |
| block_iterator | block_end () const |
| unsigned | getNumBlocks () const |
| getNumBlocks - Get the number of blocks in this loop in constant time. | |
| bool | isLoopExiting (const BlockT *BB) const |
| unsigned | getNumBackEdges () const |
| void | getExitingBlocks (SmallVectorImpl< BlockT * > &ExitingBlocks) const |
| BlockT * | getExitingBlock () const |
| void | getExitBlocks (SmallVectorImpl< BlockT * > &ExitBlocks) const |
| BlockT * | getExitBlock () const |
| void | getExitEdges (SmallVectorImpl< Edge > &ExitEdges) const |
| getExitEdges - Return all pairs of (_inside_block_,_outside_block_). | |
| BlockT * | getLoopPreheader () const |
| BlockT * | getLoopPredecessor () const |
| BlockT * | getLoopLatch () const |
| void | addBasicBlockToLoop (BlockT *NewBB, LoopInfoBase< BlockT, LoopT > &LI) |
| void | replaceChildLoopWith (LoopT *OldChild, LoopT *NewChild) |
| void | addChildLoop (LoopT *NewChild) |
| LoopT * | removeChildLoop (iterator I) |
| void | addBlockEntry (BlockT *BB) |
| void | moveToHeader (BlockT *BB) |
| void | removeBlockFromLoop (BlockT *BB) |
| void | verifyLoop () const |
| verifyLoop - Verify loop structure | |
| void | verifyLoopNest (DenseSet< const LoopT * > *Loops) const |
| verifyLoop - Verify loop structure of this loop and all nested loops. | |
| void | print (raw_ostream &OS, unsigned Depth=0) const |
Protected Member Functions | |
| LoopBase (BlockT *BB) | |
Friends | |
| class | LoopInfoBase< BlockT, LoopT > |
LoopBase class - Instances of this class are used to represent loops that are detected in the flow graph
Definition at line 63 of file LoopInfo.h.
| typedef std::vector<BlockT*>::const_iterator llvm::LoopBase< BlockT, LoopT >::block_iterator |
Definition at line 137 of file LoopInfo.h.
| typedef std::pair<const BlockT*, const BlockT*> llvm::LoopBase< BlockT, LoopT >::Edge |
Edge type.
Definition at line 204 of file LoopInfo.h.
| typedef std::vector<LoopT *>::const_iterator llvm::LoopBase< BlockT, LoopT >::iterator |
Definition at line 124 of file LoopInfo.h.
| typedef std::vector<LoopT *>::const_reverse_iterator llvm::LoopBase< BlockT, LoopT >::reverse_iterator |
Definition at line 126 of file LoopInfo.h.
| llvm::LoopBase< BlockT, LoopT >::LoopBase | ( | ) | [inline] |
Loop ctor - This creates an empty loop.
Definition at line 76 of file LoopInfo.h.
| llvm::LoopBase< BlockT, LoopT >::~LoopBase | ( | ) | [inline] |
Definition at line 77 of file LoopInfo.h.
| llvm::LoopBase< BlockT, LoopT >::LoopBase | ( | BlockT * | BB | ) | [inline, explicit, protected] |
Definition at line 307 of file LoopInfo.h.
| void llvm::LoopBase< BlockT, LoopT >::addBasicBlockToLoop | ( | BlockT * | NewBB, |
| LoopInfoBase< BlockT, LoopT > & | LIB | ||
| ) |
addBasicBlockToLoop - This method is used by other analyses to update loop information. NewBB is set to be a new member of the current loop. Because of this, it is added as a member of all parent loops, and is added to the specified LoopInfo object as being in the current basic block. It is not valid to replace the loop header with this method.
Definition at line 200 of file LoopInfoImpl.h.
Referenced by CloneLoop(), llvm::UnrollLoop(), and UpdateAnalysisInformation().
| void llvm::LoopBase< BlockT, LoopT >::addBlockEntry | ( | BlockT * | BB | ) | [inline] |
addBlockEntry - This adds a basic block directly to the basic block list. This should only be used by transformations that create new loops. Other transformations should use addBasicBlockToLoop.
Definition at line 271 of file LoopInfo.h.
| void llvm::LoopBase< BlockT, LoopT >::addChildLoop | ( | LoopT * | NewChild | ) | [inline] |
addChildLoop - Add the specified loop to be a child of this loop. This updates the loop depth of the new child.
Definition at line 250 of file LoopInfo.h.
Referenced by llvm::LPPassManager::insertLoop().
| iterator llvm::LoopBase< BlockT, LoopT >::begin | ( | ) | const [inline] |
Definition at line 127 of file LoopInfo.h.
Referenced by llvm::GraphTraits< const MachineLoop * >::child_begin(), llvm::GraphTraits< MachineLoop * >::child_begin(), llvm::GraphTraits< const Loop * >::child_begin(), llvm::GraphTraits< Loop * >::child_begin(), CloneLoop(), llvm::ScalarEvolution::forgetLoop(), llvm::ScalarEvolution::print(), PrintChildLoopComment(), PrintLoopInfo(), llvm::LoopBase< BasicBlock, Loop >::removeChildLoop(), and llvm::LoopInfo::updateUnloop().
| block_iterator llvm::LoopBase< BlockT, LoopT >::block_begin | ( | ) | const [inline] |
Definition at line 138 of file LoopInfo.h.
Referenced by ApproximateLoopSize(), CloneLoop(), llvm::LoopBase< BasicBlock, Loop >::contains(), mayLoopAccessLocation(), and llvm::LoopInfo::updateUnloop().
| block_iterator llvm::LoopBase< BlockT, LoopT >::block_end | ( | ) | const [inline] |
Definition at line 139 of file LoopInfo.h.
Referenced by ApproximateLoopSize(), CloneLoop(), llvm::LoopBase< BasicBlock, Loop >::contains(), mayLoopAccessLocation(), and llvm::LoopInfo::updateUnloop().
| bool llvm::LoopBase< BlockT, LoopT >::contains | ( | const LoopT * | L | ) | const [inline] |
contains - Return true if the specified loop is contained within in this loop.
Definition at line 101 of file LoopInfo.h.
Referenced by canConstantEvolve(), CloneLoopBlocks(), ConnectProlog(), llvm::LoopBase< BasicBlock, Loop >::contains(), FindPHIToPartitionLoops(), llvm::ScalarEvolution::getAddRecExpr(), llvm::LoopBase< BasicBlock, Loop >::getNumBackEdges(), llvm::InsertPreheaderForLoop(), isExitingLoop(), isInteresting(), llvm::LoopBase< BasicBlock, Loop >::isLoopExiting(), isTrivialLoopExitBlockHelper(), IVUseShouldUsePostIncValue(), PickMostRelevantLoop(), PlaceSplitBlockCarefully(), llvm::LoopInfo::replacementPreservesLCSSAForm(), llvm::UnrollLoop(), and llvm::LoopBlocksTraversal::visitPreorder().
| bool llvm::LoopBase< BlockT, LoopT >::contains | ( | const BlockT * | BB | ) | const [inline] |
contains - Return true if the specified basic block is in this loop.
Definition at line 109 of file LoopInfo.h.
| bool llvm::LoopBase< BlockT, LoopT >::contains | ( | const InstT * | Inst | ) | const [inline] |
contains - Return true if the specified instruction is in this loop.
Definition at line 116 of file LoopInfo.h.
| bool llvm::LoopBase< BlockT, LoopT >::empty | ( | ) | const [inline] |
Definition at line 131 of file LoopInfo.h.
Referenced by emitBasicBlockLoopComments(), and llvm::LoopInfo::updateUnloop().
| iterator llvm::LoopBase< BlockT, LoopT >::end | ( | ) | const [inline] |
Definition at line 128 of file LoopInfo.h.
Referenced by llvm::GraphTraits< const MachineLoop * >::child_end(), llvm::GraphTraits< MachineLoop * >::child_end(), llvm::GraphTraits< const Loop * >::child_end(), llvm::GraphTraits< Loop * >::child_end(), CloneLoop(), llvm::ScalarEvolution::forgetLoop(), llvm::ScalarEvolution::print(), PrintChildLoopComment(), PrintLoopInfo(), and llvm::LoopInfo::updateUnloop().
| const std::vector<BlockT*>& llvm::LoopBase< BlockT, LoopT >::getBlocks | ( | ) | const [inline] |
getBlocks - Get a list of the basic blocks which make up this loop.
Definition at line 135 of file LoopInfo.h.
Referenced by llvm::UnrollLoop().
| std::vector<BlockT*>& llvm::LoopBase< BlockT, LoopT >::getBlocksVector | ( | ) | [inline] |
Definition at line 136 of file LoopInfo.h.
| BlockT * llvm::LoopBase< BlockT, LoopT >::getExitBlock | ( | ) | const |
getExitBlock - If getExitBlocks would return exactly one block, return that block. Otherwise return null.
Definition at line 86 of file LoopInfoImpl.h.
References llvm::SmallVectorTemplateCommon< T >::size().
| void llvm::LoopBase< BlockT, LoopT >::getExitBlocks | ( | SmallVectorImpl< BlockT * > & | ExitBlocks | ) | const |
getExitBlocks - Return all of the successor blocks of this loop. These are the blocks _outside of the current loop_ which are branched to.
Definition at line 67 of file LoopInfoImpl.h.
References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorTemplateCommon< T >::end(), I, and llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().
Referenced by PrintLoopInfo().
| void llvm::LoopBase< BlockT, LoopT >::getExitEdges | ( | SmallVectorImpl< Edge > & | ExitEdges | ) | const |
getExitEdges - Return all pairs of (_inside_block_,_outside_block_).
Definition at line 97 of file LoopInfoImpl.h.
References llvm::array_pod_sort(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorTemplateCommon< T >::end(), I, and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
| BlockT * llvm::LoopBase< BlockT, LoopT >::getExitingBlock | ( | ) | const |
getExitingBlock - If getExitingBlocks would return exactly one block, return that block. Otherwise return null.
Definition at line 54 of file LoopInfoImpl.h.
References llvm::SmallVectorTemplateCommon< T >::size().
Referenced by canExpandBackedgeTakenCount(), FindLoopCounter(), genLoopLimit(), getLoopTest(), and llvm::UnrollRuntimeLoopProlog().
| void llvm::LoopBase< BlockT, LoopT >::getExitingBlocks | ( | SmallVectorImpl< BlockT * > & | ExitingBlocks | ) | const |
getExitingBlocks - Return all blocks inside the loop that have successors outside of the loop. These are the blocks _inside of the current loop_ which branch out. The returned list is always unique.
Definition at line 33 of file LoopInfoImpl.h.
References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorTemplateCommon< T >::end(), I, and llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().
Referenced by llvm::Region::contains().
| BlockT* llvm::LoopBase< BlockT, LoopT >::getHeader | ( | ) | const [inline] |
Definition at line 92 of file LoopInfo.h.
Referenced by llvm::LoopBlocksTraversal::begin(), canConstantEvolve(), CloneLoopBlocks(), llvm::Region::contains(), DoInitialMatch(), emitBasicBlockLoopComments(), llvm::LoopBlocksTraversal::end(), FindLoopCounter(), FindPHIToPartitionLoops(), llvm::ScalarEvolution::getAddRecExpr(), getLoopPhiForCounter(), llvm::LoopBase< BasicBlock, Loop >::getNumBackEdges(), llvm::SCEVExpander::getOrInsertCanonicalInductionVariable(), llvm::InsertPreheaderForLoop(), isExistingPhi(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), llvm::ScalarEvolution::isLoopEntryGuardedByCond(), isLoopInvariant(), isSimplifiedLoopNest(), isTrivialLoopExitBlock(), PickMostRelevantLoop(), llvm::SCEV::print(), llvm::IVUsers::print(), PrintLoopInfo(), PrintParentLoopComment(), PushLoopPHIs(), llvm::SCEVExpander::replaceCongruentIVs(), llvm::LPPassManager::runOnFunction(), llvm::ScalarEvolution::SimplifyICmpOperands(), llvm::simplifyLoopIVs(), llvm::UnrollLoop(), and llvm::UnrollRuntimeLoopProlog().
| unsigned llvm::LoopBase< BlockT, LoopT >::getLoopDepth | ( | ) | const [inline] |
getLoopDepth - Return the nesting level of this loop. An outer-most loop has depth 1, for consistency with loop depth values used for basic blocks, where depth 0 is used for blocks not inside any loops.
Definition at line 85 of file LoopInfo.h.
Referenced by llvm::VirtRegAuxInfo::CalculateWeightAndHint(), emitBasicBlockLoopComments(), llvm::ScalarEvolution::getAddRecExpr(), PrintParentLoopComment(), and UpdateAnalysisInformation().
| BlockT * llvm::LoopBase< BlockT, LoopT >::getLoopLatch | ( | ) | const |
getLoopLatch - If there is a single latch block for this loop, return it. A latch block is a block that contains a branch back to the header.
Definition at line 169 of file LoopInfoImpl.h.
References N.
Referenced by CloneLoopBlocks(), ConnectProlog(), FindLoopCounter(), getLoopTest(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), IVUseShouldUsePostIncValue(), needsLFTR(), llvm::SCEVExpander::replaceCongruentIVs(), llvm::UnrollLoop(), and llvm::UnrollRuntimeLoopProlog().
| BlockT * llvm::LoopBase< BlockT, LoopT >::getLoopPredecessor | ( | ) | const |
getLoopPredecessor - If the given loop's header has exactly one unique predecessor outside the loop, return it. Otherwise return null. This is less strict that the loop "preheader" concept, which requires the predecessor to have exactly one successor.
Definition at line 143 of file LoopInfoImpl.h.
References N.
Referenced by llvm::ScalarEvolution::isLoopEntryGuardedByCond().
| BlockT * llvm::LoopBase< BlockT, LoopT >::getLoopPreheader | ( | ) | const |
getLoopPreheader - If there is a preheader for this loop, return it. A loop has a preheader if there is only one edge to the header of the loop from outside of the loop. If this is the case, the block branching to the header of the loop is the preheader node.
This method returns null if there is no preheader for the loop.
Definition at line 121 of file LoopInfoImpl.h.
Referenced by CloneLoopBlocks(), genLoopLimit(), llvm::UnrollLoop(), and llvm::UnrollRuntimeLoopProlog().
| unsigned llvm::LoopBase< BlockT, LoopT >::getNumBackEdges | ( | ) | const [inline] |
getNumBackEdges - Calculate the number of back edges to the loop header
Definition at line 162 of file LoopInfo.h.
| unsigned llvm::LoopBase< BlockT, LoopT >::getNumBlocks | ( | ) | const [inline] |
getNumBlocks - Get the number of blocks in this loop in constant time.
Definition at line 142 of file LoopInfo.h.
Referenced by llvm::LoopBlocksTraversal::begin(), llvm::LoopBlocksDFS::isComplete(), and llvm::LoopBlocksDFS::LoopBlocksDFS().
| LoopT* llvm::LoopBase< BlockT, LoopT >::getParentLoop | ( | ) | const [inline] |
Definition at line 93 of file LoopInfo.h.
Referenced by CloneLoopBlocks(), emitBasicBlockLoopComments(), llvm::LPPassManager::insertLoopIntoQueue(), LoopIsOuterMostWithPredecessor(), llvm::Region::outermostLoopInRegion(), llvm::ScalarEvolution::print(), PrintParentLoopComment(), llvm::UnrollRuntimeLoopProlog(), and llvm::LoopInfo::updateUnloop().
| const std::vector<LoopT *>& llvm::LoopBase< BlockT, LoopT >::getSubLoops | ( | ) | const [inline] |
iterator/begin/end - Return the loops contained entirely within this loop.
Definition at line 122 of file LoopInfo.h.
| std::vector<LoopT *>& llvm::LoopBase< BlockT, LoopT >::getSubLoopsVector | ( | ) | [inline] |
Definition at line 123 of file LoopInfo.h.
| bool llvm::LoopBase< BlockT, LoopT >::isLoopExiting | ( | const BlockT * | BB | ) | const [inline] |
isLoopExiting - True if terminator in the block can branch to another block that is outside of the current loop.
Definition at line 149 of file LoopInfo.h.
Referenced by llvm::VirtRegAuxInfo::CalculateWeightAndHint().
| void llvm::LoopBase< BlockT, LoopT >::moveToHeader | ( | BlockT * | BB | ) | [inline] |
moveToHeader - This method is used to move BB (which must be part of this loop) to be the loop header of the loop (the block that dominates all others).
Definition at line 278 of file LoopInfo.h.
| void llvm::LoopBase< BlockT, LoopT >::print | ( | raw_ostream & | OS, |
| unsigned | Depth = 0 |
||
| ) | const |
Definition at line 338 of file LoopInfoImpl.h.
References llvm::sys::path::begin(), llvm::sys::path::end(), I, llvm::raw_ostream::indent(), and llvm::WriteAsOperand().
Referenced by llvm::operator<<().
| reverse_iterator llvm::LoopBase< BlockT, LoopT >::rbegin | ( | ) | const [inline] |
Definition at line 129 of file LoopInfo.h.
Referenced by addLoopIntoQueue(), getLoopBackedgeTakenCounts(), and llvm::ScalarEvolution::verifyAnalysis().
| void llvm::LoopBase< BlockT, LoopT >::removeBlockFromLoop | ( | BlockT * | BB | ) | [inline] |
removeBlockFromLoop - This removes the specified basic block from the current loop, updating the Blocks as appropriate. This does not update the mapping in the LoopInfo class.
Definition at line 293 of file LoopInfo.h.
| LoopT* llvm::LoopBase< BlockT, LoopT >::removeChildLoop | ( | iterator | I | ) | [inline] |
removeChildLoop - This removes the specified child from being a subloop of this loop. The loop is not deleted, as it will presumably be inserted into another loop.
Definition at line 259 of file LoopInfo.h.
Referenced by llvm::LoopInfo::updateUnloop().
| reverse_iterator llvm::LoopBase< BlockT, LoopT >::rend | ( | ) | const [inline] |
Definition at line 130 of file LoopInfo.h.
Referenced by addLoopIntoQueue(), getLoopBackedgeTakenCounts(), and llvm::ScalarEvolution::verifyAnalysis().
| void llvm::LoopBase< BlockT, LoopT >::replaceChildLoopWith | ( | LoopT * | OldChild, |
| LoopT * | NewChild | ||
| ) |
replaceChildLoopWith - This is used when splitting loops up. It replaces the OldChild entry in our children list with NewChild, and updates the parent pointer of OldChild to be null and the NewChild to be this loop. This updates the loop depth of the new child.
Definition at line 224 of file LoopInfoImpl.h.
References I.
| void llvm::LoopBase< BlockT, LoopT >::setParentLoop | ( | LoopT * | L | ) | [inline] |
setParentLoop is a raw interface for bypassing addChildLoop.
Definition at line 96 of file LoopInfo.h.
| void llvm::LoopBase< BlockT, LoopT >::verifyLoop | ( | ) | const |
verifyLoop - Verify loop structure
Definition at line 237 of file LoopInfoImpl.h.
References llvm::sys::path::begin(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::df_begin(), llvm::df_end(), llvm::df_ext_begin(), llvm::df_ext_end(), llvm::SmallVectorBase::empty(), llvm::sys::path::end(), llvm::SmallVectorTemplateCommon< T >::end(), getParent(), I, llvm::SmallPtrSet< PtrType, SmallSize >::insert(), N, llvm::A64CC::NE, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and llvm::SmallVectorTemplateCommon< T >::size().
Referenced by llvm::LPPassManager::runOnFunction().
| void llvm::LoopBase< BlockT, LoopT >::verifyLoopNest | ( | DenseSet< const LoopT * > * | Loops | ) | const |
verifyLoop - Verify loop structure of this loop and all nested loops.
Definition at line 327 of file LoopInfoImpl.h.
References llvm::sys::path::begin(), llvm::sys::path::end(), I, and llvm::DenseSet< ValueT, ValueInfoT >::insert().
friend class LoopInfoBase< BlockT, LoopT > [friend] |
Definition at line 306 of file LoopInfo.h.