[LLVMdev] LLVM beginner question

Murali Nethi nethimk at gmail.com
Mon Jul 25 12:52:02 PDT 2005


Hi,

I am new to llvm and have read all the documents and managed to get
the llvm tool working on linux without much problem. I am trying to
generate some static analysis information about my program using llvm
virtual machine architecture.

the file is really simple hello world program with a small loop which
increments a variable until a particular iteration.
main()
{
int a,b,c;
a=0;
b=0;
c=1;
a=b+c;
for (a=1;a<=10;a++)
c++;
printf("\nhello\n");
}

I want to do the following.

Generate instruction mix across the basic blocks or loop bodies.

I have tried the following.

analyze -instcount -stats hello.bc

it has generated

Printing analysis 'Counts the various types of Instructions' for
function 'main':
===-------------------------------------------------------------------------===
                          ... Statistics Collected ...
===-------------------------------------------------------------------------===
 
1 instcount - Number of Call insts
1 instcount - Number of Ret insts
1 instcount - Number of memory instructions
1 instcount - Number of non-external functions
1 instcount - Number of basic blocks
2 instcount - Number of instructions (of all types)

However, I need informations as to specific blocks and instruction mix
information across the blocks. Is there any pass that i could give to
analyze to obtain these statistics?

I would appreciate your help in this regard.

Thanks
Murali




More information about the llvm-dev mailing list