pub trait CompilerBuilder: Send + Sync + Debug {
    fn target(&mut self, target: Triple) -> Result<()>;
fn triple(&self) -> &Triple;
fn set(&mut self, name: &str, val: &str) -> Result<()>;
fn enable(&mut self, name: &str) -> Result<()>;
fn settings(&self) -> Vec<Setting>;
fn enable_incremental_compilation(
        &mut self,
        cache_store: Arc<dyn CacheStore>
    );
fn build(&self) -> Result<Box<dyn Compiler>>; }
Expand description

Abstract trait representing the ability to create a Compiler below.

This is used in Wasmtime to separate compiler implementations, currently mostly used to separate Cranelift from Wasmtime itself.

Required methods

Sets the target of compilation to the target specified.

Returns the currently configured target triple that compilation will produce artifacts for.

Compiler-specific method to configure various settings in the compiler itself.

This is expected to be defined per-compiler. Compilers should return errors for unknown names/values.

Compiler-specific method for configuring settings.

Same as CompilerBuilder::set except for enabling boolean flags. Currently cranelift uses this to sometimes enable a family of settings.

Returns a list of all possible settings that can be configured with CompilerBuilder::set and CompilerBuilder::enable.

Enables Cranelift’s incremental compilation cache, using the given CacheStore implementation.

Builds a new Compiler object from this configuration.

Implementors