diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-01 11:48:04 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-01 11:48:04 +0000 |
commit | e70e8b13a21cfe8866fc9c3357c6f42962246aaa (patch) | |
tree | 103b768984c681c0e66bf0bd7b06f89dbdc9cce1 /gcc/tree-ssa.c | |
parent | a575acb283ccbe98f47a7f5b58b15bdcb6df313f (diff) | |
download | gcc-e70e8b13a21cfe8866fc9c3357c6f42962246aaa.tar.gz |
2012-08-01 Richard Guenther <rguenther@suse.de>
* tree-flow.h (struct gimple_df): Remove syms_to_rename member,
add ssa_renaming_needed and rename_vops flags.
(SYMS_TO_RENAME): Remove.
(symbol_marked_for_renaming): Likewise.
(mark_virtual_ops_for_renaming): Likewise.
* tree-into-ssa.c (symbols_to_rename_set, symbols_to_rename):
New globals.
(mark_for_renaming, marked_for_renaming): New functions.
(symbol_marked_for_renaming): Remove.
(dump_currdefs): Adjust.
(maybe_replace_use): Likewise.
(maybe_replace_use_in_debug_stmt): Likewise.
(maybe_register_def): Likewise.
(rewrite_update_phi_arguments): Likewise.
(rewrite_update_enter_block): Likewise.
(fini_ssa_renamer): Clear update SSA status here ...
(delete_update_ssa): ... not here. Free rename set.
(prepare_block_for_update): Compute which decls need renaming.
(dump_update_ssa): Adjust.
(mark_sym_for_renaming): Adjust update SSA status for virtuals.
(need_ssa_update_p): Adjust.
(insert_updated_phi_nodes_for): Likewise.
(update_ssa): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs): Adjust update SSA status
for virtual and real operands.
(finalize_ssa_uses): Likewise.
* tree-ssanames.c (init_ssanames): Adjust.
* tree-ssa.c (maybe_rewrite_mem_ref_base, maybe_optimize_var,
execute_update_addresses_taken): Add bitmap to keep track of which
candidates are suitable for rewriting and later renaming by SSA
update.
* matrix-reorg.c (transform_access_sites): Do not rename all defs.
* tree-dfa.c (make_rename_temp): Do not mark real operands for renaming.
* cgraphunit.c (assemble_thunk): Likewise.
* gimplify.c (gimple_regimplify_operands): Likewise.
(force_gimple_operand_1): Likewise.
* ipa-prop.c (ipa_modify_formal_parameters): Likewise.
* tree-inline.c (declare_return_variable): Likewise.
* tree-parloops.c (separate_decls_in_region_stmt): Do not call
mark_virtual_ops_for_renaming.
(create_stores_for_reduction): Likewise.
(create_loads_and_stores_for_name): Likewise.
* tree-predcom.c (mark_virtual_ops_for_renaming): Remove.
(initialize_root_vars_lm): Do not call mark_virtual_ops_for_renaming.
(execute_load_motion): Likewise.
(remove_stmt): Likewise.
(execute_pred_commoning_chain): Likewise.
* tree-sra.c (create_access_replacement): Do not rename real
operands.
(get_unrenamed_access_replacement): Unify with ...
(get_access_replacement): ... this.
(get_repl_default_def_ssa_name): Adjust.
* tree-ssa-loop-im.c (move_computations_stmt): Manually update
virtual SSA form.
(rewrite_mem_ref_loc): Do not call mark_virtual_ops_for_renaming.
* tree-ssa-loop-prefetch.c (emit_mfence_after_loop): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190033 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r-- | gcc/tree-ssa.c | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 9acb0354941..b8712eb094c 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1771,7 +1771,7 @@ struct gimple_opt_pass pass_early_warn_uninitialized = a MEM_REF to a plain or converted symbol. */ static void -maybe_rewrite_mem_ref_base (tree *tp) +maybe_rewrite_mem_ref_base (tree *tp, bitmap suitable_for_renaming) { tree sym; @@ -1782,7 +1782,7 @@ maybe_rewrite_mem_ref_base (tree *tp) && (sym = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0)) && DECL_P (sym) && !TREE_ADDRESSABLE (sym) - && symbol_marked_for_renaming (sym)) + && bitmap_bit_p (suitable_for_renaming, DECL_UID (sym))) { if (TREE_CODE (TREE_TYPE (sym)) == VECTOR_TYPE && useless_type_conversion_p (TREE_TYPE (*tp), @@ -1891,21 +1891,15 @@ non_rewritable_lvalue_p (tree lhs) mark the variable VAR for conversion into SSA. Return true when updating stmts is required. */ -static bool -maybe_optimize_var (tree var, bitmap addresses_taken, bitmap not_reg_needs) +static void +maybe_optimize_var (tree var, bitmap addresses_taken, bitmap not_reg_needs, + bitmap suitable_for_renaming) { - bool update_vops = false; - /* Global Variables, result decls cannot be changed. */ if (is_global_var (var) || TREE_CODE (var) == RESULT_DECL || 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 (cfun, DECL_UID (var))) - return false; + return; if (TREE_ADDRESSABLE (var) /* Do not change TREE_ADDRESSABLE if we need to preserve var as @@ -1918,8 +1912,7 @@ maybe_optimize_var (tree var, bitmap addresses_taken, bitmap not_reg_needs) { TREE_ADDRESSABLE (var) = 0; if (is_gimple_reg (var)) - mark_sym_for_renaming (var); - update_vops = true; + bitmap_set_bit (suitable_for_renaming, DECL_UID (var)); if (dump_file) { fprintf (dump_file, "No longer having address taken: "); @@ -1936,8 +1929,7 @@ maybe_optimize_var (tree var, bitmap addresses_taken, bitmap not_reg_needs) && (TREE_CODE (var) != VAR_DECL || !DECL_HARD_REGISTER (var))) { DECL_GIMPLE_REG_P (var) = 1; - mark_sym_for_renaming (var); - update_vops = true; + bitmap_set_bit (suitable_for_renaming, DECL_UID (var)); if (dump_file) { fprintf (dump_file, "Now a gimple register: "); @@ -1945,8 +1937,6 @@ maybe_optimize_var (tree var, bitmap addresses_taken, bitmap not_reg_needs) fprintf (dump_file, "\n"); } } - - return update_vops; } /* Compute TREE_ADDRESSABLE and DECL_GIMPLE_REG_P for local variables. */ @@ -1958,7 +1948,7 @@ execute_update_addresses_taken (void) basic_block bb; bitmap addresses_taken = BITMAP_ALLOC (NULL); bitmap not_reg_needs = BITMAP_ALLOC (NULL); - bool update_vops = false; + bitmap suitable_for_renaming = BITMAP_ALLOC (NULL); tree var; unsigned i; @@ -2057,14 +2047,16 @@ execute_update_addresses_taken (void) unused vars from BLOCK trees, which causes code generation differences for -g vs. -g0. */ for (var = DECL_ARGUMENTS (cfun->decl); var; var = DECL_CHAIN (var)) - update_vops |= maybe_optimize_var (var, addresses_taken, not_reg_needs); + maybe_optimize_var (var, addresses_taken, not_reg_needs, + suitable_for_renaming); FOR_EACH_VEC_ELT (tree, cfun->local_decls, i, var) - update_vops |= maybe_optimize_var (var, addresses_taken, not_reg_needs); + maybe_optimize_var (var, addresses_taken, not_reg_needs, + suitable_for_renaming); /* Operand caches need to be recomputed for operands referencing the updated - variables. */ - if (update_vops) + variables and operands need to be rewritten to expose bare symbols. */ + if (!bitmap_empty_p (suitable_for_renaming)) { FOR_EACH_BB (bb) for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);) @@ -2090,14 +2082,14 @@ execute_update_addresses_taken (void) && (sym = TREE_OPERAND (TREE_OPERAND (lhs, 0), 0)) && DECL_P (sym) && !TREE_ADDRESSABLE (sym) - && symbol_marked_for_renaming (sym)) + && bitmap_bit_p (suitable_for_renaming, DECL_UID (sym))) lhs = sym; else lhs = gimple_assign_lhs (stmt); /* Rewrite the RHS and make sure the resulting assignment is validly typed. */ - maybe_rewrite_mem_ref_base (rhsp); + maybe_rewrite_mem_ref_base (rhsp, suitable_for_renaming); rhs = gimple_assign_rhs1 (stmt); if (gimple_assign_lhs (stmt) != lhs && !useless_type_conversion_p (TREE_TYPE (lhs), @@ -2112,7 +2104,7 @@ execute_update_addresses_taken (void) TREE_ADDRESSABLE just remove the stmt. */ if (DECL_P (lhs) && TREE_CLOBBER_P (rhs) - && symbol_marked_for_renaming (lhs)) + && bitmap_bit_p (suitable_for_renaming, DECL_UID (lhs))) { unlink_stmt_vdef (stmt); gsi_remove (&gsi, true); @@ -2133,7 +2125,7 @@ execute_update_addresses_taken (void) for (i = 0; i < gimple_call_num_args (stmt); ++i) { tree *argp = gimple_call_arg_ptr (stmt, i); - maybe_rewrite_mem_ref_base (argp); + maybe_rewrite_mem_ref_base (argp, suitable_for_renaming); } } @@ -2143,12 +2135,14 @@ execute_update_addresses_taken (void) for (i = 0; i < gimple_asm_noutputs (stmt); ++i) { tree link = gimple_asm_output_op (stmt, i); - maybe_rewrite_mem_ref_base (&TREE_VALUE (link)); + maybe_rewrite_mem_ref_base (&TREE_VALUE (link), + suitable_for_renaming); } for (i = 0; i < gimple_asm_ninputs (stmt); ++i) { tree link = gimple_asm_input_op (stmt, i); - maybe_rewrite_mem_ref_base (&TREE_VALUE (link)); + maybe_rewrite_mem_ref_base (&TREE_VALUE (link), + suitable_for_renaming); } } @@ -2157,9 +2151,10 @@ execute_update_addresses_taken (void) { tree *valuep = gimple_debug_bind_get_value_ptr (stmt); tree decl; - maybe_rewrite_mem_ref_base (valuep); + maybe_rewrite_mem_ref_base (valuep, suitable_for_renaming); decl = non_rewritable_mem_ref_base (*valuep); - if (decl && symbol_marked_for_renaming (decl)) + if (decl + && bitmap_bit_p (suitable_for_renaming, DECL_UID (decl))) gimple_debug_bind_reset_value (stmt); } @@ -2179,6 +2174,7 @@ execute_update_addresses_taken (void) BITMAP_FREE (not_reg_needs); BITMAP_FREE (addresses_taken); + BITMAP_FREE (suitable_for_renaming); timevar_pop (TV_ADDRESS_TAKEN); } |