Skip to main content

WriteBackendMethods

Trait WriteBackendMethods 

Source
pub trait WriteBackendMethods: Clone + 'static {
    type Module: Send + Sync;
    type TargetMachine;
    type ModuleBuffer: ModuleBufferMethods;
    type ThinData: Send + Sync;

    // Required methods
    fn target_machine_factory(
        &self,
        sess: &Session,
        opt_level: OptLevel,
        target_features: &[String],
    ) -> TargetMachineFactoryFn<Self>;
    fn optimize_and_codegen_fat_lto(
        cgcx: &CodegenContext,
        prof: &SelfProfilerRef,
        shared_emitter: &SharedEmitter,
        tm_factory: TargetMachineFactoryFn<Self>,
        exported_symbols_for_lto: &[String],
        each_linked_rlib_for_lto: &[PathBuf],
        modules: Vec<FatLtoInput<Self>>,
    ) -> CompiledModule;
    fn run_thin_lto(
        cgcx: &CodegenContext,
        prof: &SelfProfilerRef,
        dcx: DiagCtxtHandle<'_>,
        exported_symbols_for_lto: &[String],
        each_linked_rlib_for_lto: &[PathBuf],
        modules: Vec<(String, Self::ModuleBuffer)>,
        cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>,
    ) -> (Vec<ThinModule<Self>>, Vec<WorkProduct>);
    fn optimize(
        cgcx: &CodegenContext,
        prof: &SelfProfilerRef,
        shared_emitter: &SharedEmitter,
        module: &mut ModuleCodegen<Self::Module>,
        config: &ModuleConfig,
    );
    fn optimize_and_codegen_thin(
        cgcx: &CodegenContext,
        prof: &SelfProfilerRef,
        shared_emitter: &SharedEmitter,
        tm_factory: TargetMachineFactoryFn<Self>,
        thin: ThinModule<Self>,
    ) -> CompiledModule;
    fn codegen(
        cgcx: &CodegenContext,
        prof: &SelfProfilerRef,
        shared_emitter: &SharedEmitter,
        module: ModuleCodegen<Self::Module>,
        config: &ModuleConfig,
    ) -> CompiledModule;
    fn serialize_module(
        module: Self::Module,
        is_thin: bool,
    ) -> Self::ModuleBuffer;

    // Provided method
    fn thread_profiler() -> Box<dyn Any> { ... }
}

Required Associated Types§

Required Methods§

Source

fn target_machine_factory( &self, sess: &Session, opt_level: OptLevel, target_features: &[String], ) -> TargetMachineFactoryFn<Self>

Source

fn optimize_and_codegen_fat_lto( cgcx: &CodegenContext, prof: &SelfProfilerRef, shared_emitter: &SharedEmitter, tm_factory: TargetMachineFactoryFn<Self>, exported_symbols_for_lto: &[String], each_linked_rlib_for_lto: &[PathBuf], modules: Vec<FatLtoInput<Self>>, ) -> CompiledModule

Performs fat LTO by merging all modules into a single one, running autodiff if necessary and running any further optimizations

Source

fn run_thin_lto( cgcx: &CodegenContext, prof: &SelfProfilerRef, dcx: DiagCtxtHandle<'_>, exported_symbols_for_lto: &[String], each_linked_rlib_for_lto: &[PathBuf], modules: Vec<(String, Self::ModuleBuffer)>, cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>, ) -> (Vec<ThinModule<Self>>, Vec<WorkProduct>)

Performs thin LTO by performing necessary global analysis and returning two lists, one of the modules that need optimization and another for modules that can simply be copied over from the incr. comp. cache.

Source

fn optimize( cgcx: &CodegenContext, prof: &SelfProfilerRef, shared_emitter: &SharedEmitter, module: &mut ModuleCodegen<Self::Module>, config: &ModuleConfig, )

Source

fn optimize_and_codegen_thin( cgcx: &CodegenContext, prof: &SelfProfilerRef, shared_emitter: &SharedEmitter, tm_factory: TargetMachineFactoryFn<Self>, thin: ThinModule<Self>, ) -> CompiledModule

Source

fn codegen( cgcx: &CodegenContext, prof: &SelfProfilerRef, shared_emitter: &SharedEmitter, module: ModuleCodegen<Self::Module>, config: &ModuleConfig, ) -> CompiledModule

Source

fn serialize_module(module: Self::Module, is_thin: bool) -> Self::ModuleBuffer

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§