diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-22 20:08:44 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-22 20:08:44 +0000 |
commit | 6bcfabf2bbc89d294eead019b61cb2844010284a (patch) | |
tree | 1615fa41425f7784a56379fbbf9492b6ad8fd64b /gcc/tree-sra.c | |
parent | 020bc656ab7a62b27ac7216a559a2e41e645e833 (diff) | |
download | gcc-6bcfabf2bbc89d294eead019b61cb2844010284a.tar.gz |
* ipa.c (symtab_remove_unreachable_nodes): Fix up comment typos.
* ipa-prop.c (get_vector_of_formal_parm_types): Renamed to ...
(ipa_get_vector_of_formal_parm_types): ... this. No longer static.
(ipa_modify_formal_parameters): Adjust caller. Remove
synth_parm_prefix argument. Use operator enum instead of bit fields.
Add assert for properly handling vector of references. Handle
creating brand new parameters.
(ipa_modify_call_arguments): Use operator enum instead of bit
fields.
(ipa_combine_adjustments): Same. Assert that IPA_PARM_OP_NEW is not
used.
(ipa_modify_expr, get_ssa_base_param, ipa_get_adjustment_candidate):
New functions.
(ipa_dump_param_adjustments): Rename reduction to new_decl.
Use operator enum instead of bit fields.
* ipa-prop.h (enum ipa_parm_op): New.
(struct ipa_parm_adjustment): New field op. Rename reduction
to new_decl, new_arg_prefix to arg_prefix and remove remove_param
and copy_param.
(ipa_modify_formal_parameters): Remove last argument.
(ipa_get_vector_of_formal_parm_types, ipa_modify_expr,
ipa_get_adjustment_candidate): New prototypes.
* tree-sra.c (turn_representatives_into_adjustments): Use operator
enum. Set arg_prefix.
(get_adjustment_for_base): Use operator enum.
(sra_ipa_modify_expr): Rename to ipa_modify_expr and move to
ipa-prop.c.
(sra_ipa_modify_assign): Rename sra_ipa_modify_expr to
ipa_modify_expr.
(ipa_sra_modify_function_body): Same. No longer static.
(sra_ipa_reset_debug_stmts): Use operator enum.
(modify_function): Do not pass prefix argument.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205284 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r-- | gcc/tree-sra.c | 106 |
1 files changed, 15 insertions, 91 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 99856f93679..0890613852b 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -4281,9 +4281,10 @@ turn_representatives_into_adjustments (vec<access_p> representatives, adj.base_index = get_param_index (parm, parms); adj.base = parm; if (!repr) - adj.copy_param = 1; + adj.op = IPA_PARM_OP_COPY; else - adj.remove_param = 1; + adj.op = IPA_PARM_OP_REMOVE; + adj.arg_prefix = "ISRA"; adjustments.quick_push (adj); } else @@ -4303,6 +4304,7 @@ turn_representatives_into_adjustments (vec<access_p> representatives, adj.by_ref = (POINTER_TYPE_P (TREE_TYPE (repr->base)) && (repr->grp_maybe_modified || repr->grp_not_necessarilly_dereferenced)); + adj.arg_prefix = "ISRA"; adjustments.quick_push (adj); } } @@ -4433,7 +4435,7 @@ get_adjustment_for_base (ipa_parm_adjustment_vec adjustments, tree base) struct ipa_parm_adjustment *adj; adj = &adjustments[i]; - if (!adj->copy_param && adj->base == base) + if (adj->op != IPA_PARM_OP_COPY && adj->base == base) return adj; } @@ -4497,84 +4499,6 @@ replace_removed_params_ssa_names (gimple stmt, return true; } -/* If the expression *EXPR should be replaced by a reduction of a parameter, do - so. ADJUSTMENTS is a pointer to a vector of adjustments. CONVERT - specifies whether the function should care about type incompatibility the - current and new expressions. If it is false, the function will leave - incompatibility issues to the caller. Return true iff the expression - was modified. */ - -static bool -sra_ipa_modify_expr (tree *expr, bool convert, - ipa_parm_adjustment_vec adjustments) -{ - int i, len; - struct ipa_parm_adjustment *adj, *cand = NULL; - HOST_WIDE_INT offset, size, max_size; - tree base, src; - - len = adjustments.length (); - - if (TREE_CODE (*expr) == BIT_FIELD_REF - || TREE_CODE (*expr) == IMAGPART_EXPR - || TREE_CODE (*expr) == REALPART_EXPR) - { - expr = &TREE_OPERAND (*expr, 0); - convert = true; - } - - base = get_ref_base_and_extent (*expr, &offset, &size, &max_size); - if (!base || size == -1 || max_size == -1) - return false; - - if (TREE_CODE (base) == MEM_REF) - { - offset += mem_ref_offset (base).low * BITS_PER_UNIT; - base = TREE_OPERAND (base, 0); - } - - base = get_ssa_base_param (base); - if (!base || TREE_CODE (base) != PARM_DECL) - return false; - - for (i = 0; i < len; i++) - { - adj = &adjustments[i]; - - if (adj->base == base - && (adj->offset == offset || adj->remove_param)) - { - cand = adj; - break; - } - } - if (!cand || cand->copy_param || cand->remove_param) - return false; - - if (cand->by_ref) - src = build_simple_mem_ref (cand->reduction); - else - src = cand->reduction; - - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, "About to replace expr "); - print_generic_expr (dump_file, *expr, 0); - fprintf (dump_file, " with "); - print_generic_expr (dump_file, src, 0); - fprintf (dump_file, "\n"); - } - - if (convert && !useless_type_conversion_p (TREE_TYPE (*expr), cand->type)) - { - tree vce = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (*expr), src); - *expr = vce; - } - else - *expr = src; - return true; -} - /* If the statement pointed to by STMT_PTR contains any expressions that need to replaced with a different one as noted by ADJUSTMENTS, do so. Handle any potential type incompatibilities (GSI is used to accommodate conversion @@ -4595,8 +4519,8 @@ sra_ipa_modify_assign (gimple *stmt_ptr, gimple_stmt_iterator *gsi, rhs_p = gimple_assign_rhs1_ptr (stmt); lhs_p = gimple_assign_lhs_ptr (stmt); - any = sra_ipa_modify_expr (rhs_p, false, adjustments); - any |= sra_ipa_modify_expr (lhs_p, false, adjustments); + any = ipa_modify_expr (rhs_p, false, adjustments); + any |= ipa_modify_expr (lhs_p, false, adjustments); if (any) { tree new_rhs = NULL_TREE; @@ -4642,7 +4566,7 @@ sra_ipa_modify_assign (gimple *stmt_ptr, gimple_stmt_iterator *gsi, /* Traverse the function body and all modifications as described in ADJUSTMENTS. Return true iff the CFG has been changed. */ -static bool +bool ipa_sra_modify_function_body (ipa_parm_adjustment_vec adjustments) { bool cfg_changed = false; @@ -4668,7 +4592,7 @@ ipa_sra_modify_function_body (ipa_parm_adjustment_vec adjustments) case GIMPLE_RETURN: t = gimple_return_retval_ptr (stmt); if (*t != NULL_TREE) - modified |= sra_ipa_modify_expr (t, true, adjustments); + modified |= ipa_modify_expr (t, true, adjustments); break; case GIMPLE_ASSIGN: @@ -4681,13 +4605,13 @@ ipa_sra_modify_function_body (ipa_parm_adjustment_vec adjustments) for (i = 0; i < gimple_call_num_args (stmt); i++) { t = gimple_call_arg_ptr (stmt, i); - modified |= sra_ipa_modify_expr (t, true, adjustments); + modified |= ipa_modify_expr (t, true, adjustments); } if (gimple_call_lhs (stmt)) { t = gimple_call_lhs_ptr (stmt); - modified |= sra_ipa_modify_expr (t, false, adjustments); + modified |= ipa_modify_expr (t, false, adjustments); modified |= replace_removed_params_ssa_names (stmt, adjustments); } @@ -4697,12 +4621,12 @@ ipa_sra_modify_function_body (ipa_parm_adjustment_vec adjustments) for (i = 0; i < gimple_asm_ninputs (stmt); i++) { t = &TREE_VALUE (gimple_asm_input_op (stmt, i)); - modified |= sra_ipa_modify_expr (t, true, adjustments); + modified |= ipa_modify_expr (t, true, adjustments); } for (i = 0; i < gimple_asm_noutputs (stmt); i++) { t = &TREE_VALUE (gimple_asm_output_op (stmt, i)); - modified |= sra_ipa_modify_expr (t, false, adjustments); + modified |= ipa_modify_expr (t, false, adjustments); } break; @@ -4748,7 +4672,7 @@ sra_ipa_reset_debug_stmts (ipa_parm_adjustment_vec adjustments) use_operand_p use_p; adj = &adjustments[i]; - if (adj->copy_param || !is_gimple_reg (adj->base)) + if (adj->op == IPA_PARM_OP_COPY || !is_gimple_reg (adj->base)) continue; name = ssa_default_def (cfun, adj->base); vexpr = NULL; @@ -4931,7 +4855,7 @@ modify_function (struct cgraph_node *node, ipa_parm_adjustment_vec adjustments) redirect_callers.release (); push_cfun (DECL_STRUCT_FUNCTION (new_node->decl)); - ipa_modify_formal_parameters (current_function_decl, adjustments, "ISRA"); + ipa_modify_formal_parameters (current_function_decl, adjustments); cfg_changed = ipa_sra_modify_function_body (adjustments); sra_ipa_reset_debug_stmts (adjustments); convert_callers (new_node, node->decl, adjustments); |