Types
LLVM.LLVMType — Type
LLVMTypeAbstract supertype for all LLVM types.
Properties
typ.contextThe context in which the type was created.
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.
Integer types
LLVM.IntegerType — Type
LLVM.IntegerType <: LLVMTypeType representing arbitrary bit width integers.
Properties
inttyp.widthThe bit width of the integer type.
The properties of LLVMType are available too.
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.
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.
Floating-point types
LLVM.FloatingPointType — Type
LLVM.FloatingPointType <: LLVMTypeAbstract supertype of the floating-point types, like LLVM.FloatType and LLVM.DoubleType.
LLVM.HalfType — Type
LLVM.HalfType <: LLVM.FloatingPointTypeThe 16-bit floating-point type.
LLVM.HalfType()Create the 16-bit floating-point type in the active context.
LLVM.BFloatType — Type
LLVM.BFloatType <: LLVM.FloatingPointTypeThe 16-bit “brain” floating-point type.
LLVM.BFloatType()Create the 16-bit “brain” floating-point type in the active context.
LLVM.FloatType — Type
LLVM.FloatType <: LLVM.FloatingPointTypeThe 32-bit floating-point type.
LLVM.FloatType()Create the 32-bit floating-point type in the active context.
LLVM.DoubleType — Type
LLVM.DoubleType <: LLVM.FloatingPointTypeThe 64-bit floating-point type.
LLVM.DoubleType()Create the 64-bit floating-point type in the active context.
LLVM.FP128Type — Type
LLVM.FP128Type <: LLVM.FloatingPointTypeThe 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.
LLVM.X86FP80Type — Type
LLVM.X86FP80Type <: LLVM.FloatingPointTypeThe 80-bit, X87 floating-point type.
LLVM.X86FP80Type()Create the 80-bit, X87 floating-point type in the active context.
LLVM.PPCFP128Type — Type
LLVM.PPCFP128Type <: LLVM.FloatingPointTypeThe 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.
Function types
LLVM.FunctionType — Type
LLVM.FunctionType <: LLVMTypeA function type, representing a function signature.
Properties
ft.return_typeThe return type of the function type.
ft.parametersThe 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.
LLVM.isvararg — Function
isvararg(ft::LLVM.FunctionType)Check whether the given function type is variadic.
Pointer types
LLVM.PointerType — Type
LLVM.PointerType <: LLVMTypeA pointer type.
Properties
ptrtyp.addrspaceThe address space of the pointer type.
ptrtyp.element_typeThe 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.
LLVM.isopaque — Method
isopaque(ptrtyp::LLVM.PointerType)Check whether the given pointer type is opaque.
Array types
LLVM.ArrayType — Type
LLVM.ArrayType <: LLVMTypeAn array type, representing a fixed-size array of identically-typed elements.
Properties
arrtyp.element_typeThe type of the elements of the array type.
arrtyp.lengthThe number of elements of the array type.
The properties of LLVMType are available too.
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.
Vector types
LLVM.VectorType — Type
LLVM.VectorType <: LLVMTypeA 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_typeThe type of the elements of the vector type.
vectyp.lengthThe number of elements of the vector type.
The properties of LLVMType are available too.
LLVM.ScalableVectorType — Type
LLVM.ScalableVectorType <: LLVMTypeA 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_typeThe type of the elements of the vector type.
vectyp.min_lengthThe 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.
Structure types
LLVM.StructType — Type
LLVM.StructType <: LLVMTypeA structure type, representing a collection of named fields of potentially different types.
Properties
structtyp.name
structtyp.name = name::AbstractStringThe 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.elementsThe 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.
LLVM.ispacked — Function
ispacked(structtyp::LLVM.StructType)Check whether the given structure type is packed.
LLVM.isopaque — Method
isopaque(structtyp::LLVM.StructType)Check whether the given structure type is opaque.
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.
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.
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.
LLVM.TargetExtType — Type
LLVM.TargetExtType <: LLVMTypeA 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.nameThe name of the target extension type.
typ.type_parametersThe type parameters of the target extension type.
typ.int_parametersThe integer parameters of the target extension type.
The properties of LLVMType are available too.
Other types
LLVM.VoidType — Type
LLVM.VoidType <: LLVMTypeA void type, representing the absence of a value.
LLVM.LabelType — Type
LLVM.LabelType <: LLVMTypeA label type, representing a code label.
LLVM.MetadataType — Type
LLVM.MetadataType <: LLVMTypeA metadata type, representing a metadata value.
LLVM.TokenType — Type
LLVM.TokenType <: LLVMTypeA token type, representing a token value.
LLVM.X86AMXType — Type
LLVM.X86AMXType <: LLVMTypeThe x86_amx type, representing a tile of the x86 Advanced Matrix Extensions.
LLVM.X86AMXType()Create the x86_amx type in the active context.
LLVM.X86MMXType (LLVM 19 and earlier):
LLVM.X86MMXType — Type
LLVM.X86MMXType <: LLVMTypeThe 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.