<div dir="ltr"><div><div><div><div><div><div>Hello everyone.<br><br></div>I'm working in a project and my task right now is improving LLVM code generation's statistics for X86 target.<br><br></div>Currently you can show statistics by passing the command-line parameter -stats to any llvm program (I'm using llc to compile .bc to native code) and it'll show something like this:<br>
<br>===-------------------------------------------------------------------------===<br> ... Statistics Collected ...<br>===-------------------------------------------------------------------------===<br>
<br>416 asm-printer - Number of machine instrs printed<br> 1 codegen-dce - Number of dead instructions deleted<br> 4 codegenprepare - Number of GEPs converted to casts<br> 20 dagcombine - Number of dag nodes combined<br>
11 isel - Number of blocks selected using DAG<br> 11 isel - Number of entry blocks encountered<br>487 isel - Number of times dag isel has to try another path<br>544 pei - Number of bytes used for stack in all functions<br>
5 regalloc - Number of cross class joins performed<br> 28 regalloc - Number of identity moves eliminated after rewriting<br> 8 regalloc - Number of instructions deleted by DCE<br> 10 regalloc - Number of instructions re-materialized<br>
7 regalloc - Number of interval joins performed<br> 36 regalloc - Number of registers assigned<br> 2 twoaddrinstr - Number of two-address instructions<br> 6 x86-codegen - Number of floating point instructions<br>
2 x86-isel - Number of loads moved below TokenFactor<br><br></div>I aim to improve the x86-codegen and asm-printer sections, detailing and adding more informations on it. I'll need to add the number of every kind of generated assembly instructions (x add, y movl, etc.). <br>
<br>Reading briefly the X86 target code, I realized these instructions are defined on tablegen .td files, so I have two ways: write c++ code on .td files, which I don't believe it's possible (otherwise, I really'd like to know how to do that); or changing the tablegen program allowing it to generate c++ code with the statistics enabled.<br>
<br></div>After the contextualizarion, I'd like to know your opinion about the viability of each above alternative.<br><br></div>Perhaps (and probably) there's another way to to this, so I'm open to suggestions :-)<br>
<br></div>Thanks in advance!<br><div><div><br><div><div><div><div><div><div>-- <br>Sent from my mind
</div></div></div></div></div></div></div></div></div>