@@ -30,6 +30,7 @@ use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput, SharedEmitter}
3030use rustc_codegen_ssa:: traits:: * ;
3131use rustc_codegen_ssa:: { ModuleCodegen , ModuleKind , looks_like_rust_object_file} ;
3232use rustc_data_structures:: memmap:: Mmap ;
33+ use rustc_data_structures:: profiling:: SelfProfilerRef ;
3334use rustc_errors:: { DiagCtxt , DiagCtxtHandle } ;
3435use rustc_log:: tracing:: info;
3536use rustc_middle:: bug;
@@ -112,6 +113,7 @@ fn save_as_file(obj: &[u8], path: &Path) -> Result<(), LtoBitcodeFromRlib> {
112113/// for further optimization.
113114pub ( crate ) fn run_fat (
114115 cgcx : & CodegenContext ,
116+ prof : & SelfProfilerRef ,
115117 shared_emitter : & SharedEmitter ,
116118 each_linked_rlib_for_lto : & [ PathBuf ] ,
117119 modules : Vec < FatLtoInput < GccCodegenBackend > > ,
@@ -123,6 +125,7 @@ pub(crate) fn run_fat(
123125 lto_data.symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();*/
124126 fat_lto (
125127 cgcx,
128+ prof,
126129 dcx,
127130 modules,
128131 lto_data. upstream_modules ,
@@ -133,13 +136,14 @@ pub(crate) fn run_fat(
133136
134137fn fat_lto (
135138 cgcx : & CodegenContext ,
139+ prof : & SelfProfilerRef ,
136140 _dcx : DiagCtxtHandle < ' _ > ,
137141 modules : Vec < FatLtoInput < GccCodegenBackend > > ,
138142 mut serialized_modules : Vec < ( SerializedModule < ModuleBuffer > , CString ) > ,
139143 tmp_path : TempDir ,
140144 //symbols_below_threshold: &[String],
141145) -> ModuleCodegen < GccContext > {
142- let _timer = cgcx . prof . generic_activity ( "GCC_fat_lto_build_monolithic_module" ) ;
146+ let _timer = prof. generic_activity ( "GCC_fat_lto_build_monolithic_module" ) ;
143147 info ! ( "going for a fat lto" ) ;
144148
145149 // Sort out all our lists of incoming modules into two lists.
@@ -223,8 +227,7 @@ fn fat_lto(
223227 // We add the object files and save in should_combine_object_files that we should combine
224228 // them into a single object file when compiling later.
225229 for ( bc_decoded, name) in serialized_modules {
226- let _timer = cgcx
227- . prof
230+ let _timer = prof
228231 . generic_activity_with_arg_recorder ( "GCC_fat_lto_link_module" , |recorder| {
229232 recorder. record_arg ( format ! ( "{:?}" , name) )
230233 } ) ;
@@ -284,6 +287,7 @@ impl ModuleBufferMethods for ModuleBuffer {
284287/// can simply be copied over from the incr. comp. cache.
285288pub ( crate ) fn run_thin (
286289 cgcx : & CodegenContext ,
290+ prof : & SelfProfilerRef ,
287291 dcx : DiagCtxtHandle < ' _ > ,
288292 each_linked_rlib_for_lto : & [ PathBuf ] ,
289293 modules : Vec < ( String , ThinBuffer ) > ,
@@ -298,6 +302,7 @@ pub(crate) fn run_thin(
298302 }
299303 thin_lto (
300304 cgcx,
305+ prof,
301306 dcx,
302307 modules,
303308 lto_data. upstream_modules ,
@@ -345,15 +350,16 @@ pub(crate) fn prepare_thin(module: ModuleCodegen<GccContext>) -> (String, ThinBu
345350/// all of the `LtoModuleCodegen` units returned below and destroyed once
346351/// they all go out of scope.
347352fn thin_lto (
348- cgcx : & CodegenContext ,
353+ _cgcx : & CodegenContext ,
354+ prof : & SelfProfilerRef ,
349355 _dcx : DiagCtxtHandle < ' _ > ,
350356 modules : Vec < ( String , ThinBuffer ) > ,
351357 serialized_modules : Vec < ( SerializedModule < ModuleBuffer > , CString ) > ,
352358 tmp_path : TempDir ,
353359 cached_modules : Vec < ( SerializedModule < ModuleBuffer > , WorkProduct ) > ,
354360 //_symbols_below_threshold: &[String],
355361) -> ( Vec < ThinModule < GccCodegenBackend > > , Vec < WorkProduct > ) {
356- let _timer = cgcx . prof . generic_activity ( "LLVM_thin_lto_global_analysis" ) ;
362+ let _timer = prof. generic_activity ( "LLVM_thin_lto_global_analysis" ) ;
357363 info ! ( "going for that thin, thin LTO" ) ;
358364
359365 /*let green_modules: FxHashMap<_, _> =
0 commit comments