On this page:
2.1 Integer Types
llvm-int1-type
llvm-int8-type
llvm-int16-type
llvm-int32-type
llvm-int64-type
llvm-int128-type
llvm-int-type
2.2 Floating-Point Types
llvm-half-type
llvm-float-type
llvm-double-type
2.3 Other Scalar Types
llvm-void-type
llvm-label-type
2.4 Composite Types
llvm-function-type
llvm-pointer-type
llvm-array-type
llvm-vector-type
llvm-struct-type
llvm-struct-create-named
llvm-struct-set-body
llvm-add-struct-type
2.5 Type Queries
llvm-get-int-type-width
llvm-get-return-type
llvm-count-param-types
llvm-is-function-var-arg
llvm-get-element-type
llvm-get-array-length2
llvm-get-vector-size
llvm-print-type-to-string
9.0

2 Types🔗ℹ

LLVM types represent the type system of the intermediate representation. Every value in LLVM IR has a type.

2.1 Integer Types🔗ℹ

procedure

(llvm-int1-type)  LLVMTypeRef?

Creates an i1 (boolean) type.

procedure

(llvm-int8-type)  LLVMTypeRef?

Creates an i8 type.

procedure

(llvm-int16-type)  LLVMTypeRef?

Creates an i16 type.

procedure

(llvm-int32-type)  LLVMTypeRef?

Creates an i32 type.

procedure

(llvm-int64-type)  LLVMTypeRef?

Creates an i64 type.
Creates an i128 type.

procedure

(llvm-int-type num-bits)  LLVMTypeRef?

  num-bits : exact-nonnegative-integer?
Creates an integer type with the given bit width.

2.2 Floating-Point Types🔗ℹ

procedure

(llvm-half-type)  LLVMTypeRef?

Creates a 16-bit floating-point type (IEEE 754 half).

procedure

(llvm-float-type)  LLVMTypeRef?

Creates a 32-bit floating-point type (IEEE 754 single).
Creates a 64-bit floating-point type (IEEE 754 double).

2.3 Other Scalar Types🔗ℹ

procedure

(llvm-void-type)  LLVMTypeRef?

Creates the void type, used for functions that return nothing.

procedure

(llvm-label-type)  LLVMTypeRef?

Creates the label type, used for basic block addresses.

2.4 Composite Types🔗ℹ

procedure

(llvm-function-type return-type    
  [param-types    
  variadic?])  LLVMTypeRef?
  return-type : LLVMTypeRef?
  param-types : (listof LLVMTypeRef?) = '()
  variadic? : boolean? = #f
Creates a function type. return-type is the return type, param-types is a list of parameter types, and variadic? indicates whether the function accepts variable arguments.

procedure

(llvm-pointer-type type [address-space])  LLVMTypeRef?

  type : LLVMTypeRef?
  address-space : exact-nonnegative-integer? = 0
Creates a pointer type pointing to type in the given address-space.

procedure

(llvm-array-type element-type count)  LLVMTypeRef?

  element-type : LLVMTypeRef?
  count : exact-nonnegative-integer?
Creates an array type of count elements of element-type.

procedure

(llvm-vector-type element-type count)  LLVMTypeRef?

  element-type : LLVMTypeRef?
  count : exact-nonnegative-integer?
Creates a fixed-size vector type of count elements of element-type.

procedure

(llvm-struct-type element-types [packed?])  LLVMTypeRef?

  element-types : (listof LLVMTypeRef?)
  packed? : boolean? = #f
Creates a literal (anonymous) struct type with the given element types. If packed? is true, the struct has no padding between elements.

procedure

(llvm-struct-create-named context name)  LLVMTypeRef?

  context : LLVMContextRef?
  name : string?
Creates a named struct type in the given context. Use llvm-struct-set-body to define its fields.

procedure

(llvm-struct-set-body struct-type    
  [element-types    
  pack?])  void?
  struct-type : LLVMTypeRef?
  element-types : (listof LLVMTypeRef?) = (list)
  pack? : boolean? = #f
Sets the body of a named struct type created with llvm-struct-create-named.

procedure

(llvm-add-struct-type mod    
  element-types    
  [pack?])  LLVMTypeRef?
  mod : LLVMModuleRef?
  element-types : (listof LLVMTypeRef?)
  pack? : boolean? = #f
Convenience function that creates a named struct in the module’s context and sets its body in one step.

2.5 Type Queries🔗ℹ

Returns the bit width of an integer type.

procedure

(llvm-get-return-type function-type)  LLVMTypeRef?

  function-type : LLVMTypeRef?
Returns the return type of a function type.

procedure

(llvm-count-param-types function-type)

  exact-nonnegative-integer?
  function-type : LLVMTypeRef?
Returns the number of parameter types in a function type.

procedure

(llvm-is-function-var-arg function-type)  boolean?

  function-type : LLVMTypeRef?
Returns whether a function type is variadic.

procedure

(llvm-get-element-type type)  LLVMTypeRef?

  type : LLVMTypeRef?
Returns the element type of an array, vector, or pointer type.
Returns the length of an array type.
Returns the number of elements in a vector type.

procedure

(llvm-print-type-to-string type)  string?

  type : LLVMTypeRef?
Returns the string representation of a type.