From: Michael Hayes Date: Thu, 25 Jan 2001 09:28:55 +0000 (+0000) Subject: loop.c (loop_call_insn_emit_before, [...]): New. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=86e212125feadb56d55459f167c9de10e8bf998c;p=gcc.git loop.c (loop_call_insn_emit_before, [...]): New. * loop.c (loop_call_insn_emit_before, loop_call_insn_hoist): New. (loop_insn_emit_before): No longer static. (move_movables): Replace emit_insn_after with loop_insn_emit_after. (loop_givs_rescan, load_mems): Likewise. (check_dbra_loop): Replace emit_insn_before with loop_insn_emit_before. (maybe_eliminate_biv_1): (move_movables): Replace emit_call_insn_before with loop_call_insn_hoist. * loop.h (loop_insn_emit_before): Add. * unroll.c (copy_loop_body): Replace emit_insn_before with loop_insn_emit_before. From-SVN: r39260 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d3c77b45925..491a93e950d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2001-01-25 Michael Hayes + + * loop.c (loop_call_insn_emit_before, loop_call_insn_hoist): New. + (loop_insn_emit_before): No longer static. + (move_movables): Replace emit_insn_after with loop_insn_emit_after. + (loop_givs_rescan, load_mems): Likewise. + (check_dbra_loop): Replace emit_insn_before with loop_insn_emit_before. + (maybe_eliminate_biv_1): + (move_movables): Replace emit_call_insn_before with + loop_call_insn_hoist. + * loop.h (loop_insn_emit_before): Add. + * unroll.c (copy_loop_body): Replace emit_insn_before with + loop_insn_emit_before. + 2001-01-25 Neil Booth * diagnostic.c (fatal): Request preprocessed source. diff --git a/gcc/loop.c b/gcc/loop.c index 37f0f260754..91fdf7fb83f 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -253,8 +253,9 @@ static int iv_add_mult_cost PARAMS ((rtx, rtx, rtx, rtx)); static rtx loop_insn_emit_after PARAMS((const struct loop *, basic_block, rtx, rtx)); -static rtx loop_insn_emit_before PARAMS((const struct loop *, basic_block, - rtx, rtx)); +static rtx loop_call_insn_emit_before PARAMS((const struct loop *, + basic_block, rtx, rtx)); +static rtx loop_call_insn_hoist PARAMS((const struct loop *, rtx)); static rtx loop_insn_sink_or_swim PARAMS((const struct loop *, rtx)); static void loop_dump_aux PARAMS ((const struct loop *, FILE *, int)); @@ -1885,13 +1886,13 @@ move_movables (loop, movables, threshold, insn_count) if (GET_CODE (temp) == CALL_INSN && fn_address != 0 && reg_referenced_p (fn_reg, body)) - emit_insn_after (gen_move_insn (fn_reg, - fn_address), - fn_address_insn); + loop_insn_emit_after (loop, 0, fn_address_insn, + gen_move_insn + (fn_reg, fn_address)); if (GET_CODE (temp) == CALL_INSN) { - i1 = emit_call_insn_before (body, loop_start); + i1 = loop_call_insn_hoist (loop, body); /* Because the USAGE information potentially contains objects other than hard registers we need to copy it. */ @@ -1937,7 +1938,7 @@ move_movables (loop, movables, threshold, insn_count) } else if (GET_CODE (p) == CALL_INSN) { - i1 = emit_call_insn_before (PATTERN (p), loop_start); + i1 = loop_call_insn_hoist (loop, PATTERN (p)); /* Because the USAGE information potentially contains objects other than hard registers we need to copy it. */ @@ -4052,8 +4053,8 @@ loop_givs_rescan (loop, bl, reg_map) { /* Not replaceable; emit an insn to set the original giv reg from the reduced giv, same as above. */ - emit_insn_after (gen_move_insn (v->dest_reg, v->new_reg), - v->insn); + loop_insn_emit_after (loop, 0, v->insn, + gen_move_insn (v->dest_reg, v->new_reg)); } /* When a loop is reversed, givs which depend on the reversed @@ -7563,7 +7564,7 @@ check_dbra_loop (loop, insn_count) tem = gen_sequence (); end_sequence (); - p = emit_insn_before (tem, bl->biv->insn); + p = loop_insn_emit_before (loop, 0, bl->biv->insn, tem); delete_insn (bl->biv->insn); /* Update biv info to reflect its new status. */ @@ -7941,8 +7942,9 @@ maybe_eliminate_biv_1 (loop, x, insn, bl, eliminate_p, where_bb, where_insn) into a register (it will be a loop invariant.) */ tem = gen_reg_rtx (GET_MODE (v->new_reg)); - emit_insn_before (gen_move_insn (tem, copy_rtx (v->add_val)), - where_insn); + loop_insn_emit_before (loop, 0, where_insn, + gen_move_insn (tem, + copy_rtx (v->add_val))); /* Substitute the new register for its invariant value in the compare expression. */ @@ -9075,7 +9077,7 @@ load_mems (loop) /* Store the memory immediately after END, which is the NOTE_LOOP_END. */ set = gen_move_insn (copy_rtx (mem), reg); - emit_insn_after (set, label); + loop_insn_emit_after (loop, 0, label, set); } if (loop_dump_stream) @@ -9459,7 +9461,7 @@ loop_insn_emit_after (loop, where_bb, where_insn, pattern) in basic block WHERE_BB (ignored in the interim) within the loop otherwise hoist PATTERN into the loop pre-header. */ -static rtx +rtx loop_insn_emit_before (loop, where_bb, where_insn, pattern) const struct loop *loop; basic_block where_bb ATTRIBUTE_UNUSED; @@ -9472,6 +9474,20 @@ loop_insn_emit_before (loop, where_bb, where_insn, pattern) } +/* Emit call insn for PATTERN before WHERE_INSN in basic block + WHERE_BB (ignored in the interim) within the loop. */ + +static rtx +loop_call_insn_emit_before (loop, where_bb, where_insn, pattern) + const struct loop *loop ATTRIBUTE_UNUSED; + basic_block where_bb ATTRIBUTE_UNUSED; + rtx where_insn; + rtx pattern; +{ + return emit_call_insn_before (pattern, where_insn); +} + + /* Hoist insn for PATTERN into the loop pre-header. */ rtx @@ -9483,6 +9499,17 @@ loop_insn_hoist (loop, pattern) } +/* Hoist call insn for PATTERN into the loop pre-header. */ + +static rtx +loop_call_insn_hoist (loop, pattern) + const struct loop *loop; + rtx pattern; +{ + return loop_call_insn_emit_before (loop, 0, loop->start, pattern); +} + + /* Sink insn for PATTERN after the loop end. */ rtx diff --git a/gcc/loop.h b/gcc/loop.h index 9e382e6ca61..cfec9934b20 100644 --- a/gcc/loop.h +++ b/gcc/loop.h @@ -412,6 +412,8 @@ int back_branch_in_range_p PARAMS ((const struct loop *, rtx)); int loop_insn_first_p PARAMS ((rtx, rtx)); typedef rtx (*loop_insn_callback) PARAMS ((struct loop *, rtx, int, int)); void for_each_insn_in_loop PARAMS ((struct loop *, loop_insn_callback)); +rtx loop_insn_emit_before PARAMS((const struct loop *, basic_block, + rtx, rtx)); rtx loop_insn_sink PARAMS((const struct loop *, rtx)); rtx loop_insn_hoist PARAMS((const struct loop *, rtx)); diff --git a/gcc/unroll.c b/gcc/unroll.c index ec0a151f3eb..0d3927632b1 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -2257,7 +2257,7 @@ copy_loop_body (loop, copy_start, copy_end, map, exit_label, last_iteration, tem = gen_sequence (); end_sequence (); - emit_insn_before (tem, insert_before); + loop_insn_emit_before (loop, 0, insert_before, tem); } /* Emit an insn, using the expand_binop to ensure that a valid insn is