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]

2.95: Backport reload_combine fix


This patch was suggested by Hartmut Schirmer to fix some problems on sh-elf
targets.  The original submission can be found at

  http://gcc.gnu.org/ml/gcc-patches/2000-03/msg00030.html


Bernd

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ChangeLog,v
retrieving revision 1.3667.4.351
diff -u -p -r1.3667.4.351 ChangeLog
--- ChangeLog	2001/04/03 13:13:26	1.3667.4.351
+++ ChangeLog	2001/04/03 14:40:58
@@ -21,6 +21,10 @@
 	(get_last_value_validate) : Same.
 	(get_last_value) : Same.

+	Fri Mar  3 12:49:28 2000  J"orn Rennecke <amylaar@cygnus.co.uk>
+        * reload1.c (reload_combine_note_use): Handle return register USEs.
+	REG case: Handle multi-hard-register hard regs.
+
 2001-03-30  Bernd Schmidt  <bernds@redhat.com>

 	* jump.c (delete_barrier_successors): Fix error in last change.
Index: reload1.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reload1.c,v
retrieving revision 1.145.4.13
diff -u -p -r1.145.4.13 reload1.c
--- reload1.c	2001/03/30 13:13:16	1.145.4.13
+++ reload1.c	2001/04/03 14:41:04
@@ -9970,6 +9970,21 @@ reload_combine_note_use (xp, insn)
 	}
       break;

+    case USE:
+      /* If this is the USE of a return value, we can't change it.  */
+      if (GET_CODE (XEXP (x, 0)) == REG && REG_FUNCTION_VALUE_P (XEXP (x, 0)))
+	{
+	/* Mark the return register as used in an unknown fashion.  */
+	  rtx reg = XEXP (x, 0);
+	  int regno = REGNO (reg);
+	  int nregs = HARD_REGNO_NREGS (regno, GET_MODE (reg));
+
+	  while (--nregs >= 0)
+	    reg_state[regno + nregs].use_index = -1;
+	  return;
+	}
+      break;
+
     case CLOBBER:
       if (GET_CODE (SET_DEST (x)) == REG)
 	return;
@@ -9986,11 +10001,22 @@ reload_combine_note_use (xp, insn)
       {
 	int regno = REGNO (x);
 	int use_index;
+	int nregs;

 	/* Some spurious USEs of pseudo registers might remain.
 	   Just ignore them.  */
 	if (regno >= FIRST_PSEUDO_REGISTER)
 	  return;
+
+	nregs = HARD_REGNO_NREGS (regno, GET_MODE (x));
+
+	/* We can't substitute into multi-hard-reg uses.  */
+	if (nregs > 1)
+	  {
+	    while (--nregs >= 0)
+	      reg_state[regno + nregs].use_index = -1;
+	    return;
+	  }

 	/* If this register is already used in some unknown fashion, we
 	   can't do anything.


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