This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

forget_old_reloads_1: do not use offset


hi guys.

the vector initializer code generated some interesting reloads that
triggered a bug in forget_old_reloads_1.  as geoff suggested, here is
the patch to fix reload :).

consider this:

        (subreg:SI (reg/v:V4SI 9 r9) 12)                                  

we need 4 GPRs to represent V4SI, so (reg:V4SI r9) is really, r9-r12.

forget_old_reloads_1() will calculate a 3 word offset, and end up
clearing the reload info for r12-r15 instead of r9-r12.  so we end
up wrongly inheriting a reload because we didn't clear the right bits.

interestingly enough we didn't really need to calculate the offset,
because we use the underlying hard registers (HARD_REGNO_NREGS for
hard regs, and the entire register for pseudos).

this patch removes the use of the offset altogether, since it's
not needed and causes us to clear the wrong registers.

bootstrapped and regtested on powerpc-unknown-linux-gnualtivec.

jim wilson approved this patch.  comitted to mainline.

aldy

2002-05-15  Aldy Hernandez  <aldyh@redhat.com>

	* reload1.c (forget_old_reloads_1): Do not use subreg offset.


Index: reload1.c
===================================================================
RCS file: /cvs/uberbaum/gcc/reload1.c,v
retrieving revision 1.335
diff -c -p -r1.335 reload1.c
*** reload1.c	9 May 2002 01:42:26 -0000	1.335
--- reload1.c	15 May 2002 23:55:16 -0000
*************** forget_old_reloads_1 (x, ignored, data)
*** 4098,4120 ****
  {
    unsigned int regno;
    unsigned int nr;
-   int offset = 0;
  
    /* note_stores does give us subregs of hard regs,
       subreg_regno_offset will abort if it is not a hard reg.  */
    while (GET_CODE (x) == SUBREG)
      {
!       offset += subreg_regno_offset (REGNO (SUBREG_REG (x)),
! 				     GET_MODE (SUBREG_REG (x)),
! 				     SUBREG_BYTE (x),
! 				     GET_MODE (x));
        x = SUBREG_REG (x);
      }
  
    if (GET_CODE (x) != REG)
      return;
  
!   regno = REGNO (x) + offset;
  
    if (regno >= FIRST_PSEUDO_REGISTER)
      nr = 1;
--- 4098,4118 ----
  {
    unsigned int regno;
    unsigned int nr;
  
    /* note_stores does give us subregs of hard regs,
       subreg_regno_offset will abort if it is not a hard reg.  */
    while (GET_CODE (x) == SUBREG)
      {
!       /* We ignore the subreg offset when calculating the regno,
! 	 because we are using the entire underlying hard register
! 	 below.  */
        x = SUBREG_REG (x);
      }
  
    if (GET_CODE (x) != REG)
      return;
  
!   regno = REGNO (x);
  
    if (regno >= FIRST_PSEUDO_REGISTER)
      nr = 1;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]