-1

How to count total number of load instruction on a simple "hello world" program through LLVM ??

Abhinash Jain
  • 169
  • 10
  • Do you want to count the number of load instructions that appear in the code, or the number of load instructions that will be performed when the code is ran? – Oak Mar 19 '13 at 20:12
  • I want to write a pass that counts the number of load instructions in the IR of "hello world" program........ – Abhinash Jain Mar 19 '13 at 20:36

1 Answers1

3

Write a pass which iterates over all the instructions in the module, then count the number of instructions that fulfil isa<LoadInst>(I).

See the programmer's manual for how to iterate over all the instructions.

If you're not sure how to write a pass, take a look at this handy guide.

Oak
  • 26,231
  • 8
  • 93
  • 152