Struct EvmLlvmBuilder

Source
pub struct EvmLlvmBuilder<'a, 'ctx> {
    pub(crate) backend: &'a mut EvmLlvmBackend<'ctx>,
    pub(crate) function: FunctionValue<'ctx>,
}
Expand description

The LLVM-based EVM bytecode compiler function builder.

Fields§

§backend: &'a mut EvmLlvmBackend<'ctx>§function: FunctionValue<'ctx>

Implementations§

Source§

impl<'ctx> EvmLlvmBuilder<'_, 'ctx>

Source

pub(crate) fn extract_value( &mut self, value: BasicValueEnum<'ctx>, index: u32, name: &str, ) -> BasicValueEnum<'ctx>

Source

pub(crate) fn memcpy_inner( &mut self, dst: BasicValueEnum<'ctx>, src: BasicValueEnum<'ctx>, len: BasicValueEnum<'ctx>, inline: bool, )

Source

pub(crate) fn call_overflow_function( &mut self, name: &str, lhs: BasicValueEnum<'ctx>, rhs: BasicValueEnum<'ctx>, ) -> (BasicValueEnum<'ctx>, BasicValueEnum<'ctx>)

Source

pub(crate) fn get_overflow_function( &mut self, name: &str, ty: BasicTypeEnum<'ctx>, ) -> FunctionValue<'ctx>

Source

pub(crate) fn get_sat_function( &mut self, name: &str, ty: BasicTypeEnum<'ctx>, ) -> FunctionValue<'ctx>

Source

pub(crate) fn get_or_add_function( &mut self, name: &str, mk_ty: impl FnOnce(&mut Self) -> FunctionType<'ctx>, ) -> FunctionValue<'ctx>

Source

pub(crate) fn set_branch_weights( &self, inst: InstructionValue<'ctx>, weights: impl IntoIterator<Item = u32>, )

Methods from Deref<Target = EvmLlvmBackend<'ctx>>§

Source

pub fn cx(&self) -> &'ctx Context

Returns the LLVM context.

Source

pub(crate) fn exec_engine(&self) -> &ExecutionEngine<'ctx>

Source

pub(crate) fn fn_type( &self, ret: Option<BasicTypeEnum<'ctx>>, params: &[BasicTypeEnum<'ctx>], ) -> FunctionType<'ctx>

Source

pub(crate) fn id_to_name(&self, id: u32) -> &str

Source

pub(crate) fn clear_module(&mut self)

Trait Implementations§

Source§

impl<'ctx> BackendTypes for EvmLlvmBuilder<'_, 'ctx>

Source§

type Type = <EvmLlvmBackend<'ctx> as BackendTypes>::Type

Source§

type Value = <EvmLlvmBackend<'ctx> as BackendTypes>::Value

Source§

type StackSlot = <EvmLlvmBackend<'ctx> as BackendTypes>::StackSlot

Source§

type BasicBlock = <EvmLlvmBackend<'ctx> as BackendTypes>::BasicBlock

Source§

type Function = <EvmLlvmBackend<'ctx> as BackendTypes>::Function

Source§

impl Builder for EvmLlvmBuilder<'_, '_>

Source§

fn create_block(&mut self, name: &str) -> Self::BasicBlock

Source§

fn create_block_after( &mut self, after: Self::BasicBlock, name: &str, ) -> Self::BasicBlock

Source§

fn switch_to_block(&mut self, block: Self::BasicBlock)

Source§

fn seal_block(&mut self, block: Self::BasicBlock)

Source§

fn seal_all_blocks(&mut self)

Source§

fn set_current_block_cold(&mut self)

Source§

fn current_block(&mut self) -> Option<Self::BasicBlock>

Source§

fn block_addr(&mut self, block: Self::BasicBlock) -> Option<Self::Value>

Source§

fn add_comment_to_current_inst(&mut self, comment: &str)

Source§

fn fn_param(&mut self, index: usize) -> Self::Value

Source§

fn num_fn_params(&self) -> usize

Source§

fn bool_const(&mut self, value: bool) -> Self::Value

Source§

fn iconst(&mut self, ty: Self::Type, value: i64) -> Self::Value

Sign-extends negative values to ty.
Source§

fn uconst(&mut self, ty: Self::Type, value: u64) -> Self::Value

Source§

fn iconst_256(&mut self, value: U256) -> Self::Value

Source§

fn str_const(&mut self, value: &str) -> Self::Value

Source§

fn nullptr(&mut self) -> Self::Value

Source§

fn new_stack_slot_raw(&mut self, ty: Self::Type, name: &str) -> Self::StackSlot

Source§

fn stack_load( &mut self, ty: Self::Type, slot: Self::StackSlot, name: &str, ) -> Self::Value

Source§

fn stack_store(&mut self, value: Self::Value, slot: Self::StackSlot)

Source§

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

Source§

fn load_unaligned( &mut self, ty: Self::Type, ptr: Self::Value, name: &str, ) -> Self::Value

Source§

fn store(&mut self, value: Self::Value, ptr: Self::Value)

Source§

fn store_unaligned(&mut self, value: Self::Value, ptr: Self::Value)

Source§

fn nop(&mut self)

Source§

fn ret(&mut self, values: &[Self::Value])

Source§

fn icmp( &mut self, cond: IntCC, lhs: Self::Value, rhs: Self::Value, ) -> Self::Value

Source§

fn icmp_imm(&mut self, cond: IntCC, lhs: Self::Value, rhs: i64) -> Self::Value

Source§

fn is_null(&mut self, ptr: Self::Value) -> Self::Value

Source§

fn is_not_null(&mut self, ptr: Self::Value) -> Self::Value

Source§

fn br(&mut self, dest: Self::BasicBlock)

Source§

fn brif( &mut self, cond: Self::Value, then_block: Self::BasicBlock, else_block: Self::BasicBlock, )

Source§

fn brif_cold( &mut self, cond: Self::Value, then_block: Self::BasicBlock, else_block: Self::BasicBlock, then_is_cold: bool, )

Source§

fn switch( &mut self, index: Self::Value, default: Self::BasicBlock, targets: &[(u64, Self::BasicBlock)], default_is_cold: bool, )

Source§

fn br_indirect( &mut self, address: Self::Value, destinations: &[Self::BasicBlock], )

Source§

fn phi( &mut self, ty: Self::Type, incoming: &[(Self::Value, Self::BasicBlock)], ) -> Self::Value

Source§

fn select( &mut self, cond: Self::Value, then_value: Self::Value, else_value: Self::Value, ) -> Self::Value

Source§

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

Source§

fn iadd(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn isub(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn imul(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn udiv(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn sdiv(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn urem(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn srem(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn iadd_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value

Source§

fn isub_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value

Source§

fn imul_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value

Source§

fn uadd_overflow( &mut self, lhs: Self::Value, rhs: Self::Value, ) -> (Self::Value, Self::Value)

Source§

fn usub_overflow( &mut self, lhs: Self::Value, rhs: Self::Value, ) -> (Self::Value, Self::Value)

Source§

fn uadd_sat(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn umax(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn umin(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn bswap(&mut self, value: Self::Value) -> Self::Value

Source§

fn bitor(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn bitand(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn bitxor(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn bitnot(&mut self, value: Self::Value) -> Self::Value

Source§

fn bitor_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value

Source§

fn bitand_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value

Source§

fn bitxor_imm(&mut self, lhs: Self::Value, rhs: i64) -> Self::Value

Source§

fn ishl(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn ushr(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn sshr(&mut self, lhs: Self::Value, rhs: Self::Value) -> Self::Value

Source§

fn zext(&mut self, ty: Self::Type, value: Self::Value) -> Self::Value

Source§

fn sext(&mut self, ty: Self::Type, value: Self::Value) -> Self::Value

Source§

fn ireduce(&mut self, to: Self::Type, value: Self::Value) -> Self::Value

Source§

fn gep( &mut self, elem_ty: Self::Type, ptr: Self::Value, indexes: &[Self::Value], name: &str, ) -> Self::Value

Source§

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>

Returns Some(is_value_compile_time), or None if unsupported.
Source§

fn memcpy(&mut self, dst: Self::Value, src: Self::Value, len: Self::Value)

Source§

fn memcpy_inline(&mut self, dst: Self::Value, src: Self::Value, len: i64)

Source§

fn unreachable(&mut self)

Source§

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

Source§

fn get_function(&mut self, name: &str) -> Option<Self::Function>

Source§

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, ) -> Self::Function

Adds a function to the module that’s located at address. Read more
Source§

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. Read more
§

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, 'ctx> Debug for EvmLlvmBuilder<'a, 'ctx>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'ctx> Deref for EvmLlvmBuilder<'_, 'ctx>

Source§

type Target = EvmLlvmBackend<'ctx>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for EvmLlvmBuilder<'_, '_>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl TypeMethods for EvmLlvmBuilder<'_, '_>

Source§

fn type_ptr(&self) -> Self::Type

Source§

fn type_ptr_sized_int(&self) -> Self::Type

Source§

fn type_int(&self, bits: u32) -> Self::Type

Source§

fn type_array(&self, ty: Self::Type, size: u32) -> Self::Type

Source§

fn type_bit_width(&self, ty: Self::Type) -> u32

Auto Trait Implementations§

§

impl<'a, 'ctx> Freeze for EvmLlvmBuilder<'a, 'ctx>

§

impl<'a, 'ctx> !RefUnwindSafe for EvmLlvmBuilder<'a, 'ctx>

§

impl<'a, 'ctx> !Send for EvmLlvmBuilder<'a, 'ctx>

§

impl<'a, 'ctx> !Sync for EvmLlvmBuilder<'a, 'ctx>

§

impl<'a, 'ctx> Unpin for EvmLlvmBuilder<'a, 'ctx>

§

impl<'a, 'ctx> !UnwindSafe for EvmLlvmBuilder<'a, 'ctx>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more

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: 16 bytes