Commit cf55cb6a by Richard Sandiford Committed by Richard Sandiford

lower-subreg.c: Include rtl-iter.h.

gcc/
	* lower-subreg.c: Include rtl-iter.h.
	(resolve_subreg_use): Turn from being a for_each_rtx callback
	to being a function that examines each subrtx itself.  Remove
	handling of null rtxes.
	(resolve_reg_notes, resolve_simple_move): Update accordingly.
	(decompose_multiword_subregs): Likewise.

From-SVN: r214647
parent b42b06e6
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com> 2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* lower-subreg.c: Include rtl-iter.h.
(resolve_subreg_use): Turn from being a for_each_rtx callback
to being a function that examines each subrtx itself. Remove
handling of null rtxes.
(resolve_reg_notes, resolve_simple_move): Update accordingly.
(decompose_multiword_subregs): Likewise.
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* loop-iv.c (altered_reg_used): Turn from being a for_each_rtx callback * loop-iv.c (altered_reg_used): Turn from being a for_each_rtx callback
to being a function that examines each subrtx itself. to being a function that examines each subrtx itself.
(simplify_using_condition, simplify_using_initial_values): Update (simplify_using_condition, simplify_using_initial_values): Update
......
...@@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h" #include "tree-pass.h"
#include "df.h" #include "df.h"
#include "lower-subreg.h" #include "lower-subreg.h"
#include "rtl-iter.h"
#ifdef STACK_GROWS_DOWNWARD #ifdef STACK_GROWS_DOWNWARD
# undef STACK_GROWS_DOWNWARD # undef STACK_GROWS_DOWNWARD
...@@ -726,46 +727,42 @@ resolve_subreg_p (rtx x) ...@@ -726,46 +727,42 @@ resolve_subreg_p (rtx x)
return resolve_reg_p (SUBREG_REG (x)); return resolve_reg_p (SUBREG_REG (x));
} }
/* This is called via for_each_rtx. Look for SUBREGs which need to be /* Look for SUBREGs in *LOC which need to be decomposed. */
decomposed. */
static int static bool
resolve_subreg_use (rtx *px, void *data) resolve_subreg_use (rtx *loc, rtx insn)
{ {
rtx insn = (rtx) data; subrtx_ptr_iterator::array_type array;
rtx x = *px; FOR_EACH_SUBRTX_PTR (iter, array, loc, NONCONST)
if (x == NULL_RTX)
return 0;
if (resolve_subreg_p (x))
{ {
x = simplify_subreg_concatn (GET_MODE (x), SUBREG_REG (x), rtx *loc = *iter;
SUBREG_BYTE (x)); rtx x = *loc;
if (resolve_subreg_p (x))
/* It is possible for a note to contain a reference which we can
decompose. In this case, return 1 to the caller to indicate
that the note must be removed. */
if (!x)
{ {
gcc_assert (!insn); x = simplify_subreg_concatn (GET_MODE (x), SUBREG_REG (x),
return 1; SUBREG_BYTE (x));
}
validate_change (insn, px, x, 1); /* It is possible for a note to contain a reference which we can
return -1; decompose. In this case, return 1 to the caller to indicate
} that the note must be removed. */
if (!x)
{
gcc_assert (!insn);
return true;
}
if (resolve_reg_p (x)) validate_change (insn, loc, x, 1);
{ iter.skip_subrtxes ();
/* Return 1 to the caller to indicate that we found a direct }
reference to a register which is being decomposed. This can else if (resolve_reg_p (x))
happen inside notes, multiword shift or zero-extend /* Return 1 to the caller to indicate that we found a direct
instructions. */ reference to a register which is being decomposed. This can
return 1; happen inside notes, multiword shift or zero-extend
instructions. */
return true;
} }
return 0; return false;
} }
/* This is called via for_each_rtx. Look for SUBREGs which can be /* This is called via for_each_rtx. Look for SUBREGs which can be
...@@ -808,7 +805,7 @@ resolve_reg_notes (rtx_insn *insn) ...@@ -808,7 +805,7 @@ resolve_reg_notes (rtx_insn *insn)
if (note) if (note)
{ {
int old_count = num_validated_changes (); int old_count = num_validated_changes ();
if (for_each_rtx (&XEXP (note, 0), resolve_subreg_use, NULL)) if (resolve_subreg_use (&XEXP (note, 0), NULL_RTX))
remove_note (insn, note); remove_note (insn, note);
else else
if (old_count != num_validated_changes ()) if (old_count != num_validated_changes ())
...@@ -952,9 +949,9 @@ resolve_simple_move (rtx set, rtx_insn *insn) ...@@ -952,9 +949,9 @@ resolve_simple_move (rtx set, rtx_insn *insn)
int acg; int acg;
if (MEM_P (src)) if (MEM_P (src))
for_each_rtx (&XEXP (src, 0), resolve_subreg_use, NULL_RTX); resolve_subreg_use (&XEXP (src, 0), NULL_RTX);
if (MEM_P (dest)) if (MEM_P (dest))
for_each_rtx (&XEXP (dest, 0), resolve_subreg_use, NULL_RTX); resolve_subreg_use (&XEXP (dest, 0), NULL_RTX);
acg = apply_change_group (); acg = apply_change_group ();
gcc_assert (acg); gcc_assert (acg);
} }
...@@ -1617,9 +1614,7 @@ decompose_multiword_subregs (bool decompose_copies) ...@@ -1617,9 +1614,7 @@ decompose_multiword_subregs (bool decompose_copies)
} }
for (i = recog_data.n_operands - 1; i >= 0; --i) for (i = recog_data.n_operands - 1; i >= 0; --i)
for_each_rtx (recog_data.operand_loc[i], resolve_subreg_use (recog_data.operand_loc[i], insn);
resolve_subreg_use,
insn);
resolve_reg_notes (insn); resolve_reg_notes (insn);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment