diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-21 09:46:11 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-21 09:46:11 +0000 |
commit | 11bbec1341e4d8a1ddfc7e5f81e1ef251dd3cff4 (patch) | |
tree | f2703985f3ba0f658ced8d1bb4ac68c69a393e5a | |
parent | 5cbc53e292c83887dd882fe02e2f9dc172304c6d (diff) | |
download | gcc-11bbec1341e4d8a1ddfc7e5f81e1ef251dd3cff4.tar.gz |
2010-07-21 Richard Guenther <rguenther@suse.de>
* tree-flow.h (referenced_var): Move define ...
* tree-flow-inline.h (referenced_var): ... here as an inline
function. Assert here ...
* tree-dfa.c (referenced_var_lookup): ... instead of here.
* tree-ssa.c (maybe_optimize_var): Check if the variable
is in referenced vars.
(execute_update_addresses_taken): Remove old broken check.
* gimple-pretty-print.c (pp_points_to_solution): Use
referenced_var_lookup.
* tree-into-ssa.c (dump_decl_set): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162368 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/gimple-pretty-print.c | 6 | ||||
-rw-r--r-- | gcc/tree-dfa.c | 1 | ||||
-rw-r--r-- | gcc/tree-flow-inline.h | 10 | ||||
-rw-r--r-- | gcc/tree-flow.h | 1 | ||||
-rw-r--r-- | gcc/tree-into-ssa.c | 6 | ||||
-rw-r--r-- | gcc/tree-ssa.c | 13 |
7 files changed, 31 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2d702330376..313baf6c36d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2010-07-21 Richard Guenther <rguenther@suse.de> + + * tree-flow.h (referenced_var): Move define ... + * tree-flow-inline.h (referenced_var): ... here as an inline + function. Assert here ... + * tree-dfa.c (referenced_var_lookup): ... instead of here. + * tree-ssa.c (maybe_optimize_var): Check if the variable + is in referenced vars. + (execute_update_addresses_taken): Remove old broken check. + * gimple-pretty-print.c (pp_points_to_solution): Use + referenced_var_lookup. + * tree-into-ssa.c (dump_decl_set): Likewise. + 2010-07-21 Jakub Jelinek <jakub@redhat.com> PR debug/45003 diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index 0c613e4a8bb..6e1f6b782c2 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -534,11 +534,7 @@ pp_points_to_solution (pretty_printer *buffer, struct pt_solution *pt) pp_string (buffer, "{ "); EXECUTE_IF_SET_IN_BITMAP (pt->vars, 0, i, bi) { - struct tree_decl_minimal in; - tree var; - in.uid = i; - var = (tree) htab_find_with_hash (gimple_referenced_vars (cfun), - &in, i); + tree var = referenced_var_lookup (i); if (var) { dump_generic_node (buffer, var, 0, dump_flags, false); diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 37e15bf7ee2..461e2cf2277 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -495,7 +495,6 @@ referenced_var_lookup (unsigned int uid) struct tree_decl_minimal in; in.uid = uid; h = (tree) htab_find_with_hash (gimple_referenced_vars (cfun), &in, uid); - gcc_assert (h || uid == 0); return h; } diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index 7e935378c81..7103d238b09 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -98,6 +98,16 @@ next_htab_element (htab_iterator *hti) return NULL; } +/* Get the variable with uid UID from the list of referenced vars. */ + +static inline tree +referenced_var (unsigned int uid) +{ + tree var = referenced_var_lookup (uid); + gcc_assert (var || uid == 0); + return var; +} + /* Initialize ITER to point to the first referenced variable in the referenced_vars hashtable, and return that variable. */ diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index 6b12d086a9f..6209a844df3 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -321,7 +321,6 @@ typedef struct extern tree referenced_var_lookup (unsigned int); extern bool referenced_var_check_and_insert (tree); #define num_referenced_vars htab_elements (gimple_referenced_vars (cfun)) -#define referenced_var(i) referenced_var_lookup (i) #define num_ssa_names (VEC_length (tree, cfun->gimple_df->ssa_names)) #define ssa_name(i) (VEC_index (tree, cfun->gimple_df->ssa_names, (i))) diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index e49fb035bc1..e7c4eca1bb9 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -1470,11 +1470,7 @@ dump_decl_set (FILE *file, bitmap set) EXECUTE_IF_SET_IN_BITMAP (set, 0, i, bi) { - struct tree_decl_minimal in; - tree var; - in.uid = i; - var = (tree) htab_find_with_hash (gimple_referenced_vars (cfun), - &in, i); + tree var = referenced_var_lookup (i); if (var) print_generic_expr (file, var, 0); else diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index d4c519fdfe2..0be459118e5 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1881,6 +1881,11 @@ maybe_optimize_var (tree var, bitmap addresses_taken, bitmap not_reg_needs) || bitmap_bit_p (addresses_taken, DECL_UID (var))) return false; + /* If the variable is not in the list of referenced vars then we + do not need to touch it nor can we rename it. */ + if (!referenced_var_lookup (DECL_UID (var))) + return false; + if (TREE_ADDRESSABLE (var) /* Do not change TREE_ADDRESSABLE if we need to preserve var as a non-register. Otherwise we are confused and forget to @@ -2031,13 +2036,7 @@ execute_update_addresses_taken (bool do_optimize) unused vars from BLOCK trees which cause code generation differences for -g vs. -g0. */ for (var = DECL_ARGUMENTS (cfun->decl); var; var = DECL_CHAIN (var)) - { - /* ??? Not all arguments are in referenced vars. */ - if (!var_ann (var)) - continue; - update_vops - |= maybe_optimize_var (var, addresses_taken, not_reg_needs); - } + update_vops |= maybe_optimize_var (var, addresses_taken, not_reg_needs); for (i = 0; VEC_iterate (tree, cfun->local_decls, i, var); ++i) update_vops |= maybe_optimize_var (var, addresses_taken, not_reg_needs); } |