pub fn start_codegen<'tcx>(
    codegen_backend: &dyn CodegenBackend,
    tcx: TyCtxt<'tcx>,
    outputs: &OutputFilenames,
) -> Box<dyn Any> {
    if log_enabled!(::log::Level::Info) {
        println!("Pre-codegen");
        tcx.print_debug_stats();
    }

    let (metadata, need_metadata_module) = encode_and_write_metadata(tcx, outputs);

    let codegen = tcx.sess.time("codegen_crate", move || {
        codegen_backend.codegen_crate(tcx, metadata, need_metadata_module)
    });

    if log_enabled!(::log::Level::Info) {
        println!("Post-codegen");
        tcx.print_debug_stats();
    }

    if tcx.sess.opts.output_types.contains_key(&OutputType::Mir) {
        if let Err(e) = mir::transform::dump_mir::emit_mir(tcx, outputs) {
            tcx.sess.err(&format!("could not emit MIR: {}", e));
            tcx.sess.abort_if_errors();
        }
    }

    codegen
}
/// Runs the codegen backend, after which the AST and analysis can
/// be discarded.
Runs the codegen backend, after which the AST and analysis can
be discarded.
Runs the codegen backend after which the AST and analysis can be discarded .
pub fn start_codegen<'tcx>(
    codegen_backend: &dyn CodegenBackend,
    tcx: TyCtxt<'tcx>,
    outputs: &OutputFilenames,
) -> Box<dyn Any> {
    if log_enabled!(::log::Level::Info) {
        println!("Pre-codegen");
        tcx.print_debug_stats();
    }
    let (metadata, need_metadata_module) = encode_and_write_metadata(tcx, outputs);
    let codegen = tcx.sess.time("codegen_crate", move || {
        codegen_backend.codegen_crate(tcx, metadata, need_metadata_module)
    });
    if log_enabled!(::log::Level::Info) {
        println!("Post-codegen");
        tcx.print_debug_stats();
    }
    if tcx.sess.opts.output_types.contains_key(&OutputType::Mir) {
        if let Err(e) = mir::transform::dump_mir::emit_mir(tcx, outputs) {
            tcx.sess.err(&format!("could not emit MIR: {}", e));
            tcx.sess.abort_if_errors();
        }
    }
    codegen
}
pub fn start_codegen < ' tcx > ( codegen_backend : & dyn CodegenBackend , tcx : TyCtxt < ' tcx > , outputs : & OutputFilenames , ) -> Box < dyn Any > { if log_enabled ! ( log Level Info ) { println ! ( " " ) ; tcx . print_debug_stats ( ) ; } let ( metadata , need_metadata_module ) = encode_and_write_metadata ( tcx , outputs ) ; let codegen = tcx . sess . time ( " " , move | | { codegen_backend . codegen_crate ( tcx , metadata , need_metadata_module ) } ) ; if log_enabled ! ( log Level Info ) { println ! ( " " ) ; tcx . print_debug_stats ( ) ; } if tcx . sess . opts . output_types . contains_key ( & OutputType :: Mir ) { if let Err ( e ) = mir :: transform :: dump_mir :: emit_mir ( tcx , outputs ) { tcx . sess . err ( & format ! ( " " e ) ) ; tcx . sess . abort_if_errors ( ) ; } } codegen }
Runs the codegen backend, after which the AST and analysis can
be discarded.
Runs the codegen backend after which the AST and analysis can be discarded .
codegen_backend
&dyn CodegenBackend
tcx
TyCtxt<'tcx>
outputs
&OutputFilenames
codegen_backend
&dyn CodegenBackend
tcx
TyCtxt<'tcx>
outputs
&OutputFilenames