loop.h (REGNO_FIRST_LUID, [...]): Define.

* loop.h (REGNO_FIRST_LUID, REGNO_LAST_LUID): Define.
	* loop.c (REGNO_FIRST_LUID, REGNO_LAST_LUID): Use in place of
	direct access to uid_luid array.
	* unroll.c (REGNO_FIRST_LUID, REGNO_LAST_LUID): Likewise.

From-SVN: r38575
This commit is contained in:
Michael Hayes 2001-01-01 00:14:30 +00:00 committed by Michael Hayes
parent 2b872543ba
commit 8529a489d6
4 changed files with 43 additions and 31 deletions

View File

@ -1,5 +1,12 @@
2001-01-01 Michael Hayes <mhayes@redhat.com>
* loop.h (REGNO_FIRST_LUID, REGNO_LAST_LUID): Define.
* loop.c (REGNO_FIRST_LUID, REGNO_LAST_LUID): Use in place of
direct access to uid_luid array.
* unroll.c (REGNO_FIRST_LUID, REGNO_LAST_LUID): Likewise.
2001-01-01 Michael Hayes <mhayes@redhat.com>
* loop.h (struct loop_movables): New.
(LOOP_MOVABLES): New.
(struct loop_info): Add movables field.

View File

@ -54,6 +54,7 @@ Boston, MA 02111-1307, USA. */
#include "except.h"
#include "toplev.h"
/* Vector mapping INSN_UIDs to luids.
The luids are like uids but increase monotonically always.
We use them to see whether a jump comes from outside a given loop. */
@ -823,12 +824,12 @@ scan_loop (loop, flags)
or consec_sets_invariant_p returned 2
(only conditionally invariant). */
m->cond = ((tem | tem1 | tem2) > 1);
m->global = (uid_luid[REGNO_LAST_UID (regno)]
m->global = (REGNO_LAST_LUID (regno)
> INSN_LUID (loop_end)
|| uid_luid[REGNO_FIRST_UID (regno)] < INSN_LUID (loop_start));
|| REGNO_FIRST_LUID (regno) < INSN_LUID (loop_start));
m->match = 0;
m->lifetime = (uid_luid[REGNO_LAST_UID (regno)]
- uid_luid[REGNO_FIRST_UID (regno)]);
m->lifetime = (REGNO_LAST_LUID (regno)
- REGNO_FIRST_LUID (regno));
m->savings = VARRAY_INT (regs->n_times_set, regno);
if (find_reg_note (p, REG_RETVAL, NULL_RTX))
m->savings += libcall_benefit (p);
@ -921,12 +922,12 @@ scan_loop (loop, flags)
INSN_LUID and hence must make a conservative
assumption. */
m->global = (INSN_UID (p) >= max_uid_for_loop
|| (uid_luid[REGNO_LAST_UID (regno)]
|| (REGNO_LAST_LUID (regno)
> INSN_LUID (loop_end))
|| (uid_luid[REGNO_FIRST_UID (regno)]
|| (REGNO_FIRST_LUID (regno)
< INSN_LUID (p))
|| (labels_in_range_p
(p, uid_luid[REGNO_FIRST_UID (regno)])));
(p, REGNO_FIRST_LUID (regno))));
if (maybe_never && m->global)
m->savemode = GET_MODE (SET_SRC (set1));
else
@ -934,8 +935,8 @@ scan_loop (loop, flags)
m->regno = regno;
m->cond = 0;
m->match = 0;
m->lifetime = (uid_luid[REGNO_LAST_UID (regno)]
- uid_luid[REGNO_FIRST_UID (regno)]);
m->lifetime = (REGNO_LAST_LUID (regno)
- REGNO_FIRST_LUID (regno));
m->savings = 1;
VARRAY_INT (regs->set_in_loop, regno) = -1;
/* Add M to the end of the chain MOVABLES. */
@ -1393,8 +1394,8 @@ combine_movables (movables, regs)
&& mode == GET_MODE (SET_SRC (PATTERN (NEXT_INSN (m->insn)))))
{
register struct movable *m1;
int first = uid_luid[REGNO_FIRST_UID (m->regno)];
int last = uid_luid[REGNO_LAST_UID (m->regno)];
int first = REGNO_FIRST_LUID (m->regno);
int last = REGNO_LAST_LUID (m->regno);
if (m0 == 0)
{
@ -1412,8 +1413,8 @@ combine_movables (movables, regs)
already combined together. */
for (m1 = movables->head; m1 != m; m1 = m1->next)
if (m1 == m0 || (m1->partial && m1->match == m0))
if (! (uid_luid[REGNO_FIRST_UID (m1->regno)] > last
|| uid_luid[REGNO_LAST_UID (m1->regno)] < first))
if (! (REGNO_FIRST_LUID (m1->regno) > last
|| REGNO_LAST_LUID (m1->regno) < first))
goto overlap;
/* No overlap: we can combine this with the others. */
@ -2038,12 +2039,12 @@ move_movables (loop, movables, threshold, insn_count)
to say it lives at least the full length of this loop.
This will help guide optimizations in outer loops. */
if (uid_luid[REGNO_FIRST_UID (regno)] > INSN_LUID (loop_start))
if (REGNO_FIRST_LUID (regno) > INSN_LUID (loop_start))
/* This is the old insn before all the moved insns.
We can't use the moved insn because it is out of range
in uid_luid. Only the old insns have luids. */
REGNO_FIRST_UID (regno) = INSN_UID (loop_start);
if (uid_luid[REGNO_LAST_UID (regno)] < INSN_LUID (loop_end))
if (REGNO_LAST_LUID (regno) < INSN_LUID (loop_end))
REGNO_LAST_UID (regno) = INSN_UID (loop_end);
/* Combine with this moved insn any other matching movables. */
@ -3876,10 +3877,10 @@ strength_reduce (loop, insn_count, flags)
long as init_insn doesn't use the biv itself.
March 14, 1989 -- self@bayes.arc.nasa.gov */
if ((uid_luid[REGNO_LAST_UID (bl->regno)] < INSN_LUID (loop_end)
if ((REGNO_LAST_LUID (bl->regno) < INSN_LUID (loop_end)
&& bl->init_insn
&& INSN_UID (bl->init_insn) < max_uid_for_loop
&& uid_luid[REGNO_FIRST_UID (bl->regno)] >= INSN_LUID (bl->init_insn)
&& REGNO_FIRST_LUID (bl->regno) >= INSN_LUID (bl->init_insn)
#ifdef HAVE_decrement_and_branch_until_zero
&& ! bl->nonneg
#endif
@ -4935,8 +4936,8 @@ record_giv (loop, v, insn, src_reg, dest_reg, mult_val, add_val, ext_val,
{
v->mode = GET_MODE (SET_DEST (set));
v->lifetime = (uid_luid[REGNO_LAST_UID (REGNO (dest_reg))]
- uid_luid[REGNO_FIRST_UID (REGNO (dest_reg))]);
v->lifetime = (REGNO_LAST_LUID (REGNO (dest_reg))
- REGNO_FIRST_LUID (REGNO (dest_reg)));
/* If the lifetime is zero, it means that this register is
really a dead store. So mark this as a giv that can be
@ -4981,7 +4982,7 @@ record_giv (loop, v, insn, src_reg, dest_reg, mult_val, add_val, ext_val,
if (REGNO_FIRST_UID (REGNO (dest_reg)) == INSN_UID (insn)
/* Previous line always fails if INSN was moved by loop opt. */
&& uid_luid[REGNO_LAST_UID (REGNO (dest_reg))]
&& REGNO_LAST_LUID (REGNO (dest_reg))
< INSN_LUID (loop->end)
&& (! not_every_iteration
|| last_use_this_basic_block (dest_reg, insn)))
@ -5004,10 +5005,10 @@ record_giv (loop, v, insn, src_reg, dest_reg, mult_val, add_val, ext_val,
for (b = bl->biv; b; b = b->next_iv)
{
if (INSN_UID (b->insn) >= max_uid_for_loop
|| ((uid_luid[INSN_UID (b->insn)]
>= uid_luid[REGNO_FIRST_UID (REGNO (dest_reg))])
&& (uid_luid[INSN_UID (b->insn)]
<= uid_luid[REGNO_LAST_UID (REGNO (dest_reg))])))
|| ((INSN_LUID (b->insn)
>= REGNO_FIRST_LUID (REGNO (dest_reg)))
&& (INSN_LUID (b->insn)
<= REGNO_LAST_LUID (REGNO (dest_reg)))))
{
v->replaceable = 0;
v->not_replaceable = 1;
@ -8224,7 +8225,7 @@ update_reg_last_use (x, insn)
and hence this insn will never be the last use of x. */
if (GET_CODE (x) == REG && REGNO (x) < max_reg_before_loop
&& INSN_UID (insn) < max_uid_for_loop
&& uid_luid[REGNO_LAST_UID (REGNO (x))] < uid_luid[INSN_UID (insn)])
&& REGNO_LAST_LUID (REGNO (x)) < INSN_LUID (insn))
REGNO_LAST_UID (REGNO (x)) = INSN_UID (insn);
else
{

View File

@ -44,6 +44,10 @@ Boston, MA 02111-1307, USA. */
(INSN_UID (INSN) < max_uid_for_loop ? uid_luid[INSN_UID (INSN)] \
: (abort (), -1))
#define REGNO_FIRST_LUID(REGNO) uid_luid[REGNO_FIRST_UID (REGNO)]
#define REGNO_LAST_LUID(REGNO) uid_luid[REGNO_LAST_UID (REGNO)]
/* A "basic induction variable" or biv is a pseudo reg that is set
(within this loop) only by incrementing or decrementing it. */
/* A "general induction variable" or giv is a pseudo reg whose

View File

@ -841,9 +841,9 @@ unroll_loop (loop, insn_count, end_insert_before, strength_reduce_p)
these pseudo registers have valid regno_first_uid info. */
for (r = FIRST_PSEUDO_REGISTER; r < max_reg_before_loop; ++r)
if (REGNO_FIRST_UID (r) > 0 && REGNO_FIRST_UID (r) <= max_uid_for_loop
&& uid_luid[REGNO_FIRST_UID (r)] >= copy_start_luid
&& REGNO_FIRST_LUID (r) >= copy_start_luid
&& REGNO_LAST_UID (r) > 0 && REGNO_LAST_UID (r) <= max_uid_for_loop
&& uid_luid[REGNO_LAST_UID (r)] <= copy_end_luid)
&& REGNO_LAST_LUID (r) <= copy_end_luid)
{
/* However, we must also check for loop-carried dependencies.
If the value the pseudo has at the end of iteration X is
@ -1457,7 +1457,7 @@ precondition_loop_p (loop, initial_value, final_value, increment, mode)
/* Fail if loop_info->iteration_var is not live before loop_start,
since we need to test its value in the preconditioning code. */
if (uid_luid[REGNO_FIRST_UID (REGNO (loop_info->iteration_var))]
if (REGNO_FIRST_LUID (REGNO (loop_info->iteration_var))
> INSN_LUID (loop_start))
{
if (loop_dump_stream)
@ -2469,10 +2469,10 @@ find_splittable_regs (loop, unroll_type, end_insert_before, unroll_number)
biv_final_value = 0;
if (unroll_type != UNROLL_COMPLETELY
&& (loop->exit_count || unroll_type == UNROLL_NAIVE)
&& (uid_luid[REGNO_LAST_UID (bl->regno)] >= INSN_LUID (loop_end)
&& (REGNO_LAST_LUID (bl->regno) >= INSN_LUID (loop_end)
|| ! bl->init_insn
|| INSN_UID (bl->init_insn) >= max_uid_for_loop
|| (uid_luid[REGNO_FIRST_UID (bl->regno)]
|| (REGNO_FIRST_LUID (bl->regno)
< INSN_LUID (bl->init_insn))
|| reg_mentioned_p (bl->biv->dest_reg, SET_SRC (bl->init_set)))
&& ! (biv_final_value = final_biv_value (loop, bl)))
@ -2698,7 +2698,7 @@ find_splittable_givs (loop, bl, unroll_type, increment, unroll_number)
|| (REGNO_FIRST_UID (REGNO (v->dest_reg))
!= INSN_UID (XEXP (tem, 0)))))
/* Line above always fails if INSN was moved by loop opt. */
|| (uid_luid[REGNO_LAST_UID (REGNO (v->dest_reg))]
|| (REGNO_LAST_LUID (REGNO (v->dest_reg))
>= INSN_LUID (loop->end)))
&& ! (final_value = v->final_value))
continue;