Commit 86e21212 by Michael Hayes Committed by Michael Hayes

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
parent 9dee3e02
2001-01-25 Michael Hayes <mhayes@redhat.com>
* 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 <neil@daikokuya.demon.co.uk> 2001-01-25 Neil Booth <neil@daikokuya.demon.co.uk>
* diagnostic.c (fatal): Request preprocessed source. * diagnostic.c (fatal): Request preprocessed source.
......
...@@ -253,8 +253,9 @@ static int iv_add_mult_cost PARAMS ((rtx, rtx, rtx, rtx)); ...@@ -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, static rtx loop_insn_emit_after PARAMS((const struct loop *, basic_block,
rtx, rtx)); rtx, rtx));
static rtx loop_insn_emit_before PARAMS((const struct loop *, basic_block, static rtx loop_call_insn_emit_before PARAMS((const struct loop *,
rtx, rtx)); 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 rtx loop_insn_sink_or_swim PARAMS((const struct loop *, rtx));
static void loop_dump_aux PARAMS ((const struct loop *, FILE *, int)); static void loop_dump_aux PARAMS ((const struct loop *, FILE *, int));
...@@ -1885,13 +1886,13 @@ move_movables (loop, movables, threshold, insn_count) ...@@ -1885,13 +1886,13 @@ move_movables (loop, movables, threshold, insn_count)
if (GET_CODE (temp) == CALL_INSN if (GET_CODE (temp) == CALL_INSN
&& fn_address != 0 && fn_address != 0
&& reg_referenced_p (fn_reg, body)) && reg_referenced_p (fn_reg, body))
emit_insn_after (gen_move_insn (fn_reg, loop_insn_emit_after (loop, 0, fn_address_insn,
fn_address), gen_move_insn
fn_address_insn); (fn_reg, fn_address));
if (GET_CODE (temp) == CALL_INSN) 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 /* Because the USAGE information potentially
contains objects other than hard registers contains objects other than hard registers
we need to copy it. */ we need to copy it. */
...@@ -1937,7 +1938,7 @@ move_movables (loop, movables, threshold, insn_count) ...@@ -1937,7 +1938,7 @@ move_movables (loop, movables, threshold, insn_count)
} }
else if (GET_CODE (p) == CALL_INSN) 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 /* Because the USAGE information potentially
contains objects other than hard registers contains objects other than hard registers
we need to copy it. */ we need to copy it. */
...@@ -4052,8 +4053,8 @@ loop_givs_rescan (loop, bl, reg_map) ...@@ -4052,8 +4053,8 @@ loop_givs_rescan (loop, bl, reg_map)
{ {
/* Not replaceable; emit an insn to set the original giv reg from /* Not replaceable; emit an insn to set the original giv reg from
the reduced giv, same as above. */ the reduced giv, same as above. */
emit_insn_after (gen_move_insn (v->dest_reg, v->new_reg), loop_insn_emit_after (loop, 0, v->insn,
v->insn); gen_move_insn (v->dest_reg, v->new_reg));
} }
/* When a loop is reversed, givs which depend on the reversed /* When a loop is reversed, givs which depend on the reversed
...@@ -7563,7 +7564,7 @@ check_dbra_loop (loop, insn_count) ...@@ -7563,7 +7564,7 @@ check_dbra_loop (loop, insn_count)
tem = gen_sequence (); tem = gen_sequence ();
end_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); delete_insn (bl->biv->insn);
/* Update biv info to reflect its new status. */ /* 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) ...@@ -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.) */ into a register (it will be a loop invariant.) */
tem = gen_reg_rtx (GET_MODE (v->new_reg)); tem = gen_reg_rtx (GET_MODE (v->new_reg));
emit_insn_before (gen_move_insn (tem, copy_rtx (v->add_val)), loop_insn_emit_before (loop, 0, where_insn,
where_insn); gen_move_insn (tem,
copy_rtx (v->add_val)));
/* Substitute the new register for its invariant value in /* Substitute the new register for its invariant value in
the compare expression. */ the compare expression. */
...@@ -9075,7 +9077,7 @@ load_mems (loop) ...@@ -9075,7 +9077,7 @@ load_mems (loop)
/* Store the memory immediately after END, which is /* Store the memory immediately after END, which is
the NOTE_LOOP_END. */ the NOTE_LOOP_END. */
set = gen_move_insn (copy_rtx (mem), reg); 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) if (loop_dump_stream)
...@@ -9459,7 +9461,7 @@ loop_insn_emit_after (loop, where_bb, where_insn, pattern) ...@@ -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 in basic block WHERE_BB (ignored in the interim) within the loop
otherwise hoist PATTERN into the loop pre-header. */ otherwise hoist PATTERN into the loop pre-header. */
static rtx rtx
loop_insn_emit_before (loop, where_bb, where_insn, pattern) loop_insn_emit_before (loop, where_bb, where_insn, pattern)
const struct loop *loop; const struct loop *loop;
basic_block where_bb ATTRIBUTE_UNUSED; basic_block where_bb ATTRIBUTE_UNUSED;
...@@ -9472,6 +9474,20 @@ loop_insn_emit_before (loop, where_bb, where_insn, pattern) ...@@ -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. */ /* Hoist insn for PATTERN into the loop pre-header. */
rtx rtx
...@@ -9483,6 +9499,17 @@ loop_insn_hoist (loop, pattern) ...@@ -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. */ /* Sink insn for PATTERN after the loop end. */
rtx rtx
......
...@@ -412,6 +412,8 @@ int back_branch_in_range_p PARAMS ((const struct loop *, rtx)); ...@@ -412,6 +412,8 @@ int back_branch_in_range_p PARAMS ((const struct loop *, rtx));
int loop_insn_first_p PARAMS ((rtx, rtx)); int loop_insn_first_p PARAMS ((rtx, rtx));
typedef rtx (*loop_insn_callback) PARAMS ((struct loop *, rtx, int, int)); typedef rtx (*loop_insn_callback) PARAMS ((struct loop *, rtx, int, int));
void for_each_insn_in_loop PARAMS ((struct loop *, loop_insn_callback)); 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_sink PARAMS((const struct loop *, rtx));
rtx loop_insn_hoist PARAMS((const struct loop *, rtx)); rtx loop_insn_hoist PARAMS((const struct loop *, rtx));
......
...@@ -2257,7 +2257,7 @@ copy_loop_body (loop, copy_start, copy_end, map, exit_label, last_iteration, ...@@ -2257,7 +2257,7 @@ copy_loop_body (loop, copy_start, copy_end, map, exit_label, last_iteration,
tem = gen_sequence (); tem = gen_sequence ();
end_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 /* Emit an insn, using the expand_binop to ensure that a valid insn is
......
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