GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple.h"
#include "alloc-pool.h"
#include "tree-pass.h"
#include "ssa.h"
#include "tree-streamer.h"
#include "cgraph.h"
#include "diagnostic.h"
#include "fold-const.h"
#include "print-tree.h"
#include "tree-inline.h"
#include "gimple-pretty-print.h"
#include "cfganal.h"
#include "gimple-iterator.h"
#include "tree-cfg.h"
#include "tree-ssa-loop-niter.h"
#include "tree-ssa-loop.h"
#include "symbol-summary.h"
#include "sreal.h"
#include "ipa-cp.h"
#include "ipa-prop.h"
#include "ipa-fnsummary.h"
#include "ipa-inline.h"
#include "cfgloop.h"
#include "tree-scalar-evolution.h"
#include "ipa-utils.h"
#include "cfgexpand.h"
#include "gimplify.h"
#include "attribs.h"
Data Structures | |
class | node_context_cache_entry |
class | node_context_summary |
struct | growth_data |
Functions | |
void | initialize_inline_failed (struct cgraph_edge *e) |
void | initialize_growth_caches () |
void | free_growth_caches (void) |
int | simple_edge_hints (struct cgraph_edge *edge) |
sreal | do_estimate_edge_time (struct cgraph_edge *edge, sreal *ret_nonspec_time) |
void | reset_node_cache (struct cgraph_node *node) |
void | ipa_remove_from_growth_caches (struct cgraph_edge *edge) |
int | do_estimate_edge_size (struct cgraph_edge *edge) |
ipa_hints | do_estimate_edge_hints (struct cgraph_edge *edge) |
int | estimate_size_after_inlining (struct cgraph_node *node, struct cgraph_edge *edge) |
static bool | do_estimate_growth_1 (struct cgraph_node *node, void *data) |
static int | offline_size (struct cgraph_node *node, ipa_size_summary *info) |
int | estimate_growth (struct cgraph_node *node) |
static bool | check_callers (cgraph_node *node, int *growth, int *n, int offline, int min_size, struct cgraph_edge *known_edge) |
bool | growth_positive_p (struct cgraph_node *node, struct cgraph_edge *known_edge, int edge_growth) |
Variables | |
fast_call_summary< edge_growth_cache_entry *, va_heap > * | edge_growth_cache = NULL |
static fast_function_summary< node_context_summary *, va_heap > * | node_context_cache = NULL |
static long | node_context_cache_hit |
static long | node_context_cache_miss |
static long | node_context_cache_clear |
|
static |
Verify if there are fewer than MAX_CALLERS.
References ipa_call_summary::call_stmt_size, cgraph_node::callers, cgraph_node::can_remove_if_no_direct_calls_and_refs_p(), cgraph_inline_failed_type(), check_callers(), CIF_FINAL_ERROR, dyn_cast(), edge_growth_cache, FOR_EACH_ALIAS, growth_data::growth, ipa_call_summaries, cgraph_edge::next_caller, growth_data::node, NULL, ipa_ref::referring, and edge_growth_cache_entry::size.
Referenced by check_callers(), growth_positive_p(), and want_inline_function_to_all_callers_p().
ipa_hints do_estimate_edge_hints | ( | struct cgraph_edge * | edge | ) |
Estimate the growth of the caller when inlining EDGE. Only to be called via estimate_edge_size.
References do_estimate_edge_time(), edge_growth_cache, ipa_call_context::estimate_size_and_time(), evaluate_properties_for_edge(), gcc_checking_assert, ipa_call_estimates::hints, NULL, simple_edge_hints(), and vNULL.
Referenced by estimate_edge_hints().
int do_estimate_edge_size | ( | struct cgraph_edge * | edge | ) |
Return estimated callee growth after inlining EDGE. Only to be called via estimate_edge_size.
References do_estimate_edge_time(), edge_growth_cache, ipa_call_context::estimate_size_and_time(), evaluate_properties_for_edge(), gcc_checking_assert, NULL, ipa_call_estimates::size, and vNULL.
Referenced by estimate_edge_size().
sreal do_estimate_edge_time | ( | struct cgraph_edge * | edge, |
sreal * | ret_nonspec_time ) |
Estimate the time cost for the caller when inlining EDGE. Only to be called via estimate_edge_time, that handles the caching mechanism. When caching, also update the cache entry. Compute both time and size, since we always need both metrics eventually.
References cgraph_node::count, node_context_cache_entry::ctx, symtab_node::decl, DECL_ATTRIBUTES, ipa_cached_call_context::duplicate_from(), edge_growth_cache, node_context_summary::entry, ipa_call_context::equal_to(), ipa_call_context::estimate_size_and_time(), evaluate_properties_for_edge(), ipa_call_context::exists_p(), gcc_assert, gcc_checking_assert, edge_growth_cache_entry::hints, ipa_call_estimates::hints, node_context_cache_entry::hints, INLINE_HINT_known_hot, ipa_call_summaries, ipa_fn_summaries, profile_count::ipa_p(), lookup_attribute(), node_context_cache, node_context_cache_clear, node_context_cache_hit, node_context_cache_miss, edge_growth_cache_entry::nonspec_time, node_context_cache_entry::nonspec_time, ipa_call_estimates::nonspecialized_time, NULL, opt_for_fn, ipa_call_summary::param, ipa_cached_call_context::release(), simple_edge_hints(), edge_growth_cache_entry::size, ipa_call_estimates::size, node_context_cache_entry::size, edge_growth_cache_entry::time, ipa_call_estimates::time, and node_context_cache_entry::time.
Referenced by do_estimate_edge_hints(), do_estimate_edge_size(), and estimate_edge_time().
|
static |
Worker for do_estimate_growth. Collect growth for all callers.
References cgraph_edge::caller, cgraph_node::callers, growth_data::cap, cgraph_inline_failed_type(), CIF_FINAL_ERROR, symtab_node::decl, estimate_edge_growth(), gcc_checking_assert, growth_data::growth, cgraph_edge::inline_failed, INT_MAX, cgraph_edge::next_caller, growth_data::node, opt_for_fn, cgraph_edge::recursive_p(), growth_data::self_recursive, and growth_data::uninlinable.
Referenced by estimate_growth(), and growth_positive_p().
int estimate_growth | ( | struct cgraph_node * | node | ) |
Estimate the growth caused by inlining NODE into all callers.
References cgraph_node::call_for_symbol_and_aliases(), do_estimate_growth_1(), growth_data::growth, INT_MAX, ipa_size_summaries, growth_data::node, offline_size(), growth_data::self_recursive, ipa_size_summary::size, and growth_data::uninlinable.
Referenced by edge_badness(), and inline_small_functions().
int estimate_size_after_inlining | ( | struct cgraph_node * | node, |
struct cgraph_edge * | edge ) |
Estimate the size of NODE after inlining EDGE which should be an edge to either NODE or a call inlined into NODE.
References estimate_edge_growth(), gcc_assert, ipa_call_summaries, ipa_size_summaries, ipa_call_summary::predicate, and ipa_size_summary::size.
Referenced by caller_growth_limits(), check_callers(), and recursive_inlining().
void free_growth_caches | ( | void | ) |
Free growth caches.
References dump_file, edge_growth_cache, node_context_cache, node_context_cache_clear, node_context_cache_hit, node_context_cache_miss, and NULL.
Referenced by inline_small_functions().
bool growth_positive_p | ( | struct cgraph_node * | node, |
struct cgraph_edge * | known_edge, | ||
int | edge_growth ) |
Decide if growth of NODE is positive. This is cheaper than calculating actual growth. If edge growth of KNOWN_EDGE is known it is passed by EDGE_GROWTH.
References cgraph_node::call_for_symbol_and_aliases(), ipa_call_summary::call_stmt_size, cgraph_node::callers, cgraph_inline_failed_type(), check_callers(), CIF_FINAL_ERROR, do_estimate_growth_1(), dyn_cast(), edge_growth_cache, FOR_EACH_ALIAS, growth_data::growth, cgraph_edge::inline_failed, ipa_call_summaries, ipa_fn_summaries, ipa_size_summaries, cgraph_edge::next_caller, growth_data::node, NULL, offline_size(), ipa_ref::referring, growth_data::self_recursive, edge_growth_cache_entry::size, and growth_data::uninlinable.
Referenced by want_inline_function_to_all_callers_p(), and want_inline_small_function_p().
void initialize_growth_caches | ( | ) |
Allocate edge growth caches.
References edge_growth_cache, node_context_cache, and symtab.
Referenced by inline_small_functions().
void initialize_inline_failed | ( | struct cgraph_edge * | e | ) |
Give initial reasons why inlining would fail on EDGE. This gets either nullified or usually overwritten by more precise reasons later.
References cgraph_edge::call_stmt_cannot_inline_p, cgraph_edge::callee, cgraph_inline_failed_type(), CIF_FINAL_ERROR, symtab_node::definition, gcc_checking_assert, cgraph_edge::indirect_unknown_callee, cgraph_edge::inline_failed, and cgraph_node::redefined_extern_inline.
Referenced by cgraph_node::create_edge(), cgraph_node::create_indirect_edge(), ipa_inline(), cgraph_edge::make_direct(), and cgraph_edge::make_speculative().
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().
|
static |
Return estimated savings for eliminating offline copy of NODE by inlining it everywhere.
References cgraph_node::can_remove_if_no_direct_calls_p(), symtab_node::decl, DECL_COMDAT, DECL_EXTERNAL, growth_data::node, opt_for_fn, ipa_size_summary::size, and cgraph_node::will_be_removed_from_program_if_no_direct_calls_p().
Referenced by estimate_growth(), and growth_positive_p().
void reset_node_cache | ( | struct cgraph_node * | node | ) |
Reset cache for NODE. This must be done each time NODE body is modified.
References node_context_cache.
Referenced by inline_small_functions(), recursive_inlining(), and reset_edge_caches().
int simple_edge_hints | ( | struct cgraph_edge * | edge | ) |
Return hints derived from EDGE.
References cross_module_call_p(), INLINE_HINT_cross_module, INLINE_HINT_same_scc, and ipa_fn_summaries.
Referenced by do_estimate_edge_hints(), and do_estimate_edge_time().
fast_call_summary<edge_growth_cache_entry *, va_heap>* edge_growth_cache = NULL |
Analysis used by inlining decision heuristics. Copyright (C) 2003-2025 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/>.
Cached node/edge growths.
Referenced by check_callers(), do_estimate_edge_hints(), do_estimate_edge_size(), do_estimate_edge_time(), estimate_edge_hints(), estimate_edge_size(), estimate_edge_time(), free_growth_caches(), growth_positive_p(), initialize_growth_caches(), inline_small_functions(), ipa_remove_from_growth_caches(), recursive_inlining(), and reset_edge_caches().
|
static |
Summary holding the context cache.
Referenced by do_estimate_edge_time(), free_growth_caches(), initialize_growth_caches(), ipa_remove_from_growth_caches(), and reset_node_cache().
|
static |
Referenced by do_estimate_edge_time(), and free_growth_caches().
|
static |
Statistics about the context cache effectivity.
Referenced by do_estimate_edge_time(), and free_growth_caches().
|
static |
Referenced by do_estimate_edge_time(), and free_growth_caches().