LLVM  3.7.0
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
llvm::SCEV Class Reference

SCEV - This class represents an analyzed expression in the program. More...

#include <ScalarEvolution.h>

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

Public Types

enum  NoWrapFlags {
  FlagAnyWrap = 0, FlagNW = (1 << 0), FlagNUW = (1 << 1), FlagNSW = (1 << 2),
  NoWrapMask = (1 << 3) -1
}
 NoWrapFlags are bitfield indices into SubclassData. More...
 

Public Member Functions

 SCEV (const FoldingSetNodeIDRef ID, unsigned SCEVTy)
 
unsigned getSCEVType () const
 
TypegetType () const
 getType - Return the LLVM type of this SCEV expression. More...
 
bool isZero () const
 isZero - Return true if the expression is a constant zero. More...
 
bool isOne () const
 isOne - Return true if the expression is a constant one. More...
 
bool isAllOnesValue () const
 isAllOnesValue - Return true if the expression is a constant all-ones value. More...
 
bool isNonConstantNegative () const
 isNonConstantNegative - Return true if the specified scev is negated, but not a constant. More...
 
void print (raw_ostream &OS) const
 print - Print out the internal representation of this scalar to the specified stream. More...
 
void dump () const
 dump - This method is used for debugging. More...
 
- Public Member Functions inherited from llvm::FoldingSetImpl::Node
 Node ()
 
void * getNextInBucket () const
 
void SetNextInBucket (void *N)
 

Protected Attributes

unsigned short SubclassData
 SubclassData - This field is initialized to zero and may be used in subclasses to store miscellaneous information. More...
 

Friends

struct FoldingSetTrait< SCEV >
 

Detailed Description

SCEV - This class represents an analyzed expression in the program.

These are opaque objects that the client is not allowed to do much with directly.

Definition at line 58 of file ScalarEvolution.h.

Member Enumeration Documentation

NoWrapFlags are bitfield indices into SubclassData.

Add and Mul expressions may have no-unsigned-wrap <NUW> or no-signed-wrap <NSW> properties, which are derived from the IR operator. NSW is a misnomer that we use to mean no signed overflow or underflow.

AddRec expressions may have a no-self-wraparound <NW> property if, in the integer domain, abs(step) * max-iteration(loop) <= unsigned-max(bitwidth). This means that the recurrence will never reach its start value if the step is non-zero. Computing the same value on each iteration is not considered wrapping, and recurrences with step = 0 are trivially <NW>. <NW> is independent of the sign of step and the value the add recurrence starts with.

Note that NUW and NSW are also valid properties of a recurrence, and either implies NW. For convenience, NW will be set for a recurrence whenever either NUW or NSW are set.

Enumerator
FlagAnyWrap 
FlagNW 
FlagNUW 
FlagNSW 
NoWrapMask 

Definition at line 96 of file ScalarEvolution.h.

Constructor & Destructor Documentation

llvm::SCEV::SCEV ( const FoldingSetNodeIDRef  ID,
unsigned  SCEVTy 
)
inlineexplicit

Definition at line 102 of file ScalarEvolution.h.

Member Function Documentation

void SCEV::dump ( ) const

dump - This method is used for debugging.

Definition at line 136 of file ScalarEvolution.cpp.

References llvm::dbgs(), and print().

unsigned llvm::SCEV::getSCEVType ( ) const
inline
Type * SCEV::getType ( ) const

getType - Return the LLVM type of this SCEV expression.

Definition at line 252 of file ScalarEvolution.cpp.

References getSCEVType(), llvm_unreachable, llvm::scAddExpr, llvm::scAddRecExpr, llvm::scConstant, llvm::scCouldNotCompute, llvm::scMulExpr, llvm::scSignExtend, llvm::scSMaxExpr, llvm::scTruncate, llvm::scUDivExpr, llvm::scUMaxExpr, llvm::scUnknown, and llvm::scZeroExtend.

Referenced by BinomialCoefficient(), BuildConstantFromSCEV(), CanBeSMax(), CanBeSMin(), FactorOutConstant(), FindLoopCounter(), genLoopLimit(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getAnyExtendExpr(), getExactSDiv(), llvm::ScalarEvolution::getGEPExpr(), llvm::ScalarEvolution::getMinusSCEV(), llvm::ScalarEvolution::getNegativeSCEV(), getNewAlignment(), llvm::ScalarEvolution::getNoopOrAnyExtend(), llvm::ScalarEvolution::getNoopOrSignExtend(), llvm::ScalarEvolution::getNoopOrZeroExtend(), llvm::ScalarEvolution::getNotSCEV(), llvm::ScalarEvolution::getPointerBase(), getSignedOverflowLimitForStep(), llvm::ScalarEvolution::getSignExtendExpr(), llvm::ScalarEvolution::getTruncateExpr(), llvm::ScalarEvolution::getTruncateOrNoop(), llvm::ScalarEvolution::getTruncateOrSignExtend(), llvm::ScalarEvolution::getTruncateOrZeroExtend(), llvm::SCEVNAryExpr::getType(), llvm::SCEVAddExpr::getType(), llvm::SCEVUDivExpr::getType(), llvm::ScalarEvolution::getUDivExpr(), llvm::ScalarEvolution::getUMaxFromMismatchedTypes(), llvm::ScalarEvolution::getUMinFromMismatchedTypes(), getUnsignedOverflowLimitForStep(), llvm::ScalarEvolution::getZeroExtendExpr(), isAddFoldable(), llvm::ScalarEvolution::SimplifyICmpOperands(), and llvm::UnrollRuntimeLoopProlog().

bool SCEV::isAllOnesValue ( ) const

isAllOnesValue - Return true if the expression is a constant all-ones value.

Definition at line 289 of file ScalarEvolution.cpp.

References llvm::PPCISD::SC.

bool SCEV::isNonConstantNegative ( ) const

isNonConstantNegative - Return true if the specified scev is negated, but not a constant.

Definition at line 297 of file ScalarEvolution.cpp.

References llvm::dyn_cast(), llvm::SCEVNAryExpr::getOperand(), llvm::SCEVConstant::getValue(), llvm::ConstantInt::getValue(), llvm::APInt::isNegative(), and llvm::PPCISD::SC.

bool SCEV::isOne ( ) const

isOne - Return true if the expression is a constant one.

Definition at line 283 of file ScalarEvolution.cpp.

References llvm::PPCISD::SC.

Referenced by FactorOutConstant(), FindLoopCounter(), and genLoopLimit().

bool SCEV::isZero ( ) const
void SCEV::print ( raw_ostream OS) const

Friends And Related Function Documentation

friend struct FoldingSetTrait< SCEV >
friend

Definition at line 59 of file ScalarEvolution.h.

Member Data Documentation

unsigned short llvm::SCEV::SubclassData
protected

SubclassData - This field is initialized to zero and may be used in subclasses to store miscellaneous information.

Definition at line 71 of file ScalarEvolution.h.

Referenced by llvm::SCEVNAryExpr::getNoWrapFlags(), llvm::SCEVCommutativeExpr::setNoWrapFlags(), and llvm::SCEVAddRecExpr::setNoWrapFlags().


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