Class to represent integer types.

Synopsis

Declared in <llvm/IR/DerivedTypes.h>

class IntegerType
    : public Type

Description

Note that this class is also used to represent the built‐in integer types: Int1Ty, Int8Ty, Int16Ty, Int32Ty and Int64Ty.

Base Classes

Name

Description

Type

The root of the LLVM type system hierarchy.

Type Aliases

Name

Description

subtype_iterator

Iterator over this type's contained (subtype) types.

subtype_reverse_iterator

Reverse iterator over contained (subtype) types.

Enums

Name

Description

Unnamed enum

This enum is just used to hold constants we need for IntegerType.

TypeID

Identifiers for all base types in the LLVM type system.

Member Functions

Name

Description

canLosslesslyBitCastTo

Return true if this type could be converted with a lossless 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

Dump this type to stderr for debugging.

getArrayElementType

Return the element type of this array type.

getArrayNumElements

Return the number of elements in this array type.

getBitMask

Return a bitmask with ones set for all of the bits that can be set by an unsigned version of this type. This is 0xFF for i8, 0xFFFF for i16, etc.

getBitWidth

Get the number of bits in this IntegerType.

getByteBitWidth

Return the bit width of this byte type (or of its scalar element).

getContainedType

Return the type contained at index i in this derived type.

getContext

Return the LLVMContext in which this type was uniqued.

getExtendedType

Returns type twice as wide the input type.

getFPMantissaWidth

Return the width of the mantissa of this floating‐point type.

getFltSemantics

Return the floating‐point semantics for this floating‐point type.

getFunctionNumParams

Return the number of fixed parameters of this function type.

getFunctionParamType

Return the type of formal parameter i of this function type.

getIntegerBitWidth

Return the bit width of this integer type.

getMask

For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.

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.

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'.

getSignBit

Return a uint64_t with just the most significant bit set (the sign bit, if the value is treated as a signed number).

getStructElementType

Return the type of element N in this struct type.

getStructName

Return the name of this identified struct type.

getStructNumElements

Return the number of elements in this struct type.

getTargetExtName

Return the name of this target extension type.

getTruncatedType

Returns type half as wide the input type.

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.

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

Return true if this function type is variadic.

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

Return true if this is a multi‐unit floating‐point type.

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

True if this is an instance of TargetExtType of RISC‐V vector tuple.

isScalableTargetExtTy

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

isScalableTy

isScalableTy overloads

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.

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.

subtype_begin

Iterator to the first contained (subtype) type.

subtype_end

Iterator past the last contained (subtype) type.

subtype_rbegin

Reverse iterator to the last contained (subtype) type.

subtype_rend

Reverse iterator past the first contained (subtype) type.

subtypes

Return an array view of this type's contained subtypes.

Static Member Functions

Name

Description

classof

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

get

Get or create an IntegerType instance.

getBFloatTy

Return the bfloat (16‐bit) floating‐point type.

getByte128Ty

Return the 128‐bit byte type.

getByte16Ty

Return the 16‐bit byte type for the given context.

getByte1Ty

Return the 1‐bit byte type.

getByte32Ty

Return the 32‐bit byte type for the given context.

getByte64Ty

Return the 64‐bit byte type.

getByte8Ty

Return the 8‐bit byte type.

getByteFromIntType

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

getByteNTy

Return a byte type with bit width N.

getDoubleTy

Return the IEEE double‐precision (64‐bit) floating‐point type.

getFP128Ty

Return the 128‐bit IEEE floating‐point type (fp128).

getFloatTy

Return the IEEE single‐precision (32‐bit) floating‐point type.

getFloatingPointTy

Return the floating‐point type matching semantics S.

getHalfTy

Return the IEEE half‐precision (16‐bit) floating‐point type.

getInt128Ty

Return the 128‐bit integer type.

getInt16Ty

Return the 16‐bit integer type.

getInt1Ty

Return the 1‐bit integer type.

getInt32Ty

Return the 32‐bit integer type.

getInt64Ty

Return the 64‐bit integer type.

getInt8Ty

Return the 8‐bit integer type.

getIntFromByteType

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

getIntNTy

Return an integer type with bit width N.

getLabelTy

Return the label type.

getMetadataTy

Return the metadata type used for metadata operands in the IR.

getPPC_FP128Ty

Return the PowerPC double‐double (ppc_fp128) floating‐point type.

getPrimitiveType

Return a type based on an identifier.

getScalarTy

Return the LLVM scalar type corresponding to a C++ scalar type ScalarTy.

getTokenTy

Return the token type.

getVoidTy

Return the void type.

getWasm_ExternrefTy

Return the WebAssembly externref target‐extension type.

getWasm_FuncrefTy

Return the WebAssembly funcref target‐extension type.

getX86_AMXTy

Return the X86 AMX type for the given context.

getX86_FP80Ty

Return the x86 80‐bit extended‐precision floating‐point type.

Protected Member Functions

Name

Description

IntegerType [constructor]

Construct an integer type with bit width NumBits in context C.

getSubclassData

Return the subclass‐specific data packed into this type.

setSubclassData

Store subclass‐specific data into this type's SubclassData field.

Protected Data Members

Name

Description

ContainedTys

Pointer to the array of Types contained by this Type.

NumContainedTys

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

Friends

Name

Description

llvm::LLVMContextImpl

Private implementation details of LLVMContext.

Non-Member Functions

Name

Description

ComputeLinearIndex

Compute the linearized index of a member in a nested aggregate.

ComputeLinearIndex

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

ConstantFoldGetElementPtr

Attempt to constant fold a getelementptr instruction with the specified operands.

canVectorizeTy

Returns true if Ty can be used as a vector element or vectorized struct.

checkGEPType

Return Ty after asserting it is a valid GEP index result type.

gep_type_begin

Return a begin iterator over GEP indices from type Op0 and operands A.

gep_type_end

Return an end iterator for GEP indices from operands A.

getContainedTypes

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

getLLTForType

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

getPointersDiff

Returns the distance between compatible pointers PtrA and PtrB.

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

Convert a vectorized type to its scalarized (non‐vector) form.

toVectorTy

Convert a scalar type to a vector type.

toVectorTy

Convert a scalar type to a fixed‐length vector type.

toVectorizedTy

Convert a scalar or struct type to its vectorized form.

wrap

C API conversion helpers for Type / LLVMTypeRef, including typed unwrap.

wrap

Wrap an array of Type pointers for the C API.

AttributeFuncs::isNoFPClassCompatibleType

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

AttributeFuncs::typeIncompatible

Return the mask of attributes incompatible with type Ty.

PatternMatch::m_SpecificType

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

PatternMatch::m_SpecificType

Match any value of a specific type.

PatternMatch::m_SpecificType

Match a const 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.

fuzzerop::makeConstantsWithType

Return 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.

Created with MrDocs