aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-08-30 15:28:18 +0000
committerRichard Sandiford <richard.sandiford@linaro.org>2017-08-30 15:28:18 +0000
commit0d4db3dd6e937ff6dcc4f0048a34d5215299d8cf (patch)
treebc69488d125557e352f5d02d91a2fdac5505faa3
parent055b5e4186bc3717bae1520a85d25e5b5c42c12c (diff)
Drop df_ from df_read_modify_subreg_p
...it's really a general RTL predicate, rather than something that depends on the DF state. Thanks to Segher for the suggestion. 2017-08-30 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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@251537 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog18
-rw-r--r--gcc/cprop.c2
-rw-r--r--gcc/df-problems.c2
-rw-r--r--gcc/df-scan.c22
-rw-r--r--gcc/df.h1
-rw-r--r--gcc/ira-lives.c6
-rw-r--r--gcc/reginfo.c2
-rw-r--r--gcc/rtl.h3
-rw-r--r--gcc/rtlanal.c17
-rw-r--r--gcc/sched-deps.c2
10 files changed, 46 insertions, 29 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a726d8e690b..da37ce8a965 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,22 @@
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
+
+ * 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.
+
+2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
diff --git a/gcc/cprop.c b/gcc/cprop.c
index 4814b5e97c0..f7a327770cd 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -1161,7 +1161,7 @@ local_cprop_find_used_regs (rtx *xptr, void *data)
return;
case SUBREG:
- if (df_read_modify_subreg_p (x))
+ if (read_modify_subreg_p (x))
return;
break;
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 755aecf46df..4aafb43edc6 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -2819,7 +2819,7 @@ df_word_lr_mark_ref (df_ref ref, bool is_set, regset live)
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))
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index dde6d15d07b..8ab3d716ea2 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -2623,24 +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, 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 > 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. */
@@ -2696,7 +2678,7 @@ df_def_record_1 (struct df_collection_rec *collection_rec,
}
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;
@@ -2910,7 +2892,7 @@ df_uses_record (struct df_collection_rec *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,
diff --git a/gcc/df.h b/gcc/df.h
index 07fd3345d9d..290fd3c7b9d 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -1080,7 +1080,6 @@ extern unsigned int df_hard_reg_used_count (unsigned int);
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);
diff --git a/gcc/ira-lives.c b/gcc/ira-lives.c
index 3fd71745380..0dff248ed48 100644
--- a/gcc/ira-lives.c
+++ b/gcc/ira-lives.c
@@ -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)
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index 4239fa3df4e..9f07176d9b7 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -1348,7 +1348,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);
}
}
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 79abfa35fb4..2f6e32b4803 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2194,6 +2194,7 @@ extern unsigned int subreg_lsb_1 (machine_mode, machine_mode,
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
@@ -2836,7 +2837,7 @@ partial_subreg_p (machine_mode outermode, machine_mode innermode)
}
/* 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
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index e6483679903..3ae06e42797 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -1358,6 +1358,23 @@ modified_in_p (const_rtx x, const_rtx insn)
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, 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 > REGMODE_NATURAL_SIZE (GET_MODE (SUBREG_REG (x)));
+}
/* Helper function for set_of. */
struct set_of_data
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 4c459e6587f..844bf02803e 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -2419,7 +2419,7 @@ sched_analyze_1 (struct deps_desc *deps, rtx x, rtx_insn *insn)
{
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