This class represents an analyzed expression in the program.More...
#include "llvm/Analysis/ScalarEvolution.h"
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 (constFoldingSetNodeIDRefID,SCEVTypes SCEVTy,unsigned shortExpressionSize) | |
SCEV (constSCEV &)=delete | |
SCEV & | operator= (constSCEV &)=delete |
SCEVTypes | getSCEVType ()const |
Type * | getType ()const |
Return the LLVM type of thisSCEV expression. | |
ArrayRef<constSCEV * > | operands ()const |
Return operands of thisSCEV expression. | |
bool | isZero ()const |
Return true if the expression is a constant zero. | |
bool | isOne ()const |
Return true if the expression is a constant one. | |
bool | isAllOnesValue ()const |
Return true if the expression is a constant all-ones value. | |
bool | isNonConstantNegative ()const |
Return true if the specified scev is negated, but not a constant. | |
unsigned short | getExpressionSize ()const |
void | print (raw_ostream &OS)const |
Print out the internal representation of this scalar to the specified stream. | |
void | dump ()const |
This method is used for debugging. | |
![]() | |
Node ()=default | |
void * | getNextInBucket ()const |
void | SetNextInBucket (void *N) |
Protected Attributes | |
constunsigned short | ExpressionSize |
unsigned short | SubclassData = 0 |
This field is initialized to zero and may be used in subclasses to store miscellaneous information. | |
Friends | |
struct | FoldingSetTrait< 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 line71 of fileScalarEvolution.h.
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.
We require that the flag on aSCEV apply to the entire scope in which thatSCEV is defined. ASCEV's scope is set of locations dominated by a defining location, which is in turn described by the following rules:
The above rules describe a maximally hoisted form (without regards to potential control dependence). ASCEV is defined anywhere a corresponding instruction could be defined in said maximally hoisted form. Note thatSCEVUDivExpr (currently the only expression type which can trap) can be defined per these rules in regions where it would trap at runtime. ASCEV being defined does not require the existence of any instruction within the defined scope.
Enumerator | |
---|---|
FlagAnyWrap | |
FlagNW | |
FlagNUW | |
FlagNSW | |
NoWrapMask |
Definition at line126 of fileScalarEvolution.h.
| inlineexplicit |
Definition at line134 of fileScalarEvolution.h.
LLVM_DUMP_METHOD void SCEV::dump | ( | ) | const |
This method is used for debugging.
Definition at line267 of fileScalarEvolution.cpp.
Referencesllvm::dbgs(), andprint().
| inline |
Definition at line169 of fileScalarEvolution.h.
ReferencesExpressionSize.
Referenced byhasHugeExpression().
| inline |
Definition at line140 of fileScalarEvolution.h.
Referenced byllvm::SCEVCouldNotCompute::classof(),llvm::SCEVConstant::classof(),llvm::SCEVVScale::classof(),llvm::SCEVCastExpr::classof(),llvm::SCEVPtrToIntExpr::classof(),llvm::SCEVIntegralCastExpr::classof(),llvm::SCEVTruncateExpr::classof(),llvm::SCEVZeroExtendExpr::classof(),llvm::SCEVSignExtendExpr::classof(),llvm::SCEVNAryExpr::classof(),llvm::SCEVCommutativeExpr::classof(),llvm::SCEVAddExpr::classof(),llvm::SCEVMulExpr::classof(),llvm::SCEVUDivExpr::classof(),llvm::SCEVAddRecExpr::classof(),llvm::SCEVMinMaxExpr::classof(),llvm::SCEVSMaxExpr::classof(),llvm::SCEVUMaxExpr::classof(),llvm::SCEVSMinExpr::classof(),llvm::SCEVUMinExpr::classof(),llvm::SCEVSequentialMinMaxExpr::classof(),llvm::SCEVSequentialUMinExpr::classof(),llvm::SCEVUnknown::classof(),llvm::SCEVSequentialMinMaxExpr::getEquivalentNonSequentialSCEVType(),getExprBase(),getType(),GroupByComplexity(),isHighCostExpansion(),operands(),print(),SCEVMinMaxExprContains(),llvm::SCEVVisitor< SC, RetVal >::visit(), andllvm::SCEVTraversal< SV >::visitAll().
Type * SCEV::getType | ( | ) | const |
Return the LLVM type of thisSCEV expression.
Definition at line386 of fileScalarEvolution.cpp.
ReferencesgetSCEVType(),llvm_unreachable,llvm::scAddExpr,llvm::scAddRecExpr,llvm::scConstant,llvm::scCouldNotCompute,llvm::scMulExpr,llvm::scPtrToInt,llvm::scSequentialUMinExpr,llvm::scSignExtend,llvm::scSMaxExpr,llvm::scSMinExpr,llvm::scTruncate,llvm::scUDivExpr,llvm::scUMaxExpr,llvm::scUMinExpr,llvm::scUnknown,llvm::scVScale, andllvm::scZeroExtend.
Referenced byllvm::SCEVAAResult::alias(),BinomialCoefficient(),calculateRtStride(),llvm::cannotBeMaxInLoop(),llvm::cannotBeMinInLoop(),llvm::ScalarEvolution::computeConstantDifference(),llvm::LoopVectorizationCostModel::computeMaxVF(),llvm::IndexedReference::computeRefCost(),computeTripCount(),countToEliminateCompares(),llvm::VPlan::createInitialVPlan(),createNodeForSelectViaUMinSeq(),createReplacement(),DoInitialMatch(),llvm::VPExpandSCEVRecipe::execute(),llvm::ScalarEvolution::ExitLimit::ExitLimit(),expandBounds(),llvm::SCEVExpander::expandCodeFor(),findForkedSCEVs(),FindLoopCounter(),llvm::SCEVExpander::generateOverflowCheck(),genLoopLimit(),llvm::ScalarEvolution::getAnyExtendExpr(),llvm::ScalarEvolution::getGEPExpr(),llvm::ScalarEvolution::getLoopInvariantExitCondDuringFirstIterationsImpl(),llvm::ScalarEvolution::getLosslessPtrToIntExpr(),llvm::ScalarEvolution::getMinTrailingZeros(),getNewAlignment(),getSignedOverflowLimitForStep(),llvm::ScalarEvolution::getSignExtendExprImpl(),llvm::getStartAndEndForAccess(),llvm::ScalarEvolution::getTripCountFromExitCount(),llvm::SCEVMulExpr::getType(),llvm::SCEVUDivExpr::getType(),llvm::SCEVAddRecExpr::getType(),llvm::SCEVMinMaxExpr::getType(),llvm::SCEVSequentialMinMaxExpr::getType(),llvm::ScalarEvolution::getUMinFromMismatchedTypes(),getUnsignedOverflowLimitForStep(),llvm::ScalarEvolution::getZeroExtendExprImpl(),llvm::hasIterationCountInvariantInParent(),llvm::SCEVWrapPredicate::implies(),llvm::ARMTTIImpl::isHardwareLoopProfitable(),llvm::isKnownNegativeInLoop(),llvm::isKnownNonNegativeInLoop(),llvm::isKnownNonPositiveInLoop(),llvm::isKnownPositiveInLoop(),llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(),isSafeDecreasingBound(),isSafeDependenceDistance(),isSafeIncreasingBound(),IsSimplerBaseSCEVForTarget(),llvm::SCEVPatternMatch::cst_pred_ty< Predicate >::match(),llvm::VPlanTransforms::optimizeForVFAndUF(),optimizeLoopExitWithUnknownExitCount(),llvm::LoopStructure::parseLoopStructure(),PrintSCEVWithTypeHint(),llvm::replaceSymbolicStrideSCEV(),llvm::splitLoopBound(),llvm::UnrollRuntimeLoopRemainder(),verifyTripCount(),llvm::SCEVDivision::visitAddExpr(),llvm::SCEVDivision::visitAddRecExpr(), andllvm::SCEVDivision::visitMulExpr().
bool SCEV::isAllOnesValue | ( | ) | const |
Return true if the expression is a constant all-ones value.
Definition at line452 of fileScalarEvolution.cpp.
Referencesllvm::SCEVPatternMatch::m_scev_AllOnes(), andllvm::PatternMatch::match().
Referenced byMatchNotExpr().
bool SCEV::isNonConstantNegative | ( | ) | const |
Return true if the specified scev is negated, but not a constant.
Definition at line454 of fileScalarEvolution.cpp.
Referencesllvm::Mul.
Referenced bycalculateRtStride().
bool SCEV::isOne | ( | ) | const |
Return true if the expression is a constant one.
Definition at line450 of fileScalarEvolution.cpp.
Referencesllvm::SCEVPatternMatch::m_scev_One(), andllvm::PatternMatch::match().
Referenced byllvm::SCEVDivision::divide(),llvm::SCEVExpander::generateOverflowCheck(),genLoopLimit(),llvm::LoopVectorizationCostModel::getInstructionCost(),getStartForNegStride(), andisLoopCounter().
bool SCEV::isZero | ( | ) | const |
Return true if the expression is a constant zero.
Definition at line448 of fileScalarEvolution.cpp.
Referencesllvm::SCEVPatternMatch::m_scev_Zero(), andllvm::PatternMatch::match().
Referenced bybreakBackedgeIfNotTaken(),calculateRtStride(),CollectSubexprs(),llvm::LoopVectorizationCostModel::computeMaxVF(),llvm::SCEVDivision::divide(),llvm::ScalarEvolution::ExitLimit::ExitLimit(),llvm::findArrayDimensions(),FindLoopCounter(),isAlwaysFoldable(),llvm::VPlanTransforms::optimizeForVFAndUF(),SolveQuadraticAddRecRange(),llvm::ScalarEvolution::verify(), andllvm::SCEVDivision::visitMulExpr().
Return operands of thisSCEV expression.
Definition at line420 of fileScalarEvolution.cpp.
ReferencesgetSCEVType(),llvm_unreachable,llvm::scAddExpr,llvm::scAddRecExpr,llvm::scConstant,llvm::scCouldNotCompute,llvm::scMulExpr,llvm::scPtrToInt,llvm::scSequentialUMinExpr,llvm::scSignExtend,llvm::scSMaxExpr,llvm::scSMinExpr,llvm::scTruncate,llvm::scUDivExpr,llvm::scUMaxExpr,llvm::scUMinExpr,llvm::scUnknown,llvm::scVScale, andllvm::scZeroExtend.
Referenced byllvm::ScalarEvolution::computeConstantDifference(),llvm::ScalarEvolution::getMulExpr(),llvm::ScalarEvolution::getNotSCEV(),getSetupCost(),llvm::ScalarEvolution::verify(), andllvm::SCEVTraversal< SV >::visitAll().
void SCEV::print | ( | raw_ostream & | OS | ) | const |
Print out the internal representation of this scalar to the specified stream.
This should really only be used for debugging purposes.
Definition at line273 of fileScalarEvolution.cpp.
ReferencesFlagNSW,FlagNUW,llvm::LoopBase< BlockT, LoopT >::getHeader(),llvm::SCEVUDivExpr::getLHS(),llvm::SCEVAddRecExpr::getLoop(),llvm::SCEVNAryExpr::getNoWrapFlags(),llvm::SCEVNAryExpr::getNumOperands(),llvm::SCEVCastExpr::getOperand(),llvm::SCEVNAryExpr::getOperand(),llvm::SCEVUDivExpr::getRHS(),getSCEVType(),llvm::SCEVCastExpr::getType(),llvm::SCEVNAryExpr::hasNoSelfWrap(),llvm::SCEVNAryExpr::hasNoSignedWrap(),llvm::SCEVNAryExpr::hasNoUnsignedWrap(),llvm_unreachable,llvm::SCEVNAryExpr::operands(),OS,llvm::Value::printAsOperand(),llvm::scAddExpr,llvm::scAddRecExpr,llvm::scConstant,llvm::scCouldNotCompute,llvm::scMulExpr,llvm::scPtrToInt,llvm::scSequentialUMinExpr,llvm::scSignExtend,llvm::scSMaxExpr,llvm::scSMinExpr,llvm::scTruncate,llvm::scUDivExpr,llvm::scUMaxExpr,llvm::scUMinExpr,llvm::scUnknown,llvm::scVScale, andllvm::scZeroExtend.
Referenced bydump(),llvm::operator<<(), andllvm::ScalarEvolution::print().
| friend |
Definition at line412 of fileScalarEvolution.h.
Definition at line83 of fileScalarEvolution.h.
Referenced bygetExpressionSize().
| protected |
This field is initialized to zero and may be used in subclasses to store miscellaneous information.
Definition at line87 of fileScalarEvolution.h.
Referenced byllvm::SCEVNAryExpr::getNoWrapFlags(),llvm::SCEVCommutativeExpr::setNoWrapFlags(), andllvm::SCEVAddRecExpr::setNoWrapFlags().