+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.
+
2008-05-13 Tom Tromey <tromey@redhat.com>
PR preprocessor/22168:
if (gimple_in_ssa_p (cfun))
{
push_cfun (child_cfun);
- init_tree_ssa ();
+ init_tree_ssa (child_cfun);
init_ssa_operands ();
cfun->gimple_df->in_ssa_p = true;
pop_cfun ();
{
return v->result;
}
+
+
+/* Return an SSA_NAME node for variable VAR defined in statement STMT
+ in function cfun. */
+
+static inline tree
+make_ssa_name (tree var, tree stmt)
+{
+ return make_ssa_name_fn (cfun, var, stmt);
+}
+
#endif /* _TREE_FLOW_INLINE_H */
extern void remove_phi_args (edge);
extern void remove_phi_node (tree, tree, bool);
extern tree phi_reverse (tree);
+extern void init_phinodes (void);
+extern void fini_phinodes (void);
+extern void release_phi_node (tree);
+#ifdef GATHER_STATISTICS
+extern void phinodes_print_statistics (void);
+#endif
/* In gimple-low.c */
extern void record_vars_into (tree, tree);
extern edge_var_map_vector redirect_edge_var_map_vector (edge);
extern void redirect_edge_var_map_destroy (void);
-
-extern void init_tree_ssa (void);
+extern void init_tree_ssa (struct function *);
extern edge ssa_redirect_edge (edge, basic_block);
extern void flush_pending_stmts (edge);
extern bool tree_ssa_useless_type_conversion (tree);
tree get_current_def (tree);
void set_current_def (tree, tree);
+/* In tree-ssanames.c */
+extern void init_ssanames (struct function *, int);
+extern void fini_ssanames (void);
+extern tree make_ssa_name_fn (struct function *, tree, tree);
+extern tree duplicate_ssa_name (tree, tree);
+extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *);
+extern void release_ssa_name (tree);
+extern void release_defs (tree);
+extern void replace_ssa_name_symbol (tree, tree);
+
+#ifdef GATHER_STATISTICS
+extern void ssanames_print_statistics (void);
+#endif
+
/* In tree-ssa-ccp.c */
bool fold_stmt (tree *);
bool fold_stmt_inplace (tree);
if (src_cfun->gimple_df)
{
- init_tree_ssa ();
+ init_tree_ssa (cfun);
cfun->gimple_df->in_ssa_p = true;
init_ssa_operands ();
}
execute_init_datastructures (void)
{
/* Allocate hash tables, arrays and other structures. */
- init_tree_ssa ();
+ init_tree_ssa (cfun);
return 0;
}
/* Initialize global DFA and SSA structures. */
void
-init_tree_ssa (void)
+init_tree_ssa (struct function *fn)
{
- cfun->gimple_df = GGC_CNEW (struct gimple_df);
- cfun->gimple_df->referenced_vars = htab_create_ggc (20, uid_decl_map_hash,
- uid_decl_map_eq, NULL);
- cfun->gimple_df->default_defs = htab_create_ggc (20, uid_ssaname_map_hash,
- uid_ssaname_map_eq, NULL);
- cfun->gimple_df->var_anns = htab_create_ggc (20, var_ann_hash,
- var_ann_eq, NULL);
- cfun->gimple_df->call_clobbered_vars = BITMAP_GGC_ALLOC ();
- cfun->gimple_df->addressable_vars = BITMAP_GGC_ALLOC ();
- init_ssanames ();
+ fn->gimple_df = GGC_CNEW (struct gimple_df);
+ fn->gimple_df->referenced_vars = htab_create_ggc (20, uid_decl_map_hash,
+ uid_decl_map_eq, NULL);
+ fn->gimple_df->default_defs = htab_create_ggc (20, uid_ssaname_map_hash,
+ uid_ssaname_map_eq, NULL);
+ fn->gimple_df->var_anns = htab_create_ggc (20, var_ann_hash,
+ var_ann_eq, NULL);
+ fn->gimple_df->call_clobbered_vars = BITMAP_GGC_ALLOC ();
+ fn->gimple_df->addressable_vars = BITMAP_GGC_ALLOC ();
+ init_ssanames (fn, 0);
init_phinodes ();
}
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
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. */
}
#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;
|| 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
/* 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
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
- 0 /* todo_flags_finish */
+ TODO_dump_func /* todo_flags_finish */
}
};
extern tree make_tree_vec_stat (int MEM_STAT_DECL);
#define make_tree_vec(t) make_tree_vec_stat (t MEM_STAT_INFO)
-/* Tree nodes for SSA analysis. */
-
-extern void init_phinodes (void);
-extern void fini_phinodes (void);
-extern void release_phi_node (tree);
-#ifdef GATHER_STATISTICS
-extern void phinodes_print_statistics (void);
-#endif
-
-extern void init_ssanames (void);
-extern void fini_ssanames (void);
-extern tree make_ssa_name (tree, tree);
-extern tree duplicate_ssa_name (tree, tree);
-extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *);
-extern void release_ssa_name (tree);
-extern void release_defs (tree);
-extern void replace_ssa_name_symbol (tree, tree);
-
-#ifdef GATHER_STATISTICS
-extern void ssanames_print_statistics (void);
-#endif
-
/* Return the (unique) IDENTIFIER_NODE node for a given name.
The name is supplied as a char *. */