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>
impl<'ctx> EvmLlvmBackend<'ctx>
Sourcepub fn new(
cx: &'ctx Context,
aot: bool,
opt_level: OptimizationLevel,
) -> Result<Self>
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.
Sourcepub fn new_for_target(
cx: &'ctx Context,
aot: bool,
opt_level: OptimizationLevel,
target: &Target,
) -> Result<Self>
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.
pub(crate) fn exec_engine(&self) -> &ExecutionEngine<'ctx>
pub(crate) fn fn_type( &self, ret: Option<BasicTypeEnum<'ctx>>, params: &[BasicTypeEnum<'ctx>], ) -> FunctionType<'ctx>
pub(crate) fn id_to_name(&self, id: u32) -> &str
pub(crate) fn clear_module(&mut self)
Trait Implementations§
Source§impl<'ctx> Backend for EvmLlvmBackend<'ctx>
impl<'ctx> Backend for EvmLlvmBackend<'ctx>
type Builder<'a> = EvmLlvmBuilder<'a, 'ctx> where Self: 'a
type FuncId = u32
fn ir_extension(&self) -> &'static str
fn set_module_name(&mut self, name: &str)
fn set_is_dumping(&mut self, yes: bool)
fn set_debug_assertions(&mut self, yes: bool)
fn opt_level(&self) -> OptimizationLevel
fn set_opt_level(&mut self, level: OptimizationLevel)
fn is_aot(&self) -> bool
fn function_name_is_unique(&self, name: &str) -> bool
fn dump_ir(&mut self, path: &Path) -> Result<()>
fn dump_disasm(&mut self, path: &Path) -> Result<()>
fn build_function( &mut self, name: &str, ret: Option<Self::Type>, params: &[Self::Type], param_names: &[&str], linkage: Linkage, ) -> Result<(Self::Builder<'_>, Self::FuncId)>
fn verify_module(&mut self) -> Result<()>
fn optimize_module(&mut self) -> Result<()>
fn write_object<W: Write>(&mut self, w: W) -> Result<()>
fn jit_function(&mut self, id: Self::FuncId) -> Result<usize>
unsafe fn free_function(&mut self, id: Self::FuncId) -> Result<()>
unsafe fn free_all_functions(&mut self) -> Result<()>
Source§impl<'ctx> BackendTypes for EvmLlvmBackend<'ctx>
impl<'ctx> BackendTypes for EvmLlvmBackend<'ctx>
Source§impl<'ctx> Debug for EvmLlvmBackend<'ctx>
impl<'ctx> Debug for EvmLlvmBackend<'ctx>
Source§impl Drop for EvmLlvmBackend<'_>
impl Drop for EvmLlvmBackend<'_>
Source§impl TypeMethods for EvmLlvmBackend<'_>
impl TypeMethods for EvmLlvmBackend<'_>
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> 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
Mutably borrows from an owned value. Read more
§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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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§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: 272 bytes