GCC Middle and Back End API Reference
|
Go to the source code of this file.
Data Structures | |
struct | agg_position_info |
class | size_time_entry |
class | ipa_size_summary |
struct | ipa_freqcounting_predicate |
class | ipa_fn_summary |
class | ipa_fn_summary_t |
class | ipa_size_summary_t |
class | ipa_call_summary |
class | ipa_call_summary_t |
struct | ipa_call_estimates |
class | ipa_call_context |
class | ipa_cached_call_context |
Typedefs | |
typedef int | ipa_hints |
Enumerations | |
enum | ipa_hints_vals { INLINE_HINT_indirect_call = 1 , INLINE_HINT_loop_iterations = 2 , INLINE_HINT_loop_stride = 4 , INLINE_HINT_same_scc = 8 , INLINE_HINT_in_scc = 16 , INLINE_HINT_declared_inline = 32 , INLINE_HINT_cross_module = 64 , INLINE_HINT_known_hot = 128 , INLINE_HINT_builtin_constant_p = 256 } |
Variables | |
fast_function_summary< ipa_fn_summary *, va_gc > * | ipa_fn_summaries |
fast_function_summary< ipa_size_summary *, va_heap > * | ipa_size_summaries |
fast_call_summary< ipa_call_summary *, va_heap > * | ipa_call_summaries |
typedef int ipa_hints |
enum ipa_hints_vals |
IPA function body analysis. Copyright (C) 2003-2024 Free Software Foundation, Inc. Contributed by Jan Hubicka This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Hints are reasons why IPA heuristics should prefer specializing given function. They are represented as bitmap of the following values.
void compute_fn_summary | ( | struct cgraph_node * | node, |
bool | early ) |
Compute function summary. EARLY is true when we compute parameters during early opts.
References ipa_fn_summary::account_size_time(), analyze_function_body(), eni_weights::call_cost, ipa_call_summary::call_stmt_size, ipa_call_summary::call_stmt_time, cgraph_edge::callee, cgraph_node::callees, cgraph_node::can_change_signature, symtab_node::decl, DECL_ARGUMENTS, DECL_ATTRIBUTES, DECL_CHAIN, DECL_STRUCT_FUNCTION, dump_file, eni_size_weights, eni_time_weights, ipa_size_summary::estimated_self_stack_size, estimated_stack_frame_size(), ipa_fn_summary::estimated_stack_size, fndecl_built_in_p(), gcc_assert, get_attribute_name(), IDENTIFIER_POINTER, cgraph_node::indirect_calls, ipa_fn_summary::inlinable, cgraph_edge::inline_failed, cgraph_node::inlined_to, ipa_call_summaries, ipa_fn_summaries, ipa_fn_summary_alloc(), ipa_size_summaries, ipa_update_overall_fn_summary(), lookup_attribute(), cgraph_edge::next_callee, ipa_predicate::not_inlined(), opt_for_fn, pop_cfun(), push_cfun(), ipa_size_summary::self_size, ipa_size_summary::size, ipa_fn_summary::size_scale, cgraph_edge::speculative, stdarg_p(), cgraph_node::thunk, TODO_update_ssa_only_virtuals, TREE_CHAIN, tree_inlinable_function_p(), TREE_TYPE, ipa_param_adjustments::type_attribute_allowed_p(), TYPE_ATTRIBUTES, update_ssa(), and variably_modified_type_p().
Referenced by autofdo::afdo_vpt_for_early_inline(), autofdo::auto_profile(), compute_fn_summary_for_current(), autofdo::early_inline(), inline_always_inline_functions(), inline_analyze_function(), ipa_merge_profiles(), symbol_table::process_new_functions(), and split_function().
|
inline |
Return true if EDGE is a cross module call.
References DECL_COMDAT.
Referenced by dump_ipa_call_summary(), inline_small_functions(), and simple_edge_hints().
void estimate_ipcp_clone_size_and_time | ( | struct cgraph_node * | node, |
ipa_auto_call_arg_values * | avals, | ||
ipa_call_estimates * | estimates ) |
Estimate size and time needed to execute callee of EDGE assuming that parameters known to be constant at caller of EDGE are propagated. KNOWN_VALS and KNOWN_CONTEXTS are vectors of assumed known constant values and types for parameters.
References ipa_call_context::estimate_size_and_time(), evaluate_conditions_for_known_args(), NULL, and vNULL.
Referenced by estimate_local_effects(), and perform_estimation_of_a_value().
void evaluate_properties_for_edge | ( | struct cgraph_edge * | e, |
bool | inline_p, | ||
clause_t * | clause_ptr, | ||
clause_t * | nonspec_clause_ptr, | ||
ipa_auto_call_arg_values * | avals, | ||
bool | compute_contexts ) |
Work out what conditions might be true at invocation of E. Compute costs for inlined edge if INLINE_P is true. Return in CLAUSE_PTR the evaluated conditions and in NONSPEC_CLAUSE_PTR (if non-NULL) conditions evaluated for nonspecialized clone called in a given context. Vectors in AVALS will be populated with useful known information about argument values - information not known to have any uses will be omitted - except for m_known_contexts which will only be calculated if COMPUTE_CONTEXTS is true.
References ipa_jump_func::agg, cgraph_edge::call_stmt, cgraph_edge::call_stmt_cannot_inline_p, cgraph_edge::callee, cgraph_edge::caller, ipa_fn_summary::conds, count, error_mark_node, evaluate_conditions_for_known_args(), fre_will_run_p(), gcc_assert, gcc_checking_assert, gimple_call_arg(), gimple_call_num_args(), i, cgraph_node::inlined_to, ipa_call_summaries, ipa_context_from_jfunc(), ipa_edge_args_sum, ipa_fn_summaries, ipa_get_cs_argument_count(), ipa_get_ith_jump_func(), ipa_get_param_count(), ipa_get_type(), ipa_is_param_used_by_indirect_call(), ipa_is_param_used_by_ipa_predicates(), ipa_is_param_used_by_polymorphic_call(), ipa_node_params_sum, ipa_push_agg_values_from_jfunc(), ipa_value_from_jfunc(), ipa_value_range_from_jfunc(), is_gimple_min_invariant(), ipa_auto_call_arg_values::m_known_aggs, ipa_auto_call_arg_values::m_known_contexts, ipa_auto_call_arg_values::m_known_vals, ipa_auto_call_arg_values::m_known_value_ranges, MIN, ipa_predicate::not_inlined_condition, NULL, ipa_call_summary::param, cgraph_node::thunk, TREE_CODE, cgraph_node::ultimate_alias_target(), value_range::undefined_p(), ipa_polymorphic_call_context::useless_p(), value_range::varying_p(), void_type_node, and vrp_will_run_p().
Referenced by do_estimate_edge_hints(), do_estimate_edge_size(), do_estimate_edge_time(), and ipa_merge_fn_summary_after_inlining().
void inline_analyze_function | ( | struct cgraph_node * | node | ) |
Note function body size.
References cgraph_node::callees, compute_fn_summary(), symtab_node::decl, DECL_STRUCT_FUNCTION, dump_file, symtab_node::dump_name(), cgraph_node::indirect_calls, cgraph_edge::inline_failed, inline_indirect_intraprocedural_analysis(), cgraph_edge::next_callee, opt_for_fn, pop_cfun(), push_cfun(), and cgraph_node::thunk.
Referenced by cgraph_node::create_wrapper(), cgraph_node::expand_all_artificial_thunks(), ipa_fn_summary_t::insert(), and ipa_fn_summary_generate().
void ipa_debug_fn_summary | ( | struct cgraph_node * | node | ) |
In ipa-fnsummary.cc
References ipa_dump_fn_summary().
void ipa_dump_fn_summaries | ( | FILE * | f | ) |
References FOR_EACH_DEFINED_FUNCTION, cgraph_node::inlined_to, and ipa_dump_fn_summary().
Referenced by ipa_inline().
void ipa_dump_fn_summary | ( | FILE * | f, |
struct cgraph_node * | node ) |
References ipa_fn_summary::builtin_constant_p_parms, ipa_fn_summary::conds, symtab_node::decl, DECL_DISREGARD_INLINE_LIMITS, symtab_node::definition, ipa_predicate::dump(), dump_ipa_call_summary(), symtab_node::dump_name(), ipa_fn_summary::estimated_stack_size, size_time_entry::exec_predicate, ipa_fn_summary::fp_expressions, ipa_freqcounting_predicate::freq, ipa_fn_summary::growth, i, ipa_fn_summary::inlinable, ipa_fn_summaries, ipa_size_summaries, ipa_fn_summary::loop_iterations, ipa_fn_summary::loop_strides, ipa_fn_summary::min_size, size_time_entry::nonconst_predicate, NULL, ipa_freqcounting_predicate::predicate, ipa_fn_summary::scc_no, size_time_entry::size, ipa_fn_summary::size_scale, ipa_fn_summary::size_time_table, ss, ipa_fn_summary::target_info, ipa_fn_summary::time, size_time_entry::time, sreal::to_double(), and vec_safe_iterate().
Referenced by analyze_function_body(), ipa_debug_fn_summary(), and ipa_dump_fn_summaries().
void ipa_dump_hints | ( | FILE * | f, |
ipa_hints | hints ) |
Dump IPA hints.
References gcc_assert, INLINE_HINT_builtin_constant_p, INLINE_HINT_cross_module, INLINE_HINT_declared_inline, INLINE_HINT_in_scc, INLINE_HINT_indirect_call, INLINE_HINT_known_hot, INLINE_HINT_loop_iterations, INLINE_HINT_loop_stride, and INLINE_HINT_same_scc.
Referenced by edge_badness().
void ipa_fnsummary_cc_finalize | ( | void | ) |
Reset all state within ipa-fnsummary.cc so that we can rerun the compiler within the same process. For use by toplev::finalize.
References ipa_free_fn_summary(), and ipa_free_size_summary().
Referenced by toplev::finalize().
void ipa_free_fn_summary | ( | void | ) |
Release function summary.
References edge_predicate_pool, ggc_delete(), ggc_trim(), ipa_call_summaries, ipa_fn_summaries, and NULL.
Referenced by ipa_fnsummary_cc_finalize(), and symbol_table::process_new_functions().
void ipa_free_size_summary | ( | void | ) |
Release function summary.
References ipa_size_summaries, and NULL.
Referenced by ipa_fnsummary_cc_finalize(), and symbol_table::process_new_functions().
HOST_WIDE_INT ipa_get_stack_frame_offset | ( | struct cgraph_node * | node | ) |
Return stack frame offset where frame of NODE is supposed to start inside of the function it is inlined to. Return 0 for functions that are not inlined.
References cgraph_edge::caller, cgraph_node::callers, cgraph_node::inlined_to, ipa_size_summaries, and offset.
Referenced by caller_growth_limits(), dump_ipa_call_summary(), and ipa_merge_fn_summary_after_inlining().
void ipa_merge_fn_summary_after_inlining | ( | struct cgraph_edge * | edge | ) |
We inlined EDGE. Update summary of the function we inlined into.
References ipa_fn_summary::account_size_time(), add_builtin_constant_p_parm(), ipa_fn_summary::builtin_constant_p_parms, ipa_fn_summary::call_size_time_table, ipa_fn_summary::conds, count, dump_file, dump_flags, estimate_edge_size_and_time(), ipa_fn_summary::estimated_stack_size, evaluate_properties_for_edge(), size_time_entry::exec_predicate, ipa_fn_summary::fp_expressions, gcc_assert, i, inline_update_callee_summaries(), INT_MAX, ipa_call_summaries, ipa_edge_args_sum, ipa_fn_summaries, ipa_get_cs_argument_count(), ipa_get_ith_jump_func(), ipa_get_jf_ancestor_agg_preserved(), ipa_get_jf_ancestor_formal_id(), ipa_get_jf_ancestor_offset(), ipa_get_jf_pass_through_agg_preserved(), ipa_get_jf_pass_through_formal_id(), ipa_get_jf_pass_through_operation(), ipa_get_param_count(), ipa_get_stack_frame_offset(), IPA_JF_ANCESTOR, IPA_JF_PASS_THROUGH, ipa_node_params_sum, ipa_remove_from_growth_caches(), ipa_call_summary::loop_depth, ipa_fn_summary::loop_iterations, ipa_fn_summary::loop_strides, map, size_time_entry::nonconst_predicate, NULL, offset, ipa_call_summary::param, ipa_call_summary::predicate, ipa_predicate::probability(), REG_BR_PROB_BASE, ipa_predicate::remap_after_inlining(), remap_edge_summaries(), remap_freqcounting_predicate(), size_time_entry::size, ipa_fn_summary::size_time_table, summarize_calls_size_and_time(), ipa_fn_summary::target_info, TDF_DETAILS, size_time_entry::time, and ipa_jump_func::type.
Referenced by inline_call().
void ipa_remove_from_growth_caches | ( | struct cgraph_edge * | edge | ) |
Remove EDGE from caches once it was inlined.
References edge_growth_cache, and node_context_cache.
Referenced by ipa_merge_fn_summary_after_inlining().
void ipa_update_overall_fn_summary | ( | struct cgraph_node * | node, |
bool | reset ) |
For performance reasons ipa_merge_fn_summary_after_inlining is not updating overall size and time. Recompute it. If RESET is true also recompute call_time_size_table.
References ipa_fn_summary::call_size_time_table, cgraph_node::callees, estimate_calls_size_and_time(), ipa_predicate::false_condition, i, cgraph_node::indirect_calls, ipa_fn_summaries, ipa_size_summaries, ipa_fn_summary::min_size, NULL, RDIV, ipa_size_summary::size, size_time_entry::size, ipa_fn_summary::size_scale, ipa_fn_summary::size_time_table, ipa_fn_summary::time, and size_time_entry::time.
Referenced by compute_fn_summary(), ipa_fn_summary_t::duplicate(), early_inline_small_functions(), early_inliner(), flatten_function(), inline_call(), inline_small_functions(), inline_to_all_callers(), ipa_devirt(), ipa_inline(), ipa_profile(), ipcp_discover_new_direct_edges(), resolve_noninline_speculation(), and walk_polymorphic_call_targets().
Return true if T is a pointer pointing to memory location that is local for the function (that means, dead after return) or read-only.
References cfun, current_function_decl, DECL_BY_REFERENCE, DECL_RESULT, integer_zerop(), ptr_deref_may_alias_global_p(), refs_local_or_readonly_memory_p(), ssa_default_def(), TREE_CODE, and TREE_OPERAND.
Referenced by analyze_function_body(), refs_local_or_readonly_memory_p(), and remap_edge_params().
Return true if T references memory location that is local for the function (that means, dead after return) or read-only.
References auto_var_in_fn_p(), current_function_decl, DECL_P, get_base_address(), points_to_local_or_readonly_memory_p(), TREE_CODE, TREE_OPERAND, and TREE_READONLY.
Referenced by check_op(), and points_to_local_or_readonly_memory_p().
|
extern |
Referenced by analyze_function_body(), can_inline_edge_by_limits_p(), check_callers(), check_callers(), compute_fn_summary(), compute_inlined_call_time(), do_estimate_edge_time(), dump_ipa_call_summary(), ipa_fn_summary_t::duplicate(), early_inliner(), edge_badness(), edge_set_predicate(), estimate_calls_size_and_time_1(), estimate_edge_growth(), estimate_edge_size_and_time(), estimate_min_edge_growth(), estimate_size_after_inlining(), evaluate_properties_for_edge(), growth_positive_p(), inline_update_callee_summaries(), inlining_speedup(), ipa_fn_summary_alloc(), ipa_free_fn_summary(), ipa_make_edge_direct_to_target(), ipa_merge_fn_summary_after_inlining(), ipa_propagate_frequency_1(), malloc_candidate_p_1(), propagate_malloc(), read_ipa_call_summary(), redirect_to_unreachable(), remap_edge_params(), remap_edge_summaries(), ipa_fn_summary_t::remove_callees(), symbol_table::remove_unreachable_nodes(), summarize_calls_size_and_time(), want_inline_small_function_p(), and write_ipa_call_summary().
|
extern |
Summaries.
Referenced by analyze_function_body(), caller_growth_limits(), can_early_inline_edge_p(), can_inline_edge_by_limits_p(), can_inline_edge_p(), compute_fn_summary(), compute_inlined_call_time(), compute_uninlined_call_time(), devirtualization_time_bonus(), do_estimate_edge_time(), dump_ipa_call_summary(), dump_overall_stats(), early_inline_small_functions(), edge_badness(), estimate_calls_size_and_time(), estimate_edge_devirt_benefit(), estimate_min_edge_growth(), ipa_call_context::estimate_size_and_time(), evaluate_conditions_for_known_args(), evaluate_properties_for_edge(), execute_split_functions(), growth_positive_p(), inline_always_inline_functions(), inline_call(), inline_read_section(), inline_small_functions(), ipa_dump_fn_summary(), ipa_fn_summary_alloc(), ipa_fn_summary_generate(), ipa_fn_summary_read(), ipa_fn_summary_write(), ipa_free_fn_summary(), ipa_merge_fn_summary_after_inlining(), ipa_update_overall_fn_summary(), ipa_icf::sem_function::merge(), symbol_table::process_new_functions(), recursive_inlining(), simple_edge_hints(), update_callee_keys(), update_caller_keys(), walk_polymorphic_call_targets(), and want_inline_small_function_p().
|
extern |
Referenced by analyze_function_body(), caller_growth_limits(), clone_inlined_nodes(), compute_fn_summary(), devirtualization_time_bonus(), dump_ipa_call_summary(), edge_badness(), estimate_growth(), estimate_size_after_inlining(), growth_positive_p(), inline_call(), inline_read_section(), inline_small_functions(), inline_to_all_callers_1(), ipa_dump_fn_summary(), ipa_fn_summary_alloc(), ipa_fn_summary_write(), ipa_free_size_summary(), ipa_get_stack_frame_offset(), ipa_update_overall_fn_summary(), ipcp_cloning_candidate_p(), ipcp_propagate_stage(), ipa_icf::sem_function::merge(), and recursive_inlining().