loop.c (emit_iv_add_mult): Simplify it's input and emit REG_EQUAL note explaining the calculated value.
* loop.c (emit_iv_add_mult): Simplify it's input and emit REG_EQUAL note explaining the calculated value. From-SVN: r33283
This commit is contained in:
parent
a33b40d2a3
commit
ba2b25ecac
|
@ -1,5 +1,8 @@
|
||||||
Thu Apr 20 14:19:18 MET DST 2000 Jan Hubicka <jh@suse.cz>
|
Thu Apr 20 14:19:18 MET DST 2000 Jan Hubicka <jh@suse.cz>
|
||||||
|
|
||||||
|
* loop.c (emit_iv_add_mult): Simplify it's input and emit
|
||||||
|
REG_EQUAL note explaining the calculated value.
|
||||||
|
|
||||||
* calls.c (expand_call): Avoid unnecesary precalculation
|
* calls.c (expand_call): Avoid unnecesary precalculation
|
||||||
and outgoing parameters space guarding for sibling calls.
|
and outgoing parameters space guarding for sibling calls.
|
||||||
(store_one_arg): Likewise.
|
(store_one_arg): Likewise.
|
||||||
|
|
56
gcc/loop.c
56
gcc/loop.c
|
@ -7640,11 +7640,24 @@ emit_iv_add_mult (b, m, a, reg, insert_before)
|
||||||
{
|
{
|
||||||
rtx seq;
|
rtx seq;
|
||||||
rtx result;
|
rtx result;
|
||||||
|
rtx last;
|
||||||
|
rtx set;
|
||||||
|
rtx exp;
|
||||||
|
enum machine_mode mode = GET_MODE (reg);
|
||||||
|
|
||||||
/* Prevent unexpected sharing of these rtx. */
|
/* Prevent unexpected sharing of these rtx. */
|
||||||
a = copy_rtx (a);
|
a = copy_rtx (a);
|
||||||
b = copy_rtx (b);
|
b = copy_rtx (b);
|
||||||
|
|
||||||
|
/* We may be faced to (plus (symbol_ref) (const_int)). We want to simplify
|
||||||
|
this to CONST rtx. */
|
||||||
|
exp = simplify_rtx (a);
|
||||||
|
if (exp)
|
||||||
|
a = exp;
|
||||||
|
exp = simplify_rtx (b);
|
||||||
|
if (exp)
|
||||||
|
b = exp;
|
||||||
|
|
||||||
/* Increase the lifetime of any invariants moved further in code. */
|
/* Increase the lifetime of any invariants moved further in code. */
|
||||||
update_reg_last_use (a, insert_before);
|
update_reg_last_use (a, insert_before);
|
||||||
update_reg_last_use (b, insert_before);
|
update_reg_last_use (b, insert_before);
|
||||||
|
@ -7657,7 +7670,7 @@ emit_iv_add_mult (b, m, a, reg, insert_before)
|
||||||
seq = gen_sequence ();
|
seq = gen_sequence ();
|
||||||
end_sequence ();
|
end_sequence ();
|
||||||
|
|
||||||
emit_insn_before (seq, insert_before);
|
last = emit_insn_before (seq, insert_before);
|
||||||
|
|
||||||
/* It is entirely possible that the expansion created lots of new
|
/* It is entirely possible that the expansion created lots of new
|
||||||
registers. Iterate over the sequence we just created and
|
registers. Iterate over the sequence we just created and
|
||||||
|
@ -7668,14 +7681,47 @@ emit_iv_add_mult (b, m, a, reg, insert_before)
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < XVECLEN (seq, 0); ++i)
|
for (i = 0; i < XVECLEN (seq, 0); ++i)
|
||||||
{
|
{
|
||||||
rtx set = single_set (XVECEXP (seq, 0, i));
|
set = single_set (XVECEXP (seq, 0, i));
|
||||||
if (set && GET_CODE (SET_DEST (set)) == REG)
|
if (set && GET_CODE (SET_DEST (set)) == REG)
|
||||||
record_base_value (REGNO (SET_DEST (set)), SET_SRC (set), 0);
|
record_base_value (REGNO (SET_DEST (set)), SET_SRC (set), 0);
|
||||||
}
|
}
|
||||||
|
last = XVECEXP (seq, 0, i - 1);
|
||||||
}
|
}
|
||||||
else if (GET_CODE (seq) == SET
|
else
|
||||||
&& GET_CODE (SET_DEST (seq)) == REG)
|
{
|
||||||
record_base_value (REGNO (SET_DEST (seq)), SET_SRC (seq), 0);
|
set = single_set (last);
|
||||||
|
if (set && GET_CODE (SET_DEST (set)) == REG)
|
||||||
|
record_base_value (REGNO (SET_DEST (set)), SET_SRC (set), 0);
|
||||||
|
}
|
||||||
|
if (!last)
|
||||||
|
return;
|
||||||
|
/* Sequence really ought to end by set storing final value to the register.
|
||||||
|
|
||||||
|
Attach note indicating expression we've just calculated to it. This is
|
||||||
|
important for second run of loop optimizer to understand strength reduced
|
||||||
|
givs from the first run. */
|
||||||
|
if (GET_CODE (last) != INSN)
|
||||||
|
abort();
|
||||||
|
set = single_set (last);
|
||||||
|
if (!set)
|
||||||
|
return;
|
||||||
|
if (SET_DEST (set) != reg)
|
||||||
|
abort();
|
||||||
|
|
||||||
|
/* In case we start to emit some usefull notes to these insns, get abort
|
||||||
|
here, since we need to decide what information is more important. */
|
||||||
|
if (find_reg_note (last, REG_EQUIV, NULL_RTX)
|
||||||
|
|| find_reg_note (last, REG_EQUAL, NULL_RTX))
|
||||||
|
abort();
|
||||||
|
|
||||||
|
/* Expression we've just caluclated. */
|
||||||
|
exp = simplify_gen_binary (PLUS, mode,
|
||||||
|
simplify_gen_binary (MULT, mode, b, m),
|
||||||
|
a);
|
||||||
|
REG_NOTES (last)
|
||||||
|
= gen_rtx_EXPR_LIST (REG_EQUAL,
|
||||||
|
exp,
|
||||||
|
REG_NOTES (last));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test whether A * B can be computed without
|
/* Test whether A * B can be computed without
|
||||||
|
|
Loading…
Reference in New Issue