GCC Middle and Back End API Reference
cgraph.h File Reference
#include "profile-count.h"
#include "ipa-ref.h"
#include "plugin-api.h"
#include "ipa-param-manipulation.h"
#include "cif-code.def"
Include dependency graph for cgraph.h:

Go to the source code of this file.

Data Structures

struct  section_hash_entry
 
struct  section_name_hasher
 
struct  symtab_node
 
struct  ipa_replace_map
 
struct  cgraph_simd_clone_arg
 
struct  cgraph_simd_clone
 
struct  cgraph_function_version_info
 
struct  cgraph_edge_hasher
 
struct  cgraph_node
 
struct  cgraph_node_set_def
 
struct  varpool_node_set_def
 
struct  cgraph_node_set_iterator
 
struct  varpool_node_set_iterator
 
class  ipa_polymorphic_call_context
 
class  cgraph_indirect_call_info
 
class  cgraph_edge
 
struct  varpool_node
 
struct  asm_node
 
struct  symbol_priority_map
 
struct  asmname_hasher
 
class  symbol_table
 
struct  constant_descriptor_tree
 
struct  tree_descriptor_hasher
 

Macros

#define FOR_EACH_ALIAS(NODE, ALIAS)
 
#define DEFCIFCODE(code, type, string)   CIF_ ## code,
 
#define CGRAPH_FREQ_BASE   1000
 
#define CGRAPH_FREQ_MAX   100000
 
#define FOR_EACH_SYMBOL(node)    for ((node) = symtab->first_symbol (); (node); (node) = (node)->next)
 
#define FOR_EACH_DEFINED_SYMBOL(node)
 
#define FOR_EACH_VARIABLE(node)
 
#define FOR_EACH_STATIC_INITIALIZER(node)
 
#define FOR_EACH_DEFINED_VARIABLE(node)
 
#define FOR_EACH_DEFINED_FUNCTION(node)
 
#define FOR_EACH_FUNCTION(node)
 
#define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node)
 

Typedefs

typedef ipa_opt_pass_dipa_opt_pass
 
typedef cgraph_node_set_defcgraph_node_set
 
typedef struct varpool_node_set_defvarpool_node_set
 
typedef void(* cgraph_edge_hook) (cgraph_edge *, void *)
 
typedef void(* cgraph_node_hook) (cgraph_node *, void *)
 
typedef void(* varpool_node_hook) (varpool_node *, void *)
 
typedef void(* cgraph_2edge_hook) (cgraph_edge *, cgraph_edge *, void *)
 
typedef void(* cgraph_2node_hook) (cgraph_node *, cgraph_node *, void *)
 
typedef function_summary< thunk_info * > thunk_summary
 
typedef function_summary< clone_info * > clone_summary
 

Enumerations

enum  symtab_type { SYMTAB_SYMBOL , SYMTAB_FUNCTION , SYMTAB_VARIABLE }
 
enum  availability {
  AVAIL_UNSET , AVAIL_NOT_AVAILABLE , AVAIL_INTERPOSABLE , AVAIL_AVAILABLE ,
  AVAIL_LOCAL
}
 
enum  symbol_partitioning_class { SYMBOL_EXTERNAL , SYMBOL_PARTITION , SYMBOL_DUPLICATE }
 
enum  cgraph_simd_clone_arg_type {
  SIMD_CLONE_ARG_TYPE_VECTOR , SIMD_CLONE_ARG_TYPE_UNIFORM , SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP , SIMD_CLONE_ARG_TYPE_LINEAR_VARIABLE_STEP ,
  SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP , SIMD_CLONE_ARG_TYPE_LINEAR_REF_VARIABLE_STEP , SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP , SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_VARIABLE_STEP ,
  SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP , SIMD_CLONE_ARG_TYPE_LINEAR_VAL_VARIABLE_STEP , SIMD_CLONE_ARG_TYPE_MASK
}
 
enum  cgraph_inline_failed_t { CIF_N_REASONS }
 
enum  cgraph_inline_failed_type_t { CIF_FINAL_NORMAL = 0 , CIF_FINAL_ERROR }
 
enum  symtab_state {
  PARSING , CONSTRUCTION , LTO_STREAMING , IPA ,
  IPA_SSA , IPA_SSA_AFTER_INLINING , EXPANSION , FINISHED
}
 

Functions

void debuginfo_early_init (void)
 
void debuginfo_init (void)
 
void debuginfo_fini (void)
 
void debuginfo_start (void)
 
void debuginfo_stop (void)
 
void debuginfo_early_start (void)
 
void debuginfo_early_stop (void)
 
void cgraph_cc_finalize (void)
 
void release_function_body (tree)
 
cgraph_indirect_call_infocgraph_allocate_init_indirect_info (void)
 
void cgraph_update_edges_for_call_stmt (gimple *, tree, gimple *)
 
bool cgraph_function_possibly_inlined_p (tree)
 
const charcgraph_inline_failed_string (cgraph_inline_failed_t)
 
cgraph_inline_failed_type_t cgraph_inline_failed_type (cgraph_inline_failed_t)
 
void cgraphunit_cc_finalize (void)
 
int tp_first_run_node_cmp (const void *pa, const void *pb)
 
void symtab_thunks_cc_finalize (void)
 
basic_block init_lowered_empty_function (tree, bool, profile_count)
 
tree thunk_adjust (gimple_stmt_iterator *, tree, bool, HOST_WIDE_INT, tree, HOST_WIDE_INT)
 
