GCC Middle and Back End API Reference
ipa-fnsummary.h File Reference
#include "sreal.h"
#include "ipa-predicate.h"
Include dependency graph for ipa-fnsummary.h:
This graph shows which files directly or indirectly include this file:

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
}
 

Functions

void ipa_debug_fn_summary (struct cgraph_node *)
 
void ipa_dump_fn_summaries (FILE *f)
 
void ipa_dump_fn_summary (FILE *f, struct cgraph_node *node)
 
void ipa_dump_hints (FILE *f, ipa_hints)
 
void ipa_free_fn_summary (void)
 
void ipa_free_size_summary (void)
 
void inline_analyze_function (struct cgraph_node *node)
 
void estimate_ipcp_clone_size_and_time (struct cgraph_node *node, ipa_auto_call_arg_values *avals, ipa_call_estimates *estimates)
 
void ipa_merge_fn_summary_after_inlining (struct cgraph_edge *edge)
 
void ipa_update_overall_fn_summary (struct cgraph_node *node, bool reset=true)
 
void compute_fn_summary (struct cgraph_node *, bool)
 
bool refs_local_or_readonly_memory_p (tree)
 
bool points_to_local_or_readonly_memory_p (tree)
 
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)
 
void ipa_fnsummary_cc_finalize (void)
 
HOST_WIDE_INT ipa_get_stack_frame_offset (struct cgraph_node *node)
 
void ipa_remove_from_growth_caches (struct cgraph_edge *edge)
 
bool cross_module_call_p (struct cgraph_edge *edge)
 

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 Documentation

◆ ipa_hints

typedef int ipa_hints

Enumeration Type Documentation

◆ 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.   
Enumerator
INLINE_HINT_indirect_call 
INLINE_HINT_loop_iterations 
INLINE_HINT_loop_stride 
INLINE_HINT_same_scc 
INLINE_HINT_in_scc 
INLINE_HINT_declared_inline 
INLINE_HINT_cross_module 
INLINE_HINT_known_hot 
INLINE_HINT_builtin_constant_p 

Function Documentation

◆ compute_fn_summary()

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().

◆ cross_module_call_p()

bool cross_module_call_p ( struct cgraph_edge * edge)
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().

◆ estimate_ipcp_clone_size_and_time()

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().

◆ evaluate_properties_for_edge()

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().

◆ inline_analyze_function()

◆ ipa_debug_fn_summary()

void ipa_debug_fn_summary ( struct cgraph_node * node)
In ipa-fnsummary.cc   

References ipa_dump_fn_summary().

◆ ipa_dump_fn_summaries()

void ipa_dump_fn_summaries ( FILE * f)

◆ ipa_dump_fn_summary()

◆ ipa_dump_hints()

◆ ipa_fnsummary_cc_finalize()

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().

◆ ipa_free_fn_summary()

void ipa_free_fn_summary ( void )

◆ ipa_free_size_summary()

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().

◆ ipa_get_stack_frame_offset()

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().

◆ 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().

◆ ipa_remove_from_growth_caches()

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().

◆ ipa_update_overall_fn_summary()

◆ points_to_local_or_readonly_memory_p()

bool points_to_local_or_readonly_memory_p ( tree t)
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().

◆ refs_local_or_readonly_memory_p()

bool refs_local_or_readonly_memory_p ( tree t)
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().

Variable Documentation

◆ ipa_call_summaries

◆ ipa_fn_summaries

◆ ipa_size_summaries