llvm::ElementCount

Describes how many elements a type holds, either fixed or scaled by vscale.

Synopsis

Declared in <llvm/Support/TypeSize.h>

class ElementCount
    : public details::FixedOrScalableQuantity<ElementCount, unsigned int>

Description

Examples:

  • ElementCount::getFixed(1) : A scalar value.

  • ElementCount::getFixed(2) : A vector type holding 2 values.

  • ElementCount::getScalable(4) : A scalable vector type holding 4 values.

Base Classes

NameDescription
details::FixedOrScalableQuantity<ElementCount, unsigned int>Common representation for a quantity that may be fixed or scaled by runtime vscale, shared by ElementCount and TypeSize.

Type Aliases

NameDescription
ScalarTy Scalar type used to store the fixed or scalable quantity.

Member Functions

NameDescription
ElementCount [constructor]Construct a zero fixed element count.
coefficientNextPowerOf2 Round the known-min coefficient up to the next power of two.
divideCoefficientBy Divide the known-min coefficient by RHS.
getFixedValue Return the compile-time quantity when this is fixed or zero; asserts if called on a non-zero scalable quantity.
getKnownMinValue Returns the minimum value this quantity can represent.
getKnownScalarFactor Returns a value X where RHS.multiplyCoefficientBy(X) will result in a value whose quantity matches our own.
getWithIncrement Add RHS to the underlying quantity.
hasKnownScalarFactor Returns true if there exists a value X where RHS.multiplyCoefficientBy(X) will result in a value whose quantity matches our own.
isFixed Returns true if the quantity is not scaled by vscale.
isKnownEven Return true if the known-min coefficient is even.
isKnownMultipleOf isKnownMultipleOf overloads
isNonZero Return true if the underlying coefficient is non-zero.
isScalable Returns whether the quantity is scaled by a runtime quantity (vscale).
isScalar Exactly one element.
isVector One or more elements.
isZero Return true if the known-minimum coefficient is zero.
multiplyCoefficientBy Multiply the known-min coefficient by RHS, preserving fixed/scalable kind.
print Print this quantity to OS.
operator bool Return true if the quantity is non-zero.
operator== Return true if quantity and scalable kind equal those of RHS.
operator!= Return true if quantity or scalable kind differs from RHS.

Static Member Functions

NameDescription
get Return an element count with minimum value MinVal, optionally scalable.
getFixed Return a fixed (non-vscale) element count of MinVal.
getScalable Return a scalable element count with known-minimum MinVal.
isKnownGE Return true when LHS is definitely greater than or equal to RHS given that vscale >= 1; returns false when the relation cannot be proved.
isKnownGT Return true when LHS is definitely greater than RHS given that vscale >= 1; returns false when the relation cannot be proved.
isKnownLE Return true when LHS is definitely less than or equal to RHS given that vscale >= 1; returns false when the relation cannot be proved.
isKnownLT Return true when LHS is definitely less than RHS given that vscale >= 1; returns false when the relation cannot be proved.

Protected Data Members

NameDescription
Quantity Known-minimum quantity (coefficient of 1 or of vscale).
Scalable True when Quantity is scaled by the runtime vscale factor.

Non-Member Functions

NameDescription
SplitBlockAndInsertForEachLaneInvoke a callback once for each lane of a vector with EC elements.
getOptionalElementCountLoopAttributeBuild an ElementCount from loop vectorize width metadata, if present.
getVectorizedTypeVFReturns the number of vector elements for a vectorized type.
details::operator*Multiply LHS by the scalar RHS, preserving its fixed/scalable kind.
details::operator*=Multiply LHS by the scalar RHS in place, preserving its fixed/scalable kind.
details::operator+Add RHS to LHS when both have compatible fixed/scalable kinds.
details::operator+=Add RHS into LHS when both have compatible fixed/scalable kinds.
details::operator-Negate LHS when the scalar type is signed.
details::operator-Subtract RHS from LHS when both have compatible fixed/scalable kinds; asserts if the operands cannot be combined.
details::operator-=Subtract RHS from LHS when both have compatible fixed/scalable kinds; asserts if the operands cannot be combined.