diff options
Diffstat (limited to 'gcc/ipa-fnsummary.c')
-rw-r--r-- | gcc/ipa-fnsummary.c | 112 |
1 files changed, 59 insertions, 53 deletions
diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c index bdf9ba1..8a6c5d0 100644 --- a/gcc/ipa-fnsummary.c +++ b/gcc/ipa-fnsummary.c @@ -241,7 +241,7 @@ redirect_to_unreachable (struct cgraph_edge *e) e->make_direct (target); else e->redirect_callee (target); - struct ipa_call_summary *es = ipa_call_summaries->get (e); + struct ipa_call_summary *es = ipa_call_summaries->get_create (e); e->inline_failed = CIF_UNREACHABLE; e->count = profile_count::zero (); es->call_stmt_size = 0; @@ -266,7 +266,7 @@ edge_set_predicate (struct cgraph_edge *e, predicate *predicate) && (!e->speculative || e->callee)) e = redirect_to_unreachable (e); - struct ipa_call_summary *es = ipa_call_summaries->get (e); + struct ipa_call_summary *es = ipa_call_summaries->get_create (e); if (predicate && *predicate != true) { if (!es->predicate) @@ -328,7 +328,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, { clause_t clause = inline_p ? 0 : 1 << predicate::not_inlined_condition; clause_t nonspec_clause = 1 << predicate::not_inlined_condition; - struct ipa_fn_summary *info = ipa_fn_summaries->get (node); + struct ipa_fn_summary *info = ipa_fn_summaries->get_create (node); int i; struct condition *c; @@ -428,7 +428,7 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p, vec<ipa_agg_jump_function_p> *known_aggs_ptr) { struct cgraph_node *callee = e->callee->ultimate_alias_target (); - struct ipa_fn_summary *info = ipa_fn_summaries->get (callee); + struct ipa_fn_summary *info = ipa_fn_summaries->get_create (callee); vec<tree> known_vals = vNULL; vec<ipa_agg_jump_function_p> known_aggs = vNULL; @@ -445,7 +445,7 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p, { struct ipa_node_params *caller_parms_info, *callee_pi; struct ipa_edge_args *args = IPA_EDGE_REF (e); - struct ipa_call_summary *es = ipa_call_summaries->get (e); + struct ipa_call_summary *es = ipa_call_summaries->get_create (e); int i, count = ipa_get_cs_argument_count (args); if (e->caller->global.inlined_to) @@ -583,9 +583,9 @@ ipa_fn_summary::reset (struct cgraph_node *node) vec_free (conds); vec_free (size_time_table); for (e = node->callees; e; e = e->next_callee) - ipa_call_summaries->get (e)->reset (); + ipa_call_summaries->get_create (e)->reset (); for (e = node->indirect_calls; e; e = e->next_callee) - ipa_call_summaries->get (e)->reset (); + ipa_call_summaries->get_create (e)->reset (); fp_expressions = false; } @@ -625,7 +625,7 @@ ipa_fn_summary_t::duplicate (cgraph_node *src, ipa_fn_summary *, ipa_fn_summary *info) { - memcpy (info, ipa_fn_summaries->get (src), sizeof (ipa_fn_summary)); + memcpy (info, ipa_fn_summaries->get_create (src), sizeof (ipa_fn_summary)); /* TODO: as an optimization, we may avoid copying conditions that are known to be false or true. */ info->conds = vec_safe_copy (info->conds); @@ -700,7 +700,7 @@ ipa_fn_summary_t::duplicate (cgraph_node *src, for (edge = dst->callees; edge; edge = next) { predicate new_predicate; - struct ipa_call_summary *es = ipa_call_summaries->get (edge); + struct ipa_call_summary *es = ipa_call_summaries->get_create (edge); next = edge->next_callee; if (!edge->inline_failed) @@ -719,7 +719,7 @@ ipa_fn_summary_t::duplicate (cgraph_node *src, for (edge = dst->indirect_calls; edge; edge = next) { predicate new_predicate; - struct ipa_call_summary *es = ipa_call_summaries->get (edge); + struct ipa_call_summary *es = ipa_call_summaries->get_create (edge); next = edge->next_callee; gcc_checking_assert (edge->inline_failed); @@ -813,7 +813,7 @@ dump_ipa_call_summary (FILE *f, int indent, struct cgraph_node *node, struct cgraph_edge *edge; for (edge = node->callees; edge; edge = edge->next_callee) { - struct ipa_call_summary *es = ipa_call_summaries->get (edge); + struct ipa_call_summary *es = ipa_call_summaries->get_create (edge); struct cgraph_node *callee = edge->callee->ultimate_alias_target (); int i; @@ -825,8 +825,9 @@ dump_ipa_call_summary (FILE *f, int indent, struct cgraph_node *node, ? "inlined" : cgraph_inline_failed_string (edge-> inline_failed), indent, "", es->loop_depth, edge->sreal_frequency ().to_double (), es->call_stmt_size, es->call_stmt_time, - (int) ipa_fn_summaries->get (callee)->size / ipa_fn_summary::size_scale, - (int) ipa_fn_summaries->get (callee)->estimated_stack_size); + (int) (ipa_fn_summaries->get_create (callee)->size + / ipa_fn_summary::size_scale), + (int) ipa_fn_summaries->get_create (callee)->estimated_stack_size); if (es->predicate) { @@ -849,18 +850,19 @@ dump_ipa_call_summary (FILE *f, int indent, struct cgraph_node *node, } if (!edge->inline_failed) { + ipa_fn_summary *s = ipa_fn_summaries->get_create (callee); fprintf (f, "%*sStack frame offset %i, callee self size %i," " callee size %i\n", indent + 2, "", - (int) ipa_fn_summaries->get (callee)->stack_frame_offset, - (int) ipa_fn_summaries->get (callee)->estimated_self_stack_size, - (int) ipa_fn_summaries->get (callee)->estimated_stack_size); + (int) s->stack_frame_offset, + (int) s->estimated_self_stack_size, + (int) s->estimated_stack_size); dump_ipa_call_summary (f, indent + 2, callee, info); } } for (edge = node->indirect_calls; edge; edge = edge->next_callee) { - struct ipa_call_summary *es = ipa_call_summaries->get (edge); + struct ipa_call_summary *es = ipa_call_summaries->get_create (edge); fprintf (f, "%*sindirect call loop depth:%2i freq:%4.2f size:%2i" " time: %2i", indent, "", @@ -883,7 +885,7 @@ ipa_dump_fn_summary (FILE *f, struct cgraph_node *node) { if (node->definition) { - struct ipa_fn_summary *s = ipa_fn_summaries->get (node); + struct ipa_fn_summary *s = ipa_fn_summaries->get_create (node); size_time_entry *e; int i; fprintf (f, "IPA function summary for %s/%i", node->name (), @@ -2009,7 +2011,7 @@ analyze_function_body (struct cgraph_node *node, bool early) basic_block bb; struct function *my_function = DECL_STRUCT_FUNCTION (node->decl); sreal freq; - struct ipa_fn_summary *info = ipa_fn_summaries->get (node); + struct ipa_fn_summary *info = ipa_fn_summaries->get_create (node); predicate bb_predicate; struct ipa_func_body_info fbi; vec<predicate> nonconstant_names = vNULL; @@ -2177,7 +2179,7 @@ analyze_function_body (struct cgraph_node *node, bool early) && !gimple_call_internal_p (stmt)) { struct cgraph_edge *edge = node->get_edge (stmt); - struct ipa_call_summary *es = ipa_call_summaries->get (edge); + ipa_call_summary *es = ipa_call_summaries->get_create (edge); /* Special case: results of BUILT_IN_CONSTANT_P will be always resolved as constant. We however don't want to optimize @@ -2275,7 +2277,8 @@ analyze_function_body (struct cgraph_node *node, bool early) } } } - set_hint_predicate (&ipa_fn_summaries->get (node)->array_index, array_index); + set_hint_predicate (&ipa_fn_summaries->get_create (node)->array_index, + array_index); free (order); if (nonconstant_names.exists () && !early) @@ -2360,9 +2363,9 @@ analyze_function_body (struct cgraph_node *node, bool early) } free (body); } - set_hint_predicate (&ipa_fn_summaries->get (node)->loop_iterations, + set_hint_predicate (&ipa_fn_summaries->get_create (node)->loop_iterations, loop_iterations); - set_hint_predicate (&ipa_fn_summaries->get (node)->loop_stride, + set_hint_predicate (&ipa_fn_summaries->get_create (node)->loop_stride, loop_stride); scev_finalize (); } @@ -2381,8 +2384,8 @@ analyze_function_body (struct cgraph_node *node, bool early) e->aux = NULL; } } - ipa_fn_summaries->get (node)->time = time; - ipa_fn_summaries->get (node)->self_size = size; + ipa_fn_summaries->get_create (node)->time = time; + ipa_fn_summaries->get_create (node)->self_size = size; nonconstant_names.release (); ipa_release_body_info (&fbi); if (opt_for_fn (node->decl, optimize)) @@ -2416,7 +2419,7 @@ compute_fn_summary (struct cgraph_node *node, bool early) if (!ipa_fn_summaries) ipa_fn_summary_alloc (); - info = ipa_fn_summaries->get (node); + info = ipa_fn_summaries->get_create (node); info->reset (node); /* Estimate the stack size for the function if we're optimizing. */ @@ -2428,7 +2431,7 @@ compute_fn_summary (struct cgraph_node *node, bool early) if (node->thunk.thunk_p) { - struct ipa_call_summary *es = ipa_call_summaries->get (node->callees); + ipa_call_summary *es = ipa_call_summaries->get_create (node->callees); predicate t = true; node->local.can_change_signature = false; @@ -2572,7 +2575,7 @@ estimate_edge_devirt_benefit (struct cgraph_edge *ie, callee = callee->function_symbol (&avail); if (avail < AVAIL_AVAILABLE) return false; - isummary = ipa_fn_summaries->get (callee); + isummary = ipa_fn_summaries->get_create (callee); return isummary->inlinable; } @@ -2591,7 +2594,7 @@ estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *min_size, vec<ipa_agg_jump_function_p> known_aggs, ipa_hints *hints) { - struct ipa_call_summary *es = ipa_call_summaries->get (e); + struct ipa_call_summary *es = ipa_call_summaries->get_create (e); int call_size = es->call_stmt_size; int call_time = es->call_stmt_time; int cur_size; @@ -2628,7 +2631,7 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size, struct cgraph_edge *e; for (e = node->callees; e; e = e->next_callee) { - struct ipa_call_summary *es = ipa_call_summaries->get (e); + struct ipa_call_summary *es = ipa_call_summaries->get_create (e); /* Do not care about zero sized builtins. */ if (e->inline_failed && !es->call_stmt_size) @@ -2659,7 +2662,7 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size, } for (e = node->indirect_calls; e; e = e->next_callee) { - struct ipa_call_summary *es = ipa_call_summaries->get (e); + struct ipa_call_summary *es = ipa_call_summaries->get_create (e); if (!es->predicate || es->predicate->evaluate (possible_truths)) estimate_edge_size_and_time (e, size, @@ -2694,7 +2697,7 @@ estimate_node_size_and_time (struct cgraph_node *node, vec<inline_param_summary> inline_param_summary) { - struct ipa_fn_summary *info = ipa_fn_summaries->get (node); + struct ipa_fn_summary *info = ipa_fn_summaries->get_create (node); size_time_entry *e; int size = 0; sreal time = 0; @@ -2848,8 +2851,9 @@ static void inline_update_callee_summaries (struct cgraph_node *node, int depth) { struct cgraph_edge *e; - struct ipa_fn_summary *callee_info = ipa_fn_summaries->get (node); - struct ipa_fn_summary *caller_info = ipa_fn_summaries->get (node->callers->caller); + ipa_fn_summary *callee_info = ipa_fn_summaries->get_create (node); + ipa_fn_summary *caller_info + = ipa_fn_summaries->get_create (node->callers->caller); HOST_WIDE_INT peak; callee_info->stack_frame_offset @@ -2857,17 +2861,19 @@ inline_update_callee_summaries (struct cgraph_node *node, int depth) + caller_info->estimated_self_stack_size; peak = callee_info->stack_frame_offset + callee_info->estimated_self_stack_size; - if (ipa_fn_summaries->get (node->global.inlined_to)->estimated_stack_size < peak) - ipa_fn_summaries->get (node->global.inlined_to)->estimated_stack_size = peak; + + ipa_fn_summary *s = ipa_fn_summaries->get_create (node->global.inlined_to); + if (s->estimated_stack_size < peak) + s->estimated_stack_size = peak; ipa_propagate_frequency (node); for (e = node->callees; e; e = e->next_callee) { if (!e->inline_failed) inline_update_callee_summaries (e->callee, depth); - ipa_call_summaries->get (e)->loop_depth += depth; + ipa_call_summaries->get_create (e)->loop_depth += depth; } for (e = node->indirect_calls; e; e = e->next_callee) - ipa_call_summaries->get (e)->loop_depth += depth; + ipa_call_summaries->get_create (e)->loop_depth += depth; } /* Update change_prob of EDGE after INLINED_EDGE has been inlined. @@ -2884,9 +2890,9 @@ remap_edge_change_prob (struct cgraph_edge *inlined_edge, { int i; struct ipa_edge_args *args = IPA_EDGE_REF (edge); - struct ipa_call_summary *es = ipa_call_summaries->get (edge); + struct ipa_call_summary *es = ipa_call_summaries->get_create (edge); struct ipa_call_summary *inlined_es - = ipa_call_summaries->get (inlined_edge); + = ipa_call_summaries->get_create (inlined_edge); for (i = 0; i < ipa_get_cs_argument_count (args); i++) { @@ -2933,7 +2939,7 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge, struct cgraph_edge *e, *next; for (e = node->callees; e; e = next) { - struct ipa_call_summary *es = ipa_call_summaries->get (e); + struct ipa_call_summary *es = ipa_call_summaries->get_create (e); predicate p; next = e->next_callee; @@ -2959,7 +2965,7 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge, } for (e = node->indirect_calls; e; e = next) { - struct ipa_call_summary *es = ipa_call_summaries->get (e); + struct ipa_call_summary *es = ipa_call_summaries->get_create (e); predicate p; next = e->next_callee; @@ -3009,10 +3015,10 @@ remap_hint_predicate (struct ipa_fn_summary *info, void ipa_merge_fn_summary_after_inlining (struct cgraph_edge *edge) { - struct ipa_fn_summary *callee_info = ipa_fn_summaries->get (edge->callee); + ipa_fn_summary *callee_info = ipa_fn_summaries->get_create (edge->callee); struct cgraph_node *to = (edge->caller->global.inlined_to ? edge->caller->global.inlined_to : edge->caller); - struct ipa_fn_summary *info = ipa_fn_summaries->get (to); + struct ipa_fn_summary *info = ipa_fn_summaries->get_create (to); clause_t clause = 0; /* not_inline is known to be false. */ size_time_entry *e; vec<int> operand_map = vNULL; @@ -3020,7 +3026,7 @@ ipa_merge_fn_summary_after_inlining (struct cgraph_edge *edge) int i; predicate toplev_predicate; predicate true_p = true; - struct ipa_call_summary *es = ipa_call_summaries->get (edge); + struct ipa_call_summary *es = ipa_call_summaries->get_create (edge); if (es->predicate) toplev_predicate = *es->predicate; @@ -3109,8 +3115,8 @@ ipa_merge_fn_summary_after_inlining (struct cgraph_edge *edge) &callee_info->array_index, operand_map, offset_map, clause, &toplev_predicate); - inline_update_callee_summaries (edge->callee, - ipa_call_summaries->get (edge)->loop_depth); + ipa_call_summary *s = ipa_call_summaries->get_create (edge); + inline_update_callee_summaries (edge->callee, s->loop_depth); /* We do not maintain predicates of inlined edges, free it. */ edge_set_predicate (edge, &true_p); @@ -3126,7 +3132,7 @@ ipa_merge_fn_summary_after_inlining (struct cgraph_edge *edge) void ipa_update_overall_fn_summary (struct cgraph_node *node) { - struct ipa_fn_summary *info = ipa_fn_summaries->get (node); + struct ipa_fn_summary *info = ipa_fn_summaries->get_create (node); size_time_entry *e; int i; @@ -3224,7 +3230,7 @@ ipa_fn_summary_generate (void) static void read_ipa_call_summary (struct lto_input_block *ib, struct cgraph_edge *e) { - struct ipa_call_summary *es = ipa_call_summaries->get (e); + struct ipa_call_summary *es = ipa_call_summaries->get_create (e); predicate p; int length, i; @@ -3283,7 +3289,7 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data, encoder = file_data->symtab_node_encoder; node = dyn_cast<cgraph_node *> (lto_symtab_encoder_deref (encoder, index)); - info = ipa_fn_summaries->get (node); + info = ipa_fn_summaries->get_create (node); info->estimated_stack_size = info->estimated_self_stack_size = streamer_read_uhwi (&ib); @@ -3384,7 +3390,7 @@ ipa_fn_summary_read (void) static void write_ipa_call_summary (struct output_block *ob, struct cgraph_edge *e) { - struct ipa_call_summary *es = ipa_call_summaries->get (e); + struct ipa_call_summary *es = ipa_call_summaries->get_create (e); int i; streamer_write_uhwi (ob, es->call_stmt_size); @@ -3432,7 +3438,7 @@ ipa_fn_summary_write (void) cgraph_node *cnode = dyn_cast <cgraph_node *> (snode); if (cnode && cnode->definition && !cnode->alias) { - struct ipa_fn_summary *info = ipa_fn_summaries->get (cnode); + struct ipa_fn_summary *info = ipa_fn_summaries->get_create (cnode); struct bitpack_d bp; struct cgraph_edge *edge; int i; @@ -3507,7 +3513,7 @@ ipa_free_fn_summary (void) return; FOR_EACH_DEFINED_FUNCTION (node) if (!node->alias) - ipa_fn_summaries->get (node)->reset (node); + ipa_fn_summaries->get_create (node)->reset (node); ipa_fn_summaries->release (); ipa_fn_summaries = NULL; ipa_call_summaries->release (); |