File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -464,14 +464,6 @@ impl WriteBackendMethods for GccCodegenBackend {
464464 unreachable ! ( )
465465 }
466466
467- fn print_pass_timings ( & self ) {
468- unimplemented ! ( ) ;
469- }
470-
471- fn print_statistics ( & self ) {
472- unimplemented ! ( )
473- }
474-
475467 fn optimize (
476468 _cgcx : & CodegenContext ,
477469 _prof : & SelfProfilerRef ,
Original file line number Diff line number Diff line change @@ -136,14 +136,6 @@ impl WriteBackendMethods for LlvmCodegenBackend {
136136 type TargetMachine = OwnedTargetMachine ;
137137 type ThinData = back:: lto:: ThinData ;
138138 type ThinBuffer = back:: lto:: ThinBuffer ;
139- fn print_pass_timings ( & self ) {
140- let timings = llvm:: build_string ( |s| unsafe { llvm:: LLVMRustPrintPassTimings ( s) } ) . unwrap ( ) ;
141- print ! ( "{timings}" ) ;
142- }
143- fn print_statistics ( & self ) {
144- let stats = llvm:: build_string ( |s| unsafe { llvm:: LLVMRustPrintStatistics ( s) } ) . unwrap ( ) ;
145- print ! ( "{stats}" ) ;
146- }
147139 fn run_and_optimize_fat_lto (
148140 cgcx : & CodegenContext ,
149141 prof : & SelfProfilerRef ,
@@ -375,6 +367,16 @@ impl CodegenBackend for LlvmCodegenBackend {
375367 ( codegen_results, work_products)
376368 }
377369
370+ fn print_pass_timings ( & self ) {
371+ let timings = llvm:: build_string ( |s| unsafe { llvm:: LLVMRustPrintPassTimings ( s) } ) . unwrap ( ) ;
372+ print ! ( "{timings}" ) ;
373+ }
374+
375+ fn print_statistics ( & self ) {
376+ let stats = llvm:: build_string ( |s| unsafe { llvm:: LLVMRustPrintStatistics ( s) } ) . unwrap ( ) ;
377+ print ! ( "{stats}" ) ;
378+ }
379+
378380 fn link (
379381 & self ,
380382 sess : & Session ,
Original file line number Diff line number Diff line change @@ -2266,16 +2266,6 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> {
22662266 copy_all_cgu_workproducts_to_incr_comp_cache_dir ( sess, & compiled_modules) ;
22672267 produce_final_output_artifacts ( sess, & compiled_modules, & self . output_filenames ) ;
22682268
2269- // FIXME: time_llvm_passes support - does this use a global context or
2270- // something?
2271- if sess. codegen_units ( ) . as_usize ( ) == 1 && sess. opts . unstable_opts . time_llvm_passes {
2272- self . backend . print_pass_timings ( )
2273- }
2274-
2275- if sess. print_llvm_stats ( ) {
2276- self . backend . print_statistics ( )
2277- }
2278-
22792269 (
22802270 CodegenResults {
22812271 crate_info : self . crate_info ,
Original file line number Diff line number Diff line change @@ -117,6 +117,10 @@ pub trait CodegenBackend {
117117 outputs : & OutputFilenames ,
118118 ) -> ( CodegenResults , FxIndexMap < WorkProductId , WorkProduct > ) ;
119119
120+ fn print_pass_timings ( & self ) { }
121+
122+ fn print_statistics ( & self ) { }
123+
120124 /// This is called on the returned [`CodegenResults`] from [`join_codegen`](Self::join_codegen).
121125 fn link (
122126 & self ,
Original file line number Diff line number Diff line change @@ -40,8 +40,6 @@ pub trait WriteBackendMethods: Clone + 'static {
4040 modules : Vec < ( String , Self :: ThinBuffer ) > ,
4141 cached_modules : Vec < ( SerializedModule < Self :: ModuleBuffer > , WorkProduct ) > ,
4242 ) -> ( Vec < ThinModule < Self > > , Vec < WorkProduct > ) ;
43- fn print_pass_timings ( & self ) ;
44- fn print_statistics ( & self ) ;
4543 fn optimize (
4644 cgcx : & CodegenContext ,
4745 prof : & SelfProfilerRef ,
Original file line number Diff line number Diff line change @@ -56,6 +56,15 @@ impl Linker {
5656 }
5757 }
5858 } ) ;
59+
60+ if sess. codegen_units ( ) . as_usize ( ) == 1 && sess. opts . unstable_opts . time_llvm_passes {
61+ codegen_backend. print_pass_timings ( )
62+ }
63+
64+ if sess. print_llvm_stats ( ) {
65+ codegen_backend. print_statistics ( )
66+ }
67+
5968 sess. timings . end_section ( sess. dcx ( ) , TimingSection :: Codegen ) ;
6069
6170 if sess. opts . incremental . is_some ( )
You can’t perform that action at this time.
0 commit comments