Instructions
LLVM.Instruction — Type
InstructionAn instruction in the LLVM IR.
LLVM.remove! — Method
remove!(inst::Instruction)Remove the given instruction from the containing basic block, but do not delete the object.
LLVM.erase! — Method
erase!(inst::Instruction)Remove the given instruction from the containing basic block and delete the object.
LLVM.parent — Method
parent(inst::Instruction)Get the basic block that contains the given instruction.
Creating instructions
LLVM.IRBuilder — Type
IRBuilderAn instruction builder, which is used to build instructions within a basic block.
LLVM.IRBuilder — Method
IRBuilder()Create a new, unpositioned instruction builder.
This object needs to be disposed of using dispose.
LLVM.dispose — Method
dispose(builder::IRBuilder)Dispose of an instruction builder.
LLVM.context — Method
context(builder::IRBuilder)Get the context associated with an instruction builder.
Base.position — Function
position(builder::IRBuilder)Return the current position of the instruction builder.
LLVM.position! — Method
position!(builder::IRBuilder, inst::Instruction)Position the instruction builder before the given instruction.
LLVM.position! — Method
position!(builder::IRBuilder, bb::BasicBlock)Position the instruction builder at the end of the given basic block.
LLVM.position! — Method
position!(builder::IRBuilder)Clear the current position of the instruction builder.
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.
LLVM.debuglocation — Function
debuglocation(builder::IRBuilder)Get the current debug location of the instruction builder, or nothing if no location is set.
LLVM.debuglocation! — Function
debuglocation!(builder::IRBuilder)Clear the current debug location of the instruction builder.
debuglocation!(builder::IRBuilder, loc)Set the current debug location of the instruction builder to loc, which can be a Metadata or MetadataAsValue.
debuglocation!(builder::IRBuilder, inst::Instruction)Set the current debug location of the instruction builder to the location of the given instruction.
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!.
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!.
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!.
Comparison instructions
LLVM.predicate — Function
predicate(inst::ICmpInst)
predicate(inst::FCmpInst)Get the comparison predicate of the given integer or floating-point comparison instruction.
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.
LLVM.ordering — Function
ordering(atomic_inst::Instruction)Get the atomic ordering of the given atomic instruction.
LLVM.ordering! — Function
ordering!(inst::Instruction, ordering::LLVM.AtomicOrdering)Set the atomic ordering of the given instruction.
LLVM.SyncScope — Type
SyncScopeA synchronization scope for atomic operations.
LLVM.syncscope — Function
syncscope(inst::AtomicInst)Get the synchronization scope of the given atomic instruction.
LLVM.syncscope! — Function
syncscope!(inst::AtomicInst, scope::SyncScope)Set the synchronization scope of the given atomic instruction.
LLVM.binop — Function
binop(inst::AtomicRMWInst)Get the binary operation of the given atomic read-modify-write instruction.
LLVM.isweak — Function
isweak(inst::AtomicCmpXchgInst)Check if the given atomic compare-and-exchange instruction is weak.
LLVM.weak! — Function
weak!(inst::AtomicCmpXchgInst, is_weak::Bool)Set whether the given atomic compare-and-exchange instruction is weak.
LLVM.success_ordering — Function
success_ordering(inst::AtomicCmpXchgInst)Get the success ordering of the given atomic compare-and-exchange instruction.
LLVM.success_ordering! — Function
success_ordering!(inst::AtomicCmpXchgInst, ord::API.LLVMAtomicOrdering)Set the success ordering of the given atomic compare-and-exchange instruction.
LLVM.failure_ordering — Function
failure_ordering(inst::AtomicCmpXchgInst)Get the failure ordering of the given atomic compare-and-exchange instruction.
LLVM.failure_ordering! — Function
failure_ordering!(inst::AtomicCmpXchgInst, ord::API.LLVMAtomicOrdering)Set the failure ordering of the given atomic compare-and-exchange instruction.
Call instructions
LLVM.callconv — Method
callconv(call_inst::Instruction)Get the calling convention of the given callable instruction.
LLVM.callconv! — Method
callconv!(call_inst::Instruction, cc)Set the calling convention of the given callable instruction.
LLVM.istailcall — Function
istailcall(call_inst::Instruction)Tests if this call site must be tail call optimized.
LLVM.tailcall! — Function
tailcall!(call_inst::Instruction, is_tail::Bool)Sets whether this call site must be tail call optimized.
LLVM.called_operand — Function
called_operand(call_inst::Instruction)Get the operand of a callable instruction that represents the called function.
LLVM.arguments — Function
arguments(call_inst::Instruction)Get the arguments of a callable instruction.
LLVM.called_type — Function
called_type(call_inst::Instruction)Get the type of the function being called by the given callable instruction.
Operand Bundles
LLVM.OperandBundle — Type
OperandBundleAn operand bundle attached to a call site.
LLVM.operand_bundles — Function
operand_bundles(call_inst::Instruction)Get the operand bundles attached to the given call instruction.
LLVM.inputs — Function
inputs(bundle::OperandBundle)Get an iterator over the inputs of the given operand bundle.
Terminator instructions
LLVM.isterminator — Function
isterminator(inst::Instruction)Check if the given instruction is a terminator instruction.
LLVM.isconditional — Function
isconditional(br::BrInst)Check if the given branch instruction is conditional.
LLVM.condition — Function
condition(br::BrInst)Get the condition of the given branch instruction.
LLVM.condition! — Function
condition!(br::BrInst, cond::Value)Set the condition of the given branch instruction.
LLVM.default_dest — Function
default_dest(switch::SwitchInst)Get the default destination of the given switch instruction.
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!.
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.
Floating Point instructions
LLVM.fast_math — Function
fast_math(inst::Instruction)Get the fast math flags on an instruction.
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 NaNninf: assume arguments and results are not Infnsz: treat the sign of zero arguments and results as insignificantarcp: allow use of reciprocal rather than perform divisioncontract: allow contraction of operationsafn: allow substitution of approximate calculations for functionsreassoc: allow reassociation of operations
Alignment
LLVM.alignment — Function
alignment(gv::GlobalVariable)Get the alignment of the global variable.
alignment(val::Instruction)Get the alignment of the instruction.
LLVM.alignment! — Function
alignment!(gv::GlobalVariable, bytes::Integer)Set the alignment of the global variable.
alignment!(val::Instruction, bytes::Integer)Set the alignment of the instruction.