Skip to main content

Backend

Trait Backend 

Source
pub trait Backend: BackendTypes + TypeMethods {
    type Builder<'a>: Builder<Type = Self::Type, Value = Self::Value, StackSlot = Self::StackSlot, BasicBlock = Self::BasicBlock, Function = Self::Function>
       where Self: 'a;
    type FuncId: Copy + Eq + Hash + Debug;

Show 19 methods // Required methods fn ir_extension(&self) -> &'static str; fn set_module_name(&mut self, name: &str); fn config(&self) -> &BackendConfig; fn apply_config(&mut self, config: BackendConfig); fn dump_ir(&mut self, path: &Path) -> Result<()>; fn dump_disasm(&mut self, path: &Path) -> Result<()>; fn is_aot(&self) -> bool; fn function_name_is_unique(&self, name: &str) -> bool; 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>; fn function_name(&self, id: Self::FuncId) -> Option<&str>; fn clear_ir(&mut self) -> Result<()>; unsafe fn free_function(&mut self, id: Self::FuncId) -> Result<()>; unsafe fn free_all_functions(&mut self) -> Result<()>; // Provided methods fn finalize_debug_info(&mut self) -> Result<()> { ... } fn function_sizes(&self) -> Vec<(String, usize)> { ... }
}

Required Associated Types§

Source

type Builder<'a>: Builder<Type = Self::Type, Value = Self::Value, StackSlot = Self::StackSlot, BasicBlock = Self::BasicBlock, Function = Self::Function> where Self: 'a

Source

type FuncId: Copy + Eq + Hash + Debug

Required Methods§

Source

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

Source

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

Source

fn config(&self) -> &BackendConfig

Returns the current backend configuration.

Source

fn apply_config(&mut self, config: BackendConfig)

Applies the given configuration snapshot.

Backends should apply any side-effects (e.g. toggling ASM verbosity) here.

Source

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

Source

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

Source

fn is_aot(&self) -> bool

Source

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

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

fn function_name(&self, id: Self::FuncId) -> Option<&str>

Returns the name of a compiled function by its ID.

Source

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

Clears the IR module, freeing memory used by IR representations.

This does not free JIT-compiled machine code, so previously obtained function pointers remain valid. The module is left in a state where new functions can be translated.

Source

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

Source

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

Provided Methods§

Source

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

Finalizes any pending debug info metadata.

Must be called before verification, optimization, or code emission.

Source

fn function_sizes(&self) -> Vec<(String, usize)>

Returns the estimated sizes of compiled functions as (name, size) pairs.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§