[LLVMdev] How to count the number of **LLVM** instructions executed dynamically
John Criswell
criswell at illinois.edu
Sat May 24 10:23:10 PDT 2014
Dear Abhinash,
You may need to build an instrumentation pass to do this. Fortunately,
such a pass should be trivial to write.
1) Your pass instruments each basic block to update a counter in a
global variable with the number of instructions found in that basic block.
2) You add a call to a run-time library function at the end of the
main() function of the program that prints the value in the global variable.
This may not work with a program that exits from a signal handler, but
you can make it more sophisticated if you need to do so (e.g., by using
atexit()).
Regards,
John Criswell
On 5/23/14, 8:03 PM, Abhinash Jain wrote:
> Hi,
>
> I wanted to count the number of "*LLVM*" instruction executed dynamically in
> any program.
>
> Have already tried "lli -stats -force-interpreter filename.bc", but it's not
> giving any information related to instruction count.
>
> lli --version output:-
> LLVM version 3.4svn
> DEBUG build with assertions.
> Default target: x86_64-unknown-linux-gnu
> Host CPU: corei7
>
>
>
>
> --
> View this message in context: http://llvm.1065342.n5.nabble.com/How-to-count-the-number-of-LLVM-instructions-executed-dynamically-tp68837.html
> Sent from the LLVM - Dev mailing list archive at Nabble.com.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list