Commit 53b4bf74 by Diego Novillo Committed by Diego Novillo

tree-into-ssa.c (set_livein_block): Fix typo in comment.

	* tree-into-ssa.c (set_livein_block): Fix typo in comment.
	(rewrite_ssa_into_ssa): Start iterating over SSA names at 1.
	Release SSA names that have been re-renamed.
	* tree-phinodes.c (make_phi_node): Set same TREE_TYPE as the
	variable.
	* tree-ssa-alias.c (init_alias_info): If aliases have been
	computed before, clear existing alias information.
	(create_name_tags): Do no fixup PT_ANYTHING pointers.
	If the new name tag for a pointer is different than the one it
	had before, mark the old tag for renaming.
	(replace_may_alias): New function.
	(group_aliases): Call it.
	(setup_pointers_and_addressables): Always call get_tmt_for.
	(maybe_create_global_var): Don't create .GLOBAL_VAR more than
	once.
	(set_pt_anything): New local function.
	(set_pt_malloc): New local function.
	(merge_pointed_to_info): Don't merge pointed-to variables from
	the original pointer if the destination is pointing to an
	unknown location.
	(add_pointed_to_expr): Call set_pt_anything and set_pt_malloc.
	(add_pointed_to_var): Do not add a variable to the points-to
	set if the pointer is already pointing to anywhere.
	(collect_points_to_info_r): If the defining statement is a PHI
	node, only merge pointed-to information if the argument has
	already been visited.
	(get_tmt_for): Only create a new tag if the pointer didn't
	have one already.
	(dump_alias_info): Emit more information.
	(dump_points_to_info_for): Likewise.
	* tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Don't
	try to get the annotation of an SSA_NAME.
	* tree-ssa-operands.c (add_stmt_operand): Only check for empty
	alias sets when checking is enabled.
	* tree-ssa-pre.c (need_eh_cleanup): New local variable.
	(eliminate): Mark basic blocks that will need
	EH information cleaned up.
	(init_pre): Split ENTRY_BLOCK->0 if block 0 has more than one
	predecessor.
	Initialize need_eh_cleanup.
	(fini_pre): Call tree_purge_all_dead_eh_edges and
	cleanup_tree_cfg if needed.
	Free need_eh_cleanup.
	* tree-ssa.c (verify_ssa_name): New function.
	(verify_def): Call it.
	Re-arrange to avoid printing too many error messages.
	(verify_use): Likewise.
	(verify_phi_args): Likewise.
	(verify_flow_insensitive_alias_info): New function.
	(verify_flow_sensitive_alias_info): New function.
	(verify_alias_info): New function.
	(verify_ssa): Call verify_alias_info.
	Clear TREE_VISITED on all the SSA_NAMEs before scanning the
	program.
	Re-arrange to avoid printing too many error messages.
	* tree-ssanames.c (make_ssa_name): Clear
	SSA_NAME_IN_FREE_LIST.
	(release_ssa_name): Never release a default definition.
	(release_defs): New function.
	* tree.h: Declare it.
	* tree-ssa-dce.c (remove_dead_stmt): Call it.


	* tree-ssa.c (walk_use_def_chains_1): Add new argument IS_DFS.
	If true, do a depth-first search.  Do a breadht-first search,
	otherwise.
	(walk_use_def_chains): Add new argument IS_DFS.
	Update all users.
	* tree-flow.h (walk_use_def_chains): Update prototype.

