diff options
author | Richard Guenther <rguenther@suse.de> | 2012-05-22 11:59:41 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-05-22 11:59:41 +0000 |
commit | 3828719aa915799d17cb2c650a48fd9f5ba88187 (patch) | |
tree | d8263cd9215e1a5a4e587cf8cfb703ab3c0c6850 | |
parent | 72d5c6c1575874d0377d4d637fa1311e60378e72 (diff) | |
download | gcc-3828719aa915799d17cb2c650a48fd9f5ba88187.zip gcc-3828719aa915799d17cb2c650a48fd9f5ba88187.tar.gz gcc-3828719aa915799d17cb2c650a48fd9f5ba88187.tar.bz2 |
tree.h (VAR_DECL_IS_VIRTUAL_OPERAND): New.
2012-05-22 Richard Guenther <rguenther@suse.de>
* tree.h (VAR_DECL_IS_VIRTUAL_OPERAND): New.
(init_function_for_compilation): Remove.
* tree-dfa.c (find_vars_r): Take struct function argument.
(find_referenced_vars_in): Adjust.
* tree-ssa-operands.c (clobber_stats): Remove.
(create_vop_var): Take struct function argument. Mark
virtual operand with VAR_DECL_IS_VIRTUAL_OPERAND.
(init_ssa_operands): Take struct function argument.
(fini_ssa_operands): Do not dump dead stats.
* tree-ssa-operands.h (init_ssa_operands): Take struct function
argument.
* cgraphunit.c (init_lowered_empty_function): Adjust.
* lto-streamer-in.c (input_cfg): Likewise.
* tree-inline.c (initialize_cfun): Likewise.
* tree-into-ssa.c (rewrite_into_ssa): Likewise.
* omp-low.c (expand_omp_taskreg): Likewise. Avoid switching
cfun.
* gimple.c (is_gimple_reg): Optimize the SSA_NAME case,
virtual operands are not registers.
From-SVN: r187772
-rw-r--r-- | gcc/ChangeLog | 22 | ||||
-rw-r--r-- | gcc/cgraphunit.c | 2 | ||||
-rw-r--r-- | gcc/gimple.c | 12 | ||||
-rw-r--r-- | gcc/lto-streamer-in.c | 2 | ||||
-rw-r--r-- | gcc/omp-low.c | 6 | ||||
-rw-r--r-- | gcc/tree-dfa.c | 15 | ||||
-rw-r--r-- | gcc/tree-inline.c | 2 | ||||
-rw-r--r-- | gcc/tree-into-ssa.c | 2 | ||||
-rw-r--r-- | gcc/tree-ssa-operands.c | 68 | ||||
-rw-r--r-- | gcc/tree-ssa-operands.h | 2 | ||||
-rw-r--r-- | gcc/tree.h | 7 |
11 files changed, 66 insertions, 74 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4714c31..b76a522 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,27 @@ 2012-05-22 Richard Guenther <rguenther@suse.de> + * tree.h (VAR_DECL_IS_VIRTUAL_OPERAND): New. + (init_function_for_compilation): Remove. + * tree-dfa.c (find_vars_r): Take struct function argument. + (find_referenced_vars_in): Adjust. + * tree-ssa-operands.c (clobber_stats): Remove. + (create_vop_var): Take struct function argument. Mark + virtual operand with VAR_DECL_IS_VIRTUAL_OPERAND. + (init_ssa_operands): Take struct function argument. + (fini_ssa_operands): Do not dump dead stats. + * tree-ssa-operands.h (init_ssa_operands): Take struct function + argument. + * cgraphunit.c (init_lowered_empty_function): Adjust. + * lto-streamer-in.c (input_cfg): Likewise. + * tree-inline.c (initialize_cfun): Likewise. + * tree-into-ssa.c (rewrite_into_ssa): Likewise. + * omp-low.c (expand_omp_taskreg): Likewise. Avoid switching + cfun. + * gimple.c (is_gimple_reg): Optimize the SSA_NAME case, + virtual operands are not registers. + +2012-05-22 Richard Guenther <rguenther@suse.de> + * tree-cfg.c (verify_gimple_assign_unary): Fix typo in previous commit. diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index e3416c6..2833868 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1211,7 +1211,7 @@ init_lowered_empty_function (tree decl) gimple_register_cfg_hooks (); init_empty_tree_cfg (); init_tree_ssa (cfun); - init_ssa_operands (); + init_ssa_operands (cfun); cfun->gimple_df->in_ssa_p = true; DECL_INITIAL (decl) = make_node (BLOCK); diff --git a/gcc/gimple.c b/gcc/gimple.c index 4fc8362..bb02864 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -2786,7 +2786,17 @@ bool is_gimple_reg (tree t) { if (TREE_CODE (t) == SSA_NAME) - t = SSA_NAME_VAR (t); + { + t = SSA_NAME_VAR (t); + if (TREE_CODE (t) == VAR_DECL + && VAR_DECL_IS_VIRTUAL_OPERAND (t)) + return false; + return true; + } + + if (TREE_CODE (t) == VAR_DECL + && VAR_DECL_IS_VIRTUAL_OPERAND (t)) + return false; if (!is_gimple_variable (t)) return false; diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 63497f6..271fe99 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -616,7 +616,7 @@ input_cfg (struct lto_input_block *ib, struct function *fn, int index; init_empty_tree_cfg_for_function (fn); - init_ssa_operands (); + init_ssa_operands (fn); profile_status_for_function (fn) = streamer_read_enum (ib, profile_status_d, PROFILE_LAST); diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 980d06f..0058472 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -3543,11 +3543,9 @@ expand_omp_taskreg (struct omp_region *region) if (gimple_in_ssa_p (cfun)) { - push_cfun (child_cfun); init_tree_ssa (child_cfun); - init_ssa_operands (); - cfun->gimple_df->in_ssa_p = true; - pop_cfun (); + init_ssa_operands (child_cfun); + child_cfun->gimple_df->in_ssa_p = true; block = NULL_TREE; } else diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 785ae1b..31cafa0 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -62,7 +62,6 @@ struct dfa_stats_d /* Local functions. */ static void collect_dfa_stats (struct dfa_stats_d *); -static tree find_vars_r (tree *, int *, void *); /*--------------------------------------------------------------------------- @@ -441,17 +440,19 @@ collect_dfa_stats (struct dfa_stats_d *dfa_stats_p ATTRIBUTE_UNUSED) the function. */ static tree -find_vars_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) +find_vars_r (tree *tp, int *walk_subtrees, void *data) { + struct function *fn = (struct function *) data; + /* If we are reading the lto info back in, we need to rescan the referenced vars. */ if (TREE_CODE (*tp) == SSA_NAME) - add_referenced_var (SSA_NAME_VAR (*tp)); + add_referenced_var_1 (SSA_NAME_VAR (*tp), fn); /* If T is a regular variable that the optimizers are interested in, add it to the list of variables. */ else if (SSA_VAR_P (*tp)) - add_referenced_var (*tp); + add_referenced_var_1 (*tp, fn); /* Type, _DECL and constant nodes have no interesting children. Ignore them. */ @@ -471,16 +472,16 @@ find_referenced_vars_in (gimple stmt) if (gimple_code (stmt) != GIMPLE_PHI) { for (i = 0; i < gimple_num_ops (stmt); i++) - walk_tree (gimple_op_ptr (stmt, i), find_vars_r, NULL, NULL); + walk_tree (gimple_op_ptr (stmt, i), find_vars_r, cfun, NULL); } else { - walk_tree (gimple_phi_result_ptr (stmt), find_vars_r, NULL, NULL); + walk_tree (gimple_phi_result_ptr (stmt), find_vars_r, cfun, NULL); for (i = 0; i < gimple_phi_num_args (stmt); i++) { tree arg = gimple_phi_arg_def (stmt, i); - walk_tree (&arg, find_vars_r, NULL, NULL); + walk_tree (&arg, find_vars_r, cfun, NULL); } } } diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 8c116f6..3055d93 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -2123,7 +2123,7 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, gcov_type count) { init_tree_ssa (cfun); cfun->gimple_df->in_ssa_p = true; - init_ssa_operands (); + init_ssa_operands (cfun); } pop_cfun (); } diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index 170d8d0..86899fe 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -2471,7 +2471,7 @@ rewrite_into_ssa (void) basic_block bb; /* Initialize operand data structures. */ - init_ssa_operands (); + init_ssa_operands (cfun); /* Initialize internal data needed by the renamer. */ init_ssa_renamer (); diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index 2994a12..d415ba2 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -76,34 +76,6 @@ along with GCC; see the file COPYING3. If not see operand vector for VUSE, then the new vector will also be modified such that it contains 'a_5' rather than 'a'. */ -/* Structure storing statistics on how many call clobbers we have, and - how many where avoided. */ - -static struct -{ - /* Number of call-clobbered ops we attempt to add to calls in - add_call_clobbered_mem_symbols. */ - unsigned int clobbered_vars; - - /* Number of write-clobbers (VDEFs) avoided by using - not_written information. */ - unsigned int static_write_clobbers_avoided; - - /* Number of reads (VUSEs) avoided by using not_read information. */ - unsigned int static_read_clobbers_avoided; - - /* Number of write-clobbers avoided because the variable can't escape to - this call. */ - unsigned int unescapable_clobbers_avoided; - - /* Number of read-only uses we attempt to add to calls in - add_call_read_mem_symbols. */ - unsigned int readonly_clobbers; - - /* Number of read-only uses we avoid using not_read information. */ - unsigned int static_readonly_clobbers_avoided; -} clobber_stats; - /* Flags to describe operand properties in helpers. */ @@ -186,11 +158,11 @@ ssa_operands_active (void) representative of all of the virtual operands FUD chain. */ static void -create_vop_var (void) +create_vop_var (struct function *fn) { tree global_var; - gcc_assert (cfun->gimple_df->vop == NULL_TREE); + gcc_assert (fn->gimple_df->vop == NULL_TREE); global_var = build_decl (BUILTINS_LOCATION, VAR_DECL, get_identifier (".MEM"), @@ -203,10 +175,11 @@ create_vop_var (void) DECL_CONTEXT (global_var) = NULL_TREE; TREE_THIS_VOLATILE (global_var) = 0; TREE_ADDRESSABLE (global_var) = 0; + VAR_DECL_IS_VIRTUAL_OPERAND (global_var) = 1; create_var_ann (global_var); - add_referenced_var (global_var); - cfun->gimple_df->vop = global_var; + add_referenced_var_1 (global_var, fn); + fn->gimple_df->vop = global_var; } /* These are the sizes of the operand memory buffer in bytes which gets @@ -224,7 +197,7 @@ create_vop_var (void) /* Initialize the operand cache routines. */ void -init_ssa_operands (void) +init_ssa_operands (struct function *fn) { if (!n_initialized++) { @@ -235,13 +208,12 @@ init_ssa_operands (void) bitmap_obstack_initialize (&operands_bitmap_obstack); } - gcc_assert (gimple_ssa_operands (cfun)->operand_memory == NULL); - gimple_ssa_operands (cfun)->operand_memory_index - = gimple_ssa_operands (cfun)->ssa_operand_mem_size; - gimple_ssa_operands (cfun)->ops_active = true; - memset (&clobber_stats, 0, sizeof (clobber_stats)); - gimple_ssa_operands (cfun)->ssa_operand_mem_size = OP_SIZE_INIT; - create_vop_var (); + gcc_assert (gimple_ssa_operands (fn)->operand_memory == NULL); + gimple_ssa_operands (fn)->operand_memory_index + = gimple_ssa_operands (fn)->ssa_operand_mem_size; + gimple_ssa_operands (fn)->ops_active = true; + gimple_ssa_operands (fn)->ssa_operand_mem_size = OP_SIZE_INIT; + create_vop_var (fn); } @@ -276,22 +248,6 @@ fini_ssa_operands (void) bitmap_obstack_release (&operands_bitmap_obstack); cfun->gimple_df->vop = NULL_TREE; - - if (dump_file && (dump_flags & TDF_STATS)) - { - fprintf (dump_file, "Original clobbered vars: %d\n", - clobber_stats.clobbered_vars); - fprintf (dump_file, "Static write clobbers avoided: %d\n", - clobber_stats.static_write_clobbers_avoided); - fprintf (dump_file, "Static read clobbers avoided: %d\n", - clobber_stats.static_read_clobbers_avoided); - fprintf (dump_file, "Unescapable clobbers avoided: %d\n", - clobber_stats.unescapable_clobbers_avoided); - fprintf (dump_file, "Original read-only clobbers: %d\n", - clobber_stats.readonly_clobbers); - fprintf (dump_file, "Static read-only clobbers avoided: %d\n", - clobber_stats.static_readonly_clobbers_avoided); - } } diff --git a/gcc/tree-ssa-operands.h b/gcc/tree-ssa-operands.h index ac195b5..e3fe633 100644 --- a/gcc/tree-ssa-operands.h +++ b/gcc/tree-ssa-operands.h @@ -100,7 +100,7 @@ struct GTY(()) ssa_operands { #define PHI_ARG_INDEX_FROM_USE(USE) phi_arg_index_from_use (USE) -extern void init_ssa_operands (void); +extern void init_ssa_operands (struct function *fn); extern void fini_ssa_operands (void); extern void update_stmt_operands (gimple); extern void free_stmt_operands (gimple); @@ -689,6 +689,9 @@ struct GTY(()) tree_common { TYPE_SATURATING in all types + VAR_DECL_IS_VIRTUAL_OPERAND in + VAR_DECL + nowarning_flag: TREE_NO_WARNING in @@ -3333,6 +3336,9 @@ extern void decl_fini_priority_insert (tree, priority_type); libraries. */ #define MAX_RESERVED_INIT_PRIORITY 100 +#define VAR_DECL_IS_VIRTUAL_OPERAND(NODE) \ + (VAR_DECL_CHECK (NODE)->base.saturating_flag) + #define DECL_VAR_ANN_PTR(NODE) \ (TREE_CODE (NODE) == VAR_DECL ? &(NODE)->var_decl.ann \ : TREE_CODE (NODE) == PARM_DECL ? &(NODE)->parm_decl.ann \ @@ -5537,7 +5543,6 @@ extern void stack_protect_prologue (void); extern void stack_protect_epilogue (void); extern void init_dummy_function_start (void); extern void expand_dummy_function_end (void); -extern unsigned int init_function_for_compilation (void); extern void allocate_struct_function (tree, bool); extern void push_struct_function (tree fndecl); extern void init_function_start (tree); |