Instructions

Base.copy — Method
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.parent — Method
parent(inst::Instruction)

Get the basic block that contains the given instruction.

source

Creating instructions

LLVM.IRBuilder — Type
IRBuilder

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

source
LLVM.IRBuilder — Method
IRBuilder()

Create a new, unpositioned instruction builder.

This object needs to be disposed of using dispose.

source
LLVM.dispose — Method
dispose(builder::IRBuilder)

Dispose of an instruction builder.

source
LLVM.context — Method
context(builder::IRBuilder)

Get the context associated with an instruction builder.

source
Base.position — Function
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.debuglocation — Function
debuglocation(builder::IRBuilder)

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

source
debuglocation(inst::Instruction) -> Union{DILocation,Nothing}

Get the debug location attached to the given instruction, or nothing.

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
debuglocation!(inst::Instruction, loc::DILocation)

Set the debug location of the given instruction.

source
debuglocation!(inst::Instruction)

Clear the debug location of the given instruction.

source

Attributes

LLVM.function_attributes — Method
function_attributes(instr::CallBase)

Get the attributes of the given instruction.

This is a mutable iterator, supporting push!, append! and delete!.

source
LLVM.argument_attributes — Method
argument_attributes(instr::CallBase, idx::Integer)

Get the attributes of the given argument of the given instruction.

This is a mutable iterator, supporting push!, append! and delete!.

source
LLVM.return_attributes — Method
return_attributes(instr::CallBase)

Get the attributes of the return value of the given instruction.

This is a mutable iterator, supporting push!, append! and delete!.

source

Comparison instructions

LLVM.predicate — Function
predicate(inst::ICmpInst)
predicate(inst::FCmpInst)

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

source

Atomic instructions

LLVM.is_atomic — Function
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.ordering — Function
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.syncscope — Function
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.binop — Function
binop(inst::AtomicRMWInst)

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

source
LLVM.isweak — Function
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_ordering — Function
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_ordering — Function
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.callconv — Method
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.istailcall — Function
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_operand — Function
called_operand(call_inst::Instruction)

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

source
LLVM.arguments — Function
arguments(call_inst::Instruction)

Get the arguments of a callable instruction.

source
LLVM.called_type — Function
called_type(call_inst::Instruction)

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

source

Operand Bundles

LLVM.operand_bundles — Function
operand_bundles(call_inst::Instruction)

Get the operand bundles attached to the given call instruction.

source
LLVM.tag — Method
tag(bundle::OperandBundle)

Get the tag of the given operand bundle.

source
LLVM.inputs — Function
inputs(bundle::OperandBundle)

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

source

Terminator instructions

LLVM.isterminator — Function
isterminator(inst::Instruction)

Check if the given instruction is a terminator instruction.

source
LLVM.condition — Function
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_dest — Function
default_dest(switch::SwitchInst)

Get the default destination of the given switch instruction.

source
LLVM.successors — Method
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.incoming — Function
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_math — Function
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.alignment — Function
alignment(gv::GlobalVariable)

Get the alignment of the global variable.

source
alignment(val::Instruction)

Get the alignment of the instruction.

source
LLVM.alignment! — Function
alignment!(gv::GlobalVariable, bytes::Integer)

Set the alignment of the global variable.

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

Set the alignment of the instruction.

source