tree clone_function_name_numbered (const char *name, const char *suffix)
 
tree clone_function_name_numbered (tree decl, const char *suffix)
 
tree clone_function_name (const char *name, const char *suffix, unsigned long number)
 
tree clone_function_name (tree decl, const char *suffix, unsigned long number)
 
tree clone_function_name (tree decl, const char *suffix)
 
void tree_function_versioning (tree, tree, vec< ipa_replace_map *, va_gc > *, ipa_param_adjustments *, bool, bitmap, basic_block)
 
void dump_callgraph_transformation (const cgraph_node *original, const cgraph_node *clone, const char *suffix)
 
int compute_call_stmt_bb_frequency (tree, basic_block bb)
 
void record_references_in_initializer (tree, bool)
 
void cgraph_build_static_cdtor (char which, tree body, int priority)
 
bool ipa_discover_variable_flags (void)
 
tree ctor_for_folding (tree)
 
void initialize_inline_failed (struct cgraph_edge *)
 
bool speculation_useful_p (struct cgraph_edge *e, bool anticipate_inlining)
 
bool decl_in_symtab_p (const_tree decl)
 
bool resolution_used_from_other_file_p (enum ld_plugin_symbol_resolution resolution)
 
hash_table< tree_descriptor_hasher > * constant_pool_htab (void)
 
bool decl_is_tm_clone (const_tree fndecl)
 
const charxstrdup_for_dump (const char *transient_str)
 

Variables

const char *const cgraph_availability_names []
 
const char *const ld_plugin_symbol_resolution_names []
 
const char *const tls_model_names []
 
symbol_tablesymtab
 
vec< cgraph_node * > cgraph_new_nodes
 
symbol_tablesaved_symtab
 

Macro Definition Documentation

◆ CGRAPH_FREQ_BASE

#define CGRAPH_FREQ_BASE   1000

◆ CGRAPH_FREQ_MAX

#define CGRAPH_FREQ_MAX   100000

◆ DEFCIFCODE

#define DEFCIFCODE ( code,
type,
string )   CIF_ ## code,

◆ FOR_EACH_ALIAS

◆ FOR_EACH_DEFINED_FUNCTION

◆ FOR_EACH_DEFINED_SYMBOL

#define FOR_EACH_DEFINED_SYMBOL ( node)
Value:
for ((node) = symtab->first_defined_symbol (); (node); \
(node) = node->next_defined_symbol ())
symtab_node * first_defined_symbol(void)
Definition cgraph.h:2879
Walk all symbols with definitions in current unit.   

Referenced by ipa_comdats().

◆ FOR_EACH_DEFINED_VARIABLE

#define FOR_EACH_DEFINED_VARIABLE ( node)
Value:
for ((node) = symtab->first_defined_variable (); (node); \
(node) = symtab->next_defined_variable (node))
varpool_node * next_defined_variable(varpool_node *node)
Definition cgraph.h:2971
varpool_node * first_defined_variable(void)
Definition cgraph.h:2957
Walk all variables with definitions in current unit.   

Referenced by asan_finish_file(), function_and_variable_visibility(), increase_alignment(), ipa_single_use(), ipa_write_summaries(), symbol_table::output_variables(), ipa_icf::sem_item_optimizer::parse_funcs_and_vars(), symbol_table::remove_unreachable_nodes(), and symbol_table::remove_unreferenced_decls().

◆ FOR_EACH_FUNCTION

◆ FOR_EACH_FUNCTION_WITH_GIMPLE_BODY

