[LLVMdev] Inserting C++ code on tablegen to improve code generation statistics

Leandro Santiago leandrosansilva at gmail.com
Thu Aug 8 13:26:25 PDT 2013


Hello everyone.

I'm working in a project and my task right now is improving LLVM code
generation's statistics for X86 target.

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:

===-------------------------------------------------------------------------===
                          ... Statistics Collected ...
===-------------------------------------------------------------------------===

416 asm-printer    - Number of machine instrs printed
  1 codegen-dce    - Number of dead instructions deleted
  4 codegenprepare - Number of GEPs converted to casts
 20 dagcombine     - Number of dag nodes combined
 11 isel           - Number of blocks selected using DAG
 11 isel           - Number of entry blocks encountered
487 isel           - Number of times dag isel has to try another path
544 pei            - Number of bytes used for stack in all functions
  5 regalloc       - Number of cross class joins performed
 28 regalloc       - Number of identity moves eliminated after rewriting
  8 regalloc       - Number of instructions deleted by DCE
 10 regalloc       - Number of instructions re-materialized
  7 regalloc       - Number of interval joins performed
 36 regalloc       - Number of registers assigned
  2 twoaddrinstr   - Number of two-address instructions
  6 x86-codegen    - Number of floating point instructions
  2 x86-isel       - Number of loads moved below TokenFactor

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.).

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.

After the contextualizarion, I'd like to know your opinion about the
viability of each above alternative.

Perhaps (and probably) there's another way to to this, so I'm open to
suggestions :-)

Thanks in advance!

-- 
Sent from my mind
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130808/865276ee/attachment.html>


More information about the llvm-dev mailing list