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]

[patch] reload1.c: Detect and utilize implicit sets in move2add.(take 2)


Hi,

Attached is a patch to detect implicit sets in move2add and treat such
sets identically to explicit sets.  This patch is a revised version of

  http://gcc.gnu.org/ml/gcc-patches/2003-04/msg00733.html

This version addresses the bootstrap failure on
alphaev67-unknown-linux-gnu that occurred with my previous patch.  The
reason for the failure was exactly the same as the one Roger Sayle
faced when implementing implicit set detection in gcse.c.  See

  http://gcc.gnu.org/ml/gcc-patches/2003-02/msg00468.html

Bootstrapped on alphaev67-unknown-linux-gnu.  Tested on h8300 port.
OK to apply?

Kazu Hirata

2003-06-08  Kazu Hirata  <kazu@cs.umass.edu>

	* gcse.c (fis_get_condition): Make it a global function.
	* reload1.c (reload_cse_move2add): Detect implicit sets.
	* rtl.h: Add a prototype for fis_get_condition.

Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.249
diff -u -r1.249 gcse.c
--- gcse.c	21 May 2003 01:16:32 -0000	1.249
+++ gcse.c	8 Jun 2003 19:43:54 -0000
@@ -611,7 +611,6 @@
 static void canon_list_insert        PARAMS ((rtx, rtx, void *));
 static int cprop_insn		PARAMS ((rtx, int));
 static int cprop		PARAMS ((int));
-static rtx fis_get_condition	PARAMS ((rtx));
 static void find_implicit_sets	PARAMS ((void));
 static int one_cprop_pass	PARAMS ((int, int, int));
 static bool constprop_register	PARAMS ((rtx, rtx, rtx, int));
@@ -4610,7 +4609,7 @@
    recording the value of *every* register scaned by canonicalize_condition,
    but this would require some code reorganization.  */
 
-static rtx
+rtx
 fis_get_condition (jump)
      rtx jump;
 {
Index: reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.395
diff -u -r1.395 reload1.c
--- reload1.c	7 Jun 2003 05:33:00 -0000	1.395
+++ reload1.c	8 Jun 2003 19:43:59 -0000
@@ -9301,6 +9301,26 @@
 	    }
 	}
       note_stores (PATTERN (insn), move2add_note_store, NULL);
+
+      /* If INSN is a conditional branch, we try to extract an
+	 implicit set out of it.  */
+      if (any_condjump_p (insn) && onlyjump_p (insn))
+	{
+	  rtx cnd = fis_get_condition (insn);
+
+	  if (cnd != NULL_RTX
+	      && GET_CODE (cnd) == NE
+	      && GET_CODE (XEXP (cnd, 0)) == REG
+	      && SCALAR_INT_MODE_P (GET_MODE (XEXP (cnd, 0)))
+	      && HARD_REGNO_NREGS (REGNO (XEXP (cnd, 0)), GET_MODE (XEXP (cnd, 0))) == 1
+	      && GET_CODE (XEXP (cnd, 1)) == CONST_INT)
+	    {
+	      rtx implicit_set =
+		gen_rtx_SET (VOIDmode, XEXP (cnd, 0), XEXP (cnd, 1));
+	      move2add_note_store (SET_DEST (implicit_set), implicit_set, 0);
+	    }
+	}
+
       /* If this is a CALL_INSN, all call used registers are stored with
 	 unknown values.  */
       if (GET_CODE (insn) == CALL_INSN)
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.410
diff -u -r1.410 rtl.h
--- rtl.h	8 Jun 2003 19:35:53 -0000	1.410
+++ rtl.h	8 Jun 2003 19:44:00 -0000
@@ -2168,6 +2168,7 @@
 
 /* In gcse.c */
 extern bool can_copy_p			PARAMS ((enum machine_mode));
+extern rtx fis_get_condition		PARAMS ((rtx));
 #ifdef BUFSIZ
 extern int gcse_main			PARAMS ((rtx, FILE *));
 extern int bypass_jumps			PARAMS ((FILE *));


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