pub trait CompilerBuilder: Send + Sync + Debug {
    // Required methods
    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>
    ) -> Result<()>;
    fn set_tunables(&mut self, tunables: Tunables) -> Result<()>;
    fn build(&self) -> Result<Box<dyn Compiler>>;

    // Provided methods
    fn clif_dir(&mut self, _path: &Path) -> Result<()> { ... }
    fn wmemcheck(&mut self, _enable: bool) { ... }
}
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§

source

fn target(&mut self, target: Triple) -> Result<()>

Sets the target of compilation to the target specified.

source

fn triple(&self) -> &Triple

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

source

fn set(&mut self, name: &str, val: &str) -> Result<()>

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.

source

fn enable(&mut self, name: &str) -> Result<()>

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.

source

fn settings(&self) -> Vec<Setting>

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

source

fn enable_incremental_compilation( &mut self, cache_store: Arc<dyn CacheStore> ) -> Result<()>

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

This will return an error if the compiler does not support incremental compilation.

source

fn set_tunables(&mut self, tunables: Tunables) -> Result<()>

Set the tunables for this compiler.

source

fn build(&self) -> Result<Box<dyn Compiler>>

Builds a new Compiler object from this configuration.

Provided Methods§

source

fn clif_dir(&mut self, _path: &Path) -> Result<()>

Enables clif output in the directory specified.

source

fn wmemcheck(&mut self, _enable: bool)

Enables or disables wmemcheck during runtime according to the wmemcheck CLI flag.

Implementors§