Commit a36a1928 by Richard Sandiford Committed by Richard Sandiford

lower-subreg.c (find_decomposable_subregs): Turn from being a for_each_rtx…

lower-subreg.c (find_decomposable_subregs): Turn from being a for_each_rtx callback to being a function that examines each...

gcc/
	* lower-subreg.c (find_decomposable_subregs): Turn from being
	a for_each_rtx callback to being a function that examines each
	subrtx itself.  Remove handling of null rtxes.
	(decompose_multiword_subregs): Update accordingly.

From-SVN: r214649
parent f2d3f347
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com> 2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* lower-subreg.c (find_decomposable_subregs): Turn from being
a for_each_rtx callback to being a function that examines each
subrtx itself. Remove handling of null rtxes.
(decompose_multiword_subregs): Update accordingly.
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* lower-subreg.c (adjust_decomposed_uses): Delete. * lower-subreg.c (adjust_decomposed_uses): Delete.
(resolve_debug): Use FOR_EACH_SUBRTX_PTR rather than for_each_rtx. (resolve_debug): Use FOR_EACH_SUBRTX_PTR rather than for_each_rtx.
Remove handling of null rtxes. Remove handling of null rtxes.
......
...@@ -443,7 +443,7 @@ propagate_pseudo_copies (void) ...@@ -443,7 +443,7 @@ propagate_pseudo_copies (void)
} }
/* A pointer to one of these values is passed to /* A pointer to one of these values is passed to
find_decomposable_subregs via for_each_rtx. */ find_decomposable_subregs. */
enum classify_move_insn enum classify_move_insn
{ {
...@@ -455,33 +455,33 @@ enum classify_move_insn ...@@ -455,33 +455,33 @@ enum classify_move_insn
SIMPLE_MOVE SIMPLE_MOVE
}; };
/* This is called via for_each_rtx. If we find a SUBREG which we /* If we find a SUBREG in *LOC which we could use to decompose a
could use to decompose a pseudo-register, set a bit in pseudo-register, set a bit in DECOMPOSABLE_CONTEXT. If we find an
DECOMPOSABLE_CONTEXT. If we find an unadorned register which is unadorned register which is not a simple pseudo-register copy,
not a simple pseudo-register copy, DATA will point at the type of DATA will point at the type of move, and we set a bit in
move, and we set a bit in DECOMPOSABLE_CONTEXT or DECOMPOSABLE_CONTEXT or NON_DECOMPOSABLE_CONTEXT as appropriate. */
NON_DECOMPOSABLE_CONTEXT as appropriate. */
static int static void
find_decomposable_subregs (rtx *px, void *data) find_decomposable_subregs (rtx *loc, enum classify_move_insn *pcmi)
{ {
enum classify_move_insn *pcmi = (enum classify_move_insn *) data; subrtx_var_iterator::array_type array;
rtx x = *px; FOR_EACH_SUBRTX_VAR (iter, array, *loc, NONCONST)
{
if (x == NULL_RTX) rtx x = *iter;
return 0;
if (GET_CODE (x) == SUBREG) if (GET_CODE (x) == SUBREG)
{ {
rtx inner = SUBREG_REG (x); rtx inner = SUBREG_REG (x);
unsigned int regno, outer_size, inner_size, outer_words, inner_words; unsigned int regno, outer_size, inner_size, outer_words, inner_words;
if (!REG_P (inner)) if (!REG_P (inner))
return 0; continue;
regno = REGNO (inner); regno = REGNO (inner);
if (HARD_REGISTER_NUM_P (regno)) if (HARD_REGISTER_NUM_P (regno))
return -1; {
iter.skip_subrtxes ();
continue;
}
outer_size = GET_MODE_SIZE (GET_MODE (x)); outer_size = GET_MODE_SIZE (GET_MODE (x));
inner_size = GET_MODE_SIZE (GET_MODE (inner)); inner_size = GET_MODE_SIZE (GET_MODE (inner));
...@@ -501,7 +501,8 @@ find_decomposable_subregs (rtx *px, void *data) ...@@ -501,7 +501,8 @@ find_decomposable_subregs (rtx *px, void *data)
if (outer_words == 1 && inner_words > 1) if (outer_words == 1 && inner_words > 1)
{ {
bitmap_set_bit (decomposable_context, regno); bitmap_set_bit (decomposable_context, regno);
return -1; iter.skip_subrtxes ();
continue;
} }
/* If this is a cast from one mode to another, where the modes /* If this is a cast from one mode to another, where the modes
...@@ -514,7 +515,8 @@ find_decomposable_subregs (rtx *px, void *data) ...@@ -514,7 +515,8 @@ find_decomposable_subregs (rtx *px, void *data)
{ {
bitmap_set_bit (non_decomposable_context, regno); bitmap_set_bit (non_decomposable_context, regno);
bitmap_set_bit (subreg_context, regno); bitmap_set_bit (subreg_context, regno);
return -1; iter.skip_subrtxes ();
continue;
} }
} }
else if (REG_P (x)) else if (REG_P (x))
...@@ -564,11 +566,10 @@ find_decomposable_subregs (rtx *px, void *data) ...@@ -564,11 +566,10 @@ find_decomposable_subregs (rtx *px, void *data)
/* Any registers used in a MEM do not participate in a /* Any registers used in a MEM do not participate in a
SIMPLE_MOVE or DECOMPOSABLE_SIMPLE_MOVE. Do our own recursion SIMPLE_MOVE or DECOMPOSABLE_SIMPLE_MOVE. Do our own recursion
here, and return -1 to block the parent's recursion. */ here, and return -1 to block the parent's recursion. */
for_each_rtx (&XEXP (x, 0), find_decomposable_subregs, &cmi_mem); find_decomposable_subregs (&XEXP (x, 0), &cmi_mem);
return -1; iter.skip_subrtxes ();
}
} }
return 0;
} }
/* Decompose REGNO into word-sized components. We smash the REG node /* Decompose REGNO into word-sized components. We smash the REG node
...@@ -1496,9 +1497,7 @@ decompose_multiword_subregs (bool decompose_copies) ...@@ -1496,9 +1497,7 @@ decompose_multiword_subregs (bool decompose_copies)
n = recog_data.n_operands; n = recog_data.n_operands;
for (i = 0; i < n; ++i) for (i = 0; i < n; ++i)
{ {
for_each_rtx (&recog_data.operand[i], find_decomposable_subregs (&recog_data.operand[i], &cmi);
find_decomposable_subregs,
&cmi);
/* We handle ASM_OPERANDS as a special case to support /* We handle ASM_OPERANDS as a special case to support
things like x86 rdtsc which returns a DImode value. things like x86 rdtsc which returns a DImode value.
......
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