Skip to main content

CodegenBackend

Trait CodegenBackend 

Source
pub trait CodegenBackend {
Show 18 methods // Required methods fn name(&self) -> &'static str; fn target_cpu(&self, sess: &Session) -> String; fn codegen_crate<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Box<dyn Any>; fn join_codegen( &self, ongoing_codegen: Box<dyn Any>, sess: &Session, incr_comp_session: Option<&IncrCompSession>, outputs: &OutputFilenames, crate_info: &CrateInfo, ) -> (CompiledModules, WorkProductMap); // Provided methods fn init(&mut self, _sess: &EarlySession) -> CodegenBackendInit { ... } fn print(&self, _req: &PrintRequest, _out: &mut String, _sess: &Session) { ... } fn target_config(&self, _sess: &EarlySession) -> TargetConfig { ... } fn supported_crate_types(&self, _sess: &Session) -> Vec<CrateType> { ... } fn print_passes(&self) { ... } fn print_version(&self) { ... } fn has_zstd(&self) -> bool { ... } fn has_mnemonic(&self, _sess: &Session, _mnemonic: &str) -> bool { ... } fn metadata_loader(&self) -> Box<MetadataLoaderDyn> { ... } fn provide(&self, _providers: &mut Providers) { ... } fn print_pass_timings(&self) { ... } fn print_statistics(&self) { ... } fn print_statistics_json(&self) -> String { ... } fn link( &self, sess: &Session, compiled_modules: CompiledModules, crate_info: CrateInfo, metadata: EncodedMetadata, outputs: &OutputFilenames, ) { ... }
}

Required Methods§

Source

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

Source

fn target_cpu(&self, sess: &Session) -> String

Source

fn codegen_crate<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Box<dyn Any>

Source

fn join_codegen( &self, ongoing_codegen: Box<dyn Any>, sess: &Session, incr_comp_session: Option<&IncrCompSession>, outputs: &OutputFilenames, crate_info: &CrateInfo, ) -> (CompiledModules, WorkProductMap)

This is called on the returned Box<dyn Any> from codegen_crate

§Panics

Panics when the passed Box<dyn Any> was not returned by codegen_crate.

Provided Methods§

Source

fn init(&mut self, _sess: &EarlySession) -> CodegenBackendInit

Source

fn print(&self, _req: &PrintRequest, _out: &mut String, _sess: &Session)

Source

fn target_config(&self, _sess: &EarlySession) -> TargetConfig

Collect target-specific options that should be set in cfg(...), including target_feature and support for unstable float types.

Source

fn supported_crate_types(&self, _sess: &Session) -> Vec<CrateType>

Source

fn print_passes(&self)

Source

fn print_version(&self)

Source

fn has_zstd(&self) -> bool

Value printed by --print=backend-has-zstd.

Used by compiletest to determine whether tests involving zstd compression (e.g. -Zdebuginfo-compression=zstd) should be executed or skipped.

Source

fn has_mnemonic(&self, _sess: &Session, _mnemonic: &str) -> bool

Value printed by --print=backend-has-mnemonic:....

Used by compiletest to determine whether tests involving asm!() should be executed or skipped.

Source

fn metadata_loader(&self) -> Box<MetadataLoaderDyn>

The metadata loader used to load rlib and dylib metadata.

Alternative codegen backends may want to use different rlib or dylib formats than the default native static archives and dynamic libraries.

Source

fn provide(&self, _providers: &mut Providers)

Allows queries to be overridden. Not used by any in-tree backends, but rustc_codegen_spirv and rustc_codegen_nvvm use it.

Source

fn print_pass_timings(&self)

Source

fn print_statistics(&self)

Source

fn print_statistics_json(&self) -> String

This is called on the returned CompiledModules from join_codegen.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§