Instructions

Base.copyMethod
copy(inst::Instruction)

Create a copy of the given instruction.

source
LLVM.remove!Method
remove!(inst::Instruction)

Remove the given instruction from the containing basic block, but do not delete the object.

source
LLVM.erase!Method
erase!(inst::Instruction)

Remove the given instruction from the containing basic block and delete the object.

Warning

This function is unsafe because it does not check if the instruction is used elsewhere.

source
LLVM.parentMethod
parent(inst::Instruction)

Get the basic block that contains the given instruction.

source

Creating instructions

LLVM.IRBuilderType
IRBuilder

An instruction builder, which is used to build instructions within a basic block.

source
LLVM.IRBuilderMethod
IRBuilder()

Create a new, unpositioned instruction builder.

This object needs to be disposed of using dispose.

source
LLVM.disposeMethod
dispose(builder::IRBuilder)

Dispose of an instruction builder.

source
LLVM.contextMethod
context(builder::IRBuilder)

Get the context associated with an instruction builder.

source
Base.positionFunction
position(builder::IRBuilder)

Return the current position of the instruction builder.

source
LLVM.position!Method
position!(builder::IRBuilder, inst::Instruction)

Position the instruction builder before the given instruction.

source
LLVM.position!Method
position!(builder::IRBuilder, bb::BasicBlock)

Position the instruction builder at the end of the given basic block.

source
LLVM.position!Method
position!(builder::IRBuilder)

Clear the current position of the instruction builder.

source
Base.insert!Method
insert!(builder::IRBuilder, inst::Instruction, [name::String])

Insert an instruction into the current basic block at the current position, optionally giving it a name.

source
LLVM.debuglocationFunction
debuglocation(builder::IRBuilder)

Get the current debug location of the instruction builder, or nothing if no location is set.

source
LLVM.debuglocation!Function
debuglocation!(builder::IRBuilder)

Clear the current debug location of the instruction builder.

source
debuglocation!(builder::IRBuilder, loc)

Set the current debug location of the instruction builder to loc, which can be a Metadata or MetadataAsValue.

source
debuglocation!(builder::IRBuilder, inst::Instruction)

Set the current debug location of the instruction builder to the location of the given instruction.

source

Comparison instructions

LLVM.predicateFunction
predicate(inst::ICmpInst)
predicate(inst::FCmpInst)

Get the comparison predicate of the given integer or floating-point comparison instruction.

source

Atomic instructions

LLVM.is_atomicFunction
is_atomic(inst::Instruction)

Check if the given instruction is atomic. This includes atomic operations such as atomicrmw or fence, but also loads and stores that have been made atomic by setting an atomic ordering.

source
LLVM.orderingFunction
ordering(atomic_inst::Instruction)

Get the atomic ordering of the given atomic instruction.

source
LLVM.ordering!Function
ordering!(inst::Instruction, ordering::LLVM.AtomicOrdering)

Set the atomic ordering of the given instruction.

source
LLVM.syncscopeFunction
syncscope(inst::AtomicInst)

Get the synchronization scope of the given atomic instruction.

source
LLVM.syncscope!Function
syncscope!(inst::AtomicInst, scope::SyncScope)

Set the synchronization scope of the given atomic instruction.

source
LLVM.binopFunction
binop(inst::AtomicRMWInst)

Get the binary operation of the given atomic read-modify-write instruction.

source
LLVM.isweakFunction
isweak(inst::AtomicCmpXchgInst)

Check if the given atomic compare-and-exchange instruction is weak.

source
LLVM.weak!Function
weak!(inst::AtomicCmpXchgInst, is_weak::Bool)

Set whether the given atomic compare-and-exchange instruction is weak.

source
LLVM.success_orderingFunction
success_ordering(inst::AtomicCmpXchgInst)

Get the success ordering of the given atomic compare-and-exchange instruction.

source
LLVM.success_ordering!Function
success_ordering!(inst::AtomicCmpXchgInst, ord::API.LLVMAtomicOrdering)

Set the success ordering of the given atomic compare-and-exchange instruction.

source
LLVM.failure_orderingFunction
failure_ordering(inst::AtomicCmpXchgInst)

Get the failure ordering of the given atomic compare-and-exchange instruction.

source
LLVM.failure_ordering!Function
failure_ordering!(inst::AtomicCmpXchgInst, ord::API.LLVMAtomicOrdering)

Set the failure ordering of the given atomic compare-and-exchange instruction.

source

Call instructions

LLVM.callconvMethod
callconv(call_inst::Instruction)

Get the calling convention of the given callable instruction.

source
LLVM.callconv!Method
callconv!(call_inst::Instruction, cc)

Set the calling convention of the given callable instruction.

source
LLVM.istailcallFunction
istailcall(call_inst::Instruction)

Tests if this call site must be tail call optimized.

source
LLVM.tailcall!Function
tailcall!(call_inst::Instruction, is_tail::Bool)

Sets whether this call site must be tail call optimized.

source
LLVM.called_operandFunction
called_operand(call_inst::Instruction)

Get the operand of a callable instruction that represents the called function.

source
LLVM.argumentsFunction
arguments(call_inst::Instruction)

Get the arguments of a callable instruction.

source
LLVM.called_typeFunction
called_type(call_inst::Instruction)

Get the type of the function being called by the given callable instruction.

source

Operand Bundles

LLVM.operand_bundlesFunction
operand_bundles(call_inst::Instruction)

Get the operand bundles attached to the given call instruction.

source
LLVM.tagFunction
tag(bundle::OperandBundle)

Get the tag of the given operand bundle.

source
LLVM.inputsFunction
inputs(bundle::OperandBundle)

Get an iterator over the inputs of the given operand bundle.

source

Terminator instructions

LLVM.isterminatorFunction
isterminator(inst::Instruction)

Check if the given instruction is a terminator instruction.

source
LLVM.conditionFunction
condition(br::BrInst)

Get the condition of the given branch instruction.

source
LLVM.condition!Function
condition!(br::BrInst, cond::Value)

Set the condition of the given branch instruction.

source
LLVM.default_destFunction
default_dest(switch::SwitchInst)

Get the default destination of the given switch instruction.

source
LLVM.successorsMethod
successors(term::Instruction)

Get an iterator over the successors of the given terminator instruction.

This is a mutable iterator, so you can modify the successors of the terminator by calling setindex!.

source

Phi instructions

LLVM.incomingFunction
incoming(phi::PhiInst)

Get an iterator over the incoming values of the given phi node.

This is a mutable iterator, so you can modify the incoming values of the phi node by calling push! or append!, passing a tuple of the incoming value and the originating basic block.

source

Floating Point instructions

LLVM.fast_mathFunction
fast_math(inst::Instruction)

Get the fast math flags on an instruction.

source
LLVM.fast_math!Function
fast_math!(inst::Instruction; [flag=...], [all=...])

Set the fast math flags on an instruction. If all is true, then all flags are set.

The following flags are supported:

  • nnan: assume arguments and results are not NaN
  • ninf: assume arguments and results are not Inf
  • nsz: treat the sign of zero arguments and results as insignificant
  • arcp: allow use of reciprocal rather than perform division
  • contract: allow contraction of operations
  • afn: allow substitution of approximate calculations for functions
  • reassoc: allow reassociation of operations
source

Alignment

LLVM.alignmentFunction
alignment(val::LLVM.GlobalValue)

Get the alignment of the global value.

source
alignment(val::Instruction)

Get the alignment of the instruction.

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

Set the alignment of the global value.

source
alignment!(val::Instruction, bytes::Integer)

Set the alignment of the instruction.

source