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: bug in `find_equiv_reg' and patch



Bernd Schmidt <bernds@balti.cygnus.co.uk> writes:

> Looking at this function, there appears to be another instance of the
> same problem:
> 
>   /* Reject VALUE if it is one of the regs reserved for reloads.
>      Reload1 knows how to reuse them anyway, and it would get
>      confused if we allocated one without its knowledge.
>      (Now that insns introduced by reload are ignored above,
>      this case shouldn't happen, but I'm not positive.)  */
> 
>   if (reload_reg_p != 0 && reload_reg_p != (short *) (HOST_WIDE_INT) 1
>       && reload_reg_p[valueno] >= 0)
>     return 0;
> 
> This probably ought to be changed as well.


I'm sorry.

Patch in my previous mail was wrong.


Sat Apr 22 17:54:43 2000  Denis Chertykov  <denisc@overta.ru>

	* reload.c (find_equiv_reg): Checks all valueno regs
	as a reload_reg_p regs.


Index: egcs/gcc/reload.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reload.c,v
retrieving revision 1.104
diff -c -3 -p -r1.104 reload.c
*** reload.c	2000/04/21 21:00:09	1.104
--- reload.c	2000/04/22 14:24:23
*************** find_equiv_reg (goal, insn, class, other
*** 6112,6129 ****
        && regno < valueno + (int) HARD_REGNO_NREGS (valueno, mode))
      return 0;
  
    /* Reject VALUE if it is one of the regs reserved for reloads.
       Reload1 knows how to reuse them anyway, and it would get
       confused if we allocated one without its knowledge.
       (Now that insns introduced by reload are ignored above,
       this case shouldn't happen, but I'm not positive.)  */
  
!   if (reload_reg_p != 0 && reload_reg_p != (short *) (HOST_WIDE_INT) 1
!       && reload_reg_p[valueno] >= 0)
!     return 0;
! 
!   nregs = HARD_REGNO_NREGS (regno, mode);
!   valuenregs = HARD_REGNO_NREGS (valueno, mode);
  
    /* Reject VALUE if it is a register being used for an input reload
       even if it is not one of those reserved.  */
--- 6112,6133 ----
        && regno < valueno + (int) HARD_REGNO_NREGS (valueno, mode))
      return 0;
  
+   nregs = HARD_REGNO_NREGS (regno, mode);
+   valuenregs = HARD_REGNO_NREGS (valueno, mode);
+ 
    /* Reject VALUE if it is one of the regs reserved for reloads.
       Reload1 knows how to reuse them anyway, and it would get
       confused if we allocated one without its knowledge.
       (Now that insns introduced by reload are ignored above,
       this case shouldn't happen, but I'm not positive.)  */
  
!   if (reload_reg_p != 0 && reload_reg_p != (short *) (HOST_WIDE_INT) 1)
!     {
!       int i;
!       for (i = 0; i < valuenregs; ++i)
! 	if (reload_reg_p[valueno + i] >= 0)
! 	  return 0;
!     }
  
    /* Reject VALUE if it is a register being used for an input reload
       even if it is not one of those reserved.  */


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