|
LLVM
10.0.0
|
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 (const FoldingSetNodeIDRef ID, unsigned SCEVTy, unsigned short ExpressionSize) | |
| SCEV (const SCEV &)=delete | |
| SCEV & | operator= (const SCEV &)=delete |
| unsigned | getSCEVType () const |
| Type * | getType () const |
| Return the LLVM type of this SCEV expression. More... | |
| bool | isZero () const |
| Return true if the expression is a constant zero. More... | |
| bool | isOne () const |
| Return true if the expression is a constant one. More... | |
| bool | isAllOnesValue () const |
| Return true if the expression is a constant all-ones value. More... | |
| bool | isNonConstantNegative () const |
| Return true if the specified scev is negated, but not a constant. More... | |
| unsigned short | getExpressionSize () const |
| void | print (raw_ostream &OS) const |
| Print out the internal representation of this scalar to the specified stream. More... | |
| void | dump () const |
| This method is used for debugging. More... | |
Public Member Functions inherited from llvm::FoldingSetBase::Node | |
| Node ()=default | |
| void * | getNextInBucket () const |
| void | SetNextInBucket (void *N) |
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. More... | |
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 76 of file ScalarEvolution.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.
| Enumerator | |
|---|---|
| FlagAnyWrap | |
| FlagNW | |
| FlagNUW | |
| FlagNSW | |
| NoWrapMask | |
Definition at line 113 of file ScalarEvolution.h.
|
inlineexplicit |
Definition at line 121 of file ScalarEvolution.h.
References operator=().
| LLVM_DUMP_METHOD void SCEV::dump | ( | ) | const |
This method is used for debugging.
Definition at line 239 of file ScalarEvolution.cpp.
References llvm::dbgs(), and print().
Referenced by getExpressionSize().
|
inline |
Definition at line 153 of file ScalarEvolution.h.
References dump(), ExpressionSize, and print().
Referenced by isHugeExpression().
|
inline |
Definition at line 127 of file ScalarEvolution.h.
References getType(), isAllOnesValue(), isNonConstantNegative(), isOne(), and isZero().
Referenced by BuildConstantFromSCEV(), llvm::SCEVConstant::classof(), llvm::SCEVCastExpr::classof(), llvm::SCEVTruncateExpr::classof(), llvm::SCEVZeroExtendExpr::classof(), llvm::SCEVSignExtendExpr::classof(), llvm::SCEVNAryExpr::classof(), llvm::SCEVCouldNotCompute::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::SCEVUnknown::classof(), CompareSCEVComplexity(), llvm::SCEVExpander::expandCodeFor(), llvm::ScalarEvolution::getBlockDisposition(), getExprBase(), llvm::ScalarEvolution::getLoopDisposition(), llvm::ScalarEvolution::getMinMaxExpr(), llvm::SCEVExpander::getRelatedExistingExpansion(), getType(), GroupByComplexity(), IsAvailableOnEntry(), isHighCostExpansion(), print(), llvm::SCEVVisitor< SCEVLoopAddRecRewriter, const SCEV *>::visit(), and llvm::SCEVTraversal< SV >::visitAll().
| Type * SCEV::getType | ( | ) | const |
Return the LLVM type of this SCEV expression.
Definition at line 363 of file ScalarEvolution.cpp.
References getSCEVType(), llvm_unreachable, llvm::scAddExpr, llvm::scAddRecExpr, llvm::scConstant, llvm::scCouldNotCompute, llvm::scMulExpr, llvm::scSignExtend, llvm::scSMaxExpr, llvm::scSMinExpr, llvm::scTruncate, llvm::scUDivExpr, llvm::scUMaxExpr, llvm::scUMinExpr, llvm::scUnknown, and llvm::scZeroExtend.
Referenced by llvm::LoopAccessInfo::addRuntimeChecks(), llvm::SCEVAAResult::alias(), BinomialCoefficient(), BuildConstantFromSCEV(), llvm::cannotBeMaxInLoop(), llvm::cannotBeMinInLoop(), llvm::IndexedReference::computeRefCost(), computeTripCount(), countToEliminateCompares(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), llvm::SCEVExpander::expandCodeFor(), llvm::SCEVExpander::expandEqualPredicate(), llvm::AlignmentFromAssumptionsPass::extractAlignmentInfo(), FactorOutConstant(), FindLoopCounter(), llvm::InnerLoopVectorizer::fixupIVUsers(), genLoopLimit(), llvm::ScalarEvolution::getAnyExtendExpr(), getConstantPart(), llvm::ScalarEvolution::getEqualPredicate(), getExactSDiv(), llvm::ScalarEvolution::getGEPExpr(), getMaxBackedgeTakenCount(), llvm::ScalarEvolution::getMinusSCEV(), llvm::ScalarEvolution::getNegativeSCEV(), getNewAlignment(), llvm::ScalarEvolution::getNoopOrAnyExtend(), llvm::ScalarEvolution::getNoopOrSignExtend(), llvm::ScalarEvolution::getNoopOrZeroExtend(), llvm::ScalarEvolution::getNotSCEV(), getNumBytes(), llvm::InnerLoopVectorizer::getOrCreateTripCount(), llvm::ScalarEvolution::getPointerBase(), getRangeForAffineARHelper(), GetRangeFromMetadata(), llvm::SCEVExpander::getRelatedExistingExpansion(), getSCEVType(), getSignedOverflowLimitForStep(), llvm::ScalarEvolution::getSignExtendExpr(), llvm::ScalarEvolution::getTruncateExpr(), llvm::ScalarEvolution::getTruncateOrNoop(), llvm::ScalarEvolution::getTruncateOrSignExtend(), llvm::ScalarEvolution::getTruncateOrZeroExtend(), llvm::ScalarEvolution::getUDivExpr(), llvm::ScalarEvolution::getUMaxFromMismatchedTypes(), llvm::ScalarEvolution::getUMinFromMismatchedTypes(), getUnsignedOverflowLimitForStep(), llvm::ScalarEvolution::getURemExpr(), getVectorType(), llvm::ScalarEvolution::getZeroExtendExpr(), hasHugeExpression(), llvm::hasIterationCountInvariantInParent(), llvm::RuntimePointerChecking::insert(), isAddFoldable(), llvm::HardwareLoopInfo::isHardwareLoopCandidate(), llvm::ARMTTIImpl::isHardwareLoopProfitable(), isIgnorableInst(), isIntegerLoopHeaderPHI(), llvm::isKnownNegativeInLoop(), llvm::isKnownNonNegativeInLoop(), isKnownPredicateExtendIdiom(), IsKnownPredicateViaMinOrMax(), isLoadOrStore(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), llvm::ScalarEvolution::isLoopEntryGuardedByCond(), isLoopIncrement(), llvm::ScalarEvolution::isLoopInvariantPredicate(), isRemainderZero(), isSafeDependenceDistance(), isSimpleCastedPHI(), llvm::FullDependence::isSplitable(), MatchBinaryOp(), matchesOr(), mayLoopAccessLocation(), mayUsePostIncMode(), minAPInt(), normalizePredicate(), PickMostRelevantLoop(), llvm::LoopPredicationPass::run(), llvm::SCEVCastExpr::SCEVCastExpr(), llvm::SCEVEqualPredicate::SCEVEqualPredicate(), llvm::ScalarEvolution::SimplifyICmpOperands(), SolveLinEquationWithOverflow(), truncateIVUse(), llvm::UnrollRuntimeLoopRemainder(), visitIVCast(), and willNotOverflow().
| bool SCEV::isAllOnesValue | ( | ) | const |
Return true if the expression is a constant all-ones value.
Definition at line 402 of file ScalarEvolution.cpp.
References llvm::PPCISD::SC.
Referenced by generateLoopLatchCheck(), llvm::ScalarEvolution::getMulExpr(), getSCEVType(), MatchNotExpr(), and normalizePredicate().
| bool SCEV::isNonConstantNegative | ( | ) | const |
Return true if the specified scev is negated, but not a constant.
Definition at line 408 of file ScalarEvolution.cpp.
References llvm::dyn_cast(), llvm::SCEVConstant::getAPInt(), llvm::SCEVNAryExpr::getOperand(), llvm::APInt::isNegative(), and llvm::PPCISD::SC.
Referenced by getSCEVType(), IsIncrementNUW(), and PickMostRelevantLoop().
| bool SCEV::isOne | ( | ) | const |
Return true if the expression is a constant one.
Definition at line 396 of file ScalarEvolution.cpp.
References llvm::PPCISD::SC.
Referenced by FactorOutConstant(), generateLoopLatchCheck(), genLoopLimit(), getSCEVType(), hasHugeExpression(), isLoopCounter(), and normalizePredicate().
| bool SCEV::isZero | ( | ) | const |
Return true if the expression is a constant zero.
Definition at line 390 of file ScalarEvolution.cpp.
References llvm::PPCISD::SC.
Referenced by BuildConstantFromSCEV(), canFoldIVIncExpr(), DoInitialMatch(), llvm::AlignmentFromAssumptionsPass::extractAlignmentInfo(), FactorOutConstant(), llvm::ScalarEvolution::findArrayDimensions(), findArrayDimensionsRec(), getConstantPart(), getMaxBackedgeTakenCount(), llvm::SCEVAddRecExpr::getPostIncExpr(), getSCEVType(), getSetupCost(), hasHugeExpression(), isAlwaysFoldable(), isProfitableChain(), mayUsePostIncMode(), SolveQuadraticAddRecRange(), and llvm::ScalarEvolution::verify().
| 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 245 of file ScalarEvolution.cpp.
References llvm::numbers::e, E, FlagNSW, 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::SCEVUnknown::getValue(), llvm::SCEVNAryExpr::hasNoSelfWrap(), llvm::SCEVNAryExpr::hasNoSignedWrap(), llvm::SCEVNAryExpr::hasNoUnsignedWrap(), I, llvm::SCEVUnknown::isAlignOf(), llvm::SCEVUnknown::isOffsetOf(), llvm::SCEVUnknown::isSizeOf(), llvm_unreachable, llvm::SCEVNAryExpr::op_begin(), llvm::SCEVNAryExpr::op_end(), llvm::Value::printAsOperand(), llvm::scAddExpr, llvm::scAddRecExpr, llvm::scConstant, llvm::scCouldNotCompute, llvm::scMulExpr, llvm::scSignExtend, llvm::scSMaxExpr, llvm::scSMinExpr, llvm::scTruncate, llvm::scUDivExpr, llvm::scUMaxExpr, llvm::scUMinExpr, llvm::scUnknown, and llvm::scZeroExtend.
Referenced by dump(), llvm::SCEVPredicate::getComplexity(), getExpressionSize(), llvm::SCEVWrapPredicate::getFlags(), llvm::SCEVUnionPredicate::getPredicates(), llvm::ScalarEvolutionWrapperPass::getSE(), llvm::PredicatedScalarEvolution::getSE(), llvm::ScalarEvolution::getSignedRangeMax(), llvm::operator<<(), and llvm::ScalarEvolution::print().
|
friend |
Definition at line 77 of file ScalarEvolution.h.
Definition at line 88 of file ScalarEvolution.h.
Referenced by getExpressionSize().
|
protected |
This field is initialized to zero and may be used in subclasses to store miscellaneous information.
Definition at line 92 of file ScalarEvolution.h.
Referenced by llvm::SCEVNAryExpr::getNoWrapFlags(), llvm::SCEVCommutativeExpr::setNoWrapFlags(), and llvm::SCEVAddRecExpr::setNoWrapFlags().
1.8.13