LLVM API Documentation

llvm::ScalarEvolution Class Reference

#include <ScalarEvolution.h>

Inheritance diagram for llvm::ScalarEvolution:
[legend]
Collaboration diagram for llvm::ScalarEvolution:
[legend]

List of all members.

Public Member Functions

 ScalarEvolution ()
LLVMContext & getContext () const
bool isSCEVable (const Type *Ty) const
uint64_t getTypeSizeInBits (const Type *Ty) const
const Type * getEffectiveSCEVType (const Type *Ty) const
const SCEV * getSCEV (Value *V)
const SCEV * getConstant (ConstantInt *V)
const SCEV * getConstant (const APInt &Val)
const SCEV * getConstant (const Type *Ty, uint64_t V, bool isSigned=false)
const SCEV * getTruncateExpr (const SCEV *Op, const Type *Ty)
const SCEV * getZeroExtendExpr (const SCEV *Op, const Type *Ty)
const SCEV * getSignExtendExpr (const SCEV *Op, const Type *Ty)
const SCEV * getAnyExtendExpr (const SCEV *Op, const Type *Ty)
const SCEV * getAddExpr (SmallVectorImpl< const SCEV * > &Ops)
const SCEV * getAddExpr (const SCEV *LHS, const SCEV *RHS)
const SCEV * getAddExpr (const SCEV *Op0, const SCEV *Op1, const SCEV *Op2)
const SCEV * getMulExpr (SmallVectorImpl< const SCEV * > &Ops)
const SCEV * getMulExpr (const SCEV *LHS, const SCEV *RHS)
const SCEV * getUDivExpr (const SCEV *LHS, const SCEV *RHS)
const SCEV * getAddRecExpr (const SCEV *Start, const SCEV *Step, const Loop *L)
const SCEV * getAddRecExpr (SmallVectorImpl< const SCEV * > &Operands, const Loop *L)
const SCEV * getAddRecExpr (const SmallVectorImpl< const SCEV * > &Operands, const Loop *L)
const SCEV * getSMaxExpr (const SCEV *LHS, const SCEV *RHS)
const SCEV * getSMaxExpr (SmallVectorImpl< const SCEV * > &Operands)
const SCEV * getUMaxExpr (const SCEV *LHS, const SCEV *RHS)
const SCEV * getUMaxExpr (SmallVectorImpl< const SCEV * > &Operands)
const SCEV * getSMinExpr (const SCEV *LHS, const SCEV *RHS)
const SCEV * getUMinExpr (const SCEV *LHS, const SCEV *RHS)
const SCEV * getFieldOffsetExpr (const StructType *STy, unsigned FieldNo)
const SCEV * getAllocSizeExpr (const Type *AllocTy)
const SCEV * getUnknown (Value *V)
const SCEV * getCouldNotCompute ()
const SCEV * getNegativeSCEV (const SCEV *V)
const SCEV * getNotSCEV (const SCEV *V)
 getNotSCEV - Return a SCEV corresponding to ~V = -1-V
const SCEV * getMinusSCEV (const SCEV *LHS, const SCEV *RHS)
const SCEV * getTruncateOrZeroExtend (const SCEV *V, const Type *Ty)
const SCEV * getTruncateOrSignExtend (const SCEV *V, const Type *Ty)
const SCEV * getNoopOrZeroExtend (const SCEV *V, const Type *Ty)
const SCEV * getNoopOrSignExtend (const SCEV *V, const Type *Ty)
const SCEV * getNoopOrAnyExtend (const SCEV *V, const Type *Ty)
const SCEV * getTruncateOrNoop (const SCEV *V, const Type *Ty)
const SCEV * getIntegerSCEV (int Val, const Type *Ty)
const SCEV * getUMaxFromMismatchedTypes (const SCEV *LHS, const SCEV *RHS)
const SCEV * getUMinFromMismatchedTypes (const SCEV *LHS, const SCEV *RHS)
const SCEV * getSCEVAtScope (const SCEV *S, const Loop *L)
const SCEV * getSCEVAtScope (Value *V, const Loop *L)
bool isLoopGuardedByCond (const Loop *L, ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS)
bool isLoopBackedgeGuardedByCond (const Loop *L, ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS)
const SCEV * getBackedgeTakenCount (const Loop *L)
const SCEV * getMaxBackedgeTakenCount (const Loop *L)
bool hasLoopInvariantBackedgeTakenCount (const Loop *L)
void forgetLoopBackedgeTakenCount (const Loop *L)
uint32_t GetMinTrailingZeros (const SCEV *S)
ConstantRange getUnsignedRange (const SCEV *S)
ConstantRange getSignedRange (const SCEV *S)
bool isKnownNegative (const SCEV *S)
bool isKnownPositive (const SCEV *S)
bool isKnownNonNegative (const SCEV *S)
bool isKnownNonPositive (const SCEV *S)
bool isKnownNonZero (const SCEV *S)
bool isKnownPredicate (ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS)
virtual bool runOnFunction (Function &F)
virtual void releaseMemory ()
virtual void getAnalysisUsage (AnalysisUsage &AU) const
void print (raw_ostream &OS, const Module *=0) const
virtual void print (std::ostream &OS, const Module *=0) const
void print (std::ostream *OS, const Module *M=0) const