#define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY ( node)
Value:
for ((node) = symtab->first_function_with_gimple_body (); (node); \
cgraph_node * next_function_with_gimple_body(cgraph_node *node)
Definition cgraph.h:3058
cgraph_node * first_function_with_gimple_body(void)
Definition cgraph.h:3044
Walk all functions with body defined.   

Referenced by execute_one_pass(), ipa_profile_dump_all_summaries(), ipa_profile_generate_summary(), ipcp_generate_summary(), ipcp_store_vr_results(), ipcp_verify_propagated_values(), lhd_finalize_early_debug(), print_all_lattices(), and verify_strub().

◆ FOR_EACH_STATIC_INITIALIZER

#define FOR_EACH_STATIC_INITIALIZER ( node)
Value:
for ((node) = symtab->first_static_initializer (); (node); \
(node) = symtab->next_static_initializer (node))
varpool_node * next_static_initializer(varpool_node *node)
Definition cgraph.h:2938
varpool_node * first_static_initializer(void)
Definition cgraph.h:2924
Walk all static variables with initializer set.   

◆ FOR_EACH_SYMBOL

◆ FOR_EACH_VARIABLE

#define FOR_EACH_VARIABLE ( node)

Typedef Documentation

◆ cgraph_2edge_hook

typedef void(* cgraph_2edge_hook) (cgraph_edge *, cgraph_edge *, void *)

◆ cgraph_2node_hook

typedef void(* cgraph_2node_hook) (cgraph_node *, cgraph_node *, void *)

◆ cgraph_edge_hook

typedef void(* cgraph_edge_hook) (cgraph_edge *, void *)

◆ cgraph_node_hook

typedef void(* cgraph_node_hook) (cgraph_node *, void *)

◆ cgraph_node_set

◆ clone_summary

◆ ipa_opt_pass

◆ thunk_summary

◆ varpool_node_hook

typedef void(* varpool_node_hook) (varpool_node *, void *)

◆ varpool_node_set

Enumeration Type Documentation

◆ availability

Enumerator
AVAIL_UNSET 
AVAIL_NOT_AVAILABLE 
AVAIL_INTERPOSABLE 
AVAIL_AVAILABLE 
AVAIL_LOCAL 

◆ cgraph_inline_failed_t

Reasons for inlining failures.   
Enumerator
CIF_N_REASONS 

◆ cgraph_inline_failed_type_t

Enumerator
CIF_FINAL_NORMAL 
CIF_FINAL_ERROR 

◆ cgraph_simd_clone_arg_type

Enumerator
SIMD_CLONE_ARG_TYPE_VECTOR 
SIMD_CLONE_ARG_TYPE_UNIFORM 
SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP 
SIMD_CLONE_ARG_TYPE_LINEAR_VARIABLE_STEP 
SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP 
SIMD_CLONE_ARG_TYPE_LINEAR_REF_VARIABLE_STEP 
SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP 
SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_VARIABLE_STEP 
SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP 
SIMD_CLONE_ARG_TYPE_LINEAR_VAL_VARIABLE_STEP 
SIMD_CLONE_ARG_TYPE_MASK 

◆ symbol_partitioning_class

Classification of symbols WRT partitioning.   
Enumerator
SYMBOL_EXTERNAL 
SYMBOL_PARTITION 
SYMBOL_DUPLICATE 

◆ symtab_state

Enumerator
PARSING 
CONSTRUCTION 
LTO_STREAMING 
IPA 
IPA_SSA 
IPA_SSA_AFTER_INLINING 
EXPANSION 
FINISHED 

◆ symtab_type

Symbol table consists of functions and variables.
TODO: add labels and CONST_DECLs.   
Enumerator
SYMTAB_SYMBOL 
SYMTAB_FUNCTION 
SYMTAB_VARIABLE 

Function Documentation

◆ cgraph_allocate_init_indirect_info()

cgraph_indirect_call_info * cgraph_allocate_init_indirect_info ( void )
Allocate cgraph_indirect_call_info and set its fields to default values.  

References ggc_alloc().

Referenced by cgraph_node::create_indirect_edge().

◆ cgraph_build_static_cdtor()

void cgraph_build_static_cdtor ( char which,
tree body,
int priority )
In ipa.cc   
Generate and emit a static constructor or destructor.  WHICH must
be one of 'I' (for a constructor) or 'D' (for a destructor).
BODY is a STATEMENT_LIST containing GENERIC
statements.  PRIORITY is the initialization priority for this
constructor or destructor.   

References cgraph_build_static_cdtor_1(), ggc_alloc(), optimization_default_node, and target_option_default_node.

Referenced by asan_finish_file(), build_gcov_exit_decl(), build_init_ctor(), hwasan_finish_file(), ipa_lower_emutls(), and tsan_finish_file().

◆ cgraph_cc_finalize()

void cgraph_cc_finalize ( void )
In cgraph.cc   
Reset all state within cgraph.cc so that we can rerun the compiler
within the same process.  For use by toplev::finalize.   

References cgraph_fnver_htab, NULL, clone_info::release(), thunk_info::release(), nested_function_info::release(), symtab, version_info_node, and x_cgraph_nodes_queue.

Referenced by toplev::finalize().

◆ cgraph_function_possibly_inlined_p()

bool cgraph_function_possibly_inlined_p ( tree decl)
Return true when the DECL can possibly be inlined.   

References DECL_POSSIBLY_INLINED, DECL_UNINLINABLE, symbol_table::global_info_ready, and symtab.

Referenced by gen_field_die(), and premark_types_used_by_global_vars_helper().

◆ cgraph_inline_failed_string()

const char * cgraph_inline_failed_string ( cgraph_inline_failed_t reason)
Return a string describing the failure REASON.   

References CIF_N_REASONS, gcc_assert, and ggc_alloc().

Referenced by dump_inline_stats(), dump_ipa_call_summary(), expand_call_inline(), and report_inline_failed_reason().

◆ cgraph_inline_failed_type()

◆ cgraph_update_edges_for_call_stmt()

void cgraph_update_edges_for_call_stmt ( gimple * old_stmt,
tree old_decl,
gimple * new_stmt )
Update or remove the corresponding cgraph edge if a GIMPLE_CALL
OLD_STMT changed into NEW_STMT.  OLD_DECL is gimple_call_fndecl
of OLD_STMT before it was updated (updating can happen inplace).   

References cfun, cgraph_update_edges_for_call_stmt_node(), cgraph_node::clone_of, cgraph_node::clones, gcc_checking_assert, cgraph_node::get(), ggc_alloc(), and cgraph_node::next_sibling_clone.

Referenced by fold_marked_statements().

◆ cgraphunit_cc_finalize()

void cgraphunit_cc_finalize ( void )
In cgraphunit.cc   
Reset all state within cgraphunit.cc so that we can rerun the compiler
within the same process.  For use by toplev::finalize.   

References cgraph_new_nodes, first_analyzed, first_analyzed_var, gcc_assert, NULL, queued_nodes, and symtab_terminator.

Referenced by toplev::finalize().

◆ clone_function_name() [1/3]

tree clone_function_name ( const char * name,
const char * suffix,
unsigned long number )
Return a new assembler name for a clone of decl named NAME.  Apart
from the string SUFFIX, the new name will end with the specified
NUMBER.  If clone numbering is not needed then the two argument
clone_function_name should be used instead.   

References ASM_FORMAT_PRIVATE_NAME, get_identifier(), ggc_alloc(), and symbol_table::symbol_suffix_separator().

Referenced by clone_function_name(), clone_function_name_numbered(), create_dispatcher_calls(), create_target_clone(), cgraph_node::create_version_clone_with_body(), cgraph_node::create_virtual_clone(), expand_omp_target(), final_scan_insn_1(), and symtab_node::noninterposable_alias().

◆ clone_function_name() [2/3]

tree clone_function_name ( tree decl,
const char * suffix )
Return a new assembler name ending with the string SUFFIX for a
clone of DECL.   

References DECL_ASSEMBLER_NAME, get_identifier(), ggc_alloc(), IDENTIFIER_POINTER, and symbol_table::symbol_suffix_separator().

◆ clone_function_name() [3/3]

tree clone_function_name ( tree decl,
const char * suffix,
unsigned long number )
Return a new assembler name for a clone of DECL.  Apart from the
string SUFFIX, the new name will end with the specified NUMBER.  If
clone numbering is not needed then the two argument
clone_function_name should be used instead.   

References clone_function_name(), DECL_ASSEMBLER_NAME, and IDENTIFIER_POINTER.

◆ clone_function_name_numbered() [1/2]

tree clone_function_name_numbered ( const char * name,
const char * suffix )
In cgraphclones.cc   
Return a new assembler name for a clone of decl named NAME.  Apart
from the string SUFFIX, the new name will end with a unique (for
each NAME) unspecified number.  If clone numbering is not needed
then the two argument clone_function_name should be used instead.
Should not be called directly except for by
lto-partition.cc:privatize_symbol_name_1.   

References clone_fn_ids, clone_function_name(), hash_map< KeyId, Value, Traits >::create_ggc(), get_identifier(), ggc_alloc(), and IDENTIFIER_POINTER.

Referenced by clone_function_name_numbered(), create_assumption_fn(), create_omp_child_function_name(), cgraph_node::create_version_clone_with_body(), duplicate_thunk_for_node(), and simd_clone_create().

◆ clone_function_name_numbered() [2/2]

tree clone_function_name_numbered ( tree decl,
const char * suffix )
Return a new assembler name for a clone of DECL.  Apart from string
SUFFIX, the new name will end with a unique (for each DECL
assembler name) unspecified number.  If clone numbering is not
needed then the two argument clone_function_name should be used
instead.   

References clone_function_name_numbered(), DECL_ASSEMBLER_NAME, and IDENTIFIER_POINTER.

◆ compute_call_stmt_bb_frequency()

int compute_call_stmt_bb_frequency ( tree decl,
basic_block bb )
In cgraphbuild.cc   
Computes the frequency of the call statement so that it can be stored in
cgraph_edge.  BB is the basic block of the call statement.   

References basic_block_def::count, count, DECL_STRUCT_FUNCTION, ENTRY_BLOCK_PTR_FOR_FN, and profile_count::to_cgraph_frequency().

◆ constant_pool_htab()

hash_table< tree_descriptor_hasher > * constant_pool_htab ( void )
Constant pool accessor function.   

References const_desc_htab.

Referenced by asan_finish_file().

◆ ctor_for_folding()

tree ctor_for_folding ( tree decl)
In varpool.cc   
If DECLARATION is constant variable and its initial value is known
(so we can do constant folding), return its constructor (DECL_INITIAL).
This may be an expression or NULL when DECL is initialized to 0.
Return ERROR_MARK_NODE otherwise.

In LTO this may actually trigger reading the constructor from disk.
For this reason varpool_ctor_useable_for_folding_p should be used when
the actual constructor value is not needed.   

References symtab_node::alias, symtab_node::analyzed, cfun, varpool_node::ctor_useable_for_folding_p(), symtab_node::decl, DECL_EXTERNAL, DECL_IN_CONSTANT_POOL, DECL_INITIAL, DECL_VIRTUAL_P, error_mark_node, gcc_assert, varpool_node::get(), varpool_node::get_alias_target(), ggc_alloc(), PROP_gimple, PROP_rtl, symtab_node::transparent_alias, TREE_CODE, TREE_PUBLIC, TREE_READONLY, TREE_SIDE_EFFECTS, TREE_STATIC, TREE_THIS_VOLATILE, varpool_node::ultimate_alias_target(), and VAR_P.

Referenced by constant_after_peeling(), constant_byte_string(), strlen_pass::count_nonzero_bytes(), expand_expr_real_1(), fully_constant_vn_reference_p(), get_base_constructor(), get_symbol_constant_value(), gimple_get_virt_method_for_vtable(), optimize_count_trailing_zeroes(), param_change_prob(), and symbol_table::remove_unreachable_nodes().

◆ debuginfo_early_init()

void debuginfo_early_init ( void )
extern
Callgraph handling code.
   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/>.   
Register the debug and earlydebug dump files.   

References debuginfo_dump_nr, debuginfo_early_dump_nr, DK_tree, g, gcc::context::get_dumps(), ggc_alloc(), and OPTGROUP_NONE.

Referenced by general_init().

◆ debuginfo_early_start()

void debuginfo_early_start ( void )
extern
Set dump_file to the earlydebug dump file.   

References debuginfo_early_dump_file, and set_dump_file().

Referenced by symbol_table::finalize_compilation_unit().

◆ debuginfo_early_stop()

void debuginfo_early_stop ( void )
extern
Undo setting dump_file to the earlydebug dump file.   

References NULL, and set_dump_file().

Referenced by symbol_table::finalize_compilation_unit().

◆ debuginfo_fini()

void debuginfo_fini ( void )
extern
Finalize the debug and earlydebug dump files.   

References debuginfo_dump_file, debuginfo_dump_nr, debuginfo_early_dump_file, debuginfo_early_dump_nr, and dump_end().

Referenced by finalize().

◆ debuginfo_init()

◆ debuginfo_start()

void debuginfo_start ( void )
extern
Set dump_file to the debug dump file.   

References debuginfo_dump_file, and set_dump_file().

Referenced by compile_file().

◆ debuginfo_stop()

void debuginfo_stop ( void )
extern
Undo setting dump_file to the debug dump file.   

References NULL, and set_dump_file().

Referenced by compile_file().

◆ decl_in_symtab_p()

bool decl_in_symtab_p ( const_tree decl)
inline
Return true if DECL should have entry in symbol table if used.
Those are functions and static & external variables.   

References DECL_EXTERNAL, ggc_alloc(), TREE_CODE, TREE_STATIC, and VAR_P.

Referenced by address_compare(), compare_base_decls(), ipa_icf_gimple::func_checker::compare_variable_decl(), ensure_base_align(), ipa_icf::sem_variable::equals(), increase_alignment(), maybe_nonzero_address(), and vect_can_force_dr_alignment_p().

◆ decl_is_tm_clone()

bool decl_is_tm_clone ( const_tree fndecl)
inline

◆ dump_callgraph_transformation()

◆ init_lowered_empty_function()

basic_block init_lowered_empty_function ( tree decl,
bool in_ssa,
profile_count count )
Initialize datastructures so DECL is a function in lowered gimple form.
IN_SSA is true if the gimple is in SSA.   
DECL is FUNCTION_DECL.  Initialize datastructures so DECL is a function
in lowered gimple form.  IN_SSA is true if the gimple is in SSA.

Set current_function_decl and cfun to newly constructed empty function body.
return basic block in the function body.   

References add_bb_to_loop(), allocate_struct_function(), profile_probability::always(), BLOCK_SUPERCONTEXT, cfun, basic_block_def::count, count, create_basic_block(), current_function_decl, function::decl, DECL_INITIAL, DECL_SAVED_TREE, ENTRY_BLOCK_PTR_FOR_FN, error_mark_node, EXIT_BLOCK_PTR_FOR_FN, ggc_alloc(), gimple_register_cfg_hooks(), init_empty_tree_cfg(), init_loops_structure(), init_ssa_operands(), init_tree_ssa(), loops_for_fn(), LOOPS_MAY_HAVE_MULTIPLE_LATCHES, make_edge(), make_node(), NULL, PROP_cfg, PROP_gimple_any, PROP_gimple_lcf, PROP_gimple_leh, PROP_loops, PROP_ssa, set_loops_for_fn(), and loops::state.

Referenced by expand_thunk().

◆ initialize_inline_failed()

◆ ipa_discover_variable_flags()

bool ipa_discover_variable_flags ( void )
Discover variables that have no longer address taken, are read-only or
write-only and update their flags.

Return true when unreachable symbol removal should be done.

FIXME: This cannot be done in between gimplify and omp_expand since
readonly flag plays role on what is shared and what is not.  Currently we do
this transformation as part of whole program visibility and re-do at
ipa-reference pass (to take into account clonning), but it would
make sense to do it before early optimizations.   

References clear_addressable_bit(), dump_file, FOR_EACH_VARIABLE, ggc_alloc(), NULL, process_references(), set_readonly_bit(), set_writeonly_bit(), TREE_ADDRESSABLE, and TREE_READONLY.

Referenced by propagate().

◆ record_references_in_initializer()

void record_references_in_initializer ( tree decl,
bool only_vars )
Record references to functions and other variables present in the
initial value of DECL, a variable.
When ONLY_VARS is true, we mark needed only variables, not functions.   

References DECL_INITIAL, varpool_node::get_create(), ggc_alloc(), NULL, record_reference_ctx::only_vars, record_reference(), record_reference_ctx::varpool_node, and walk_tree.

Referenced by varpool_node::analyze(), function_and_variable_visibility(), and new_emutls_decl().

◆ release_function_body()

void release_function_body ( tree decl)

◆ resolution_used_from_other_file_p()

bool resolution_used_from_other_file_p ( enum ld_plugin_symbol_resolution resolution)
inline
Return true when RESOLUTION indicate that linker will use
the symbol from non-LTO object files.   

References ggc_alloc().

Referenced by symtab_node::used_from_object_file_p().

◆ speculation_useful_p()

◆ symtab_thunks_cc_finalize()

void symtab_thunks_cc_finalize ( void )
In symtab-thunks.cc   

References NULL, and vtable_entry_type.

Referenced by toplev::finalize().

◆ thunk_adjust()

tree thunk_adjust ( gimple_stmt_iterator * bsi,
tree ptr,
bool this_adjusting,
HOST_WIDE_INT fixed_offset,
tree virtual_offset,
HOST_WIDE_INT indirect_offset )
Adjust PTR by the constant FIXED_OFFSET, by the vtable offset indicated by
VIRTUAL_OFFSET, and by the indirect offset indicated by INDIRECT_OFFSET, if
it is non-null. THIS_ADJUSTING is nonzero for a this adjusting thunk and zero
for a result adjusting thunk.   

References build1(), build_pointer_type(), build_simple_mem_ref, create_tmp_reg(), fold_build_pointer_plus_hwi_loc(), fold_build_pointer_plus_loc(), force_gimple_operand_gsi(), ggc_alloc(), gimple_build_assign(), GSI_CONTINUE_LINKING, gsi_insert_after(), GSI_NEW_STMT, input_location, integer_type_node, layout_type(), make_node(), NULL_TREE, TREE_TYPE, TYPE_ARG_TYPES, VAR_P, and vtable_entry_type.

Referenced by expand_call_inline(), and expand_thunk().

◆ tp_first_run_node_cmp()

int tp_first_run_node_cmp ( const void * pa,
const void * pb )
Node comparator that is responsible for the order that corresponds
to time when a function was launched for the first time.   

References a, b, ggc_alloc(), INT_MAX, and opt_for_fn.

Referenced by expand_all_functions().

◆ tree_function_versioning()

void tree_function_versioning ( tree old_decl,
tree new_decl,
vec< ipa_replace_map *, va_gc > * tree_map,
ipa_param_adjustments * param_adjustments,
bool update_clones,
bitmap blocks_to_copy,
basic_block new_entry )
Create a copy of a function's tree.
  OLD_DECL and NEW_DECL are FUNCTION_DECL tree nodes
  of the original function and the new copied function
  respectively.  In case we want to replace a DECL
  tree with another tree while duplicating the function's
  body, TREE_MAP represents the mapping between these
  trees. If UPDATE_CLONES is set, the call_stmt fields
  of edges of clones of the function will be updated.

  If non-NULL PARAM_ADJUSTMENTS determines how function prototype (i.e. the
  function parameters and return value) should be modified).
  If non-NULL BLOCKS_TO_COPY determine what basic blocks to copy.
  If non_NULL NEW_ENTRY determine new entry BB of the clone.

