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 ()
SCEVHandle getSCEV (Value *V) const
SCEVHandle getConstant (ConstantInt *V)
SCEVHandle getConstant (const APInt &Val)
SCEVHandle getTruncateExpr (const SCEVHandle &Op, const Type *Ty)
SCEVHandle getZeroExtendExpr (const SCEVHandle &Op, const Type *Ty)
SCEVHandle getSignExtendExpr (const SCEVHandle &Op, const Type *Ty)
SCEVHandle getAddExpr (std::vector< SCEVHandle > &Ops)
SCEVHandle getAddExpr (const SCEVHandle &LHS, const SCEVHandle &RHS)
SCEVHandle getAddExpr (const SCEVHandle &Op0, const SCEVHandle &Op1, const SCEVHandle &Op2)
SCEVHandle getMulExpr (std::vector< SCEVHandle > &Ops)
SCEVHandle getMulExpr (const SCEVHandle &LHS, const SCEVHandle &RHS)
SCEVHandle getUDivExpr (const SCEVHandle &LHS, const SCEVHandle &RHS)
SCEVHandle getAddRecExpr (const SCEVHandle &Start, const SCEVHandle &Step, const Loop *L)
SCEVHandle getAddRecExpr (std::vector< SCEVHandle > &Operands, const Loop *L)
SCEVHandle getAddRecExpr (const std::vector< SCEVHandle > &Operands, const Loop *L)
SCEVHandle getSMaxExpr (const SCEVHandle &LHS, const SCEVHandle &RHS)
SCEVHandle getSMaxExpr (std::vector< SCEVHandle > Operands)
SCEVHandle getUMaxExpr (const SCEVHandle &LHS, const SCEVHandle &RHS)
SCEVHandle getUMaxExpr (std::vector< SCEVHandle > Operands)
SCEVHandle getUnknown (Value *V)
SCEVHandle getNegativeSCEV (const SCEVHandle &V)
SCEVHandle getNotSCEV (const SCEVHandle &V)
 getNotSCEV - Return a SCEV corresponding to ~V = -1-V
SCEVHandle getMinusSCEV (const SCEVHandle &LHS, const SCEVHandle &RHS)
SCEVHandle getTruncateOrZeroExtend (const SCEVHandle &V, const Type *Ty)
SCEVHandle getIntegerSCEV (int Val, const Type *Ty)
bool hasSCEV (Value *V) const
void setSCEV (Value *V, const SCEVHandle &H)
SCEVHandle getSCEVAtScope (Value *V, const Loop *L) const
SCEVHandle getIterationCount (const Loop *L) const
bool hasLoopInvariantIterationCount (const Loop *L) const
void deleteValueFromRecords (Value *V) const
virtual bool runOnFunction (Function &F)
virtual void releaseMemory ()
virtual void getAnalysisUsage (AnalysisUsage &AU) 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


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 190 of file ScalarEvolution.h.


Constructor & Destructor Documentation

llvm::ScalarEvolution::ScalarEvolution (  )  [inline]

Definition at line 194 of file ScalarEvolution.h.


Member Function Documentation

SCEVHandle ScalarEvolution::getSCEV ( Value *  V  )  const

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

Definition at line 2992 of file ScalarEvolution.cpp.

Referenced by getSCEVAtScope(), and print().

SCEVHandle ScalarEvolution::getConstant ( ConstantInt *  V  ) 

SCEVHandle ScalarEvolution::getConstant ( const APInt &  Val  ) 

Definition at line 180 of file ScalarEvolution.cpp.

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

SCEVHandle ScalarEvolution::getTruncateExpr ( const SCEVHandle &  Op,
const Type *  Ty 
)

SCEVHandle ScalarEvolution::getZeroExtendExpr ( const SCEVHandle &  Op,
const Type *  Ty 
)

SCEVHandle ScalarEvolution::getSignExtendExpr ( const SCEVHandle &  Op,
const Type *  Ty 
)

SCEVHandle ScalarEvolution::getAddExpr ( std::vector< SCEVHandle > &  Ops  ) 

SCEVHandle llvm::ScalarEvolution::getAddExpr ( const SCEVHandle &  LHS,
const SCEVHandle &  RHS 
) [inline]

Definition at line 206 of file ScalarEvolution.h.

References getAddExpr().

SCEVHandle llvm::ScalarEvolution::getAddExpr ( const SCEVHandle &  Op0,
const SCEVHandle &  Op1,
const SCEVHandle &  Op2 
) [inline]

Definition at line 212 of file ScalarEvolution.h.

References getAddExpr().

SCEVHandle ScalarEvolution::getMulExpr ( std::vector< SCEVHandle > &  Ops  ) 

SCEVHandle llvm::ScalarEvolution::getMulExpr ( const SCEVHandle &  LHS,
const SCEVHandle &  RHS 
) [inline]

Definition at line 221 of file ScalarEvolution.h.

References getMulExpr().

SCEVHandle ScalarEvolution::getUDivExpr ( const SCEVHandle &  LHS,
const SCEVHandle &  RHS 
)

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

SCEVHandle ScalarEvolution::getAddRecExpr ( std::vector< SCEVHandle > &  Operands,
const Loop *  L 
)

SCEVAddRecExpr::get - Get a add recurrence expression for the specified loop. Simplify the expression as much as possible.

Definition at line 1151 of file ScalarEvolution.cpp.

References getAddRecExpr(), and llvm::LoopBase< BlockT >::getLoopDepth().

SCEVHandle llvm::ScalarEvolution::getAddRecExpr ( const std::vector< SCEVHandle > &  Operands,
const Loop *  L 
) [inline]

Definition at line 232 of file ScalarEvolution.h.

