Use generic_activity_with_arg in codegen_fn and compile_fn
This commit is contained in:
parent
d2ffe40864
commit
469783c263
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user