Remove TyCtxt parameter from compile_fn
This commit is contained in:
parent
c820b7cd60
commit
df1b25171c
2 changed files with 6 additions and 4 deletions
|
@ -36,7 +36,7 @@ pub(crate) fn codegen_and_compile_fn<'tcx>(
|
|||
let cached_func = std::mem::replace(&mut cached_context.func, Function::new());
|
||||
let codegened_func = codegen_fn(tcx, cx, cached_func, module, instance);
|
||||
|
||||
compile_fn(tcx, cx, cached_context, module, codegened_func);
|
||||
compile_fn(cx, cached_context, module, codegened_func);
|
||||
}
|
||||
|
||||
fn codegen_fn<'tcx>(
|
||||
|
@ -142,7 +142,6 @@ fn codegen_fn<'tcx>(
|
|||
}
|
||||
|
||||
fn compile_fn<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
cx: &mut crate::CodegenCx<'tcx>,
|
||||
cached_context: &mut Context,
|
||||
module: &mut dyn Module,
|
||||
|
@ -193,7 +192,7 @@ fn compile_fn<'tcx>(
|
|||
};
|
||||
|
||||
// Define function
|
||||
tcx.sess.time("define function", || {
|
||||
cx.profiler.verbose_generic_activity("define function").run(|| {
|
||||
context.want_disasm = cx.should_write_ir;
|
||||
module.define_function(codegened_func.func_id, context).unwrap();
|
||||
});
|
||||
|
@ -222,7 +221,7 @@ fn compile_fn<'tcx>(
|
|||
let isa = module.isa();
|
||||
let debug_context = &mut cx.debug_context;
|
||||
let unwind_context = &mut cx.unwind_context;
|
||||
tcx.sess.time("generate debug info", || {
|
||||
cx.profiler.verbose_generic_activity("generate debug info").run(|| {
|
||||
if let Some(debug_context) = debug_context {
|
||||
debug_context.define_function(
|
||||
codegened_func.instance,
|
||||
|
|
|
@ -30,6 +30,7 @@ use std::sync::Arc;
|
|||
|
||||
use rustc_codegen_ssa::traits::CodegenBackend;
|
||||
use rustc_codegen_ssa::CodegenResults;
|
||||
use rustc_data_structures::profiling::SelfProfilerRef;
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_metadata::EncodedMetadata;
|
||||
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
|
||||
|
@ -122,6 +123,7 @@ impl<F: Fn() -> String> Drop for PrintOnPanic<F> {
|
|||
/// The codegen context holds any information shared between the codegen of individual functions
|
||||
/// inside a single codegen unit with the exception of the Cranelift [`Module`](cranelift_module::Module).
|
||||
struct CodegenCx<'tcx> {
|
||||
profiler: SelfProfilerRef,
|
||||
output_filenames: Arc<OutputFilenames>,
|
||||
should_write_ir: bool,
|
||||
global_asm: String,
|
||||
|
@ -149,6 +151,7 @@ impl<'tcx> CodegenCx<'tcx> {
|
|||
None
|
||||
};
|
||||
CodegenCx {
|
||||
profiler: tcx.prof.clone(),
|
||||
output_filenames: tcx.output_filenames(()).clone(),
|
||||
should_write_ir: crate::pretty_clif::should_write_ir(tcx),
|
||||
global_asm: String::new(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue