LLVM API Documentation
#include <LoopInfo.h>
Public Member Functions | |
| Loop () | |
| bool | isLoopInvariant (Value *V) const |
| bool | isLoopInvariant (Instruction *I) const |
| bool | makeLoopInvariant (Value *V, bool &Changed, Instruction *InsertPt=0) const |
| bool | makeLoopInvariant (Instruction *I, bool &Changed, Instruction *InsertPt=0) 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 | |
| bool | isLoopSimplifyForm () const |
Friends | |
| class | LoopInfoBase< BasicBlock, Loop > |
Definition at line 490 of file LoopInfo.h.
| llvm::Loop::Loop | ( | ) | [inline] |
Definition at line 492 of file LoopInfo.h.
isLoopInvariant - Return true if the specified value is loop invariant
Definition at line 39 of file LoopInfo.cpp.
Referenced by makeLoopInvariant().
| bool Loop::isLoopInvariant | ( | Instruction * | I | ) | const |
isLoopInvariant - Return true if the specified instruction is loop-invariant.
isLoopInvariant - Return true if the specified instruction is loop-invariant.
Definition at line 48 of file LoopInfo.cpp.
References llvm::LoopBase< BlockT, LoopT >::contains(), and llvm::Instruction::getParent().
| bool Loop::makeLoopInvariant | ( | Value * | V, | |
| bool & | Changed, | |||
| Instruction * | InsertPt = 0 | |||
| ) | const |
makeLoopInvariant - If the given value is an instruction inside of the loop and it can be hoisted, do so to make it trivially loop-invariant. Return true if the value after any hoisting is loop invariant. This function can be used as a slightly more aggressive replacement for isLoopInvariant.
If InsertPt is specified, it is the point to hoist instructions to. If null, the terminator of the loop preheader is used.
makeLoopInvariant - If the given value is an instruciton inside of the loop and it can be hoisted, do so to make it trivially loop-invariant. Return true if the value after any hoisting is loop invariant. This function can be used as a slightly more aggressive replacement for isLoopInvariant.
If InsertPt is specified, it is the point to hoist instructions to. If null, the terminator of the loop preheader is used.
Definition at line 61 of file LoopInfo.cpp.
Referenced by FindLIVLoopCondition(), and makeLoopInvariant().
| bool Loop::makeLoopInvariant | ( | Instruction * | I, | |
| bool & | Changed, | |||
| Instruction * | InsertPt = 0 | |||
| ) | const |
makeLoopInvariant - If the given instruction is inside of the loop and it can be hoisted, do so to make it trivially loop-invariant. Return true if the instruction after any hoisting is loop invariant. This function can be used as a slightly more aggressive replacement for isLoopInvariant.
If InsertPt is specified, it is the point to hoist instructions to. If null, the terminator of the loop preheader is used.
makeLoopInvariant - If the given instruction is inside of the loop and it can be hoisted, do so to make it trivially loop-invariant. Return true if the instruction after any hoisting is loop invariant. This function can be used as a slightly more aggressive replacement for isLoopInvariant.
If InsertPt is specified, it is the point to hoist instructions to. If null, the terminator of the loop preheader is used.
Definition at line 77 of file LoopInfo.cpp.
References llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::BasicBlock::getTerminator(), isLoopInvariant(), llvm::Instruction::isSafeToSpeculativelyExecute(), makeLoopInvariant(), llvm::Instruction::mayReadFromMemory(), llvm::Instruction::moveBefore(), and Preheader.
| PHINode * Loop::getCanonicalInductionVariable | ( | ) | const |
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.
The IndVarSimplify pass transforms loops to have a canonical induction variable.
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.
The IndVarSimplify pass transforms loops to have a canonical induction variable.
Definition at line 112 of file LoopInfo.cpp.
References llvm::BasicBlock::begin(), llvm::LoopBase< BlockT, LoopT >::contains(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::PHINode::getIncomingValueForBlock(), H, PI, and std::swap().
Referenced by getCanonicalInductionVariableIncrement().
| Instruction * Loop::getCanonicalInductionVariableIncrement | ( | ) | const |
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.
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 153 of file LoopInfo.cpp.
References llvm::LoopBase< BlockT, LoopT >::contains(), and getCanonicalInductionVariable().
Referenced by getTripCount().
| Value * Loop::getTripCount | ( | ) | const |
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.
The IndVarSimplify pass transforms loops to have a form that this function easily understands.
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.
The IndVarSimplify pass transforms loops to have a form that this function easily understands.
Definition at line 169 of file LoopInfo.cpp.
References llvm::LoopBase< BlockT, LoopT >::contains(), getCanonicalInductionVariableIncrement(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::PHINode::getIncomingBlock(), llvm::User::getOperand(), llvm::CmpInst::ICMP_EQ, and llvm::CmpInst::ICMP_NE.
Referenced by getSmallConstantTripCount(), and getSmallConstantTripMultiple().
| unsigned Loop::getSmallConstantTripCount | ( | ) | const |
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)
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 200 of file LoopInfo.cpp.
References getTripCount().
Referenced by llvm::UnrollLoop().
| unsigned Loop::getSmallConstantTripMultiple | ( | ) | const |
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).
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 222 of file LoopInfo.cpp.
References llvm::dyn_cast(), llvm::APInt::getActiveBits(), getTripCount(), llvm::ConstantInt::getValue(), and llvm::ConstantInt::getZExtValue().
Referenced by llvm::UnrollLoop().
| bool Loop::isLCSSAForm | ( | ) | const |
isLCSSAForm - Return true if the Loop is in LCSSA form
Definition at line 250 of file LoopInfo.cpp.
References BB, llvm::BasicBlock::begin(), llvm::LoopBase< BlockT, LoopT >::block_begin(), llvm::LoopBase< BlockT, LoopT >::block_end(), llvm::SmallPtrSet< PtrType, SmallSize >::count(), E, llvm::BasicBlock::end(), and llvm::MachineBasicBlock::getParent().
Referenced by llvm::UnrollLoop().
| bool Loop::isLoopSimplifyForm | ( | ) | const |
isLoopSimplifyForm - Return true if the Loop is in the form that the LoopSimplify form transforms loops to, which is sometimes called normal form.
isLoopSimplifyForm - Return true if the Loop is in the form that the LoopSimplify form transforms loops to, which is sometimes called normal form.
Definition at line 278 of file LoopInfo.cpp.
References llvm::LoopBase< BlockT, LoopT >::contains(), llvm::LoopBase< BlockT, LoopT >::getExitBlocks(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), PI, llvm::pred_begin(), llvm::pred_end(), and llvm::SmallVectorImpl< T >::size().
friend class LoopInfoBase< BasicBlock, Loop > [friend] |
Definition at line 579 of file LoopInfo.h.