mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Move print_pass_timings and print_statistics calls to rustc_interface
This commit is contained in:
@@ -455,14 +455,6 @@ fn run_thin_lto(
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn print_pass_timings(&self) {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
fn print_statistics(&self) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn optimize(
|
||||
_cgcx: &CodegenContext,
|
||||
_prof: &SelfProfilerRef,
|
||||
|
||||
@@ -135,14 +135,6 @@ impl WriteBackendMethods for LlvmCodegenBackend {
|
||||
type ModuleBuffer = back::lto::ModuleBuffer;
|
||||
type TargetMachine = OwnedTargetMachine;
|
||||
type ThinData = back::lto::ThinData;
|
||||
fn print_pass_timings(&self) {
|
||||
let timings = llvm::build_string(|s| unsafe { llvm::LLVMRustPrintPassTimings(s) }).unwrap();
|
||||
print!("{timings}");
|
||||
}
|
||||
fn print_statistics(&self) {
|
||||
let stats = llvm::build_string(|s| unsafe { llvm::LLVMRustPrintStatistics(s) }).unwrap();
|
||||
print!("{stats}");
|
||||
}
|
||||
fn run_and_optimize_fat_lto(
|
||||
cgcx: &CodegenContext,
|
||||
prof: &SelfProfilerRef,
|
||||
@@ -371,6 +363,16 @@ fn join_codegen(
|
||||
(compiled_modules, work_products)
|
||||
}
|
||||
|
||||
fn print_pass_timings(&self) {
|
||||
let timings = llvm::build_string(|s| unsafe { llvm::LLVMRustPrintPassTimings(s) }).unwrap();
|
||||
print!("{timings}");
|
||||
}
|
||||
|
||||
fn print_statistics(&self) {
|
||||
let stats = llvm::build_string(|s| unsafe { llvm::LLVMRustPrintStatistics(s) }).unwrap();
|
||||
print!("{stats}");
|
||||
}
|
||||
|
||||
fn link(
|
||||
&self,
|
||||
sess: &Session,
|
||||
|
||||
@@ -2243,16 +2243,6 @@ pub fn join(self, sess: &Session) -> (CompiledModules, FxIndexMap<WorkProductId,
|
||||
copy_all_cgu_workproducts_to_incr_comp_cache_dir(sess, &compiled_modules);
|
||||
produce_final_output_artifacts(sess, &compiled_modules, &self.output_filenames);
|
||||
|
||||
// FIXME: time_llvm_passes support - does this use a global context or
|
||||
// something?
|
||||
if sess.codegen_units().as_usize() == 1 && sess.opts.unstable_opts.time_llvm_passes {
|
||||
self.backend.print_pass_timings()
|
||||
}
|
||||
|
||||
if sess.print_llvm_stats() {
|
||||
self.backend.print_statistics()
|
||||
}
|
||||
|
||||
(compiled_modules, work_products)
|
||||
}
|
||||
|
||||
|
||||
@@ -119,6 +119,10 @@ fn join_codegen(
|
||||
outputs: &OutputFilenames,
|
||||
) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>);
|
||||
|
||||
fn print_pass_timings(&self) {}
|
||||
|
||||
fn print_statistics(&self) {}
|
||||
|
||||
/// This is called on the returned [`CompiledModules`] from [`join_codegen`](Self::join_codegen).
|
||||
fn link(
|
||||
&self,
|
||||
|
||||
@@ -39,8 +39,6 @@ fn run_thin_lto(
|
||||
modules: Vec<(String, Self::ModuleBuffer)>,
|
||||
cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>,
|
||||
) -> (Vec<ThinModule<Self>>, Vec<WorkProduct>);
|
||||
fn print_pass_timings(&self);
|
||||
fn print_statistics(&self);
|
||||
fn optimize(
|
||||
cgcx: &CodegenContext,
|
||||
prof: &SelfProfilerRef,
|
||||
|
||||
@@ -58,6 +58,15 @@ pub fn link(self, sess: &Session, codegen_backend: &dyn CodegenBackend) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if sess.codegen_units().as_usize() == 1 && sess.opts.unstable_opts.time_llvm_passes {
|
||||
codegen_backend.print_pass_timings()
|
||||
}
|
||||
|
||||
if sess.print_llvm_stats() {
|
||||
codegen_backend.print_statistics()
|
||||
}
|
||||
|
||||
sess.timings.end_section(sess.dcx(), TimingSection::Codegen);
|
||||
|
||||
if sess.opts.incremental.is_some()
|
||||
|
||||
Reference in New Issue
Block a user