Skip to content

Print the codegen worker id when using -Ztime-passes #29386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/librustc_trans/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ struct CodegenContext<'a> {
plugin_passes: Vec<String>,
// LLVM optimizations for which we want to print remarks.
remark: Passes,
// Worker thread number
worker: usize,
}

impl<'a> CodegenContext<'a> {
Expand All @@ -334,6 +336,7 @@ impl<'a> CodegenContext<'a> {
handler: sess.diagnostic().handler(),
plugin_passes: sess.plugin_llvm_passes.borrow().clone(),
remark: sess.opts.cg.remark.clone(),
worker: 0,
}
}
}
Expand Down Expand Up @@ -476,9 +479,9 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
cgcx.handler.abort_if_errors();

// Finally, run the actual optimization passes
time(config.time_passes, "llvm function passes", ||
time(config.time_passes, &format!("llvm function passes [{}]", cgcx.worker), ||
llvm::LLVMRustRunFunctionPassManager(fpm, llmod));
time(config.time_passes, "llvm module passes", ||
time(config.time_passes, &format!("llvm module passes [{}]", cgcx.worker), ||
llvm::LLVMRunPassManager(mpm, llmod));

// Deallocate managers that we're now done with
Expand Down Expand Up @@ -529,7 +532,7 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext,
llvm::LLVMWriteBitcodeToFile(llmod, out.as_ptr());
}

time(config.time_passes, "codegen passes", || {
time(config.time_passes, &format!("codegen passes [{}]", cgcx.worker), || {
if config.emit_ir {
let ext = format!("{}.ll", name_extra);
let out = output_names.with_extension(&ext);
Expand Down Expand Up @@ -869,6 +872,7 @@ fn run_work_multithreaded(sess: &Session,
handler: &diag_handler,
plugin_passes: plugin_passes,
remark: remark,
worker: i,
};

loop {
Expand Down