Move -Zprint-type-sizes and -Zprint-vtable-sizes into codegen_and_build_linker
This commit is contained in:
parent
2975a21b5d
commit
8127461b0e
@ -41,7 +41,6 @@
|
|||||||
use rustc_session::lint::{Lint, LintId};
|
use rustc_session::lint::{Lint, LintId};
|
||||||
use rustc_session::output::collect_crate_types;
|
use rustc_session::output::collect_crate_types;
|
||||||
use rustc_session::{config, filesearch, EarlyDiagCtxt, Session};
|
use rustc_session::{config, filesearch, EarlyDiagCtxt, Session};
|
||||||
use rustc_span::def_id::LOCAL_CRATE;
|
|
||||||
use rustc_span::source_map::FileLoader;
|
use rustc_span::source_map::FileLoader;
|
||||||
use rustc_span::symbol::sym;
|
use rustc_span::symbol::sym;
|
||||||
use rustc_span::FileName;
|
use rustc_span::FileName;
|
||||||
@ -448,21 +447,7 @@ fn run_compiler(
|
|||||||
return early_exit();
|
return early_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
let linker = queries.codegen_and_build_linker()?;
|
Ok(Some(queries.codegen_and_build_linker()?))
|
||||||
|
|
||||||
// This must run after monomorphization so that all generic types
|
|
||||||
// have been instantiated.
|
|
||||||
if sess.opts.unstable_opts.print_type_sizes {
|
|
||||||
sess.code_stats.print_type_sizes();
|
|
||||||
}
|
|
||||||
|
|
||||||
if sess.opts.unstable_opts.print_vtable_sizes {
|
|
||||||
let crate_name = queries.global_ctxt()?.enter(|tcx| tcx.crate_name(LOCAL_CRATE));
|
|
||||||
|
|
||||||
sess.code_stats.print_vtable_sizes(crate_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(Some(linker))
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// Linking is done outside the `compiler.enter()` so that the
|
// Linking is done outside the `compiler.enter()` so that the
|
||||||
|
@ -121,6 +121,18 @@ pub fn codegen_and_build_linker(&'tcx self) -> Result<Linker> {
|
|||||||
self.global_ctxt()?.enter(|tcx| {
|
self.global_ctxt()?.enter(|tcx| {
|
||||||
let ongoing_codegen = passes::start_codegen(&*self.compiler.codegen_backend, tcx)?;
|
let ongoing_codegen = passes::start_codegen(&*self.compiler.codegen_backend, tcx)?;
|
||||||
|
|
||||||
|
// This must run after monomorphization so that all generic types
|
||||||
|
// have been instantiated.
|
||||||
|
if tcx.sess.opts.unstable_opts.print_type_sizes {
|
||||||
|
tcx.sess.code_stats.print_type_sizes();
|
||||||
|
}
|
||||||
|
|
||||||
|
if tcx.sess.opts.unstable_opts.print_vtable_sizes {
|
||||||
|
let crate_name = tcx.crate_name(LOCAL_CRATE);
|
||||||
|
|
||||||
|
tcx.sess.code_stats.print_vtable_sizes(crate_name);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(Linker {
|
Ok(Linker {
|
||||||
dep_graph: tcx.dep_graph.clone(),
|
dep_graph: tcx.dep_graph.clone(),
|
||||||
output_filenames: tcx.output_filenames(()).clone(),
|
output_filenames: tcx.output_filenames(()).clone(),
|
||||||
|
Loading…
Reference in New Issue
Block a user