pub struct Builder { /* private fields */ }
Expand description
A wrapper around a LLVMBuilderRef
for a specific context
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn build_alloca(&self, ty: Type) -> Value
pub fn build_alloca(&self, ty: Type) -> Value
Build a stack allocation
Sourcepub fn build_malloc(&self, ty: Type) -> Value
pub fn build_malloc(&self, ty: Type) -> Value
Build a heap allocation
Sourcepub fn build_array_alloca(&self, ty: Type, count: u32) -> Value
pub fn build_array_alloca(&self, ty: Type, count: u32) -> Value
Build a stack allocation for an array
Sourcepub fn build_array_malloc(&self, ty: Type, count: u32) -> Value
pub fn build_array_malloc(&self, ty: Type, count: u32) -> Value
Build a heap allocation for an array
Sourcepub fn build_free(&self, ptr: Value) -> Value
pub fn build_free(&self, ptr: Value) -> Value
Build a heap free
Sourcepub fn build_struct_init(&self, ty: Type, elements: Vec<Value>) -> Value
pub fn build_struct_init(&self, ty: Type, elements: Vec<Value>) -> Value
Build a struct initialization for the given type and elements
Sourcepub fn build_struct_alloca_init(&self, ty: Type, elements: Vec<Value>) -> Value
pub fn build_struct_alloca_init(&self, ty: Type, elements: Vec<Value>) -> Value
Build a struct initialization that stores it into memory with alloca
Sourcepub fn build_struct_malloc_init(&self, ty: Type, elements: Vec<Value>) -> Value
pub fn build_struct_malloc_init(&self, ty: Type, elements: Vec<Value>) -> Value
Build a struct initialization that stores it into memory with malloc
Sourcepub fn build_insert_value(&self, agg: Value, elt: Value, index: u32) -> Value
pub fn build_insert_value(&self, agg: Value, elt: Value, index: u32) -> Value
Build an insert value instruction
Sourcepub fn build_extract_value(&self, agg: Value, index: u32) -> Value
pub fn build_extract_value(&self, agg: Value, index: u32) -> Value
Build an extract value instruction
Sourcepub fn build_gep(&self, ptr: Value, indices: Vec<Value>) -> Value
pub fn build_gep(&self, ptr: Value, indices: Vec<Value>) -> Value
Build a get element pointer instruction
Sourcepub fn build_struct_gep(&self, ptr: Value, index: u32) -> Value
pub fn build_struct_gep(&self, ptr: Value, index: u32) -> Value
Build a struct get element pointer instruction
Sourcepub fn build_inbounds_gep(&self, ptr: Value, indices: Vec<Value>) -> Value
pub fn build_inbounds_gep(&self, ptr: Value, indices: Vec<Value>) -> Value
Build an inbounds get element pointer instruction
Sourcepub fn build_global_string<S>(&self, string: S) -> Value
pub fn build_global_string<S>(&self, string: S) -> Value
Build a global string with the given value
Sourcepub fn build_global_string_ptr<S>(&self, string: S) -> Value
pub fn build_global_string_ptr<S>(&self, string: S) -> Value
Build a global string pointer with the given value
Sourcepub fn build_store(&self, val: Value, ptr: Value)
pub fn build_store(&self, val: Value, ptr: Value)
Build a store instruction
Sourcepub fn build_load(&self, ptr: Value) -> Value
pub fn build_load(&self, ptr: Value) -> Value
Build a load instruction
Sourcepub fn build_array_alloca_store(&self, ty: Type, elements: Vec<Value>) -> Value
pub fn build_array_alloca_store(&self, ty: Type, elements: Vec<Value>) -> Value
Alloca some memory for an array and then store values in it
Sourcepub fn build_array_malloc_store(&self, ty: Type, elements: Vec<Value>) -> Value
pub fn build_array_malloc_store(&self, ty: Type, elements: Vec<Value>) -> Value
Malloc some memory for an array and then store values in it
Sourcepub fn build_alloca_store(&self, val: Value) -> Value
pub fn build_alloca_store(&self, val: Value) -> Value
Alloca some memory and then store a value in it
Sourcepub fn build_malloc_store(&self, val: Value) -> Value
pub fn build_malloc_store(&self, val: Value) -> Value
Malloc some memory and then store a value in it
Sourcepub fn build_load_free(&self, ptr: Value) -> Value
pub fn build_load_free(&self, ptr: Value) -> Value
Load a value and then free the memory
Sourcepub fn build_int_to_ptr(&self, val: Value, ptr_ty: Type) -> Value
pub fn build_int_to_ptr(&self, val: Value, ptr_ty: Type) -> Value
Build a cast from integer to pointer
Sourcepub fn build_ptr_to_int(&self, ptr: Value, val_ty: Type) -> Value
pub fn build_ptr_to_int(&self, ptr: Value, val_ty: Type) -> Value
Build a cast from pointer to integer
Sourcepub fn build_pointer_cast(&self, ptr: Value, ty: Type) -> Value
pub fn build_pointer_cast(&self, ptr: Value, ty: Type) -> Value
Build a pointer cast
Sourcepub fn build_int_cast(&self, val: Value, ty: Type) -> Value
pub fn build_int_cast(&self, val: Value, ty: Type) -> Value
Build an integer cast
Sourcepub fn build_bit_cast(&self, val: Value, ty: Type) -> Value
pub fn build_bit_cast(&self, val: Value, ty: Type) -> Value
Build a bit cast
Sourcepub fn build_float_cast(&self, val: Value, ty: Type) -> Value
pub fn build_float_cast(&self, val: Value, ty: Type) -> Value
Build a floating point cast
Sourcepub fn build_ret_void(&self) -> Value
pub fn build_ret_void(&self) -> Value
Build a ret void
statement
Sourcepub fn build_unreachable(&self)
pub fn build_unreachable(&self)
Build an unreachable instruction
Sourcepub fn build_br(&self, block: BasicBlock)
pub fn build_br(&self, block: BasicBlock)
Build a branch instruction to the given block
Sourcepub fn build_if(
&self,
condition: Value,
then_block: BasicBlock,
else_block: BasicBlock,
)
pub fn build_if( &self, condition: Value, then_block: BasicBlock, else_block: BasicBlock, )
Build an if statement that branches to the given blocks
Sourcepub fn build_switch(
&self,
val: Value,
cases: Vec<(Value, BasicBlock)>,
default: BasicBlock,
)
pub fn build_switch( &self, val: Value, cases: Vec<(Value, BasicBlock)>, default: BasicBlock, )
Build a switch statement that branches to the given blocks
Sourcepub fn build_phi(&self, incoming: Vec<(Value, BasicBlock)>) -> Value
pub fn build_phi(&self, incoming: Vec<(Value, BasicBlock)>) -> Value
Build a phi instruction that takes ceratin values from certain blocks
Sourcepub fn position_in_block(&self, bb: BasicBlock, val: Value)
pub fn position_in_block(&self, bb: BasicBlock, val: Value)
Position the builder at a given value in a basic block
Sourcepub fn position_at_end(&self, bb: BasicBlock)
pub fn position_at_end(&self, bb: BasicBlock)
Position the builder at the end of the basic block
Sourcepub fn position_before(&self, val: Value)
pub fn position_before(&self, val: Value)
Position the builder before a value
Sourcepub fn inner(&self) -> LLVMBuilderRef
pub fn inner(&self) -> LLVMBuilderRef
Returns the internal builder reference
Sourcepub unsafe fn into_inner(self) -> LLVMBuilderRef
pub unsafe fn into_inner(self) -> LLVMBuilderRef
Destroys the wrapper, returning the internal builder reference
Sourcepub fn build_is_null(&self, val: Value) -> Value
pub fn build_is_null(&self, val: Value) -> Value
Builds a null check
Sourcepub fn build_is_not_null(&self, val: Value) -> Value
pub fn build_is_not_null(&self, val: Value) -> Value
Builds a null check
Sourcepub fn build_int_add(&self, a: Value, b: Value) -> Value
pub fn build_int_add(&self, a: Value, b: Value) -> Value
Builds an integer add
instruction
Sourcepub fn build_int_sub(&self, a: Value, b: Value) -> Value
pub fn build_int_sub(&self, a: Value, b: Value) -> Value
Builds an integer sub
instruction
Sourcepub fn build_int_mul(&self, a: Value, b: Value) -> Value
pub fn build_int_mul(&self, a: Value, b: Value) -> Value
Builds an integer mul
instruction
Sourcepub fn build_int_udiv(&self, a: Value, b: Value) -> Value
pub fn build_int_udiv(&self, a: Value, b: Value) -> Value
Builds an integer udiv
instruction
Sourcepub fn build_int_sdiv(&self, a: Value, b: Value) -> Value
pub fn build_int_sdiv(&self, a: Value, b: Value) -> Value
Builds an integer sdiv
instruction
Sourcepub fn build_int_urem(&self, a: Value, b: Value) -> Value
pub fn build_int_urem(&self, a: Value, b: Value) -> Value
Builds an integer urem
instruction
Sourcepub fn build_int_srem(&self, a: Value, b: Value) -> Value
pub fn build_int_srem(&self, a: Value, b: Value) -> Value
Builds an integer srem
instruction
Sourcepub fn build_lshr(&self, a: Value, b: Value) -> Value
pub fn build_lshr(&self, a: Value, b: Value) -> Value
Builds a lshr
instruction
Sourcepub fn build_ashr(&self, a: Value, b: Value) -> Value
pub fn build_ashr(&self, a: Value, b: Value) -> Value
Builds an ashr
instruction
Sourcepub fn build_int_eq(&self, a: Value, b: Value) -> Value
pub fn build_int_eq(&self, a: Value, b: Value) -> Value
Builds an integer eq
check
Sourcepub fn build_int_ne(&self, a: Value, b: Value) -> Value
pub fn build_int_ne(&self, a: Value, b: Value) -> Value
Builds an integer ne
check
Sourcepub fn build_int_ule(&self, a: Value, b: Value) -> Value
pub fn build_int_ule(&self, a: Value, b: Value) -> Value
Builds an integer ule
check
Sourcepub fn build_int_ult(&self, a: Value, b: Value) -> Value
pub fn build_int_ult(&self, a: Value, b: Value) -> Value
Builds an integer ult
check
Sourcepub fn build_int_uge(&self, a: Value, b: Value) -> Value
pub fn build_int_uge(&self, a: Value, b: Value) -> Value
Builds an integer uge
check
Sourcepub fn build_int_ugt(&self, a: Value, b: Value) -> Value
pub fn build_int_ugt(&self, a: Value, b: Value) -> Value
Builds an integer ugt
check
Sourcepub fn build_int_sle(&self, a: Value, b: Value) -> Value
pub fn build_int_sle(&self, a: Value, b: Value) -> Value
Builds an integer sle
check
Sourcepub fn build_int_slt(&self, a: Value, b: Value) -> Value
pub fn build_int_slt(&self, a: Value, b: Value) -> Value
Builds an integer slt
check
Sourcepub fn build_int_sge(&self, a: Value, b: Value) -> Value
pub fn build_int_sge(&self, a: Value, b: Value) -> Value
Builds an integer sge
check
Sourcepub fn build_int_sgt(&self, a: Value, b: Value) -> Value
pub fn build_int_sgt(&self, a: Value, b: Value) -> Value
Builds an integer sgt
check
Sourcepub fn build_float_add(&self, a: Value, b: Value) -> Value
pub fn build_float_add(&self, a: Value, b: Value) -> Value
Builds a float add
instruction
Sourcepub fn build_float_sub(&self, a: Value, b: Value) -> Value
pub fn build_float_sub(&self, a: Value, b: Value) -> Value
Builds a float sub
instruction
Sourcepub fn build_float_mul(&self, a: Value, b: Value) -> Value
pub fn build_float_mul(&self, a: Value, b: Value) -> Value
Builds a float mul
instruction
Sourcepub fn build_float_div(&self, a: Value, b: Value) -> Value
pub fn build_float_div(&self, a: Value, b: Value) -> Value
Builds a float div
instruction
Sourcepub fn build_float_rem(&self, a: Value, b: Value) -> Value
pub fn build_float_rem(&self, a: Value, b: Value) -> Value
Builds a float rem
instruction
Sourcepub fn build_float_eq(&self, a: Value, b: Value) -> Value
pub fn build_float_eq(&self, a: Value, b: Value) -> Value
Builds a float eq
check
Sourcepub fn build_float_ne(&self, a: Value, b: Value) -> Value
pub fn build_float_ne(&self, a: Value, b: Value) -> Value
Builds a float ne
check
Sourcepub fn build_float_le(&self, a: Value, b: Value) -> Value
pub fn build_float_le(&self, a: Value, b: Value) -> Value
Builds a float le
check
Sourcepub fn build_float_lt(&self, a: Value, b: Value) -> Value
pub fn build_float_lt(&self, a: Value, b: Value) -> Value
Builds a float lt
check
Sourcepub fn build_float_ge(&self, a: Value, b: Value) -> Value
pub fn build_float_ge(&self, a: Value, b: Value) -> Value
Builds a float ge
check
Sourcepub fn build_float_gt(&self, a: Value, b: Value) -> Value
pub fn build_float_gt(&self, a: Value, b: Value) -> Value
Builds a float gt
check
Sourcepub fn build_float_ord_eq(&self, a: Value, b: Value) -> Value
pub fn build_float_ord_eq(&self, a: Value, b: Value) -> Value
Builds an ordered float eq
check
Sourcepub fn build_float_ord_ne(&self, a: Value, b: Value) -> Value
pub fn build_float_ord_ne(&self, a: Value, b: Value) -> Value
Builds an ordered float ne
check
Sourcepub fn build_float_ord_le(&self, a: Value, b: Value) -> Value
pub fn build_float_ord_le(&self, a: Value, b: Value) -> Value
Builds an ordered float le
check
Sourcepub fn build_float_ord_lt(&self, a: Value, b: Value) -> Value
pub fn build_float_ord_lt(&self, a: Value, b: Value) -> Value
Builds an ordered float lt
check
Sourcepub fn build_float_ord_ge(&self, a: Value, b: Value) -> Value
pub fn build_float_ord_ge(&self, a: Value, b: Value) -> Value
Builds an ordered float ge
check
Sourcepub fn build_float_ord_gt(&self, a: Value, b: Value) -> Value
pub fn build_float_ord_gt(&self, a: Value, b: Value) -> Value
Builds an ordered float gt
check
Sourcepub fn build_float_is_ord(&self, a: Value, b: Value) -> Value
pub fn build_float_is_ord(&self, a: Value, b: Value) -> Value
Builds a check for an ordered float
Sourcepub fn build_float_non_ord(&self, a: Value, b: Value) -> Value
pub fn build_float_non_ord(&self, a: Value, b: Value) -> Value
Builds a check for an unordered float