References add_local_variables(), ipa_param_body_adjustments::append_init_stmts(), AVOID_CFG_MODIFICATIONS, BLOCK_SUPERCONTEXT, build_debug_expr_decl(), build_decl(), build_fold_addr_expr, calculate_dominance_info(), cgraph_edge::call_stmt, CB_CGE_MOVE, CB_CGE_MOVE_CLONES, CDI_DOMINATORS, CDI_POST_DOMINATORS, cfun, copy_arguments_nochange(), copy_body(), copy_decl_no_change(), copy_result_decl_to_var(), copy_static_chain(), basic_block_def::count, cgraph_edge::count, debug_hooks, DECL_ABSTRACT_ORIGIN, DECL_ARGUMENTS, DECL_ARTIFICIAL, DECL_BY_REFERENCE, DECL_CHAIN, DECL_CONTEXT, decl_debug_args_insert(), decl_debug_args_lookup(), DECL_FUNCTION_PERSONALITY, DECL_HAS_DEBUG_ARGS_P, DECL_INITIAL, DECL_IS_MALLOC, DECL_MODE, DECL_ORIGIN, DECL_POSSIBLY_INLINED, DECL_RESULT, DECL_SOURCE_LOCATION, DECL_STRUCT_FUNCTION, declare_inline_vars(), delete_unreachable_blocks_update_callgraph(), lang_hooks::dup_lang_specific_decl, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, fix_loop_structure(), fold_marked_statements(), free_dominance_info(), gcc_assert, gcc_checking_assert, clone_info::get(), hash_map< KeyId, Value, Traits >::get(), cgraph_node::get(), ipa_param_body_adjustments::get_new_param_chain(), ggc_alloc(), gimple_bb(), gimple_build_debug_bind(), gimple_build_debug_source_bind(), gimple_build_nop(), gimple_in_ssa_p(), gsi_after_labels(), gsi_insert_before(), GSI_NEW_STMT, i, initialize_cfun(), input_location, insert_decl_map(), insert_init_stmt(), is_gimple_reg(), loop_optimizer_init(), loops_for_fn(), LOOPS_NEED_FIXUP, loops_state_satisfies_p(), ipa_param_body_adjustments::m_dead_ssa_debug_equiv, ipa_param_body_adjustments::m_reset_debug_decls, ipa_param_adjustments::m_skip_return, make_ssa_name(), MAY_HAVE_DEBUG_BIND_STMTS, cgraph_edge::next_callee, NULL, NULL_TREE, number_blocks(), gcc_debug_hooks::outlining_inline_function, clone_info::param_adjustments, pop_cfun(), PROP_loops, rebuild_frequencies(), cgraph_edge::rebuild_references(), remap_blocks(), remap_decl(), remap_gimple_op_r(), SET_DECL_MODE, set_ssa_default_def(), setup_one_parameter(), single_succ(), single_succ_edge(), split_edge(), ssa_default_def(), SSA_NAME_DEF_STMT, TODO_update_ssa, TREE_CHAIN, TREE_CODE, TREE_TYPE, UNKNOWN_LOCATION, update_clone_info(), update_max_bb_count(), update_ssa(), vec_safe_copy(), vec_safe_is_empty(), vec_safe_length(), vec_safe_push(), void_type_node, VOID_TYPE_P, and walk_tree.

