On this page:
5.1 Integer Constants
llvm-const-int
llvm-const-int-of-string
llvm-const-int-get-s-ext-value
llvm-const-int-get-z-ext-value
5.2 Floating-Point Constants
llvm-const-real
llvm-const-real-of-string
5.3 Composite Constants
llvm-const-struct
llvm-const-named-struct
llvm-const-array
llvm-const-array2
llvm-const-vector
5.4 Special Constants
llvm-const-null
llvm-const-all-ones
llvm-const-pointer-null
llvm-get-undef
llvm-get-poison
5.5 Constant Expressions
llvm-const-gep2
llvm-const-in-bounds-gep2
9.0

5 Constants🔗ℹ

Functions for creating constant values in LLVM IR.

5.1 Integer Constants🔗ℹ

procedure

(llvm-const-int type value [sign-extend])  LLVMValueRef?

  type : LLVMTypeRef?
  value : exact-nonnegative-integer?
  sign-extend : boolean? = #f
Creates a constant integer of the given type with value. If sign-extend is true, the value is sign-extended to the type’s width.

procedure

(llvm-const-int-of-string type text radix)  LLVMValueRef?

  type : LLVMTypeRef?
  text : string?
  radix : exact-nonnegative-integer?
Creates a constant integer by parsing text in the given radix (e.g., 10 for decimal, 16 for hex).

procedure

(llvm-const-int-get-s-ext-value const-val)  integer?

  const-val : LLVMValueRef?
Returns the sign-extended value of a constant integer.

procedure

(llvm-const-int-get-z-ext-value const-val)

  exact-nonnegative-integer?
  const-val : LLVMValueRef?
Returns the zero-extended value of a constant integer.

5.2 Floating-Point Constants🔗ℹ

procedure

(llvm-const-real type value)  LLVMValueRef?

  type : LLVMTypeRef?
  value : number?
Creates a constant floating-point value of the given type.

procedure

(llvm-const-real-of-string type text)  LLVMValueRef?

  type : LLVMTypeRef?
  text : string?
Creates a constant floating-point value by parsing text.

5.3 Composite Constants🔗ℹ

procedure

(llvm-const-struct constant-vals [packed?])  LLVMValueRef?

  constant-vals : (listof LLVMValueRef?)
  packed? : boolean? = #f
Creates a constant struct with the given values. If packed? is true, the struct has no padding.

procedure

(llvm-const-named-struct struct-ty    
  constant-vals)  LLVMValueRef?
  struct-ty : LLVMTypeRef?
  constant-vals : (listof LLVMValueRef?)
Creates a constant value of a named struct type with the given field values.

procedure

(llvm-const-array element-ty constant-vals)  LLVMValueRef?

  element-ty : LLVMTypeRef?
  constant-vals : (listof LLVMValueRef?)
Creates a constant array of the given element type with the given values.

procedure

(llvm-const-array2 element-ty    
  constant-vals)  LLVMValueRef?
  element-ty : LLVMTypeRef?
  constant-vals : (listof LLVMValueRef?)
Creates a constant array (64-bit length variant) of the given element type with the given values.

procedure

(llvm-const-vector scalar-constant-vals)  LLVMValueRef?

  scalar-constant-vals : (listof LLVMValueRef?)
Creates a constant vector with the given scalar values.

5.4 Special Constants🔗ℹ

procedure

(llvm-const-null type)  LLVMValueRef?

  type : LLVMTypeRef?
Creates a null constant of the given type.

procedure

(llvm-const-all-ones type)  LLVMValueRef?

  type : LLVMTypeRef?
Creates a constant with all bits set for the given type.

procedure

(llvm-const-pointer-null type)  LLVMValueRef?

  type : LLVMTypeRef?
Creates a null pointer constant of the given pointer type.

procedure

(llvm-get-undef type)  LLVMValueRef?

  type : LLVMTypeRef?
Creates an undefined value of the given type.

procedure

(llvm-get-poison type)  LLVMValueRef?

  type : LLVMTypeRef?
Creates a poison value of the given type.

5.5 Constant Expressions🔗ℹ

procedure

(llvm-const-gep2 ty    
  constant-val    
  constant-indices)  LLVMValueRef?
  ty : LLVMTypeRef?
  constant-val : LLVMValueRef?
  constant-indices : (listof LLVMValueRef?)
Creates a constant GEP (Get Element Pointer) expression.

procedure

(llvm-const-in-bounds-gep2 ty    
  constant-val    
  constant-indices)  LLVMValueRef?
  ty : LLVMTypeRef?
  constant-val : LLVMValueRef?
  constant-indices : (listof LLVMValueRef?)
Creates a constant in-bounds GEP expression.