[new-ra] testsuite fixes for ppc64

Michael Matz matz@suse.de
Wed Oct 15 18:22:00 GMT 2003


Hi,

we were missing the fact, that CLOBBERs in parallels conflicts with all
inputs, which resulted in some testsuite regression on ppc64.
Unfortunately we can only add such conflicts for non-asm insns, as for
instance on i386 some asm's have to specify incorrect clobbers (like
clobbering "st(1)", but also having on input operand constrained to that
very register).

Still doesn't bootstrap ppc64 because genattrtab is miscompiled.  But
bootstraps all langs minus treelang on x86.


Ciao,
Michael.
-- 
        * df.h (enum df_ref_type): Add member DF_REF_REG_CLOBBER.
        (DF_REF_TYPE_NAMES): Adjust.
        (DF_REF_REG_DEF_P): Check for the above type.
        * df.c (df_ref_search_cached, df_ref_create): Check for new type.
        (df_def_record_1): Use new type for CLOBBERs.
        * ra-build.c (add_additional_conflicts): Add conflicts between
        CLOBBERs and inputs.

Index: df.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/df.c,v
retrieving revision 1.1.2.23
diff -u -p -r1.1.2.23 df.c
--- df.c	10 Oct 2003 14:18:20 -0000	1.1.2.23
+++ df.c	15 Oct 2003 16:07:58 -0000
@@ -732,7 +732,7 @@ df_ref_search_cached (struct df *df, rtx
   struct ref *this_ref;
   unsigned int uid = INSN_UID (insn);
   struct df_link *link;
-  if (ref_type == DF_REF_REG_DEF)
+  if (ref_type == DF_REF_REG_DEF || ref_type == DF_REF_REG_CLOBBER)
     link = df->insns[uid].defs;
   else
     link = df->insns[uid].uses;
@@ -775,7 +775,7 @@ df_ref_create (struct df *df, rtx reg, r
   DF_REF_TYPE (this_ref) = ref_type;
   DF_REF_FLAGS (this_ref) = ref_flags;

-  if (ref_type == DF_REF_REG_DEF)
+  if (ref_type == DF_REF_REG_DEF || ref_type == DF_REF_REG_CLOBBER)
     {
       if (df->def_id >= df->def_size)
 	{
@@ -946,7 +946,10 @@ df_def_record_1 (struct df *df, rtx x, b

   if (GET_CODE (dst) == REG
       || (GET_CODE (dst) == SUBREG && GET_CODE (SUBREG_REG (dst)) == REG))
-    df_ref_record (df, dst, loc, insn, DF_REF_REG_DEF, flags);
+    df_ref_record (df, dst, loc, insn,
+		   GET_CODE (x) == CLOBBER
+		     ? DF_REF_REG_CLOBBER : DF_REF_REG_DEF,
+		   flags);
 }


Index: df.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/df.h,v
retrieving revision 1.1.2.15
diff -u -p -r1.1.2.15 df.h
--- df.h	10 Oct 2003 14:18:21 -0000	1.1.2.15
+++ df.h	15 Oct 2003 16:07:58 -0000
@@ -33,10 +33,11 @@ Software Foundation, 59 Temple Place - S
 #define DF_EQUIV_NOTES 2048	/* Mark uses present in EQUIV/EQUAL notes.  */
 #define DF_FOR_REGALLOC 4096    /* If called for the register allocator.  */

-enum df_ref_type {DF_REF_REG_DEF, DF_REF_REG_USE, DF_REF_REG_MEM_LOAD,
+enum df_ref_type {DF_REF_REG_DEF, DF_REF_REG_CLOBBER,
+		  DF_REF_REG_USE, DF_REF_REG_MEM_LOAD,
 		  DF_REF_REG_MEM_STORE};

-#define DF_REF_TYPE_NAMES {"def", "use", "mem load", "mem store"}
+#define DF_REF_TYPE_NAMES {"def", "clobber", "use", "mem load", "mem store"}

 /* Link on a def-use or use-def chain.  */
 struct df_link
@@ -204,7 +205,8 @@ struct df_map

 /* Macros to determine the reference type.  */

-#define DF_REF_REG_DEF_P(REF) (DF_REF_TYPE (REF) == DF_REF_REG_DEF)
+#define DF_REF_REG_DEF_P(REF) (DF_REF_TYPE (REF) == DF_REF_REG_DEF \
+			       || DF_REF_TYPE (REF) == DF_REF_REG_CLOBBER)
 #define DF_REF_REG_USE_P(REF) ((REF) && ! DF_REF_REG_DEF_P (REF))
 #define DF_REF_REG_MEM_STORE_P(REF) (DF_REF_TYPE (REF) == DF_REF_REG_MEM_STORE)
 #define DF_REF_REG_MEM_LOAD_P(REF) (DF_REF_TYPE (REF) == DF_REF_REG_MEM_LOAD)
Index: ra-build.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ra-build.c,v
retrieving revision 1.1.2.20
diff -u -p -r1.1.2.20 ra-build.c
--- ra-build.c	10 Oct 2003 14:39:06 -0000	1.1.2.20
+++ ra-build.c	15 Oct 2003 16:07:58 -0000
@@ -2407,12 +2407,21 @@ add_additional_conflicts (void)
       {
 	int uid = INSN_UID (insn);
 	unsigned int n, num_defs = insn_df[uid].num_defs;
+	int is_asm = INSN_CODE (insn) < 0
+	    	     && asm_noperands (PATTERN (insn)) >= 0;
 	rtx source, dest;
 	for (n = 0; n < num_defs; n++)
 	  {
 	    struct ref *def = insn_df[uid].defs[n];
 	    ra_ref *rdef = DF2RA (df2ra, def);
-	    if (rdef && RA_REF_CLOBBER_P (rdef))
+	    /* Note that also direct clobbers of registers (as part
+	       of an parallel) conflict with the inputs, not just
+	       those marked early-clobber in the constraints.
+	       For handwritten asm insns some users are forced to
+	       write incorrect clobbers (i387 insns) conflicting
+	       with the inputs, so don't add such conflicts.  */
+	    if ((rdef && RA_REF_CLOBBER_P (rdef))
+		|| (!is_asm && DF_REF_TYPE (def) == DF_REF_REG_CLOBBER))
 	      {
 		unsigned int u, num_uses = insn_df[uid].num_uses;
 		struct web *web1 = def2web[DF_REF_ID (def)];



More information about the Gcc-patches mailing list