File tree 3 files changed +6
-0
lines changed
3 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -568,6 +568,8 @@ pub(crate) unsafe fn codegen(
568
568
let llcx = & * module. module_llvm . llcx ;
569
569
let tm = & * module. module_llvm . tm ;
570
570
let module_name = module. name . clone ( ) ;
571
+ let count = unsafe { llvm:: LLVMRustModuleInstructionStats ( & llmod) } ;
572
+ println ! ( "llvm-module: {module_name} = {count}" ) ;
571
573
let module_name = Some ( & module_name[ ..] ) ;
572
574
let handlers = DiagnosticHandlers :: new ( cgcx, diag_handler, llcx) ;
573
575
Original file line number Diff line number Diff line change @@ -2410,6 +2410,7 @@ extern "C" {
2410
2410
pub fn LLVMRustModuleBufferLen ( p : & ModuleBuffer ) -> usize ;
2411
2411
pub fn LLVMRustModuleBufferFree ( p : & ' static mut ModuleBuffer ) ;
2412
2412
pub fn LLVMRustModuleCost ( M : & Module ) -> u64 ;
2413
+ pub fn LLVMRustModuleInstructionStats ( M : & Module ) -> u64 ;
2413
2414
2414
2415
pub fn LLVMRustThinLTOBufferCreate ( M : & Module , is_thin : bool ) -> & ' static mut ThinLTOBuffer ;
2415
2416
pub fn LLVMRustThinLTOBufferFree ( M : & ' static mut ThinLTOBuffer ) ;
Original file line number Diff line number Diff line change @@ -1754,10 +1754,13 @@ LLVMRustModuleCost(LLVMModuleRef M) {
1754
1754
extern " C" uint64_t
1755
1755
LLVMRustModuleInstructionStats (LLVMModuleRef M) {
1756
1756
auto f = unwrap (M)->functions ();
1757
+ raw_fd_ostream OS (2 , false ); // stderr.
1757
1758
for (auto &func : f)
1758
1759
{
1759
1760
auto name = func.getName ();
1761
+
1760
1762
auto count = func.getInstructionCount ();
1763
+ OS << name << " \t " << count << " \n " ;
1761
1764
}
1762
1765
return unwrap (M)->getInstructionCount ();
1763
1766
}
You can’t perform that action at this time.
0 commit comments