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]

patch: subreg_regno_offset() being called with a pseudo


hi guys.

subreg_regno_offset() is dying because mips_secondary_reload_class() is
calling it with a pseudo.

the patch below fixes true_regnum so it doesn't assume that reg_renumber
is valid and then one can always just use true_regnum and it will
DTRT.

as a bonus, this patch simplifies mips'
SECONDARY_[INPUT/OUTPUT]_RELOAD_CLASS for mips because then we can call
true_regnum regardless, and not have to do any adhoc calculations.

i've had this patch installed and tested for about 3 weeks.  no
regressions, and it fixes at least one testsuite failure for mips.

eric preapproved the mips part a while back, but alas, it needs the
true_regnum patch to go in :)

is this ok?

-- 
Aldy Hernandez					E-mail: aldyh@redhat.com
Professional Gypsy
Red Hat, Inc.

2001-08-16  Aldy Hernandez  <aldyh@redhat.com>, Graham Stott
<grahams@redhat.com>

	* jump.c (true_regnum): Handle case when reg_renumber is not set.

	* config/mips/mips.c (mips_secondary_reload_class): Call
	true_regnum regardless	of if we	have reg_renumber set.
	true_regnum now	nows how to handle this	case.

Index: jump.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/jump.c,v
retrieving revision 1.205.2.1
diff -c -p -r1.205.2.1 jump.c
*** jump.c	2001/08/09 04:14:58	1.205.2.1
--- jump.c	2001/08/16 16:58:45
*************** true_regnum (x)
*** 2422,2428 ****
  {
    if (GET_CODE (x) == REG)
      {
!       if (REGNO (x) >= FIRST_PSEUDO_REGISTER && reg_renumber[REGNO
(x)] >= 0)
  	return reg_renumber[REGNO (x)];
        return REGNO (x);
      }
--- 2422,2429 ----
  {
    if (GET_CODE (x) == REG)
      {
!       if (REGNO (x) >= FIRST_PSEUDO_REGISTER
! 	  && reg_renumber && reg_renumber[REGNO (x)] >= 0)
  	return reg_renumber[REGNO (x)];
        return REGNO (x);
      }
Index: config/mips/mips.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/config/mips/mips.c,v
retrieving revision 1.243.2.2
diff -c -p -r1.243.2.2 mips.c
*** mips.c	2001/08/10 12:55:54	1.243.2.2
--- mips.c	2001/08/16 16:59:15
*************** mips_secondary_reload_class (class, mode
*** 8086,8110 ****
        int off = 0;
  
        x = XEXP (x, 0);
! 
!       /* We may be called with reg_renumber NULL from regclass.
! 	 ??? This is probably a bug.  */
!       if (reg_renumber)
! 	regno = true_regnum (x);
!       else
! 	{
! 	  while (GET_CODE (x) == SUBREG)
! 	    {
! 	      off += 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)
! 	    regno = REGNO (x) + off;
! 	}
      }
  
    else if (GET_CODE (x) == REG || GET_CODE (x) == SUBREG)
--- 8086,8092 ----
        int off = 0;
  
        x = XEXP (x, 0);
!       regno = true_regnum (x);
      }
  
    else if (GET_CODE (x) == REG || GET_CODE (x) == SUBREG)



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