GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "alloc-pool.h"
#include "tree-pass.h"
#include "gimple-ssa.h"
#include "cgraph.h"
#include "lto-streamer.h"
#include "trans-mem.h"
#include "calls.h"
#include "tree-inline.h"
#include "profile.h"
#include "symbol-summary.h"
#include "tree-vrp.h"
#include "sreal.h"
#include "ipa-cp.h"
#include "ipa-prop.h"
#include "ipa-fnsummary.h"
#include "ipa-inline.h"
#include "ipa-utils.h"
#include "auto-profile.h"
#include "builtins.h"
#include "fibonacci_heap.h"
#include "stringpool.h"
#include "attribs.h"
#include "asan.h"
#include "ipa-strub.h"
Data Structures | |
class | inline_badness |
Macros | |
#define | check_maybe_up(flag) |
#define | check_maybe_down(flag) |
#define | check_match(flag) |
Typedefs | |
typedef fibonacci_heap< inline_badness, cgraph_edge > | edge_heap_t |
typedef fibonacci_node< inline_badness, cgraph_edge > | edge_heap_node_t |
Enumerations | |
enum | can_inline_edge_by_limits_flags { CAN_INLINE_EARLY = 1 , CAN_INLINE_DISREGARD_LIMITS = 2 , CAN_INLINE_FORCE_LIMITS = 4 , CAN_INLINE_REPORT = 8 } |
Variables | |
static int | overall_size |
static profile_count | max_count |
static profile_count | spec_rem |
#define check_match | ( | flag | ) |
Used for flags where exact match is needed for correctness.
Referenced by can_inline_edge_by_limits_p().
#define check_maybe_down | ( | flag | ) |
Used for flags where it is safe to inline when caller's value is smaller than callee's.
Referenced by can_inline_edge_by_limits_p().
#define check_maybe_up | ( | flag | ) |
Used for flags where it is safe to inline when caller's value is grater than callee's.
Referenced by can_inline_edge_by_limits_p().
typedef fibonacci_heap<inline_badness, cgraph_edge> edge_heap_t |
|
static |
Compute badness of all edges in NEW_EDGES and add them to the HEAP.
References b, can_inline_edge_by_limits_p(), can_inline_edge_p(), CAN_INLINE_REPORT, edge_badness(), gcc_assert, fibonacci_heap< K, V >::insert(), and want_inline_small_function_p().
Referenced by inline_small_functions().
|
static |
Return true if the speedup for inlining E is bigger than param_inline_min_speedup.
References cgraph_edge::caller, compute_inlined_call_time(), compute_uninlined_call_time(), symtab_node::decl, estimate_edge_time(), cgraph_node::inlined_to, opt_for_fn, and cgraph_edge::sreal_frequency().
Referenced by edge_badness(), and want_inline_small_function_p().
|
static |
Return false when inlining edge E would lead to violating limits on function unit growth or stack usage growth. The relative function body growth limit is present generally to avoid problems with non-linear behavior of the compiler. To allow inlining huge functions into tiny wrapper, the limit is always based on the bigger of the two functions considered. For stack growth limits we always base the growth in stack usage of the callers. We want to prevent applications from segfaulting on stack overflow when functions with huge stack frames gets inlined.
References cgraph_edge::callee, cgraph_edge::caller, cgraph_node::callers, symtab_node::decl, estimate_size_after_inlining(), ipa_size_summary::estimated_self_stack_size, ipa_fn_summary::estimated_stack_size, cgraph_edge::inline_failed, cgraph_node::inlined_to, ipa_fn_summaries, ipa_get_stack_frame_offset(), ipa_size_summaries, opt_for_fn, ipa_size_summary::self_size, and cgraph_node::ultimate_alias_target().
Referenced by can_inline_edge_by_limits_p().
|
static |
Return true if the edge E is inlinable during early inlining.
References cgraph_edge::callee, cgraph_node::callees, cgraph_edge::caller, CAN_INLINE_EARLY, can_inline_edge_by_limits_p(), can_inline_edge_p(), CAN_INLINE_REPORT, cgraph_inline_failed_type(), CIF_FINAL_ERROR, symtab_node::decl, DECL_ATTRIBUTES, DECL_DISREGARD_INLINE_LIMITS, DECL_STRUCT_FUNCTION, symtab_node::externally_visible, gcc_assert, gimple_has_body_p(), gimple_in_ssa_p(), cgraph_node::indirect_calls, cgraph_edge::inline_failed, cgraph_node::inlined_to, ipa_fn_summaries, lookup_attribute(), cgraph_edge::next_callee, NULL_TREE, ipa_fn_summary::safe_to_inline_to_always_inline, and cgraph_node::ultimate_alias_target().
Referenced by early_inline_small_functions(), flatten_function(), and inline_always_inline_functions().
|
static |
Decide if we can inline the edge and possibly update inline_failed reason. We check whether inlining is possible at all and whether caller growth limits allow doing so.
References cgraph_edge::callee, cgraph_edge::caller, caller_growth_limits(), CAN_INLINE_DISREGARD_LIMITS, CAN_INLINE_EARLY, CAN_INLINE_FORCE_LIMITS, CAN_INLINE_REPORT, cgraph_inline_failed_type(), check_match, check_maybe_down, check_maybe_up, CIF_FINAL_ERROR, symtab_node::decl, DECL_ATTRIBUTES, DECL_DECLARED_INLINE_P, DECL_DISREGARD_INLINE_LIMITS, DECL_FUNCTION_PERSONALITY, DECL_FUNCTION_SPECIFIC_OPTIMIZATION, estimate_edge_growth(), estimate_edge_time(), symtab_node::externally_visible, ipa_fn_summary::fp_expressions, gcc_checking_assert, cgraph_edge::inline_failed, inline_insns_auto(), inline_insns_single(), cgraph_node::inlined_to, ipa_call_summaries, ipa_fn_summaries, LIVE_PATCHING_INLINE_ONLY_STATIC, lookup_attribute(), MAX, cgraph_node::merged_comdat, NULL, opt_for_fn, opts_for_fn(), report_inline_failed_reason(), and cgraph_node::ultimate_alias_target().
Referenced by add_new_edges_to_heap(), can_early_inline_edge_p(), check_callers(), flatten_function(), inline_small_functions(), inline_to_all_callers_1(), recursive_inlining(), speculation_useful_p(), update_callee_keys(), update_caller_keys(), and want_inline_self_recursive_call_p().
|
static |
Decide if we can inline the edge and possibly update inline_failed reason. We check whether inlining is possible at all and whether caller growth limits allow doing so. if REPORT is true, output reason to the dump file.
References AVAIL_INTERPOSABLE, cgraph_edge::call_stmt_cannot_inline_p, cgraph_edge::callee, cgraph_edge::caller, cgraph_node::calls_comdat_local, cgraph_inline_failed_type(), CIF_FINAL_ERROR, symtab_node::decl, DECL_FUNCTION_PERSONALITY, symtab_node::definition, gcc_checking_assert, gcc_unreachable, cgraph_edge::inline_failed, cgraph_node::inlined_to, ipa_fn_summaries, is_tm_pure(), NULL, opt_for_fn, report_inline_failed_reason(), sanitize_attrs_match_for_inline_p(), strub_inlinable_to_p(), targetm, and cgraph_node::ultimate_alias_target().
Referenced by add_new_edges_to_heap(), can_early_inline_edge_p(), check_callers(), flatten_function(), inline_small_functions(), inline_to_all_callers_1(), recursive_inlining(), speculation_useful_p(), update_callee_keys(), and update_caller_keys().
|
static |
Return true when NODE has uninlinable caller; set HAS_HOT_CALL if it has hot call. Worker for cgraph_for_node_and_aliases.
References cgraph_edge::caller, cgraph_node::callers, can_inline_edge_by_limits_p(), can_inline_edge_p(), CAN_INLINE_REPORT, symtab_node::decl, estimate_size_after_inlining(), cgraph_node::inlined_to, ipa_call_summaries, cgraph_edge::maybe_hot_p(), cgraph_edge::next_caller, opt_for_fn, and cgraph_edge::recursive_p().
Referenced by want_inline_function_to_all_callers_p().
|
inline |
Same as compute_uinlined_call_time but compute time when inlining does happen.
References gcc_checking_assert, ipa_call_summaries, and ipa_fn_summaries.
Referenced by big_speedup_p().
|
static |
Given whole compilation unit estimate of INSNS, compute how large we can allow the unit to grow.
References symtab_node::decl, insns, and opt_for_fn.
Referenced by inline_small_functions().
|
inline |
Compute time of the edge->caller + edge->callee execution when inlining does not happen.
References ipa_fn_summaries.
Referenced by big_speedup_p().
|
static |
Output some useful stats about inlining.
References cgraph_edge::callee, cgraph_node::callees, cgraph_inline_failed_string(), cgraph_edge::count, symtab_node::decl, DECL_VIRTUAL_P, profile_count::dump(), dump_file, dump_overall_stats(), FOR_EACH_DEFINED_FUNCTION, i, cgraph_node::indirect_calls, cgraph_edge::indirect_info, cgraph_edge::indirect_inlining_edge, profile_count::initialized_p(), cgraph_edge::inline_failed, profile_count::ipa(), max_count, cgraph_edge::next_callee, cgraph_indirect_call_info::polymorphic, PRId64, spec_rem, cgraph_edge::speculative, cgraph_edge::sreal_frequency(), and profile_count::to_gcov_type().
Referenced by ipa_inline().
|
static |
Output overall time estimate.
References symtab_node::alias, cgraph_node::count, dump_file, FOR_EACH_DEFINED_FUNCTION, profile_count::initialized_p(), cgraph_node::inlined_to, profile_count::ipa(), ipa_fn_summaries, NULL, ipa_fn_summary::time, sreal::to_double(), and profile_count::to_gcov_type().
Referenced by dump_inline_stats(), and ipa_inline().
|
static |
Decide on the inlining. We do so in the topological order to avoid expenses on updating data structures.
References cgraph_edge::call_stmt, cgraph_edge::callee, cgraph_node::callees, cgraph_edge::caller, can_early_inline_edge_p(), symtab_node::decl, DECL_DECLARED_INLINE_P, dump_enabled_p(), dump_printf_loc(), ipa_fn_summary::inlinable, inline_call(), cgraph_edge::inline_failed, ipa_fn_summaries, ipa_update_overall_fn_summary(), MSG_MISSED_OPTIMIZATION, MSG_NOTE, MSG_OPTIMIZED_LOCATIONS, cgraph_edge::next_callee, NULL, opt_for_fn, cgraph_edge::recursive_p(), cgraph_node::ultimate_alias_target(), and want_early_inline_function_p().
Referenced by early_inliner().
unsigned int early_inliner | ( | function * | fun | ) |
In ipa-inline.cc
References function::always_inline_functions_inlined, ipa_call_summary::call_stmt_size, ipa_call_summary::call_stmt_time, cgraph_node::callees, current_function_decl, symtab_node::decl, DECL_ATTRIBUTES, dump_enabled_p(), dump_file, dump_printf(), early_inline_small_functions(), eni_size_weights, eni_time_weights, estimate_num_insns(), flatten_function(), cgraph_node::get(), inline_always_inline_functions(), ipa_call_summaries, ipa_node_params_sum, ipa_update_overall_fn_summary(), lookup_attribute(), MSG_OPTIMIZED_LOCATIONS, cgraph_edge::next_callee, NULL, opt_for_fn, optimize_inline_calls(), symtab_node::remove_all_references(), seen_error(), timevar_pop(), timevar_push(), todo, and symtab_node::verify().
Referenced by autofdo::early_inline().
|
static |
A cost model driving the inlining heuristics in a way so the edges with smallest badness are inlined first. After each inlining is performed the costs of all caller edges of nodes affected are recomputed so the metrics may accurately depend on values such as number of inlinable callers of the function or function body size.
References big_speedup_p(), cgraph_node::count, symtab_node::decl, DECL_DECLARED_INLINE_P, DECL_DISREGARD_INLINE_LIMITS, DECL_EXTERNAL, dump_file, estimate_edge_growth(), estimate_edge_hints(), estimate_edge_time(), estimate_growth(), gcc_checking_assert, ipa_fn_summary::growth, profile_count::initialized_p(), ipa_fn_summary::inlinable, INLINE_HINT_builtin_constant_p, INLINE_HINT_cross_module, INLINE_HINT_declared_inline, INLINE_HINT_in_scc, INLINE_HINT_indirect_call, INLINE_HINT_loop_iterations, INLINE_HINT_loop_stride, INLINE_HINT_same_scc, inlining_speedup(), profile_count::ipa(), ipa_call_summaries, ipa_dump_hints(), ipa_fn_summaries, ipa_size_summaries, sreal::max(), MIN, profile_count::nonzero_p(), opt_for_fn, PRId64, sreal::shift(), ipa_fn_summary::single_caller, cgraph_node::split_part, SREAL_MAX_EXP, SREAL_MIN_SIG, ipa_fn_summary::time, sreal::to_double(), profile_count::to_gcov_type(), cgraph_node::ultimate_alias_target(), and wrapper_heuristics_may_apply().
Referenced by add_new_edges_to_heap(), inline_small_functions(), and update_edge_key().
|
static |
Flatten NODE. Performed both during early inlining and at IPA inlining time.
References symtab_node::aux, cgraph_edge::call_stmt, cgraph_edge::callee, cgraph_node::callees, cgraph_edge::caller, can_early_inline_edge_p(), can_inline_edge_by_limits_p(), can_inline_edge_p(), CAN_INLINE_REPORT, cgraph_inline_failed_type(), CIF_FINAL_ERROR, symtab_node::decl, DECL_STRUCT_FUNCTION, dump_enabled_p(), dump_printf_loc(), flatten_function(), gcc_assert, gimple_in_ssa_p(), inline_call(), cgraph_edge::inline_failed, cgraph_node::inlined_to, ipa_update_overall_fn_summary(), MSG_MISSED_OPTIMIZATION, MSG_OPTIMIZED_LOCATIONS, cgraph_edge::next_callee, NULL, opt_for_fn, cgraph_edge::recursive_p(), and cgraph_node::ultimate_alias_target().
Referenced by early_inliner(), flatten_function(), and ipa_inline().
|
static |
Called when node is removed.
References hash_set< KeyId, Lazy, Traits >::add(), symtab_node::decl, DECL_ATTRIBUTES, lookup_attribute(), and NULL.
Referenced by ipa_inline().
|
static |
If NODE has a caller, return true.
References cgraph_node::callers.
Referenced by want_inline_function_to_all_callers_p().
|
static |
Remove EDGE from the fibheap.
References cgraph_edge::aux, and NULL.
Referenced by inline_small_functions().
|
inline |
We only propagate across edges with non-interposable callee.
References AVAIL_INTERPOSABLE, cgraph_edge::callee, cgraph_edge::caller, and cgraph_node::function_or_virtual_thunk_symbol().
Referenced by inline_small_functions().
bool inline_account_function_p | ( | struct cgraph_node * | node | ) |
Return true if NODE should be accounted for overall size estimate. Skip all nodes optimized for size so we can measure the growth of hot part of program no matter of the padding.
References symtab_node::decl, DECL_EXTERNAL, cgraph_node::frequency, NODE_FREQUENCY_UNLIKELY_EXECUTED, and opt_for_fn.
Referenced by clone_inlined_nodes(), inline_call(), and inline_small_functions().
|
static |
Inline always-inline function calls in NODE (which itself is possibly inline).
References symtab_node::aux, cgraph_edge::call_stmt, cgraph_edge::callee, cgraph_node::callees, cgraph_edge::caller, can_early_inline_edge_p(), compute_fn_summary(), symtab_node::decl, DECL_ATTRIBUTES, DECL_DISREGARD_INLINE_LIMITS, symtab_node::definition, dump_enabled_p(), dump_printf_loc(), gcc_checking_assert, inline_always_inline_functions(), inline_call(), cgraph_edge::inline_failed, ipa_fn_summaries, lookup_attribute(), MSG_MISSED_OPTIMIZATION, MSG_OPTIMIZED_LOCATIONS, cgraph_edge::next_callee, NULL, cgraph_edge::recursive_p(), and cgraph_node::ultimate_alias_target().
Referenced by early_inliner(), and inline_always_inline_functions().
|
static |
Return inlining_insns_auto limit for function N. If HINT or HINT2 is true scale up the bound.
References symtab_node::decl, opt_for_fn, and spd.
Referenced by can_inline_edge_by_limits_p(), want_inline_small_function_p(), and wrapper_heuristics_may_apply().
|
static |
Return inlining_insns_single limit for function N. If HINT or HINT2 is true scale up the bound.
References symtab_node::decl, opt_for_fn, and spd.
Referenced by can_inline_edge_by_limits_p(), want_inline_small_function_p(), and wrapper_heuristics_may_apply().
|
static |
We use greedy algorithm for inlining of small functions: All inline candidates are put into prioritized heap ordered in increasing badness. The inlining of small functions is bounded by unit growth parameters.
References symbol_table::add_edge_removal_hook(), add_new_edges_to_heap(), symtab_node::alias, symtab_node::analyzed, symtab_node::aux, b, bitmap_clear(), BUILTINS_LOCATION, cgraph_node::call_for_symbol_and_aliases(), cgraph_node::callees, cgraph_edge::caller, cgraph_node::callers, can_inline_edge_by_limits_p(), can_inline_edge_p(), CAN_INLINE_REPORT, symbol_table::cgraph_count, compute_max_insns(), cgraph_node::count, cross_module_call_p(), symtab_node::decl, DECL_DISREGARD_INLINE_LIMITS, dump_enabled_p(), dump_file, dump_flags, symtab_node::dump_name(), dump_printf(), dump_printf_loc(), edge_badness(), edge_growth_cache, fibonacci_heap< K, V >::empty(), estimate_edge_growth(), estimate_edge_hints(), estimate_edge_size(), estimate_edge_time(), estimate_growth(), fibonacci_heap< K, V >::extract_min(), FOR_EACH_DEFINED_FUNCTION, free(), free_growth_caches(), gcc_assert, gcc_checking_assert, cgraph_node::get(), gimple_filename(), gimple_lineno(), gimple_location(), ipa_fn_summary::growth, cgraph_node::has_gimple_body_p(), heap_edge_removal_hook(), ignore_edge_p(), initialize_growth_caches(), profile_count::initialized_p(), inline_account_function_p(), inline_call(), cgraph_node::inlined_to, fibonacci_heap< K, V >::insert(), ipa_fn_summaries, ipa_free_postorder_info(), profile_count::ipa_p(), ipa_reduced_postorder(), ipa_size_summaries, ipa_update_overall_fn_summary(), LOCATION_LOCUS, profile_count::max(), max_count, fibonacci_heap< K, V >::min(), fibonacci_heap< K, V >::min_key(), MSG_NOTE, MSG_OPTIMIZED_LOCATIONS, cgraph_edge::next_callee, cgraph_edge::next_caller, ipa_dfs_info::next_cycle, profile_count::nonzero_p(), NULL, num_calls(), opt_for_fn, symtab_node::order, overall_size, profile_info, recursive_inlining(), symbol_table::remove_edge_removal_hook(), report_inline_failed_reason(), reset_edge_caches(), reset_node_cache(), resolve_noninline_speculation(), cgraph_edge::resolve_speculation(), ipa_dfs_info::scc_no, ipa_fn_summary::scc_no, ipa_fn_summary::single_caller, speculation_useful_p(), sum_callers(), symtab, TDF_DETAILS, cgraph_node::thunk, ipa_fn_summary::time, sreal::to_double(), cgraph_node::ultimate_alias_target(), profile_count::uninitialized(), update_callee_keys(), update_caller_keys(), update_edge_key(), want_inline_self_recursive_call_p(), want_inline_small_function_p(), and wrapper_heuristics_may_apply().
Referenced by ipa_inline().
|
static |
Wrapper around inline_to_all_callers_1 doing delayed overall summary update.
References cgraph_node::callers, i, inline_to_all_callers_1(), and ipa_update_overall_fn_summary().
Referenced by ipa_inline().
|
static |
Inline NODE to all callers. Worker for cgraph_for_node_and_aliases. DATA points to number of calls originally found so we avoid infinite recursion.
References cgraph_edge::caller, cgraph_node::callers, can_inline_edge_by_limits_p(), can_inline_edge_p(), CAN_INLINE_REPORT, dump_file, symtab_node::dump_name(), inline_call(), cgraph_node::inlined_to, ipa_size_summaries, NULL, num_calls(), cgraph_edge::recursive_p(), and cgraph_node::ultimate_alias_target().
Referenced by inline_to_all_callers().
|
inline |
Determine time saved by inlining EDGE of frequency FREQ where callee's runtime w/o inlining is UNINLINED_TYPE and with inlined is INLINED_TYPE.
References gcc_checking_assert, and ipa_call_summaries.
Referenced by edge_badness().
|
static |
Decide on the inlining. We do so in the topological order to avoid expenses on updating data structures.
References symbol_table::add_cgraph_removal_hook(), symtab_node::alias, symtab_node::aux, cgraph_node::call_for_symbol_and_aliases(), cgraph_node::callees, symbol_table::cgraph_count, hash_set< KeyId, Lazy, Traits >::contains(), symtab_node::decl, DECL_ATTRIBUTES, symtab_node::definition, dump_enabled_p(), dump_file, dump_inline_stats(), symtab_node::dump_name(), dump_overall_stats(), dump_printf(), flatten_function(), flatten_remove_node_hook(), FOR_EACH_DEFINED_FUNCTION, FOR_EACH_FUNCTION, free(), gcc_assert, i, cgraph_node::indirect_calls, initialize_inline_failed(), inline_small_functions(), inline_to_all_callers(), cgraph_node::inlined_to, profile_count::ipa(), ipa_dump_fn_summaries(), ipa_reverse_postorder(), IPA_SSA, IPA_SSA_AFTER_INLINING, ipa_update_overall_fn_summary(), lookup_attribute(), MSG_NOTE, ncalls_inlined, cgraph_edge::next_callee, nfunctions_inlined, NULL, num_calls(), opt_for_fn, symtab_node::order, symbol_table::remove_cgraph_removal_hook(), symbol_table::remove_unreachable_nodes(), reset_edge_caches(), cgraph_edge::resolve_speculation(), spec_rem, speculation_useful_p(), symbol_table::state, sum_callers(), symtab, TODO_remove_functions, want_inline_function_to_all_callers_p(), and profile_count::zero().
|
static |
Enqueue all recursive calls from NODE into priority queue depending on how likely we want to recursively inline the call.
References AVAIL_INTERPOSABLE, b, cgraph_edge::callee, cgraph_node::callees, cgraph_edge::caller, cgraph_edge::inline_failed, fibonacci_heap< K, V >::insert(), lookup_recursive_calls(), cgraph_edge::next_callee, cgraph_edge::sreal_frequency(), and cgraph_node::ultimate_alias_target().
Referenced by lookup_recursive_calls(), and recursive_inlining().
gimple_opt_pass * make_pass_early_inline | ( | gcc::context * | ctxt | ) |
ipa_opt_pass_d * make_pass_ipa_inline | ( | gcc::context * | ctxt | ) |
|
static |
Return number of calls in N. Ignore cheap builtins.
References cgraph_edge::callee, cgraph_node::callees, symtab_node::decl, is_inexpensive_builtin(), and cgraph_edge::next_callee.
Referenced by compute_control_dep_chain(), compute_control_dep_chain(), compute_control_dep_chain_pdom(), inline_small_functions(), inline_to_all_callers_1(), ipa_inline(), sum_callers(), vectorizable_simd_clone_call(), and want_early_inline_function_p().
|
static |
Decide on recursive inlining: in the case function has recursive calls, inline until body size reaches given argument. If any new indirect edges are discovered in the process, add them to *NEW_EDGES, unless NEW_EDGES is NULL.
References b, cgraph_edge::callee, cgraph_node::callees, cgraph_edge::caller, cgraph_node::callers, can_inline_edge_by_limits_p(), can_inline_edge_p(), CAN_INLINE_FORCE_LIMITS, CAN_INLINE_REPORT, clone_inlined_nodes(), cgraph_edge::count, cgraph_node::count, cgraph_node::create_clone(), symtab_node::decl, DECL_DECLARED_INLINE_P, dump_enabled_p(), dump_file, symtab_node::dump_name(), dump_printf_loc(), edge_growth_cache, fibonacci_heap< K, V >::empty(), estimate_size_after_inlining(), fibonacci_heap< K, V >::extract_min(), symbol_table::first_function(), profile_count::initialized_p(), inline_call(), cgraph_edge::inline_failed, cgraph_node::inlined_to, ipa_fn_summaries, ipa_size_summaries, lookup_recursive_calls(), sreal::min(), MSG_NOTE, symtab_node::next, cgraph_edge::next_callee, symbol_table::next_function(), profile_count::nonzero_p(), NULL, opt_for_fn, overall_size, cgraph_edge::redirect_callee(), cgraph_node::remove(), reset_node_cache(), symtab, profile_count::to_gcov_type(), cgraph_node::ultimate_alias_target(), vNULL, and want_inline_self_recursive_call_p().
Referenced by inline_small_functions().
|
static |
Dump info about why inlining has failed.
References cgraph_edge::call_stmt, cgraph_edge::callee, cgraph_edge::caller, cgraph_inline_failed_string(), symtab_node::decl, dump_enabled_p(), dump_file, dump_printf_loc(), lto_file_decl_data::file_name, cgraph_edge::inline_failed, symtab_node::lto_file_data, MSG_MISSED_OPTIMIZATION, opts_for_fn(), target_opts_for_fn(), and cgraph_node::ultimate_alias_target().
Referenced by can_inline_edge_by_limits_p(), can_inline_edge_p(), inline_small_functions(), update_callee_keys(), update_caller_keys(), want_early_inline_function_p(), and want_inline_small_function_p().
|
static |
NODE was inlined. All caller edges needs to be reset because size estimates change. Similarly callees needs reset because better context may be known.
References cgraph_edge::callee, cgraph_node::callees, cgraph_edge::caller, cgraph_node::callers, dyn_cast(), edge_growth_cache, FOR_EACH_ALIAS, cgraph_edge::inline_failed, cgraph_node::inlined_to, cgraph_edge::next_callee, cgraph_edge::next_caller, NULL, ipa_ref::referring, reset_edge_caches(), and reset_node_cache().
Referenced by inline_small_functions(), ipa_inline(), reset_edge_caches(), and resolve_noninline_speculation().
|
static |
We know that EDGE is not going to be inlined. See if we can remove speculation.
References cgraph_node::inlined_to, profile_count::ipa(), ipa_update_overall_fn_summary(), NULL, reset_edge_caches(), cgraph_edge::resolve_speculation(), spec_rem, speculation_useful_p(), update_callee_keys(), and update_caller_keys().
Referenced by inline_small_functions().
|
static |
bool speculation_useful_p | ( | struct cgraph_edge * | e, |
bool | anticipate_inlining ) |
Return true if speculation of edge E seems useful. If ANTICIPATE_INLINING is true, be conservative and hope that E may get inlined.
References AVAIL_AVAILABLE, cgraph_edge::callee, cgraph_edge::caller, CAN_INLINE_DISREGARD_LIMITS, can_inline_edge_by_limits_p(), can_inline_edge_p(), symtab_node::decl, ECF_CONST, cgraph_indirect_call_info::ecf_flags, ECF_PURE, flags_from_decl_or_type(), gcc_assert, cgraph_edge::indirect_info, cgraph_edge::indirect_unknown_callee, cgraph_edge::inline_failed, cgraph_node::local, cgraph_edge::maybe_hot_p(), cgraph_edge::speculative, cgraph_edge::speculative_call_indirect_edge(), and cgraph_node::ultimate_alias_target().
Referenced by check_speculations_1(), inline_small_functions(), ipa_inline(), and resolve_noninline_speculation().
|
static |
Count number of callers of NODE and store it into DATA (that points to int. Worker for cgraph_for_node_and_aliases.
References cgraph_node::callers, cgraph_edge::next_caller, and num_calls().
Referenced by inline_small_functions(), and ipa_inline().
|
static |
Recompute HEAP nodes for each uninlined call in NODE If UPDATE_SINCE is non-NULL check if edges called within that function are inlinable (typically UPDATE_SINCE is the inline clone we introduced where all edges have new context). This is used when we know that edge badnesses are going only to increase (we introduced new call site) and thus all we need is to insert newly created edges into heap.
References cgraph_edge::aux, AVAIL_AVAILABLE, bitmap_bit_p, cgraph_edge::callee, cgraph_node::callees, cgraph_edge::caller, cgraph_node::callers, can_inline_edge_by_limits_p(), can_inline_edge_p(), fibonacci_heap< K, V >::delete_node(), gcc_checking_assert, cgraph_node::get_uid(), cgraph_edge::inline_failed, ipa_fn_summaries, cgraph_edge::next_callee, NULL, report_inline_failed_reason(), cgraph_node::ultimate_alias_target(), update_edge_key(), and want_inline_small_function_p().
Referenced by inline_small_functions(), and resolve_noninline_speculation().
|
static |
Recompute HEAP nodes for each of caller of NODE. UPDATED_NODES track nodes we already visited, to avoid redundant work. When CHECK_INLINABLITY_FOR is set, re-check for specified edge that it is inlinable. Otherwise check all edges.
References symtab_node::alias, bitmap_set_bit, cgraph_node::callers, can_inline_edge_by_limits_p(), can_inline_edge_p(), fibonacci_heap< K, V >::delete_node(), dyn_cast(), FOR_EACH_ALIAS, cgraph_node::get_uid(), cgraph_node::inlined_to, ipa_fn_summaries, cgraph_edge::next_caller, NULL, ipa_ref::referring, report_inline_failed_reason(), update_caller_keys(), update_edge_key(), and want_inline_small_function_p().
Referenced by inline_small_functions(), resolve_noninline_speculation(), and update_caller_keys().
|
inlinestatic |
Recompute badness of EDGE and update its key in HEAP if needed.
References b, fibonacci_heap< K, V >::decrease_key(), dump_file, dump_flags, edge_badness(), gcc_checking_assert, fibonacci_node< K, V >::get_data(), fibonacci_node< K, V >::get_key(), fibonacci_heap< K, V >::insert(), TDF_DETAILS, and sreal::to_double().
Referenced by inline_small_functions(), update_callee_keys(), and update_caller_keys().
|
static |
Return true if we are interested in inlining small function.
References afdo_callsite_hot_enough_for_early_inline(), cgraph_edge::call_stmt, cgraph_edge::callee, cgraph_edge::caller, symtab_node::decl, DECL_DECLARED_INLINE_P, DECL_DISREGARD_INLINE_LIMITS, dump_enabled_p(), dump_printf_loc(), estimate_edge_growth(), estimate_min_edge_growth(), cgraph_edge::inline_failed, cgraph_edge::maybe_hot_p(), MSG_MISSED_OPTIMIZATION, num_calls(), opt_for_fn, report_inline_failed_reason(), and cgraph_node::ultimate_alias_target().
Referenced by early_inline_small_functions().
|
static |
Decide if inlining NODE would reduce unit size by eliminating the offline copy of function. When COLD is true the cold calls are considered, too.
References symtab_node::alias, cgraph_node::call_for_symbol_and_aliases(), check_callers(), growth_positive_p(), has_caller_p(), cgraph_node::inlined_to, INT_MIN, and NULL.
Referenced by ipa_inline().
|
static |
EDGE is self recursive edge. We handle two cases - when function A is inlining into itself or when function A is being inlined into another inliner copy of function A within function B. In first case OUTER_NODE points to the toplevel copy of A, while in the second case OUTER_NODE points to the outermost copy of A in B. In both cases we want to be extra selective since inlining the call will just introduce new recursive calls to appear.
References cgraph_node::callers, can_inline_edge_by_limits_p(), CAN_INLINE_FORCE_LIMITS, CAN_INLINE_REPORT, symtab_node::decl, DECL_DECLARED_INLINE_P, dump_enabled_p(), dump_printf_loc(), i, cgraph_node::inlined_to, MSG_MISSED_OPTIMIZATION, NULL, opt_for_fn, and cgraph_edge::sreal_frequency().
Referenced by inline_small_functions(), and recursive_inlining().
|
static |
Return true if we are interested in inlining small function. When REPORT is true, report reason to dump file.
References big_speedup_p(), cgraph_edge::callee, cgraph_edge::caller, cgraph_inline_failed_type(), CIF_FINAL_ERROR, cgraph_edge::count, symtab_node::decl, DECL_DECLARED_INLINE_P, DECL_DISREGARD_INLINE_LIMITS, estimate_edge_growth(), estimate_edge_hints(), growth_positive_p(), profile_count::initialized_p(), cgraph_edge::inline_failed, INLINE_HINT_builtin_constant_p, INLINE_HINT_indirect_call, INLINE_HINT_known_hot, INLINE_HINT_loop_iterations, INLINE_HINT_loop_stride, inline_insns_auto(), inline_insns_single(), cgraph_node::inlined_to, profile_count::ipa(), ipa_call_summaries, ipa_fn_summaries, cgraph_edge::maybe_hot_p(), profile_count::nonzero_p(), opt_for_fn, report_inline_failed_reason(), and cgraph_node::ultimate_alias_target().
Referenced by add_new_edges_to_heap(), inline_small_functions(), update_callee_keys(), and update_caller_keys().
|
static |
Return true if WHERE of SIZE is a possible candidate for wrapper heuristics in estimate_edge_badness.
References symtab_node::decl, DECL_DECLARED_INLINE_P, inline_insns_auto(), and inline_insns_single().
Referenced by edge_badness(), and inline_small_functions().
|
static |
Referenced by autofdo::afdo_annotate_cfg(), autofdo::afdo_set_bb_count(), dump_inline_stats(), and inline_small_functions().
|
static |
Statistics we collect about inlining algorithm.
Referenced by inline_small_functions(), and recursive_inlining().
|
static |
Referenced by dump_inline_stats(), ipa_inline(), and resolve_noninline_speculation().