summaryrefslogtreecommitdiff
path: root/gcc/regrename.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/regrename.c')
-rw-r--r--gcc/regrename.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 10787a23db1..b15deee9b7a 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -106,7 +106,7 @@ static struct obstack rename_obstack;
/* If nonnull, the code calling into the register renamer requested
information about insn operands, and we store it here. */
-VEC(insn_rr_info, heap) *insn_rr;
+vec<insn_rr_info> insn_rr;
static void scan_rtx (rtx, rtx *, enum reg_class, enum scan_actions,
enum op_type);
@@ -116,7 +116,7 @@ static bool build_def_use (basic_block);
static unsigned current_id;
/* A mapping of unique id numbers to chains. */
-static VEC(du_head_p, heap) *id_to_chain;
+static vec<du_head_p> id_to_chain;
/* List of currently open chains. */
static struct du_head *open_chains;
@@ -142,12 +142,12 @@ static operand_rr_info *cur_operand;
du_head_p
regrename_chain_from_id (unsigned int id)
{
- du_head_p first_chain = VEC_index (du_head_p, id_to_chain, id);
+ du_head_p first_chain = id_to_chain[id];
du_head_p chain = first_chain;
while (chain->id != id)
{
id = chain->id;
- chain = VEC_index (du_head_p, id_to_chain, id);
+ chain = id_to_chain[id];
}
first_chain->id = id;
return chain;
@@ -160,7 +160,7 @@ dump_def_use_chain (int from)
{
du_head_p head;
int i;
- FOR_EACH_VEC_ELT_FROM (du_head_p, id_to_chain, i, head, from)
+ FOR_EACH_VEC_ELT_FROM (id_to_chain, i, head, from)
{
struct du_chain *this_du = head->first;
@@ -182,10 +182,10 @@ free_chain_data (void)
{
int i;
du_head_p ptr;
- for (i = 0; VEC_iterate(du_head_p, id_to_chain, i, ptr); i++)
+ for (i = 0; id_to_chain.iterate (i, &ptr); i++)
bitmap_clear (&ptr->conflicts);
- VEC_free (du_head_p, heap, id_to_chain);
+ id_to_chain.release ();
}
/* Walk all chains starting with CHAINS and record that they conflict with
@@ -232,7 +232,7 @@ create_new_chain (unsigned this_regno, unsigned this_nregs, rtx *loc,
head->need_caller_save_reg = 0;
head->cannot_rename = 0;
- VEC_safe_push (du_head_p, heap, id_to_chain, head);
+ id_to_chain.safe_push (head);
head->id = current_id++;
bitmap_initialize (&head->conflicts, &bitmap_default_obstack);
@@ -429,7 +429,7 @@ rename_chains (void)
#endif
}
- FOR_EACH_VEC_ELT (du_head_p, id_to_chain, i, this_head)
+ FOR_EACH_VEC_ELT (id_to_chain, i, this_head)
{
int best_new_reg;
int n_uses;
@@ -687,7 +687,7 @@ regrename_analyze (bitmap bb_mask)
}
current_id = 0;
- id_to_chain = VEC_alloc (du_head_p, heap, 0);
+ id_to_chain.create (0);
bitmap_initialize (&open_chains_set, &bitmap_default_obstack);
/* The order in which we visit blocks ensures that whenever
@@ -702,7 +702,7 @@ regrename_analyze (bitmap bb_mask)
bool success;
edge e;
edge_iterator ei;
- int old_length = VEC_length (du_head_p, id_to_chain);
+ int old_length = id_to_chain.length ();
this_info = (struct bb_rename_info *) bb1->aux;
if (this_info == NULL)
@@ -719,17 +719,16 @@ regrename_analyze (bitmap bb_mask)
if (dump_file)
fprintf (dump_file, "failed\n");
bb1->aux = NULL;
- VEC_truncate (du_head_p, id_to_chain, old_length);
+ id_to_chain.truncate (old_length);
current_id = old_length;
bitmap_clear (&this_info->incoming_open_chains_set);
open_chains = NULL;
- if (insn_rr != NULL)
+ if (insn_rr.exists ())
{
rtx insn;
FOR_BB_INSNS (bb1, insn)
{
- insn_rr_info *p = &VEC_index (insn_rr_info, insn_rr,
- INSN_UID (insn));
+ insn_rr_info *p = &insn_rr[INSN_UID (insn)];
p->op_info = NULL;
}
}
@@ -1578,9 +1577,9 @@ build_def_use (basic_block bb)
n_ops = recog_data.n_operands;
untracked_operands = 0;
- if (insn_rr != NULL)
+ if (insn_rr.exists ())
{
- insn_info = &VEC_index (insn_rr_info, insn_rr, INSN_UID (insn));
+ insn_info = &insn_rr[INSN_UID (insn)];
insn_info->op_info = XOBNEWVEC (&rename_obstack, operand_rr_info,
recog_data.n_operands);
memset (insn_info->op_info, 0,
@@ -1796,16 +1795,16 @@ void
regrename_init (bool insn_info)
{
gcc_obstack_init (&rename_obstack);
- insn_rr = NULL;
+ insn_rr.create (0);
if (insn_info)
- VEC_safe_grow_cleared (insn_rr_info, heap, insn_rr, get_max_uid ());
+ insn_rr.safe_grow_cleared (get_max_uid ());
}
/* Free all global data used by the register renamer. */
void
regrename_finish (void)
{
- VEC_free (insn_rr_info, heap, insn_rr);
+ insn_rr.release ();
free_chain_data ();
obstack_free (&rename_obstack, NULL);
}