aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssanames.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssanames.c')
-rw-r--r--gcc/tree-ssanames.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
index d418bc1..8d675b4 100644
--- a/gcc/tree-ssanames.c
+++ b/gcc/tree-ssanames.c
@@ -67,12 +67,16 @@ unsigned int ssa_name_nodes_reused;
unsigned int ssa_name_nodes_created;
#endif
-/* Initialize management of SSA_NAMEs. */
+/* Initialize management of SSA_NAMEs to default SIZE. If SIZE is
+ zero use default. */
void
-init_ssanames (void)
+init_ssanames (struct function *fn, int size)
{
- SSANAMES (cfun) = VEC_alloc (tree, gc, 50);
+ if (size < 50)
+ size = 50;
+
+ SSANAMES (fn) = VEC_alloc (tree, gc, size);
/* Version 0 is special, so reserve the first slot in the table. Though
currently unused, we may use version 0 in alias analysis as part of
@@ -81,8 +85,8 @@ init_ssanames (void)
We use VEC_quick_push here because we know that SSA_NAMES has at
least 50 elements reserved in it. */
- VEC_quick_push (tree, SSANAMES (cfun), NULL_TREE);
- FREE_SSANAMES (cfun) = NULL;
+ VEC_quick_push (tree, SSANAMES (fn), NULL_TREE);
+ FREE_SSANAMES (fn) = NULL;
}
/* Finalize management of SSA_NAMEs. */
@@ -105,13 +109,13 @@ ssanames_print_statistics (void)
}
#endif
-/* Return an SSA_NAME node for variable VAR defined in statement STMT.
- STMT may be an empty statement for artificial references (e.g., default
- definitions created when a variable is used without a preceding
- definition). */
+/* Return an SSA_NAME node for variable VAR defined in statement STMT
+ in function FN. STMT may be an empty statement for artificial
+ references (e.g., default definitions created when a variable is
+ used without a preceding definition). */
tree
-make_ssa_name (tree var, tree stmt)
+make_ssa_name_fn (struct function *fn, tree var, tree stmt)
{
tree t;
use_operand_p imm;
@@ -124,10 +128,10 @@ make_ssa_name (tree var, tree stmt)
|| TREE_CODE (stmt) == PHI_NODE);
/* If our free list has an element, then use it. */
- if (FREE_SSANAMES (cfun))
+ if (FREE_SSANAMES (fn))
{
- t = FREE_SSANAMES (cfun);
- FREE_SSANAMES (cfun) = TREE_CHAIN (FREE_SSANAMES (cfun));
+ t = FREE_SSANAMES (fn);
+ FREE_SSANAMES (fn) = TREE_CHAIN (FREE_SSANAMES (fn));
#ifdef GATHER_STATISTICS
ssa_name_nodes_reused++;
#endif
@@ -135,13 +139,13 @@ make_ssa_name (tree var, tree stmt)
/* The node was cleared out when we put it on the free list, so
there is no need to do so again here. */
gcc_assert (ssa_name (SSA_NAME_VERSION (t)) == NULL);
- VEC_replace (tree, SSANAMES (cfun), SSA_NAME_VERSION (t), t);
+ VEC_replace (tree, SSANAMES (fn), SSA_NAME_VERSION (t), t);
}
else
{
t = make_node (SSA_NAME);
- SSA_NAME_VERSION (t) = num_ssa_names;
- VEC_safe_push (tree, gc, SSANAMES (cfun), t);
+ SSA_NAME_VERSION (t) = VEC_length (tree, SSANAMES (fn));
+ VEC_safe_push (tree, gc, SSANAMES (fn), t);
#ifdef GATHER_STATISTICS
ssa_name_nodes_created++;
#endif
@@ -358,6 +362,6 @@ struct gimple_opt_pass pass_release_ssa_names =
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
- 0 /* todo_flags_finish */
+ TODO_dump_func /* todo_flags_finish */
}
};