diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-22 02:48:27 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-22 02:48:27 +0000 |
commit | 280450faa1152c283c0bb88b31337cee8e569ff5 (patch) | |
tree | b73bc536f4dc7bf38bca669bed0165ada4082844 /gcc/gimple-low.c | |
parent | 4bed831ea2e22d2a38eb7ca75ff4257235ba36bc (diff) | |
download | gcc-280450faa1152c283c0bb88b31337cee8e569ff5.tar.gz |
* gimple-low.c (expand_var_p): Don't look at TREE_ADDRESSABLE,
TREE_THIS_VOLATILE, may_aliases, or optimization level.
(remove_useless_vars): Dump debugging info.
(expand_used_vars): Move ...
* cfgexpand.c (expand_used_vars): ... here. Make static.
* tree-flow-inline.h (set_is_used): New.
(set_default_def): Use get_var_ann.
* tree-flow.h: Update decls.
* tree-ssa-live.c (mark_all_vars_used_1, mark_all_vars_used): New.
(create_ssa_var_map): Use it.
* tree-ssa.c (set_is_used): Remove.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85034 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-low.c')
-rw-r--r-- | gcc/gimple-low.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c index f164bd92ef1..828a36fa756 100644 --- a/gcc/gimple-low.c +++ b/gcc/gimple-low.c @@ -475,15 +475,13 @@ expand_var_p (tree var) if (TREE_CODE (var) != VAR_DECL) return true; - /* Remove all unused, unaliased temporaries. Also remove unused, unaliased - local variables during highly optimizing compilations. */ + /* Leave statics and externals alone. */ + if (TREE_STATIC (var) || DECL_EXTERNAL (var)) + return true; + + /* Remove all unused local variables. */ ann = var_ann (var); - if (ann - && ! ann->may_aliases - && ! ann->used - && ! TREE_ADDRESSABLE (var) - && ! TREE_THIS_VOLATILE (var) - && (DECL_ARTIFICIAL (var) || optimize >= 2)) + if (!ann || !ann->used) return false; return true; @@ -495,6 +493,13 @@ static void remove_useless_vars (void) { tree var, *cell; + FILE *df = NULL; + + if (dump_file && (dump_flags & TDF_DETAILS)) + { + df = dump_file; + fputs ("Discarding as unused:\n", df); + } for (cell = &cfun->unexpanded_var_list; *cell; ) { @@ -502,27 +507,22 @@ remove_useless_vars (void) if (!expand_var_p (var)) { + if (df) + { + fputs (" ", df); + print_generic_expr (df, var, dump_flags); + fputc ('\n', df); + } + *cell = TREE_CHAIN (*cell); continue; } cell = &TREE_CHAIN (*cell); } -} - -/* Expand variables in the unexpanded_var_list. */ - -void -expand_used_vars (void) -{ - tree cell; - - cfun->unexpanded_var_list = nreverse (cfun->unexpanded_var_list); - - for (cell = cfun->unexpanded_var_list; cell; cell = TREE_CHAIN (cell)) - expand_var (TREE_VALUE (cell)); - cfun->unexpanded_var_list = NULL_TREE; + if (df) + fputc ('\n', df); } struct tree_opt_pass pass_remove_useless_vars = |