LLVM  14.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
llvm::LinearPolySize< LeafTy > Class Template Reference

LinearPolySize is a base class to represent sizes. More...

#include "llvm/Support/TypeSize.h"

Inheritance diagram for llvm::LinearPolySize< LeafTy >:
Inheritance graph
[legend]
Collaboration diagram for llvm::LinearPolySize< LeafTy >:
Collaboration graph
[legend]

Public Types

enum  Dims : unsigned { FixedDim = 0, ScalableDim = 1 }
 
using ScalarTy = typename UnivariateLinearPolyBase< LeafTy >::ScalarTy
 
- Public Types inherited from llvm::UnivariateLinearPolyBase< LeafTy >
using ScalarTy = typename LinearPolyBaseTypeTraits< LeafTy >::ScalarTy
 

Public Member Functions

ScalarTy getKnownMinValue () const
 Returns the minimum value this size can represent. More...
 
bool isScalable () const
 Returns whether the size is scaled by a runtime quantity (vscale). More...
 
bool isKnownEven () const
 A return value of true indicates we know at compile time that the number of elements (vscale * Min) is definitely even. More...
 
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. More...
 
ScalarTy getFixedValue () const
 
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. More...
 
LeafTy coefficientNextPowerOf2 () const
 
void print (raw_ostream &OS) const
 Printing function. More...
 
- Public Member Functions inherited from llvm::UnivariateLinearPolyBase< LeafTy >
bool operator== (const UnivariateLinearPolyBase &RHS) const
 
bool operator!= (const UnivariateLinearPolyBase &RHS) const
 
bool isZero () const
 
bool isNonZero () const
 
 operator bool () const
 
ScalarTy getValue (unsigned Dim) const
 
LeafTy getWithIncrement (ScalarTy RHS) const
 Add RHS to the value at the univariate dimension. More...
 
LeafTy getWithDecrement (ScalarTy RHS) const
 Subtract RHS from the value at the univariate dimension. More...
 

Static Public Member Functions

static LeafTy getFixed (ScalarTy MinVal)
 
static LeafTy getScalable (ScalarTy MinVal)
 
static LeafTy get (ScalarTy MinVal, bool Scalable)
 
static LeafTy getNull ()
 
static bool isKnownLT (const LinearPolySize &LHS, const LinearPolySize &RHS)
 
static bool isKnownGT (const LinearPolySize &LHS, const LinearPolySize &RHS)
 
static bool isKnownLE (const LinearPolySize &LHS, const LinearPolySize &RHS)
 
static bool isKnownGE (const LinearPolySize &LHS, const LinearPolySize &RHS)
 

Protected Member Functions

 LinearPolySize (ScalarTy MinVal, Dims D)
 
 LinearPolySize (const UnivariateLinearPolyBase< LeafTy > &V)
 
- Protected Member Functions inherited from llvm::UnivariateLinearPolyBase< LeafTy >
 UnivariateLinearPolyBase (ScalarTy Val, unsigned UnivariateDim)
 

Friends

class UnivariateLinearPolyBase< LeafTy >
 

Additional Inherited Members

- Static Public Attributes inherited from llvm::UnivariateLinearPolyBase< LeafTy >
static constexpr auto Dimensions = LinearPolyBaseTypeTraits<LeafTy>::Dimensions
 
- Protected Attributes inherited from llvm::UnivariateLinearPolyBase< LeafTy >
ScalarTy Value
 
unsigned UnivariateDim
 

Detailed Description

template<typename LeafTy>
class llvm::LinearPolySize< LeafTy >

LinearPolySize is a base class to represent sizes.

It is either fixed-sized or it is scalable-sized, but it cannot be both.

Definition at line 264 of file TypeSize.h.

Member Typedef Documentation

◆ ScalarTy

template<typename LeafTy >
using llvm::LinearPolySize< LeafTy >::ScalarTy = typename UnivariateLinearPolyBase<LeafTy>::ScalarTy

Definition at line 271 of file TypeSize.h.

Member Enumeration Documentation

◆ Dims

