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. From-SVN: r251537
This commit is contained in:
parent
bd4288c02b
commit
33845ca96b
@ -1,3 +1,21 @@
|
||||
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>
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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))
|
||||
|
@ -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,
|
||||
|
1
gcc/df.h
1
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);
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user