Referenced by cgraph_node::create_version_clone_with_body(), ipa_tm_create_version(), cgraph_node::materialize_clone(), and save_inline_function_body().

◆ xstrdup_for_dump()

const char * xstrdup_for_dump ( const char * transient_str)
inline
When using fprintf (or similar), problems can arise with
transient generated strings.  Many string-generation APIs
only support one result being alive at once (e.g. by
returning a pointer to a statically-allocated buffer).

If there is more than one generated string within one
fprintf call: the first string gets evicted or overwritten
by the second, before fprintf is fully evaluated.
See e.g. PR/53136.

This function provides a workaround for this, by providing
a simple way to create copies of these transient strings,
without the need to have explicit cleanup:

    fprintf (dumpfile, "string 1: %s string 2:%s\n",
             xstrdup_for_dump (EXPR_1),
             xstrdup_for_dump (EXPR_2));

This is actually a simple wrapper around ggc_strdup, but
the name documents the intent.  We require that no GC can occur
within the fprintf call.   

References ggc_alloc(), and ggc_strdup.

Referenced by dump_probability(), and dump_profile().

Variable Documentation

◆ cgraph_availability_names

const char* const cgraph_availability_names[]
extern
Names used to print out the availability enum.   

Referenced by cgraph_node::dump(), and varpool_node::dump().

