Blame SOURCES/gcc32-s390-reload-dup.patch

4ac4fd
2002-09-26  Ulrich Weigand  <uweigand@de.ibm.com>
4ac4fd
4ac4fd
	* reload.c (dup_replacements): New function.
4ac4fd
	(find_reloads): Use it to duplicate replacements at the top level
4ac4fd
	of match_dup operands.
4ac4fd
4ac4fd
2004-10-25  Jakub Jelinek  <jakub@redhat.com>
4ac4fd
4ac4fd
	* gcc.c-torture/execute/20041025-1.c: New test.
4ac4fd
4ac4fd
--- gcc/reload.c.jj	2003-04-08 15:51:07.000000000 +0200	1.190
4ac4fd
+++ gcc/reload.c	2004-10-25 13:10:48.056167117 +0200	1.191
4ac4fd
@@ -244,6 +244,7 @@ static enum reg_class find_valid_class P
4ac4fd
 						unsigned int));
4ac4fd
 static int reload_inner_reg_of_subreg PARAMS ((rtx, enum machine_mode, int));
4ac4fd
 static void push_replacement	PARAMS ((rtx *, int, enum machine_mode));
4ac4fd
+static void dup_replacements	PARAMS ((rtx *, rtx *));
4ac4fd
 static void combine_reloads	PARAMS ((void));
4ac4fd
 static int find_reusable_reload	PARAMS ((rtx *, rtx, enum reg_class,
4ac4fd
 				       enum reload_type, int, int));
4ac4fd
@@ -1578,6 +1579,25 @@ push_replacement (loc, reloadnum, mode)
4ac4fd
       r->mode = mode;
4ac4fd
     }
4ac4fd
 }
4ac4fd
+
4ac4fd
+/* Duplicate any replacement we have recorded to apply at
4ac4fd
+   location ORIG_LOC to also be performed at DUP_LOC.
4ac4fd
+   This is used in insn patterns that use match_dup.  */
4ac4fd
+
4ac4fd
+static void
4ac4fd
+dup_replacements (dup_loc, orig_loc)
4ac4fd
+     rtx *dup_loc;
4ac4fd
+     rtx *orig_loc;
4ac4fd
+{
4ac4fd
+  int i, n = n_replacements;
4ac4fd
+
4ac4fd
+  for (i = 0; i < n; i++)
4ac4fd
+    {
4ac4fd
+      struct replacement *r = &replacements[i];
4ac4fd
+      if (r->where == orig_loc)
4ac4fd
+	push_replacement (dup_loc, r->what, r->mode);
4ac4fd
+    }
4ac4fd
+}
4ac4fd
 
4ac4fd
 /* Transfer all replacements that used to be in reload FROM to be in
4ac4fd
    reload TO.  */
4ac4fd
@@ -3969,9 +3989,7 @@ find_reloads (insn, replace, ind_levels,
4ac4fd
       {
4ac4fd
 	int opno = recog_data.dup_num[i];
4ac4fd
 	*recog_data.dup_loc[i] = *recog_data.operand_loc[opno];
4ac4fd
-	if (operand_reloadnum[opno] >= 0)
4ac4fd
-	  push_replacement (recog_data.dup_loc[i], operand_reloadnum[opno],
4ac4fd
-			    insn_data[insn_code_number].operand[opno].mode);
4ac4fd
+	dup_replacements (recog_data.dup_loc[i], recog_data.operand_loc[opno]);
4ac4fd
       }
4ac4fd
 
4ac4fd
 #if 0
4ac4fd
--- gcc/testsuite/gcc.c-torture/execute/20041025-1.c.jj	2004-10-25 13:13:28.604657996 +0200
4ac4fd
+++ gcc/testsuite/gcc.c-torture/execute/20041025-1.c	2004-10-25 13:11:43.119389360 +0200
4ac4fd
@@ -0,0 +1,17 @@
4ac4fd
+extern void abort (void);
4ac4fd
+
4ac4fd
+void
4ac4fd
+foo (int a, int b, int c, int d, int e, void **f)
4ac4fd
+{
4ac4fd
+  char g[4096];
4ac4fd
+  if (f == 0 || *f != 0)
4ac4fd
+    abort ();
4ac4fd
+}
4ac4fd
+
4ac4fd
+int
4ac4fd
+main (void)
4ac4fd
+{
4ac4fd
+  void *x = 0;
4ac4fd
+  foo (0, 1, 2, 3, 4, &x);
4ac4fd
+  return 0;
4ac4fd
+}