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 fix for reload reg selection


Here is the revised patch:

Wed Jan 24 18:11:10 2001  J"orn Rennecke <amylaar@redhat.com>

	* reload1.c (reload_reg_free_for_value_p): New parameter start_regno.
	Changed all callers.  Take it into account when deciding if a
	previously loaded value matches.

Index: reload1.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reload1.c,v
retrieving revision 1.254
diff -p -r1.254 reload1.c
*** reload1.c	2001/01/19 16:32:27	1.254
--- reload1.c	2001/01/24 18:10:45
*************** static void clear_reload_reg_in_use	PARA
*** 414,420 ****
  						 enum machine_mode));
  static int reload_reg_free_p		PARAMS ((unsigned int, int,
  						 enum reload_type));
! static int reload_reg_free_for_value_p	PARAMS ((int, int, enum reload_type,
  						 rtx, rtx, int, int));
  static int free_for_value_p		PARAMS ((int, enum machine_mode, int,
  						 enum reload_type, rtx, rtx,
--- 414,421 ----
  						 enum machine_mode));
  static int reload_reg_free_p		PARAMS ((unsigned int, int,
  						 enum reload_type));
! static int reload_reg_free_for_value_p	PARAMS ((int, int, int,
! 						 enum reload_type,
  						 rtx, rtx, int, int));
  static int free_for_value_p		PARAMS ((int, enum machine_mode, int,
  						 enum reload_type, rtx, rtx,
*************** rtx reload_override_in[MAX_RELOADS];
*** 4725,4736 ****
     or -1 if we did not need a register for this reload.  */
  int reload_spill_index[MAX_RELOADS];
  
! /* Subroutine of free_for_value_p, used to check a single register.  */
  
  static int
! reload_reg_free_for_value_p (regno, opnum, type, value, out, reloadnum,
! 			     ignore_address_reloads)
!      int regno;
       int opnum;
       enum reload_type type;
       rtx value, out;
--- 4726,4739 ----
     or -1 if we did not need a register for this reload.  */
  int reload_spill_index[MAX_RELOADS];
  
! /* Subroutine of free_for_value_p, used to check a single register.
!    START_REGNO is the starting regno of the full reload register
!    (possibly comprising multiple hard registers) that we are considering.  */
  
  static int
! reload_reg_free_for_value_p (start_regno, regno, opnum, type, value, out,
! 			     reloadnum, ignore_address_reloads)
!      int start_regno, regno;
       int opnum;
       enum reload_type type;
       rtx value, out;
*************** reload_reg_free_for_value_p (regno, opnu
*** 4823,4829 ****
  	      <= HARD_REGNO_NREGS (REGNO (reg), GET_MODE (reg)) - (unsigned)1)
  	  && i != reloadnum)
  	{
! 	  if (! rld[i].in || ! rtx_equal_p (rld[i].in, value)
  	      || rld[i].out || out)
  	    {
  	      int time2;
--- 4826,4839 ----
  	      <= HARD_REGNO_NREGS (REGNO (reg), GET_MODE (reg)) - (unsigned)1)
  	  && i != reloadnum)
  	{
! 	  rtx other_input = rld[i].in;
! 
! 	  /* If the other reload loads the same input value, that
! 	     will not cause a conflict only if it's loading it into
! 	     the same register.  */
! 	  if (true_regnum (reg) != start_regno)
! 	    other_input = NULL_RTX;
! 	  if (! other_input || ! rtx_equal_p (other_input, value)
  	      || rld[i].out || out)
  	    {
  	      int time2;
*************** reload_reg_free_for_value_p (regno, opnu
*** 4904,4910 ****
  		case RELOAD_OTHER:
  		  /* If there is no conflict in the input part, handle this
  		     like an output reload.  */
! 		  if (! rld[i].in || rtx_equal_p (rld[i].in, value))
  		    {
  		      time2 = MAX_RECOG_OPERANDS * 4 + 4;
  		      /* Earlyclobbered outputs must conflict with inputs.  */
--- 4914,4920 ----
  		case RELOAD_OTHER:
  		  /* If there is no conflict in the input part, handle this
  		     like an output reload.  */
! 		  if (! rld[i].in || rtx_equal_p (other_input, value))
  		    {
  		      time2 = MAX_RECOG_OPERANDS * 4 + 4;
  		      /* Earlyclobbered outputs must conflict with inputs.  */
*************** reload_reg_free_for_value_p (regno, opnu
*** 4926,4932 ****
  		}
  	      if ((time1 >= time2
  		   && (! rld[i].in || rld[i].out
! 		       || ! rtx_equal_p (rld[i].in, value)))
  		  || (out && rld[reloadnum].out_reg
  		      && time2 >= MAX_RECOG_OPERANDS * 4 + 3))
  		return 0;
--- 4936,4942 ----
  		}
  	      if ((time1 >= time2
  		   && (! rld[i].in || rld[i].out
! 		       || ! rtx_equal_p (other_input, value)))
  		  || (out && rld[reloadnum].out_reg
  		      && time2 >= MAX_RECOG_OPERANDS * 4 + 3))
  		return 0;
*************** free_for_value_p (regno, mode, opnum, ty
*** 4977,4984 ****
  {
    int nregs = HARD_REGNO_NREGS (regno, mode);
    while (nregs-- > 0)
!     if (! reload_reg_free_for_value_p (regno + nregs, opnum, type, value, out,
! 				       reloadnum, ignore_address_reloads))
        return 0;
    return 1;
  }
--- 4987,4995 ----
  {
    int nregs = HARD_REGNO_NREGS (regno, mode);
    while (nregs-- > 0)
!     if (! reload_reg_free_for_value_p (regno, regno + nregs, opnum, type,
! 				       value, out, reloadnum,
! 				       ignore_address_reloads))
        return 0;
    return 1;
  }
*************** allocate_reload_reg (chain, r, last_relo
*** 5141,5147 ****
  		   && ! TEST_HARD_REG_BIT (reload_reg_used, regnum)
  		   && free_for_value_p (regnum, rld[r].mode, rld[r].opnum,
  					rld[r].when_needed, rld[r].in,
! 					rld[r].out, r, 1)))
  	      && TEST_HARD_REG_BIT (reg_class_contents[class], regnum)
  	      && HARD_REGNO_MODE_OK (regnum, rld[r].mode)
  	      /* Look first for regs to share, then for unshared.  But
--- 5152,5158 ----
  		   && ! TEST_HARD_REG_BIT (reload_reg_used, regnum)
  		   && free_for_value_p (regnum, rld[r].mode, rld[r].opnum,
  					rld[r].when_needed, rld[r].in,
! 					rld[r].out, r, 0)))
  	      && TEST_HARD_REG_BIT (reg_class_contents[class], regnum)
  	      && HARD_REGNO_MODE_OK (regnum, rld[r].mode)
  	      /* Look first for regs to share, then for unshared.  But

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