◆ cgraph_new_nodes

vec<cgraph_node *> cgraph_new_nodes
extern
Driver of optimization process
   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/>.   
This module implements main driver of compilation process.

  The main scope of this file is to act as an interface in between
  tree based frontends and the backend.

  The front-end is supposed to use following functionality:

   - finalize_function

     This function is called once front-end has parsed whole body of function
     and it is certain that the function body nor the declaration will change.

     (There is one exception needed for implementing GCC extern inline
       function.)

   - varpool_finalize_decl

     This function has same behavior as the above but is used for static
     variables.

   - add_asm_node

     Insert new toplevel ASM statement

   - finalize_compilation_unit

     This function is called once (source level) compilation unit is finalized
     and it will no longer change.

     The symbol table is constructed starting from the trivially needed
     symbols finalized by the frontend.  Functions are lowered into
     GIMPLE representation and callgraph/reference lists are constructed.
     Those are used to discover other necessary functions and variables.

     At the end the bodies of unreachable functions are removed.

     The function can be called multiple times when multiple source level
     compilation units are combined.

   - compile

     This passes control to the back-end.  Optimizations are performed and
     final assembler is generated.  This is done in the following way. Note
     that with link time optimization the process is split into three
     stages (compile time, linktime analysis and parallel linktime as
     indicated bellow).

     Compile time:

       1) Inter-procedural optimization.
          (ipa_passes)

          This part is further split into:

          a) early optimizations. These are local passes executed in
             the topological order on the callgraph.

             The purpose of early optimizations is to optimize away simple
             things that may otherwise confuse IP analysis. Very simple
             propagation across the callgraph is done i.e. to discover
             functions without side effects and simple inlining is performed.

          b) early small interprocedural passes.

             Those are interprocedural passes executed only at compilation
             time.  These include, for example, transactional memory lowering,
             unreachable code removal and other simple transformations.

          c) IP analysis stage.  All interprocedural passes do their
             analysis.

             Interprocedural passes differ from small interprocedural
             passes by their ability to operate across whole program
             at linktime.  Their analysis stage is performed early to
             both reduce linking times and linktime memory usage by     
             not having to represent whole program in memory.

          d) LTO streaming.  When doing LTO, everything important gets
             streamed into the object file.

      Compile time and or linktime analysis stage (WPA):

             At linktime units gets streamed back and symbol table is
             merged.  Function bodies are not streamed in and not
             available.
          e) IP propagation stage.  All IP passes execute their
             IP propagation. This is done based on the earlier analysis
             without having function bodies at hand.
          f) Ltrans streaming.  When doing WHOPR LTO, the program
             is partitioned and streamed into multiple object files.

      Compile time and/or parallel linktime stage (ltrans)

             Each of the object files is streamed back and compiled
             separately.  Now the function bodies becomes available
             again.

        2) Virtual clone materialization
           (cgraph_materialize_clone)

           IP passes can produce copies of existing functions (such
           as versioned clones or inline clones) without actually
           manipulating their bodies by creating virtual clones in
           the callgraph. At this time the virtual clones are
           turned into real functions
        3) IP transformation

           All IP passes transform function bodies based on earlier
           decision of the IP propagation.

        4) late small IP passes

           Simple IP passes working within single program partition.

        5) Expansion
           (expand_all_functions)

           At this stage functions that needs to be output into
           assembler are identified and compiled in topological order
        6) Output of variables and aliases
           Now it is known what variable references was not optimized
           out and thus all variables are output to the file.

           Note that with -fno-toplevel-reorder passes 5 and 6
           are combined together in cgraph_output_in_order.  

  Finally there are functions to manipulate the callgraph from
  backend.
   - cgraph_add_new_function is used to add backend produced
     functions introduced after the unit is finalized.
     The functions are enqueue for later processing and inserted
     into callgraph with cgraph_process_new_functions.

   - cgraph_function_versioning

     produces a copy of function into new one (a version)
     and apply simple transformations
