[llvm-dev] How to write LLVM pass to collect register usage stats

John Criswell via llvm-dev llvm-dev at lists.llvm.org
Fri Feb 26 05:46:08 PST 2016


On 2/26/16 1:47 AM, Balasaheb Dabhade via llvm-dev wrote:
> Hi All,
>
> I wanted to collect the register usage stats for the program assigned 
> by compiler(in other words "how many time each register will be 
> accessed by the program when it will execute"). How to write LLVM pass 
> which will analyse the code after LLVM global register allocation pass 
> and output the stats.

Are you counting the number of static uses of a register in each 
function, or are you instrumenting the program to count the number of 
times a register is used during execution?

Regardless of which you are doing, you will need to write a 
MachineFunctionPass that performs the analysis and/or instrumentation.  
You can read about the MachineFunctionPass in the "How to Write an LLVM 
Pass" document.  This document (http://llvm.org/docs/CodeGenerator.html) 
will also be useful.

Regards,

John Criswell

>
> Regards,
> -Bala
>
> -- 
> Thanks,
> Bala
> IIITA Allahabad
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160226/2d71e29d/attachment.html>


More information about the llvm-dev mailing list