pub struct EvmLlvmBuilder<'a> {
pub(crate) backend: &'a mut EvmLlvmBackend,
pub(crate) function: FunctionValue<'static>,
pub(crate) debug_scope: Option<DISubprogram<'static>>,
}Expand description
The LLVM-based EVM bytecode compiler function builder.
Fields§
§backend: &'a mut EvmLlvmBackend§function: FunctionValue<'static>§debug_scope: Option<DISubprogram<'static>>Implementations§
Source§impl EvmLlvmBuilder<'_>
impl EvmLlvmBuilder<'_>
pub(crate) fn extract_value( &mut self, value: BasicValueEnum<'static>, index: u32, name: &str, ) -> BasicValueEnum<'static>
pub(crate) fn memcpy_inner( &mut self, dst: BasicValueEnum<'static>, src: BasicValueEnum<'static>, len: BasicValueEnum<'static>, inline: bool, )
pub(crate) fn call_overflow_function( &mut self, name: &str, lhs: BasicValueEnum<'static>, rhs: BasicValueEnum<'static>, ) -> (BasicValueEnum<'static>, BasicValueEnum<'static>)
pub(crate) fn get_overflow_function( &mut self, name: &str, ty: BasicTypeEnum<'static>, ) -> FunctionValue<'static>
pub(crate) fn get_sat_function( &mut self, name: &str, ty: BasicTypeEnum<'static>, ) -> FunctionValue<'static>
pub(crate) fn get_or_add_function( &mut self, name: &str, mk_ty: impl FnOnce(&mut Self) -> FunctionType<'static>, ) -> FunctionValue<'static>
pub(crate) fn set_branch_weights( &self, inst: InstructionValue<'static>, weights: impl IntoIterator<Item = u32>, )
pub(crate) fn assume_inner( &mut self, cond: BasicValueEnum<'static>, ) -> CallSiteValue<'static>
Methods from Deref<Target = EvmLlvmBackend>§
pub(crate) fn module(&self) -> &Module<'static>
pub(crate) fn ensure_orc(&mut self) -> Result<&mut OrcJitState>
pub(crate) fn fn_type( &self, ret: Option<BasicTypeEnum<'static>>, params: &[BasicTypeEnum<'static>], ) -> FunctionType<'static>
Sourcepub(crate) fn name<'a>(&self, name: &'a str) -> &'a str
pub(crate) fn name<'a>(&self, name: &'a str) -> &'a str
Returns the given name if IR output is being dumped, otherwise an empty string. LLVM skips internal name processing for empty names, avoiding overhead when names are not needed for readability.
pub(crate) fn id_to_name(&self, id: u32) -> &str
Sourcepub(crate) fn ensure_di_state(&mut self)
pub(crate) fn ensure_di_state(&mut self)
Lazily initializes the debug info builder and compile unit for the module.
Sourcepub(crate) fn commit_staged_module(&mut self) -> Result<()>
pub(crate) fn commit_staged_module(&mut self) -> Result<()>
Commits the current staging module to the ORC JIT if there are pending functions.
Sourcepub(crate) fn reset_jit(&mut self) -> Result<()>
pub(crate) fn reset_jit(&mut self) -> Result<()>
Clears all code from this compiler’s JITDylib, freeing JIT-compiled code. The LLVM context and global LLJIT are reused across resets.
Sourcepub fn take_last_resource_tracker(&mut self) -> Option<ResourceTracker>
pub fn take_last_resource_tracker(&mut self) -> Option<ResourceTracker>
Pops and returns the ResourceTracker for the last committed
JIT module.
Each call to jit_function commits a module
with its own tracker. The caller takes ownership and is responsible for calling
tracker.remove() to free the machine code when it is no longer needed.
The caller must also hold a JitDylibGuard to prevent the owning JITDylib from
being recycled before the tracker is removed.
Returns None in AOT mode or if no modules have been committed.
Sourcepub fn jit_dylib_guard(&self) -> Arc<JitDylibGuard>
pub fn jit_dylib_guard(&self) -> Arc<JitDylibGuard>
Returns a shared handle that keeps this backend’s JITDylib alive.
The JITDylib will not be cleared or recycled until all JitDylibGuard handles
(and the backend itself) are dropped. Callers holding JIT function pointers must
retain a guard to prevent the backing code from being freed.
Trait Implementations§
Source§impl BackendTypes for EvmLlvmBuilder<'_>
impl BackendTypes for EvmLlvmBuilder<'_>
type Type = <EvmLlvmBackend as BackendTypes>::Type
type Value = <EvmLlvmBackend as BackendTypes>::Value
type StackSlot = <EvmLlvmBackend as BackendTypes>::StackSlot
type BasicBlock = <EvmLlvmBackend as BackendTypes>::BasicBlock
type Function = <EvmLlvmBackend as BackendTypes>::Function
Source§impl Builder for EvmLlvmBuilder<'_>
impl Builder for EvmLlvmBuilder<'_>
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)
Source§fn set_debug_location(&mut self, line: u32, col: u32)
fn set_debug_location(&mut self, line: u32, col: u32)
Source§fn clear_debug_location(&mut self)
fn clear_debug_location(&mut self)
fn fn_param(&mut self, index: usize) -> Self::Value
fn num_fn_params(&self) -> usize
fn bool_const(&mut self, value: bool) -> Self::Value
Source§fn iconst(&mut self, ty: Self::Type, value: i64) -> Self::Value
fn iconst(&mut self, ty: Self::Type, value: i64) -> Self::Value
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
Source§fn 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
Source§fn 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
Source§fn store(&mut self, value: Self::Value, ptr: Self::Value)
fn store(&mut self, value: Self::Value, ptr: Self::Value)
Source§fn 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)
fn nop(&mut self)
fn ret(&mut self, values: &[Self::Value])
fn assume(&mut self, cond: 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 brif_cold( &mut self, cond: Self::Value, then_block: Self::BasicBlock, else_block: Self::BasicBlock, then_is_cold: bool, )
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
Source§fn inttoptr(&mut self, value: Self::Value, ty: Self::Type) -> Self::Value
fn inttoptr(&mut self, value: Self::Value, ty: Self::Type) -> Self::Value
fn gep( &mut self, elem_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>
Source§fn 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>
Some(is_value_compile_time), or None if unsupported.fn memcpy(&mut self, dst: Self::Value, src: Self::Value, len: Self::Value)
fn memcpy_inline(&mut self, dst: Self::Value, src: Self::Value, len: i64)
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
Source§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( &mut self, name: &str, params: &[Self::Type], ret: Option<Self::Type>, address: Option<usize>, linkage: Linkage, call_conv: CallConv, ) -> Self::Function
address. Read moreSource§fn 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
Source§fn 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, )
fn cstr_const(&mut self, value: &CStr) -> Self::Value
fn new_stack_slot(&mut self, ty: Self::Type, name: &str) -> Pointer<Self>
fn call( &mut self, function: Self::Function, args: &[Self::Value], ) -> Option<Self::Value>
Source§impl<'a> Debug for EvmLlvmBuilder<'a>
impl<'a> Debug for EvmLlvmBuilder<'a>
Source§impl Deref for EvmLlvmBuilder<'_>
impl Deref for EvmLlvmBuilder<'_>
Source§impl DerefMut for EvmLlvmBuilder<'_>
impl DerefMut for EvmLlvmBuilder<'_>
Source§impl TypeMethods for EvmLlvmBuilder<'_>
impl TypeMethods for EvmLlvmBuilder<'_>
Auto Trait Implementations§
impl<'a> Freeze for EvmLlvmBuilder<'a>
impl<'a> !RefUnwindSafe for EvmLlvmBuilder<'a>
impl<'a> !Send for EvmLlvmBuilder<'a>
impl<'a> !Sync for EvmLlvmBuilder<'a>
impl<'a> Unpin for EvmLlvmBuilder<'a>
impl<'a> UnsafeUnpin for EvmLlvmBuilder<'a>
impl<'a> !UnwindSafe for EvmLlvmBuilder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes