LLVM beginner question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

LLVM beginner question

Murali Nethi
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

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: LLVM beginner question

Chris Lattner
On Mon, 25 Jul 2005, Murali Nethi wrote:
> 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.

ok.

> 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?

Not currently.  If you're interested in enhancing the -instcount pass, the
source is available in lib/Analysis/InstCount.cpp

-Chris

--
http://nondot.org/sabre/
http://llvm.org/

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev