Struct EvmLlvmBackend

Source
pub struct EvmLlvmBackend<'ctx> {
Show 19 fields pub(crate) cx: &'ctx Context, pub(crate) _dh: DiagnosticHandlerGuard<'ctx>, pub(crate) bcx: Builder<'ctx>, pub(crate) module: Module<'ctx>, pub(crate) exec_engine: Option<ExecutionEngine<'ctx>>, pub(crate) machine: TargetMachine, pub(crate) ty_void: VoidType<'ctx>, pub(crate) ty_ptr: PointerType<'ctx>, pub(crate) ty_i1: IntType<'ctx>, pub(crate) ty_i8: IntType<'ctx>, pub(crate) ty_i32: IntType<'ctx>, pub(crate) ty_i64: IntType<'ctx>, pub(crate) ty_i256: IntType<'ctx>, pub(crate) ty_isize: IntType<'ctx>, pub(crate) aot: bool, pub(crate) debug_assertions: bool, pub(crate) opt_level: OptimizationLevel, pub(crate) function_counter: u32, pub(crate) functions: FxHashMap<u32, (String, FunctionValue<'ctx>)>,
}
Expand description

The LLVM-based EVM bytecode compiler backend.

Fields§

§cx: &'ctx Context§_dh: DiagnosticHandlerGuard<'ctx>§bcx: Builder<'ctx>§module: Module<'ctx>§exec_engine: Option<ExecutionEngine<'ctx>>§machine: TargetMachine§ty_void: VoidType<'ctx>§ty_ptr: PointerType<'ctx>§ty_i1: IntType<'ctx>§ty_i8: IntType<'ctx>§ty_i32: IntType<'ctx>§ty_i64: IntType<'ctx>§ty_i256: IntType<'ctx>§ty_isize: IntType<'ctx>§aot: bool§debug_assertions: bool§opt_level: OptimizationLevel§function_counter: u32

Separate from functions to have always increasing IDs.

§functions: FxHashMap<u32, (String, FunctionValue<'ctx>)>

Implementations§

Source§

impl<'ctx> EvmLlvmBackend<'ctx>

Source

pub fn new( cx: &'ctx Context, aot: bool, opt_level: OptimizationLevel, ) -> Result<Self>

Creates a new LLVM backend for the host machine.

Use new_for_target to create a backend for a specific target.

Source

pub fn new_for_target( cx: &'ctx Context, aot: bool, opt_level: OptimizationLevel, target: &Target, ) -> Result<Self>

Creates a new LLVM backend for the given target.

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> Backend for EvmLlvmBackend<'ctx>

Source§

type Builder<'a> = EvmLlvmBuilder<'a, 'ctx> where Self: 'a

Source§

type FuncId = u32

Source§

fn ir_extension(&self) -> &'static str

Source§

fn set_module_name(&mut self, name: &str)

Source§

fn set_is_dumping(&mut self, yes: bool)

Source§

fn set_debug_assertions(&mut self, yes: bool)

Source§

fn opt_level(&self) -> OptimizationLevel

Source§

fn set_opt_level(&mut self, level: OptimizationLevel)

Source§

fn is_aot(&self) -> bool

Source§

fn function_name_is_unique(&self, name: &str) -> bool

Source§

fn dump_ir(&mut self, path: &Path) -> Result<()>

Source§

fn dump_disasm(&mut self, path: &Path) -> Result<()>

Source§

fn build_function( &mut self, name: &str, ret: Option<Self::Type>, params: &[Self::Type], param_names: &[&str], linkage: Linkage, ) -> Result<(Self::Builder<'_>, Self::FuncId)>

Source§

fn verify_module(&mut self) -> Result<()>

Source§

fn optimize_module(&mut self) -> Result<()>

Source§

fn write_object<W: Write>(&mut self, w: W) -> Result<()>

Source§

fn jit_function(&mut self, id: Self::FuncId) -> Result<usize>

Source§

unsafe fn free_function(&mut self, id: Self::FuncId) -> Result<()>

Source§

unsafe fn free_all_functions(&mut self) -> Result<()>

Source§

impl<'ctx> BackendTypes for EvmLlvmBackend<'ctx>

Source§

type Type = BasicTypeEnum<'ctx>

Source§

type Value = BasicValueEnum<'ctx>

Source§

type StackSlot = PointerValue<'ctx>

Source§

type BasicBlock = BasicBlock<'ctx>

Source§

type Function = FunctionValue<'ctx>

Source§

impl<'ctx> Debug for EvmLlvmBackend<'ctx>

Source§

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

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

impl Drop for EvmLlvmBackend<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl TypeMethods for EvmLlvmBackend<'_>

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<'ctx> !Freeze for EvmLlvmBackend<'ctx>

§

impl<'ctx> !RefUnwindSafe for EvmLlvmBackend<'ctx>

§

impl<'ctx> !Send for EvmLlvmBackend<'ctx>

§

impl<'ctx> !Sync for EvmLlvmBackend<'ctx>

§

impl<'ctx> Unpin for EvmLlvmBackend<'ctx>

§

impl<'ctx> UnwindSafe for EvmLlvmBackend<'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<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: 272 bytes