calculate_global_regs_live

Jim Wilson wilson@specifixinc.com
Fri Dec 12 08:53:00 GMT 2003


Eric Botcazou wrote:
> Is it a feature or an oversight that calculate_global_regs_live doesn't clear 
> the regsets containing the liveness information for each BB before calculing 
> them again?

In gcc-2.95, I see that life_analysis_1 computes these fields.  It 
allocates the fields before computing them, so they are always zero.

In gcc-3.0, we now have update_life_info/calculate_global_regs_live, and 
update_life_info is now called from multiple places, only one of which 
allocates the fields before the call.  So some calls could already have 
data when we enter.

In gcc-3.1, update_life_info now calls calculate_global_regs_live in a 
loop, so it is called multiple times with one update_life_info call. 
The calculate_global_regs_live comment you quoted appears, but it seems 
to be the same algorithm, so it appears to be just a documentation 
improvement.

On mainline, there is code in update_life_info to clear the fields in 
question at the end of the loop before calling 
calculate_globals_regs_live again.  So it appears that someone has 
already noticed a similar problem to yours.

Maybe this clearing needs to be done at the top of the loop?  We don't 
need this for the very first call to update_life_info, but it may not be 
worth optimizing that case.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list