rtl.h (loc_mentioned_in_p): Declare.

* rtl.h (loc_mentioned_in_p): Declare.
	* reload.c (loc_mentioned_in_p): Moved from here...
	* rtlanal.c (loc_mentioned_in_p): to here.  No longer static.
	Fix loop increment for 'E' handling.
	* loop.c (strength_reduce): When doing biv->giv conversion,
	take multi-insn biv increments into account.

From-SVN: r34150
This commit is contained in:
J"orn Rennecke 2000-05-25 01:11:22 +00:00 committed by Joern Rennecke
parent 04da69d3a6
commit db7ba74241
5 changed files with 51 additions and 31 deletions

View File

@ -1,3 +1,12 @@
Thu May 25 02:09:10 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
* rtl.h (loc_mentioned_in_p): Declare.
* reload.c (loc_mentioned_in_p): Moved from here...
* rtlanal.c (loc_mentioned_in_p): to here. No longer static.
Fix loop increment for 'E' handling.
* loop.c (strength_reduce): When doing biv->giv conversion,
take multi-insn biv increments into account.
2000-05-24 Jason Merrill <jason@casey.soma.redhat.com>
* stmt.c (expand_end_bindings): Look through NOTEs to find a

View File

@ -4228,6 +4228,7 @@ strength_reduce (loop, insn_count, flags)
HOST_WIDE_INT offset;
rtx set, add_val, old_reg, dest_reg, last_use_insn, note;
int old_regno, new_regno;
rtx next_loc_insn;
if (! v->always_executed
|| v->maybe_multiple
@ -4262,7 +4263,17 @@ strength_reduce (loop, insn_count, flags)
VARRAY_GROW (reg_single_usage, nregs);
}
if (! validate_change (next->insn, next->location, add_val, 0))
/* Some bivs are incremented with a multi-insn sequence.
The first insn contains the add. */
next_loc_insn = next->insn;
while (! loc_mentioned_in_p (next->location,
PATTERN (next_loc_insn)))
next_loc_insn = PREV_INSN (next_loc_insn);
if (next_loc_insn == v->insn)
abort ();
if (! validate_change (next_loc_insn, next->location, add_val, 0))
{
vp = &v->next_iv;
continue;
@ -4274,7 +4285,7 @@ strength_reduce (loop, insn_count, flags)
/* Set last_use_insn so that we can check against it. */
for (last_use_insn = v->insn, p = NEXT_INSN (v->insn);
p != next->insn;
p != next_loc_insn;
p = next_insn_in_loop (loop, p))
{
if (!INSN_P (p))
@ -4294,7 +4305,7 @@ strength_reduce (loop, insn_count, flags)
|| ! validate_change (v->insn, &SET_DEST (set), dest_reg, 0))
{
/* Change the increment at NEXT back to what it was. */
if (! validate_change (next->insn, next->location,
if (! validate_change (next_loc_insn, next->location,
next->add_val, 0))
abort ();
vp = &v->next_iv;
@ -4353,7 +4364,7 @@ strength_reduce (loop, insn_count, flags)
the replaced increment and the next increment, and
remember the last insn that needed a replacement. */
for (last_use_insn = v->insn, p = NEXT_INSN (v->insn);
p != next->insn;
p != next_loc_insn;
p = next_insn_in_loop (loop, p))
{
rtx note;

View File

@ -272,7 +272,6 @@ static void find_reloads_address_part PARAMS ((rtx, rtx *, enum reg_class,
static rtx find_reloads_subreg_address PARAMS ((rtx, int, int, enum reload_type,
int, rtx));
static int find_inc_amount PARAMS ((rtx, rtx));
static int loc_mentioned_in_p PARAMS ((rtx *, rtx));
extern void debug_reload_to_stream PARAMS ((FILE *));
extern void debug_reload PARAMS ((void));
@ -1557,32 +1556,6 @@ remove_address_replacements (in_rtx)
}
return something_changed;
}
/* Return non-zero if IN contains a piece of rtl that has the address LOC */
static int
loc_mentioned_in_p (loc, in)
rtx *loc, in;
{
enum rtx_code code = GET_CODE (in);
const char *fmt = GET_RTX_FORMAT (code);
int i, j;
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
{
if (loc == &in->fld[i].rtx)
return 1;
if (fmt[i] == 'e')
{
if (loc_mentioned_in_p (loc, XEXP (in, i)))
return 1;
}
else if (fmt[i] == 'E')
for (j = XVECLEN (in, i) - 1; i >= 0; i--)
if (loc_mentioned_in_p (loc, XVECEXP (in, i, j)))
return 1;
}
return 0;
}
/* If there is only one output reload, and it is not for an earlyclobber
operand, try to combine it with a (logically unrelated) input reload

View File

@ -1248,6 +1248,7 @@ extern rtx regno_use_in PARAMS ((unsigned int, rtx));
extern int auto_inc_p PARAMS ((rtx));
extern void remove_node_from_expr_list PARAMS ((rtx, rtx *));
extern int insns_safe_to_move_p PARAMS ((rtx, rtx, rtx *));
extern int loc_mentioned_in_p PARAMS ((rtx *, rtx));
/* flow.c */

View File

@ -2358,3 +2358,29 @@ insns_safe_to_move_p (from, to, new_to)
return 0;
}
/* Return non-zero if IN contains a piece of rtl that has the address LOC */
int
loc_mentioned_in_p (loc, in)
rtx *loc, in;
{
enum rtx_code code = GET_CODE (in);
const char *fmt = GET_RTX_FORMAT (code);
int i, j;
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
{
if (loc == &in->fld[i].rtx)
return 1;
if (fmt[i] == 'e')
{
if (loc_mentioned_in_p (loc, XEXP (in, i)))
return 1;
}
else if (fmt[i] == 'E')
for (j = XVECLEN (in, i) - 1; j >= 0; j--)
if (loc_mentioned_in_p (loc, XVECEXP (in, i, j)))
return 1;
}
return 0;
}