* 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
+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
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
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;
/* 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))
|| ! 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;
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;
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));
\f
}
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;
-}
\f
/* 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
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 */
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;
+}