This is the mail archive of the gcc@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: [dataflow] partial register handling



The rules should be simple. Bits of the dest reg survive only if one of the following is true.

- there is a STRICT_LOW_PART (of a SUBREG)

- there is a ZERO_EXTRACT (not necessarily of a SUBREG!)

- the subreg is part of a multiword subreg

So, this is a prototype patch that I would like to go in.


Paolo
	* df-scan.c (df_read_modify_subreg_p): Use REGMODE_NATURAL_SIZE.
	(df_def_record_1): Sets to ZERO_EXTRACT get DF_REF_PARTIAL.

Index: gcc-test-df/base-gcc-src/gcc/df-scan.c
===================================================================
--- gcc-test-df/base-gcc-src/gcc/df-scan.c	(revision 124539)
+++ gcc-test-df/base-gcc-src/gcc/df-scan.c	(working copy)
@@ -2697,12 +2697,15 @@ df_ref_record (struct df_collection_rec 
 bool
 df_read_modify_subreg_p (rtx x)
 {
+  enum machine_mode imode, omode;
   unsigned int isize, osize;
   if (GET_CODE (x) != SUBREG)
     return false;
-  isize = GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)));
-  osize = GET_MODE_SIZE (GET_MODE (x));
-  return (isize > osize && isize > UNITS_PER_WORD);
+  imode = GET_MODE (SUBREG_REG (x));
+  omode = GET_MODE (x);
+  isize = GET_MODE_SIZE (imode);
+  osize = GET_MODE_SIZE (omode);
+  return (isize > osize && isize > REGMODE_NATURAL_SIZE (imode));
 }
 
 
@@ -2751,30 +2754,18 @@ df_def_record_1 (struct df_collection_re
 	 || GET_CODE (dst) == ZERO_EXTRACT
 	 || df_read_modify_subreg_p (dst))
     {
-#if 0
-      /* Strict low part always contains SUBREG, but we do not want to make
-	 it appear outside, as whole register is always considered.  */
-      if (GET_CODE (dst) == STRICT_LOW_PART)
-	{
-	  loc = &XEXP (dst, 0);
-	  dst = *loc;
-	}
-#endif
-      loc = &XEXP (dst, 0);
-      if (GET_CODE (dst) == STRICT_LOW_PART)
-	dst_in_strict_lowpart = true;
-      dst = *loc;
       flags |= DF_REF_READ_WRITE;
 
+      /* Apart from sets to a subreg of a multi-word register, all
+         partial sets are recognized here.  */
+      if (GET_CODE (dst) == STRICT_LOW_PART
+	  || GET_CODE (dst) == ZERO_EXTRACT)
+	flags |= DF_REF_PARTIAL;
+
+      loc = &XEXP (dst, 0);
+      dst = *loc;
     }
 
-  /* Sets to a subreg of a single word register are partial sets if
-     they are wrapped in a strict lowpart, and not partial otherwise.
-  */
-  if (GET_CODE (dst) == SUBREG && REG_P (SUBREG_REG (dst))
-      && dst_in_strict_lowpart)
-    flags |= DF_REF_PARTIAL;
-    
   if (REG_P (dst)
       || (GET_CODE (dst) == SUBREG && REG_P (SUBREG_REG (dst))))
     df_ref_record (collection_rec, 

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