Base class of all SIMD vector types

Synopsis

Declared in <llvm/IR/DerivedTypes.h>

class VectorType
    : public Type

Base Classes

Name

Description

Type

The instances of the Type class are immutable: once they are created, they are never changed. Also note that only one instance of a particular type is ever created. Thus seeing if two types are equal is a matter of doing a trivial pointer comparison. To enforce that no two equal instances are created, Type instances can only be created via static factory methods in class Type and in derived classes. Once allocated, Types are never free'd.

Type Aliases

Enums

Name

Description

TypeID

Definitions of all of the base types for the Type system. Based on this value, you can cast to a class defined in DerivedTypes.h. Note: If you add an element to this, you need to add an element to the Type::getPrimitiveType function, or else things will break! Also update LLVMTypeKind and LLVMGetTypeKind () in the C binding.

Member Functions

Name

Description

VectorType [constructor] [deleted]

Copy constructor

operator= [deleted]

Copy assignment operator

canLosslesslyBitCastTo

Return true if this type could be converted with a lossless BitCast to type 'Ty'. For example, i8* to i32*. BitCasts are valid for types of the same size only where no re‐interpretation of the bits is done. Determine if this type could be losslessly bitcast to Ty

containsNonGlobalTargetExtType

Return true if this type is or contains a target extension type that disallows being used as a global.

containsNonLocalTargetExtType

Return true if this type is or contains a target extension type that disallows being used as a local.

dump

getArrayElementType

getArrayNumElements

getByteBitWidth

getContainedType

This method is used to implement the type iterator (defined at the end of the file). For derived types, this returns the types 'contained' in the derived type.

getContext

Return the LLVMContext in which this type was uniqued.

getElementCount

Return an ElementCount instance to represent the (possibly scalable) number of elements in the vector.

getElementType

getExtendedType

Given scalar/vector integer type, returns a type with elements twice as wide as in the original type. For vectors, preserves element count.

getFPMantissaWidth

Return the width of the mantissa of this type. This is only valid on floating‐point types. If the FP type does not have a stable mantissa (e.g. ppc long double), this method returns ‐1.

getFltSemantics

getFunctionNumParams

getFunctionParamType

getIntegerBitWidth

getNumContainedTypes

Return the number of types in the derived type.

getPointerAddressSpace

Get the address space of this pointer or pointer vector type.

getPrimitiveSizeInBits

Return the basic size of this type if it is a primitive type. These are fixed by LLVM and are not target‐dependent. This will return zero if the type does not have a size or is not a primitive type.

getScalarSizeInBits

If this is a vector type, return the getPrimitiveSizeInBits value for the element type. Otherwise return the getPrimitiveSizeInBits value for this type.

getScalarType

If this is a vector type, return the element type, otherwise return 'this'.

getStructElementType

getStructName

getStructNumElements

getTargetExtName

getTruncatedType

Given scalar/vector integer type, returns a type with elements half as wide as in the original type. For vectors, preserves element count.

getTypeID

Return the type id for the type. This will return one of the TypeID enum elements defined above.

getWithNewBitWidth

Given an integer or vector type, change the lane bitwidth to NewBitwidth, whilst keeping the old number of lanes.

getWithNewType

Given vector type, change the element type, whilst keeping the old number of elements. For non‐vectors simply returns EltTy.

is16bitFPTy

Return true if this is a 16‐bit float type.

isAggregateType

Return true if the type is an aggregate type. This means it is valid as the first operand of an insertvalue or extractvalue instruction. This includes struct and array types, but does not include vector types.

isArrayTy

True if this is an instance of ArrayType.

isBFloatTy

Return true if this is 'bfloat', a 16‐bit bfloat type.

isByteOrByteVectorTy

isByteOrByteVectorTy overloads

isByteTy

isByteTy overloads

isDoubleTy

Return true if this is 'double', a 64‐bit IEEE fp type.

isEmptyTy

Return true if this type is empty, that is, it has no elements or all of its elements are empty.

isFP128Ty

Return true if this is 'fp128'.

isFPOrFPVectorTy

Return true if this is a FP type or a vector of FP.

isFirstClassType

Return true if the type is "first class", meaning it is a valid type for a Value.

isFloatTy

Return true if this is 'float', a 32‐bit IEEE fp type.

isFloatingPointTy

