[LLVMdev] Counting instructions in MCJIT

Verena Beckham verena at codeplay.com
Wed Jun 27 02:22:45 PDT 2012


Hi there,

I wondered whether anyone could give me any advice about counting 
assembly instructions when using MCJIT?
For performance regression testing I would like to be able to count the 
number of instructions generated during the jit compilation of a given 
module.

The Statistic class, as far as I understand, cannot collect this data 
per-module (per-ExecutionEngine/per-MCJIT), and there is no way of 
extracting a single statistic without doing string manipulation. I'm 
also doing several code gens in parallel, so even if the class is 
thread-safe, I cannot find the values for the single modules.

In JIT you can add a JITListener, which can count the 
MachineInstructions, with the assumption that there is a (more or less) 
1-2-1 mapping between machine and assembly instructions. Is there 
something equivalent for MCJIT?

I can write a MachineFunctionPass to do the same, but I can find no way 
of inserting that into the PassManager that MCJIT uses. This means I'm 
replicating the passes and doing code gen twice, basically.

Any advice would be much appreciated!
Thank you very much,

-- 
Verena Beckham

Vice President Engineering

Codeplay Software Ltd
45 York Place, Edinburgh, EH1 3HP
Tel: 0131 466 0503
Fax: 0131 557 6600
Website: http://www.codeplay.com

This email and any attachments may contain confidential and /or 
privileged information and  is for use  by the addressee only. If you 
are not the intended recipient, please notify Codeplay Software Ltd 
immediately and delete the message from your computer. You may not copy 
or forward it,or use or disclose its contents to any other person. Any 
views or other information in this message which do not relate to our 
business are not authorized by Codeplay software Ltd, nor does this 
message form part of any contract unless so stated.
As internet communications are capable of data corruption Codeplay 
Software Ltd does not accept any responsibility for any changes made to 
this message after it was sent. Please note that Codeplay Software Ltd 
does not accept any liability or responsibility for viruses and it is 
your responsibility to scan any attachments.
Company registered in England and Wales, number: 04567874
Registered office: 81 Linkfield Street, Redhill RH1 6BY



More information about the llvm-dev mailing list