Static Public Attributes

static char ID = 0

Friends

class SCEVCallbackVH
struct SCEVExpander

Classes

struct  BackedgeTakenInfo
class  SCEVCallbackVH


Detailed Description

ScalarEvolution - This class is the main scalar evolution driver. Because client code (intentionally) can't do much with the SCEV objects directly, they must ask this class for services.

Definition at line 158 of file ScalarEvolution.h.


Constructor & Destructor Documentation

ScalarEvolution::ScalarEvolution (  ) 

Definition at line 5093 of file ScalarEvolution.cpp.


Member Function Documentation

LLVMContext& llvm::ScalarEvolution::getContext (  )  const [inline]

bool ScalarEvolution::isSCEVable ( const Type *  Ty  )  const

isSCEVable - Test if values of the given type are analyzable within the SCEV framework. This primarily includes integer types, and it can optionally include pointer types if the ScalarEvolution class has access to target-specific information.

isSCEVable - Test if values of the given type are analyzable within the SCEV framework. This primarily includes integer types, and it can optionally include pointer types if the ScalarEvolution class has access to target-specific information.

Definition at line 2158 of file ScalarEvolution.cpp.

References llvm::Type::isInteger().

Referenced by llvm::IVUsers::AddUsersIfInteresting(), getAnyExtendExpr(), getEffectiveSCEVType(), getSCEV(), getSCEVAtScope(), getSignExtendExpr(), getTruncateExpr(), getTypeSizeInBits(), getZeroExtendExpr(), and print().

uint64_t ScalarEvolution::getTypeSizeInBits ( const Type *  Ty  )  const

const Type * ScalarEvolution::getEffectiveSCEVType ( const Type *  Ty  )  const

getEffectiveSCEVType - Return a type with the same bitwidth as the given type and which represents how SCEV will treat the given type, for which isSCEVable must return true. For pointer types, this is the pointer-sized integer type.

getEffectiveSCEVType - Return a type with the same bitwidth as the given type and which represents how SCEV will treat the given type, for which isSCEVable must return true. For pointer types, this is the pointer-sized integer type.

Definition at line 2186 of file ScalarEvolution.cpp.

References getContext(), llvm::Type::getInt64Ty(), llvm::TargetData::getIntPtrType(), llvm::Type::isInteger(), and isSCEVable().

Referenced by getAddExpr(), getAddRecExpr(), getAllocSizeExpr(), getAnyExtendExpr(), getFieldOffsetExpr(), getIntegerSCEV(), getMulExpr(), getNegativeSCEV(), getNotSCEV(), getSignExtendExpr(), getSMaxExpr(), getTruncateExpr(), getUDivExpr(), getUMaxExpr(), getZeroExtendExpr(), and InsertAffinePhi().

const SCEV * ScalarEvolution::getSCEV ( Value *  V  ) 

getSCEV - Return a SCEV expression handle for the full generality of the specified expression.

getSCEV - Return an existing SCEV if it exists, otherwise analyze the expression and create a new one.

Definition at line 2206 of file ScalarEvolution.cpp.

References llvm::Value::getType(), isSCEVable(), S, and SCEVCallbackVH.

Referenced by llvm::IVUsers::AddUsersIfInteresting(), llvm::PointerTracking::getPointerOffset(), getSCEVAtScope(), and print().

const SCEV * ScalarEvolution::getConstant ( ConstantInt *  V  ) 

const SCEV * ScalarEvolution::getConstant ( const APInt &  Val  ) 

Definition at line 190 of file ScalarEvolution.cpp.

References llvm::ConstantInt::get(), getConstant(), and getContext().

const SCEV * ScalarEvolution::getConstant ( const Type *  Ty,
uint64_t  V,
bool  isSigned = false 
)

Definition at line 195 of file ScalarEvolution.cpp.

References llvm::ConstantInt::get(), and getConstant().