References getAddRecExpr().

SCEVHandle ScalarEvolution::getSMaxExpr ( const SCEVHandle &  LHS,
const SCEVHandle &  RHS 
)

SCEVHandle ScalarEvolution::getSMaxExpr ( std::vector< SCEVHandle >  Operands  ) 

SCEVHandle ScalarEvolution::getUMaxExpr ( const SCEVHandle &  LHS,
const SCEVHandle &  RHS 
)

SCEVHandle ScalarEvolution::getUMaxExpr ( std::vector< SCEVHandle >  Operands  ) 

SCEVHandle ScalarEvolution::getUnknown ( Value *  V  ) 

SCEVHandle ScalarEvolution::getNegativeSCEV ( const SCEVHandle &  V  ) 

getNegativeSCEV - Return the SCEV object corresponding to -V.

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

Definition at line 483 of file ScalarEvolution.cpp.

References llvm::ConstantInt::getAllOnesValue(), getConstant(), getMulExpr(), llvm::ConstantExpr::getNeg(), getUnknown(), and llvm::ARMCC::VC.

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

SCEVHandle ScalarEvolution::getNotSCEV ( const SCEVHandle &  V  ) 

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

getNotSCEV - Return the SCEV object corresponding to ~V.

Definition at line 491 of file ScalarEvolution.cpp.

References llvm::ConstantInt::getAllOnesValue(), getConstant(), getMinusSCEV(), llvm::ConstantExpr::getNot(), getUnknown(), and llvm::ARMCC::VC.

SCEVHandle ScalarEvolution::getMinusSCEV ( const SCEVHandle &  LHS,
const SCEVHandle &  RHS 
)

getMinusSCEV - Return LHS-RHS.

getMinusSCEV - Return a SCEV corresponding to LHS - RHS.

Definition at line 501 of file ScalarEvolution.cpp.

References getAddExpr(), and getNegativeSCEV().

Referenced by BinomialCoefficient(), getNotSCEV(), and RemoveCommonExpressionsFromUseBases().

SCEVHandle ScalarEvolution::getTruncateOrZeroExtend ( const SCEVHandle &  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 716 of file ScalarEvolution.cpp.

References llvm::Type::getPrimitiveSizeInBits(), getTruncateExpr(), getZeroExtendExpr(), and llvm::Type::isInteger().

Referenced by BinomialCoefficient().

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

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

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

Definition at line 469 of file ScalarEvolution.cpp.

References llvm::lltok::APFloat, llvm::CallingConv::C, llvm::Type::FloatTy, llvm::ConstantInt::get(), llvm::ConstantFP::get(), llvm::Constant::getNullValue(), getUnknown(), llvm::APFloat::IEEEdouble, llvm::APFloat::IEEEsingle, and llvm::Type::isFloatingPoint().

Referenced by BinomialCoefficient(), getAddExpr(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), llvm::SCEVExpander::getOrInsertCanonicalInductionVariable(), MoveImmediateValues(), MoveLoopVariantsToImmediateField(), RemoveCommonExpressionsFromUseBases(), SeparateSubExprs(), and llvm::SCEVExpander::visitAddRecExpr().

bool ScalarEvolution::hasSCEV ( Value *  V  )  const

hasSCEV - Return true if the SCEV for this value has already been computed.

hasSCEV - Return true if the SCEV for this value has already been computed.

Definition at line 2998 of file ScalarEvolution.cpp.

void ScalarEvolution::setSCEV ( Value *  V,
const SCEVHandle &  H 
)

setSCEV - Insert the specified SCEV into the map of current SCEVs for the specified value.

setSCEV - Insert the specified SCEV into the map of current SCEVs for the specified value.

Definition at line 3005 of file ScalarEvolution.cpp.

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

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.

If this value is not computable at this scope, a SCEVCouldNotCompute object is returned.

Definition at line 3018 of file ScalarEvolution.cpp.

References getSCEV().

Referenced by print().

SCEVHandle ScalarEvolution::getIterationCount ( const Loop *  L  )  const

getIterationCount - If the specified loop has a predictable iteration count, return it, otherwise return a SCEVCouldNotCompute object.

Definition at line 3010 of file ScalarEvolution.cpp.

Referenced by hasLoopInvariantIterationCount(), and PrintLoopInfo().

bool ScalarEvolution::hasLoopInvariantIterationCount ( const Loop *  L  )  const

hasLoopInvariantIterationCount - Return true if the specified loop has an analyzable loop-invariant iteration count.

Definition at line 3014 of file ScalarEvolution.cpp.

References getIterationCount().

Referenced by PrintLoopInfo().

void ScalarEvolution::deleteValueFromRecords ( Value *  V  )  const

deleteValueFromRecords - This method should be called by the client before it removes a Value from the program, to make sure that no dangling references are left around.

Definition at line 3022 of file ScalarEvolution.cpp.

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 2977 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 2982 of file ScalarEvolution.cpp.

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 2987 of file ScalarEvolution.cpp.

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

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 3048 of file ScalarEvolution.cpp.

References llvm::LoopInfo::begin(), E, llvm::LoopInfo::end(), F, llvm::LoopInfo::getLoopFor(), llvm::Value::getName(), llvm::LoopBase< BlockT >::getParentLoop(), getSCEV(), getSCEVAtScope(), llvm::inst_begin(), llvm::inst_end(), and PrintLoopInfo().

Referenced by print().

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

Reimplemented from llvm::Pass.

Definition at line 302 of file ScalarEvolution.h.

References M, and print().


Member Data Documentation

char ScalarEvolution::ID = 0 [static]

Definition at line 193 of file ScalarEvolution.h.


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