+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>
return;
case SUBREG:
- if (df_read_modify_subreg_p (x))
+ if (read_modify_subreg_p (x))
return;
break;
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))
}
-/* 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. */
}
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;
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,
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);
\f
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);
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);
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)
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);
}
}
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
}
/* 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
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)));
+}
\f
/* Helper function for set_of. */
struct set_of_data
{
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