LLVM: llvm::LoopInfoBase< BlockT, LoopT > Class Template Reference (original) (raw)

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

#include "[llvm/Support/GenericLoopInfo.h](GenericLoopInfo%5F8h%5Fsource.html)"

Public Types
using iterator = typename std::vector<LoopT *>::const_iterator
iterator/begin/end - The interface to the top-level loops in the current function.
using reverse_iterator
Public Member Functions
LoopInfoBase ()=default
~LoopInfoBase ()
LoopInfoBase (LoopInfoBase &&Arg)
LoopInfoBase & operator= (LoopInfoBase &&RHS)
void releaseMemory ()
template<typename... ArgsTy>
LoopT * AllocateLoop (ArgsTy &&...Args)
iterator begin () const
iterator end () const
reverse_iterator rbegin () const
reverse_iterator rend () const
bool empty () const
SmallVector< LoopT *, 4 > getLoopsInPreorder () const
Return all of the loops in the function in preorder across the loop nests, with siblings in forward program order.
SmallVector< LoopT *, 4 > getLoopsInReverseSiblingPreorder () const
Return all of the loops in the function in preorder across the loop nests, with siblings in reverse program order.
LoopT * getLoopFor (const BlockT *BB) const
Return the inner most loop that BB lives in.
const LoopT * operator[] (const BlockT *BB) const
Same as getLoopFor.
unsigned getLoopDepth (const BlockT *BB) const
Return the loop nesting level of the specified block.
LoopT * getSmallestCommonLoop (LoopT *A, LoopT *B) const
Find the innermost loop containing both given loops.
LoopT * getSmallestCommonLoop (BlockT *A, BlockT *B) const
Find the innermost loop containing both given blocks.
bool isLoopHeader (const BlockT *BB) const
const std::vector< LoopT * > & getTopLevelLoops () const
Return the top-level loops.
std::vector< LoopT * > & getTopLevelLoopsVector ()
Return the top-level loops.
LoopT * removeLoop (iterator I)
This removes the specified top-level loop from this loop info object.
void changeLoopFor (BlockT *BB, LoopT *L)
Change the top-level loop that contains BB to the specified loop.
void changeTopLevelLoop (LoopT *OldLoop, LoopT *NewLoop)
Replace the specified loop in the top-level loops list with the indicated loop.
void addTopLevelLoop (LoopT *New)
This adds the specified loop to the collection of top-level loops.
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.
void analyze (const DominatorTreeBase< BlockT, false > &DomTree)
Create the loop forest using a stable algorithm.
void print (raw_ostream &OS) const
void verify (const DominatorTreeBase< BlockT, false > &DomTree) const
void destroy (LoopT *L)
Destroy a loop that has been removed from the LoopInfo nest.
Static Public Member Functions
static bool isNotAlreadyContainedIn (const LoopT *SubLoop, const LoopT *ParentLoop)
Friends
class LoopBase< BlockT, LoopT >
class LoopInfo

template<class BlockT, class LoopT>
class llvm::LoopInfoBase< BlockT, LoopT >

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

Definition at line 526 of file GenericLoopInfo.h.

iterator

template<class BlockT, class LoopT>

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

Definition at line 578 of file GenericLoopInfo.h.

reverse_iterator

template<class BlockT, class LoopT>

Initial value:

typename std::vector<LoopT *>::const_reverse_iterator

Definition at line 579 of file GenericLoopInfo.h.

template<class BlockT, class LoopT>

~LoopInfoBase()

template<class BlockT, class LoopT>

LoopInfoBase() [2/2]

template<class BlockT, class LoopT>

addTopLevelLoop()

template<class BlockT, class LoopT>

AllocateLoop()

template<class BlockT, class LoopT>

template<typename... ArgsTy>

analyze()

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 578 of file GenericLoopInfoImpl.h.

