diff options
author | Richard Guenther <rguenther@suse.de> | 2012-08-02 11:40:20 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-08-02 11:40:20 +0000 |
commit | 322445530d0742db2345197405f83bbf505acf9d (patch) | |
tree | 7d44a4c9f671c4b247e1567327eda00cf283e581 /gcc | |
parent | fcddd80e2efd57253335eb33d4e35fb47a4a0e20 (diff) | |
download | gcc-322445530d0742db2345197405f83bbf505acf9d.zip gcc-322445530d0742db2345197405f83bbf505acf9d.tar.gz gcc-322445530d0742db2345197405f83bbf505acf9d.tar.bz2 |
tree-flow.h (set_default_def): Rename to ...
2012-08-02 Richard Guenther <rguenther@suse.de>
* tree-flow.h (set_default_def): Rename to ...
(set_ssa_default_def): ... this. Take a struct function argument.
(gimple_default_def): Rename to ...
(ssa_default_def): ... this.
(get_or_create_ssa_default_def): New function.
* tree-dfa.c: Likewise.
(dump_variable): Adjust.
* ipa-prop.c (ipa_analyze_params_uses): Adjust, properly check
for used parameters.
* ipa-split.c (consider_split): Adjust, avoid repeated default-def
lookups.
(split_function): Likewise.
* lto-streamer-in.c (input_ssa_names): Adjust.
* omp-low.c (expand_omp_taskreg): Likewise.
* tree-cfg.c (replace_ssa_name): Adjust, no need to push/pop cfun.
* tree-complex.c (init_parameter_lattice_values): Adjust.
(get_component_ssa_name): Likewise.
(update_parameter_components): Likewise.
* tree-inline.c (remap_ssa_name): Likewise.
(setup_one_parameter): Likewise.
(initialize_inlined_parameters): Likewise.
(declare_return_variable): Likewise.
(expand_call_inline): Likewise.
(tree_function_versioning): Likewise.
* tree-into-ssa.c (get_default_def_for): Remove.
(get_reaching_def): Use get_or_create_ssa_default_def instead.
* tree-predcom.c (replace_ref_with): Adjust.
* tree-sra.c (get_repl_default_def_ssa_name): Likewise.
(is_unused_scalar_param): Likewise.
(ptr_parm_has_direct_uses): Likewise.
(sra_ipa_reset_debug_stmts): Likewise.
* tree-ssa-coalesce.c (create_outofssa_var_map): Adjust.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-live.c (verify_live_on_entry): Likewise.
* tree-ssa-math-opts.c (execute_cse_reciprocals): Likewise,
avoid repeated default def lookups.
* tree-ssa-sccvn.c (run_scc_vn): Likewise.
* tree-tailcall.c (arg_needs_copy_p): Adjust.
(tree_optimize_tail_calls_1): Likewise.
From-SVN: r190073
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 42 | ||||
-rw-r--r-- | gcc/ipa-prop.c | 5 | ||||
-rw-r--r-- | gcc/ipa-split.c | 47 | ||||
-rw-r--r-- | gcc/lto-streamer-in.c | 2 | ||||
-rw-r--r-- | gcc/omp-low.c | 4 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 7 | ||||
-rw-r--r-- | gcc/tree-complex.c | 8 | ||||
-rw-r--r-- | gcc/tree-dfa.c | 45 | ||||
-rw-r--r-- | gcc/tree-flow.h | 5 | ||||
-rw-r--r-- | gcc/tree-inline.c | 25 | ||||
-rw-r--r-- | gcc/tree-into-ssa.c | 19 | ||||
-rw-r--r-- | gcc/tree-predcom.c | 10 | ||||
-rw-r--r-- | gcc/tree-sra.c | 19 | ||||
-rw-r--r-- | gcc/tree-ssa-coalesce.c | 2 | ||||
-rw-r--r-- | gcc/tree-ssa-copyrename.c | 6 | ||||
-rw-r--r-- | gcc/tree-ssa-live.c | 2 | ||||
-rw-r--r-- | gcc/tree-ssa-math-opts.c | 9 | ||||
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 8 | ||||
-rw-r--r-- | gcc/tree-tailcall.c | 6 |
19 files changed, 139 insertions, 132 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1f6539e..52f4a8c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,47 @@ 2012-08-02 Richard Guenther <rguenther@suse.de> + * tree-flow.h (set_default_def): Rename to ... + (set_ssa_default_def): ... this. Take a struct function argument. + (gimple_default_def): Rename to ... + (ssa_default_def): ... this. + (get_or_create_ssa_default_def): New function. + * tree-dfa.c: Likewise. + (dump_variable): Adjust. + * ipa-prop.c (ipa_analyze_params_uses): Adjust, properly check + for used parameters. + * ipa-split.c (consider_split): Adjust, avoid repeated default-def + lookups. + (split_function): Likewise. + * lto-streamer-in.c (input_ssa_names): Adjust. + * omp-low.c (expand_omp_taskreg): Likewise. + * tree-cfg.c (replace_ssa_name): Adjust, no need to push/pop cfun. + * tree-complex.c (init_parameter_lattice_values): Adjust. + (get_component_ssa_name): Likewise. + (update_parameter_components): Likewise. + * tree-inline.c (remap_ssa_name): Likewise. + (setup_one_parameter): Likewise. + (initialize_inlined_parameters): Likewise. + (declare_return_variable): Likewise. + (expand_call_inline): Likewise. + (tree_function_versioning): Likewise. + * tree-into-ssa.c (get_default_def_for): Remove. + (get_reaching_def): Use get_or_create_ssa_default_def instead. + * tree-predcom.c (replace_ref_with): Adjust. + * tree-sra.c (get_repl_default_def_ssa_name): Likewise. + (is_unused_scalar_param): Likewise. + (ptr_parm_has_direct_uses): Likewise. + (sra_ipa_reset_debug_stmts): Likewise. + * tree-ssa-coalesce.c (create_outofssa_var_map): Adjust. + * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. + * tree-ssa-live.c (verify_live_on_entry): Likewise. + * tree-ssa-math-opts.c (execute_cse_reciprocals): Likewise, + avoid repeated default def lookups. + * tree-ssa-sccvn.c (run_scc_vn): Likewise. + * tree-tailcall.c (arg_needs_copy_p): Adjust. + (tree_optimize_tail_calls_1): Likewise. + +2012-08-02 Richard Guenther <rguenther@suse.de> + PR tree-optimization/50672 Revert 2012-08-01 Richard Guenther <rguenther@suse.de> diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 0c49fdf..09e96d5 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -1623,10 +1623,13 @@ ipa_analyze_params_uses (struct cgraph_node *node, for (i = 0; i < ipa_get_param_count (info); i++) { tree parm = ipa_get_param (info, i); + tree ddef; /* For SSA regs see if parameter is used. For non-SSA we compute the flag during modification analysis. */ if (is_gimple_reg (parm) - && gimple_default_def (DECL_STRUCT_FUNCTION (node->symbol.decl), parm)) + && (ddef = ssa_default_def (DECL_STRUCT_FUNCTION (node->symbol.decl), + parm)) != NULL_TREE + && !has_zero_uses (ddef)) ipa_set_param_used (info, i, true); } diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index be21436..d6aad89 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -438,14 +438,17 @@ consider_split (struct split_point *current, bitmap non_ssa_vars, return; } } - else if (gimple_default_def (cfun, parm) - && bitmap_bit_p (current->ssa_names_to_pass, - SSA_NAME_VERSION (gimple_default_def - (cfun, parm)))) + else { - if (!VOID_TYPE_P (TREE_TYPE (parm))) - call_overhead += estimate_move_cost (TREE_TYPE (parm)); - num_args++; + tree ddef = ssa_default_def (cfun, parm); + if (ddef + && bitmap_bit_p (current->ssa_names_to_pass, + SSA_NAME_VERSION (ddef))) + { + if (!VOID_TYPE_P (TREE_TYPE (parm))) + call_overhead += estimate_move_cost (TREE_TYPE (parm)); + num_args++; + } } } if (!VOID_TYPE_P (TREE_TYPE (current_function_decl))) @@ -1056,7 +1059,7 @@ split_function (struct split_point *split_point) bool split_part_return_p = false; gimple last_stmt = NULL; unsigned int i; - tree arg; + tree arg, ddef; if (dump_file) { @@ -1074,24 +1077,16 @@ split_function (struct split_point *split_point) parm; parm = DECL_CHAIN (parm), num++) if (args_to_skip && (!is_gimple_reg (parm) - || !gimple_default_def (cfun, parm) + || (ddef = ssa_default_def (cfun, parm)) == NULL_TREE || !bitmap_bit_p (split_point->ssa_names_to_pass, - SSA_NAME_VERSION (gimple_default_def (cfun, - parm))))) + SSA_NAME_VERSION (ddef)))) bitmap_set_bit (args_to_skip, num); else { /* This parm might not have been used up to now, but is going to be used, hence register it. */ if (is_gimple_reg (parm)) - { - arg = gimple_default_def (cfun, parm); - if (!arg) - { - arg = make_ssa_name (parm, gimple_build_nop ()); - set_default_def (parm, arg); - } - } + arg = get_or_create_ssa_default_def (cfun, parm); else arg = parm; @@ -1356,19 +1351,7 @@ split_function (struct split_point *split_point) assigned to RESULT_DECL (that is pointer to return value). Look it up or create new one if it is missing. */ if (DECL_BY_REFERENCE (retval)) - { - tree retval_name; - if ((retval_name = gimple_default_def (cfun, retval)) - != NULL) - retval = retval_name; - else - { - retval_name = make_ssa_name (retval, - gimple_build_nop ()); - set_default_def (retval, retval_name); - retval = retval_name; - } - } + retval = get_or_create_ssa_default_def (cfun, retval); /* Otherwise produce new SSA name for return value. */ else retval = make_ssa_name (retval, call); diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index d497eef..cca216c 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -709,7 +709,7 @@ input_ssa_names (struct lto_input_block *ib, struct data_in *data_in, ssa_name = make_ssa_name_fn (fn, name, gimple_build_nop ()); if (is_default_def) - set_default_def (SSA_NAME_VAR (ssa_name), ssa_name); + set_ssa_default_def (cfun, SSA_NAME_VAR (ssa_name), ssa_name); i = streamer_read_uhwi (ib); } diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 1696fec..ade999b 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -3499,9 +3499,9 @@ expand_omp_taskreg (struct omp_region *region) /* If we are in ssa form, we must load the value from the default definition of the argument. That should not be defined now, since the argument is not used uninitialized. */ - gcc_assert (gimple_default_def (cfun, arg) == NULL); + gcc_assert (ssa_default_def (cfun, arg) == NULL); narg = make_ssa_name (arg, gimple_build_nop ()); - set_default_def (arg, narg); + set_ssa_default_def (cfun, arg, narg); /* ?? Is setting the subcode really necessary ?? */ gimple_omp_set_subcode (parcopy_stmt, TREE_CODE (narg)); gimple_assign_set_rhs1 (parcopy_stmt, narg); diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 981b224..b4b7692 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -5948,11 +5948,10 @@ replace_ssa_name (tree name, struct pointer_map_t *vars_map, { replace_by_duplicate_decl (&decl, vars_map, to_context); - push_cfun (DECL_STRUCT_FUNCTION (to_context)); - new_name = make_ssa_name (decl, SSA_NAME_DEF_STMT (name)); + new_name = make_ssa_name_fn (DECL_STRUCT_FUNCTION (to_context), + decl, SSA_NAME_DEF_STMT (name)); if (SSA_NAME_IS_DEFAULT_DEF (name)) - set_default_def (decl, new_name); - pop_cfun (); + set_ssa_default_def (DECL_STRUCT_FUNCTION (to_context), decl, new_name); loc = pointer_map_insert (vars_map, name); *loc = new_name; diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c index afc9d0a..cd29433 100644 --- a/gcc/tree-complex.c +++ b/gcc/tree-complex.c @@ -176,7 +176,7 @@ init_parameter_lattice_values (void) for (parm = DECL_ARGUMENTS (cfun->decl); parm ; parm = DECL_CHAIN (parm)) if (is_complex_reg (parm) - && (ssa_name = gimple_default_def (cfun, parm)) != NULL_TREE) + && (ssa_name = ssa_default_def (cfun, parm)) != NULL_TREE) VEC_replace (complex_lattice_t, complex_lattice_values, SSA_NAME_VERSION (ssa_name), VARYING); } @@ -496,10 +496,10 @@ get_component_ssa_name (tree ssa_name, bool imag_p) SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ret) = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ssa_name); if (TREE_CODE (SSA_NAME_VAR (ssa_name)) == VAR_DECL - && gimple_nop_p (SSA_NAME_DEF_STMT (ssa_name))) + && SSA_NAME_IS_DEFAULT_DEF (ssa_name)) { SSA_NAME_DEF_STMT (ret) = SSA_NAME_DEF_STMT (ssa_name); - set_default_def (SSA_NAME_VAR (ret), ret); + set_ssa_default_def (cfun, SSA_NAME_VAR (ret), ret); } VEC_replace (tree, complex_ssa_name_components, ssa_name_index, ret); @@ -690,7 +690,7 @@ update_parameter_components (void) continue; type = TREE_TYPE (type); - ssa_name = gimple_default_def (cfun, parm); + ssa_name = ssa_default_def (cfun, parm); if (!ssa_name) continue; diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 39555ce..0db5f19 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -164,10 +164,10 @@ dump_variable (FILE *file, tree var) if (TREE_THIS_VOLATILE (var)) fprintf (file, ", is volatile"); - if (cfun && gimple_default_def (cfun, var)) + if (cfun && ssa_default_def (cfun, var)) { fprintf (file, ", default def: "); - print_generic_expr (file, gimple_default_def (cfun, var), dump_flags); + print_generic_expr (file, ssa_default_def (cfun, var), dump_flags); } if (DECL_INITIAL (var)) @@ -312,49 +312,68 @@ collect_dfa_stats (struct dfa_stats_d *dfa_stats_p ATTRIBUTE_UNUSED) variable. */ tree -gimple_default_def (struct function *fn, tree var) +ssa_default_def (struct function *fn, tree var) { struct tree_decl_minimal ind; struct tree_ssa_name in; - gcc_assert (SSA_VAR_P (var)); + gcc_assert (TREE_CODE (var) == VAR_DECL + || TREE_CODE (var) == PARM_DECL + || TREE_CODE (var) == RESULT_DECL); in.var = (tree)&ind; ind.uid = DECL_UID (var); return (tree) htab_find_with_hash (DEFAULT_DEFS (fn), &in, DECL_UID (var)); } -/* Insert the pair VAR's UID, DEF into the default_defs hashtable. */ +/* Insert the pair VAR's UID, DEF into the default_defs hashtable + of function FN. */ void -set_default_def (tree var, tree def) +set_ssa_default_def (struct function *fn, tree var, tree def) { struct tree_decl_minimal ind; struct tree_ssa_name in; void **loc; - gcc_assert (SSA_VAR_P (var)); + gcc_assert (TREE_CODE (var) == VAR_DECL + || TREE_CODE (var) == PARM_DECL + || TREE_CODE (var) == RESULT_DECL); in.var = (tree)&ind; ind.uid = DECL_UID (var); if (!def) { - loc = htab_find_slot_with_hash (DEFAULT_DEFS (cfun), &in, - DECL_UID (var), INSERT); - gcc_assert (*loc); - htab_remove_elt (DEFAULT_DEFS (cfun), *loc); + loc = htab_find_slot_with_hash (DEFAULT_DEFS (fn), &in, + DECL_UID (var), NO_INSERT); + if (*loc) + htab_clear_slot (DEFAULT_DEFS (fn), loc); return; } gcc_assert (TREE_CODE (def) == SSA_NAME && SSA_NAME_VAR (def) == var); - loc = htab_find_slot_with_hash (DEFAULT_DEFS (cfun), &in, + loc = htab_find_slot_with_hash (DEFAULT_DEFS (fn), &in, DECL_UID (var), INSERT); /* Default definition might be changed by tail call optimization. */ if (*loc) SSA_NAME_IS_DEFAULT_DEF (*(tree *) loc) = false; - *(tree *) loc = def; /* Mark DEF as the default definition for VAR. */ + *(tree *) loc = def; SSA_NAME_IS_DEFAULT_DEF (def) = true; } +/* Retrieve or create a default definition for VAR. */ + +tree +get_or_create_ssa_default_def (struct function *fn, tree var) +{ + tree ddef = ssa_default_def (fn, var); + if (ddef == NULL_TREE) + { + ddef = make_ssa_name (var, gimple_build_nop ()); + set_ssa_default_def (cfun, var, ddef); + } + return ddef; +} + /* If EXP is a handled component reference for a structure, return the base variable. The access range is delimited by bit positions *POFFSET and diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index 888f1f3..ac867d1 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -445,8 +445,9 @@ extern void debug_dfa_stats (void); extern void dump_variable (FILE *, tree); extern void debug_variable (tree); extern tree make_rename_temp (tree, const char *); -extern void set_default_def (tree, tree); -extern tree gimple_default_def (struct function *, tree); +extern void set_ssa_default_def (struct function *, tree, tree); +extern tree ssa_default_def (struct function *, tree); +extern tree get_or_create_ssa_default_def (struct function *, tree); extern bool stmt_references_abnormal_ssa_name (gimple); extern tree get_addr_base_and_unit_offset (tree, HOST_WIDE_INT *); extern void dump_enumerated_decls (FILE *, int); diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 8ca912e..ba716f5 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -247,7 +247,7 @@ remap_ssa_name (tree name, copy_body_data *id) struct ptr_info_def *new_pi = get_ptr_info (new_tree); new_pi->pt = pi->pt; } - if (gimple_nop_p (SSA_NAME_DEF_STMT (name))) + if (SSA_NAME_IS_DEFAULT_DEF (name)) { /* By inlining function having uninitialized variable, we might extend the lifetime (variable might get reused). This cause @@ -259,7 +259,6 @@ remap_ssa_name (tree name, copy_body_data *id) this for all BBs that are not inside strongly connected regions of the CFG, but this is expensive to test. */ if (id->entry_bb - && is_gimple_reg (SSA_NAME_VAR (name)) && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name) && TREE_CODE (SSA_NAME_VAR (name)) != PARM_DECL && (id->entry_bb != EDGE_SUCC (ENTRY_BLOCK_PTR, 0)->dest @@ -276,9 +275,7 @@ remap_ssa_name (tree name, copy_body_data *id) else { SSA_NAME_DEF_STMT (new_tree) = gimple_build_nop (); - if (gimple_default_def (id->src_cfun, SSA_NAME_VAR (name)) - == name) - set_default_def (SSA_NAME_VAR (new_tree), new_tree); + set_ssa_default_def (cfun, SSA_NAME_VAR (new_tree), new_tree); } } } @@ -2502,7 +2499,7 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn, tree var; tree rhs = value; tree def = (gimple_in_ssa_p (cfun) - ? gimple_default_def (id->src_cfun, p) : NULL); + ? ssa_default_def (id->src_cfun, p) : NULL); if (value && value != error_mark_node @@ -2635,7 +2632,7 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn, def = remap_ssa_name (def, id); init_stmt = gimple_build_assign (def, rhs); SSA_NAME_IS_DEFAULT_DEF (def) = 0; - set_default_def (var, NULL); + set_ssa_default_def (cfun, var, NULL); } else if (!optimize) { @@ -2687,7 +2684,7 @@ initialize_inlined_parameters (copy_body_data *id, gimple stmt, && TREE_CODE (*varp) == VAR_DECL) { tree def = (gimple_in_ssa_p (cfun) && is_gimple_reg (p) - ? gimple_default_def (id->src_cfun, p) : NULL); + ? ssa_default_def (id->src_cfun, p) : NULL); tree var = *varp; TREE_TYPE (var) = remap_type (TREE_TYPE (var), id); /* Also remap the default definition if it was remapped @@ -2902,8 +2899,7 @@ declare_return_variable (copy_body_data *id, tree return_slot, tree modify_dest, && is_gimple_reg (result)) { temp = make_ssa_name (temp, NULL); - insert_decl_map (id, gimple_default_def (id->src_cfun, result), - temp); + insert_decl_map (id, ssa_default_def (id->src_cfun, result), temp); } insert_init_stmt (id, entry_bb, gimple_build_assign (temp, var)); } @@ -3983,7 +3979,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id) { tree name = gimple_call_lhs (stmt); tree var = SSA_NAME_VAR (name); - tree def = gimple_default_def (cfun, var); + tree def = ssa_default_def (cfun, var); if (def) { @@ -3996,7 +3992,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id) { /* Otherwise make this variable undefined. */ gsi_remove (&stmt_gsi, true); - set_default_def (var, name); + set_ssa_default_def (cfun, var, name); SSA_NAME_DEF_STMT (name) = gimple_build_nop (); } } @@ -5160,13 +5156,12 @@ tree_function_versioning (tree old_decl, tree new_decl, lang_hooks.dup_lang_specific_decl (DECL_RESULT (new_decl)); if (gimple_in_ssa_p (id.src_cfun) && DECL_BY_REFERENCE (DECL_RESULT (old_decl)) - && (old_name - = gimple_default_def (id.src_cfun, DECL_RESULT (old_decl)))) + && (old_name = ssa_default_def (id.src_cfun, DECL_RESULT (old_decl)))) { tree new_name = make_ssa_name (DECL_RESULT (new_decl), NULL); insert_decl_map (&id, old_name, new_name); SSA_NAME_DEF_STMT (new_name) = gimple_build_nop (); - set_default_def (DECL_RESULT (new_decl), new_name); + set_ssa_default_def (cfun, DECL_RESULT (new_decl), new_name); } } diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index c18f080..da57cfd 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -987,23 +987,6 @@ find_def_blocks_for (tree var) } -/* Retrieve or create a default definition for symbol SYM. */ - -static inline tree -get_default_def_for (tree sym) -{ - tree ddef = gimple_default_def (cfun, sym); - - if (ddef == NULL_TREE) - { - ddef = make_ssa_name (sym, gimple_build_nop ()); - set_default_def (sym, ddef); - } - - return ddef; -} - - /* Marks phi node PHI in basic block BB for rewrite. */ static void @@ -1253,7 +1236,7 @@ get_reaching_def (tree var) if (currdef == NULL_TREE) { tree sym = DECL_P (var) ? var : SSA_NAME_VAR (var); - currdef = get_default_def_for (sym); + currdef = get_or_create_ssa_default_def (cfun, sym); set_current_def (var, currdef); } diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index eb1538e..1d7c2a5 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -1308,15 +1308,7 @@ replace_ref_with (gimple stmt, tree new_tree, bool set, bool in_lhs) val = gimple_assign_rhs1 (stmt); gcc_assert (gimple_assign_single_p (stmt)); if (TREE_CLOBBER_P (val)) - { - val = gimple_default_def (cfun, SSA_NAME_VAR (new_tree)); - if (val == NULL_TREE) - { - val = make_ssa_name (SSA_NAME_VAR (new_tree), - gimple_build_nop ()); - set_default_def (SSA_NAME_VAR (new_tree), val); - } - } + val = get_or_create_ssa_default_def (cfun, SSA_NAME_VAR (new_tree)); else gcc_assert (gimple_assign_copy_p (stmt)); } diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 4294173..820acd0 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -2842,18 +2842,7 @@ sra_modify_constructor_assign (gimple *stmt, gimple_stmt_iterator *gsi) static tree get_repl_default_def_ssa_name (struct access *racc) { - tree repl, decl; - - decl = get_access_replacement (racc); - - repl = gimple_default_def (cfun, decl); - if (!repl) - { - repl = make_ssa_name (decl, gimple_build_nop ()); - set_default_def (decl, repl); - } - - return repl; + return get_or_create_ssa_default_def (cfun, get_access_replacement (racc)); } /* Return true if REF has a COMPONENT_REF with a bit-field field declaration @@ -3351,7 +3340,7 @@ is_unused_scalar_param (tree parm) { tree name; return (is_gimple_reg (parm) - && (!(name = gimple_default_def (cfun, parm)) + && (!(name = ssa_default_def (cfun, parm)) || has_zero_uses (name))); } @@ -3365,7 +3354,7 @@ ptr_parm_has_direct_uses (tree parm) { imm_use_iterator ui; gimple stmt; - tree name = gimple_default_def (cfun, parm); + tree name = ssa_default_def (cfun, parm); bool ret = false; FOR_EACH_IMM_USE_STMT (stmt, ui, name) @@ -4531,7 +4520,7 @@ sra_ipa_reset_debug_stmts (ipa_parm_adjustment_vec adjustments) adj = VEC_index (ipa_parm_adjustment_t, adjustments, i); if (adj->copy_param || !is_gimple_reg (adj->base)) continue; - name = gimple_default_def (cfun, adj->base); + name = ssa_default_def (cfun, adj->base); vexpr = NULL; if (name) FOR_EACH_IMM_USE_STMT (stmt, ui, name) diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c index aedaa96..5001ced 100644 --- a/gcc/tree-ssa-coalesce.c +++ b/gcc/tree-ssa-coalesce.c @@ -1148,7 +1148,7 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy) /* Mark any default_def variables as being in the coalesce list since they will have to be coalesced with the base variable. If not marked as present, they won't be in the coalesce view. */ - if (gimple_default_def (cfun, SSA_NAME_VAR (var)) == var + if (SSA_NAME_IS_DEFAULT_DEF (var) && !has_zero_uses (var)) bitmap_set_bit (used_in_copy, SSA_NAME_VERSION (var)); } diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c index 84d195b..0d676cc 100644 --- a/gcc/tree-ssa-copyrename.c +++ b/gcc/tree-ssa-copyrename.c @@ -211,9 +211,9 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) /* If both values have default defs, we can't coalesce. If only one has a tag, make sure that variable is the new root partition. */ - if (gimple_default_def (cfun, root1)) + if (ssa_default_def (cfun, root1)) { - if (gimple_default_def (cfun, root2)) + if (ssa_default_def (cfun, root2)) { if (debug) fprintf (debug, " : 2 default defs. No coalesce.\n"); @@ -225,7 +225,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) ign1 = false; } } - else if (gimple_default_def (cfun, root2)) + else if (ssa_default_def (cfun, root2)) { ign1 = true; ign2 = false; diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index 5128ed9..2feef96 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -1269,7 +1269,7 @@ verify_live_on_entry (tree_live_info_p live) var = partition_to_var (map, i); stmt = SSA_NAME_DEF_STMT (var); tmp = gimple_bb (stmt); - d = gimple_default_def (cfun, SSA_NAME_VAR (var)); + d = ssa_default_def (cfun, SSA_NAME_VAR (var)); loe = live_on_entry (live, e->dest); if (loe && bitmap_bit_p (loe, i)) diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 13e74bf..c9bc047 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -513,10 +513,13 @@ execute_cse_reciprocals (void) #endif for (arg = DECL_ARGUMENTS (cfun->decl); arg; arg = DECL_CHAIN (arg)) - if (gimple_default_def (cfun, arg) - && FLOAT_TYPE_P (TREE_TYPE (arg)) + if (FLOAT_TYPE_P (TREE_TYPE (arg)) && is_gimple_reg (arg)) - execute_cse_reciprocals_1 (NULL, gimple_default_def (cfun, arg)); + { + tree name = ssa_default_def (cfun, arg); + if (name) + execute_cse_reciprocals_1 (NULL, name); + } FOR_EACH_BB (bb) { diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index d2661b3..bae3cc1 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -3963,11 +3963,9 @@ run_scc_vn (vn_lookup_kind default_vn_walk_kind_) param; param = DECL_CHAIN (param)) { - if (gimple_default_def (cfun, param) != NULL) - { - tree def = gimple_default_def (cfun, param); - VN_INFO (def)->valnum = def; - } + tree def = ssa_default_def (cfun, param); + if (def) + VN_INFO (def)->valnum = def; } for (i = 1; i < num_ssa_names; ++i) diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index 078ec67..548d1b6 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -767,7 +767,7 @@ arg_needs_copy_p (tree param) return false; /* Parameters that are only defined but never used need not be copied. */ - def = gimple_default_def (cfun, param); + def = ssa_default_def (cfun, param); if (!def) return false; @@ -969,11 +969,11 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls) param = DECL_CHAIN (param)) if (arg_needs_copy_p (param)) { - tree name = gimple_default_def (cfun, param); + tree name = ssa_default_def (cfun, param); tree new_name = make_ssa_name (param, SSA_NAME_DEF_STMT (name)); gimple phi; - set_default_def (param, new_name); + set_ssa_default_def (cfun, param, new_name); phi = create_phi_node (name, first); SSA_NAME_DEF_STMT (name) = phi; add_phi_arg (phi, new_name, single_pred_edge (first), |