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]
Other format: [Raw text]

Overlapping of complex addresses generated by reload


On Nov  6, 2001, Hans-Peter Nilsson <hp@bitrange.com> wrote:

> sh and mcore have pending patches for one show-stopper bug (the same
> for both, it seems).
> <URL:http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00009.html> and
> <URL:http://gcc.gnu.org/ml/gcc-patches/2001-08/msg00920.html>

Here's my stab at fixing the problem.  It's similar to Kaz Kojima's
patch, but perhaps a bit more general, and totally different from Jan
Hubicka's, even though I confess I don't have a complete understanding
of the issue, so I don't know whether I'm addressing the problem on
the right level.  This patch is enough to get sh-elf back to a
buildable state.  Is this (or any of the above) ok to install?

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* reload.c (reg_overlap_mentioned_for_reload_p): Handle PLUS and
	auto_inc_dec values.

Index: gcc/reload.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reload.c,v
retrieving revision 1.175
diff -u -p -r1.175 reload.c
--- gcc/reload.c 2002/01/13 22:57:29 1.175
+++ gcc/reload.c 2002/01/19 03:49:38
@@ -6166,7 +6166,13 @@ reg_overlap_mentioned_for_reload_p (x, i
   int regno, endregno;
 
   /* Overly conservative.  */
-  if (GET_CODE (x) == STRICT_LOW_PART)
+  if (GET_CODE (x) == STRICT_LOW_PART
+      || GET_CODE (x) == PRE_INC
+      || GET_CODE (x) == POST_INC
+      || GET_CODE (x) == PRE_DEC
+      || GET_CODE (x) == POST_DEC
+      || GET_CODE (x) == PRE_MODIFY
+      || GET_CODE (x) == POST_MODIFY)
     x = XEXP (x, 0);
 
   /* If either argument is a constant, then modifying X can not affect IN.  */
@@ -6202,6 +6208,9 @@ reg_overlap_mentioned_for_reload_p (x, i
   else if (GET_CODE (x) == SCRATCH || GET_CODE (x) == PC
 	   || GET_CODE (x) == CC0)
     return reg_mentioned_p (x, in);
+  else if (GET_CODE (x) == PLUS)
+    return (reg_overlap_mentioned_for_reload_p (XEXP (x, 0), in)
+	    || reg_overlap_mentioned_for_reload_p (XEXP (x, 1), in));
   else
     abort ();
 

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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