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]

Re: fix m68k-linux bootstrap (PR9093)


On Thu, Feb 06, 2003 at 12:53:09AM +0100, Roman Zippel wrote:
> Anyway, Andreas added one with PR9226.

Thanks.  Try this.


r~


	* gcse.c (local_cprop_find_used_regs): New.
	(local_cprop_pass): Use it.

Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.232
diff -c -p -d -u -r1.232 gcse.c
--- gcse.c	27 Jan 2003 11:30:35 -0000	1.232
+++ gcse.c	6 Feb 2003 01:02:59 -0000
@@ -701,6 +701,7 @@ static void free_insn_expr_list_list	PAR
 static void clear_modify_mem_tables	PARAMS ((void));
 static void free_modify_mem_tables	PARAMS ((void));
 static rtx gcse_emit_move_after		PARAMS ((rtx, rtx, rtx));
+static void local_cprop_find_used_regs	PARAMS ((rtx *, void *));
 static bool do_local_cprop		PARAMS ((rtx, rtx, int, rtx*));
 static bool adjust_libcall_notes	PARAMS ((rtx, rtx, rtx, rtx*));
 static void local_cprop_pass		PARAMS ((int));
@@ -4248,6 +4249,53 @@ cprop_insn (insn, alter_jumps)
   return changed;
 }
 
+/* Like find_used_regs, but avoid recording uses that appear in
+   input-output contexts such as zero_extract or pre_dec.  This
+   restricts the cases we consider to those for which local cprop
+   can legitimately make replacements.  */
+
+static void
+local_cprop_find_used_regs (xptr, data)
+     rtx *xptr;
+     void *data;
+{
+  rtx x = *xptr;
+
+  if (x == 0)
+    return;
+
+  switch (GET_CODE (x))
+    {
+    case ZERO_EXTRACT:
+    case SIGN_EXTRACT:
+    case STRICT_LOW_PART:
+      return;
+
+    case PRE_DEC:
+    case PRE_INC:
+    case POST_DEC:
+    case POST_INC:
+    case PRE_MODIFY:
+    case POST_MODIFY:
+      /* Can only legitimately appear this early in the context of
+	 stack pushes for function arguments, but handle all of the
+	 codes nonetheless.  */
+      return;
+
+    case SUBREG:
+      /* Setting a subreg of a register larger than word_mode leaves
+	 the non-written words unchanged.  */
+      if (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x))) > BITS_PER_WORD)
+	return;
+      break;
+
+    default:
+      break;
+    }
+
+  find_used_regs (xptr, data);
+}
+  
 /* LIBCALL_SP is a zero-terminated array of insns at the end of a libcall;
    their REG_EQUAL notes need updating.  */
 
@@ -4403,9 +4451,9 @@ local_cprop_pass (alter_jumps)
 	  do
 	    {
 	      reg_use_count = 0;
-	      note_uses (&PATTERN (insn), find_used_regs, NULL);
+	      note_uses (&PATTERN (insn), local_cprop_find_used_regs, NULL);
 	      if (note)
-		find_used_regs (&XEXP (note, 0), NULL);
+		local_cprop_find_used_regs (&XEXP (note, 0), NULL);
 
 	      for (reg_used = &reg_use_table[0]; reg_use_count > 0;
 		   reg_used++, reg_use_count--)


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