This is the mail archive of the
mailing list for the GCC project.
Re: Reload patch v4
- To: Jeffrey A Law <law at cygnus dot com>
- Subject: Re: Reload patch v4
- From: Bernd Schmidt <crux at pool dot informatik dot rwth-aachen dot de>
- Date: Fri, 11 Sep 1998 14:41:45 +0200 (MET DST)
- cc: egcs-patches at cygnus dot com
> I think we need to fix forget_old_reloads_1 to handle cases where we
> store into a pseudo which happens to be allocated to a hard reg that
> has also been used as a spill reg. Imagine
> Use reg 0 as an output reload for some value V
> Psuedo X is made live and is allocated to reg 0
> [ ... ]
> Pseudo X dies
> Use of V which needs an input reload.
> In this case we might try and use reg0 to satisfy the input reload
> even though it no longer holds the value we need.
I'm not convinced yet that anything is broken. The situation you describe
could already occur with the old reload code, since it has some simple code
to avoid spilling within one basic block.
In the above example, if pseudo X is allocated to reg 0, its rtl will have
been modified to look like hard reg 0 by the time forget_old_reloads_1 runs.
And in that case, the following piece of code in find_old_reloads_1 should
nr = HARD_REGNO_NREGS (regno, GET_MODE (x));
/* Storing into a spilled-reg invalidates its contents.
This can happen if a block-local pseudo is allocated to that reg
and it wasn't spilled because this block's total need is 0.
Then some insn might have an optional reload and use this reg. */
for (i = 0; i < nr; i++)
/* But don't do this if the reg actually serves as an output
reload reg in the current instruction. */
if (n_reloads == 0
|| ! TEST_HARD_REG_BIT (reg_is_output_reload, regno + i))
CLEAR_HARD_REG_BIT (reg_reloaded_valid, regno + i);
It's quite possible that I've missed something, but so far I don't see where
things could break.