Types

LLVM.LLVMType — Type
LLVMType

Abstract supertype for all LLVM types.

Properties

typ.context

The context in which the type was created.

source
LLVM.issized — Function
issized(typ::LLVMType)

Return true if it makes sense to take the size of this type.

Note that this does not mean that it's possible to call sizeof on this type, as LLVM types sizes can only queried given a target data layout.

See also: LLVM.bit_size.

source

Integer types

LLVM.IntegerType — Type
LLVM.IntegerType <: LLVMType

Type representing arbitrary bit width integers.

Properties

inttyp.width

The bit width of the integer type.

The properties of LLVMType are available too.

source
LLVM.IntType — Function
LLVM.IntType(bits::Integer)

Create an integer type with the given bits width.

Short-hand constructors are available for common widths: LLVM.Int1Type, LLVM.Int8Type, LLVM.Int16Type, LLVM.Int32Type, LLVM.Int64Type, and LLVM.Int128Type.

source
LLVM.ByteType — Type
LLVM.ByteType(bits::Integer)

An arbitrary-width byte type, which holds uninterpreted bits. Requires LLVM 23+.

Its width property gives the bit width.

source

Floating-point types

LLVM.HalfType — Type
LLVM.HalfType <: LLVM.FloatingPointType

The 16-bit floating-point type.

LLVM.HalfType()

Create the 16-bit floating-point type in the active context.

source
LLVM.BFloatType — Type
LLVM.BFloatType <: LLVM.FloatingPointType

The 16-bit “brain” floating-point type.

LLVM.BFloatType()

Create the 16-bit “brain” floating-point type in the active context.

source
LLVM.FloatType — Type
LLVM.FloatType <: LLVM.FloatingPointType

The 32-bit floating-point type.

LLVM.FloatType()

Create the 32-bit floating-point type in the active context.

source
LLVM.DoubleType — Type
LLVM.DoubleType <: LLVM.FloatingPointType

The 64-bit floating-point type.

LLVM.DoubleType()

Create the 64-bit floating-point type in the active context.

source
LLVM.FP128Type — Type
LLVM.FP128Type <: LLVM.FloatingPointType

The 128-bit floating-point type, with a 113-bit significand.

LLVM.FP128Type()

Create the 128-bit floating-point type, with a 113-bit significand in the active context.

source
LLVM.X86FP80Type — Type
LLVM.X86FP80Type <: LLVM.FloatingPointType

The 80-bit, X87 floating-point type.

LLVM.X86FP80Type()

Create the 80-bit, X87 floating-point type in the active context.

source
LLVM.PPCFP128Type — Type
LLVM.PPCFP128Type <: LLVM.FloatingPointType

The 128-bit floating-point type, consisting of two 64-bit values.

LLVM.PPCFP128Type()

Create the 128-bit floating-point type, consisting of two 64-bit values in the active context.

source

Function types

LLVM.FunctionType — Type
LLVM.FunctionType <: LLVMType

A function type, representing a function signature.

Properties

ft.return_type

The return type of the function type.

ft.parameters

The parameter types of the function type, as a read-only view. Types are uniqued and cannot be changed, so create a new function type instead.

The properties of LLVMType are available too.

source
LLVM.isvararg — Function
isvararg(ft::LLVM.FunctionType)

Check whether the given function type is variadic.

source

Pointer types

LLVM.PointerType — Type
LLVM.PointerType <: LLVMType

A pointer type.

Properties

ptrtyp.addrspace

The address space of the pointer type.

ptrtyp.element_type

The type that a typed pointer points to, or nothing for an opaque pointer. Only available before LLVM 17, which removed typed pointers.

The properties of LLVMType are available too.

source
LLVM.isopaque — Method
isopaque(ptrtyp::LLVM.PointerType)

Check whether the given pointer type is opaque.

source

Array types

LLVM.ArrayType — Type
LLVM.ArrayType <: LLVMType

An array type, representing a fixed-size array of identically-typed elements.

Properties

arrtyp.element_type

The type of the elements of the array type.

arrtyp.length

The number of elements of the array type.

The properties of LLVMType are available too.

