Learn R Programming

Rllvm (version 0.7-0)

IRBuilder: Create an IR builder object for LLVM construction

Description

This function and class allow us to create and use an IRBuilder for "easy" creation of instructions as we define a native function and generate code.

Usage

IRBuilder(block = getGlobalContext())
createBr(builder, block, check = TRUE)
createBranch(builder, block, check = TRUE)
createCall(builder, fun, ..., .args = list(...), id = character())
createCondBr(builder, cond, true, false)
createGEP(builder, val, index, id = character())
createLoad(builder, val, isVolatile = FALSE, id = character())
createLocalArrayVariable(builder, type, id, size = NULL)
createLocalVariable(builder, type, id, beforeTerminator = FALSE)
createAlloc(builder, type, id, beforeTerminator = FALSE)
createNeg(val, id = character(), block = NULL)
createNot(val, id = character(), block = NULL, builder = NULL)
createRet(builder, value = NULL)
createReturn(builder, value = NULL)
createReturnVoid(builder)
createRetVoid(builder)
createSExt(builder, val, type, id = character())
createStore(builder, val, ptr, volatile = FALSE)
createBitCast(builder, val, type, id = character())
createUIToFP(builder, val, type, id = character())
createSIToFP(builder, val, type, id = character())
createFPToSI(builder, val, type, id = character())
createFPToUI(builder, val, type, id = character())
setInsertPoint(builder, instruction)
createCast(builder, op, from, to, id = character())
createCondBranch(builder, cond, true, false)
createExtractElement(builder, vec, idx)
createFCmp(builder, op, lhs, rhs, id = character())
createFNeg(builder, val, id = character())
createGlobalString(builder, val, id = character())
createInsertElement(builder, vec, elt, idx)
createIntCast(builder, val, type, isSigned = TRUE, id = character())
createSelect(builder, cond, true, false, id = character())
createStructGEP(builder, value, field)
createTargetMachine(target, triple, cpu, features = "", options = list())
createUnreachable(builder, id = character())
createUnwind(builder, id = character())
createZExt(builder, val, type, id = character(), Z = TRUE)
getTrue(ir)
getFalse(ir)
getInsertBlock(builder)
setInsertBlock(builder, block)
setInsertPoint(builder, instruction)
createTrunc(builder, value, type, id = "")
createFPTrunc(builder, value, type, id = "")

Arguments

block

either a Block object to which instructions will be inserted/added by default. This can be reset using setInsertPoint. Alternatively, this can be an LLVMContext object.

builder, ir

an instance of the IRBuilder class in LLVM that we use to create the instructions in the code.

fun

the LLVM Function object we are calling in createCall.

...

the arguments to the call in createCall.

.args

a list of the arguments to pass to the actual function call being generated in the code to createCall. This is an alternative to … so that we can pass a single object containing the individual arguments rather than passing the arguments individually in the call to createCall. (This is all a bit meta, but that's because it is!)

id

a human-readable character string giving an identifier to use for identifying the instruction

cond

the Value instruction to use for the the condition in an LLVM if-else-statement created by createCondBr.

true

the Block to use for the body of the if-statement created with createCondBr

false

the Block to use for the else part of the if-statement created with createCondBr

val

a Value object. This is used as the object in which to get the general element pointer (GEP) in createGEP, and the representation of the variable to load in createLoad. It is also the Value objectto negate with createNeg and createNot.

index

a list of Value objects (or literal numbers) that are used in createGEP to specify the indices to subset.

isVolatile,volatile

a logical value indicating whether the LLVM object is to be treated as volatile, i.e. can change due to external commands.

type

an LLVM Type object that describes/represents a data type

size

the number of elements in this local array variable.

beforeTerminator

a logical value that indicates whether the new variable should be inserted before the terminator for the target block.

value

the Value that is to be returned

ptr

the Value to which the value will be stored in createStore.

instruction

the LLVM Instruction object after which new instructions will be added when used in setInsertPoint.

op

the Value to be cast in createCast

from

the Type from which to cast the LLVM Value in createCast

to

the Type to which to cast the LLVM Value in createCast

vec

the object from which we want to extract a value in createExtractElement

idx

the Value representing the index of the element to use in createExtractElement

lhs

left hand side Value of floating-pointing comparison in createFCmp

rhs

right hand side Value of floating-pointing comparison in createFCmp

elt

the specification of the element in the object into which we will sert a value via createInsertElement

isSigned

a logical value

field

a integer specifying the index that identifies the field in the struct data type in createStructGEP

target

a Target object.

triple

a string representing the target machine type

cpu

a string describing the type of CPU

features

a string specifying the features.

options

a list

Z

a logical value

check

a logical value that determines whether we check if the branch is to the same block, i.e., if we are creating a branch instruction to a block that is the same block.

References

LLVM Documentation http://llvm.org/docs/