Basic blocks

LLVM.BasicBlockType
BasicBlock

A basic block in the IR. A basic block is a sequence of instructions that always ends in a terminator instruction.

source
LLVM.BasicBlockMethod
BasicBlock(name::String)

Create a new, empty basic block with the given name.

source
LLVM.BasicBlockMethod
BasicBlock(f::LLVM.Function, name::String)

Create a new, empty basic block with the given name, and insert it at the end of the given function.

source
LLVM.BasicBlockMethod
BasicBlock(bb::BasicBlock, name::String)

Create a new, empty basic block with the given name, and insert it before the given basic block.

source

Properties and operations

LLVM.remove!Method
remove!(bb::BasicBlock)

Remove the given basic block from its parent function, but do not free the object.

source
LLVM.erase!Method
erase!(fun::Function, bb::BasicBlock)

Remove the given basic block from its parent function and free the object.

Warning

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

source
LLVM.parentMethod
parent(bb::BasicBlock) -> LLVM.Function

Get the function that contains the given basic block, or nothing if the block is not part of a function.

source
LLVM.terminatorMethod
terminator(bb::BasicBlock) -> LLVM.Instruction

Get the terminator instruction of the given basic block.

source
LLVM.nameMethod
name(bb::BasicBlock) -> String

Get the name of the given basic block.

source
LLVM.move_beforeFunction
move_before(bb::BasicBlock, pos::BasicBlock)

Move the given basic block before the given position.

source
LLVM.move_afterFunction
move_after(bb::BasicBlock, pos::BasicBlock)

Move the given basic block after the given position.

source

Control flow

Instructions

LLVM.instructionsFunction
instructions(bb::BasicBlock)

Get an iterator over the instructions in the given basic block.

source
LLVM.previnstFunction
previnst(inst::Instruction)

Get the instruction before the given instruction in the basic block, or nothing if there is none.

source
LLVM.nextinstFunction
nextinst(inst::Instruction)

Get the instruction after the given instruction in the basic block, or nothing if there is none.

source