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]

reload_as_needed patch applied


Reviewed by Jim Wilson.

Mon Mar 22 22:24:30 1999  J"orn Rennecke <amylaar@cygnus.co.uk>

	* reload1.c (reload_as_needed): Set reload_is_output_reload /
	reload_has_output_reload for auto_inc expressions that could be
	reloaded.  Call forget_old_reloads for REG_INC notes.

Index: reload1.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/reload1.c,v
retrieving revision 1.218.2.7
diff -p -r1.218.2.7 reload1.c
*** reload1.c	1999/03/17 22:59:53	1.218.2.7
--- reload1.c	1999/03/19 02:35:50
*************** reload_as_needed (live_known)
*** 4404,4420 ****
  			  break;
  			}
  		      if (n == 1)
! 			REG_NOTES (p) = gen_rtx_EXPR_LIST (REG_INC, reload_reg,
! 							   REG_NOTES (p));
  		      else
  			forget_old_reloads_1 (XEXP (in_reg, 0), NULL_RTX);
  		    }
  		}
  	    }
! #if 0 /* ??? Is this code obsolete now?  Need to check carefully. */
! 	  /* Likewise for regs altered by auto-increment in this insn.
! 	     But note that the reg-notes are not changed by reloading:
! 	     they still contain the pseudo-regs, not the spill regs.  */
  	  for (x = REG_NOTES (insn); x; x = XEXP (x, 1))
  	    if (REG_NOTE_KIND (x) == REG_INC)
  	      {
--- 4404,4440 ----
  			  break;
  			}
  		      if (n == 1)
! 			{
! 			  REG_NOTES (p)
! 			    = gen_rtx_EXPR_LIST (REG_INC, reload_reg,
! 						 REG_NOTES (p));
! 			  /* Mark this as having an output reload so that the
! 			     REG_INC processing code below won't invalidate
! 			     the reload for inheritance.  */
! 			  SET_HARD_REG_BIT (reg_is_output_reload,
! 					    REGNO (reload_reg));
! 			  reg_has_output_reload[REGNO (XEXP (in_reg, 0))] = 1;
! 			}
  		      else
  			forget_old_reloads_1 (XEXP (in_reg, 0), NULL_RTX);
  		    }
+ 		  else if ((code == PRE_INC || code == PRE_DEC)
+ 			   && TEST_HARD_REG_BIT (reg_reloaded_valid,
+ 						 REGNO (reload_reg_rtx[i]))
+ 			   /* Make sure it is the inc/dec pseudo, and not
+ 			      some other (e.g. output operand) pseudo.  */
+ 			   && (reg_reloaded_contents[REGNO (reload_reg_rtx[i])]
+ 			       == REGNO (XEXP (in_reg, 0))))
+ 		    {
+ 		      SET_HARD_REG_BIT (reg_is_output_reload,
+ 					REGNO (reload_reg_rtx[i]));
+ 		      reg_has_output_reload[REGNO (XEXP (in_reg, 0))] = 1;
+ 		    }
  		}
  	    }
! 	  /* If a pseudo that got a hard register is auto-incremented,
! 	     we must purge records of copying it into pseudos without
! 	     hard registers.  */
  	  for (x = REG_NOTES (insn); x; x = XEXP (x, 1))
  	    if (REG_NOTE_KIND (x) == REG_INC)
  	      {
*************** reload_as_needed (live_known)
*** 4428,4434 ****
  		if (i == n_reloads)
  		  forget_old_reloads_1 (XEXP (x, 0), NULL_RTX);
  	      }
- #endif
  #endif
  	}
        /* A reload reg's contents are unknown after a label.  */
--- 4448,4453 ----


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