Reload patch v4

Bernd Schmidt crux@pool.informatik.rwth-aachen.de
Fri Sep 11 05:51:00 GMT 1998


> 
> 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
run.

      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.

Bernd




More information about the Gcc-patches mailing list