const SCEV * ScalarEvolution::getTruncateExpr ( const SCEV *  Op,
const Type *  Ty 
)

const SCEV * ScalarEvolution::getZeroExtendExpr ( const SCEV *  Op,
const Type *  Ty 
)

const SCEV * ScalarEvolution::getSignExtendExpr ( const SCEV *  Op,
const Type *  Ty 
)

const SCEV * ScalarEvolution::getAnyExtendExpr ( const SCEV *  Op,
const Type *  Ty 
)

getAnyExtendExpr - Return a SCEV for the given operand extended with unspecified bits out to the given type.

Definition at line 1037 of file ScalarEvolution.cpp.

References getEffectiveSCEVType(), getSignExtendExpr(), getTruncateOrNoop(), llvm::SCEV::getType(), getTypeSizeInBits(), getZeroExtendExpr(), isSCEVable(), llvm::Attribute::SExt, T, and llvm::ZExt.

Referenced by getNoopOrAnyExtend().

const SCEV * ScalarEvolution::getAddExpr ( SmallVectorImpl< const SCEV * > &  Ops  ) 

getAddExpr - Get a canonical add expression, or something simpler if possible.

Definition at line 1172 of file ScalarEvolution.cpp.

References llvm::FoldingSetNodeID::AddInteger(), AddOne(), llvm::FoldingSetNodeID::AddPointer(), llvm::BumpPtrAllocator::Allocate(), llvm::SmallVectorImpl< T >::begin(), llvm::CallingConv::C, llvm::SmallVectorImpl< T >::clear(), CollectAddOperandsWithScales(), E, llvm::SmallVectorImpl< T >::empty(), llvm::SmallVectorImpl< T >::end(), llvm::SmallVectorImpl< T >::erase(), llvm::DenseMap< KeyT, ValueT, KeyInfoT, ValueInfoT >::find(), getAddRecExpr(), getConstant(), getEffectiveSCEVType(), getIntegerSCEV(), llvm::SCEVAddRecExpr::getLoop(), getMulExpr(), llvm::SCEVNAryExpr::getNumOperands(), llvm::SCEVNAryExpr::getOperand(), llvm::SCEVCastExpr::getOperand(), getSignExtendExpr(), llvm::SCEVAddRecExpr::getStart(), getTruncateExpr(), llvm::SCEV::getType(), llvm::SCEVCastExpr::getType(), llvm::Intrinsic::getType(), getTypeSizeInBits(), GroupByComplexity(), Idx, llvm::SmallVectorImpl< T >::insert(), M, llvm::SCEVNAryExpr::op_begin(), llvm::SCEVNAryExpr::op_end(), llvm::SmallVectorImpl< T >::push_back(), S, llvm::scAddExpr, llvm::scAddRecExpr, llvm::scMulExpr, llvm::SmallVectorImpl< T >::size(), T, and Ty.

Referenced by llvm::SCEVAddRecExpr::evaluateAtIteration(), ExposePointerBase(), FactorOutConstant(), getAddExpr(), getMinusSCEV(), getMulExpr(), llvm::SCEVAddRecExpr::getPostIncExpr(), getSCEVAtScope(), getSCEVStartAndStride(), getSignExtendExpr(), getUDivExpr(), getZeroExtendExpr(), MoveImmediateValues(), MoveLoopVariantsToImmediateField(), RemoveCommonExpressionsFromUseBases(), and SimplifyAddOperands().

const SCEV* llvm::ScalarEvolution::getAddExpr ( const SCEV *  LHS,
const SCEV *  RHS 
) [inline]

Definition at line 399 of file ScalarEvolution.h.

References getAddExpr(), and llvm::SmallVectorImpl< T >::push_back().

const SCEV* llvm::ScalarEvolution::getAddExpr ( const SCEV *  Op0,
const SCEV *  Op1,
const SCEV *  Op2 
) [inline]

Definition at line 405 of file ScalarEvolution.h.

References getAddExpr(), and llvm::SmallVectorImpl< T >::push_back().

const SCEV * ScalarEvolution::getMulExpr ( SmallVectorImpl< const SCEV * > &  Ops  ) 

const SCEV* llvm::ScalarEvolution::getMulExpr ( const SCEV *  LHS,
const SCEV *  RHS 
) [inline]

Definition at line 414 of file ScalarEvolution.h.

References getMulExpr(), and llvm::SmallVectorImpl< T >::push_back().

const SCEV * ScalarEvolution::getUDivExpr ( const SCEV *  LHS,
const SCEV *  RHS 
)

