Questions !!

Thanks for the reply,

Actually I m aiming towards determining two values:

  • number of basic blocks in a program
    For this I have used Statistic facility provided in llvm and increasing the counter for each basic block for each function.but for some reason , I m getting different number everytime !!
    Is Statistic is the right way to do it ?

  • Average basic block size in a program ( in bytes)

Any suggestions to make it simple and get an accurate result?

Regards,
Tanu

That should work fine. Remember that statistics accumulate across the whole execution of the tool though, they are not reset per function. Also, you might want to check out the -instcount pass. It prints BB counts among other things.

For a small .ll file, it prints:

$ llvm-as < t.ll | analyze -instcount -stats
Printing analysis 'Counts the various types of Instructions' for function 'test':