calculate_global_regs_live
Eric Botcazou
ebotcazou@libertysurf.fr
Fri Dec 12 08:35:00 GMT 2003
Hi,
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?
The algorithm is explained by the following comment:
/* We work through the queue until there are no more blocks. What
is live at the end of this block is precisely the union of what
is live at the beginning of all its successors. So, we set its
GLOBAL_LIVE_AT_END field based on the GLOBAL_LIVE_AT_START field
for its successors. Then, we compute GLOBAL_LIVE_AT_START for
this block by walking through the instructions in this block in
reverse order and updating as we go. If that changed
GLOBAL_LIVE_AT_START, we add the predecessors of the block to the
queue; they will now need to recalculate GLOBAL_LIVE_AT_END.
We are guaranteed to terminate, because GLOBAL_LIVE_AT_START
never shrinks. If a register appears in GLOBAL_LIVE_AT_START, it
must either be live at the end of the block, or used within the
block. In the latter case, it will certainly never disappear
from GLOBAL_LIVE_AT_START. In the former case, the register
could go away only if it disappeared from GLOBAL_LIVE_AT_START
for one of the successor blocks. By induction, that cannot
occur. */
If GLOBAL_LIVE_AT_START starts as non-zero, it can shrink and the reasoning
above doesn't apply anymore. I have a testcase which causes an infinite
oscillation in the function because of this problem.
--
Eric Botcazou
More information about the Gcc
mailing list