pub struct EvmLlvmBackend {Show 20 fields
pub(crate) cx: &'static Context,
pub(crate) _dh: DiagnosticHandlerGuard,
pub(crate) bcx: Builder<'static>,
pub(crate) module: Module<'static>,
pub(crate) exec_engine: Option<ExecutionEngine<'static>>,
pub(crate) machine: TargetMachine,
pub(crate) ty_void: VoidType<'static>,
pub(crate) ty_ptr: PointerType<'static>,
pub(crate) ty_i1: IntType<'static>,
pub(crate) ty_i8: IntType<'static>,
pub(crate) ty_i32: IntType<'static>,
pub(crate) ty_i64: IntType<'static>,
pub(crate) ty_i256: IntType<'static>,
pub(crate) ty_isize: IntType<'static>,
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<'static>)>,
pub(crate) mapped_symbols: FxHashSet<String>,
}Expand description
The LLVM-based EVM bytecode compiler backend.
Fields§
§cx: &'static Context§_dh: DiagnosticHandlerGuard§bcx: Builder<'static>§module: Module<'static>§exec_engine: Option<ExecutionEngine<'static>>§machine: TargetMachine§ty_void: VoidType<'static>§ty_ptr: PointerType<'static>§ty_i1: IntType<'static>§ty_i8: IntType<'static>§ty_i32: IntType<'static>§ty_i64: IntType<'static>§ty_i256: IntType<'static>§ty_isize: IntType<'static>§aot: bool§debug_assertions: bool§opt_level: OptimizationLevel§function_counter: u32Separate from functions to have always increasing IDs.
functions: FxHashMap<u32, (String, FunctionValue<'static>)>§mapped_symbols: FxHashSet<String>Symbol names that have been registered via add_global_mapping in the MCJIT engine.
Used to avoid re-registering builtins when a new module is created after clear_ir.
Implementations§
Source§impl EvmLlvmBackend
impl EvmLlvmBackend
Sourcepub fn new(aot: bool, opt_level: OptimizationLevel) -> Result<Self>
pub fn new(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(
aot: bool,
opt_level: OptimizationLevel,
target: &Target,
) -> Result<Self>
pub fn new_for_target( 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<'static>
pub(crate) fn fn_type( &self, ret: Option<BasicTypeEnum<'static>>, params: &[BasicTypeEnum<'static>], ) -> FunctionType<'static>
pub(crate) fn id_to_name(&self, id: u32) -> &str
pub(crate) fn clear_module(&mut self) -> Result<()>
Trait Implementations§
Source§impl Backend for EvmLlvmBackend
impl Backend for EvmLlvmBackend
type Builder<'a> = EvmLlvmBuilder<'a> 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>
Source§fn clear_ir(&mut self) -> Result<()>
fn clear_ir(&mut self) -> Result<()>
Clears the IR module, freeing memory used by IR representations. Read more
unsafe fn free_function(&mut self, id: Self::FuncId) -> Result<()>
unsafe fn free_all_functions(&mut self) -> Result<()>
Source§impl BackendTypes for EvmLlvmBackend
impl BackendTypes for EvmLlvmBackend
Source§impl Debug for EvmLlvmBackend
impl Debug for EvmLlvmBackend
Source§impl Drop for EvmLlvmBackend
impl Drop for EvmLlvmBackend
Source§impl TypeMethods for EvmLlvmBackend
impl TypeMethods for EvmLlvmBackend
impl Send for EvmLlvmBackend
Auto Trait Implementations§
impl !Freeze for EvmLlvmBackend
impl !RefUnwindSafe for EvmLlvmBackend
impl !Sync for EvmLlvmBackend
impl Unpin for EvmLlvmBackend
impl UnsafeUnpin for EvmLlvmBackend
impl UnwindSafe for EvmLlvmBackend
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>
§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: 304 bytes