const SCEV * ScalarEvolution::getAddRecExpr ( const SCEV *  Start,
const SCEV *  Step,
const Loop *  L 
)

const SCEV * ScalarEvolution::getAddRecExpr ( SmallVectorImpl< const SCEV * > &  Operands,
const Loop *  L 
)

const SCEV* llvm::ScalarEvolution::getAddRecExpr ( const SmallVectorImpl< const SCEV * > &  Operands,
const Loop *  L 
) [inline]

const SCEV * ScalarEvolution::getSMaxExpr ( const SCEV *  LHS,
const SCEV *  RHS 
)

const SCEV * ScalarEvolution::getSMaxExpr ( SmallVectorImpl< const SCEV * > &  Operands  ) 

const SCEV * ScalarEvolution::getUMaxExpr ( const SCEV *  LHS,
const SCEV *  RHS 
)

const SCEV * ScalarEvolution::getUMaxExpr ( SmallVectorImpl< const SCEV * > &  Operands  ) 

const SCEV * ScalarEvolution::getSMinExpr ( const SCEV *  LHS,
const SCEV *  RHS 
)

Definition at line 2051 of file ScalarEvolution.cpp.

References getNotSCEV(), and getSMaxExpr().

const SCEV * ScalarEvolution::getUMinExpr ( const SCEV *  LHS,
const SCEV *  RHS 
)

Definition at line 2057 of file ScalarEvolution.cpp.

References getNotSCEV(), and getUMaxExpr().

Referenced by getUMinFromMismatchedTypes().

const SCEV * ScalarEvolution::getFieldOffsetExpr ( const StructType *  STy,
unsigned  FieldNo 
)

const SCEV * ScalarEvolution::getAllocSizeExpr ( const Type *  AllocTy  ) 

const SCEV * ScalarEvolution::getUnknown ( Value *  V  ) 

const SCEV * ScalarEvolution::getCouldNotCompute (  ) 

const SCEV * ScalarEvolution::getNegativeSCEV ( const SCEV *  V  ) 

getNegativeSCEV - Return the SCEV object corresponding to -V.

getNegativeSCEV - Return a SCEV corresponding to -V = -1*V

Definition at line 2225 of file ScalarEvolution.cpp.

References llvm::Constant::getAllOnesValue(), getConstant(), getEffectiveSCEVType(), getMulExpr(), llvm::ConstantExpr::getNeg(), llvm::SCEV::getType(), Ty, and llvm::ARMCC::VC.

Referenced by getMinusSCEV(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), and InsertAffinePhi().

const SCEV * ScalarEvolution::getNotSCEV ( const SCEV *  V  ) 

getNotSCEV - Return a SCEV corresponding to ~V = -1-V

getNotSCEV - Return the SCEV object corresponding to ~V.

Definition at line 2237 of file ScalarEvolution.cpp.

References llvm::Constant::getAllOnesValue(), getConstant(), getEffectiveSCEVType(), getMinusSCEV(), llvm::ConstantExpr::getNot(), llvm::SCEV::getType(), Ty, and llvm::ARMCC::VC.

Referenced by getSMinExpr(), and getUMinExpr().

const SCEV * ScalarEvolution::getMinusSCEV ( const SCEV *  LHS,
const SCEV *  RHS 
)

getMinusSCEV - Return LHS-RHS.

getMinusSCEV - Return a SCEV corresponding to LHS - RHS.

Definition at line 2251 of file ScalarEvolution.cpp.

References getAddExpr(), and getNegativeSCEV().

Referenced by llvm::IVUsers::AddUsersIfInteresting(), BinomialCoefficient(), getNotSCEV(), llvm::PointerTracking::getPointerOffset(), isKnownPredicate(), and RemoveCommonExpressionsFromUseBases().

const SCEV * ScalarEvolution::getTruncateOrZeroExtend ( const SCEV *  V,
const Type *  Ty 
)

getTruncateOrZeroExtend - Return a SCEV corresponding to a conversion of the input value to the specified type. If the type must be extended, it is zero extended.

getTruncateOrZeroExtend - Return a SCEV corresponding to a conversion of the input value to the specified type. If the type must be extended, it is zero extended.

Definition at line 2261 of file ScalarEvolution.cpp.

References getTruncateExpr(), llvm::SCEV::getType(), getTypeSizeInBits(), getZeroExtendExpr(), and llvm::Type::isInteger().

Referenced by BinomialCoefficient(), getSignExtendExpr(), getTruncateExpr(), and getZeroExtendExpr().

