File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3638,8 +3638,6 @@ dependencies = [
36383638 " rustc_span" ,
36393639 " rustc_symbol_mangling" ,
36403640 " rustc_target" ,
3641- " serde" ,
3642- " serde_json" ,
36433641 " smallvec" ,
36443642 " tracing" ,
36453643]
Original file line number Diff line number Diff line change @@ -38,8 +38,6 @@ rustc_session = { path = "../rustc_session" }
3838rustc_span = { path = " ../rustc_span" }
3939rustc_symbol_mangling = { path = " ../rustc_symbol_mangling" }
4040rustc_target = { path = " ../rustc_target" }
41- serde = { version = " 1" , features = [" derive" ] }
42- serde_json = " 1"
4341smallvec = { version = " 1.8.1" , features = [" union" , " may_dangle" ] }
4442tracing = " 0.1"
4543# tidy-alphabetical-end
Original file line number Diff line number Diff line change @@ -1136,7 +1136,7 @@ pub(crate) fn codegen(
11361136 EmitObj :: None => { }
11371137 }
11381138
1139- record_llvm_cgu_instructions_stats ( & cgcx. prof , llmod) ;
1139+ record_llvm_cgu_instructions_stats ( & cgcx. prof , & module . name , llmod) ;
11401140 }
11411141
11421142 // `.dwo` files are only emitted if:
@@ -1343,22 +1343,11 @@ fn record_artifact_size(
13431343 }
13441344}
13451345
1346- fn record_llvm_cgu_instructions_stats ( prof : & SelfProfilerRef , llmod : & llvm:: Module ) {
1346+ fn record_llvm_cgu_instructions_stats ( prof : & SelfProfilerRef , name : & str , llmod : & llvm:: Module ) {
13471347 if !prof. enabled ( ) {
13481348 return ;
13491349 }
13501350
1351- let raw_stats =
1352- llvm:: build_string ( |s| unsafe { llvm:: LLVMRustModuleInstructionStats ( llmod, s) } )
1353- . expect ( "cannot get module instruction stats" ) ;
1354-
1355- #[ derive( serde:: Deserialize ) ]
1356- struct InstructionsStats {
1357- module : String ,
1358- total : u64 ,
1359- }
1360-
1361- let InstructionsStats { module, total } =
1362- serde_json:: from_str ( & raw_stats) . expect ( "cannot parse llvm cgu instructions stats" ) ;
1363- prof. artifact_size ( "cgu_instructions" , module, total) ;
1351+ let total = unsafe { llvm:: LLVMRustModuleInstructionStats ( llmod) } ;
1352+ prof. artifact_size ( "cgu_instructions" , name, total) ;
13641353}
Original file line number Diff line number Diff line change @@ -2454,7 +2454,7 @@ unsafe extern "C" {
24542454 pub ( crate ) fn LLVMRustModuleBufferLen ( p : & ModuleBuffer ) -> usize ;
24552455 pub ( crate ) fn LLVMRustModuleBufferFree ( p : & ' static mut ModuleBuffer ) ;
24562456 pub ( crate ) fn LLVMRustModuleCost ( M : & Module ) -> u64 ;
2457- pub ( crate ) fn LLVMRustModuleInstructionStats ( M : & Module , Str : & RustString ) ;
2457+ pub ( crate ) fn LLVMRustModuleInstructionStats ( M : & Module ) -> u64 ;
24582458
24592459 pub ( crate ) fn LLVMRustThinLTOBufferCreate (
24602460 M : & Module ,
Original file line number Diff line number Diff line change @@ -1572,16 +1572,8 @@ extern "C" uint64_t LLVMRustModuleCost(LLVMModuleRef M) {
15721572 return std::distance (std::begin (f), std::end (f));
15731573}
15741574
1575- extern " C" void LLVMRustModuleInstructionStats (LLVMModuleRef M,
1576- RustStringRef Str) {
1577- auto OS = RawRustStringOstream (Str);
1578- auto JOS = llvm::json::OStream (OS );
1579- auto Module = unwrap (M);
1580-
1581- JOS .object ([&] {
1582- JOS .attribute (" module" , Module->getName ());
1583- JOS .attribute (" total" , Module->getInstructionCount ());
1584- });
1575+ extern " C" uint64_t LLVMRustModuleInstructionStats (LLVMModuleRef M) {
1576+ return unwrap (M)->getInstructionCount ();
15851577}
15861578
15871579// Transfers ownership of DiagnosticHandler unique_ptr to the caller.
You can’t perform that action at this time.
0 commit comments