Values
General APIs
LLVM.Value
— TypeLLVM.Value
Abstract type representing an LLVM value.
LLVM.value_type
— Functionvalue_type(val::Value)
Get the type of the given value.
LLVM.context
— Methodcontext(val::LLVM.Value)
Return the context in which the given value was created.
LLVM.name
— Methodname(val::Value)
Get the name of the given value.
LLVM.name!
— Methodname!(val::Value, name::String)
Set the name of the given value.
LLVM.isconstant
— Methodisconstant(val::LLVM.Value)
Check if the given value is a constant value.
LLVM.isundef
— Functionisundef(val::LLVM.Value)
Check if the given value is an undef value.
LLVM.ispoison
— Functionispoison(val::LLVM.Value)
Check if the given value is a poison value.
LLVM.isnull
— Functionisnull(val::LLVM.Value)
Check if the given value is a null constant.
User values
LLVM.User
— TypeLLVM.operands
— Methodoperands(user::LLVM.User)
Get an iterator over the operands of the given user.
Constant values
LLVM.Constant
— TypeLLVM.Constant <: LLVM.User
Abstract supertype for all constant values.
LLVM.null
— Functionnull(typ::LLVMType)
Create a null constant of the given type.
LLVM.all_ones
— Functionall_ones(typ::LLVMType)
Create a constant with all bits set to one of the given type.
LLVM.PointerNull
— TypePointerNull <: LLVM.ConstantData
A null pointer constant.
LLVM.UndefValue
— TypeUndefValue <: LLVM.ConstantData
An undefined constant value.
LLVM.PoisonValue
— TypePoisonValue <: LLVM.ConstantData
A poison constant value.
LLVM.ConstantInt
— TypeConstantInt <: LLVM.ConstantData
A constant integer value.
Base.convert
— Methodconvert(::Type{<:Integer}, val::ConstantInt)
Convert a constant integer value back to a Julia integer.
LLVM.ConstantFP
— TypeConstantFP <: LLVM.ConstantData
A constant floating point value.
Base.convert
— Methodconvert(::Type{<:AbstractFloat}, val::ConstantFP)
Convert a constant floating point value back to a Julia floating point number.
LLVM.ConstantStruct
— TypeConstantStruct <: LLVM.ConstantAggregate
A constant struct of values.
LLVM.ConstantDataArray
— TypeConstantDataArray <: 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
LLVM.ConstantDataArray
— MethodConstantDataArray(typ::LLVMType, data::AbstractVector)
Create a constant array of simple data values of the given type and data.
The memory layout of the data array must match the expected layout of the LLVM type.
LLVM.ConstantDataArray
— MethodConstantDataArray(data::AbstractVector)
Create a constant array of simple data values from a Julia vector.
LLVM.ConstantDataVector
— TypeConstantDataVector <: 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
LLVM.ConstantArray
— TypeConstantArray <: 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.
LLVM.ConstantArray
— MethodConstantArray(typ::LLVMType, data::AbstractArray)
Create a constant array of values of the given type and data.
When using simple data types, this constructor can also return a ConstantDataArray
.
LLVM.ConstantArray
— MethodConstantArray(data::AbstractArray)
Create a constant array of values from a Julia array, using the appropriate constant type.
Base.collect
— Methodcollect(ca::ConstantArray)
Convert a constant array back to a Julia array.
LLVM.InlineAsm
— TypeInlineAsm <: LLVM.Constant
A constant inline assembly block.
LLVM.ConstantExpr
— TypeLLVM.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.
Global values
LLVM.GlobalValue
— TypeLLVM.GlobalValue <: LLVM.Constant
Abstract supertype for all global values.
LLVM.global_value_type
— Functionglobal_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.
LLVM.parent
— Methodparent(val::LLVM.GlobalValue)
Get the parent module of the global value.
LLVM.isdeclaration
— Functionisdeclaration(val::LLVM.GlobalValue)
Check if the global value is a declaration, i.e. it does not have a definition.
LLVM.linkage
— Functionlinkage(val::LLVM.GlobalValue)
Get the linkage of the global value.
LLVM.linkage!
— Functionlinkage!(val::LLVM.GlobalValue, linkage::LLVM.LLVMLinkage)
Set the linkage of the global value.
LLVM.section
— Functionsection(val::LLVM.GlobalValue)
Get the section of the global value.
LLVM.section!
— Functionsection!(val::LLVM.GlobalValue, sec::String)
Set the section of the global value.
LLVM.visibility
— Functionvisibility(val::LLVM.GlobalValue)
Get the visibility of the global value.
LLVM.visibility!
— Functionvisibility!(val::LLVM.GlobalValue, viz::LLVM.LLVMVisibility)
Set the visibility of the global value.
LLVM.dllstorage
— Functiondllstorage(val::LLVM.GlobalValue)
Get the DLL storage class of the global value.
LLVM.dllstorage!
— Functiondllstorage!(val::LLVM.GlobalValue, storage::LLVM.LLVMDLLStorageClass)
Set the DLL storage class of the global value.
LLVM.unnamed_addr
— Functionunnamed_addr(val::LLVM.GlobalValue)
Check if the global value has the unnamed address flag set.
LLVM.unnamed_addr!
— Functionunnamed_addr!(val::LLVM.GlobalValue, flag::Bool)
Set the unnamed address flag of the global value.
LLVM.alignment
— Methodalignment(val::LLVM.GlobalValue)
Get the alignment of the global value.
LLVM.alignment!
— Methodalignment!(val::LLVM.GlobalValue, bytes::Integer)
Set the alignment of the global value.
Global variables
Global variables are a specific kind of global values, and have additional APIs:
LLVM.GlobalVariable
— TypeGlobalVariable <: LLVM.GlobalObject
A global variable.
LLVM.erase!
— Methoderase!(gv::GlobalVariable)
Remove the global variable from its parent module and delete it.
This function is unsafe as it does not check if the global variable is still used elsewhere.
LLVM.initializer
— Functioninitializer(gv::GlobalVariable)
Get the initializer of the global variable.
LLVM.initializer!
— Functioninitializer!(gv::GlobalVariable, val::Constant)
Set the initializer of the global variable. Setting the value to nothing
removes the current initializer.
LLVM.isthreadlocal
— Functionisthreadlocal(gv::GlobalVariable)
Check if the global variable is thread-local.
LLVM.threadlocal!
— Functionthreadlocal!(gv::GlobalVariable, flag::Bool)
Set the thread-local flag of the global variable.
LLVM.threadlocalmode
— Functionthreadlocalmode(gv::GlobalVariable)
Get the thread-local mode of the global variable.
LLVM.threadlocalmode!
— Functionthreadlocalmode!(gv::GlobalVariable, mode::LLVM.LLVMThreadLocalMode)
Set the thread-local mode of the global variable.
LLVM.isconstant
— Methodisconstant(gv::GlobalVariable)
Check if the global variable is a global constant, i.e., its value is immutable throughout the runtime execution of the program.
LLVM.constant!
— Functionconstant!(gv::GlobalVariable, flag::Bool)
Set the constant flag of the global variable.
LLVM.isextinit
— Functionisextinit(gv::GlobalVariable)
Check if the global variable is externally initialized.
LLVM.extinit!
— Functionextinit!(gv::GlobalVariable, flag::Bool)
Set the externally initialized flag of the global variable.
Uses
LLVM.replace_uses!
— Functionreplace_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!
.
LLVM.replace_metadata_uses!
— Functionreplace_metadata_uses!(old::LLVM.Value, new::LLVM.Value)
Replace all uses of an old
value in metadata with new
.
LLVM.uses
— FunctionLLVM.Use
— TypeLLVM.user
— Functionuser(use::LLVM.Use)
Get the user of the given use.
LLVM.value
— Functionvalue(use::LLVM.Use)
Get the used value of the given use.