template<typename LeafTy >
enum llvm::LinearPolySize::Dims : unsigned
Enumerator
FixedDim 
ScalableDim 

Definition at line 272 of file TypeSize.h.

Constructor & Destructor Documentation

◆ LinearPolySize() [1/2]

template<typename LeafTy >
llvm::LinearPolySize< LeafTy >::LinearPolySize ( ScalarTy  MinVal,
Dims  D 
)
inlineprotected

◆ LinearPolySize() [2/2]

template<typename LeafTy >
llvm::LinearPolySize< LeafTy >::LinearPolySize ( const UnivariateLinearPolyBase< LeafTy > &  V)
inlineprotected

Definition at line 278 of file TypeSize.h.

Member Function Documentation

◆ coefficientNextPowerOf2()

template<typename LeafTy >
LeafTy llvm::LinearPolySize< LeafTy >::coefficientNextPowerOf2 ( ) const
inline

Definition at line 365 of file TypeSize.h.

Referenced by llvm::TargetLoweringBase::getVectorTypeBreakdown().

◆ divideCoefficientBy()

template<typename LeafTy >
LeafTy llvm::LinearPolySize< LeafTy >::divideCoefficientBy ( ScalarTy  RHS) const
inline

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 360 of file TypeSize.h.

Referenced by llvm::LegalizerHelper::fewerElementsVectorMulo(), llvm::LegalizerHelper::fewerElementsVectorSelect(), llvm::LegalizerHelper::fewerElementsVectorShuffle(), getHalfSizedType(), and llvm::TargetLoweringBase::getVectorTypeBreakdown().

◆ get()

template<typename LeafTy >
static LeafTy llvm::LinearPolySize< LeafTy >::get ( ScalarTy  MinVal,
bool  Scalable 
)
inlinestatic

◆ getFixed()

template<typename LeafTy >
static LeafTy llvm::LinearPolySize< LeafTy >::getFixed ( ScalarTy  MinVal)
inlinestatic

Definition at line 283 of file TypeSize.h.

◆ getFixedValue()

template<typename LeafTy >
ScalarTy llvm::LinearPolySize< LeafTy >::getFixedValue ( ) const
inline

◆ getKnownMinValue()

template<typename LeafTy >
ScalarTy llvm::LinearPolySize< LeafTy >::getKnownMinValue ( ) const
inline

Returns the minimum value this size can represent.

Definition at line 296 of file TypeSize.h.

Referenced by llvm::InnerLoopVectorizer::buildScalarSteps(), clampDynamicVectorIndex(), llvm::LinearPolySize< TypeSize >::coefficientNextPowerOf2(), llvm::TargetLoweringBase::computeRegisterProperties(), llvm::EpilogueVectorizerEpilogueLoop::createEpilogueVectorizedLoopSkeleton(), createStepForVF(), llvm::RISCVTargetLowering::decomposeSubvectorInsertExtractToSubRegs(), llvm::LinearPolySize< TypeSize >::divideCoefficientBy(), llvm::VPReplicateRecipe::execute(), llvm::VPWidenCanonicalIVRecipe::execute(), llvm::VPRegionBlock::execute(), llvm::VPTransformState::get(), llvm::VPLane::getAsRuntimeExpr(), getCopyFromPartsVector(), llvm::SelectionDAG::GetDependentSplitDestVTs(), llvm::LinearPolySize< TypeSize >::getFixedValue(), llvm::DenseMapInfo< ElementCount, void >::getHashValue(), llvm::VPLane::getLastLaneForVF(), llvm::RISCVTargetLowering::getLMUL(), llvm::AArch64TTIImpl::getMaxNumElements(), llvm::VPLane::getNumCachedLanes(), llvm::LLT::getNumElements(), llvm::InnerLoopVectorizer::getOrCreateVectorTripCount(), llvm::EVT::getPow2VectorType(), llvm::MVT::getPow2VectorType(), llvm::getRuntimeVF(), llvm::LoopVectorizationCostModel::getVectorCallCost(), llvm::EVT::getVectorMinNumElements(), llvm::TargetLoweringBase::getVectorTypeBreakdown(), instCombineSVETBL(), llvm::VFRange::isEmpty(), llvm::LinearPolySize< TypeSize >::isKnownEven(), llvm::LinearPolySize< TypeSize >::isKnownGE(), llvm::LinearPolySize< TypeSize >::isKnownGT(), llvm::LinearPolySize< TypeSize >::isKnownLE(), llvm::LinearPolySize< TypeSize >::isKnownLT(), llvm::LinearPolySize< TypeSize >::isKnownMultipleOf(), llvm::VPLane::mapToCacheIndex(), llvm::ElementCountComparator::operator()(), llvm::AArch64TargetLowering::PerformDAGCombine(), llvm::LoopVectorizationPlanner::plan(), llvm::LoopVectorizationPlanner::planInVPlanNativePath(), llvm::LinearPolySize< TypeSize >::print(), llvm::LoopVectorizationCostModel::selectEpilogueVectorizationFactor(), llvm::LoopVectorizationCostModel::selectInterleaveCount(), llvm::LoopVectorizationCostModel::selectVectorizationFactor(), llvm::LoopVectorizationCostModel::setCostBasedWideningDecision(), llvm::InnerLoopVectorizer::setDebugLocFromInst(), SimplifyShuffleVectorInst(), llvm::InnerLoopVectorizer::vectorizeInterleaveGroup(), llvm::VFRange::VFRange(), and llvm::InnerLoopVectorizer::widenCallInstruction().

