GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "function.h"
#include "tree.h"
#include "alloc-pool.h"
#include "tree-pass.h"
#include "cgraph.h"
#include "tree-cfg.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 "tree-inline.h"
#include "cfg.h"
#include "basic-block.h"
#include "ipa-utils.h"
#include "ipa-modref-tree.h"
#include "ipa-modref.h"
#include "symtab-thunks.h"
#include "symtab-clones.h"
Variables | |
int | ncalls_inlined |
int | nfunctions_inlined |
function_summary< tree * > * | ipa_saved_clone_sources |
|
static |
We are going to eliminate last direct call to NODE (or alias of it) via edge E. Verify that the NODE can be removed from unit and if it is contained in comdat group that the whole comdat group is removable.
References symtab_node::alias, can_remove_node_now_p_1(), dyn_cast(), symtab_node::externally_visible, symtab_node::next, and symtab_node::same_comdat_group.
Referenced by clone_inlined_nodes(), and inline_call().
|
static |
We removed or are going to remove the last call to NODE. Return true if we can and want proactively remove the NODE now. This is important to do, since we want inliner to know when offline copy of function was removed.
References symtab_node::address_taken, cgraph_node::callers, cgraph_node::can_remove_if_no_direct_calls_and_refs_p(), can_remove_node_now_p_1(), cgraph_new_nodes, symtab_node::decl, DECL_VIRTUAL_P, dyn_cast(), FOR_EACH_ALIAS, opt_for_fn, and ipa_ref::referring.
Referenced by can_remove_node_now_p(), and can_remove_node_now_p_1().
|
static |
Check all speculations in N and if any seem useless, resolve them and remove them from NEW_EDGES.
References check_speculations_1(), and push_all_edges_in_set_to_vec().
Referenced by inline_call().
|
static |
Check all speculations in N and if any seem useless, resolve them. When a first edge is resolved, pop all edges from NEW_EDGES and insert them to EDGE_SET. Then remove each resolved edge from EDGE_SET, if it is there.
References cgraph_node::callees, check_speculations_1(), symtab_node::next, NULL, cgraph_edge::resolve_speculation(), and speculation_useful_p().
Referenced by check_speculations(), and check_speculations_1().
void clone_inlined_nodes | ( | struct cgraph_edge * | e, |
bool | duplicate, | ||
bool | update_original, | ||
int * | overall_size ) |
E is expected to be an edge being inlined. Clone destination node of the edge and redirect it to the new clone. DUPLICATE is used for bookkeeping on whether we are actually creating new clones or re-using node originally representing out-of-line function call. By default the offline copy is removed, when it appears dead after inlining. UPDATE_ORIGINAL prevents this transformation. If OVERALL_SIZE is non-NULL, the size is updated to reflect the transformation.
References symtab_node::alias, cgraph_edge::callee, cgraph_node::callees, cgraph_edge::caller, cgraph_node::callers, can_remove_node_now_p(), clone_inlined_nodes(), cgraph_edge::count, cgraph_node::count, cgraph_node::create_clone(), symtab_node::decl, symtab_node::definition, dump_callgraph_transformation(), symtab_node::externally_visible, gcc_assert, inline_account_function_p(), cgraph_edge::inline_failed, cgraph_node::inlined_to, ipa_size_summaries, cgraph_node::ipa_transforms_to_apply, master_clone_with_noninline_clones_p(), symtab_node::next, cgraph_edge::next_callee, cgraph_edge::next_caller, nfunctions_inlined, NULL, overall_size, cgraph_edge::redirect_callee(), symtab_node::remove_from_same_comdat_group(), update_noncloned_counts(), cgraph_node::used_as_abstract_origin, and vNULL.
Referenced by clone_inlined_nodes(), inline_call(), and recursive_inlining().
bool inline_call | ( | struct cgraph_edge * | e, |
bool | update_original, | ||
vec< cgraph_edge * > * | new_edges, | ||
int * | overall_size, | ||
bool | update_overall_summary, | ||
bool * | callee_removed ) |
Mark edge E as inlined and update callgraph accordingly. UPDATE_ORIGINAL specify whether profile of original function should be updated. If any new indirect edges are discovered in the process, add them to NEW_EDGES, unless it is NULL. If UPDATE_OVERALL_SUMMARY is false, do not bother to recompute overall size of caller after inlining. Caller is required to eventually do it via ipa_update_overall_fn_summary. If callee_removed is non-NULL, set it to true if we removed callee node. Return true iff any new callgraph edges were discovered as a result of inlining.
References symtab_node::alias, build_optimization_node(), symbol_table::call_cgraph_insertion_hooks(), symbol_table::call_cgraph_removal_hooks(), cgraph_edge::callee, cgraph_node::callees, cgraph_edge::caller, cgraph_node::calls_comdat_local, can_remove_node_now_p(), cfun, cgraph_node::check_calls_comdat_local_p(), check_speculations(), clone_inlined_nodes(), symtab_node::comdat_local_p(), symtab_node::decl, DECL_FUNCTION_PERSONALITY, DECL_FUNCTION_SPECIFIC_OPTIMIZATION, DECL_POSSIBLY_INLINED, DECL_STRUCT_FUNCTION, dump_file, symtab_node::dump_name(), estimate_edge_growth(), expand_thunk(), ipa_fn_summary::fp_expressions, gcc_assert, thunk_info::get(), thunk_info::get_create(), cgraph_node::get_untransformed_body(), global_options, global_options_set, cgraph_edge::in_polymorphic_cdtor, inline_account_function_p(), cgraph_edge::inline_failed, cgraph_node::inlined_to, ipa_fn_summaries, ipa_merge_fn_summary_after_inlining(), ipa_merge_modref_summary_after_inlining(), ipa_propagate_indirect_call_infos(), ipa_size_summaries, ipa_update_overall_fn_summary(), mark_all_inlined_calls_cdtor(), ncalls_inlined, cgraph_edge::next_callee, cgraph_edge::next_caller, NULL, opt_for_fn, opts_for_fn(), overall_size, cgraph_edge::prev_caller, cgraph_edge::redirect_callee(), set_cfun(), symtab, cgraph_node::thunk, thunk_expansion, and cgraph_node::ultimate_alias_target().
Referenced by autofdo::afdo_indirect_call(), early_inline_small_functions(), flatten_function(), inline_always_inline_functions(), inline_small_functions(), inline_to_all_callers_1(), and recursive_inlining().
unsigned int inline_transform | ( | struct cgraph_node * | node | ) |
Apply inline plan to function.
References profile_count::adjust_for_ipa_scaling(), profile_count::apply_scale(), cgraph_node::callees, cfun, symtab_node::clear_stmts_in_references(), cgraph_node::clones, basic_block_def::count, cgraph_node::count, current_function_decl, symtab_node::decl, profile_count::dump(), dump_file, ENTRY_BLOCK_PTR_FOR_FN, execute_fixup_cfg(), FOR_ALL_BB_FN, profile_count::initialized_p(), cgraph_edge::inline_failed, cgraph_node::materialize_clone(), profile_count::max(), maybe_materialize_called_clones(), cgraph_edge::next_callee, cgraph_node::next_sibling_clone, opt_for_fn, optimize_inline_calls(), preserve_function_body_p(), cgraph_edge::redirect_call_stmt_to_callee(), symtab_node::remove_all_references(), save_inline_function_body(), timevar_pop(), timevar_push(), todo, TODO_update_ssa_any, TODO_update_ssa_only_virtuals, and profile_count::uninitialized().
|
static |
Mark all call graph edges coming out of NODE and all nodes that have been inlined to it as in_polymorphic_cdtor.
References cgraph_node::callees, cgraph_node::indirect_calls, mark_all_inlined_calls_cdtor(), and cgraph_edge::next_callee.
Referenced by inline_call(), and mark_all_inlined_calls_cdtor().
|
static |
Return true if NODE is a master clone with non-inline clones.
References cgraph_node::clone_of, cgraph_node::clones, symtab_node::decl, and cgraph_node::next_sibling_clone.
Referenced by clone_inlined_nodes().
|
static |
tree-inline can not recurse; materialize all function bodie we will need during inlining. This includes inlined functions, but also called functions with param manipulation because IPA param manipulation attaches debug statements to PARM_DECLs of called clone. Materialize them if needed. FIXME: This is somehwat broken by design because it does not play well with partitioning.
References cgraph_node::callees, cgraph_node::clone_of, cgraph_node::get(), clone_info::get(), cgraph_node::get_untransformed_body(), maybe_materialize_called_clones(), cgraph_edge::next_callee, and clone_info::param_adjustments.
Referenced by inline_transform(), and maybe_materialize_called_clones().
|
static |
Return true when function body of DECL still needs to be kept around for later re-use.
References symtab_node::alias, cgraph_node::clones, gcc_assert, symbol_table::global_info_ready, cgraph_node::next_sibling_clone, symtab, and cgraph_node::thunk.
Referenced by inline_transform().
bool push_all_edges_in_set_to_vec | ( | cgraph_edge *const & | e, |
vec< cgraph_edge * > * | new_edges ) |
Push E to NEW_EDGES. Called from hash_set traverse method, which unfortunately means this function has to have external linkage, otherwise the code will not compile with gcc 4.8.
Referenced by check_speculations().
|
static |
Copy function body of NODE and redirect all inline clones to it. This is done before inline plan is applied to NODE when there are still some inline clones if it. This is necessary because inline decisions are not really transitive and the other inline clones may have different bodies.
References cgraph_node::callers, cgraph_node::clone_of, cgraph_node::clones, copy_node(), symtab_node::decl, DECL_COMDAT, DECL_EXTERNAL, dump_file, symtab_node::dump_name(), cgraph_node::former_clone_of, function_summary(), gcc_assert, cgraph_node::get(), ipa_saved_clone_sources, cgraph_node::ipa_transforms_to_apply, cgraph_node::next_sibling_clone, NULL, cgraph_node::prev_sibling_clone, cgraph_node::remove_symbol_and_inline_clones(), symtab, cgraph_node::thunk, tree_function_versioning(), TREE_PUBLIC, and symtab_node::verify().
Referenced by inline_transform().
|
static |
Scale counts of NODE edges by NUM/DEN.
References profile_count::adjust_for_ipa_scaling(), profile_count::apply_scale(), cgraph_edge::callee, cgraph_node::callees, cgraph_edge::count, cgraph_node::count, cgraph_node::indirect_calls, cgraph_edge::inline_failed, cgraph_edge::next_callee, and update_noncloned_counts().
Referenced by clone_inlined_nodes(), and update_noncloned_counts().
function_summary<tree *>* ipa_saved_clone_sources |
For each node that was made the holder of function body by save_inline_function_body, this summary contains pointer to the previous holder of the body.
Referenced by expand_all_functions(), cgraph_edge::redirect_call_stmt_to_callee(), and save_inline_function_body().
int ncalls_inlined |
Callgraph transformations to handle inlining 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/>.
The inline decisions are stored in callgraph in "inline plan" and applied later. To mark given call inline, use inline_call function. The function marks the edge inlinable and, if necessary, produces virtual clone in the callgraph representing the new copy of callee's function body. The inline plan is applied on given function body by inline_transform.
Referenced by inline_call(), and ipa_inline().
int nfunctions_inlined |
Referenced by clone_inlined_nodes(), and ipa_inline().