From-SVN: r85052
parent 8e99fb4f
2004-07-22 Diego Novillo <dnovillo@redhat.com>
* tree-into-ssa.c (set_livein_block): Fix typo in comment.
(rewrite_ssa_into_ssa): Start iterating over SSA names at 1.
Release SSA names that have been re-renamed.
* tree-phinodes.c (make_phi_node): Set same TREE_TYPE as the
variable.
* tree-ssa-alias.c (init_alias_info): If aliases have been
computed before, clear existing alias information.
(create_name_tags): Do no fixup PT_ANYTHING pointers.
If the new name tag for a pointer is different than the one it
had before, mark the old tag for renaming.
(replace_may_alias): New function.
(group_aliases): Call it.
(setup_pointers_and_addressables): Always call get_tmt_for.
(maybe_create_global_var): Don't create .GLOBAL_VAR more than
once.
(set_pt_anything): New local function.
(set_pt_malloc): New local function.
(merge_pointed_to_info): Don't merge pointed-to variables from
the original pointer if the destination is pointing to an
unknown location.
(add_pointed_to_expr): Call set_pt_anything and set_pt_malloc.
(add_pointed_to_var): Do not add a variable to the points-to
set if the pointer is already pointing to anywhere.
(collect_points_to_info_r): If the defining statement is a PHI
node, only merge pointed-to information if the argument has
already been visited.
(get_tmt_for): Only create a new tag if the pointer didn't
have one already.
(dump_alias_info): Emit more information.
(dump_points_to_info_for): Likewise.
* tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Don't
try to get the annotation of an SSA_NAME.
* tree-ssa-operands.c (add_stmt_operand): Only check for empty
alias sets when checking is enabled.
* tree-ssa-pre.c (need_eh_cleanup): New local variable.
(eliminate): Mark basic blocks that will need
EH information cleaned up.
(init_pre): Split ENTRY_BLOCK->0 if block 0 has more than one
predecessor.
Initialize need_eh_cleanup.
(fini_pre): Call tree_purge_all_dead_eh_edges and
cleanup_tree_cfg if needed.
Free need_eh_cleanup.
* tree-ssa.c (verify_ssa_name): New function.
(verify_def): Call it.
Re-arrange to avoid printing too many error messages.
(verify_use): Likewise.
(verify_phi_args): Likewise.
(verify_flow_insensitive_alias_info): New function.
(verify_flow_sensitive_alias_info): New function.
(verify_alias_info): New function.
(verify_ssa): Call verify_alias_info.
Clear TREE_VISITED on all the SSA_NAMEs before scanning the
program.
Re-arrange to avoid printing too many error messages.
* tree-ssanames.c (make_ssa_name): Clear
SSA_NAME_IN_FREE_LIST.
(release_ssa_name): Never release a default definition.
(release_defs): New function.
* tree.h: Declare it.
* tree-ssa-dce.c (remove_dead_stmt): Call it.
2004-07-22 Diego Novillo <dnovillo@redhat.com>
* tree-ssa.c (walk_use_def_chains_1): Add new argument IS_DFS.
If true, do a depth-first search. Do a breadht-first search,
otherwise.
(walk_use_def_chains): Add new argument IS_DFS.
Update all users.
* tree-flow.h (walk_use_def_chains): Update prototype.
2004-07-22 Hans-Peter Nilsson <hp@axis.com>
* config/cris/cris.md: Tweak formatting.
......
......@@ -576,7 +576,7 @@ extern bool tree_ssa_useless_type_conversion_1 (tree, tree);
extern void verify_ssa (void);
extern void delete_tree_ssa (void);
extern void register_new_def (tree, varray_type *);
extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *);
extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *, bool);
extern void kill_redundant_phi_nodes (void);
/* In tree-into-ssa.c */
......
......@@ -608,7 +608,7 @@ set_livein_block (tree var, basic_block bb)
/* If the use operand pointed to by OP_P needs to be renamed, then strip away
any SSA_NAME wrapping the operand, set *UID_P to the underlying variable's
uid, and return true. Otherwise return false. If the operand was an
SSA_NAME, change it to the stipped name. */
SSA_NAME, change it to the stripped name. */
static bool
prepare_use_operand_for_rename (use_operand_p op_p, size_t *uid_p)
......@@ -1822,9 +1822,8 @@ rewrite_ssa_into_ssa (bitmap names_to_rename)
/* We no longer need this bitmap, clear and free it. */
sbitmap_free (mark_def_sites_global_data.kills);
for (i = 0; i < num_ssa_names; i++)
if (ssa_name (i))
set_current_def (ssa_name (i), NULL_TREE);
for (i = 1; i < num_ssa_names; i++)
set_current_def (ssa_name (i), NULL_TREE);
/* Insert PHI nodes at dominance frontiers of definition blocks. */
insert_phi_nodes (dfs, names_to_rename);
......@@ -1856,6 +1855,9 @@ rewrite_ssa_into_ssa (bitmap names_to_rename)
/* Finalize the dominator walker. */
fini_walk_dominator_tree (&walk_data);
EXECUTE_IF_SET_IN_BITMAP (names_to_rename, 0, i,
release_ssa_name (ssa_name (i)));
sbitmap_free (snames_to_rename);
timevar_pop (TV_TREE_SSA_REWRITE_BLOCKS);
......@@ -1874,16 +1876,16 @@ rewrite_ssa_into_ssa (bitmap names_to_rename)
htab_delete (def_blocks);
for (i = 0; i < num_ssa_names; i++)
for (i = 1; i < num_ssa_names; i++)
{
name = ssa_name (i);
if (!name
|| !SSA_NAME_AUX (name))
if (!SSA_NAME_AUX (name))
continue;
free (SSA_NAME_AUX (name));
SSA_NAME_AUX (name) = NULL;
}
timevar_pop (TV_TREE_SSA_OTHER);
}
......
......@@ -202,6 +202,7 @@ make_phi_node (tree var, int len)
memset (phi, 0, size);
TREE_SET_CODE (phi, PHI_NODE);
PHI_ARG_CAPACITY (phi) = len;
TREE_TYPE (phi) = TREE_TYPE (var);
if (TREE_CODE (var) == SSA_NAME)
SET_PHI_RESULT (phi, var);
else
......
......@@ -753,6 +753,7 @@ remove_dead_stmt (block_stmt_iterator *i, basic_block bb)
}
bsi_remove (i);
release_defs (t);
}
/* Print out removed statement statistics. */
......
......@@ -366,27 +366,30 @@ redirect_edges_and_update_ssa_graph (varray_type redirection_edges)
defs = DEF_OPS (ann);
for (j = 0; j < NUM_DEFS (defs); j++)
{
tree op = SSA_NAME_VAR (DEF_OP (defs, j));
bitmap_set_bit (vars_to_rename, var_ann (op)->uid);
tree op = DEF_OP (defs, j);
tree var = SSA_NAME_VAR (op);
bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
}
v_may_defs = STMT_V_MAY_DEF_OPS (stmt);
for (j = 0; j < NUM_V_MAY_DEFS (v_may_defs); j++)
{
tree op = V_MAY_DEF_RESULT (v_may_defs, j);
bitmap_set_bit (vars_to_rename, var_ann (op)->uid);
tree var = SSA_NAME_VAR (op);
bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
}
v_must_defs = STMT_V_MUST_DEF_OPS (stmt);
for (j = 0; j < NUM_V_MUST_DEFS (v_must_defs); j++)
{
tree op = V_MUST_DEF_OP (v_must_defs, j);
bitmap_set_bit (vars_to_rename, var_ann (op)->uid);
tree var = SSA_NAME_VAR (op);
bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
}
}
/* Finally, any variables in PHI nodes at our final destination
must also be taken our of SSA form. */
must also be taken out of SSA form. */
for (phi = phi_nodes (tgt); phi; phi = PHI_CHAIN (phi))
{
tree result = SSA_NAME_VAR (PHI_RESULT (phi));
......@@ -528,6 +531,7 @@ redirect_edges_and_update_ssa_graph (varray_type redirection_edges)
remove_phi_node (phi, NULL, bb);
}
}
BITMAP_XFREE (virtuals_to_rename);
}
......
......@@ -1386,8 +1386,10 @@ add_stmt_operand (tree *var_p, tree stmt, int flags, voperands_t prev_vops)
/* The variable is aliased. Add its aliases to the virtual
operands. */
#if defined ENABLE_CHECKING
if (VARRAY_ACTIVE_SIZE (aliases) == 0)
abort ();
#endif
if (flags & opf_is_def)
{
......
......@@ -307,6 +307,10 @@ static alloc_pool binary_node_pool;
static alloc_pool unary_node_pool;
static alloc_pool reference_node_pool;
/* Set of blocks with statements that have had its EH information
cleaned up. */
static bitmap need_eh_cleanup;
/* The phi_translate_table caches phi translations for a given
expression and predecessor. */
......@@ -1891,6 +1895,16 @@ eliminate (void)
pre_stats.eliminations++;
propagate_tree_value (rhs_p, sprime);
modify_stmt (stmt);
/* If we removed EH side effects from the statement, clean
its EH information. */
if (maybe_clean_eh_stmt (stmt))
{
bitmap_set_bit (need_eh_cleanup,
bb_for_stmt (stmt)->index);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " Removed EH side effects.\n");
}
}
}
}
......@@ -1909,6 +1923,18 @@ init_pre (void)
connect_infinite_loops_to_exit ();
vn_init ();
memset (&pre_stats, 0, sizeof (pre_stats));
/* If block 0 has more than one predecessor, it means that its PHI
nodes will have arguments coming from block -1. This creates
problems for several places in PRE that keep local arrays indexed
by block number. To prevent this, we split the edge coming from
ENTRY_BLOCK_PTR (FIXME, if ENTRY_BLOCK_PTR had an index number
different than -1 we wouldn't have to hack this. tree-ssa-dce.c
needs a similar change). */
if (ENTRY_BLOCK_PTR->succ->dest->pred->pred_next)
if (!(ENTRY_BLOCK_PTR->succ->flags & EDGE_ABNORMAL))
split_edge (ENTRY_BLOCK_PTR->succ);
FOR_ALL_BB (bb)
bb->aux = xcalloc (1, sizeof (struct bb_value_sets));
......@@ -1926,7 +1952,8 @@ init_pre (void)
binary_node_pool = create_alloc_pool ("Binary tree nodes", tsize, 30);
tsize = tree_size (build1 (NEGATE_EXPR, void_type_node, NULL_TREE));
unary_node_pool = create_alloc_pool ("Unary tree nodes", tsize, 30);
tsize = tree_size (build (COMPONENT_REF, void_type_node, NULL_TREE, NULL_TREE, NULL_TREE));
tsize = tree_size (build (COMPONENT_REF, void_type_node, NULL_TREE,
NULL_TREE, NULL_TREE));
reference_node_pool = create_alloc_pool ("Reference tree nodes", tsize, 30);
FOR_ALL_BB (bb)
{
......@@ -1935,6 +1962,8 @@ init_pre (void)
TMP_GEN (bb) = bitmap_set_new ();
AVAIL_OUT (bb) = bitmap_set_new ();
}
need_eh_cleanup = BITMAP_XMALLOC ();
}
......@@ -1962,6 +1991,14 @@ fini_pre (void)
free_dominance_info (CDI_POST_DOMINATORS);
vn_delete ();
if (bitmap_first_set_bit (need_eh_cleanup) >= 0)
{
tree_purge_all_dead_eh_edges (need_eh_cleanup);
cleanup_tree_cfg ();
}
BITMAP_XFREE (need_eh_cleanup);
}
......
......@@ -160,6 +160,7 @@ make_ssa_name (tree var, tree stmt)
SSA_NAME_VAR (t) = var;
SSA_NAME_DEF_STMT (t) = stmt;
SSA_NAME_PTR_INFO (t) = NULL;
SSA_NAME_IN_FREE_LIST (t) = 0;
return t;
}
......@@ -176,6 +177,11 @@ make_ssa_name (tree var, tree stmt)
void
release_ssa_name (tree var)
{
/* Never release the default definition for a symbol. It's a
special SSA name that should always exist once it's created. */
if (var == var_ann (SSA_NAME_VAR (var))->default_def)
return;
/* release_ssa_name can be called multiple times on a single SSA_NAME.
However, it should only end up on our free list one time. We
keep a status bit in the SSA_NAME node itself to indicate it has
......@@ -216,4 +222,31 @@ duplicate_ssa_name (tree name, tree stmt)
return new_name;
}
/* Release all the SSA_NAMEs created by STMT. */
void
release_defs (tree stmt)
{
size_t i;
v_may_def_optype v_may_defs;
v_must_def_optype v_must_defs;
def_optype defs;
stmt_ann_t ann;
ann = stmt_ann (stmt);
defs = DEF_OPS (ann);
v_may_defs = V_MAY_DEF_OPS (ann);
v_must_defs = V_MUST_DEF_OPS (ann);
for (i = 0; i < NUM_DEFS (defs); i++)
release_ssa_name (DEF_OP (defs, i));
for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
release_ssa_name (V_MAY_DEF_RESULT (v_may_defs, i));
for (i = 0; i < NUM_V_MUST_DEFS (v_must_defs); i++)
release_ssa_name (V_MUST_DEF_OP (v_must_defs, i));
}
#include "gt-tree-ssanames.h"
......@@ -2647,6 +2647,8 @@ extern void fini_ssanames (void);
extern tree make_ssa_name (tree, tree);
extern tree duplicate_ssa_name (tree, tree);
extern void release_ssa_name (tree);
extern void release_defs (tree);
#ifdef GATHER_STATISTICS
extern void ssanames_print_statistics (void);
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment