Values

General APIs

LLVM.contextMethod
context(val::LLVM.Value)

Return the context in which the given value was created.

source
LLVM.name!Method
name!(val::Value, name::String)

Set the name of the given value.

source
LLVM.isundefFunction
isundef(val::LLVM.Value)

Check if the given value is an undef value.

source
LLVM.ispoisonFunction
ispoison(val::LLVM.Value)

Check if the given value is a poison value.

source
LLVM.isnullFunction
isnull(val::LLVM.Value)

Check if the given value is a null constant.

source

User values

LLVM.operandsMethod
operands(user::LLVM.User)

Get an iterator over the operands of the given user.

source

Constant values

LLVM.ConstantType
LLVM.Constant <: LLVM.User

Abstract supertype for all constant values.

source
LLVM.nullFunction
null(typ::LLVMType)

Create a null constant of the given type.

source
LLVM.all_onesFunction
all_ones(typ::LLVMType)

Create a constant with all bits set to one of the given type.

source
Base.convertMethod
convert(::Type{<:Integer}, val::ConstantInt)

Convert a constant integer value back to a Julia integer.

source
Base.convertMethod
convert(::Type{<:AbstractFloat}, val::ConstantFP)

Convert a constant floating point value back to a Julia floating point number.

source
LLVM.ConstantDataArrayType
ConstantDataArray <: LLVM.ConstantDataSequential

A constant array of simple data values, i.e., whose element type is a simple 1/2/4/8-byte integer or half/bfloat/float/double, and whose elements are just simple data values

See also: ConstantArray

source
LLVM.ConstantDataArrayMethod
ConstantDataArray(typ::LLVMType, data::AbstractVector)

Create a constant array of simple data values of the given type and data.

Warning

The memory layout of the data array must match the expected layout of the LLVM type.

source
LLVM.ConstantDataArrayMethod
ConstantDataArray(data::AbstractVector)

Create a constant array of simple data values from a Julia vector.

source
LLVM.ConstantDataVectorType
ConstantDataVector <: LLVM.ConstantDataSequential

A constant vector of simple data values, i.e., whose element type is a simple 1/2/4/8-byte integer or half/bfloat/float/double, and whose elements are just simple data values

source
LLVM.ConstantArrayType
ConstantArray <: LLVM.ConstantAggregate

A constant array of values.

This type implements the Julia array interface, so (to some extent) it can be used as a regular Julia array.

source
LLVM.ConstantArrayMethod
ConstantArray(typ::LLVMType, data::AbstractArray)

Create a constant array of values of the given type and data.

Note

When using simple data types, this constructor can also return a ConstantDataArray.

source
LLVM.ConstantArrayMethod
ConstantArray(data::AbstractArray)

Create a constant array of values from a Julia array, using the appropriate constant type.

source
Base.collectMethod
collect(ca::ConstantArray)

Convert a constant array back to a Julia array.

source
LLVM.ConstantExprType
LLVM.ConstantExpr <: LLVM.Constant

A constant value that is initialized with an expression using other constant values.

Constant expressions are created using const_-prefixed functions, which correspond to the LLVM IR instructions: const_neg, const_not, etc.

source

Global values

LLVM.global_value_typeFunction
global_value_type(val::LLVM.GlobalValue)

Get the type of the global value.

This differs from value_type in that it returns the type of the contained value, not the type of the global value itself which is always a pointer type.

source
LLVM.parentMethod
parent(val::LLVM.GlobalValue)

Get the parent module of the global value.

source
LLVM.isdeclarationFunction
isdeclaration(val::LLVM.GlobalValue)

Check if the global value is a declaration, i.e. it does not have a definition.

source
LLVM.linkageFunction
linkage(val::LLVM.GlobalValue)

Get the linkage of the global value.

source
LLVM.linkage!Function
linkage!(val::LLVM.GlobalValue, linkage::LLVM.LLVMLinkage)

Set the linkage of the global value.

source
LLVM.sectionFunction
section(val::LLVM.GlobalValue)

Get the section of the global value.

source
LLVM.section!Function
section!(val::LLVM.GlobalValue, sec::String)

Set the section of the global value.

source
LLVM.visibilityFunction
visibility(val::LLVM.GlobalValue)

Get the visibility of the global value.

source
LLVM.visibility!Function
visibility!(val::LLVM.GlobalValue, viz::LLVM.LLVMVisibility)

Set the visibility of the global value.

source
LLVM.dllstorageFunction
dllstorage(val::LLVM.GlobalValue)

Get the DLL storage class of the global value.

source
LLVM.dllstorage!Function
dllstorage!(val::LLVM.GlobalValue, storage::LLVM.LLVMDLLStorageClass)

Set the DLL storage class of the global value.

source
LLVM.unnamed_addrFunction
unnamed_addr(val::LLVM.GlobalValue)

Check if the global value has the unnamed address flag set.

source
LLVM.unnamed_addr!Function
unnamed_addr!(val::LLVM.GlobalValue, flag::Bool)

Set the unnamed address flag of the global value.

source
LLVM.alignmentMethod
alignment(val::LLVM.GlobalValue)

Get the alignment of the global value.

source
LLVM.alignment!Method
alignment!(val::LLVM.GlobalValue, bytes::Integer)

Set the alignment of the global value.

source

Global variables

Global variables are a specific kind of global values, and have additional APIs:

LLVM.erase!Method
erase!(gv::GlobalVariable)

Remove the global variable from its parent module and delete it.

Warning

This function is unsafe as it does not check if the global variable is still used elsewhere.

source
LLVM.initializer!Function
initializer!(gv::GlobalVariable, val::Constant)

Set the initializer of the global variable. Setting the value to nothing removes the current initializer.

source
LLVM.threadlocal!Function
threadlocal!(gv::GlobalVariable, flag::Bool)

Set the thread-local flag of the global variable.

source
LLVM.threadlocalmode!Function
threadlocalmode!(gv::GlobalVariable, mode::LLVM.LLVMThreadLocalMode)

Set the thread-local mode of the global variable.

source
LLVM.isconstantMethod
isconstant(gv::GlobalVariable)

Check if the global variable is a global constant, i.e., its value is immutable throughout the runtime execution of the program.

source
LLVM.constant!Function
constant!(gv::GlobalVariable, flag::Bool)

Set the constant flag of the global variable.

source
LLVM.isextinitFunction
isextinit(gv::GlobalVariable)

Check if the global variable is externally initialized.

source
LLVM.extinit!Function
extinit!(gv::GlobalVariable, flag::Bool)

Set the externally initialized flag of the global variable.

source

Uses

LLVM.replace_uses!Function
replace_uses!(old::LLVM.Value, new::LLVM.Value)

Replace all uses of an old value in the IR with new.

This does not replace uses in metadata, which must be done separately with replace_metadata_uses!.

source
LLVM.usesFunction
uses(val::LLVM.Value)

Get an iterator over the uses of the given value.

See also: LLVM.Use.

source
LLVM.UseType
LLVM.Use

A use of a value in the IR. Knows both the user and the used value.

See also: user, value.

source
LLVM.userFunction
user(use::LLVM.Use)

Get the user of the given use.

source
LLVM.valueFunction
value(use::LLVM.Use)

Get the used value of the given use.

source