const SCEV * ScalarEvolution::getTruncateOrSignExtend ( const SCEV *  V,
const Type *  Ty 
)

getTruncateOrSignExtend - Return a SCEV corresponding to a conversion of the input value to the specified type. If the type must be extended, it is sign extended.

getTruncateOrSignExtend - Return a SCEV corresponding to a conversion of the input value to the specified type. If the type must be extended, it is sign extended.

Definition at line 2278 of file ScalarEvolution.cpp.

References getSignExtendExpr(), getTruncateExpr(), llvm::SCEV::getType(), getTypeSizeInBits(), and llvm::Type::isInteger().

Referenced by getSignExtendExpr(), getTruncateExpr(), and getZeroExtendExpr().

const SCEV * ScalarEvolution::getNoopOrZeroExtend ( const SCEV *  V,
const Type *  Ty 
)

getNoopOrZeroExtend - Return a SCEV corresponding to a conversion of the input value to the specified type. If the type must be extended, it is zero extended. The conversion must not be narrowing.

getNoopOrZeroExtend - Return a SCEV corresponding to a conversion of the input value to the specified type. If the type must be extended, it is zero extended. The conversion must not be narrowing.

Definition at line 2295 of file ScalarEvolution.cpp.

References llvm::SCEV::getType(), getTypeSizeInBits(), getZeroExtendExpr(), and llvm::Type::isInteger().

Referenced by getSignedRange(), getUMaxFromMismatchedTypes(), getUMinFromMismatchedTypes(), and getUnsignedRange().

const SCEV * ScalarEvolution::getNoopOrSignExtend ( const SCEV *  V,
const Type *  Ty 
)

getNoopOrSignExtend - Return a SCEV corresponding to a conversion of the input value to the specified type. If the type must be extended, it is sign extended. The conversion must not be narrowing.

getNoopOrSignExtend - Return a SCEV corresponding to a conversion of the input value to the specified type. If the type must be extended, it is sign extended. The conversion must not be narrowing.

Definition at line 2311 of file ScalarEvolution.cpp.

References getSignExtendExpr(), llvm::SCEV::getType(), getTypeSizeInBits(), and llvm::Type::isInteger().

const SCEV * ScalarEvolution::getNoopOrAnyExtend ( const SCEV *  V,
const Type *  Ty 
)

getNoopOrAnyExtend - Return a SCEV corresponding to a conversion of the input value to the specified type. If the type must be extended, it is extended with unspecified bits. The conversion must not be narrowing.

getNoopOrAnyExtend - Return a SCEV corresponding to a conversion of the input value to the specified type. If the type must be extended, it is extended with unspecified bits. The conversion must not be narrowing.

Definition at line 2328 of file ScalarEvolution.cpp.

References getAnyExtendExpr(), llvm::SCEV::getType(), getTypeSizeInBits(), and llvm::Type::isInteger().

const SCEV * ScalarEvolution::getTruncateOrNoop ( const SCEV *  V,
const Type *  Ty 
)

getTruncateOrNoop - Return a SCEV corresponding to a conversion of the input value to the specified type. The conversion must not be widening.

getTruncateOrNoop - Return a SCEV corresponding to a conversion of the input value to the specified type. The conversion must not be widening.

Definition at line 2343 of file ScalarEvolution.cpp.

References getTruncateExpr(), llvm::SCEV::getType(), getTypeSizeInBits(), and llvm::Type::isInteger().

Referenced by getAnyExtendExpr().

const SCEV * ScalarEvolution::getIntegerSCEV ( int  Val,
const Type *  Ty 
)

getIntegerSCEV - Given a SCEVable type, create a constant for the specified signed integer value and return a SCEV for the constant.

getIntegerSCEV - Given a SCEVable type, create a constant for the specified signed integer value and return a SCEV for the constant.

Definition at line 2218 of file ScalarEvolution.cpp.

References llvm::ConstantInt::get(), getConstant(), and getEffectiveSCEVType().

Referenced by llvm::IVUsers::AddUsersIfInteresting(), BinomialCoefficient(), ExposePointerBase(), FactorOutConstant(), getAddExpr(), getAllocSizeExpr(), getFieldOffsetExpr(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), llvm::SCEVExpander::getOrInsertCanonicalInductionVariable(), getUDivExpr(), MoveImmediateValues(), MoveLoopVariantsToImmediateField(), RemoveCommonExpressionsFromUseBases(), SeparateSubExprs(), SimplifyAddOperands(), and SplitAddRecs().

const SCEV * ScalarEvolution::getUMaxFromMismatchedTypes ( const SCEV *  LHS,
const SCEV *  RHS 
)

