LLVM: llvm::LoopNest Class Reference (original) (raw)
This class represents a loop nest and can be used to query its properties. More...
#include "[llvm/Analysis/LoopNestAnalysis.h](LoopNestAnalysis%5F8h%5Fsource.html)"
| Public Member Functions | |
|---|---|
| LoopNest (Loop &Root, ScalarEvolution &SE) | |
| Construct a loop nest rooted by loop Root. | |
| LoopNest ()=delete | |
| Loop & | getOutermostLoop () const |
| Return the outermost loop in the loop nest. | |
| Loop * | getInnermostLoop () const |
| Return the innermost loop in the loop nest if the nest has only one innermost loop, and a nullptr otherwise. | |
| Loop * | getLoop (unsigned Index) const |
| Return the loop at the given Index. | |
| unsigned | getLoopIndex (const Loop &L) const |
| Get the loop index of the given loop L. | |
| size_t | getNumLoops () const |
| Return the number of loops in the nest. | |
| ArrayRef< Loop * > | getLoops () const |
| Get the loops in the nest. | |
| LoopVectorTy | getLoopsAtDepth (unsigned Depth) const |
| Get the loops in the nest at the given Depth. | |
| SmallVector< LoopVectorTy, 4 > | getPerfectLoops (ScalarEvolution &SE) const |
| Retrieve a vector of perfect loop nests contained in the current loop nest. | |
| unsigned | getNestDepth () const |
| Return the loop nest depth (i.e. | |
| unsigned | getMaxPerfectDepth () const |
| Return the maximum perfect nesting depth. | |
| bool | areAllLoopsSimplifyForm () const |
| Return true if all loops in the loop nest are in simplify form. | |
| bool | areAllLoopsRotatedForm () const |
| Return true if all loops in the loop nest are in rotated form. | |
| Function * | getParent () const |
| Return the function to which the loop-nest belongs. | |
| StringRef | getName () const |
| Static Public Member Functions | |
|---|---|
| static std::unique_ptr< LoopNest > | getLoopNest (Loop &Root, ScalarEvolution &SE) |
| Construct a LoopNest object. | |
| static bool | arePerfectlyNested (const Loop &OuterLoop, const Loop &InnerLoop, ScalarEvolution &SE) |
| Return true if the given loops OuterLoop and InnerLoop are perfectly nested with respect to each other, and false otherwise. | |
| static InstrVectorTy | getInterveningInstructions (const Loop &OuterLoop, const Loop &InnerLoop, ScalarEvolution &SE) |
| Return a vector of instructions that prevent the LoopNest given by loops OuterLoop and InnerLoop from being perfect. | |
| static unsigned | getMaxPerfectDepth (const Loop &Root, ScalarEvolution &SE) |
| Return the maximum nesting depth of the loop nest rooted by loop Root. | |
| static const BasicBlock & | skipEmptyBlockUntil (const BasicBlock *From, const BasicBlock *End, bool CheckUniquePred=false) |
| Recursivelly traverse all empty 'single successor' basic blocks of From (if there are any). |
This class represents a loop nest and can be used to query its properties.
Definition at line 29 of file LoopNestAnalysis.h.
◆ InstrVectorTy
◆ LoopNest() [1/2]
◆ LoopNest() [2/2]
| llvm::LoopNest::LoopNest ( ) | delete |
|---|
◆ areAllLoopsRotatedForm()
| bool llvm::LoopNest::areAllLoopsRotatedForm ( ) const | inline |
|---|
◆ areAllLoopsSimplifyForm()
| bool llvm::LoopNest::areAllLoopsSimplifyForm ( ) const | inline |
|---|
◆ arePerfectlyNested()
Return true if the given loops OuterLoop and InnerLoop are perfectly nested with respect to each other, and false otherwise.
Example:
arePerfectlyNested(loop_i, loop_j, SE) would return true. arePerfectlyNested(loop_j, loop_k, SE) would return true. arePerfectlyNested(loop_i, loop_k, SE) would return false.
Definition at line 103 of file LoopNestAnalysis.cpp.
Referenced by getMaxPerfectDepth(), getPerfectLoops(), and LoopNest().
◆ getInnermostLoop()
| Loop * llvm::LoopNest::getInnermostLoop ( ) const | inline |
|---|
◆ getInterveningInstructions()
Return a vector of instructions that prevent the LoopNest given by loops OuterLoop and InnerLoop from being perfect.
Definition at line 181 of file LoopNestAnalysis.cpp.
References checkSafeInstruction(), llvm::dbgs(), DEBUG_WITH_TYPE, llvm::Loop::getBounds(), llvm::LoopBase< BlockT, LoopT >::getExitBlock(), llvm::LoopBase< BlockT, LoopT >::getHeader(), getInnerLoopGuardCmp(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), getOuterLoopLatchCmp(), I, LLVM_DEBUG, and VerboseDebug.
Referenced by LoopNest().
◆ getLoop()
| Loop * llvm::LoopNest::getLoop ( unsigned Index) const | inline |
|---|
◆ getLoopIndex()
◆ getLoopNest()
◆ getLoops()
| ArrayRef< Loop * > llvm::LoopNest::getLoops ( ) const | inline |
|---|
◆ getLoopsAtDepth()
◆ getMaxPerfectDepth() [1/2]
| unsigned llvm::LoopNest::getMaxPerfectDepth ( ) const | inline |
|---|
◆ getMaxPerfectDepth() [2/2]
◆ getName()
| StringRef llvm::LoopNest::getName ( ) const | inline |
|---|
◆ getNestDepth()
| unsigned llvm::LoopNest::getNestDepth ( ) const | inline |
|---|
Return the loop nest depth (i.e.
the loop depth of the 'deepest' loop) For example given the loop nest:
for(i)
for(j1)
for(k)
for(j2)
getNestDepth() would return 3.
Definition at line 156 of file LoopNestAnalysis.h.
References assert(), and Loops.
Referenced by llvm::operator<<().
◆ getNumLoops()
| size_t llvm::LoopNest::getNumLoops ( ) const | inline |
|---|
◆ getOutermostLoop()
| Loop & llvm::LoopNest::getOutermostLoop ( ) const | inline |
|---|
◆ getParent()
| Function * llvm::LoopNest::getParent ( ) const | inline |
|---|
◆ getPerfectLoops()
Retrieve a vector of perfect loop nests contained in the current loop nest.
For example, given the following nest containing 4 loops, this member function would return {{L1,L2},{L3,L4}}.
for(i)
for(j)
for(k)
for(l)
Definition at line 241 of file LoopNestAnalysis.cpp.
References arePerfectlyNested(), llvm::SmallVectorImpl< T >::clear(), llvm::depth_first(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), Loops, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
◆ skipEmptyBlockUntil()
◆ Loops
Definition at line 185 of file LoopNestAnalysis.h.
Referenced by areAllLoopsRotatedForm(), areAllLoopsSimplifyForm(), getInnermostLoop(), getLoop(), getLoops(), getLoopsAtDepth(), getName(), getNestDepth(), getNumLoops(), getOutermostLoop(), getParent(), getPerfectLoops(), and LoopNest().
◆ MaxPerfectDepth
The documentation for this class was generated from the following files:
- include/llvm/Analysis/LoopNestAnalysis.h
- lib/Analysis/LoopNestAnalysis.cpp