summaryrefslogtreecommitdiff
path: root/gcc/tree-ssanames.c
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-13 18:24:33 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-13 18:24:33 +0000
commitbcaa2770b7990b0f52711102844ea72e3fd72f01 (patch)
tree27982ea789dad2373cffff1356daddf15ef05405 /gcc/tree-ssanames.c
parent148e6e9a8750db9128d9cbc095f9e960c12be72e (diff)
downloadgcc-bcaa2770b7990b0f52711102844ea72e3fd72f01.tar.gz
2008-05-13 Diego Novillo <dnovillo@google.com>
Kenneth Zadeck <zadeck@naturalbridge.com> http://gcc.gnu.org/ml/gcc-patches/2008-05/msg00748.html * tree.h (init_phinodes, fini_phinodes, release_phi_node, phinodes_print_statistics, init_ssanames, fini_ssanames, make_ssa_name, duplicate_ssa_name, duplicate_ssa_name_ptr_info, release_ssa_name, release_defs, replace_ssa_name_symbol, ssanames_print_statistics): Move ... * tree-flow.h: ... here. * tree-ssanames.c (init_ssanames): Add arguments FN and SIZE. Use FN instead of cfun. (make_ssa_name_fn): Rename from make_ssa_name. (pass_release_ssa_names): Add TODO_dump_func to finish flags. * tree-flow-inline.h (make_ssa_name): Move from tree-ssanames.c. Convert to static inline. Call make_ssa_name_fn. * omp-low.c (expand_omp_parallel): * tree-flow-inline.h (redirect_edge_var_map_result): * tree-ssa.c (init_tree_ssa): Add argument FN. Use it instead of cfun. Update all users. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135270 138bc75d-0d04-0410-961f-82ee72b054a4
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 d418bc19b5f..8d675b43c49 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 */
}
};