diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2023-02-03 17:33:39 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2023-02-03 17:33:39 +0000 |
| commit | 469783c263c3ac0aadde100cbf7e575c21caad1f (patch) | |
| tree | d0042a6eba79bd2ba5148534dd1e8754216dbb04 | |
| parent | d2ffe40864e6dc93881225621a05b833957963a5 (diff) | |
| download | rust-469783c263c3ac0aadde100cbf7e575c21caad1f.tar.gz rust-469783c263c3ac0aadde100cbf7e575c21caad1f.zip | |
Use generic_activity_with_arg in codegen_fn and compile_fn
| -rw-r--r-- | src/base.rs | 7 | ||||
| -rw-r--r-- | src/driver/aot.rs | 18 |
2 files changed, 14 insertions, 11 deletions
diff --git a/src/base.rs b/src/base.rs index 184ddbdd280..b43bb5e8668 100644 --- a/src/base.rs +++ b/src/base.rs @@ -30,6 +30,9 @@ pub(crate) fn codegen_fn<'tcx>( ) -> CodegenedFunction { debug_assert!(!instance.substs.needs_infer()); + let symbol_name = tcx.symbol_name(instance).name.to_string(); + let _timer = tcx.prof.generic_activity_with_arg("codegen fn", &*symbol_name); + let mir = tcx.instance_mir(instance.def); let _mir_guard = crate::PrintOnPanic(|| { let mut buf = Vec::new(); @@ -41,7 +44,6 @@ pub(crate) fn codegen_fn<'tcx>( }); // Declare function - let symbol_name = tcx.symbol_name(instance).name.to_string(); let sig = get_function_sig(tcx, module.target_config().default_call_conv, instance); let func_id = module.declare_function(&symbol_name, Linkage::Local, &sig).unwrap(); @@ -129,6 +131,9 @@ pub(crate) fn compile_fn( module: &mut dyn Module, codegened_func: CodegenedFunction, ) { + let _timer = + cx.profiler.generic_activity_with_arg("compile function", &*codegened_func.symbol_name); + let clif_comments = codegened_func.clif_comments; // Store function in context diff --git a/src/driver/aot.rs b/src/driver/aot.rs index 2aa3209e2b1..58b01dfb5b0 100644 --- a/src/driver/aot.rs +++ b/src/driver/aot.rs @@ -291,16 +291,14 @@ fn module_codegen( for (mono_item, _) in mono_items { match mono_item { MonoItem::Fn(inst) => { - tcx.prof.generic_activity("codegen fn").run(|| { - let codegened_function = crate::base::codegen_fn( - tcx, - &mut cx, - Function::new(), - &mut module, - inst, - ); - codegened_functions.push(codegened_function); - }); + let codegened_function = crate::base::codegen_fn( + tcx, + &mut cx, + Function::new(), + &mut module, + inst, + ); + codegened_functions.push(codegened_function); } MonoItem::Static(def_id) => { crate::constant::codegen_static(tcx, &mut module, def_id) |
