|
LLVM 23.0.0git
|
This class represents an analyzed expression in the program. More...
#include "llvm/Analysis/ScalarEvolution.h"
Public Types | |
| using | NoWrapFlags = SCEVNoWrapFlags |
Public Member Functions | |
| SCEV (const FoldingSetNodeIDRef ID, SCEVTypes SCEVTy, unsigned short ExpressionSize) | |
| SCEV (const SCEV &)=delete | |
| SCEV & | operator= (const SCEV &)=delete |
| SCEVTypes | getSCEVType () const |
| LLVM_ABI Type * | getType () const |
| Return the LLVM type of this SCEV expression. | |
| LLVM_ABI ArrayRef< SCEVUse > | operands () const |
| Return operands of this SCEV expression. | |
| LLVM_ABI bool | isZero () const |
| Return true if the expression is a constant zero. | |
| LLVM_ABI bool | isOne () const |
| Return true if the expression is a constant one. | |
| LLVM_ABI bool | isAllOnesValue () const |
| Return true if the expression is a constant all-ones value. | |
| LLVM_ABI bool | isNonConstantNegative () const |
| Return true if the specified scev is negated, but not a constant. | |
| unsigned short | getExpressionSize () const |
| LLVM_ABI void | print (raw_ostream &OS) const |
| Print out the internal representation of this scalar to the specified stream. | |
| LLVM_ABI void | dump () const |
| This method is used for debugging. | |
| LLVM_ABI void | computeAndSetCanonical (ScalarEvolution &SE) |
| Compute and set the canonical SCEV, by constructing a SCEV with the same operands, but all SCEVUse flags dropped. | |
| LLVM_ABI const SCEV * | getCanonical () const |
| Return the canonical SCEV. | |
| Public Member Functions inherited from llvm::FoldingSetBase::Node | |
| Node ()=default | |
| void * | getNextInBucket () const |
| void | SetNextInBucket (void *N) |
Static Public Attributes | |
| static constexpr auto | FlagAnyWrap = SCEVNoWrapFlags::FlagAnyWrap |
| static constexpr auto | FlagNW = SCEVNoWrapFlags::FlagNW |
| static constexpr auto | FlagNUW = SCEVNoWrapFlags::FlagNUW |
| static constexpr auto | FlagNSW = SCEVNoWrapFlags::FlagNSW |
| static constexpr auto | NoWrapMask = SCEVNoWrapFlags::NoWrapMask |
Protected Attributes | |
| const unsigned short | ExpressionSize |
| unsigned short | SubclassData = 0 |
| This field is initialized to zero and may be used in subclasses to store miscellaneous information. | |
| const SCEV * | CanonicalSCEV = nullptr |
| Pointer to the canonical version of the SCEV, i.e. | |
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 line 256 of file ScalarEvolution.h.
Definition at line 279 of file ScalarEvolution.h.
|
inlineexplicit |
Definition at line 286 of file ScalarEvolution.h.
References ExpressionSize.
Referenced by llvm::SCEVCastExpr::classof(), llvm::SCEVConstant::classof(), llvm::SCEVCouldNotCompute::classof(), llvm::SCEVNAryExpr::classof(), llvm::SCEVUDivExpr::classof(), llvm::SCEVUnknown::classof(), llvm::SCEVVScale::classof(), getCanonical(), operator=(), print(), llvm::SCEVConstant::ScalarEvolution, llvm::SCEVUDivExpr::ScalarEvolution, llvm::SCEVUnknown::ScalarEvolution, llvm::SCEVVScale::ScalarEvolution, SCEV(), llvm::SCEVCastExpr::SCEVCastExpr(), llvm::SCEVCouldNotCompute::SCEVCouldNotCompute(), and llvm::SCEVNAryExpr::SCEVNAryExpr().
| void SCEV::computeAndSetCanonical | ( | ScalarEvolution & | SE | ) |
Compute and set the canonical SCEV, by constructing a SCEV with the same operands, but all SCEVUse flags dropped.
Definition at line 261 of file ScalarEvolution.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::back(), CanonicalSCEV, llvm::cast(), Changed, llvm::dyn_cast(), FlagAnyWrap, llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getAddRecExpr(), llvm::ScalarEvolution::getMulExpr(), llvm::ScalarEvolution::getPtrToAddrExpr(), llvm::ScalarEvolution::getPtrToIntExpr(), getSCEVType(), llvm::ScalarEvolution::getSignExtendExpr(), llvm::ScalarEvolution::getSMaxExpr(), llvm::ScalarEvolution::getSMinExpr(), llvm::ScalarEvolution::getTruncateExpr(), getType(), llvm::ScalarEvolution::getUDivExpr(), llvm::ScalarEvolution::getUMaxExpr(), llvm::ScalarEvolution::getUMinExpr(), llvm::ScalarEvolution::getZeroExtendExpr(), llvm_unreachable, operands(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::scAddExpr, llvm::scAddRecExpr, llvm::scConstant, llvm::scMulExpr, llvm::scPtrToAddr, llvm::scPtrToInt, llvm::scSequentialUMinExpr, llvm::scSignExtend, llvm::scSMaxExpr, llvm::scSMinExpr, llvm::scTruncate, llvm::scUDivExpr, llvm::scUMaxExpr, llvm::scUMinExpr, llvm::scUnknown, llvm::scVScale, and llvm::scZeroExtend.
Referenced by llvm::ScalarEvolution::getConstant(), llvm::ScalarEvolution::getLosslessPtrToIntExpr(), llvm::ScalarEvolution::getMinMaxExpr(), llvm::ScalarEvolution::getPtrToAddrExpr(), llvm::ScalarEvolution::getSequentialMinMaxExpr(), llvm::ScalarEvolution::getSignExtendExprImpl(), llvm::ScalarEvolution::getTruncateExpr(), llvm::ScalarEvolution::getUDivExpr(), llvm::ScalarEvolution::getUnknown(), llvm::ScalarEvolution::getVScale(), and llvm::ScalarEvolution::getZeroExtendExprImpl().
| LLVM_DUMP_METHOD void SCEV::dump | ( | ) | const |
This method is used for debugging.
Definition at line 344 of file ScalarEvolution.cpp.
References llvm::dbgs(), LLVM_DUMP_METHOD, and print().
Return the canonical SCEV.
Definition at line 337 of file ScalarEvolution.h.
References assert(), CanonicalSCEV, LLVM_ABI, and SCEV().
|
inline |
Definition at line 321 of file ScalarEvolution.h.
References ExpressionSize.
Referenced by hasHugeExpression().
|
inline |
Definition at line 292 of file ScalarEvolution.h.
Referenced by llvm::SCEVAddExpr::classof(), llvm::SCEVAddRecExpr::classof(), llvm::SCEVCastExpr::classof(), llvm::SCEVCommutativeExpr::classof(), llvm::SCEVConstant::classof(), llvm::SCEVCouldNotCompute::classof(), llvm::SCEVIntegralCastExpr::classof(), llvm::SCEVMinMaxExpr::classof(), llvm::SCEVMulExpr::classof(), llvm::SCEVNAryExpr::classof(), llvm::SCEVPtrToAddrExpr::classof(), llvm::SCEVPtrToIntExpr::classof(), llvm::SCEVSequentialMinMaxExpr::classof(), llvm::SCEVSequentialUMinExpr::classof(), llvm::SCEVSignExtendExpr::classof(), llvm::SCEVSMaxExpr::classof(), llvm::SCEVSMinExpr::classof(), llvm::SCEVTruncateExpr::classof(), llvm::SCEVUDivExpr::classof(), llvm::SCEVUMaxExpr::classof(), llvm::SCEVUMinExpr::classof(), llvm::SCEVUnknown::classof(), llvm::SCEVVScale::classof(), llvm::SCEVZeroExtendExpr::classof(), computeAndSetCanonical(), llvm::SCEVSequentialMinMaxExpr::getEquivalentNonSequentialSCEVType(), getExprBase(), getType(), GroupByComplexity(), isHighCostExpansion(), operands(), print(), SCEVMinMaxExprContains(), llvm::SCEVUseVisitor< SC, RetVal >::visit(), llvm::SCEVVisitor< SCEVSequentialMinMaxDeduplicatingVisitor, RetVal >::visit(), and llvm::SCEVTraversal< SV >::visitAll().
| Type * SCEV::getType | ( | ) | const |
Return the LLVM type of this SCEV expression.
Definition at line 463 of file ScalarEvolution.cpp.
References llvm::cast(), getSCEVType(), llvm_unreachable, llvm::scAddExpr, llvm::scAddRecExpr, llvm::scConstant, llvm::scCouldNotCompute, llvm::scMulExpr, llvm::scPtrToAddr, llvm::scPtrToInt, llvm::scSequentialUMinExpr, llvm::scSignExtend, llvm::scSMaxExpr, llvm::scSMinExpr, llvm::scTruncate, llvm::scUDivExpr, llvm::scUMaxExpr, llvm::scUMinExpr, llvm::scUnknown, llvm::scVScale, and llvm::scZeroExtend.
Referenced by llvm::VPlanTransforms::addMinimumIterationCheck(), llvm::SCEVAAResult::alias(), areAllLoadsDereferenceable(), BinomialCoefficient(), calculateRtStride(), llvm::cannotBeMaxInLoop(), llvm::cannotBeMinInLoop(), CollectSubexprs(), computeAndSetCanonical(), llvm::ScalarEvolution::computeConstantDifference(), llvm::LoopVectorizationCostModel::computeMaxVF(), llvm::IndexedReference::computeRefCost(), computeTripCount(), llvm::ScalarEvolution::convertSCEVToAddRecWithPredicates(), countToEliminateCompares(), createNodeForSelectViaUMinSeq(), createReplacement(), llvm::delinearizeFixedSizeArray(), llvm::DependenceInfo::depends(), DoInitialMatch(), evaluatePtrAddRecAtMaxBTCWillNotWrap(), expandBounds(), llvm::SCEVExpander::expandCodeFor(), llvm::VPlanTransforms::expandSCEVs(), ExtractImmediate(), FindLoopCounter(), findSplitCandidate(), llvm::SCEVExpander::generateOverflowCheck(), genLoopLimit(), llvm::ScalarEvolution::getAnyExtendExpr(), llvm::ScalarEvolution::getGEPExpr(), llvm::ScalarEvolution::getLoopInvariantExitCondDuringFirstIterationsImpl(), llvm::ScalarEvolution::getLosslessPtrToIntExpr(), getMaxTCFromNonZeroRange(), llvm::ScalarEvolution::getMinTrailingZeros(), getNewAlignment(), llvm::ScalarEvolution::getPtrToAddrExpr(), llvm::vputils::getSCEVExprForVPValue(), getSignedOverflowLimitForStep(), llvm::ScalarEvolution::getSignExtendExprImpl(), getSmallConstantTripCount(), llvm::getStartAndEndForAccess(), llvm::getStartAndEndForAccess(), llvm::ScalarEvolution::getTripCountFromExitCount(), llvm::ScalarEvolution::getTripCountFromExitCount(), llvm::SCEVAddRecExpr::getType(), llvm::SCEVMinMaxExpr::getType(), llvm::SCEVMulExpr::getType(), llvm::SCEVSequentialMinMaxExpr::getType(), llvm::SCEVUDivExpr::getType(), llvm::ScalarEvolution::getUMinFromMismatchedTypes(), getUnsignedOverflowLimitForStep(), llvm::ScalarEvolution::getZeroExtendExprImpl(), llvm::hasIterationCountInvariantInParent(), llvm::SCEVWrapPredicate::implies(), isConditionTrueViaVFAndUF(), llvm::ARMTTIImpl::isHardwareLoopProfitable(), llvm::ScalarEvolution::isKnownMultipleOf(), llvm::isKnownNegativeInLoop(), llvm::isKnownNonNegativeInLoop(), llvm::isKnownNonPositiveInLoop(), llvm::isKnownPositiveInLoop(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isSafeDecreasingBound(), isSafeDependenceDistance(), isSafeIncreasingBound(), IsSimplerBaseSCEVForTarget(), llvm::SCEVPatternMatch::bind_cst_ty::match(), llvm::SCEVPatternMatch::cst_pred_ty< Predicate >::match(), llvm::SCEVPatternMatch::SCEVURem_match< Op0_t, Op1_t >::match(), mayUsePostIncMode(), llvm::VPlanTransforms::optimizeFindIVReductions(), optimizeLoopExitWithUnknownExitCount(), llvm::LoopStructure::parseLoopStructure(), llvm::peelLoop(), PrintSCEVWithTypeHint(), llvm::replaceSymbolicStrideSCEV(), llvm::ScalarEvolution::LoopGuards::rewrite(), shouldPeelLastIteration(), simplifyBranchConditionForVFAndUF(), llvm::VPlanTransforms::simplifyKnownEVL(), splitLoopBound(), llvm::UnrollRuntimeLoopRemainder(), llvm::validateDelinearizationResult(), verifyTripCount(), SCEVCastSinkingRewriter::visit(), llvm::SCEVDivision::visitAddExpr(), llvm::SCEVDivision::visitAddRecExpr(), and llvm::SCEVDivision::visitMulExpr().
| bool SCEV::isAllOnesValue | ( | ) | const |
Return true if the expression is a constant all-ones value.
Definition at line 531 of file ScalarEvolution.cpp.
References llvm::SCEVPatternMatch::m_scev_AllOnes(), and llvm::PatternMatch::match().
| bool SCEV::isNonConstantNegative | ( | ) | const |
Return true if the specified scev is negated, but not a constant.
Definition at line 533 of file ScalarEvolution.cpp.
References llvm::dyn_cast(), llvm::SCEVConstant::getAPInt(), llvm::APInt::isNegative(), and llvm::Mul.
Referenced by calculateRtStride().
| bool SCEV::isOne | ( | ) | const |
Return true if the expression is a constant one.
Definition at line 529 of file ScalarEvolution.cpp.
References llvm::SCEVPatternMatch::m_scev_One(), and llvm::PatternMatch::match().
Referenced by llvm::ScalarEvolution::convertSCEVToAddRecWithPredicates(), genLoopLimit(), getStartForNegStride(), and normalizePredicate().
| bool SCEV::isZero | ( | ) | const |
Return true if the expression is a constant zero.
Definition at line 527 of file ScalarEvolution.cpp.
References llvm::SCEVPatternMatch::m_scev_Zero(), and llvm::PatternMatch::match().
Referenced by breakBackedgeIfNotTaken(), calculateRtStride(), llvm::LoopVectorizationCostModel::computeMaxVF(), llvm::DependenceInfo::depends(), llvm::SCEVDivision::divide(), dumpExampleDependence(), evaluatePtrAddRecAtMaxBTCWillNotWrap(), llvm::findArrayDimensions(), FindLoopCounter(), isAlwaysFoldable(), llvm::LoopVectorizationPlanner::selectBestEpiloguePlan(), SolveQuadraticAddRecRange(), and llvm::ScalarEvolution::verify().
Return operands of this SCEV expression.
Definition at line 498 of file ScalarEvolution.cpp.
References llvm::cast(), getSCEVType(), llvm_unreachable, llvm::scAddExpr, llvm::scAddRecExpr, llvm::scConstant, llvm::scCouldNotCompute, llvm::scMulExpr, llvm::scPtrToAddr, llvm::scPtrToInt, llvm::scSequentialUMinExpr, llvm::scSignExtend, llvm::scSMaxExpr, llvm::scSMinExpr, llvm::scTruncate, llvm::scUDivExpr, llvm::scUMaxExpr, llvm::scUMinExpr, llvm::scUnknown, llvm::scVScale, and llvm::scZeroExtend.
Referenced by computeAndSetCanonical(), llvm::ScalarEvolution::computeConstantDifference(), llvm::ScalarEvolution::getMulExpr(), llvm::ScalarEvolution::getNotSCEV(), getSetupCost(), llvm::ScalarEvolution::verify(), and llvm::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 line 350 of file ScalarEvolution.cpp.
References llvm::cast(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::SCEVUDivExpr::getLHS(), llvm::SCEVAddRecExpr::getLoop(), 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::interleaved(), llvm_unreachable, llvm::make_pointee_range(), llvm::SCEVNAryExpr::operands(), llvm::Value::printAsOperand(), llvm::scAddExpr, llvm::scAddRecExpr, llvm::scConstant, llvm::scCouldNotCompute, SCEV(), llvm::scMulExpr, llvm::scPtrToAddr, llvm::scPtrToInt, llvm::scSequentialUMinExpr, llvm::scSignExtend, llvm::scSMaxExpr, llvm::scSMinExpr, llvm::scTruncate, llvm::scUDivExpr, llvm::scUMaxExpr, llvm::scUMinExpr, llvm::scUnknown, llvm::scVScale, and llvm::scZeroExtend.
Referenced by dump(), llvm::operator<<(), and llvm::ScalarEvolution::print().
|
friend |
Definition at line 241 of file ScalarEvolution.h.
Pointer to the canonical version of the SCEV, i.e.
one where all operands have no SCEVUse flags.
Definition at line 276 of file ScalarEvolution.h.
Referenced by computeAndSetCanonical(), and getCanonical().
Definition at line 268 of file ScalarEvolution.h.
Referenced by getExpressionSize(), and SCEV().
|
staticconstexpr |
Definition at line 280 of file ScalarEvolution.h.
Referenced by CollectSubexprs(), computeAndSetCanonical(), DoInitialMatch(), ExtractImmediate(), ExtractSymbol(), llvm::ScalarEvolution::getAbsExpr(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getAddRecExpr(), getExactSDiv(), llvm::ScalarEvolution::getGEPExpr(), llvm::ScalarEvolution::getMinusSCEV(), llvm::ScalarEvolution::getMulExpr(), llvm::ScalarEvolution::getMulExpr(), llvm::ScalarEvolution::getMulExpr(), llvm::SCEVAddRecExpr::getPostIncExpr(), getPreStartForExtend(), llvm::vputils::getSCEVExprForVPValue(), llvm::ScalarEvolution::getSignExtendExprImpl(), llvm::SCEVAddRecExpr::getStepRecurrence(), llvm::ScalarEvolution::getTruncateExpr(), llvm::ScalarEvolution::getUDivExpr(), llvm::ScalarEvolution::getZeroExtendExprImpl(), llvm::SCEVNAryExpr::hasNoSelfWrap(), llvm::SCEVNAryExpr::hasNoSignedWrap(), llvm::SCEVNAryExpr::hasNoUnsignedWrap(), llvm::ScalarEvolution::removePointerBase(), llvm::ScalarEvolution::LoopGuards::rewrite(), and llvm::ScalarEvolution::willNotOverflow().
|
staticconstexpr |
Definition at line 283 of file ScalarEvolution.h.
Referenced by llvm::ScalarEvolution::getAbsExpr(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getGEPExpr(), llvm::SCEVWrapPredicate::getImpliedFlags(), llvm::ScalarEvolution::getMinusSCEV(), llvm::ScalarEvolution::getMulExpr(), llvm::vputils::getSCEVExprForVPValue(), llvm::ScalarEvolution::getSignExtendExprImpl(), llvm::ScalarEvolution::getStrengthenedNoWrapFlagsFromBinOp(), llvm::ScalarEvolution::getZeroExtendExprImpl(), llvm::SCEVNAryExpr::hasNoSignedWrap(), llvm::SCEVExpander::hoistIVInc(), llvm::SCEVWrapPredicate::isAlwaysTrue(), IsKnownPredicateViaAddRecStart(), llvm::SCEVUseT< SCEVPtrT >::print(), llvm::ScalarEvolution::LoopGuards::rewrite(), llvm::SCEVSequentialMinMaxExpr::SCEVSequentialMinMaxExpr(), llvm::SCEVAddRecExpr::setNoWrapFlags(), llvm::ScalarEvolution::SimplifyICmpOperands(), and StrengthenNoWrapFlags().
|
staticconstexpr |
Definition at line 282 of file ScalarEvolution.h.
Referenced by llvm::VPlanTransforms::addMinimumIterationCheck(), llvm::VPlanTransforms::addMinimumVectorEpilogueIterationCheck(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getGEPExpr(), llvm::SCEVWrapPredicate::getImpliedFlags(), llvm::ScalarEvolution::getMulExpr(), getNumBytes(), getPreStartForExtend(), llvm::ScalarEvolution::getSignExtendExprImpl(), getStartForNegStride(), llvm::ScalarEvolution::getStrengthenedNoWrapFlagsFromBinOp(), llvm::ScalarEvolution::getURemExpr(), llvm::ScalarEvolution::getZeroExtendExprImpl(), llvm::SCEVNAryExpr::hasNoUnsignedWrap(), llvm::SCEVExpander::hoistIVInc(), IsKnownPredicateViaAddRecStart(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), llvm::SCEVUseT< SCEVPtrT >::print(), llvm::ScalarEvolution::LoopGuards::rewrite(), llvm::SCEVSequentialMinMaxExpr::SCEVSequentialMinMaxExpr(), llvm::SCEVAddRecExpr::setNoWrapFlags(), llvm::ScalarEvolution::SimplifyICmpOperands(), and StrengthenNoWrapFlags().
|
staticconstexpr |
Definition at line 281 of file ScalarEvolution.h.
Referenced by llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getAddRecExpr(), llvm::ScalarEvolution::getAddRecExpr(), llvm::ScalarEvolution::getAnyExtendExpr(), llvm::ScalarEvolution::getMulExpr(), llvm::SCEVAddRecExpr::getNumIterationsInRange(), llvm::ScalarEvolution::getSignExtendExprImpl(), llvm::ScalarEvolution::getUDivExpr(), llvm::ScalarEvolution::getZeroExtendExprImpl(), llvm::SCEVNAryExpr::hasNoSelfWrap(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), llvm::SCEVAddRecExpr::setNoWrapFlags(), and StrengthenNoWrapFlags().
|
staticconstexpr |
Definition at line 284 of file ScalarEvolution.h.
Referenced by llvm::SCEVNAryExpr::getNoWrapFlags(), and isNoWrap().
|
protected |
This field is initialized to zero and may be used in subclasses to store miscellaneous information.
Definition at line 272 of file ScalarEvolution.h.
Referenced by llvm::SCEVNAryExpr::getNoWrapFlags(), llvm::SCEVAddRecExpr::setNoWrapFlags(), and llvm::SCEVCommutativeExpr::setNoWrapFlags().