◆ getNull()

template<typename LeafTy >
static LeafTy llvm::LinearPolySize< LeafTy >::getNull ( )
inlinestatic

Definition at line 293 of file TypeSize.h.

◆ getScalable()

template<typename LeafTy >
static LeafTy llvm::LinearPolySize< LeafTy >::getScalable ( ScalarTy  MinVal)
inlinestatic

Definition at line 286 of file TypeSize.h.

◆ isKnownEven()

template<typename LeafTy >
bool llvm::LinearPolySize< LeafTy >::isKnownEven ( ) const
inline

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 302 of file TypeSize.h.

◆ isKnownGE()

template<typename LeafTy >
static bool llvm::LinearPolySize< LeafTy >::isKnownGE ( const LinearPolySize< LeafTy > &  LHS,
const LinearPolySize< LeafTy > &  RHS 
)
inlinestatic

Definition at line 346 of file TypeSize.h.

◆ isKnownGT()

template<typename LeafTy >
static bool llvm::LinearPolySize< LeafTy >::isKnownGT ( const LinearPolySize< LeafTy > &  LHS,
const LinearPolySize< LeafTy > &  RHS 
)
inlinestatic

Definition at line 334 of file TypeSize.h.

◆ isKnownLE()

template<typename LeafTy >
static bool llvm::LinearPolySize< LeafTy >::isKnownLE ( const LinearPolySize< LeafTy > &  LHS,
const LinearPolySize< LeafTy > &  RHS 
)
inlinestatic

Definition at line 340 of file TypeSize.h.

◆ isKnownLT()

template<typename LeafTy >
static bool llvm::LinearPolySize< LeafTy >::isKnownLT ( const LinearPolySize< LeafTy > &  LHS,
const LinearPolySize< LeafTy > &  RHS 
)
inlinestatic

Definition at line 328 of file TypeSize.h.

◆ isKnownMultipleOf()

template<typename LeafTy >
bool llvm::LinearPolySize< LeafTy >::isKnownMultipleOf ( ScalarTy  RHS) const
inline

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 305 of file TypeSize.h.

Referenced by getHalfSizedType(), llvm::LLT::isByteSized(), llvm::EVT::isByteSized(), and llvm::MVT::isByteSized().

◆ isScalable()

template<typename LeafTy >
bool llvm::LinearPolySize< LeafTy >::isScalable ( ) const
inline

Returns whether the size is scaled by a runtime quantity (vscale).

Definition at line 298 of file TypeSize.h.