source
LLVM.isemptytype — Function
isemptytype(typ::LLVMType)

Check whether the given type is empty, i.e., has no elements, or only empty elements, like C++'s Type::isEmptyTy. For example, {}, [0 x i32] and [4 x {}] are empty types.

source

Vector types

LLVM.VectorType — Type
LLVM.VectorType <: LLVMType

A vector type, representing a fixed-size vector of identically-typed elements. Typically used for SIMD operations. See ScalableVectorType for vectors whose size is only known at run time.

Properties

vectyp.element_type

The type of the elements of the vector type.

vectyp.length

The number of elements of the vector type.

The properties of LLVMType are available too.

source
LLVM.ScalableVectorType — Type
LLVM.ScalableVectorType <: LLVMType

A scalable vector type, representing a vector of identically-typed elements whose number is a multiple of a minimum number, the multiple (vscale) being a constant that is only known at run time (e.g., <vscale x 4 x i32>). Used for scalable SIMD extensions like SVE or the RISC-V vector extension.

Properties

vectyp.element_type

The type of the elements of the vector type.

vectyp.min_length

The minimum number of elements of the vector type, i.e., the number of elements when vscale is 1.

The properties of LLVMType are available too.

source

Structure types

LLVM.StructType — Type
LLVM.StructType <: LLVMType

A structure type, representing a collection of named fields of potentially different types.

Properties

structtyp.name
structtyp.name = name::AbstractString

The name of the structure type, or nothing if it is a literal (unnamed) structure. Identified structure types can be renamed by assigning a new name; if another type has that name already, a suffix is added to make it unique.

structtyp.elements

The element types of the structure type, as a read-only view. Use elements! to set the body of an opaque structure type.

The properties of LLVMType are available too.

source
LLVM.ispacked — Function
ispacked(structtyp::LLVM.StructType)

Check whether the given structure type is packed.

source
LLVM.isopaque — Method
isopaque(structtyp::LLVM.StructType)

Check whether the given structure type is opaque.

source
LLVM.isliteral — Function
isliteral(structtyp::LLVM.StructType)

Check whether the given structure type is a literal one, i.e., one that is identified by its elements (like { i32, ptr }), as opposed to an identified one that is created with a name (like %T = type { i32, ptr }, or an unnamed one like %0), which can be opaque.

source
LLVM.elements! — Function
elements!(structtyp::LLVM.StructType, elems::AbstractVector{<:LLVMType}; packed=false)

Set the body of the given structure type, i.e., its elements elems and whether it is packed (without padding between fields). This is typically used to define an opaque, named structure type.

See also the elements property.

source

Target extension types

Available with LLVM 16 and later.

LLVM.TargetExtType — Type
LLVM.TargetExtType(name::AbstractString, types::LLVMType[]=[], ints::Integer[]=[])

Create a target extension type with the given name, types type parameters and ints integer parameters.

source
LLVM.TargetExtType — Type
LLVM.TargetExtType <: LLVMType

A target extension type, representing a type that is only meaningful to a specific target, e.g., target("spirv.Image", void, 0, 0, 0, 0, 0, 0, 0). It is identified by a name, a list of type parameters and a list of integer parameters, and is opaque to the rest of LLVM. Requires LLVM 16+.

Properties

typ.name

The name of the target extension type.

typ.type_parameters

The type parameters of the target extension type.

typ.int_parameters

The integer parameters of the target extension type.

The properties of LLVMType are available too.

source

Other types

LLVM.VoidType — Type
LLVM.VoidType <: LLVMType

A void type, representing the absence of a value.

source
LLVM.X86AMXType — Type
LLVM.X86AMXType <: LLVMType

The x86_amx type, representing a tile of the x86 Advanced Matrix Extensions.

LLVM.X86AMXType()

Create the x86_amx type in the active context.

source

LLVM.X86MMXType (LLVM 19 and earlier):

LLVM.X86MMXType — Type
LLVM.X86MMXType <: LLVMType

The x86_mmx type, representing a value in an x86 MMX register. Only available before LLVM 20, which removed this type in favor of <1 x i64>.

LLVM.X86MMXType()

Create the x86_mmx type in the active context.

source