Trait cranelift_module::Backend[][src]

pub trait Backend where
    Self: Sized
{ type Builder; type CompiledFunction; type CompiledData; type FinalizedFunction; type FinalizedData; type Product; fn new(_: Self::Builder) -> Self;
fn isa(&self) -> &TargetIsa;
fn declare_function(&mut self, name: &str, linkage: Linkage);
fn declare_data(&mut self, name: &str, linkage: Linkage, writable: bool);
fn define_function(
        &mut self,
        name: &str,
        ctx: &Context,
        namespace: &ModuleNamespace<Self>,
        code_size: u32
    ) -> ModuleResult<Self::CompiledFunction>;
fn define_data(
        &mut self,
        name: &str,
        data_ctx: &DataContext,
        namespace: &ModuleNamespace<Self>
    ) -> ModuleResult<Self::CompiledData>;
fn write_data_funcaddr(
        &mut self,
        data: &mut Self::CompiledData,
        offset: usize,
        what: FuncRef
    );
fn write_data_dataaddr(
        &mut self,
        data: &mut Self::CompiledData,
        offset: usize,
        what: GlobalValue,
        addend: Addend
    );
fn finalize_function(
        &mut self,
        func: &Self::CompiledFunction,
        namespace: &ModuleNamespace<Self>
    ) -> Self::FinalizedFunction;
fn finalize_data(
        &mut self,
        data: &Self::CompiledData,
        namespace: &ModuleNamespace<Self>
    ) -> Self::FinalizedData;
fn finish(self) -> Self::Product; }

A Backend implements the functionality needed to support a Module.

Associated Types

A builder for constructing Backend instances.

The results of compiling a function.

The results of "compiling" a data object.

The completed output artifact for a function, if this is meaningful for the Backend.

The completed output artifact for a data object, if this is meaningful for the Backend.

This is an object returned by Module's finish function, if the Backend has a purpose for this.

Required Methods

Create a new Backend instance.

Return the TargetIsa to compile for.

Declare a function.

Declare a data object.

Define a function, producing the function body from the given Context.

Functions must be declared before being defined.

Define a zero-initialized data object of the given size.

Data objects must be declared before being defined.

Write the address of what into the data for data at offset. data must refer to a defined data object.

Write the address of what plus addend into the data for data at offset. data must refer to a defined data object.

Perform all outstanding relocations on the given function. This requires all Local and Export entities referenced to be defined.

Perform all outstanding relocations on the given data object. This requires all Local and Export entities referenced to be defined.

Consume this Backend and return a result. Some implementations may provide additional functionality through this result.

Implementors