reload picks invalid register in 3.1

Bob Wilson bwilson@tensilica.com
Fri Mar 22 10:00:00 GMT 2002


I discovered another regression in the 3.1 Xtensa port.  The stack 
pointer register for Xtensa should only be assigned by a special "MOVSP" 
opcode that copies a new stack pointer value from another register.  The 
xtensa.md file includes this condition in the predicate and constraints 
for the movsi insn.  (The predicate was actually incorrect, and I 
haven't yet committed the fix, but it seems to have no effect on this 
particular issue).

Before reload, I have an insn that looks like:

(set (reg/f:SI 1 sp) (reg/f:SI 451))

The pseudo reg gets allocated on the stack.  There is new code for 3.1 
at the end of find_reloads() that chooses "sp" as the reload register. 
The code begins with this comment:

   /* Special case a simple move with an input reload and a
      destination of a hard reg, if the hard reg is ok, use it.  */

I think this corresponds to the following change:

2002-01-13  Richard Henderson  <rth@redhat.com>

    * reload.c (find_reloads): Use a hard reg destination as reload reg
    for an input reload of the source.

The problem is that the input reload will then be:

(set (reg/f:SI 1 sp)
      (mem:SI (plus:SI (reg/f:SI 7 a7)
                 (const_int 8380 [0x20bc])) [0 c S4 A32]))

which is not a valid insn, because you can only assign sp with a 
register-to-register copy.  Prior to reload, the define_expand for movsi 
can introduce a new register to make the insn valid, but I can't do that 
during reload.

Is this my problem or is it a problem in the reload code?

--Bob



More information about the Gcc mailing list