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§
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
Required Methods§
fn ir_extension(&self) -> &'static str
fn set_module_name(&mut self, name: &str)
Sourcefn config(&self) -> &BackendConfig
fn config(&self) -> &BackendConfig
Returns the current backend configuration.
Sourcefn apply_config(&mut self, config: BackendConfig)
fn apply_config(&mut self, config: BackendConfig)
Applies the given configuration snapshot.
Backends should apply any side-effects (e.g. toggling ASM verbosity) here.
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>
Sourcefn function_name(&self, id: Self::FuncId) -> Option<&str>
fn function_name(&self, id: Self::FuncId) -> Option<&str>
Returns the name of a compiled function by its ID.
Sourcefn clear_ir(&mut self) -> Result<()>
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.
unsafe fn free_function(&mut self, id: Self::FuncId) -> Result<()>
unsafe fn free_all_functions(&mut self) -> Result<()>
Provided Methods§
Sourcefn finalize_debug_info(&mut self) -> Result<()>
fn finalize_debug_info(&mut self) -> Result<()>
Finalizes any pending debug info metadata.
Must be called before verification, optimization, or code emission.
Sourcefn function_sizes(&self) -> Vec<(String, usize)>
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".