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]

ppc prolog scheduling/fpint/CLOBBERs of MEMs



This patch fixes a problem with CLOBBERs of MEMs.  It is the first in
a long series of patches to implement prolog scheduling on ppc; this
particular change is needed to deal with the new fp<->int handling.

The problem it fixes is that given a sequence of insns like

(set (reg:SI 100) (plus:SI (reg:SI 31) (const_int 0x00060000)))
(set (reg:SI 101) (plus:SI (reg:SI 100) (const_int 0x00001234)))
(parallel [ (...)
	    (clobber (mem:SI (reg:SI 101)))])

combine would turn these into

(set (reg:SI 100) (plus:SI (reg:SI 31) (const_int 0x00060000)))
(parallel [ (...)
	    (clobber (mem:SI (plus:SI (reg:SI 100) (const_int 0x00001234))))]

and then decide that register 100 is not now used, and delete its setter.

It seems that the only reason this wasn't causing trouble earlier is
that on non-RISC machines (like x86), MEMs usually have the frame
pointer as the register, which is hardly ever dead :-).

Jim Wilson helped me find this and Richard Henderson approved the patch.

-- 
- Geoffrey Keating <geoffk@cygnus.com>

===File ~/patches/cygnus/rs6000-psched-3-memclobber.patch===
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ChangeLog,v
retrieving revision 1.5477
diff -p -u -u -p -r1.5477 ChangeLog
--- ChangeLog	2000/01/19 20:09:59	1.5477
+++ ChangeLog	2000/01/19 20:12:45
@@ -1,3 +1,8 @@
+2000-01-19  Geoff Keating  <geoffk@cygnus.com>
+
+	* rtlanal.c (reg_referenced_p): A CLOBBER of a MEM uses any REGs
+	inside the MEM.
+
 2000-01-20  Michael Hayes  <m.hayes@elec.canterbury.ac.nz>
 
 	* loop.c (loop_optimize): Allocate loop_info structure for each loop
Index: rtlanal.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtlanal.c,v
retrieving revision 1.51
diff -p -u -u -p -r1.51 rtlanal.c
--- rtlanal.c	2000/01/17 17:16:20	1.51
+++ rtlanal.c	2000/01/19 20:12:45
@@ -422,6 +422,12 @@ reg_referenced_p (x, body)
 	  return 1;
       return 0;
       
+    case CLOBBER:
+      if (GET_CODE (XEXP (body, 0)) == MEM)
+	if (reg_overlap_mentioned_p (x, XEXP (XEXP (body, 0), 0)))
+	  return 1;
+      return 0;
+
     default:
       return 0;
     }
============================================================

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