pub trait Builder: BackendTypes + TypeMethods {
Show 88 methods
// Required methods
fn create_block(&mut self, name: &str) -> Self::BasicBlock;
fn create_block_after(
&mut self,
after: Self::BasicBlock,
name: &str,
) -> Self::BasicBlock;
fn switch_to_block(&mut self, block: Self::BasicBlock);
fn seal_block(&mut self, block: Self::BasicBlock);
fn seal_all_blocks(&mut self);
fn set_current_block_cold(&mut self);
fn current_block(&mut self) -> Option<Self::BasicBlock>;
fn block_addr(&mut self, block: Self::BasicBlock) -> Option<Self::Value>;
fn add_comment_to_current_inst(&mut self, comment: &str);
fn fn_param(&mut self, index: usize) -> Self::Value;
fn num_fn_params(&self) -> usize;
fn bool_const(&mut self, value: bool) -> Self::Value;
fn iconst(&mut self, ty: Self::Type, value: i64) -> Self::Value;
fn uconst(&mut self, ty: Self::Type, value: u64) -> Self::Value;
fn iconst_256(&mut self, value: impl TryInto<U256>) -> Self::Value;
fn str_const(&mut self, value: &str) -> Self::Value;
fn nullptr(&mut self) -> Self::Value;
fn new_stack_slot_raw(
&mut self,
ty: Self::Type,
name: &str,
) -> Self::StackSlot;
fn stack_load(
&mut self,
ty: Self::Type,
slot: Self::StackSlot,
name: &str,
) -> Self::Value;
fn stack_store(&mut self, value: Self::Value, slot: Self::StackSlot);
fn stack_addr(
&mut self,
ty: Self::Type,
slot: Self::StackSlot,
) -> Self::Value;
fn load(
&mut self,
ty: Self::Type,
ptr: Self::Value,
name: &str,
) -> Self::Value;
fn load_aligned(
&mut self,
ty: Self::Type,
ptr: Self::Value,
align: usize,
name: &str,
) -> Self::Value;
fn store(&mut self, value: Self::Value, ptr: Self::Value);
fn store_aligned(
&mut self,
value: Self::Value,
ptr: Self::Value,
align: usize,
);
fn nop(&mut self);
fn ret(&mut self, values: &[Self::Value]);
fn icmp(
&mut self,
cond: IntCC,
lhs: Self::Value,
rhs: Self::Value,
) -> Self::Value;
fn icmp_imm(
&mut self,
cond: IntCC,
lhs: Self::Value,
rhs: i64,
) -> Self::Value;
fn is_null(&mut self, ptr: Self::Value) -> Self::Value;
fn is_not_null(&mut self, ptr: Self::Value) -> Self::Value;
fn br(&mut self, dest: Self::BasicBlock);
fn brif(
&mut self,
cond: Self::Value,
then_block: Self::BasicBlock,
else_block: Self::BasicBlock,
);
fn switch(
&mut self,
index: Self::Value,
default: Self::BasicBlock,
targets: &[(u64, Self::BasicBlock)],
default_is_cold: bool,
);
fn br_indirect(
&mut self,
address: Self::Value,
destinations: &[Self::BasicBlock],
);
fn phi(
&mut self,
ty: Self::Type,
incoming: &[(Self::Value, Self::BasicBlock)],
) -> Self::Value;
fn select(
&mut self,
cond: Self::Value,
then_value: Self::Value,
else_value: Self::Value,
) -> Self::Value;
fn lazy_select(
&mut self,
cond: Self::Value,
ty: Self::Type,
then_value: impl FnOnce(&mut Self) -> Self::Value,
else_value: impl FnOnce(&mut Self) -> Self::Value,
) -> Self::Value;
fn iadd(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn isub(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn imul(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn udiv(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn sdiv(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn urem(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn srem(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn iadd_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value;
fn isub_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value;
fn imul_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value;
fn uadd_overflow(
&mut self,
lhs: Self::Value,
rhs: Self::Value,
) -> (Self::Value, Self::Value);
fn usub_overflow(
&mut self,
lhs: Self::Value,
rhs: Self::Value,
) -> (Self::Value, Self::Value);
fn uadd_sat(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn umax(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn umin(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn bswap(&mut self, value: Self::Value) -> Self::Value;
fn bitor(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn bitand(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn bitxor(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn bitnot(&mut self, value: Self::Value) -> Self::Value;
fn clz(&mut self, value: Self::Value) -> Self::Value;
fn bitor_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value;
fn bitand_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value;
fn bitxor_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value;
fn ishl(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn ushr(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn sshr(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value;
fn zext(&mut self, ty: Self::Type, value: Self::Value) -> Self::Value;
fn sext(&mut self, ty: Self::Type, value: Self::Value) -> Self::Value;
fn ireduce(&mut self, to: Self::Type, value: Self::Value) -> Self::Value;
fn inttoptr(&mut self, value: Self::Value, ty: Self::Type) -> Self::Value;
fn gep(
&mut self,
ty: Self::Type,
ptr: Self::Value,
indexes: &[Self::Value],
name: &str,
) -> Self::Value;
fn tail_call(
&mut self,
function: Self::Function,
args: &[Self::Value],
tail_call: TailCallKind,
) -> Option<Self::Value>;
fn is_compile_time_known(
&mut self,
value: Self::Value,
) -> Option<Self::Value>;
fn memcpy(&mut self, dst: Self::Value, src: Self::Value, len: Self::Value);
fn unreachable(&mut self);
fn get_or_build_function(
&mut self,
name: &str,
params: &[Self::Type],
ret: Option<Self::Type>,
linkage: Linkage,
build: impl FnOnce(&mut Self),
) -> Self::Function;
fn get_function(&mut self, name: &str) -> Option<Self::Function>;
fn get_printf_function(&mut self) -> Self::Function;
fn add_function(
&mut self,
name: &str,
params: &[Self::Type],
ret: Option<Self::Type>,
address: Option<usize>,
linkage: Linkage,
call_conv: CallConv,
) -> Self::Function;
fn add_function_attribute(
&mut self,
function: Option<Self::Function>,
attribute: Attribute,
loc: FunctionAttributeLocation,
);
// Provided methods
fn set_debug_location(&mut self, _line: u32, _col: u32) { ... }
fn clear_debug_location(&mut self) { ... }
fn cstr_const(&mut self, value: &CStr) -> Self::Value { ... }
fn new_stack_slot(&mut self, ty: Self::Type, name: &str) -> Pointer<Self> { ... }
fn assume(&mut self, cond: Self::Value) { ... }
fn brif_cold(
&mut self,
cond: Self::Value,
then_block: Self::BasicBlock,
else_block: Self::BasicBlock,
then_is_cold: bool,
) { ... }
fn call(
&mut self,
function: Self::Function,
args: &[Self::Value],
) -> Option<Self::Value> { ... }
fn memcpy_inline(&mut self, dst: Self::Value, src: Self::Value, len: i64) { ... }
fn add_function_stub(
&mut self,
function: Self::Function,
call_conv: CallConv,
) -> Self::Function { ... }
}Required Methods§
fn create_block(&mut self, name: &str) -> Self::BasicBlock
fn create_block_after( &mut self, after: Self::BasicBlock, name: &str, ) -> Self::BasicBlock
fn switch_to_block(&mut self, block: Self::BasicBlock)
fn seal_block(&mut self, block: Self::BasicBlock)
fn seal_all_blocks(&mut self)
fn set_current_block_cold(&mut self)
fn current_block(&mut self) -> Option<Self::BasicBlock>
fn block_addr(&mut self, block: Self::BasicBlock) -> Option<Self::Value>
fn add_comment_to_current_inst(&mut self, comment: &str)
fn fn_param(&mut self, index: usize) -> Self::Value
fn num_fn_params(&self) -> usize
fn bool_const(&mut self, value: bool) -> Self::Value
Sourcefn iconst(&mut self, ty: Self::Type, value: i64) -> Self::Value
fn iconst(&mut self, ty: Self::Type, value: i64) -> Self::Value
Sign-extends negative values to ty.
fn uconst(&mut self, ty: Self::Type, value: u64) -> Self::Value
fn iconst_256(&mut self, value: impl TryInto<U256>) -> Self::Value
fn str_const(&mut self, value: &str) -> Self::Value
fn nullptr(&mut self) -> Self::Value
fn new_stack_slot_raw(&mut self, ty: Self::Type, name: &str) -> Self::StackSlot
fn stack_load( &mut self, ty: Self::Type, slot: Self::StackSlot, name: &str, ) -> Self::Value
fn stack_store(&mut self, value: Self::Value, slot: Self::StackSlot)
fn stack_addr(&mut self, ty: Self::Type, slot: Self::StackSlot) -> Self::Value
Sourcefn load(&mut self, ty: Self::Type, ptr: Self::Value, name: &str) -> Self::Value
fn load(&mut self, ty: Self::Type, ptr: Self::Value, name: &str) -> Self::Value
Loads a value from a pointer, assuming natural alignment.
Sourcefn load_aligned(
&mut self,
ty: Self::Type,
ptr: Self::Value,
align: usize,
name: &str,
) -> Self::Value
fn load_aligned( &mut self, ty: Self::Type, ptr: Self::Value, align: usize, name: &str, ) -> Self::Value
Loads a value from a pointer with an explicit alignment override.
Sourcefn store(&mut self, value: Self::Value, ptr: Self::Value)
fn store(&mut self, value: Self::Value, ptr: Self::Value)
Stores a value to a pointer, assuming natural alignment.
Sourcefn store_aligned(&mut self, value: Self::Value, ptr: Self::Value, align: usize)
fn store_aligned(&mut self, value: Self::Value, ptr: Self::Value, align: usize)
Stores a value to a pointer with an explicit alignment override.
fn nop(&mut self)
fn ret(&mut self, values: &[Self::Value])
fn icmp( &mut self, cond: IntCC, lhs: Self::Value, rhs: Self::Value, ) -> Self::Value
fn icmp_imm(&mut self, cond: IntCC, lhs: Self::Value, rhs: i64) -> Self::Value
fn is_null(&mut self, ptr: Self::Value) -> Self::Value
fn is_not_null(&mut self, ptr: Self::Value) -> Self::Value
fn br(&mut self, dest: Self::BasicBlock)
fn brif( &mut self, cond: Self::Value, then_block: Self::BasicBlock, else_block: Self::BasicBlock, )
fn switch( &mut self, index: Self::Value, default: Self::BasicBlock, targets: &[(u64, Self::BasicBlock)], default_is_cold: bool, )
fn br_indirect( &mut self, address: Self::Value, destinations: &[Self::BasicBlock], )
fn phi( &mut self, ty: Self::Type, incoming: &[(Self::Value, Self::BasicBlock)], ) -> Self::Value
fn select( &mut self, cond: Self::Value, then_value: Self::Value, else_value: Self::Value, ) -> Self::Value
fn lazy_select( &mut self, cond: Self::Value, ty: Self::Type, then_value: impl FnOnce(&mut Self) -> Self::Value, else_value: impl FnOnce(&mut Self) -> Self::Value, ) -> Self::Value
fn iadd(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn isub(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn imul(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn udiv(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn sdiv(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn urem(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn srem(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn iadd_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value
fn isub_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value
fn imul_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value
fn uadd_overflow( &mut self, lhs: Self::Value, rhs: Self::Value, ) -> (Self::Value, Self::Value)
fn usub_overflow( &mut self, lhs: Self::Value, rhs: Self::Value, ) -> (Self::Value, Self::Value)
fn uadd_sat(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn umax(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn umin(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn bswap(&mut self, value: Self::Value) -> Self::Value
fn bitor(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn bitand(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn bitxor(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn bitnot(&mut self, value: Self::Value) -> Self::Value
fn clz(&mut self, value: Self::Value) -> Self::Value
fn bitor_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value
fn bitand_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value
fn bitxor_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value
fn ishl(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn ushr(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn sshr(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value
fn zext(&mut self, ty: Self::Type, value: Self::Value) -> Self::Value
fn sext(&mut self, ty: Self::Type, value: Self::Value) -> Self::Value
fn ireduce(&mut self, to: Self::Type, value: Self::Value) -> Self::Value
Sourcefn inttoptr(&mut self, value: Self::Value, ty: Self::Type) -> Self::Value
fn inttoptr(&mut self, value: Self::Value, ty: Self::Type) -> Self::Value
Converts an integer value to a pointer.
fn gep( &mut self, ty: Self::Type, ptr: Self::Value, indexes: &[Self::Value], name: &str, ) -> Self::Value
fn tail_call( &mut self, function: Self::Function, args: &[Self::Value], tail_call: TailCallKind, ) -> Option<Self::Value>
Sourcefn is_compile_time_known(&mut self, value: Self::Value) -> Option<Self::Value>
fn is_compile_time_known(&mut self, value: Self::Value) -> Option<Self::Value>
Returns Some(is_value_compile_time), or None if unsupported.
fn memcpy(&mut self, dst: Self::Value, src: Self::Value, len: Self::Value)
fn unreachable(&mut self)
fn get_or_build_function( &mut self, name: &str, params: &[Self::Type], ret: Option<Self::Type>, linkage: Linkage, build: impl FnOnce(&mut Self), ) -> Self::Function
fn get_function(&mut self, name: &str) -> Option<Self::Function>
fn get_printf_function(&mut self) -> Self::Function
Sourcefn add_function(
&mut self,
name: &str,
params: &[Self::Type],
ret: Option<Self::Type>,
address: Option<usize>,
linkage: Linkage,
call_conv: CallConv,
) -> Self::Function
fn add_function( &mut self, name: &str, params: &[Self::Type], ret: Option<Self::Type>, address: Option<usize>, linkage: Linkage, call_conv: CallConv, ) -> Self::Function
Adds a function to the module that’s located at address.
If address is None, the function must be built.
Sourcefn add_function_attribute(
&mut self,
function: Option<Self::Function>,
attribute: Attribute,
loc: FunctionAttributeLocation,
)
fn add_function_attribute( &mut self, function: Option<Self::Function>, attribute: Attribute, loc: FunctionAttributeLocation, )
Adds an attribute to a function, one of its parameters, or its return value.
If function is None, the attribute is added to the current function.
Provided Methods§
Sourcefn set_debug_location(&mut self, _line: u32, _col: u32)
fn set_debug_location(&mut self, _line: u32, _col: u32)
Sets the current debug source location for subsequently emitted instructions.
Sourcefn clear_debug_location(&mut self)
fn clear_debug_location(&mut self)
Clears the current debug source location.
fn cstr_const(&mut self, value: &CStr) -> Self::Value
fn new_stack_slot(&mut self, ty: Self::Type, name: &str) -> Pointer<Self>
fn assume(&mut self, cond: Self::Value)
fn brif_cold( &mut self, cond: Self::Value, then_block: Self::BasicBlock, else_block: Self::BasicBlock, then_is_cold: bool, )
fn call( &mut self, function: Self::Function, args: &[Self::Value], ) -> Option<Self::Value>
fn memcpy_inline(&mut self, dst: Self::Value, src: Self::Value, len: i64)
Sourcefn add_function_stub(
&mut self,
function: Self::Function,
call_conv: CallConv,
) -> Self::Function
fn add_function_stub( &mut self, function: Self::Function, call_conv: CallConv, ) -> Self::Function
Adds a local stub with the given calling convention for an existing function.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.