From db7ba7424119d53c01667af6957ca943c0cd2ff1 Mon Sep 17 00:00:00 2001 From: "J\"orn Rennecke" Date: Thu, 25 May 2000 01:11:22 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 9 +++++++++ gcc/loop.c | 19 +++++++++++++++---- gcc/reload.c | 27 --------------------------- gcc/rtl.h | 1 + gcc/rtlanal.c | 26 ++++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 31 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0ff533f7d49..a584ccae5cf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +Thu May 25 02:09:10 2000 J"orn Rennecke + + * 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 * stmt.c (expand_end_bindings): Look through NOTEs to find a diff --git a/gcc/loop.c b/gcc/loop.c index df3ee526a68..0c37c34036e 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -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; diff --git a/gcc/reload.c b/gcc/reload.c index e94a3037be4..eb4302d117a 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -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 diff --git a/gcc/rtl.h b/gcc/rtl.h index 2de4b0ed300..79d1bca98f7 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -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 */ diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index e9a98162952..8af6c7c1ffe 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -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; +} -- 2.30.2