LLVM 22.0.0git
|
#include "llvm/Support/TypeSize.h"
Public Types | |
using | ScalarTy = ValueTy |
Public Member Functions | |
constexpr bool | operator== (const FixedOrScalableQuantity &RHS) const |
constexpr bool | operator!= (const FixedOrScalableQuantity &RHS) const |
constexpr bool | isZero () const |
constexpr bool | isNonZero () const |
operator bool () const | |
constexpr LeafTy | getWithIncrement (ScalarTy RHS) const |
Add RHS to the underlying quantity. | |
constexpr ScalarTy | getKnownMinValue () const |
Returns the minimum value this quantity can represent. | |
constexpr bool | isScalable () const |
Returns whether the quantity is scaled by a runtime quantity (vscale). | |
constexpr bool | isFixed () const |
Returns true if the quantity is not scaled by vscale. | |
constexpr bool | isKnownEven () const |
A return value of true indicates we know at compile time that the number of elements (vscale * Min) is definitely even. | |
constexpr bool | isKnownMultipleOf (ScalarTy RHS) const |
This function tells the caller whether the element count is known at compile time to be a multiple of the scalar value RHS. | |
constexpr bool | isKnownMultipleOf (const FixedOrScalableQuantity &RHS) const |
Returns whether or not the callee is known to be a multiple of RHS. | |
constexpr ScalarTy | getFixedValue () const |
constexpr LeafTy | divideCoefficientBy (ScalarTy RHS) const |
We do not provide the '/' operator here because division for polynomial types does not work in the same way as for normal integer types. | |
constexpr LeafTy | multiplyCoefficientBy (ScalarTy RHS) const |
constexpr LeafTy | coefficientNextPowerOf2 () const |
constexpr bool | hasKnownScalarFactor (const FixedOrScalableQuantity &RHS) const |
Returns true if there exists a value X where RHS.multiplyCoefficientBy(X) will result in a value whose quantity matches our own. | |
constexpr ScalarTy | getKnownScalarFactor (const FixedOrScalableQuantity &RHS) const |
Returns a value X where RHS.multiplyCoefficientBy(X) will result in a value whose quantity matches our own. | |
void | print (raw_ostream &OS) const |
Printing function. |
Static Public Member Functions | |
static constexpr bool | isKnownLT (const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS) |
static constexpr bool | isKnownGT (const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS) |
static constexpr bool | isKnownLE (const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS) |
static constexpr bool | isKnownGE (const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS) |
Protected Member Functions | |
constexpr | FixedOrScalableQuantity ()=default |
constexpr | FixedOrScalableQuantity (ScalarTy Quantity, bool Scalable) |
Protected Attributes | |
ScalarTy | Quantity = 0 |
bool | Scalable = false |
Friends | |
constexpr LeafTy & | operator+= (LeafTy &LHS, const LeafTy &RHS) |
constexpr LeafTy & | operator-= (LeafTy &LHS, const LeafTy &RHS) |
constexpr LeafTy & | operator*= (LeafTy &LHS, ScalarTy RHS) |
constexpr LeafTy | operator+ (const LeafTy &LHS, const LeafTy &RHS) |
constexpr LeafTy | operator- (const LeafTy &LHS, const LeafTy &RHS) |
constexpr LeafTy | operator* (const LeafTy &LHS, ScalarTy RHS) |
template<typename U = ScalarTy> | |
constexpr std::enable_if_t< std::is_signed_v< U >, LeafTy > | operator- (const LeafTy &LHS) |
Definition at line 86 of file TypeSize.h.
using llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::ScalarTy = ValueTy |
Definition at line 88 of file TypeSize.h.
|
constexprprotecteddefault |
Referenced by getKnownScalarFactor(), hasKnownScalarFactor(), isKnownGE(), isKnownGT(), isKnownLE(), isKnownLT(), isKnownMultipleOf(), operator!=(), and operator==().
|
inlineconstexprprotected |
Definition at line 95 of file TypeSize.h.
|
inlineconstexpr |
Definition at line 260 of file TypeSize.h.
References getKnownMinValue(), isScalable(), and llvm::NextPowerOf2().
Referenced by llvm::TargetLoweringBase::getTypeConversion(), and llvm::TargetLoweringBase::getVectorTypeBreakdown().
|
inlineconstexpr |
We do not provide the '/' operator here because division for polynomial types does not work in the same way as for normal integer types.
We can only divide the minimum value (or coefficient) by RHS, which is not the same as (Min * Vscale) / RHS The caller is recommended to use this function in combination with isKnownMultipleOf(RHS), which lets the caller know if it's possible to perform a lossless divide by RHS.
Definition at line 252 of file TypeSize.h.
References getKnownMinValue(), isScalable(), and RHS.
Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), llvm::LegalizerHelper::bitcastExtractSubvector(), llvm::LegalizerHelper::bitcastInsertSubvector(), getDeinterleaveShiftAndTrunc(), llvm::RISCVTTIImpl::getPartialReductionCost(), getQDOTXResultType(), llvm::TargetLoweringBase::getTypeConversion(), llvm::TargetLoweringBase::getVectorTypeBreakdown(), llvm::VectorType::getWithSizeAndScalar(), llvm::AArch64TargetLowering::lowerDeinterleaveIntrinsicToLoad(), llvm::LegalizerHelper::lowerEXT(), llvm::AArch64TargetLowering::lowerInterleaveIntrinsicToStore(), llvm::RISCVRegisterInfo::lowerSegmentSpillReload(), and performActiveLaneMaskCombine().
|
inlineconstexpr |
Definition at line 200 of file TypeSize.h.
References assert(), getKnownMinValue(), isScalable(), and isZero().
Referenced by areExtractShuffleVectors(), buildCopyFromRegs(), buildFrameDebugInfo(), llvm::ARMTargetLowering::canCombineStoreAndExtract(), llvm::VPReplicateRecipe::computeCost(), llvm::LoopVectorizationCostModel::computeMaxVF(), convertCalleeSaveRestoreToSPPrePostIncDec(), doInstrumentAddress(), llvm::InstCombinerImpl::foldCmpLoadFromIndexedGlobal(), llvm::SelectionDAG::FoldConstantArithmetic(), llvm::InstCombinerImpl::foldGEPICmp(), getAvailableLoadStore(), llvm::TargetTransformInfoImplBase::getCastInstrCost(), llvm::LoopVectorizationCostModel::getDivRemSpeculationCost(), getDWordFromOffset(), getElementIndex(), getFauxShuffleMask(), llvm::EVT::getFixedSizeInBits(), llvm::MVT::getFixedSizeInBits(), llvm::getGCDType(), llvm::LoopVectorizationCostModel::getInstructionCost(), llvm::getLCMType(), llvm::X86TTIImpl::getLoadStoreVecRegBitWidth(), getMask(), llvm::RISCVTTIImpl::getMaximumVF(), llvm::AArch64TTIImpl::getMaxNumElements(), llvm::HexagonTTIImpl::getMemoryOpCost(), llvm::GCNTTIImpl::getNumberOfParts(), llvm::WebAssemblyTTIImpl::getPartialReductionCost(), llvm::EVT::getScalarSizeInBits(), llvm::MVT::getScalarSizeInBits(), llvm::EVT::getScalarStoreSize(), llvm::MVT::getScalarStoreSize(), getStrideFromAddRec(), llvm::BasicTTIImplBase< BasicTTIImpl >::getTypeBasedIntrinsicInstrCost(), llvm::DataLayout::getTypeSizeInBits(), getUniformBase(), llvm::SystemZTTIImpl::getVectorTruncCost(), llvm::AMDGPU::instrumentAddress(), isIntegerWideningViableForSlice(), isKnownNonZeroFromOperator(), llvm::AArch64TTIImpl::isLegalBroadcastLoad(), llvm::X86TTIImpl::isLegalBroadcastLoad(), isLoadInvariantInLoop(), isObjectSizeLessThanOrEq(), llvm::isSafeToLoadUnconditionally(), llvm::AArch64TargetLowering::isTruncateFree(), llvm::MSP430TargetLowering::isTruncateFree(), llvm::SystemZTargetLowering::isTruncateFree(), lowerShuffleViaVRegSplitting(), MatchingStackOffset(), llvm::AArch64TargetLowering::ReconstructShuffle(), llvm::LoopVectorizationPlanner::selectEpilogueVectorizationFactor(), llvm::TargetLowering::SimplifyDemandedBits(), TypeSizeToSizeIndex(), upgradeMaskedLoad(), upgradeX86IntrinsicCall(), llvm::LLT::vector(), and willGenerateVectors().
|
inlineconstexpr |
Returns the minimum value this quantity can represent.
Definition at line 166 of file TypeSize.h.
References Quantity.
Referenced by llvm::VPlanTransforms::addBranchWeightToMiddleTerminator(), llvm::VPlanTransforms::addMinimumIterationCheck(), llvm::AArch64InstrInfo::areMemAccessesTriviallyDisjoint(), llvm::LegalizerHelper::bitcastExtractSubvector(), llvm::LegalizerHelper::bitcastInsertSubvector(), llvm::VNCoercion::canCoerceMustAliasedValueToLoad(), canConvertValue(), canCreateUndefOrPoison(), canSkipClobberingStore(), clampDynamicVectorIndex(), coefficientNextPowerOf2(), combineToVCPOP(), llvm::VPInstruction::computeCost(), computeKnownBitsFromOperator(), llvm::LoopVectorizationCostModel::computeMaxVF(), llvm::TargetLoweringBase::computeRegisterProperties(), llvm::RISCVTargetLowering::computeVLMAXBounds(), llvm::SelectionDAG::CreateStackTemporary(), llvm::SelectionDAG::CreateStackTemporary(), llvm::createStepForVF(), llvm::RISCVTargetLowering::decomposeSubvectorInsertExtractToSubRegs(), divideCoefficientBy(), estimateElementCount(), llvm::TargetLowering::expandVectorSplice(), findMemType(), llvm::AArch64TargetLowering::functionArgumentNeedsConsecutiveRegisters(), getAddressForMemoryInput(), llvm::VPLane::getAsRuntimeExpr(), getCopyFromPartsVector(), llvm::getCoverTy(), llvm::SelectionDAG::GetDependentSplitDestVTs(), llvm::EVT::getEVTString(), getFixedValue(), llvm::getGCDType(), llvm::DenseMapInfo< ElementCount, void >::getHashValue(), llvm::RISCVRegisterBankInfo::getInstrMapping(), llvm::LoopVectorizationCostModel::getInstructionCost(), llvm::AArch64TTIImpl::getIntrinsicInstrCost(), getKnownScalarFactor(), llvm::VPLane::getLaneFromEnd(), llvm::getLCMType(), llvm::RISCVTargetLowering::getLMUL(), llvm::AArch64TTIImpl::getMaxNumElements(), llvm::AArch64InstrInfo::getMemOperandWithOffsetWidth(), getMinimalExtentFrom(), llvm::LLT::getNumElements(), llvm::AArch64TargetLowering::getNumInterleavedAccesses(), llvm::AArch64TTIImpl::getPartialReductionCost(), llvm::EVT::getPow2VectorType(), llvm::MVT::getPow2VectorType(), llvm::RISCVTargetLowering::getRegClassIDForVecVT(), llvm::AArch64TTIImpl::getShuffleCost(), llvm::ARMTTIImpl::getShuffleCost(), llvm::RISCVTTIImpl::getShuffleCost(), llvm::TargetTransformInfo::getShuffleCost(), llvm::X86TTIImpl::getShuffleCost(), llvm::LLT::getSizeInBytes(), llvm::EVT::getStoreSize(), llvm::MVT::getStoreSize(), llvm::TargetLoweringBase::getTypeConversion(), llvm::DataLayout::getTypeStoreSize(), llvm::DataLayout::getTypeStoreSizeInBits(), llvm::VNCoercion::getValueForLoad(), llvm::SelectionDAGBuilder::getValueImpl(), llvm::EVT::getVectorMinNumElements(), llvm::TargetLoweringBase::getVectorTypeBreakdown(), HasAddressTaken(), hasKnownScalarFactor(), llvm::TargetLowering::IncrementMemoryAddress(), llvm::GISelAddressing::instMayAlias(), llvm::CastInst::isBitCastable(), isIndvarOverflowCheckKnownFalse(), isKnownEven(), isKnownMultipleOf(), isKnownMultipleOf(), isPackedVectorType(), llvm::LoopVectorizationLegality::isUniform(), isUnpackedVectorVT(), isValidEGW(), llvm::LocationSize::isZero(), llvm::RISCVTargetLowering::joinRegisterPartsIntoValue(), lowerBUILD_VECTOR(), llvm::AArch64TargetLowering::lowerDeinterleaveIntrinsicToLoad(), llvm::RISCVTargetLowering::lowerDeinterleaveIntrinsicToLoad(), llvm::AArch64TargetLowering::lowerInterleaveIntrinsicToStore(), llvm::RISCVTargetLowering::LowerOperation(), LowerSVEIntrinsicEXT(), lowerVECTOR_SHUFFLE(), lowerVZIP(), llvm::VPLane::mapToCacheIndex(), MemOperandsHaveAlias(), llvm::LegalityPredicates::memSizeNotByteSizePow2(), multiplyCoefficientBy(), llvm::VPlanTransforms::narrowInterleaveGroups(), optimizeVectorInductionWidthForTCAndVFUF(), performActiveLaneMaskCombine(), llvm::RISCVTargetLowering::PerformDAGCombine(), performGatherLoadCombine(), performLastTrueTestVectorCombine(), performLD1Combine(), performScatterStoreCombine(), performVectorDeinterleaveCombine(), llvm::LoopVectorizationPlanner::plan(), llvm::LoopVectorizationPlanner::planInVPlanNativePath(), print(), llvm::VPlanTransforms::replicateByVF(), llvm::LoopVectorizationCostModel::setCostBasedWideningDecision(), llvm::LoopVectorizationCostModel::setVectorizedCallDecision(), simplifyShuffleVectorInst(), llvm::RISCVTargetLowering::splitValueIntoRegisterParts(), tryToReplaceALMWithWideALM(), llvm::ObjectSizeOffsetVisitor::visitAllocaInst(), and willGenerateVectors().
|
inlineconstexpr |
Returns a value X where RHS.multiplyCoefficientBy(X) will result in a value whose quantity matches our own.
Definition at line 277 of file TypeSize.h.
References assert(), FixedOrScalableQuantity(), getKnownMinValue(), hasKnownScalarFactor(), and RHS.
|
inlineconstexpr |
Add RHS
to the underlying quantity.
Definition at line 161 of file TypeSize.h.
|
inlineconstexpr |
Returns true if there exists a value X where RHS.multiplyCoefficientBy(X) will result in a value whose quantity matches our own.
Definition at line 269 of file TypeSize.h.
References FixedOrScalableQuantity(), getKnownMinValue(), isScalable(), and RHS.
Referenced by getKnownScalarFactor(), and llvm::SelectionDAG::getNode().
|
inlineconstexpr |
Returns true if the quantity is not scaled by vscale.
Definition at line 172 of file TypeSize.h.
References Scalable.
Referenced by getMask(), llvm::AArch64TTIImpl::getPartialReductionCost(), llvm::WebAssemblyTTIImpl::getPartialReductionCost(), llvm::LoopVectorizationCostModel::isEpilogueVectorizationProfitable(), isIntegerWideningViableForSlice(), optimizeVectorInductionWidthForTCAndVFUF(), llvm::LoopVectorizationPlanner::selectEpilogueVectorizationFactor(), and llvm::LoopVectorizationCostModel::setVectorizedCallDecision().
|
inlineconstexpr |
A return value of true indicates we know at compile time that the number of elements (vscale * Min) is definitely even.
However, returning false does not guarantee that the total number of elements is odd.
Definition at line 177 of file TypeSize.h.
References getKnownMinValue().
Referenced by llvm::SelectionDAG::SplitEVL().
|
inlinestaticconstexpr |
Definition at line 237 of file TypeSize.h.
References FixedOrScalableQuantity(), LHS, and RHS.
|
inlinestaticconstexpr |
Definition at line 223 of file TypeSize.h.
References FixedOrScalableQuantity(), LHS, and RHS.
|
inlinestaticconstexpr |
Definition at line 230 of file TypeSize.h.
References FixedOrScalableQuantity(), LHS, and RHS.
|
inlinestaticconstexpr |
Definition at line 216 of file TypeSize.h.
References FixedOrScalableQuantity(), LHS, and RHS.
|
inlineconstexpr |
Returns whether or not the callee is known to be a multiple of RHS.
Definition at line 186 of file TypeSize.h.
References FixedOrScalableQuantity(), getKnownMinValue(), isScalable(), and RHS.
|
inlineconstexpr |
This function tells the caller whether the element count is known at compile time to be a multiple of the scalar value RHS.
Definition at line 181 of file TypeSize.h.
References getKnownMinValue(), and RHS.
Referenced by llvm::TargetLowering::expandVecReduce(), llvm::TargetLowering::expandVectorNaryOpBySplitting(), foldReduceOperandViaVQDOT(), llvm::RISCVTTIImpl::getPartialReductionCost(), getQDOTXResultType(), llvm::VectorType::getWithSizeAndScalar(), llvm::EVT::isByteSized(), llvm::LLT::isByteSized(), llvm::MVT::isByteSized(), isSupportedAccessType(), llvm::RISCVRegisterInfo::lowerSegmentSpillReload(), llvm::CombinerHelper::matchUseVectorTruncate(), and promoteAllocaUserToVector().
|
inlineconstexpr |
Definition at line 156 of file TypeSize.h.
References Quantity.
Referenced by llvm::LoopVectorizationCostModel::computeMaxVF(), operator bool(), and llvm::LoopVectorizationPlanner::selectInterleaveCount().
|
inlineconstexpr |
Returns whether the quantity is scaled by a runtime quantity (vscale).
Definition at line 169 of file TypeSize.h.
References Scalable.
Referenced by llvm::VPlanTransforms::addBranchWeightToMiddleTerminator(), llvm::LoopVectorizationPlanner::addMinimumIterationCheck(), llvm::AArch64InstrInfo::areMemAccessesTriviallyDisjoint(), clampDynamicVectorIndex(), coefficientNextPowerOf2(), llvm::VNCoercion::coerceAvailableValueToLoadType(), llvm::LoopVectorizationCostModel::collectInstsToScalarize(), llvm::VPReplicateRecipe::computeCost(), computeKnownBitsFromOperator(), llvm::ComputeValueTypes(), llvm::VPRegionBlock::cost(), llvm::SelectionDAG::CreateStackTemporary(), llvm::SelectionDAG::CreateStackTemporary(), llvm::createStepForVF(), divideCoefficientBy(), doInstrumentAddress(), estimateElementCount(), llvm::InstCombinerImpl::foldCmpLoadFromIndexedGlobal(), llvm::SelectionDAG::FoldConstantArithmetic(), llvm::AArch64TargetLowering::functionArgumentNeedsConsecutiveRegisters(), getAddressForMemoryInput(), getAssignmentInfoImpl(), getAvailableLoadStore(), llvm::TargetTransformInfoImplBase::getCastInstrCost(), getCopyFromPartsVector(), llvm::SelectionDAG::GetDependentSplitDestVTs(), llvm::LoopVectorizationCostModel::getDivRemSpeculationCost(), getElementIndex(), getFixedValue(), llvm::DenseMapInfo< ElementCount, void >::getHashValue(), llvm::LoopVectorizationCostModel::getInstructionCost(), llvm::BasicTTIImplBase< BasicTTIImpl >::getIntrinsicInstrCost(), llvm::VPLane::getLaneFromEnd(), llvm::getLCMType(), llvm::RISCVTTIImpl::getMaxInterleaveFactor(), llvm::AArch64TTIImpl::getMaxNumElements(), llvm::AArch64InstrInfo::getMemOperandWithOffsetWidth(), getMinClassForRegBank(), llvm::ScalarEvolution::getOffsetOfExpr(), llvm::AArch64TTIImpl::getPartialReductionCost(), llvm::EVT::getPow2VectorType(), llvm::MVT::getPow2VectorType(), llvm::LLT::getSizeInBytes(), llvm::EVT::getStoreSize(), llvm::MVT::getStoreSize(), llvm::TargetLoweringBase::getTypeConversion(), getTypePartition(), llvm::DataLayout::getTypeStoreSize(), llvm::DataLayout::getTypeStoreSizeInBits(), getUniformBase(), llvm::VNCoercion::getValueForLoad(), llvm::TargetLoweringBase::getVectorTypeBreakdown(), hasKnownScalarFactor(), llvm::AMDGPU::instrumentAddress(), llvm::LoopVectorizationCostModel::interleavedAccessCanBeWidened(), isIndvarOverflowCheckKnownFalse(), isKnownMultipleOf(), llvm::AArch64TTIImpl::isLegalBroadcastLoad(), llvm::X86TTIImpl::isLegalBroadcastLoad(), llvm::AArch64TTIImpl::isLegalToVectorizeReduction(), llvm::RISCVTTIImpl::isLegalToVectorizeReduction(), isLoadInvariantInLoop(), isObjectSizeLessThanOrEq(), llvm::isSafeToLoadUnconditionally(), llvm::LoopVectorizationLegality::isUniform(), llvm::VPLane::mapToCacheIndex(), multiplyCoefficientBy(), llvm::VPlanTransforms::narrowInterleaveGroups(), llvm::LoopVectorizationPlanner::plan(), llvm::LoopVectorizationPlanner::planInVPlanNativePath(), print(), llvm::LoopVectorizationPlanner::selectEpilogueVectorizationFactor(), llvm::LoopVectorizationPlanner::selectInterleaveCount(), llvm::LoopVectorizationCostModel::setCostBasedWideningDecision(), llvm::LoopVectorizationCostModel::shouldConsiderRegPressureForVF(), llvm::TargetLowering::SimplifyDemandedBits(), simplifyShuffleVectorInst(), TypeSizeToSizeIndex(), llvm::RegisterBankInfo::ValueMapping::verify(), llvm::ObjectSizeOffsetVisitor::visitAllocaInst(), widenVectorToPartType(), and willGenerateVectors().
|
inlineconstexpr |
Definition at line 154 of file TypeSize.h.
References Quantity.
Referenced by llvm::LoopVectorizationCostModel::computeMaxVF(), llvm::ComputeValueTypes(), getFixedValue(), llvm::isTLIScalarize(), llvm::EVT::isZeroSized(), llvm::SPIRVCallLowering::lowerCall(), and llvm::LoopVectorizationPlanner::planInVPlanNativePath().
|
inlineconstexpr |
Definition at line 256 of file TypeSize.h.
References getKnownMinValue(), isScalable(), and RHS.
Referenced by llvm::createStepForVF(), llvm::getLCMType(), getWideningInterleave(), llvm::VectorType::getWithSizeAndScalar(), isConditionTrueViaVFAndUF(), and simplifyBranchConditionForVFAndUF().
|
inlineexplicit |
Definition at line 158 of file TypeSize.h.
References isNonZero().
|
inlineconstexpr |
Definition at line 150 of file TypeSize.h.
References FixedOrScalableQuantity(), Quantity, RHS, and Scalable.
|
inlineconstexpr |
Definition at line 146 of file TypeSize.h.
References FixedOrScalableQuantity(), Quantity, RHS, and Scalable.
|
inline |
Printing function.
Definition at line 283 of file TypeSize.h.
References getKnownMinValue(), and isScalable().
Referenced by llvm::operator<<().
|
friend |
Definition at line 133 of file TypeSize.h.
|
friend |
Definition at line 118 of file TypeSize.h.
|
friend |
Definition at line 123 of file TypeSize.h.
|
friend |
Definition at line 98 of file TypeSize.h.
|
friend |
Definition at line 140 of file TypeSize.h.
References LHS.
|
friend |
Definition at line 128 of file TypeSize.h.
|
friend |
Definition at line 108 of file TypeSize.h.
|
protected |
Definition at line 91 of file TypeSize.h.
Referenced by FixedOrScalableQuantity(), getKnownMinValue(), getWithIncrement(), isNonZero(), isZero(), operator!=(), and operator==().
|
protected |
Definition at line 92 of file TypeSize.h.
Referenced by FixedOrScalableQuantity(), getWithIncrement(), isFixed(), isScalable(), operator!=(), and operator==().