Queue of cgraph nodes scheduled to be added into cgraph.  This is a
secondary queue used during optimization to accommodate passes that
may generate new functions that need to be optimized and expanded.   

Referenced by cgraph_node::add_new_function(), can_remove_node_now_p_1(), cgraphunit_cc_finalize(), and symbol_table::process_new_functions().

◆ ld_plugin_symbol_resolution_names

const char* const ld_plugin_symbol_resolution_names[]
extern

Referenced by symtab_node::dump_base().

◆ saved_symtab

symbol_table* saved_symtab
extern
A stashed copy of "symtab" for use by selftest::symbol_table_test.
This needs to be a global so that it can be a GC root, and thus
prevent the stashed copy from being garbage-collected if the GC runs
during a symbol_table_test.   

◆ symtab

symbol_table* symtab
extern
Symbol table global context.   

Referenced by varpool_node::add(), cgraph_node::add_new_function(), add_type_duplicate(), varpool_node::analyze(), analyze_functions(), assemble_alias(), autofdo::auto_profile(), symtab_node::binds_to_current_def_p(), build_toporder_info(), can_refer_decl_in_current_unit_p(), cgraph_cc_finalize(), cgraph_function_possibly_inlined_p(), cgraph_edge::clone(), symbol_table::compile(), compile_file(), coverage_obj_init(), cgraph_node::create(), cgraph_node::create_clone(), create_dispatcher_calls(), cgraph_node::create_edge(), symbol_table::create_edge(), varpool_node::create_extra_name_alias(), ipa_fn_summary_t::create_ggc(), modref_summaries::create_ggc(), modref_summaries_lto::create_ggc(), ipcp_transformation_t::create_ggc(), cgraph_node::create_indirect_edge(), cgraph_node::create_same_body_alias(), create_target_clone(), cgraph_node::create_thunk(), cgraph_node::create_version_clone_with_body(), cgraph_node::create_virtual_clone(), default_asm_output_ident_directive(), do_compile(), do_per_function_toporder(), cgraph_node::dump(), varpool_node::dump(), dump_callgraph_transformation(), dump_possible_polymorphic_call_targets(), duplicate_thunk_for_node(), emergency_dump_function(), ipa_icf::sem_item_optimizer::execute(), execute_build_ssa_passes(), execute_ipa_pass_list(), execute_one_pass(), execute_todo(), cgraph_node::expand(), expand_all_functions(), expand_call_inline(), expand_simd_clones(), varpool_node::finalize_decl(), cgraph_node::finalize_function(), function_and_variable_visibility(), general_init(), clone_info::get(), thunk_info::get(), clone_info::get_create(), thunk_info::get_create(), nested_function_info::get_create(), cgraph_node::get_create(), cgraph_node::get_fini_priority(), symtab_node::get_for_asmname(), symtab_node::get_init_priority(), gimple_fold_builtin_acc_on_device(), initialize_growth_caches(), inline_call(), inline_small_functions(), input_cgraph_1(), input_node(), input_varpool_node(), ipa_check_create_edge_args(), ipa_check_create_node_params(), ipa_fn_summary_alloc(), ipa_init(), ipa_inline(), ipa_merge_profiles(), ipa_passes(), ipa_profile(), ipa_profile_generate_summary(), ipa_profile_read_summary(), ipa_prop_cc_finalize(), ipa_pta_execute(), ipa_record_return_value_range(), ipa_reduced_postorder(), ipa_reference_cc_finalize(), ipa_reference_read_optimization_summary(), ipa_register_cgraph_hooks(), ipa_reverse_postorder(), ipa_strub_set_mode_for_new_functions(), ipa_tm_create_version(), ipa_unregister_cgraph_hooks(), ipa_write_summaries(), ipcp_driver(), ipcp_propagate_stage(), ipcp_transformation_initialize(), ipcp_verify_propagated_values(), lto_input_toplevel_asms(), lto_output_toplevel_asms(), lto_streaming_expected_p(), symtab_node::make_decl_local(), cgraph_edge::make_speculative(), cgraph_node::materialize_clone(), maybe_record_nested_function(), ipa_icf::sem_function::merge(), ipa_param_adjustments::modify_call(), omp_context_selector_matches(), omp_maybe_offloaded(), omp_resolve_declare_variant(), optimize_dyn_tls_for_decl_p(), optimize_weakref(), output_in_order(), possible_inline_candidate_p(), possible_polymorphic_call_targets(), preserve_function_body_p(), symtab_node::priority_info(), process_function_and_variable_attributes(), process_references(), propagate(), propagate_malloc(), propagate_nothrow(), propagate_pure_const(), record_argument_state(), recursive_inlining(), cgraph_edge::redirect_call_stmt_to_callee(), reference_to_unused(), referenced_from_vtable_p(), ipa_icf::sem_item_optimizer::register_hooks(), symtab_node::register_symbol(), clone_info::release(), thunk_info::release(), cgraph_node::release_body(), release_section_hash_entry(), cgraph_edge::remove(), clone_info::remove(), thunk_info::remove(), cgraph_node::remove(), varpool_node::remove(), cgraph_node::remove_callees(), cgraph_node::remove_callers(), varpool_node::remove_initializer(), symbol_table::remove_unreachable_nodes(), symtab_node::resolve_alias(), save_inline_function_body(), symtab_node::set_section_for_node(), set_user_assembler_name(), tree_profiling(), type_all_ctors_visible_p(), symtab_node::unregister(), ipa_icf::sem_item_optimizer::unregister_hooks(), symtab_node::verify_base(), cgraph_edge::verify_corresponds_to_fndecl(), cgraph_node::verify_node(), symtab_node::verify_symtab_nodes(), walk_polymorphic_call_targets(), walk_polymorphic_call_targets(), and wrapup_global_declaration_2().

◆ tls_model_names

const char* const tls_model_names[]
extern
Callgraph handling code.
   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/>.   

Referenced by varpool_node::dump(), and print_node().