LLVM API Documentation
#include <LoopInfo.h>
Public Types | |
| typedef std::vector< LoopBase < BlockT > * >::const_iterator | iterator |
| typedef std::vector< BlockT * > ::const_iterator | block_iterator |
Public Member Functions | |
| LoopBase () | |
| Loop ctor - This creates an empty loop. | |
| ~LoopBase () | |
| unsigned | getLoopDepth () const |
| BlockT * | getHeader () const |
| LoopBase< BlockT > * | getParentLoop () const |
| bool | contains (const BlockT *BB) const |
| const std::vector< LoopBase < BlockT > * > & | getSubLoops () const |
| iterator | begin () const |
| iterator | end () const |
| bool | empty () const |
| const std::vector< BlockT * > & | getBlocks () const |
| block_iterator | block_begin () const |
| block_iterator | block_end () const |
| bool | isLoopExit (const BlockT *BB) const |
| unsigned | getNumBackEdges () const |
| bool | isLoopInvariant (Value *V) const |
| void | getExitingBlocks (SmallVectorImpl< BlockT * > &ExitingBlocks) const |
| void | getExitBlocks (SmallVectorImpl< BlockT * > &ExitBlocks) const |
| void | getUniqueExitBlocks (SmallVectorImpl< BlockT * > &ExitBlocks) const |
| BlockT * | getLoopPreheader () const |
| BlockT * | getLoopLatch () const |
| PHINode * | getCanonicalInductionVariable () const |
| Instruction * | getCanonicalInductionVariableIncrement () const |
| Value * | getTripCount () const |
| unsigned | getSmallConstantTripCount () const |
| unsigned | getSmallConstantTripMultiple () const |
| bool | isLCSSAForm () const |
| isLCSSAForm - Return true if the Loop is in LCSSA form | |
| void | addBasicBlockToLoop (BlockT *NewBB, LoopInfoBase< BlockT > &LI) |
| void | replaceChildLoopWith (LoopBase< BlockT > *OldChild, LoopBase< BlockT > *NewChild) |
| void | addChildLoop (LoopBase< BlockT > *NewChild) |
| LoopBase< BlockT > * | removeChildLoop (iterator I) |
| void | addBlockEntry (BlockT *BB) |
| void | moveToHeader (BlockT *BB) |
| void | removeBlockFromLoop (BlockT *BB) |
| void | verifyLoop () const |
| verifyLoop - Verify loop structure | |
| void | print (std::ostream &OS, unsigned Depth=0) const |
| void | print (std::ostream *O, unsigned Depth=0) const |
| void | dump () const |
| template<> | |
| PHINode * | getCanonicalInductionVariable () const |
| template<> | |
| Instruction * | getCanonicalInductionVariableIncrement () const |
| template<> | |
| bool | isLoopInvariant (Value *V) const |
| template<> | |
| Value * | getTripCount () const |
| template<> | |
| bool | isLCSSAForm () const |
Friends | |
| class | LoopInfoBase< BlockT > |
Definition at line 67 of file LoopInfo.h.
| typedef std::vector<LoopBase<BlockT>*>::const_iterator llvm::LoopBase< BlockT >::iterator |
Definition at line 107 of file LoopInfo.h.
| typedef std::vector<BlockT*>::const_iterator llvm::LoopBase< BlockT >::block_iterator |
Definition at line 115 of file LoopInfo.h.
| llvm::LoopBase< BlockT >::LoopBase | ( | ) | [inline] |
| llvm::LoopBase< BlockT >::~LoopBase | ( | ) | [inline] |
Definition at line 80 of file LoopInfo.h.
| unsigned llvm::LoopBase< BlockT >::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 88 of file LoopInfo.h.
References CurLoop, and llvm::LoopBase< BlockT >::ParentLoop.
Referenced by llvm::ScalarEvolution::getAddRecExpr(), and llvm::LoopInfoBase< llvm::MachineBasicBlock >::getLoopDepth().
| BlockT* llvm::LoopBase< BlockT >::getHeader | ( | ) | const [inline] |
Definition at line 95 of file LoopInfo.h.
Referenced by llvm::LoopBase< BlockT >::addBasicBlockToLoop(), ApproximateLoopSize(), llvm::CloneLoop(), llvm::LoopInfoBase< llvm::MachineBasicBlock >::ConsiderForLoop(), FindPHIToPartitionLoops(), llvm::LoopBase< BlockT >::getCanonicalInductionVariable(), getConstantEvolvingPHI(), llvm::LoopBase< BlockT >::getLoopLatch(), llvm::LoopBase< BlockT >::getLoopPreheader(), llvm::LoopBase< BlockT >::getNumBackEdges(), getSCEVStartAndStride(), llvm::LoopBase< BlockT >::getTripCount(), llvm::LoopInfoBase< llvm::MachineBasicBlock >::InsertLoopInto(), llvm::LoopInfoBase< llvm::MachineBasicBlock >::isLoopHeader(), llvm::SCEVAddRecExpr::isLoopInvariant(), isTrivialLoopExitBlock(), llvm::SCEVAddRecExpr::print(), PrintLoopInfo(), llvm::UnrollLoop(), llvm::LoopBase< BlockT >::verifyLoop(), and llvm::SCEVExpander::visitAddRecExpr().
| LoopBase<BlockT>* llvm::LoopBase< BlockT >::getParentLoop | ( | ) | const [inline] |
Definition at line 96 of file LoopInfo.h.
Referenced by llvm::LoopBase< BlockT >::addBasicBlockToLoop(), llvm::LoopInfoBase< llvm::MachineBasicBlock >::addTopLevelLoop(), llvm::CloneLoop(), llvm::LoopInfoBase< llvm::MachineBasicBlock >::ConsiderForLoop(), llvm::LPPassManager::deleteLoopFromQueue(), llvm::LoopInfoBase< llvm::MachineBasicBlock >::isNotAlreadyContainedIn(), LoopIsOuterMostWithPreheader(), llvm::LoopInfoBase< llvm::MachineBasicBlock >::MoveSiblingLoopInto(), llvm::ScalarEvolution::print(), llvm::LoopInfoBase< llvm::MachineBasicBlock >::removeBlock(), llvm::LoopInfoBase< llvm::MachineBasicBlock >::removeLoop(), and llvm::SCEVExpander::visitAddRecExpr().
| bool llvm::LoopBase< BlockT >::contains | ( | const BlockT * | BB | ) | const [inline] |
contains - Return true if the specified basic block is in this loop
Definition at line 100 of file LoopInfo.h.
Referenced by llvm::LoopInfoBase< llvm::MachineBasicBlock >::ConsiderForLoop(), FindPHIToPartitionLoops(), llvm::LoopBase< BlockT >::getCanonicalInductionVariable(), llvm::LoopBase< BlockT >::getCanonicalInductionVariableIncrement(), getConstantEvolvingPHI(), llvm::LoopBase< BlockT >::getLoopLatch(), llvm::LoopBase< BlockT >::getLoopPreheader(), llvm::LoopBase< BlockT >::getNumBackEdges(), llvm::LoopBase< BlockT >::getTripCount(), llvm::LoopInfoBase< llvm::MachineBasicBlock >::InsertLoopInto(), llvm::LoopBase< BlockT >::isLoopExit(), llvm::SCEVUnknown::isLoopInvariant(), llvm::SCEVAddRecExpr::isLoopInvariant(), llvm::LoopBase< BlockT >::isLoopInvariant(), isTrivialLoopExitBlockHelper(), isUsedOutsideLoop(), IVUseShouldUsePostIncValue(), RemoveCommonExpressionsFromUseBases(), llvm::UnrollLoop(), and llvm::SCEVExpander::visitAddRecExpr().
| const std::vector<LoopBase<BlockT>*>& llvm::LoopBase< BlockT >::getSubLoops | ( | ) | const [inline] |
iterator/begin/end - Return the loops contained entirely within this loop.
Definition at line 106 of file LoopInfo.h.
| iterator llvm::LoopBase< BlockT >::begin | ( | ) | const [inline] |
Definition at line 108 of file LoopInfo.h.
Referenced by addLoopIntoQueue(), llvm::GraphTraits< MachineLoop * >::child_begin(), llvm::GraphTraits< const MachineLoop * >::child_begin(), llvm::GraphTraits< Loop * >::child_begin(), llvm::GraphTraits< const Loop * >::child_begin(), CloneLoop(), llvm::CloneLoop(), llvm::LoopInfoBase< llvm::MachineBasicBlock >::ConsiderForLoop(), llvm::LoopBase< BlockT >::print(), PrintLoopInfo(), and llvm::LoopBase< BlockT >::removeChildLoop().
| iterator llvm::LoopBase< BlockT >::end | ( | ) | const [inline] |
Definition at line 109 of file LoopInfo.h.
Referenced by addLoopIntoQueue(), llvm::GraphTraits< MachineLoop * >::child_end(), llvm::GraphTraits< const MachineLoop * >::child_end(), llvm::GraphTraits< Loop * >::child_end(), llvm::GraphTraits< const Loop * >::child_end(), CloneLoop(), llvm::CloneLoop(), llvm::LoopInfoBase< llvm::MachineBasicBlock >::ConsiderForLoop(), llvm::LPPassManager::deleteLoopFromQueue(), llvm::LoopBase< BlockT >::print(), and PrintLoopInfo().
| bool llvm::LoopBase< BlockT >::empty | ( | ) | const [inline] |
Definition at line 110 of file LoopInfo.h.
Referenced by llvm::LPPassManager::deleteLoopFromQueue().
| const std::vector<BlockT*>& llvm::LoopBase< BlockT >::getBlocks | ( | ) | const [inline] |
getBlocks - Get a list of the basic blocks which make up this loop.
Definition at line 114 of file LoopInfo.h.
Referenced by llvm::LPPassManager::deleteLoopFromQueue(), llvm::ExtractLoop(), llvm::LoopBase< BlockT >::print(), and llvm::UnrollLoop().
| block_iterator llvm::LoopBase< BlockT >::block_begin | ( | ) | const [inline] |
Definition at line 116 of file LoopInfo.h.
Referenced by ApproximateLoopSize(), CloneLoop(), llvm::CloneLoop(), llvm::LPPassManager::deleteLoopFromQueue(), llvm::LoopBase< BlockT >::getExitBlocks(), llvm::LoopBase< BlockT >::getExitingBlocks(), llvm::LoopBase< BlockT >::getUniqueExitBlocks(), and llvm::LoopBase< BlockT >::isLCSSAForm().
| block_iterator llvm::LoopBase< BlockT >::block_end | ( | ) | const [inline] |
Definition at line 117 of file LoopInfo.h.
Referenced by ApproximateLoopSize(), CloneLoop(), llvm::CloneLoop(), llvm::LPPassManager::deleteLoopFromQueue(), llvm::LoopBase< BlockT >::getExitBlocks(), llvm::LoopBase< BlockT >::getExitingBlocks(), llvm::LoopBase< BlockT >::getUniqueExitBlocks(), and llvm::LoopBase< BlockT >::isLCSSAForm().
| bool llvm::LoopBase< BlockT >::isLoopExit | ( | const BlockT * | BB | ) | const [inline] |
isLoopExit - True if terminator in the block can branch to another block that is outside of the current loop.
Definition at line 122 of file LoopInfo.h.
References llvm::LoopBase< BlockT >::contains(), and SE.
| unsigned llvm::LoopBase< BlockT >::getNumBackEdges | ( | ) | const [inline] |
getNumBackEdges - Calculate the number of back edges to the loop header
Definition at line 135 of file LoopInfo.h.
References llvm::LoopBase< BlockT >::contains(), E, llvm::LoopBase< BlockT >::getHeader(), and H.
| bool llvm::LoopBase< BlockT >::isLoopInvariant | ( | Value * | V | ) | const [inline] |
isLoopInvariant - Return true if the specified value is loop invariant
Definition at line 151 of file LoopInfo.h.
References llvm::LoopBase< BlockT >::contains().
Referenced by FindLIVLoopCondition(), and llvm::SCEVExpander::visitAddRecExpr().
| void llvm::LoopBase< BlockT >::getExitingBlocks | ( | SmallVectorImpl< BlockT * > & | ExitingBlocks | ) | const [inline] |
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 169 of file LoopInfo.h.
References llvm::SmallVectorImpl< T >::begin(), llvm::LoopBase< BlockT >::block_begin(), llvm::LoopBase< BlockT >::block_end(), E, llvm::SmallVectorImpl< T >::end(), and llvm::SmallVectorImpl< T >::push_back().
| void llvm::LoopBase< BlockT >::getExitBlocks | ( | SmallVectorImpl< BlockT * > & | ExitBlocks | ) | const [inline] |
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 191 of file LoopInfo.h.
References llvm::SmallVectorImpl< T >::begin(), llvm::LoopBase< BlockT >::block_begin(), llvm::LoopBase< BlockT >::block_end(), E, llvm::SmallVectorImpl< T >::end(), and llvm::SmallVectorImpl< T >::push_back().
Referenced by PrintLoopInfo().
| void llvm::LoopBase< BlockT >::getUniqueExitBlocks | ( | SmallVectorImpl< BlockT * > & | ExitBlocks | ) | const [inline] |
getUniqueExitBlocks - Return all unique successor blocks of this loop. These are the blocks _outside of the current loop_ which are branched to. This assumes that loop is in canonical form.
Definition at line 212 of file LoopInfo.h.
References llvm::SmallVectorImpl< T >::begin(), llvm::LoopBase< BlockT >::block_begin(), llvm::LoopBase< BlockT >::block_end(), E, llvm::SmallVectorImpl< T >::end(), PI, and llvm::SmallVectorImpl< T >::push_back().
| BlockT* llvm::LoopBase< BlockT >::getLoopPreheader | ( | ) | const [inline] |
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 274 of file LoopInfo.h.
References llvm::LoopBase< BlockT >::contains(), llvm::LoopBase< BlockT >::getHeader(), Header, Out, and PI.
Referenced by getSCEVStartAndStride(), LoopIsOuterMostWithPreheader(), llvm::UnrollLoop(), llvm::LoopBase< BlockT >::verifyLoop(), and llvm::SCEVExpander::visitAddRecExpr().
| BlockT* llvm::LoopBase< BlockT >::getLoopLatch | ( | ) | const [inline] |
getLoopLatch - If there is a latch block for this loop, return it. A latch block is the canonical backedge for a loop. A loop header in normal form has two edges into it: one from a preheader and one from a latch block.
Definition at line 307 of file LoopInfo.h.
References llvm::LoopBase< BlockT >::contains(), llvm::LoopBase< BlockT >::getHeader(), Header, and PI.
Referenced by llvm::CloneLoop(), IVUseShouldUsePostIncValue(), llvm::UnrollLoop(), and llvm::LoopBase< BlockT >::verifyLoop().
| PHINode* llvm::LoopBase< BlockT >::getCanonicalInductionVariable | ( | ) | const [inline] |
getCanonicalInductionVariable - Check to see if the loop has a canonical induction variable: an integer recurrence that starts at 0 and increments by one each time through the loop. If so, return the phi node that corresponds to it.
Definition at line 337 of file LoopInfo.h.
References Add(), llvm::LoopBase< BlockT >::contains(), llvm::LoopBase< BlockT >::getHeader(), llvm::PHINode::getIncomingValueForBlock(), llvm::Constant::getOperand(), H, PI, and std::swap().
Referenced by llvm::LoopBase< BlockT >::getCanonicalInductionVariableIncrement().
| Instruction* llvm::LoopBase< BlockT >::getCanonicalInductionVariableIncrement | ( | ) | const [inline] |
getCanonicalInductionVariableIncrement - Return the LLVM value that holds the canonical induction variable value for the "next" iteration of the loop. This always succeeds if getCanonicalInductionVariable succeeds.
Definition at line 379 of file LoopInfo.h.
References llvm::LoopBase< BlockT >::contains(), and llvm::LoopBase< BlockT >::getCanonicalInductionVariable().
Referenced by llvm::LoopBase< BlockT >::getTripCount().
| Value* llvm::LoopBase< BlockT >::getTripCount | ( | ) | const [inline] |
getTripCount - Return a loop-invariant LLVM value indicating the number of times the loop will be executed. Note that this means that the backedge of the loop executes N-1 times. If the trip-count cannot be determined, this returns null.
Definition at line 392 of file LoopInfo.h.
References llvm::LoopBase< BlockT >::contains(), llvm::LoopBase< BlockT >::getCanonicalInductionVariableIncrement(), llvm::LoopBase< BlockT >::getHeader(), llvm::PHINode::getIncomingBlock(), llvm::User::getOperand(), llvm::CmpInst::ICMP_EQ, and llvm::CmpInst::ICMP_NE.
Referenced by llvm::LoopBase< BlockT >::getSmallConstantTripCount(), and llvm::LoopBase< BlockT >::getSmallConstantTripMultiple().
| unsigned llvm::LoopBase< BlockT >::getSmallConstantTripCount | ( | ) | const [inline] |
getSmallConstantTripCount - Returns the trip count of this loop as a normal unsigned value, if possible. Returns 0 if the trip count is unknown of not constant. Will also return 0 if the trip count is very large (>= 2^32)
Definition at line 423 of file LoopInfo.h.
References llvm::LoopBase< BlockT >::getTripCount().
Referenced by llvm::UnrollLoop().
| unsigned llvm::LoopBase< BlockT >::getSmallConstantTripMultiple | ( | ) | const [inline] |
getSmallConstantTripMultiple - Returns the largest constant divisor of the trip count of this loop as a normal unsigned value, if possible. This means that the actual trip count is always a multiple of the returned value (don't forget the trip count could very well be zero as well!).
Returns 1 if the trip count is unknown or not guaranteed to be the multiple of a constant (which is also the case if the trip count is simply constant, use getSmallConstantTripCount for that case), Will also return 1 if the trip count is very large (>= 2^32).
Definition at line 445 of file LoopInfo.h.
References llvm::dyn_cast(), llvm::APInt::getActiveBits(), llvm::LoopBase< BlockT >::getTripCount(), llvm::ConstantInt::getValue(), and llvm::ConstantInt::getZExtValue().
Referenced by llvm::UnrollLoop().
| bool llvm::LoopBase< BlockT >::isLCSSAForm | ( | ) | const [inline] |
isLCSSAForm - Return true if the Loop is in LCSSA form
Definition at line 473 of file LoopInfo.h.
References BB, llvm::LoopBase< BlockT >::block_begin(), llvm::LoopBase< BlockT >::block_end(), llvm::SmallPtrSet< PtrType, SmallSize >::count(), E, and llvm::MachineBasicBlock::getParent().
Referenced by llvm::UnrollLoop().
| void llvm::LoopBase< BlockT >::addBasicBlockToLoop | ( | BlockT * | NewBB, | |
| LoopInfoBase< BlockT > & | LI | |||
| ) | [inline] |
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 1048 of file LoopInfo.h.
References llvm::LoopInfoBase< BlockT >::BBMap, llvm::LoopBase< BlockT >::Blocks, Blocks, llvm::LoopBase< BlockT >::getHeader(), llvm::LoopBase< BlockT >::getParentLoop(), and L.
Referenced by CloneLoop(), llvm::CloneLoop(), llvm::SplitBlock(), and llvm::UnrollLoop().
| void llvm::LoopBase< BlockT >::replaceChildLoopWith | ( | LoopBase< BlockT > * | OldChild, | |
| LoopBase< BlockT > * | NewChild | |||
| ) | [inline] |
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 514 of file LoopInfo.h.
References llvm::LoopBase< BlockT >::ParentLoop.
| void llvm::LoopBase< BlockT >::addChildLoop | ( | LoopBase< BlockT > * | 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 529 of file LoopInfo.h.
References llvm::LoopBase< BlockT >::ParentLoop.
Referenced by llvm::LPPassManager::insertLoop().
| LoopBase<BlockT>* llvm::LoopBase< BlockT >::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 538 of file LoopInfo.h.
References llvm::LoopBase< BlockT >::begin().
Referenced by llvm::LPPassManager::deleteLoopFromQueue().
| void llvm::LoopBase< BlockT >::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 550 of file LoopInfo.h.
| void llvm::LoopBase< BlockT >::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 557 of file LoopInfo.h.
| void llvm::LoopBase< BlockT >::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 572 of file LoopInfo.h.
References llvm::RemoveFromVector().
Referenced by llvm::LoopInfoBase< llvm::MachineBasicBlock >::removeBlock().
| void llvm::LoopBase< BlockT >::verifyLoop | ( | ) | const [inline] |
verifyLoop - Verify loop structure
Definition at line 577 of file LoopInfo.h.
References E, llvm::LoopBase< BlockT >::getHeader(), llvm::LoopBase< BlockT >::getLoopLatch(), and llvm::LoopBase< BlockT >::getLoopPreheader().
| void llvm::LoopBase< BlockT >::print | ( | std::ostream & | OS, | |
| unsigned | Depth = 0 | |||
| ) | const [inline] |
Definition at line 588 of file LoopInfo.h.
References llvm::LoopBase< BlockT >::begin(), E, llvm::LoopBase< BlockT >::end(), llvm::LoopBase< BlockT >::getBlocks(), and llvm::WriteAsOperand().
Referenced by llvm::LoopBase< BlockT >::dump(), and llvm::LoopBase< BlockT >::print().
| void llvm::LoopBase< BlockT >::print | ( | std::ostream * | O, | |
| unsigned | Depth = 0 | |||
| ) | const [inline] |
| void llvm::LoopBase< BlockT >::dump | ( | ) | const [inline] |
Definition at line 605 of file LoopInfo.h.
References llvm::cerr(), and llvm::LoopBase< BlockT >::print().
| PHINode * llvm::LoopBase< MachineBasicBlock >::getCanonicalInductionVariable | ( | ) | const [inline] |
Definition at line 40 of file MachineLoopInfo.h.
| Instruction * llvm::LoopBase< MachineBasicBlock >::getCanonicalInductionVariableIncrement | ( | ) | const [inline] |
Definition at line 46 of file MachineLoopInfo.h.
| bool llvm::LoopBase< MachineBasicBlock >::isLoopInvariant | ( | Value * | V | ) | const [inline] |
Definition at line 53 of file MachineLoopInfo.h.
| Value * llvm::LoopBase< MachineBasicBlock >::getTripCount | ( | ) | const [inline] |
Definition at line 59 of file MachineLoopInfo.h.
| bool llvm::LoopBase< MachineBasicBlock >::isLCSSAForm | ( | ) | const [inline] |
Definition at line 65 of file MachineLoopInfo.h.
friend class LoopInfoBase< BlockT > [friend] |
Definition at line 610 of file LoopInfo.h.