File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ pub(crate) fn codegen_fn<'tcx>(
30
30
) -> CodegenedFunction {
31
31
debug_assert ! ( !instance. substs. needs_infer( ) ) ;
32
32
33
+ let symbol_name = tcx. symbol_name ( instance) . name . to_string ( ) ;
34
+ let _timer = tcx. prof . generic_activity_with_arg ( "codegen fn" , & * symbol_name) ;
35
+
33
36
let mir = tcx. instance_mir ( instance. def ) ;
34
37
let _mir_guard = crate :: PrintOnPanic ( || {
35
38
let mut buf = Vec :: new ( ) ;
@@ -41,7 +44,6 @@ pub(crate) fn codegen_fn<'tcx>(
41
44
} ) ;
42
45
43
46
// Declare function
44
- let symbol_name = tcx. symbol_name ( instance) . name . to_string ( ) ;
45
47
let sig = get_function_sig ( tcx, module. target_config ( ) . default_call_conv , instance) ;
46
48
let func_id = module. declare_function ( & symbol_name, Linkage :: Local , & sig) . unwrap ( ) ;
47
49
@@ -129,6 +131,9 @@ pub(crate) fn compile_fn(
129
131
module : & mut dyn Module ,
130
132
codegened_func : CodegenedFunction ,
131
133
) {
134
+ let _timer =
135
+ cx. profiler . generic_activity_with_arg ( "compile function" , & * codegened_func. symbol_name ) ;
136
+
132
137
let clif_comments = codegened_func. clif_comments ;
133
138
134
139
// Store function in context
Original file line number Diff line number Diff line change @@ -291,16 +291,14 @@ fn module_codegen(
291
291
for ( mono_item, _) in mono_items {
292
292
match mono_item {
293
293
MonoItem :: Fn ( inst) => {
294
- tcx. prof . generic_activity ( "codegen fn" ) . run ( || {
295
- let codegened_function = crate :: base:: codegen_fn (
296
- tcx,
297
- & mut cx,
298
- Function :: new ( ) ,
299
- & mut module,
300
- inst,
301
- ) ;
302
- codegened_functions. push ( codegened_function) ;
303
- } ) ;
294
+ let codegened_function = crate :: base:: codegen_fn (
295
+ tcx,
296
+ & mut cx,
297
+ Function :: new ( ) ,
298
+ & mut module,
299
+ inst,
300
+ ) ;
301
+ codegened_functions. push ( codegened_function) ;
304
302
}
305
303
MonoItem :: Static ( def_id) => {
306
304
crate :: constant:: codegen_static ( tcx, & mut module, def_id)
You can’t perform that action at this time.
0 commit comments