References llvm::DominatorTreeBase< NodeT, IsPostDom >::dominates(), llvm::DominatorTreeBase< NodeT, IsPostDom >::getNode(), llvm::DominatorTreeBase< NodeT, IsPostDom >::getRootNode(), llvm::inverse_children(), llvm::post_order(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().

Referenced by llvm::OptimizationRemarkEmitter::OptimizationRemarkEmitter(), llvm::LoopAnalysis::run(), and verify().

begin()

template<class BlockT, class LoopT>

changeLoopFor()

template<class BlockT, class LoopT>

changeTopLevelLoop()

template<class BlockT, class LoopT>

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

destroy()

template<class BlockT, class LoopT>

Destroy a loop that has been removed from the LoopInfo nest.

This runs the destructor of the loop object making it invalid to reference afterward. The memory is retained so that the pointer to the loop remains valid.

The caller is responsible for removing this loop from the loop nest and otherwise disconnecting it from the broader LoopInfo data structures. Callers that don't naturally handle this themselves should probably call ‘erase’ instead.

Definition at line 721 of file GenericLoopInfo.h.

Referenced by deleteDeadBlocksFromLoop(), llvm::deleteDeadLoop(), and rebuildLoopAfterUnswitch().

empty()

template<class BlockT, class LoopT>

end()

template<class BlockT, class LoopT>

getLoopDepth()

template<class BlockT, class LoopT>

getLoopFor()

template<class BlockT, class LoopT>

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 606 of file GenericLoopInfo.h.

Referenced by llvm::addClonedBlockToLoopInfo(), buildClonedLoops(), canProveExitOnFirstIteration(), llvm::MachineBasicBlock::canSplitCriticalEdge(), checkDependencies(), llvm::cloneLoop(), cloneLoopBlocks(), cloneLoopNest(), llvm::cloneLoopWithPreheader(), collectUnswitchCandidates(), collectUnswitchCandidatesWithInjections(), computeHeuristicUnrollFactor(), ConnectProlog(), llvm::TileInfo::CreateTiledLoops(), despeculateCountZeros(), dumpExampleDependence(), llvm::dumpMaxRegPressure(), emitBasicBlockLoopComments(), llvm::MustBeExecutedContextExplorer::findBackwardJoinPoint(), llvm::MustBeExecutedContextExplorer::findForwardJoinPoint(), foldURemOfLoopIncrement(), formLCSSAForInstructionsImpl(), formLCSSAImpl(), getInnermostLoopFor(), getInsertPointForUses(), getIVIncrement(), llvm::LoopInfoBase< BasicBlock, Loop >::getLoopDepth(), getOutermostLoop(), getReductionInstr(), getSmallestCommonLoop(), getTopMostExitingLoop(), hoistLoopToNewParent(), injectPendingInvariantConditions(), inSubLoop(), IsAcceptableTarget(), llvm::HardwareLoopInfo::isHardwareLoopCandidate(), isIntegerLoopHeaderPHI(), isInteresting(), llvm::LoopInfoBase< BasicBlock, Loop >::isLoopHeader(), llvm::isPotentiallyReachable(), llvm::Loop::isRecursivelyLCSSAForm(), isRemOfLoopIncrementWithLoopInvariant(), isSameUnderlyingObjectInLoop(), mergeBlocksIntoPredecessors(), moveLCSSAPhis(), needToInsertPhisForLCSSA(), llvm::LoopInfoBase< BasicBlock, Loop >::operator, rebuildLoopAfterUnswitch(), recomputeLoopBlockSet(), llvm::rewriteLoopExitValues(), llvm::simplifyUsersOfIV(), sinkInstruction(), sortBlocks(), llvm::SplitBlockAndInsertIfThenElse(), llvm::splitBlockBefore(), SplitBlockImpl(), SplitBlockPredecessorsImpl(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchNontrivialInvariants(), UpdateAnalysisInformation(), updateLoopInfo(), and llvm::LoopBase< BasicBlock, Loop >::verifyLoopNest().

getLoopsInPreorder()

getLoopsInReverseSiblingPreorder()

getSmallestCommonLoop() [1/2]

template<class BlockT, class LoopT>

LoopT * llvm::LoopInfoBase< BlockT, LoopT >::getSmallestCommonLoop ( BlockT * A,
BlockT * B ) const

getSmallestCommonLoop() [2/2]

template<class BlockT, class LoopT>

LoopT * llvm::LoopInfoBase< BlockT, LoopT >::getSmallestCommonLoop ( LoopT * A,
LoopT * B ) const

getTopLevelLoops()

template<class BlockT, class LoopT>

getTopLevelLoopsVector()

template<class BlockT, class LoopT>

std::vector< LoopT * > & llvm::LoopInfoBase< BlockT, LoopT >::getTopLevelLoopsVector ( ) inline

isLoopHeader()

template<class BlockT, class LoopT>

isNotAlreadyContainedIn()

template<class BlockT, class LoopT>

operator=()

template<class BlockT, class LoopT>

operator[]()

template<class BlockT, class LoopT>

print()

rbegin()

template<class BlockT, class LoopT>

releaseMemory()

template<class BlockT, class LoopT>

removeBlock()

template<class BlockT, class LoopT>

removeLoop()

template<class BlockT, class LoopT>

rend()

template<class BlockT, class LoopT>

verify()

Definition at line 749 of file GenericLoopInfoImpl.h.

References llvm::addInnerLoopsToHeadersMap(), analyze(), assert(), begin(), llvm::compareLoops(), llvm::dbgs(), E(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::empty(), end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::erase(), I, llvm_unreachable, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::lookup(), and Loops.

Referenced by FixIrreducibleImpl(), llvm::hoistRegion(), injectPendingInvariantConditions(), llvm::FunctionToLoopPassAdaptor::run(), llvm::LoopBoundSplitPass::run(), llvm::LoopVerifierPass::run(), turnGuardIntoBranch(), unifyLoopExits(), llvm::UnrollAndJamLoop(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), and unswitchNontrivialInvariants().

LoopBase< BlockT, LoopT >

template<class BlockT, class LoopT>

LoopInfo

template<class BlockT, class LoopT>


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