getUMaxFromMismatchedTypes - Promote the operands to the wider of the types using zero-extension, and then perform a umax operation with them.

getUMaxFromMismatchedTypes - Promote the operands to the wider of the types using zero-extension, and then perform a umax operation with them.

Definition at line 2358 of file ScalarEvolution.cpp.

References getNoopOrZeroExtend(), llvm::SCEV::getType(), getTypeSizeInBits(), getUMaxExpr(), and getZeroExtendExpr().

const SCEV * ScalarEvolution::getUMinFromMismatchedTypes ( const SCEV *  LHS,
const SCEV *  RHS 
)

getUMinFromMismatchedTypes - Promote the operands to the wider of the types using zero-extension, and then perform a umin operation with them.

getUMinFromMismatchedTypes - Promote the operands to the wider of the types using zero-extension, and then perform a umin operation with them.

Definition at line 2374 of file ScalarEvolution.cpp.

References getNoopOrZeroExtend(), llvm::SCEV::getType(), getTypeSizeInBits(), getUMinExpr(), and getZeroExtendExpr().

const SCEV * ScalarEvolution::getSCEVAtScope ( const SCEV *  V,
const Loop *  L 
)

getSCEVAtScope - Return a SCEV expression handle for the specified value at the specified scope in the program. The L value specifies a loop nest to evaluate the expression at, where null is the top-level or a specified loop is immediately inside of the loop.

This method can be used to compute the exit value for a variable defined in a loop by querying what the value will hold in the parent loop.

In the case that a relevant loop exit value cannot be computed, the original value V is returned.

getSCEVAtScope - Return a SCEV expression handle for the specified value at the specified scope in the program. The L value specifies a loop nest to evaluate the expression at, where null is the top-level or a specified loop is immediately inside of the loop.

This method can be used to compute the exit value for a variable defined in a loop by querying what the value will hold in the parent loop.

In the case that a relevant loop exit value cannot be computed, the original value V is returned.

Definition at line 3901 of file ScalarEvolution.cpp.

References llvm::CallingConv::C, CanConstantFold(), llvm::ConstantFoldCompareInstOperands(), llvm::ConstantFoldInstOperands(), llvm::LoopBase< BlockT, LoopT >::contains(), getAddExpr(), getBackedgeTakenCount(), llvm::ConstantExpr::getCast(), llvm::CastInst::getCastOpcode(), getContext(), getCouldNotCompute(), llvm::LoopBase< BlockT, LoopT >::getHeader(), getMulExpr(), llvm::Instruction::getParent(), llvm::LoopBase< BlockT, LoopT >::getParentLoop(), getSCEV(), getSignExtendExpr(), getSMaxExpr(), getTruncateExpr(), llvm::SCEV::getType(), llvm::Value::getType(), getUDivExpr(), getUMaxExpr(), getZeroExtendExpr(), isSCEVable(), llvm_unreachable, Op, and Values.

Referenced by getSCEVAtScope(), getSCEVStartAndStride(), and print().

const SCEV * ScalarEvolution::getSCEVAtScope ( Value *  V,
const Loop *  L 
)

getSCEVAtScope - This is a convenience function which does getSCEVAtScope(getSCEV(V), L).

getSCEVAtScope - This is a convenience function which does getSCEVAtScope(getSCEV(V), L).

Definition at line 4084 of file ScalarEvolution.cpp.

References getSCEV(), and getSCEVAtScope().

bool ScalarEvolution::isLoopGuardedByCond ( const Loop *  L,
ICmpInst::Predicate  Pred,
const SCEV *  LHS,
const SCEV *  RHS 
)

isLoopGuardedByCond - Test whether entry to the loop is protected by a conditional between LHS and RHS. This is used to help avoid max expressions in loop trip counts, and to eliminate casts.

isLoopGuardedByCond - Test whether entry to the loop is protected by a conditional between LHS and RHS. This is used to help avoid max expressions in loop trip counts, and to eliminate casts.

Definition at line 4487 of file ScalarEvolution.cpp.

