I wanted to count the number of "*LLVM*" instruction executed dynamically in
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
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()).
Thanks for your suggestion.
I'm just curious to know whether "lli -stats" also does the same thing or
Because I found on the internet that this command used to give dynamic
instruction count as a output, along with some other details.
Unfortunately, In my version of lli (version 3.4), it gives all detail
except instruction counts.
I do not know if lli -stats prints the dynamic instruction count anymore; I haven't used lli in years. Perhaps others on the list know.