diff mbox series

Drop df_ from df_read_modify_subreg_p

Message ID 87378ghln3.fsf@linaro.org
State New
Headers show
Series Drop df_ from df_read_modify_subreg_p | expand

Commit Message

Richard Sandiford Aug. 24, 2017, 6:21 p.m. UTC
...it's really a general RTL predicate, rather than something that depends
on the DF state.  Thanks to Segher for the suggestion.

Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?

Richard


2017-08-24  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	* df.h (df_read_modify_subreg_p): Remove in favor of...
	* rtl.h (read_modify_subreg_p): ...this new function.  Take a
	const_rtx instead of an rtx.
	* cprop.c (local_cprop_find_used_regs): Update accordingly.
	* df-problems.c (df_word_lr_mark_ref): Likewise.
	* ira-lives.c (mark_pseudo_reg_live): Likewise.
	(mark_pseudo_reg_dead): Likewise.
	(mark_ref_dead): Likewise.
	* reginfo.c (init_subregs_of_mode): Likewise.
	* sched-deps.c (sched_analyze_1): Likewise.
	* df-scan.c (df_def_record_1): Likewise.
	(df_uses_record): Likewise.
	(df_read_modify_subreg_p): Remove in favor of...
	* rtlanal.c (read_modify_subreg_p): ...this new function.  Take a
	const_rtx instead of an rtx.

Comments

Jeff Law Aug. 24, 2017, 9:01 p.m. UTC | #1
On 08/24/2017 12:21 PM, Richard Sandiford wrote:
> ...it's really a general RTL predicate, rather than something that depends

> on the DF state.  Thanks to Segher for the suggestion.

> 

> Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?

> 

> Richard

> 

> 

> 2017-08-24  Richard Sandiford  <richard.sandiford@linaro.org>

> 

> gcc/

> 	* df.h (df_read_modify_subreg_p): Remove in favor of...

> 	* rtl.h (read_modify_subreg_p): ...this new function.  Take a

> 	const_rtx instead of an rtx.

> 	* cprop.c (local_cprop_find_used_regs): Update accordingly.

> 	* df-problems.c (df_word_lr_mark_ref): Likewise.

> 	* ira-lives.c (mark_pseudo_reg_live): Likewise.

> 	(mark_pseudo_reg_dead): Likewise.

> 	(mark_ref_dead): Likewise.

> 	* reginfo.c (init_subregs_of_mode): Likewise.

> 	* sched-deps.c (sched_analyze_1): Likewise.

> 	* df-scan.c (df_def_record_1): Likewise.

> 	(df_uses_record): Likewise.

> 	(df_read_modify_subreg_p): Remove in favor of...

> 	* rtlanal.c (read_modify_subreg_p): ...this new function.  Take a

> 	const_rtx instead of an rtx.

OK.
jeff
diff mbox series

Patch

Index: gcc/df.h
===================================================================
--- gcc/df.h	2017-08-24 19:20:31.055856350 +0100
+++ gcc/df.h	2017-08-24 19:20:31.265856538 +0100
@@ -1080,7 +1080,6 @@  extern unsigned int df_hard_reg_used_cou
 extern bool df_regs_ever_live_p (unsigned int);
 extern void df_set_regs_ever_live (unsigned int, bool);
 extern void df_compute_regs_ever_live (bool);
-extern bool df_read_modify_subreg_p (rtx);
 extern void df_scan_verify (void);
 
 
Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h	2017-08-24 19:20:31.055856350 +0100
+++ gcc/rtl.h	2017-08-24 19:20:31.266856539 +0100
@@ -2176,6 +2176,7 @@  extern unsigned int subreg_lsb_1 (machin
 				  unsigned int);
 extern unsigned int subreg_size_offset_from_lsb (unsigned int, unsigned int,
 						 unsigned int);
+extern bool read_modify_subreg_p (const_rtx);
 
 /* Return the subreg byte offset for a subreg whose outer mode is
    OUTER_MODE, whose inner mode is INNER_MODE, and where there are
@@ -2800,7 +2801,7 @@  partial_subreg_p (machine_mode outermode
 }
 
 /* Likewise return true if X is a subreg that is smaller than the inner
-   register.  Use df_read_modify_subreg_p to test whether writing to such
+   register.  Use read_modify_subreg_p to test whether writing to such
    a subreg preserves any part of the inner register.  */
 
 inline bool