Referenced by addElementIndex(), llvm::InnerLoopVectorizer::buildScalarSteps(), clampDynamicVectorIndex(), llvm::LinearPolySize< TypeSize >::coefficientNextPowerOf2(), llvm::LoopVectorizationCostModel::collectInstsToScalarize(), computeKnownBitsFromOperator(), llvm::SelectionDAG::CreateStackTemporary(), createStepForVF(), llvm::LinearPolySize< TypeSize >::divideCoefficientBy(), llvm::VPReplicateRecipe::execute(), llvm::VPWidenCanonicalIVRecipe::execute(), llvm::VPRegionBlock::execute(), llvm::FixedScalableVFPair::FixedScalableVFPair(), llvm::SelectionDAG::FoldConstantArithmetic(), llvm::AArch64TargetLowering::functionArgumentNeedsConsecutiveRegisters(), llvm::VPTransformState::get(), llvm::TargetTransformInfoImplBase::getCastInstrCost(), getCopyFromPartsVector(), llvm::SelectionDAG::GetDependentSplitDestVTs(), llvm::LinearPolySize< TypeSize >::getFixedValue(), llvm::DenseMapInfo< ElementCount, void >::getHashValue(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getIntrinsicInstrCost(), llvm::VPLane::getLastLaneForVF(), llvm::AArch64TTIImpl::getMaxNumElements(), llvm::AArch64InstrInfo::getMemOperandWithOffsetWidth(), llvm::VPLane::getNumCachedLanes(), llvm::InnerLoopVectorizer::getOrCreateVectorTripCount(), llvm::EVT::getPow2VectorType(), llvm::MVT::getPow2VectorType(), llvm::Type::getPrimitiveSizeInBits(), llvm::getRuntimeVF(), llvm::LLT::getSizeInBytes(), llvm::EVT::getStoreSize(), llvm::MVT::getStoreSize(), llvm::DataLayout::getTypeStoreSize(), llvm::TargetLoweringBase::getVectorTypeBreakdown(), llvm::VPRecipeBuilder::handleReplication(), llvm::AArch64TargetLowering::hasAndNot(), llvm::InlineFunction(), llvm::isAArch64FrameOffsetLegal(), llvm::LinearPolySize< TypeSize >::isKnownGE(), llvm::LinearPolySize< TypeSize >::isKnownGT(), llvm::LinearPolySize< TypeSize >::isKnownLE(), llvm::LinearPolySize< TypeSize >::isKnownLT(), llvm::RISCVTTIImpl::isLegalToVectorizeReduction(), llvm::AArch64TTIImpl::isLegalToVectorizeReduction(), isLoadInvariantInLoop(), llvm::VFABI::mangleTLIVectorName(), llvm::VPLane::mapToCacheIndex(), llvm::ElementCountComparator::operator()(), llvm::LoopVectorizationPlanner::plan(), llvm::LoopVectorizationPlanner::planInVPlanNativePath(), llvm::LinearPolySize< TypeSize >::print(), replaceWithCallToVeclib(), llvm::LoopVectorizationCostModel::selectEpilogueVectorizationFactor(), llvm::LoopVectorizationCostModel::selectVectorizationFactor(), llvm::LoopVectorizationCostModel::setCostBasedWideningDecision(), llvm::TargetLowering::SimplifyDemandedBits(), llvm::TargetLowering::SimplifyDemandedVectorElts(), SimplifyShuffleVectorInst(), valueCoversEntireFragment(), llvm::InnerLoopVectorizer::vectorizeInterleaveGroup(), llvm::VFRange::VFRange(), llvm::InnerLoopVectorizer::widenPHIInstruction(), and widenVectorToPartType().

◆ print()

template<typename LeafTy >
void llvm::LinearPolySize< LeafTy >::print ( raw_ostream OS) const
inline

Printing function.

Definition at line 372 of file TypeSize.h.

Referenced by llvm::operator<<().

Friends And Related Function Documentation

◆ UnivariateLinearPolyBase< LeafTy >

template<typename LeafTy >
friend class UnivariateLinearPolyBase< LeafTy >
friend

Definition at line 268 of file TypeSize.h.


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