LLVM
8.0.1
|
This class builds and contains all of the top-level loop structures in the specified function. More...
#include "llvm/Analysis/LoopInfo.h"
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) | |
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 () |
Return all of the loops in the function in preorder across the loop nests, with siblings in forward program order. More... | |
SmallVector< LoopT *, 4 > | getLoopsInReverseSiblingPreorder () |
Return all of the loops in the function in preorder across the loop nests, with siblings in reverse program order. More... | |
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, false > &DomTree) |
Create the loop forest using a stable algorithm. More... | |
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. More... | |
Static Public Member Functions | |
static bool | isNotAlreadyContainedIn (const LoopT *SubLoop, const LoopT *ParentLoop) |
Friends | |
class | LoopBase< BlockT, LoopT > |
class | LoopInfo |
This class builds and contains all of the top-level loop structures in the specified function.
Definition at line 62 of file LoopInfo.h.
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 662 of file LoopInfo.h.
typedef std::vector<LoopT *>::const_reverse_iterator llvm::LoopInfoBase< BlockT, LoopT >::reverse_iterator |
Definition at line 664 of file LoopInfo.h.
|
inline |
Definition at line 623 of file LoopInfo.h.
|
inline |
Definition at line 624 of file LoopInfo.h.
|
inline |
Definition at line 626 of file LoopInfo.h.
|
inline |
This adds the specified loop to the collection of top-level loops.
Definition at line 741 of file LoopInfo.h.
Referenced by llvm::addClonedBlockToLoopInfo(), llvm::MachineLoopInfo::addTopLevelLoop(), buildClonedLoops(), CloneLoop(), cloneLoopNest(), llvm::cloneLoopWithPreheader(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), getOnlyLiveSuccessor(), hoistLoopToNewParent(), and rebuildLoopAfterUnswitch().
|
inline |
Definition at line 654 of file LoopInfo.h.
Referenced by llvm::addClonedBlockToLoopInfo(), buildClonedLoops(), CloneLoop(), cloneLoopNest(), llvm::cloneLoopWithPreheader(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), and separateNestedLoop().
void llvm::LoopInfoBase< BlockT, LoopT >::analyze | ( | const DominatorTreeBase< BlockT, false > & | 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 554 of file LoopInfoImpl.h.
Referenced by llvm::VPlanHCFGBuilder::buildHierarchicalCFG(), llvm::OptimizationRemarkEmitter::OptimizationRemarkEmitter(), llvm::LoopAnalysis::run(), and llvm::LoopInfoBase< BasicBlock, Loop >::verify().
|
inline |
Definition at line 665 of file LoopInfo.h.
Referenced by llvm::MachineLoopInfo::begin(), calculateUnswitchCostMultiplier(), llvm::createLoopSimplifyPass(), llvm::LoopFullUnrollPass::run(), and llvm::LoopSimplifyPass::run().
|
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 722 of file LoopInfo.h.
Referenced by llvm::MachineLoopInfo::changeLoopFor(), cloneLoopNest(), deleteDeadBlocksFromLoop(), llvm::discoverAndMapSubloop(), getOnlyLiveSuccessor(), hoistLoopToNewParent(), rebuildLoopAfterUnswitch(), and separateNestedLoop().
|
inline |
Replace the specified loop in the top-level loops list with the indicated loop.
Definition at line 732 of file LoopInfo.h.
Referenced by llvm::MachineLoopInfo::changeTopLevelLoop(), and separateNestedLoop().
|
inline |
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 788 of file LoopInfo.h.
Referenced by deleteDeadBlocksFromLoop(), and rebuildLoopAfterUnswitch().
|
inline |
Definition at line 669 of file LoopInfo.h.
Referenced by llvm::MachineLoopInfo::empty(), and llvm::LoopSinkPass::run().
|
inline |
Definition at line 666 of file LoopInfo.h.
Referenced by calculateUnswitchCostMultiplier(), llvm::createLoopSimplifyPass(), llvm::MachineLoopInfo::end(), llvm::LoopFullUnrollPass::run(), and llvm::LoopSimplifyPass::run().
|
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 697 of file LoopInfo.h.
Referenced by CompareValueComplexity(), llvm::MachineLoopInfo::getLoopDepth(), and rebuildLoopAfterUnswitch().
|
inline |
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 690 of file LoopInfo.h.
Referenced by llvm::addClonedBlockToLoopInfo(), llvm::DivergenceAnalysis::addUniformOverride(), buildClonedLoops(), castToIncrementInst(), CloneInstructionInExitBlock(), CloneLoop(), CloneLoopBlocks(), cloneLoopNest(), llvm::DivergencePropagator::computeJoinPoints(), computeUnlikelySuccessors(), ConnectProlog(), llvm::createSIFixWWMLivenessPass(), deleteDeadInstruction(), llvm::discoverAndMapSubloop(), llvm::VPBasicBlock::execute(), llvm::VPlan::execute(), llvm::InnerLoopVectorizer::fixFirstOrderRecurrence(), llvm::InnerLoopVectorizer::fixReduction(), llvm::InnerLoopVectorizer::fixVectorizedLoop(), llvm::formLCSSAForInstructions(), getInsertPointForUses(), llvm::MachineLoopInfo::getLoopFor(), getOnlyLiveSuccessor(), getOutermostLoop(), getReductionValue(), hoistLoopToNewParent(), llvm::DivergenceAnalysis::inRegion(), inSubLoop(), IsAcceptableTarget(), isIntegerLoopHeaderPHI(), isInteresting(), isMustExecuteIn(), llvm::isPotentiallyReachable(), llvm::Loop::isRecursivelyLCSSAForm(), isSafeToExecuteUnconditionally(), isSameUnderlyingObjectInLoop(), isSimplifiedLoopNest(), mayUsePostIncMode(), mergeBlocksIntoPredecessors(), needToInsertPhisForLCSSA(), llvm::MachineLoopInfo::operator[](), llvm::promoteLoopAccessesToScalars(), rebuildLoopAfterUnswitch(), recomputeLoopBlockSet(), llvm::simplifyUsersOfIV(), sinkInstruction(), llvm::InnerLoopVectorizer::sinkScalarOperands(), llvm::SplitBlock(), llvm::SplitBlockAndInsertIfThen(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchBestCondition(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), unswitchTrivialSwitch(), llvm::InnerLoopVectorizer::updateAnalysis(), UpdateAnalysisInformation(), visitIVCast(), and llvm::LoopBlocksTraversal::visitPreorder().
SmallVector< LoopT *, 4 > llvm::LoopInfoBase< BlockT, LoopT >::getLoopsInPreorder | ( | ) |
Return all of the loops in the function in preorder across the loop nests, with siblings in forward program order.
Note that because loops form a forest of trees, preorder is equivalent to reverse postorder.
Definition at line 583 of file LoopInfoImpl.h.
Referenced by castToIncrementInst(), llvm::LoopSinkPass::run(), and warnAboutLeftoverTransformations().
SmallVector< LoopT *, 4 > llvm::LoopInfoBase< BlockT, LoopT >::getLoopsInReverseSiblingPreorder | ( | ) |
Return all of the loops in the function in preorder across the loop nests, with siblings in reverse program order.
Note that because loops form a forest of trees, preorder is equivalent to reverse postorder.
Also note that this is not a reverse preorder. Only the siblings are in reverse program order.
Definition at line 608 of file LoopInfoImpl.h.
|
inline |
Definition at line 703 of file LoopInfo.h.
Referenced by getOnlyLiveSuccessor(), llvm::GetUnderlyingObjects(), and llvm::MachineLoopInfo::isLoopHeader().
|
inlinestatic |
Definition at line 761 of file LoopInfo.h.
|
inline |
Definition at line 633 of file LoopInfo.h.
|
inline |
Same as getLoopFor.
Definition at line 693 of file LoopInfo.h.
void llvm::LoopInfoBase< BlockT, LoopT >::print | ( | raw_ostream & | OS | ) | const |
Definition at line 633 of file LoopInfoImpl.h.
|
inline |
Definition at line 667 of file LoopInfo.h.
|
inline |
Definition at line 645 of file LoopInfo.h.
Referenced by llvm::MachineLoopInfo::releaseMemory(), and llvm::LoopInfoWrapperPass::releaseMemory().
|
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 749 of file LoopInfo.h.
Referenced by llvm::foldBlockIntoPredecessor(), getOnlyLiveSuccessor(), llvm::MergeBlockIntoPredecessor(), llvm::MachineLoopInfo::removeBlock(), ReplaceUsesOfWith(), and simplifyOneLoop().
|
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 711 of file LoopInfo.h.
Referenced by rebuildLoopAfterUnswitch(), and llvm::MachineLoopInfo::removeLoop().
|
inline |
Definition at line 668 of file LoopInfo.h.
void llvm::LoopInfoBase< BlockT, LoopT >::verify | ( | const DominatorTreeBase< BlockT, false > & | DomTree | ) | const |
Definition at line 704 of file LoopInfoImpl.h.
Referenced by getOnlyLiveSuccessor(), llvm::hoistRegion(), and llvm::LoopVerifierPass::run().
|
friend |
Definition at line 616 of file LoopInfo.h.
|
friend |
Definition at line 617 of file LoopInfo.h.