Index: gcc/cprop.c
===================================================================
--- gcc/cprop.c	2017-08-24 19:20:31.055856350 +0100
+++ gcc/cprop.c	2017-08-24 19:20:31.264856537 +0100
@@ -1161,7 +1161,7 @@  local_cprop_find_used_regs (rtx *xptr, v
       return;
 
     case SUBREG:
-      if (df_read_modify_subreg_p (x))
+      if (read_modify_subreg_p (x))
 	return;
       break;
 
Index: gcc/df-problems.c
===================================================================
--- gcc/df-problems.c	2017-08-24 19:20:31.055856350 +0100
+++ gcc/df-problems.c	2017-08-24 19:20:31.264856537 +0100
@@ -2819,7 +2819,7 @@  df_word_lr_mark_ref (df_ref ref, bool is
     return true;
 
   if (GET_CODE (orig_reg) == SUBREG
-      && df_read_modify_subreg_p (orig_reg))
+      && read_modify_subreg_p (orig_reg))
     {
       gcc_assert (DF_REF_FLAGS_IS_SET (ref, DF_REF_PARTIAL));
       if (subreg_lowpart_p (orig_reg))
Index: gcc/ira-lives.c
===================================================================
--- gcc/ira-lives.c	2017-08-24 19:20:31.055856350 +0100
+++ gcc/ira-lives.c	2017-08-24 19:20:31.265856538 +0100
@@ -364,7 +364,7 @@  mark_hard_reg_live (rtx reg)
 static void
 mark_pseudo_reg_live (rtx orig_reg, unsigned regno)
 {
-  if (df_read_modify_subreg_p (orig_reg))
+  if (read_modify_subreg_p (orig_reg))
     {
       mark_pseudo_regno_subword_live (regno,
 				      subreg_lowpart_p (orig_reg) ? 0 : 1);
@@ -489,7 +489,7 @@  mark_hard_reg_dead (rtx reg)
 static void
 mark_pseudo_reg_dead (rtx orig_reg, unsigned regno)
 {
-  if (df_read_modify_subreg_p (orig_reg))
+  if (read_modify_subreg_p (orig_reg))
     {
       mark_pseudo_regno_subword_dead (regno,
 				      subreg_lowpart_p (orig_reg) ? 0 : 1);
@@ -515,7 +515,7 @@  mark_ref_dead (df_ref def)
   if (DF_REF_FLAGS_IS_SET (def, DF_REF_PARTIAL)
       && (GET_CODE (orig_reg) != SUBREG
 	  || REGNO (reg) < FIRST_PSEUDO_REGISTER
-	  || !df_read_modify_subreg_p (orig_reg)))
+	  || !read_modify_subreg_p (orig_reg)))
     return;
 
   if (REGNO (reg) >= FIRST_PSEUDO_REGISTER)
Index: gcc/reginfo.c
===================================================================
--- gcc/reginfo.c	2017-08-24 19:20:31.055856350 +0100
+++ gcc/reginfo.c	2017-08-24 19:20:31.265856538 +0100
@@ -1356,7 +1356,7 @@  init_subregs_of_mode (void)
 	  df_ref def;
 	  FOR_EACH_INSN_DEF (def, insn)
 	    if (DF_REF_FLAGS_IS_SET (def, DF_REF_PARTIAL)
-		&& df_read_modify_subreg_p (DF_REF_REG (def)))
+		&& read_modify_subreg_p (DF_REF_REG (def)))
 	      record_subregs_of_mode (DF_REF_REG (def), true);
 	}
 }
Index: gcc/sched-deps.c
===================================================================
--- gcc/sched-deps.c	2017-08-24 19:20:31.055856350 +0100
+++ gcc/sched-deps.c	2017-08-24 19:20:31.267856540 +0100
@@ -2419,7 +2419,7 @@  sched_analyze_1 (struct deps_desc *deps,
     {
       if (GET_CODE (dest) == STRICT_LOW_PART
 	 || GET_CODE (dest) == ZERO_EXTRACT
-	 || df_read_modify_subreg_p (dest))
+	 || read_modify_subreg_p (dest))
         {
 	  /* These both read and modify the result.  We must handle
              them as writes to get proper dependencies for following
Index: gcc/df-scan.c
===================================================================
--- gcc/df-scan.c	2017-08-24 19:20:31.055856350 +0100
+++ gcc/df-scan.c	2017-08-24 19:20:31.265856538 +0100
@@ -2623,23 +2623,6 @@  df_ref_record (enum df_ref_class cl,
 }
 
 
-/* A set to a non-paradoxical SUBREG for which the number of word_mode units
-   covered by the outer mode is smaller than that covered by the inner mode,
-   is a read-modify-write operation.
-   This function returns true iff the SUBREG X is such a SUBREG.  */
-
-bool
-df_read_modify_subreg_p (rtx x)
-{
-  unsigned int isize;
-
-  if (!partial_subreg_p (x))
-    return false;
-  isize = GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)));
-  return isize > REGMODE_NATURAL_SIZE (GET_MODE (SUBREG_REG (x)));
-}
-
-
 /* Process all the registers defined in the rtx pointed by LOC.
    Autoincrement/decrement definitions will be picked up by df_uses_record.
    Any change here has to be matched in df_find_hard_reg_defs_1.  */
@@ -2695,7 +2678,7 @@  df_def_record_1 (struct df_collection_re
     }
   else if (GET_CODE (dst) == SUBREG && REG_P (SUBREG_REG (dst)))
     {
-      if (df_read_modify_subreg_p (dst))
+      if (read_modify_subreg_p (dst))
 	flags |= DF_REF_READ_WRITE | DF_REF_PARTIAL;
 
       flags |= DF_REF_SUBREG;
@@ -2909,7 +2892,7 @@  df_uses_record (struct df_collection_rec
 	switch (GET_CODE (dst))
 	  {
 	    case SUBREG:
-	      if (df_read_modify_subreg_p (dst))
+	      if (read_modify_subreg_p (dst))
 		{
 		  df_uses_record (collection_rec, &SUBREG_REG (dst),
 				  DF_REF_REG_USE, bb, insn_info,
Index: gcc/rtlanal.c
===================================================================
--- gcc/rtlanal.c	2017-08-24 19:20:31.055856350 +0100
+++ gcc/rtlanal.c	2017-08-24 19:20:31.266856539 +0100
@@ -1357,6 +1357,22 @@  modified_in_p (const_rtx x, const_rtx in
 
   return 0;
 }
+
+/* Return true if X is a SUBREG and if storing a value to X would
+   preserve some of its SUBREG_REG.  For example, on a normal 32-bit
+   target, using a SUBREG to store to one half of a DImode REG would
+   preserve the other half.  */
+
+bool
+read_modify_subreg_p (const_rtx x)
+{
+  unsigned int isize;
+
+  if (!partial_subreg_p (x))
+    return false;
+  isize = GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)));
+  return isize > REGMODE_NATURAL_SIZE (GET_MODE (SUBREG_REG (x)));
+}
 
 /* Helper function for set_of.  */
 struct set_of_data