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/tree-ssa-live.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/tree-ssa-live.c')
-rw-r--r-- | gcc/tree-ssa-live.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index 6daf6557f0d..6d006fa99fb 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -285,6 +285,34 @@ change_partition_var (var_map map, tree var, int part) } +/* Helper function for mark_all_vars_used, called via walk_tree. */ + +static tree +mark_all_vars_used_1 (tree *tp, int *walk_subtrees, + void *data ATTRIBUTE_UNUSED) +{ + tree t = *tp; + + /* Only need to mark VAR_DECLS; parameters and return results are not + eliminated as unused. */ + if (TREE_CODE (t) == VAR_DECL) + set_is_used (t); + + if (DECL_P (t) || TYPE_P (t)) + *walk_subtrees = 0; + + return NULL; +} + +/* Mark all VAR_DECLS under *EXPR_P as used, so that they won't be + eliminated during the tree->rtl conversion process. */ + +static inline void +mark_all_vars_used (tree *expr_p) +{ + walk_tree (expr_p, mark_all_vars_used_1, NULL, NULL); +} + /* This function looks through the program and uses FLAGS to determine what SSA versioned variables are given entries in a new partition table. This new partition map is returned. */ @@ -338,6 +366,8 @@ create_ssa_var_map (int flags) arg = PHI_ARG_DEF (phi, i); if (TREE_CODE (arg) == SSA_NAME) register_ssa_partition (map, arg, true); + + mark_all_vars_used (&PHI_ARG_DEF_TREE (phi, i)); } } @@ -377,8 +407,6 @@ create_ssa_var_map (int flags) for (x = 0; x < NUM_VUSES (vuses); x++) { tree var = VUSE_OP (vuses, x); - set_is_used (var); - #if defined ENABLE_CHECKING SET_BIT (used_in_virtual_ops, var_ann (SSA_NAME_VAR (var))->uid); #endif @@ -388,8 +416,6 @@ create_ssa_var_map (int flags) for (x = 0; x < NUM_V_MAY_DEFS (v_may_defs); x++) { tree var = V_MAY_DEF_OP (v_may_defs, x); - set_is_used (var); - #if defined ENABLE_CHECKING SET_BIT (used_in_virtual_ops, var_ann (SSA_NAME_VAR (var))->uid); #endif @@ -399,11 +425,12 @@ create_ssa_var_map (int flags) for (x = 0; x < NUM_V_MUST_DEFS (v_must_defs); x++) { tree var = V_MUST_DEF_OP (v_must_defs, x); - set_is_used (var); #if defined ENABLE_CHECKING SET_BIT (used_in_virtual_ops, var_ann (SSA_NAME_VAR (var))->uid); #endif } + + mark_all_vars_used (bsi_stmt_ptr (bsi)); } } |