llvm::TypeSize

Represents the size of a type as an exact size or a known minimum.

Synopsis

Declared in <llvm/Support/TypeSize.h>

class TypeSize
    : public details::FixedOrScalableQuantity<TypeSize, uint64_t>

Description

If the type is of fixed size, it will represent the exact size. If the type is a scalable vector, it will represent the known minimum size.

Base Classes

NameDescription
details::FixedOrScalableQuantity<TypeSize, uint64_t>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
TypeSize [constructor]Construct a type size with known-minimum Quantity, optionally scaled by vscale.
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).
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 ScalarTy Implicitly convert a fixed-width size to its scalar coefficient; fatal on scalable sizes.
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 a type size with known-minimum Quantity, optionally scaled by vscale.
getFixed Return an exact fixed-width type size.
getScalable Return a scalable type size with known-minimum MinimumSize.
getZero Return a zero-sized fixed TypeSize.
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.

Friends

NameDescription
llvm::operator*Multiply unsigned 64-bit integer LHS by TypeSize RHS.
llvm::operator*Multiply signed 64-bit integer LHS by TypeSize RHS.
llvm::operator*Multiply unsigned integer LHS by TypeSize RHS.
llvm::operator*Multiply signed integer LHS by TypeSize RHS.
llvm::operator*Multiply LHS by the signed 64-bit scalar RHS.
llvm::operator*Multiply LHS by the unsigned int scalar RHS.
llvm::operator*Multiply LHS by the signed int scalar RHS.

Non-Member Functions

NameDescription
alignToRound Size up to a multiple of Align.
getBaseObjectSizeLike getObjectSize(), but only for base objects.
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.