References llvm::dyn_cast(), llvm::BranchInst::getCondition(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::BranchInst::getSuccessor(), and llvm::BranchInst::isUnconditional().

Referenced by getSignExtendExpr(), and getZeroExtendExpr().

bool ScalarEvolution::isLoopBackedgeGuardedByCond ( const Loop *  L,
ICmpInst::Predicate  Pred,
const SCEV *  LHS,
const SCEV *  RHS 
)

isLoopBackedgeGuardedByCond - Test whether the backedge of the loop is protected by a conditional between LHS and RHS. This is used to to eliminate casts.

isLoopBackedgeGuardedByCond - Test whether the backedge of the loop is protected by a conditional between LHS and RHS. This is used to to eliminate casts.

Definition at line 4462 of file ScalarEvolution.cpp.

References llvm::dyn_cast(), llvm::BranchInst::getCondition(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::BranchInst::getSuccessor(), llvm::BasicBlock::getTerminator(), and llvm::BranchInst::isUnconditional().

Referenced by getSignExtendExpr(), and getZeroExtendExpr().

const SCEV * ScalarEvolution::getBackedgeTakenCount ( const Loop *  L  ) 

getBackedgeTakenCount - If the specified loop has a predictable backedge-taken count, return it, otherwise return a SCEVCouldNotCompute object. The backedge-taken count is the number of times the loop header will be branched to from within the loop. This is one less than the trip count of the loop, since it doesn't count the first iteration, when the header is branched to from outside the loop.

Note that it is not valid to call this method on a loop without a loop-invariant backedge-taken count (see hasLoopInvariantBackedgeTakenCount).

getBackedgeTakenCount - If the specified loop has a predictable backedge-taken count, return it, otherwise return a SCEVCouldNotCompute object. The backedge-taken count is the number of times the loop header will be branched to from within the loop. This is one less than the trip count of the loop, since it doesn't count the first iteration, when the header is branched to from outside the loop.

Note that it is not valid to call this method on a loop without a loop-invariant backedge-taken count (see hasLoopInvariantBackedgeTakenCount).

Definition at line 3162 of file ScalarEvolution.cpp.

Referenced by getSCEVAtScope(), getSignedRange(), getUnsignedRange(), hasLoopInvariantBackedgeTakenCount(), and PrintLoopInfo().

const SCEV * ScalarEvolution::getMaxBackedgeTakenCount ( const Loop *  L  ) 

getMaxBackedgeTakenCount - Similar to getBackedgeTakenCount, except return the least SCEV value that is known never to be less than the actual backedge taken count.

getMaxBackedgeTakenCount - Similar to getBackedgeTakenCount, except return the least SCEV value that is known never to be less than the actual backedge taken count.

Definition at line 3169 of file ScalarEvolution.cpp.

Referenced by getSignedRange(), getSignExtendExpr(), getUnsignedRange(), getZeroExtendExpr(), and PrintLoopInfo().

bool ScalarEvolution::hasLoopInvariantBackedgeTakenCount ( const Loop *  L  ) 

hasLoopInvariantBackedgeTakenCount - Return true if the specified loop has an analyzable loop-invariant backedge-taken count.

Definition at line 5118 of file ScalarEvolution.cpp.

References getBackedgeTakenCount().

Referenced by PrintLoopInfo().

void ScalarEvolution::forgetLoopBackedgeTakenCount ( const Loop *  L  ) 

forgetLoopBackedgeTakenCount - This method should be called by the client when it has changed a loop in a way that may effect ScalarEvolution's ability to compute a trip count, or if the loop is deleted.

forgetLoopBackedgeTakenCount - This method should be called by the client when it has changed a loop in a way that may effect ScalarEvolution's ability to compute a trip count, or if the loop is deleted.

Definition at line 3255 of file ScalarEvolution.cpp.

References llvm::SmallVectorImpl< T >::empty(), llvm::SmallPtrSet< PtrType, SmallSize >::insert(), llvm::SmallVectorImpl< T >::pop_back_val(), PushDefUseChildren(), and PushLoopPHIs().

uint32_t ScalarEvolution::GetMinTrailingZeros ( const SCEV *  S  ) 

GetMinTrailingZeros - Determine the minimum number of zero bits that S is guaranteed to end in (at every loop iteration). It is, at the same time, the minimum number of times S is divisible by 2. For example, given {4,+,8} it returns 2. If S is guaranteed to be 0, it returns the bitwidth of S.

GetMinTrailingZeros - Determine the minimum number of zero bits that S is guaranteed to end in (at every loop iteration). It is, at the same time, the minimum number of times S is divisible by 2. For example, given {4,+,8} it returns 2. If S is guaranteed to be 0, it returns the bitwidth of S.

Definition at line 2600 of file ScalarEvolution.cpp.

References A, llvm::CallingConv::C, llvm::ComputeMaskedBits(), E, llvm::APInt::getAllOnesValue(), getTypeSizeInBits(), M, and T.

ConstantRange ScalarEvolution::getUnsignedRange ( const SCEV *  S  ) 

ConstantRange ScalarEvolution::getSignedRange ( const SCEV *  S  ) 

bool ScalarEvolution::isKnownNegative ( const SCEV *  S  ) 

isKnownNegative - Test if the given expression is known to be negative.

Definition at line 4361 of file ScalarEvolution.cpp.

References llvm::ConstantRange::getSignedMax(), getSignedRange(), and llvm::APInt::isNegative().

Referenced by getSignExtendExpr(), getZeroExtendExpr(), and isKnownNonZero().

bool ScalarEvolution::isKnownPositive ( const SCEV *  S  ) 

isKnownPositive - Test if the given expression is known to be positive.

Definition at line 4365 of file ScalarEvolution.cpp.

References llvm::ConstantRange::getSignedMin(), getSignedRange(), and llvm::APInt::isStrictlyPositive().

Referenced by getSignExtendExpr(), getZeroExtendExpr(), and isKnownNonZero().

bool ScalarEvolution::isKnownNonNegative ( const SCEV *  S  ) 

isKnownNonNegative - Test if the given expression is known to be non-negative.

Definition at line 4369 of file ScalarEvolution.cpp.

References llvm::ConstantRange::getSignedMin(), getSignedRange(), and llvm::APInt::isNegative().

bool ScalarEvolution::isKnownNonPositive ( const SCEV *  S  ) 

isKnownNonPositive - Test if the given expression is known to be non-positive.

Definition at line 4373 of file ScalarEvolution.cpp.

References llvm::ConstantRange::getSignedMax(), getSignedRange(), and llvm::APInt::isStrictlyPositive().

bool ScalarEvolution::isKnownNonZero ( const SCEV *  S  ) 

isKnownNonZero - Test if the given expression is known to be non-zero.

Definition at line 4377 of file ScalarEvolution.cpp.

References isKnownNegative(), and isKnownPositive().

Referenced by isKnownPredicate().

bool ScalarEvolution::isKnownPredicate ( ICmpInst::Predicate  Pred,
const SCEV *  LHS,
const SCEV *  RHS 
)

bool ScalarEvolution::runOnFunction ( Function &  F  )  [virtual]

runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.

Implements llvm::FunctionPass.

Definition at line 5097 of file ScalarEvolution.cpp.

void ScalarEvolution::releaseMemory (  )  [virtual]

releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memory when it is no longer needed. The default behavior of passes is to hold onto memory for the entire duration of their lifetime (which is the entire compile time). For pipelined passes, this is not a big deal because that memory gets recycled every time the pass is invoked on another program unit. For IP passes, it is more important to free memory when it is unused.

Optionally implement this function to release pass memory when it is no longer used.

Reimplemented from llvm::Pass.

Definition at line 5104 of file ScalarEvolution.cpp.

References llvm::BumpPtrAllocator::Reset().

void ScalarEvolution::getAnalysisUsage ( AnalysisUsage &   )  const [virtual]

getAnalysisUsage - This function should be overriden by passes that need analysis information to do their job. If a pass specifies that it uses a particular analysis result to this function, it can then use the getAnalysis<AnalysisType>() function, below.

Reimplemented from llvm::Pass.

Definition at line 5113 of file ScalarEvolution.cpp.

References llvm::AnalysisUsage::addRequiredTransitive(), and llvm::AnalysisUsage::setPreservesAll().

void ScalarEvolution::print ( raw_ostream &  OS,
const Module *  = 0 
) const

void ScalarEvolution::print ( std::ostream &  O,
const Module *  M = 0 
) const [virtual]

print - Print out the internal state of the pass. This is called by Analyze to print out the contents of an analysis. Otherwise it is not necessary to implement this method. Beware that the module pointer MAY be null. This automatically forwards to a virtual function that does not provide the Module* in case the analysis doesn't need it it can just be ignored.

Reimplemented from llvm::Pass.

Definition at line 5196 of file ScalarEvolution.cpp.

References OS, and print().

void llvm::ScalarEvolution::print ( std::ostream *  OS,
const Module *  M = 0 
) const [inline]

Reimplemented from llvm::Pass.

Definition at line 606 of file ScalarEvolution.h.

References M, and print().


Friends And Related Function Documentation

friend class SCEVCallbackVH [friend]

Definition at line 169 of file ScalarEvolution.h.

Referenced by getSCEV().

friend struct SCEVExpander [friend]

Definition at line 170 of file ScalarEvolution.h.


Member Data Documentation

char ScalarEvolution::ID = 0 [static]

Definition at line 366 of file ScalarEvolution.h.

Referenced by getConstant().


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