diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4e2e9072fd9d3a8a691bc85039752ac04e82ce85..b21d8c56509e916f0c786ad62cb8f56450d62b38 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2010-04-19 Martin Jambor <mjambor@suse.cz> + + * gimple.h (create_tmp_reg): Declare. + * gimplify.c (create_tmp_reg): New function. + (gimplify_return_expr): Use create_tmp_reg. + (gimplify_omp_atomic): Likewise. + (gimple_regimplify_operands): Likewise. + * tree-dfa.c (make_rename_temp): Likewise. + * tree-predcom.c (predcom_tmp_var): Likewise. + (reassociate_to_the_same_stmt): Likewise. + * tree-sra.c (replace_uses_with_default_def_ssa_name): Likewise. + (get_replaced_param_substitute): Likewise. + * tree-ssa-phiprop.c (phiprop_insert_phi): Likewise. + * tree-ssa-phiopt.c (cond_store_replacement): Likewise. + * tree-ssa-pre.c (get_representative_for): Likewise. + (create_expression_by_pieces): Likewise. + * tree-tailcall.c (adjust_return_value_with_ops): Likewise. + (create_tailcall_accumulator): Likewise. + 2010-04-19 Martin Jambor <mjambor@suse.cz> * cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Update diff --git a/gcc/gimple.h b/gcc/gimple.h index 18ebbb1e5605badd24e27ab99b5d97e991e48567..3daaa9e3c401871efcb236db11ccfe80bd9355d9 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -964,6 +964,7 @@ extern bool gimple_ior_addresses_taken (bitmap, gimple); extern tree create_tmp_var_raw (tree, const char *); extern tree create_tmp_var_name (const char *); extern tree create_tmp_var (tree, const char *); +extern tree create_tmp_reg (tree, const char *); extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *); extern tree get_formal_tmp_var (tree, gimple_seq *); extern void declare_vars (tree, gimple, bool); diff --git a/gcc/gimplify.c b/gcc/gimplify.c index a9eed84669fb1674fff162992ec3f75af13b5606..287d62168f00b42d9dc7e963c1bca5ebb56adcec 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -508,6 +508,23 @@ create_tmp_var (tree type, const char *prefix) return tmp_var; } +/* Create a new temporary variable declaration of type TYPE by calling + create_tmp_var and if TYPE is a vector or a complex number, mark the new + temporary as gimple register. */ + +tree +create_tmp_reg (tree type, const char *prefix) +{ + tree tmp; + + tmp = create_tmp_var (type, prefix); + if (TREE_CODE (type) == COMPLEX_TYPE + || TREE_CODE (type) == VECTOR_TYPE) + DECL_GIMPLE_REG_P (tmp) = 1; + + return tmp; +} + /* Create a temporary with a name derived from VAL. Subroutine of lookup_tmp_var; nobody else should call this function. */ @@ -1219,10 +1236,7 @@ gimplify_return_expr (tree stmt, gimple_seq *pre_p) result = gimplify_ctxp->return_temp; else { - result = create_tmp_var (TREE_TYPE (result_decl), NULL); - if (TREE_CODE (TREE_TYPE (result)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (result)) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (result) = 1; + result = create_tmp_reg (TREE_TYPE (result_decl), NULL); /* ??? With complex control flow (usually involving abnormal edges), we can wind up warning about an uninitialized value for this. Due @@ -6351,9 +6365,7 @@ gimplify_omp_atomic (tree *expr_p, gimple_seq *pre_p) tree type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr))); tree tmp_load; - tmp_load = create_tmp_var (type, NULL); - if (TREE_CODE (type) == COMPLEX_TYPE || TREE_CODE (type) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (tmp_load) = 1; + tmp_load = create_tmp_reg (type, NULL); if (goa_stabilize_expr (&rhs, pre_p, addr, tmp_load) < 0) return GS_ERROR; @@ -7828,11 +7840,8 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p) } if (need_temp) { - tree temp = create_tmp_var (TREE_TYPE (lhs), NULL); + tree temp = create_tmp_reg (TREE_TYPE (lhs), NULL); - if (TREE_CODE (TREE_TYPE (lhs)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (lhs)) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (temp) = 1; if (TREE_CODE (orig_lhs) == SSA_NAME) orig_lhs = SSA_NAME_VAR (orig_lhs); diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 5475d79254b8aaa4037b6f707aaf4a78f658dddb..d5a56e5e29918ce84c3b9139042360fc4cf5ece6 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -193,11 +193,7 @@ renumber_gimple_stmt_uids_in_blocks (basic_block *blocks, int n_blocks) tree make_rename_temp (tree type, const char *prefix) { - tree t = create_tmp_var (type, prefix); - - if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (t) = 1; + tree t = create_tmp_reg (type, prefix); if (gimple_referenced_vars (cfun)) { diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index 62708cd85230678210f36854e485c8a03a9eb2aa..41873cefb8c0d425a3fa83253f8c1b36dd9910a1 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -1460,13 +1460,9 @@ static tree predcom_tmp_var (tree ref, unsigned i, bitmap tmp_vars) { tree type = TREE_TYPE (ref); - tree var = create_tmp_var (type, get_lsm_tmp_name (ref, i)); - /* We never access the components of the temporary variable in predictive commoning. */ - if (TREE_CODE (type) == COMPLEX_TYPE - || TREE_CODE (type) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (var) = 1; + tree var = create_tmp_reg (type, get_lsm_tmp_name (ref, i)); add_referenced_var (var); bitmap_set_bit (tmp_vars, DECL_UID (var)); @@ -2209,18 +2205,12 @@ reassociate_to_the_same_stmt (tree name1, tree name2) /* Insert the new statement combining NAME1 and NAME2 before S1, and combine it with the rhs of S1. */ - var = create_tmp_var (type, "predreastmp"); - if (TREE_CODE (type) == COMPLEX_TYPE - || TREE_CODE (type) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (var) = 1; + var = create_tmp_reg (type, "predreastmp"); add_referenced_var (var); new_name = make_ssa_name (var, NULL); new_stmt = gimple_build_assign_with_ops (code, new_name, name1, name2); - var = create_tmp_var (type, "predreastmp"); - if (TREE_CODE (type) == COMPLEX_TYPE - || TREE_CODE (type) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (var) = 1; + var = create_tmp_reg (type, "predreastmp"); add_referenced_var (var); tmp_name = make_ssa_name (var, NULL); diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 0a9b3df3b15a7400791de62fc98472811e168a7a..0635aa7f4a813c7a288042a329479b0a274673ab 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -2537,10 +2537,7 @@ replace_uses_with_default_def_ssa_name (tree ssa) tree repl, decl = SSA_NAME_VAR (ssa); if (TREE_CODE (decl) == PARM_DECL) { - tree tmp = create_tmp_var (TREE_TYPE (decl), "SR"); - if (TREE_CODE (TREE_TYPE (tmp)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (tmp)) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (tmp) = 1; + tree tmp = create_tmp_reg (TREE_TYPE (decl), "SR"); get_var_ann (tmp); add_referenced_var (tmp); @@ -3733,10 +3730,7 @@ get_replaced_param_substitute (struct ipa_parm_adjustment *adj) { char *pretty_name = make_fancy_name (adj->base); - repl = create_tmp_var (TREE_TYPE (adj->base), "ISR"); - if (TREE_CODE (TREE_TYPE (repl)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (repl)) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (repl) = 1; + repl = create_tmp_reg (TREE_TYPE (adj->base), "ISR"); DECL_NAME (repl) = get_identifier (pretty_name); obstack_free (&name_obstack, pretty_name); diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index b4a0aea97182a8609ec0df603a72cbce7cfa17a4..33e058c22753bac88fd852d9c44de49dbb9e5c52 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1226,11 +1226,8 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb, of the memory touched by the store, if we need to. */ if (!condstoretemp || TREE_TYPE (lhs) != TREE_TYPE (condstoretemp)) { - condstoretemp = create_tmp_var (TREE_TYPE (lhs), "cstore"); + condstoretemp = create_tmp_reg (TREE_TYPE (lhs), "cstore"); get_var_ann (condstoretemp); - if (TREE_CODE (TREE_TYPE (lhs)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (lhs)) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (condstoretemp) = 1; } add_referenced_var (condstoretemp); diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c index fcd1d23bac8f08e5436c25a72b19047be21edd4b..799bb5a1e0bcf01867bf3e504fc97bbecd344076 100644 --- a/gcc/tree-ssa-phiprop.c +++ b/gcc/tree-ssa-phiprop.c @@ -190,11 +190,8 @@ phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt, { gcc_assert (TREE_CODE (old_arg) == ADDR_EXPR); old_arg = TREE_OPERAND (old_arg, 0); - new_var = create_tmp_var (TREE_TYPE (old_arg), NULL); + new_var = create_tmp_reg (TREE_TYPE (old_arg), NULL); tmp = gimple_build_assign (new_var, unshare_expr (old_arg)); - if (TREE_CODE (TREE_TYPE (old_arg)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (old_arg)) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (new_var) = 1; gcc_assert (is_gimple_reg (new_var)); add_referenced_var (new_var); new_var = make_ssa_name (new_var, tmp); diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index dd9fb96dd5c870e6ba10786077875dc94048898f..584f6061531281b99c4f391419c06bb1b7fcd7a8 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -1407,7 +1407,7 @@ get_representative_for (const pre_expr e) that we will return. */ if (!pretemp || exprtype != TREE_TYPE (pretemp)) { - pretemp = create_tmp_var (exprtype, "pretmp"); + pretemp = create_tmp_reg (exprtype, "pretmp"); get_var_ann (pretemp); } @@ -3088,17 +3088,13 @@ create_expression_by_pieces (basic_block block, pre_expr expr, that we will return. */ if (!pretemp || exprtype != TREE_TYPE (pretemp)) { - pretemp = create_tmp_var (exprtype, "pretmp"); + pretemp = create_tmp_reg (exprtype, "pretmp"); get_var_ann (pretemp); } temp = pretemp; add_referenced_var (temp); - if (TREE_CODE (exprtype) == COMPLEX_TYPE - || TREE_CODE (exprtype) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (temp) = 1; - newstmt = gimple_build_assign (temp, folded); name = make_ssa_name (temp, newstmt); gimple_assign_set_lhs (newstmt, name); diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index ca3dffadc75981a18d707fb36db3c4116facacfd..4d2422aa623777b05d2bb12a954a4e2503d644d4 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -575,13 +575,10 @@ adjust_return_value_with_ops (enum tree_code code, const char *label, { tree ret_type = TREE_TYPE (DECL_RESULT (current_function_decl)); - tree tmp = create_tmp_var (ret_type, label); + tree tmp = create_tmp_reg (ret_type, label); gimple stmt; tree result; - if (TREE_CODE (ret_type) == COMPLEX_TYPE - || TREE_CODE (ret_type) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (tmp) = 1; add_referenced_var (tmp); if (types_compatible_p (TREE_TYPE (acc), TREE_TYPE (op1))) @@ -908,12 +905,9 @@ static tree create_tailcall_accumulator (const char *label, basic_block bb, tree init) { tree ret_type = TREE_TYPE (DECL_RESULT (current_function_decl)); - tree tmp = create_tmp_var (ret_type, label); + tree tmp = create_tmp_reg (ret_type, label); gimple phi; - if (TREE_CODE (ret_type) == COMPLEX_TYPE - || TREE_CODE (ret_type) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (tmp) = 1; add_referenced_var (tmp); phi = create_phi_node (tmp, bb); /* RET_TYPE can be a float when -ffast-maths is enabled. */