a compile time hog that needs a rewrite (maybe cache st_exprs to
invalidate REG_EQUAL/REG_EQUIV notes for?).
- pattern_regs in st_expr should be a regset (on its own obstack).
- - antic_stores and avail_stores should be VECs instead of lists.
- store_motion_mems should be a vec instead of a list.
- there should be an alloc pool for struct st_expr objects.
- investigate whether it is helpful to make the address of an st_expr
/* List of registers mentioned by the mem. */
rtx pattern_regs;
/* INSN list of stores that are locally anticipatable. */
- rtx_insn_list *antic_stores;
+ vec<rtx_insn *> antic_stores;
/* INSN list of stores that are locally available. */
vec<rtx_insn *> avail_stores;
/* Next in the list. */
ptr->next = store_motion_mems;
ptr->pattern = x;
ptr->pattern_regs = NULL_RTX;
- ptr->antic_stores = NULL;
+ ptr->antic_stores.create (0);
ptr->avail_stores.create (0);
ptr->reaching_reg = NULL_RTX;
ptr->index = 0;
static void
free_st_expr_entry (struct st_expr * ptr)
{
- free_INSN_LIST_list (& ptr->antic_stores);
- ptr->avail_stores.release ();
+ ptr->antic_stores.release ();
+ ptr->avail_stores.release ();
free (ptr);
}
print_rtl (file, ptr->pattern);
fprintf (file, "\n ANTIC stores : ");
-
- if (ptr->antic_stores)
- print_rtl (file, ptr->antic_stores);
- else
- fprintf (file, "(nil)");
+ print_rtx_insn_vec (file, ptr->antic_stores);
fprintf (file, "\n AVAIL stores : ");
/* Do not check for anticipatability if we either found one anticipatable
store already, or tested for one and found out that it was killed. */
check_anticipatable = 0;
- if (!ptr->antic_stores)
+ if (ptr->antic_stores.is_empty ())
check_anticipatable = 1;
else
{
- rtx_insn *tmp = ptr->antic_stores->insn ();
+ rtx_insn *tmp = ptr->antic_stores.last ();
if (tmp != NULL_RTX
&& BLOCK_FOR_INSN (tmp) != bb)
check_anticipatable = 1;
tmp = NULL;
else
tmp = insn;
- ptr->antic_stores = alloc_INSN_LIST (tmp, ptr->antic_stores);
+ ptr->antic_stores.safe_push (tmp);
}
/* It is not necessary to check whether store is available if we did
for (ptr = first_st_expr (); ptr != NULL; ptr = next_st_expr (ptr))
{
LAST_AVAIL_CHECK_FAILURE (ptr) = NULL_RTX;
- if (ptr->antic_stores
- && (tmp = ptr->antic_stores->insn ()) == NULL_RTX)
- ptr->antic_stores = ptr->antic_stores->next ();
+ if (!ptr->antic_stores.is_empty ()
+ && (tmp = ptr->antic_stores.last ()) == NULL)
+ ptr->antic_stores.pop ();
}
}
int sp;
edge act;
sbitmap visited = sbitmap_alloc (last_basic_block_for_fn (cfun));
- rtx last, note;
+ rtx note;
rtx_insn *insn;
rtx mem = smexpr->pattern;
}
bitmap_set_bit (visited, bb->index);
+ rtx_insn *last;
if (bitmap_bit_p (st_antloc[bb->index], smexpr->index))
{
- for (last = smexpr->antic_stores;
- BLOCK_FOR_INSN (XEXP (last, 0)) != bb;
- last = XEXP (last, 1))
- continue;
- last = XEXP (last, 0);
+ unsigned int i;
+ FOR_EACH_VEC_ELT_REVERSE (smexpr->antic_stores, i, last)
+ if (BLOCK_FOR_INSN (last) == bb)
+ break;
}
else
last = NEXT_INSN (BB_END (bb));
struct st_expr *smexpr)
{
rtx_insn *insn;
- rtx mem, note, set, ptr;
+ rtx mem, note, set;
mem = smexpr->pattern;
insn = gen_move_insn (reg, SET_SRC (single_set (del)));
- for (ptr = smexpr->antic_stores; ptr; ptr = XEXP (ptr, 1))
- if (XEXP (ptr, 0) == del)
+ unsigned int i;
+ rtx_insn *temp;
+ FOR_EACH_VEC_ELT_REVERSE (smexpr->antic_stores, i, temp)
+ if (temp == del)
{
- XEXP (ptr, 0) = insn;
+ smexpr->antic_stores[i] = insn;
break;
}
basic_block bb;
int *regs_set_in_block;
rtx_insn *insn;
- rtx_insn_list *st;
struct st_expr * ptr;
unsigned int max_gcse_regno = max_reg_num ();
bitmap_set_bit (st_avloc[bb->index], ptr->index);
}
- for (st = ptr->antic_stores; st != NULL; st = st->next ())
+ unsigned int i;
+ FOR_EACH_VEC_ELT_REVERSE (ptr->antic_stores, i, insn)
{
- insn = st->insn ();
bb = BLOCK_FOR_INSN (insn);
bitmap_set_bit (st_antloc[bb->index], ptr->index);
}