GCC Middle and Back End API Reference
|
Go to the source code of this file.
Data Structures | |
struct | condition |
struct | predicate |
struct | size_time_entry |
struct | inline_summary |
struct | inline_param_summary |
struct | inline_edge_summary |
struct | edge_growth_cache_entry |
Typedefs | |
typedef struct condition | condition |
typedef int | inline_hints |
typedef vec< condition, va_gc > * | conditions |
typedef unsigned int | clause_t |
typedef struct size_time_entry | size_time_entry |
typedef struct inline_summary | inline_summary_t |
typedef struct inline_param_summary | inline_param_summary_t |
typedef struct inline_edge_summary | inline_edge_summary_t |
typedef struct edge_growth_cache_entry | edge_growth_cache_entry |
Enumerations | |
enum | inline_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_array_index = 128 } |
Variables | |
vec< inline_summary_t, va_gc > * | inline_summary_vec |
vec< inline_edge_summary_t > | inline_edge_summary_vec |
vec< int > | node_growth_cache |
vec< edge_growth_cache_entry > | edge_growth_cache |
int | ncalls_inlined |
int | nfunctions_inlined |
typedef unsigned int clause_t |
@verbatim Inlining decision heuristics.
Copyright (C) 2003-2013 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/.
Representation of inline parameters that do depend on context function is inlined into (i.e. known constant values of function parameters. Conditions that are interesting for function body are collected into CONDS vector. They are of simple for function_param OP VAL, where VAL is IPA invariant. The conditions are then referred by predicates.
typedef vec<condition, va_gc>* conditions |
typedef struct edge_growth_cache_entry edge_growth_cache_entry |
typedef struct inline_edge_summary inline_edge_summary_t |
typedef int inline_hints |
typedef struct inline_param_summary inline_param_summary_t |
typedef struct inline_summary inline_summary_t |
typedef struct size_time_entry size_time_entry |
enum inline_hints_vals |
Inline hints are reasons why inline heuristics should preffer inlining given function. They are represtented as bitmap of the following values.
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.
References cgraph_edge::callee, cgraph_node::callees, cgraph_edge::caller, cgraph_node::callers, can_remove_node_now_p(), cgraph_clone_node(), cgraph_redirect_edge_callee(), cgraph_resolve_speculation(), clone_inlined_nodes(), cgraph_edge::count, symtab_node_base::decl, symtab_node_base::definition, symtab_node_base::externally_visible, cgraph_edge::frequency, cgraph_node::global, cgraph_edge::inline_failed, inline_summary(), cgraph_global_info::inlined_to, cgraph_edge::next_callee, cgraph_edge::next_caller, nfunctions_inlined, inline_summary::size, speculation_removed, speculation_useful_p(), cgraph_edge::speculative, cgraph_node::symbol, symtab_dissolve_same_comdat_group_list(), update_noncloned_frequencies(), and vNULL.
Referenced by clone_inlined_nodes(), inline_call(), and recursive_inlining().
void compute_inline_parameters | ( | struct cgraph_node * | , |
bool | |||
) |
void debug_inline_summary | ( | struct cgraph_node * | ) |
In ipa-inline-analysis.c
inline_hints do_estimate_edge_hints | ( | struct cgraph_edge * | edge | ) |
int do_estimate_edge_size | ( | struct cgraph_edge * | edge | ) |
int do_estimate_edge_time | ( | struct cgraph_edge * | edge | ) |
int do_estimate_growth | ( | struct cgraph_node * | ) |
void dump_inline_hints | ( | FILE * | f, |
inline_hints | |||
) |
void dump_inline_summaries | ( | FILE * | f | ) |
void dump_inline_summary | ( | FILE * | f, |
struct cgraph_node * | node | ||
) |
|
inlinestatic |
Return estimated callee growth after inlining EDGE.
References inline_edge_summary::call_stmt_size, and estimate_edge_size().
Referenced by do_estimate_growth_1(), edge_badness(), estimate_size_after_inlining(), inline_call(), inline_small_functions(), want_early_inline_function_p(), and want_inline_small_function_p().
|
inlinestatic |
Return estimated callee runtime increase after inlning EDGE.
References do_estimate_edge_hints(), edge_growth_cache, and cgraph_edge::uid.
Referenced by edge_badness(), and want_inline_small_function_p().
|
inlinestatic |
Return estimated size of the inline sequence of EDGE.
References do_estimate_edge_size(), edge_growth_cache, and cgraph_edge::uid.
Referenced by estimate_edge_growth().
|
inlinestatic |
Return estimated callee runtime increase after inlning EDGE.
References do_estimate_edge_time(), edge_growth_cache, and cgraph_edge::uid.
Referenced by big_speedup_p(), edge_badness(), and estimate_time_after_inlining().
|
inlinestatic |
Return estimated unit growth after inlning all calls to NODE. Quick accesors to the inline growth caches. For convenience we keep zero 0 as unknown. Because growth can be both positive and negative, we simply increase positive growths by 1.
References do_estimate_growth(), node_growth_cache, and cgraph_node::uid.
Referenced by edge_badness(), inline_small_functions(), want_inline_function_to_all_callers_p(), and want_inline_small_function_p().
void estimate_ipcp_clone_size_and_time | ( | struct cgraph_node * | node, |
vec< tree > | known_vals, | ||
vec< tree > | known_binfos, | ||
vec< ipa_agg_jump_function_p > | known_aggs, | ||
int * | ret_size, | ||
int * | ret_time, | ||
inline_hints * | hints | ||
) |
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_BINFOS are vectors of assumed known constant values and types for parameters.
References estimate_node_size_and_time(), evaluate_conditions_for_known_args(), and vNULL.
Referenced by estimate_local_effects().
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(), false_predicate_p(), inline_edge_summary(), inline_summary(), inline_edge_summary::predicate, and inline_summary::size.
Referenced by caller_growth_limits(), and recursive_inlining().
int estimate_time_after_inlining | ( | struct cgraph_node * | node, |
struct cgraph_edge * | edge | ||
) |
Estimate self time of the function NODE after inlining EDGE.
References estimate_edge_time(), false_predicate_p(), inline_edge_summary(), inline_summary(), inline_edge_summary::predicate, and inline_summary::time.
void free_growth_caches | ( | void | ) |
Free growth caches.
Referenced by inline_small_functions().
void initialize_growth_caches | ( | void | ) |
Initialize growth caches.
References cgraph_edge_max_uid, and cgraph_max_uid.
Referenced by inline_small_functions().
void initialize_inline_failed | ( | struct cgraph_edge * | ) |
bool inline_call | ( | struct cgraph_edge * | e, |
bool | update_original, | ||
vec< cgraph_edge_p > * | new_edges, | ||
int * | overall_size, | ||
bool | update_overall_summary | ||
) |
In ipa-inline-transform.c
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 inline_update_overall_summary. Return true iff any new callgraph edges were discovered as a result of inlining.
References cgraph_edge::callee, cgraph_edge::caller, cgraph_node::callers, can_remove_node_now_p(), cgraph_alias_target(), cgraph_function_or_thunk_node(), cgraph_redirect_edge_callee(), cgraph_remove_node(), clone_inlined_nodes(), symtab_node_base::decl, estimate_edge_growth(), cgraph_node::global, inline_edge_summary(), cgraph_edge::inline_failed, inline_merge_summary(), inline_summary(), inline_update_overall_summary(), cgraph_global_info::inlined_to, ipa_propagate_indirect_call_infos(), ncalls_inlined, inline_edge_summary::predicate, inline_summary::size, speculation_removed, and cgraph_node::symbol.
Referenced by early_inline_small_functions(), flatten_function(), inline_always_inline_functions(), inline_small_functions(), ipa_inline(), and recursive_inlining().
|
staticread |
References inline_edge_summary_vec, and cgraph_edge::uid.
Referenced by compute_inline_parameters(), do_estimate_edge_time(), dump_inline_edge_summary(), early_inliner(), edge_set_predicate(), estimate_calls_size_and_time(), estimate_edge_size_and_time(), estimate_function_body_sizes(), estimate_size_after_inlining(), estimate_time_after_inlining(), evaluate_properties_for_edge(), inline_call(), inline_edge_duplication_hook(), inline_merge_summary(), inline_node_duplication_hook(), inline_update_callee_summaries(), ipa_make_edge_direct_to_target(), read_inline_edge_summary(), remap_edge_change_prob(), remap_edge_summaries(), reset_inline_edge_summary(), verify_edge_count_and_frequency(), and write_inline_edge_summary().
void inline_free_summary | ( | void | ) |
Release inline summary.
References cgraph_remove_edge_duplication_hook(), cgraph_remove_edge_removal_hook(), cgraph_remove_function_insertion_hook(), cgraph_remove_node_duplication_hook(), cgraph_remove_node_removal_hook(), free_alloc_pool(), reset_inline_summary(), and vec_free().
Referenced by free_inline_summary(), inline_generate_summary(), and ipa_inline().
void inline_generate_summary | ( | void | ) |
Note function body size.
References add_new_function(), symtab_node_base::alias, cgraph_add_function_insertion_hook(), inline_analyze_function(), inline_free_summary(), ipa_register_cgraph_hooks(), and cgraph_node::symbol.
void inline_merge_summary | ( | struct cgraph_edge * | edge | ) |
void inline_read_summary | ( | void | ) |
Read inline summary. Jump functions are shared among ipa-cp and inliner, so when ipa-cp is active, we don't need to write them twice.
References add_new_function(), cgraph_add_function_insertion_hook(), fatal_error(), inline_read_section(), inline_summary_alloc(), ipa_prop_read_jump_functions(), ipa_register_cgraph_hooks(), len, lto_get_file_decl_data(), lto_get_section_data(), and LTO_section_inline_summary.
|
staticread |
References cgraph_node::uid.
Referenced by caller_growth_limits(), clone_inlined_nodes(), compute_inline_parameters(), compute_inlined_call_time(), compute_uninlined_call_time(), devirtualization_time_bonus(), do_estimate_growth(), dump_inline_summary(), edge_badness(), estimate_edge_devirt_benefit(), estimate_function_body_sizes(), estimate_local_effects(), estimate_node_size_and_time(), estimate_size_after_inlining(), estimate_time_after_inlining(), evaluate_conditions_for_known_args(), evaluate_properties_for_edge(), execute_split_functions(), inline_call(), inline_merge_summary(), inline_node_duplication_hook(), inline_node_removal_hook(), inline_read_section(), inline_small_functions(), inline_update_callee_summaries(), inline_update_overall_summary(), inline_write_summary(), ipcp_propagate_stage(), reset_inline_summary(), and simple_edge_hints().
unsigned int inline_transform | ( | struct cgraph_node * | ) |
void inline_update_overall_summary | ( | struct cgraph_node * | node | ) |
void inline_write_summary | ( | void | ) |
Write inline summary for node in SET. Jump functions are shared among ipa-cp and inliner, so when ipa-cp is active, we don't need to write them twice.
References condition::agg_contents, symtab_node_base::alias, inline_summary::array_index, bitpack_create(), bp_pack_value(), condition::by_ref, inline_summary::conds, count, create_output_block(), output_block::decl_state, symtab_node_base::definition, destroy_output_block(), dyn_cast(), inline_summary::entry, inline_summary::estimated_self_stack_size, inline_summary::inlinable, inline_summary(), ipa_prop_write_jump_functions(), inline_summary::loop_iterations, inline_summary::loop_stride, LTO_section_inline_summary, lto_symtab_encoder_deref(), lto_symtab_encoder_encode(), lto_symtab_encoder_size(), output_block::main_stream, cgraph_edge::next_callee, condition::offset, condition::operand_num, size_time_entry::predicate, produce_asm(), inline_summary::self_size, inline_summary::self_time, size_time_entry::size, streamer_write_bitpack(), streamer_write_char_stream(), streamer_write_hwi(), streamer_write_uhwi(), cgraph_node::symbol, lto_out_decl_state::symtab_node_encoder, size_time_entry::time, condition::val, vec_safe_iterate(), vec_safe_length(), write_inline_edge_summary(), and write_predicate().
|
inlinestatic |
Reset cached value for EDGE.
References edge_growth_cache, and cgraph_edge::uid.
Referenced by inline_edge_removal_hook(), inline_small_functions(), recursive_inlining(), and reset_edge_caches().
|
inlinestatic |
Reset cached value for NODE.
References node_growth_cache, and cgraph_node::uid.
Referenced by heap_edge_removal_hook(), inline_small_functions(), ipa_inline(), and reset_edge_caches().
bool speculation_useful_p | ( | struct cgraph_edge * | e, |
bool | anticipate_inlining | ||
) |
vec<edge_growth_cache_entry> edge_growth_cache |
Referenced by estimate_edge_hints(), estimate_edge_size(), estimate_edge_time(), and reset_edge_growth_cache().
vec<inline_edge_summary_t> inline_edge_summary_vec |
vec<inline_summary_t, va_gc>* inline_summary_vec |
VECtor holding inline summaries. In GGC memory because conditions might point to constant trees.
Referenced by cgraph_process_new_functions().
int ncalls_inlined |
@verbatim Callgraph transformations to handle inlining
Copyright (C) 2003-2013 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().
vec<int> node_growth_cache |
Cached node/edge growths.
Referenced by estimate_growth(), and reset_node_growth_cache().