tree-dfa.c (remove_referenced_var): New function.
* tree-dfa.c (remove_referenced_var): New function. * tree-ssa-live.c (remove_unused_locals): Walk referenced vars and prune referenced vars list too. * tree-flow.h (remove_referenced_var): Declare. From-SVN: r120767
This commit is contained in:
parent
4437b50d21
commit
326648f1bd
4 changed files with 48 additions and 8 deletions
|
@ -1,3 +1,10 @@
|
|||
2007-01-14 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* tree-dfa.c (remove_referenced_var): New function.
|
||||
* tree-ssa-live.c (remove_unused_locals): Walk referenced vars and
|
||||
prune referenced vars list too.
|
||||
* tree-flow.h (remove_referenced_var): Declare.
|
||||
|
||||
2007-01-14 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* tree-eh.c (add_stmt_to_eh_region_fn): Do not add call_exprs
|
||||
|
|
|
@ -752,6 +752,29 @@ add_referenced_var (tree var)
|
|||
}
|
||||
}
|
||||
|
||||
/* Remove VAR from the list. */
|
||||
|
||||
void
|
||||
remove_referenced_var (tree var)
|
||||
{
|
||||
var_ann_t v_ann;
|
||||
struct int_tree_map in;
|
||||
void **loc;
|
||||
unsigned int uid = DECL_UID (var);
|
||||
|
||||
clear_call_clobbered (var);
|
||||
v_ann = get_var_ann (var);
|
||||
ggc_free (v_ann);
|
||||
var->base.ann = NULL;
|
||||
gcc_assert (DECL_P (var));
|
||||
in.uid = uid;
|
||||
in.to = var;
|
||||
loc = htab_find_slot_with_hash (gimple_referenced_vars (cfun), &in, uid,
|
||||
NO_INSERT);
|
||||
ggc_free (*loc);
|
||||
htab_clear_slot (gimple_referenced_vars (cfun), loc);
|
||||
}
|
||||
|
||||
|
||||
/* Return the virtual variable associated to the non-scalar variable VAR. */
|
||||
|
||||
|
|
|
@ -698,6 +698,7 @@ extern void dump_subvars_for (FILE *, tree);
|
|||
extern void debug_subvars_for (tree);
|
||||
extern tree get_virtual_var (tree);
|
||||
extern void add_referenced_var (tree);
|
||||
extern void remove_referenced_var (tree);
|
||||
extern void mark_symbols_for_renaming (tree);
|
||||
extern void find_new_referenced_vars (tree *);
|
||||
|
||||
|
|
|
@ -449,15 +449,12 @@ remove_unused_locals (void)
|
|||
{
|
||||
basic_block bb;
|
||||
tree t, *cell;
|
||||
referenced_var_iterator rvi;
|
||||
var_ann_t ann;
|
||||
|
||||
/* Assume all locals are unused. */
|
||||
for (t = cfun->unexpanded_var_list; t; t = TREE_CHAIN (t))
|
||||
{
|
||||
tree var = TREE_VALUE (t);
|
||||
if (TREE_CODE (var) != FUNCTION_DECL
|
||||
&& var_ann (var))
|
||||
var_ann (var)->used = false;
|
||||
}
|
||||
FOR_EACH_REFERENCED_VAR (t, rvi)
|
||||
var_ann (t)->used = false;
|
||||
|
||||
/* Walk the CFG marking all referenced symbols. */
|
||||
FOR_EACH_BB (bb)
|
||||
|
@ -493,7 +490,6 @@ remove_unused_locals (void)
|
|||
for (cell = &cfun->unexpanded_var_list; *cell; )
|
||||
{
|
||||
tree var = TREE_VALUE (*cell);
|
||||
var_ann_t ann;
|
||||
|
||||
if (TREE_CODE (var) != FUNCTION_DECL
|
||||
&& (!(ann = var_ann (var))
|
||||
|
@ -505,6 +501,19 @@ remove_unused_locals (void)
|
|||
|
||||
cell = &TREE_CHAIN (*cell);
|
||||
}
|
||||
|
||||
/* Remove unused variables from REFERENCED_VARs. As an special exception
|
||||
keep the variables that are believed to be aliased. Those can't be
|
||||
easilly removed from the alias sets and and operand caches.
|
||||
They will be removed shortly after next may_alias pass is performed. */
|
||||
FOR_EACH_REFERENCED_VAR (t, rvi)
|
||||
if (!is_global_var (t)
|
||||
&& !MTAG_P (t)
|
||||
&& TREE_CODE (t) != PARM_DECL
|
||||
&& TREE_CODE (t) != RESULT_DECL
|
||||
&& !(ann = var_ann (t))->used
|
||||
&& !ann->is_aliased && !is_call_clobbered (t) && !ann->symbol_mem_tag)
|
||||
remove_referenced_var (t);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue