loop-invariant.c (invariants, [...]): Use VEC instead of VARRAY.
* loop-invariant.c (invariants, create_new_invariant, get_inv_cost, best_gain_for_invariant, find_invariants_to_move, move_invariants, init_inv_motion_data, free_inv_motion_data): Use VEC instead of VARRAY. From-SVN: r99035
This commit is contained in:
parent
544f9440ab
commit
edd954e620
@ -1,3 +1,11 @@
|
||||
2005-04-30 Kazu Hirata <kazu@cs.umass.edu>
|
||||
|
||||
* loop-invariant.c (invariants, create_new_invariant,
|
||||
get_inv_cost, best_gain_for_invariant,
|
||||
find_invariants_to_move, move_invariants,
|
||||
init_inv_motion_data, free_inv_motion_data): Use VEC instead
|
||||
of VARRAY.
|
||||
|
||||
2005-04-29 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* function.c (instantiate_decls): Remove valid_only argument.
|
||||
|
@ -118,9 +118,14 @@ struct invariant
|
||||
|
||||
static unsigned actual_stamp;
|
||||
|
||||
typedef struct invariant *invariant_p;
|
||||
|
||||
DEF_VEC_P(invariant_p);
|
||||
DEF_VEC_ALLOC_P(invariant_p, heap);
|
||||
|
||||
/* The invariants. */
|
||||
|
||||
static varray_type invariants;
|
||||
static VEC(invariant_p,heap) *invariants;
|
||||
|
||||
/* Test for possibility of invariantness of X. */
|
||||
|
||||
@ -332,10 +337,10 @@ create_new_invariant (struct def *def, rtx insn, bitmap depends_on,
|
||||
inv->stamp = 0;
|
||||
inv->insn = insn;
|
||||
|
||||
inv->invno = VARRAY_ACTIVE_SIZE (invariants);
|
||||
inv->invno = VEC_length (invariant_p, invariants);
|
||||
if (def)
|
||||
def->invno = inv->invno;
|
||||
VARRAY_PUSH_GENERIC_PTR_NOGC (invariants, inv);
|
||||
VEC_safe_push (invariant_p, heap, invariants, inv);
|
||||
|
||||
if (dump_file)
|
||||
{
|
||||
@ -614,7 +619,7 @@ get_inv_cost (struct invariant *inv, int *comp_cost, unsigned *regs_needed)
|
||||
|
||||
EXECUTE_IF_SET_IN_BITMAP (inv->depends_on, 0, depno, bi)
|
||||
{
|
||||
dep = VARRAY_GENERIC_PTR_NOGC (invariants, depno);
|
||||
dep = VEC_index (invariant_p, invariants, depno);
|
||||
|
||||
get_inv_cost (dep, &acomp_cost, &aregs_needed);
|
||||
|
||||
@ -673,9 +678,8 @@ best_gain_for_invariant (struct invariant **best, unsigned *regs_needed,
|
||||
int gain = 0, again;
|
||||
unsigned aregs_needed, invno;
|
||||
|
||||
for (invno = 0; invno < VARRAY_ACTIVE_SIZE (invariants); invno++)
|
||||
for (invno = 0; VEC_iterate (invariant_p, invariants, invno, inv); invno++)
|
||||
{
|
||||
inv = VARRAY_GENERIC_PTR_NOGC (invariants, invno);
|
||||
if (inv->move)
|
||||
continue;
|
||||
|
||||
@ -697,7 +701,7 @@ best_gain_for_invariant (struct invariant **best, unsigned *regs_needed,
|
||||
static void
|
||||
set_move_mark (unsigned invno)
|
||||
{
|
||||
struct invariant *inv = VARRAY_GENERIC_PTR_NOGC (invariants, invno);
|
||||
struct invariant *inv = VEC_index (invariant_p, invariants, invno);
|
||||
bitmap_iterator bi;
|
||||
|
||||
if (inv->move)
|
||||
@ -721,7 +725,7 @@ find_invariants_to_move (struct df *df)
|
||||
unsigned i, regs_used, n_inv_uses, regs_needed = 0, new_regs;
|
||||
struct invariant *inv = NULL;
|
||||
|
||||
if (!VARRAY_ACTIVE_SIZE (invariants))
|
||||
if (!VEC_length (invariant_p, invariants))
|
||||
return;
|
||||
|
||||
/* Now something slightly more involved. First estimate the number of used
|
||||
@ -741,9 +745,8 @@ find_invariants_to_move (struct df *df)
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < VARRAY_ACTIVE_SIZE (invariants); i++)
|
||||
for (i = 0; VEC_iterate (invariant_p, invariants, i, inv); i++)
|
||||
{
|
||||
inv = VARRAY_GENERIC_PTR_NOGC (invariants, i);
|
||||
if (inv->def)
|
||||
n_inv_uses += inv->def->n_uses;
|
||||
}
|
||||
@ -762,7 +765,7 @@ find_invariants_to_move (struct df *df)
|
||||
static void
|
||||
move_invariant_reg (struct loop *loop, unsigned invno, struct df *df)
|
||||
{
|
||||
struct invariant *inv = VARRAY_GENERIC_PTR_NOGC (invariants, invno);
|
||||
struct invariant *inv = VEC_index (invariant_p, invariants, invno);
|
||||
unsigned i;
|
||||
basic_block preheader = loop_preheader_edge (loop)->src;
|
||||
rtx reg, set;
|
||||
@ -816,9 +819,8 @@ move_invariants (struct loop *loop, struct df *df)
|
||||
struct invariant *inv;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < VARRAY_ACTIVE_SIZE (invariants); i++)
|
||||
for (i = 0; VEC_iterate (invariant_p, invariants, i, inv); i++)
|
||||
{
|
||||
inv = VARRAY_GENERIC_PTR_NOGC (invariants, i);
|
||||
if (inv->move)
|
||||
move_invariant_reg (loop, i, df);
|
||||
}
|
||||
@ -831,8 +833,7 @@ init_inv_motion_data (void)
|
||||
{
|
||||
actual_stamp = 1;
|
||||
|
||||
if (!invariants)
|
||||
VARRAY_GENERIC_PTR_NOGC_INIT (invariants, 100, "invariants");
|
||||
invariants = VEC_alloc (invariant_p, heap, 100);
|
||||
}
|
||||
|
||||
/* Frees the data allocated by invariant motion. DF is the dataflow
|
||||
@ -859,13 +860,12 @@ free_inv_motion_data (struct df *df)
|
||||
DF_REF_DATA (df->defs[i]) = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < VARRAY_ACTIVE_SIZE (invariants); i++)
|
||||
for (i = 0; VEC_iterate (invariant_p, invariants, i, inv); i++)
|
||||
{
|
||||
inv = VARRAY_GENERIC_PTR_NOGC (invariants, i);
|
||||
BITMAP_FREE (inv->depends_on);
|
||||
free (inv);
|
||||
}
|
||||
VARRAY_POP_ALL (invariants);
|
||||
VEC_free (invariant_p, heap, invariants);
|
||||
}
|
||||
|
||||
/* Move the invariants out of the LOOP. DF is the dataflow object. */
|
||||
|
Loading…
Reference in New Issue
Block a user