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]

Re: regrename_optimize problem


On Fri, Jul 20, 2001 at 02:32:58AM +0200, Roman Zippel wrote:
> I have a problem in regrename_optimize, which I don't know how to solve
> correctly, below is the patch I use currently to solve it.
> gcc.c-torture/compile/920825-2.c fails with -funroll-loops for m68k. The
> problems is that regrename_optimize tries to rename a data register into a
> floating point register. That data register is only used to prepare the
> loop and regrename_optimize thinks it can reuse during the loop it.

The bug is that regrename forgot that the number of registers
required by a mode varies depending on the hard reg.  So we
renamed from fp0 (DFmode in one reg) to d0 (DFmode int two regs),
but d1 was still in use and we aborted on register liveness
sanity checks.

This appears to fix things.  I'll run a complete bootstrap on
i686 shortly.


r~


	* regrename.c (regrename_optimize): Compute nregs for each
	potential target register.

Index: regrename.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regrename.c,v
retrieving revision 1.20.4.2
diff -u -p -r1.20.4.2 regrename.c
--- regrename.c	2001/05/19 05:56:44	1.20.4.2
+++ regrename.c	2001/07/22 01:36:59
@@ -239,7 +239,6 @@ regrename_optimize ()
 	  struct du_chain *tmp, *last;
 	  HARD_REG_SET this_unavailable;
 	  int reg = REGNO (*this->loc), treg;
-	  int nregs = HARD_REGNO_NREGS (reg, GET_MODE (*this->loc));
 	  int i;
 
 	  all_chains = this->next_chain;
@@ -289,6 +288,8 @@ regrename_optimize ()
 	     have a closer look at each register still in there.  */
 	  for (treg = 0; treg < FIRST_PSEUDO_REGISTER; treg++)
 	    {
+	      int nregs = HARD_REGNO_NREGS (treg, GET_MODE (*this->loc));
+
 	      new_reg = treg;
 	      for (i = nregs - 1; i >= 0; --i)
 	        if (TEST_HARD_REG_BIT (this_unavailable, new_reg + i)


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