LLVM API Documentation

Functions
Basic Block
Core
Collaboration diagram for Basic Block:

Functions

LLVMValueRef LLVMBasicBlockAsValue (LLVMBasicBlockRef BB)
LLVMBool LLVMValueIsBasicBlock (LLVMValueRef Val)
LLVMBasicBlockRef LLVMValueAsBasicBlock (LLVMValueRef Val)
LLVMValueRef LLVMGetBasicBlockParent (LLVMBasicBlockRef BB)
LLVMValueRef LLVMGetBasicBlockTerminator (LLVMBasicBlockRef BB)
unsigned LLVMCountBasicBlocks (LLVMValueRef Fn)
void LLVMGetBasicBlocks (LLVMValueRef Fn, LLVMBasicBlockRef *BasicBlocks)
LLVMBasicBlockRef LLVMGetFirstBasicBlock (LLVMValueRef Fn)
LLVMBasicBlockRef LLVMGetLastBasicBlock (LLVMValueRef Fn)
LLVMBasicBlockRef LLVMGetNextBasicBlock (LLVMBasicBlockRef BB)
LLVMBasicBlockRef LLVMGetPreviousBasicBlock (LLVMBasicBlockRef BB)
LLVMBasicBlockRef LLVMGetEntryBasicBlock (LLVMValueRef Fn)
LLVMBasicBlockRef LLVMAppendBasicBlockInContext (LLVMContextRef C, LLVMValueRef Fn, const char *Name)
LLVMBasicBlockRef LLVMAppendBasicBlock (LLVMValueRef Fn, const char *Name)
LLVMBasicBlockRef LLVMInsertBasicBlockInContext (LLVMContextRef C, LLVMBasicBlockRef BB, const char *Name)
LLVMBasicBlockRef LLVMInsertBasicBlock (LLVMBasicBlockRef InsertBeforeBB, const char *Name)
void LLVMDeleteBasicBlock (LLVMBasicBlockRef BB)
void LLVMRemoveBasicBlockFromParent (LLVMBasicBlockRef BB)
void LLVMMoveBasicBlockBefore (LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
void LLVMMoveBasicBlockAfter (LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos)
LLVMValueRef LLVMGetFirstInstruction (LLVMBasicBlockRef BB)
LLVMValueRef LLVMGetLastInstruction (LLVMBasicBlockRef BB)

Detailed Description

A basic block represents a single entry single exit section of code. Basic blocks contain a list of instructions which form the body of the block.

Basic blocks belong to functions. They have the type of label.

Basic blocks are themselves values. However, the C API models them as LLVMBasicBlockRef.

See also:
llvm::BasicBlock

Function Documentation

Append a basic block to the end of a function using the global context.

See also:
llvm::BasicBlock::Create()

Definition at line 1823 of file Core.cpp.

References LLVMAppendBasicBlockInContext(), and LLVMGetGlobalContext().

Append a basic block to the end of a function.

See also:
llvm::BasicBlock::Create()

Definition at line 1817 of file Core.cpp.

References llvm::BasicBlock::Create(), llvm::unwrap(), and llvm::wrap().

Referenced by LLVMAppendBasicBlock().

Convert a basic block instance to a value type.

Definition at line 1751 of file Core.cpp.

References llvm::unwrap(), and llvm::wrap().

Obtain the number of basic blocks in a function.

Parameters:
FnFunction value to operate on.

Definition at line 1771 of file Core.cpp.

Remove a basic block from a function and delete it.

This deletes the basic block from its containing function and deletes the basic block itself.

See also:
llvm::BasicBlock::eraseFromParent()

Definition at line 1839 of file Core.cpp.

References llvm::unwrap().

Obtain the function to which a basic block belongs.

See also:
llvm::BasicBlock::getParent()

Definition at line 1763 of file Core.cpp.

References getParent(), llvm::unwrap(), and llvm::wrap().

void LLVMGetBasicBlocks ( LLVMValueRef  Fn,
LLVMBasicBlockRef BasicBlocks 
)

Obtain all of the basic blocks in a function.

This operates on a function value. The BasicBlocks parameter is a pointer to a pre-allocated array of LLVMBasicBlockRef of at least LLVMCountBasicBlocks() in length. This array is populated with LLVMBasicBlockRef instances.

Definition at line 1775 of file Core.cpp.

References llvm::Function::begin(), llvm::Function::end(), I, and llvm::wrap().

Obtain the terminator instruction for a basic block.

If the basic block does not have a terminator (it is not well-formed if it doesn't), then NULL is returned.

The returned LLVMValueRef corresponds to a llvm::TerminatorInst.

See also:
llvm::BasicBlock::getTerminator()

Definition at line 1767 of file Core.cpp.

References llvm::unwrap(), and llvm::wrap().

Obtain the basic block that corresponds to the entry point of a function.

See also:
llvm::Function::getEntryBlock()

Definition at line 1781 of file Core.cpp.

References llvm::wrap().

Obtain the first basic block in a function.

The returned basic block can be used as an iterator. You will likely eventually call into LLVMGetNextBasicBlock() with it.

See also:
llvm::Function::begin()

Definition at line 1785 of file Core.cpp.

References llvm::Function::begin(), llvm::Function::end(), I, and llvm::wrap().

Obtain the first instruction in a basic block.

The returned LLVMValueRef corresponds to a llvm::Instruction instance.

Definition at line 1861 of file Core.cpp.

References llvm::BasicBlock::begin(), llvm::BasicBlock::end(), I, llvm::unwrap(), and llvm::wrap().

Obtain the last basic block in a function.

See also:
llvm::Function::end()

Definition at line 1793 of file Core.cpp.

References llvm::Function::begin(), llvm::Function::end(), I, and llvm::wrap().

Obtain the last instruction in a basic block.

The returned LLVMValueRef corresponds to an LLVM:Instruction.

Definition at line 1869 of file Core.cpp.

References llvm::BasicBlock::begin(), llvm::BasicBlock::end(), I, llvm::unwrap(), and llvm::wrap().

Advance a basic block iterator.

Definition at line 1801 of file Core.cpp.

References llvm::Function::end(), llvm::BasicBlock::getParent(), I, llvm::unwrap(), and llvm::wrap().

Go backwards in a basic block iterator.

Definition at line 1809 of file Core.cpp.

References llvm::Function::begin(), llvm::BasicBlock::getParent(), I, llvm::unwrap(), and llvm::wrap().

LLVMBasicBlockRef LLVMInsertBasicBlock ( LLVMBasicBlockRef  InsertBeforeBB,
const char *  Name 
)

Insert a basic block in a function using the global context.

See also:
llvm::BasicBlock::Create()

Definition at line 1834 of file Core.cpp.

References LLVMGetGlobalContext(), and LLVMInsertBasicBlockInContext().

Insert a basic block in a function before another basic block.

The function to add to is determined by the function of the passed basic block.

See also:
llvm::BasicBlock::Create()

Definition at line 1827 of file Core.cpp.

References llvm::BasicBlock::Create(), llvm::BasicBlock::getParent(), llvm::unwrap(), and llvm::wrap().

Referenced by LLVMInsertBasicBlock().

Move a basic block to after another one.

See also:
llvm::BasicBlock::moveAfter()

Definition at line 1851 of file Core.cpp.

References llvm::unwrap().

Move a basic block to before another one.

See also:
llvm::BasicBlock::moveBefore()

Definition at line 1847 of file Core.cpp.

References llvm::unwrap().

Remove a basic block from a function.

This deletes the basic block from its containing function but keep the basic block alive.

See also:
llvm::BasicBlock::removeFromParent()

Definition at line 1843 of file Core.cpp.

References llvm::unwrap().

Convert an LLVMValueRef to an LLVMBasicBlockRef instance.

Definition at line 1759 of file Core.cpp.

References llvm::wrap().

Determine whether an LLVMValueRef is itself a basic block.

Definition at line 1755 of file Core.cpp.

References llvm::unwrap().