This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] Remove stmt annotations properly
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, law at redhat dot com
- Date: Fri, 28 Nov 2003 13:10:48 +0100
- Subject: [tree-ssa] Remove stmt annotations properly
Hi,
as discussed earlier, current code to remove annotations does not remove
anything.
This does cause weird GGC confusion becuase of linked list problem I
described.
Bootstrapedd/regtested i686-pc-gnu-linux, x86_64-linux, OK?
Honza
2003-11-28 Jan Hubicka <jh@suse.cz>
* tree-ssa.c (remove_annotations_r): Kill.
(delete_tree_ssa): Remove annotations using staement walk;
kill argument fndecl.
(rewrite_out_of_ssa): Update call.
Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa.c,v
retrieving revision 1.1.4.167
diff -c -3 -p -r1.1.4.167 tree-ssa.c
*** tree-ssa.c 28 Nov 2003 01:02:39 -0000 1.1.4.167
--- tree-ssa.c 28 Nov 2003 12:05:18 -0000
*************** static void rewrite_initialize_block (st
*** 179,185 ****
static void rewrite_walk_stmts (struct dom_walk_data *, basic_block, tree);
static void rewrite_add_phi_arguments (struct dom_walk_data *,
basic_block, tree);
! static void delete_tree_ssa (tree);
static void mark_def_sites (struct dom_walk_data *walk_data,
basic_block bb,
tree parent_block_last_stmt ATTRIBUTE_UNUSED);
--- 179,185 ----
static void rewrite_walk_stmts (struct dom_walk_data *, basic_block, tree);
static void rewrite_add_phi_arguments (struct dom_walk_data *,
basic_block, tree);
! static void delete_tree_ssa (void);
static void mark_def_sites (struct dom_walk_data *walk_data,
basic_block bb,
tree parent_block_last_stmt ATTRIBUTE_UNUSED);
*************** static void rewrite_stmt (block_stmt_ite
*** 192,198 ****
static inline void rewrite_operand (tree *);
static void register_new_def (tree, tree, varray_type *);
static void insert_phi_nodes_for (tree, bitmap *);
- static tree remove_annotations_r (tree *, int *, void *);
static tree get_reaching_def (tree);
static tree get_value_for (tree, varray_type);
static void set_value_for (tree, tree, varray_type);
--- 192,197 ----
*************** rewrite_out_of_ssa (tree fndecl, enum tr
*** 2629,2635 ****
}
/* Flush out flow graph and SSA data. */
! delete_tree_ssa (fndecl);
delete_var_map (map);
timevar_pop (TV_TREE_SSA_TO_NORMAL);
}
--- 2628,2634 ----
}
/* Flush out flow graph and SSA data. */
! delete_tree_ssa ();
delete_var_map (map);
timevar_pop (TV_TREE_SSA_TO_NORMAL);
}
*************** init_tree_ssa (void)
*** 2966,2977 ****
/* Deallocate memory associated with SSA data structures for FNDECL. */
static void
! delete_tree_ssa (tree fndecl)
{
size_t i;
! /* Remove annotations from every tree in the function. */
! walk_tree (&DECL_SAVED_TREE (fndecl), remove_annotations_r, NULL, NULL);
/* Remove annotations from every referenced variable. */
for (i = 0; i < num_referenced_vars; i++)
--- 2965,2979 ----
/* Deallocate memory associated with SSA data structures for FNDECL. */
static void
! delete_tree_ssa ()
{
size_t i;
+ basic_block bb;
+ block_stmt_iterator bsi;
! FOR_EACH_BB (bb)
! for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
! bsi_stmt (bsi)->common.ann = NULL;
/* Remove annotations from every referenced variable. */
for (i = 0; i < num_referenced_vars; i++)
*************** delete_tree_ssa (tree fndecl)
*** 2982,3018 ****
referenced_vars = NULL;
global_var = NULL_TREE;
call_clobbered_vars = NULL;
- }
-
-
- /* Callback function for walk_tree to clear DFA/SSA annotations from node
- *TP. */
-
- static tree
- remove_annotations_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
- void *data ATTRIBUTE_UNUSED)
- {
- tree t = *tp;
- enum tree_code code = TREE_CODE (t);
-
- t->common.ann = NULL;
-
- /* If the node is not a container, then it has nothing interesting
- underneath it. */
- if (code != LOOP_EXPR
- && code != COND_EXPR
- && code != CATCH_EXPR
- && code != TRY_CATCH_EXPR
- && code != TRY_FINALLY_EXPR
- && code != SWITCH_EXPR
- && code != BIND_EXPR
- && code != COMPOUND_EXPR)
- {
- *walk_subtrees = 0;
- return NULL_TREE;
- }
-
- return NULL_TREE;
}
/* Return the current definition for variable VAR. If none is found,
--- 2984,2989 ----