Return true if this is one of the floating‐point types

isFunctionTy

True if this is an instance of FunctionType.

isFunctionVarArg

isHalfTy

Return true if this is 'half', a 16‐bit IEEE fp type.

isIEEELikeFPTy

Return true if this is a well‐behaved IEEE‐like type, which has a IEEE compatible layout, and does not have non‐IEEE values, such as x86_fp80's unnormal values.

isIntOrIntVectorTy

isIntOrIntVectorTy overloads

isIntOrPtrTy

Return true if this is an integer type or a pointer type.

isIntegerTy

isIntegerTy overloads

isLabelTy

Return true if this is 'label'.

isMetadataTy

Return true if this is 'metadata'.

isMultiUnitFPType

Returns true if this is a floating‐point type that is an unevaluated sum of multiple floating‐point units. An example of such a type is ppc_fp128, also known as double‐double, which consists of two IEEE 754 doubles.

isPPC_FP128Ty

Return true if this is powerpc long double.

isPointerTy

True if this is an instance of PointerType.

isPtrOrPtrVectorTy

Return true if this is a pointer type or a vector of pointer types.

isRISCVVectorTupleTy

isScalableTargetExtTy

Return true if this is a target extension type with a scalable layout.

isScalableTy

Return true if this is a type whose size is a known multiple of vscale.

isSingleValueType

Return true if the type is a valid type for a register in codegen. This includes all first‐class types except struct and array types.

isSized

Return true if it makes sense to take the size of this type. To get the actual size for a particular target, it is reasonable to use the DataLayout subsystem to do this.

isStructTy

True if this is an instance of StructType.

isTargetExtTy

Return true if this is a target extension type.

isTokenLikeTy

Returns true if this is 'token' or a token‐like target type.s

isTokenTy

Return true if this is 'token'.

isVectorTy

True if this is an instance of VectorType.

isVoidTy

Return true if this is 'void'.

isX86_AMXTy

Return true if this is X86 AMX.

isX86_FP80Ty

Return true if this is x86 long double.

print

Print the current type. Omit the type details if NoDetails == true. E.g., let %st = type { i32, i16 } When NoDetails is true, we only print %st. Put differently, NoDetails prints the type as if inlined with the operands when printing an instruction.

subtype_begin

subtype_end

subtype_rbegin

subtype_rend

subtypes

Static Member Functions

Name

Description

classof

Methods for support type inquiry through isa, cast, and dyn_cast.

get

This static method is the primary way to construct an VectorType.

getBFloatTy

getByte128Ty

getByte16Ty

getByte1Ty

getByte32Ty

getByte64Ty

getByte8Ty

getByteFromIntType

Returns a byte (vector of byte) type with the same size of an integer of the given integer (vector of integer) type.

getByteNTy

getDoubleElementsVectorType

This static method returns a VectorType with twice as many elements as the input type and the same element type.

getDoubleTy

getExtendedElementVectorType

This static method is like getInteger except that the element types are twice as wide as the elements in the input type.

getFP128Ty

getFloatTy

getFloatingPointTy

getHalfElementsVectorType

This static method returns a VectorType with half as many elements as the input type and the same element type.

getHalfTy

getInt128Ty

getInt16Ty

getInt1Ty

getInt32Ty

getInt64Ty

getInt8Ty

getIntFromByteType

Returns an integer (vector of integer) type with the same size of a byte of the given byte (vector of byte) type.

getIntNTy

getInteger

This static method gets a VectorType with the same number of elements as the input type, and the element type is an integer type of the same width as the input element type.

getLabelTy

getMetadataTy

getOneNthElementsVectorType

getPPC_FP128Ty

getPrimitiveType

Return a type based on an identifier.

getScalarTy

getSubdividedVectorType

getTokenTy

getTruncatedElementVectorType

getVoidTy

getWasm_ExternrefTy

getWasm_FuncrefTy

getWithSizeAndScalar

This static method attempts to construct a VectorType with the same size‐in‐bits as SizeTy but with an element type that matches the scalar type of EltTy. The VectorType is returned on success, nullptr otherwise.

getX86_AMXTy

getX86_FP80Ty

isValidElementType

Return true if the specified type is valid as a element type.

Protected Member Functions

Protected Data Members

Name

Description

ContainedTys

A pointer to the array of Types contained by this Type. For example, this includes the arguments of a function type, the elements of a structure, the pointee of a pointer, the element type of an array, etc. This pointer may be 0 for types that don't contain other types (Integer, Double, Float).

ElementQuantity

The element quantity of this vector. The meaning of this value depends on the type of vector: ‐ For FixedVectorType = <ElementQuantity x ty>, there are exactly ElementQuantity elements in this vector. ‐ For ScalableVectorType = <vscale x ElementQuantity x ty>, there are vscale * ElementQuantity elements in this vector, where vscale is a runtime‐constant integer greater than 0.

NumContainedTys

Keeps track of how many Type*'s there are in the ContainedTys list.

Non-Member Functions

Name

Description

ComputeLinearIndex

Compute the linearized index of a member in a nested aggregate/struct/array.

canVectorizeTy

Returns true if Ty is a valid vector element type, void, or an unpacked literal struct where all elements are valid vector element types. Note: Even if a type can be vectorized that does not mean it is valid to do so in all cases. For example, a vectorized struct (as returned by toVectorizedTy) does not perform (de)interleaving, so it can't be used for vectorizing loads/stores.

getContainedTypes

Returns the types contained in Ty. For struct types, it returns the elements, all other types are returned directly.

getDeinterleavedVectorType

Given a deinterleaveN intrinsic, return the (narrow) vector type of each factor.

getLLTForType

Construct a low‐level type based on an LLVM type.

getPointersDiff

Returns the distance between the pointers PtrA and PtrB iff they are compatible and it is possible to calculate the distance between them. This is a simple API that does not depend on the analysis pass.

getVectorizedTypeVF

Returns the number of vector elements for a vectorized type.

isVectorizedTy

Returns true if Ty is a vector type or a struct of vector types where all vector types share the same VF.

simplifyGEPInst

Given operands for a GetElementPtrInst, fold the result or return null.

toScalarizedTy

A helper for converting vectorized types to scalarized (non‐vector) types. For vector types, this is equivalent to calling .getScalarType(). For struct types, this returns a new struct where each element type has been converted to a scalar type. Note: Only unpacked literal struct types are supported.

toVectorTy

A helper function for converting Scalar types to vector types. If the incoming type is void, we return void. If the EC represents a scalar, we return the scalar type.

toVectorizedTy

A helper for converting to vectorized types. For scalar types, this is equivalent to calling toVectorTy. For struct types, this returns a new struct where each element type has been widened to a vector type. Note: ‐ If the incoming type is void, we return void ‐ If EC is scalar, Ty is returned unchanged ‐ Only unpacked literal struct types are supported

AttributeFuncs::isNoFPClassCompatibleType

Returns true if this is a type legal for the 'nofpclass' attribute. This follows the same type rules as FPMathOperator.

AttributeFuncs::typeIncompatible

Which attributes cannot be applied to a type. The argument AS is used as a hint for the attributes whose compatibility is being checked against Ty. This does not mean the return will be a subset of AS, just that attributes that have specific dynamic type compatibilities (i.e range) will be checked against what is contained in AS. The argument ASK indicates, if only attributes that are known to be safely droppable are contained in the mask; only attributes that might be unsafe to drop (e.g., ABI‐related attributes) are in the mask; or both.

PatternMatch::m_SpecificType

Match a value of a specific type, capturing it if we match.

PatternMatch::m_SpecificType

Match a value of a specific type.

VNCoercion::analyzeLoadFromClobberingLoad

This function determines whether a value for the pointer LoadPtr can be extracted from the load at DepLI.

VNCoercion::analyzeLoadFromClobberingMemInst

This function determines whether a value for the pointer LoadPtr can be extracted from the memory intrinsic at DepMI.

VNCoercion::analyzeLoadFromClobberingStore

This function determines whether a value for the pointer LoadPtr can be extracted from the store at DepSI.

fuzzerop::makeConstantsWithType

@{ Populate a small list of potentially interesting constants of a given type.

hlsl::getDXILElementType

Converts a scalar or vector LLVM type to its DXIL element type. Integer signedness must be supplied separately because LLVM integer types are signless.

Derived Classes

Name

Description

FixedVectorType

Class to represent fixed width SIMD vectors

ScalableVectorType

Class to represent scalable SIMD vectors

Created with MrDocs