[LLVMdev] Re: Help regarding llvm tool

Misha Brukman brukman at cs.uiuc.edu
Mon Jul 25 12:13:08 PDT 2005


Murali,

Please send LLVM questions to llvmdev at cs.uiuc.edu .

On Mon, Jul 25, 2005 at 02:41:10PM -0400, Murali Krishna Nethi wrote:
> Thanks for your reply. I was able to download llvm-tv using the
> directions that you had provided to me.
> 
> I have read the whole documentation of llvm yet, have simple question
> about llvm.
> 
> I was trying to analyse a simple hello.c program with llvm.  i used
> llvm-gcc to generate the .bc file and output file. I am trying to use
> it to generate instruction counts, stats, basic block instruction
> count and identification of natural loops in the program.
> 
> I used command analyze -instcount hello.bc. however, the outp[ut it
> generates is "printing analyzis 'counts the various types of
> instructions' for function 'main' :"
> 
> It does not give me any further details. could you help me as to how
> to configure the tool to obtain the stats. I truly appreciate your
> help in this reagrd.

By itself, an analysis does not print out the stats it gathers, because
many passes collect statistics, but we don't want to show statistics for
all passes all the time while we're compiling (that's a LOT of stats!)

So, you need to specify the -stats flag to get a summary statistic
printout:

% analyze -instcount -stats hello.bc
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)

This should probably be documented as requiring the -stats flag to be
passed in to print out stats. 
 
-- 
Misha Brukman :: http://misha.brukman.net :: http://llvm.cs.uiuc.edu




More information about the llvm-dev mailing list