Basic block counts?

Jim Wilson wilson@specifixinc.com
Wed Feb 18 21:30:00 GMT 2004


Jan Hoogerbrugge wrote:
> Is it possible to obtain basic block counts (read by 
> -fbranch-probabilities) in a define_insn
> or via current_output_insn in print_operand?

> Is it possible to obtain the total of all basic block counts so that I 
> have an indication
> of the contribution of a basic block to the execution time?

Look at the profiling code in profile.c.

Basic blocks have a count field that you can check.  Instructions 
usually have a pointer to the block that contains them, so it seems like 
you should be able to access the count given an instruction.  See 
BLOCK_FOR_INSN.

I don't know about total counts.  It may be there somewhere.  Try 
looking at the code.

The entry/exit basic block counts are useful, since they tell you how 
many times the function was executed.  If the current block count is 
much larger than the function execution count, then it is an important 
block for this function.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list