GCC Middle and Back End API Reference
|
#include "profile-count.h"
#include "ipa-ref.h"
#include "plugin-api.h"
#include "ipa-param-manipulation.h"
#include "cif-code.def"
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) |
#define | CGRAPH_FREQ_BASE 1000 |
#define | CGRAPH_FREQ_MAX 100000 |
#define | FOR_EACH_SYMBOL(node) |
#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_d * | ipa_opt_pass |
typedef cgraph_node_set_def * | cgraph_node_set |
typedef struct varpool_node_set_def * | varpool_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 |
Variables | |
const char *const | cgraph_availability_names [] |
const char *const | ld_plugin_symbol_resolution_names [] |
const char *const | tls_model_names [] |
symbol_table * | symtab |
vec< cgraph_node * > | cgraph_new_nodes |
symbol_table * | saved_symtab |
#define CGRAPH_FREQ_BASE 1000 |
Referenced by profile_count::to_cgraph_frequency().
#define CGRAPH_FREQ_MAX 100000 |
Referenced by profile_count::to_cgraph_frequency().
#define DEFCIFCODE | ( | code, | |
type, | |||
string ) |
#define FOR_EACH_ALIAS | ( | NODE, | |
ALIAS ) |
Walk all aliases for NODE.
Referenced by cgraph_node::add_detected_attribute(), add_detected_attribute_1(), varpool_node::assemble_aliases(), cgraph_node::assemble_thunks_and_aliases(), cgraph_node::call_for_symbol_and_aliases_1(), symtab_node::call_for_symbol_and_aliases_1(), varpool_node::call_for_symbol_and_aliases_1(), cgraph_node::call_for_symbol_thunks_and_aliases(), can_remove_node_now_p_1(), cgraph_externally_visible_p(), check_callers(), cgraph_node::dump(), varpool_node::externally_visible_p(), growth_positive_p(), ipa_tm_execute(), recursive_call_p(), reset_edge_caches(), ipa_icf::set_alias_uids(), cgraph_node::set_const_flag(), set_const_flag_1(), cgraph_node::set_malloc_flag(), set_malloc_flag_1(), cgraph_node::set_noreturn_flag(), set_noreturn_flag_1(), cgraph_node::set_nothrow_flag(), set_nothrow_flag_1(), and update_caller_keys().
#define FOR_EACH_DEFINED_FUNCTION | ( | node | ) |
Walk all functions with body defined.
Referenced by symbol_table::compile(), do_per_function(), dump_inline_stats(), dump_overall_stats(), ipa_icf::sem_item_optimizer::fixup_points_to_sets(), function_and_variable_visibility(), generate_summary(), handle_missing_profiles(), init_node_map(), inline_small_functions(), ipa_cdtor_merge(), ipa_comdats(), ipa_devirt(), ipa_dump_fn_summaries(), ipa_fn_summary_generate(), ipa_free_postorder_info(), ipa_inline(), ipa_lower_emutls(), ipa_profile(), ipa_pta_execute(), ipa_reduced_postorder(), ipa_tm_execute(), ipa_write_summaries(), ipcp_propagate_stage(), omp_discover_implicit_declare_target(), output_in_order(), ipa_icf::sem_item_optimizer::parse_funcs_and_vars(), propagate(), propagate_malloc(), pure_const_generate_summary(), symbol_table::remove_unreachable_nodes(), and tree_profiling().
#define FOR_EACH_DEFINED_SYMBOL | ( | node | ) |
Walk all symbols with definitions in current unit.
Referenced by ipa_comdats().
#define FOR_EACH_DEFINED_VARIABLE | ( | node | ) |
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().
#define FOR_EACH_FUNCTION | ( | node | ) |
Walk all functions.
Referenced by autofdo::auto_profile(), btf_add_func_datasec_entries(), btf_add_func_records(), cgraph_node::dump_cgraph(), dump_malloc_lattice(), function_and_variable_visibility(), input_symtab(), ipa_inline(), ipa_omp_simd_clone(), ipa_print_all_jump_functions(), ipa_print_all_params(), ipa_reverse_postorder(), ipa_strub_set_mode_for_new_functions(), ipa_target_clone(), ipa_tm_execute(), mark_functions_to_output(), merge_profile_summaries(), propagate_malloc(), symbol_table::remove_unreachable_nodes(), update_type_inheritance_graph(), and cgraph_node::verify_cgraph_nodes().
#define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY | ( | node | ) |
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().
#define FOR_EACH_STATIC_INITIALIZER | ( | node | ) |
Walk all static variables with initializer set.
#define FOR_EACH_SYMBOL | ( | node | ) |
Walk all symbols.
Referenced by analyze_functions(), build_type_inheritance_graph(), symtab_node::check_ifunc_callee_symtab_nodes(), symbol_table::compile(), symbol_table::dump(), symbol_table::dump_graphviz(), symbol_table::output_weakrefs(), symbol_table::process_same_body_aliases(), select_what_to_stream(), symbol_table::symtab_initialize_asm_name_hash(), and symtab_node::verify_symtab_nodes().
#define FOR_EACH_VARIABLE | ( | node | ) |
Walk all variables.
Referenced by btf_add_const_void(), btf_add_vars(), varpool_node::dump_varpool(), function_and_variable_visibility(), ipa_discover_variable_flags(), ipa_lower_emutls(), ipa_pta_execute(), omp_discover_implicit_declare_target(), output_in_order(), symbol_table::output_variables(), and symbol_table::remove_unreachable_nodes().
typedef void(* cgraph_2edge_hook) (cgraph_edge *, cgraph_edge *, void *) |
typedef void(* cgraph_2node_hook) (cgraph_node *, cgraph_node *, void *) |
typedef void(* cgraph_edge_hook) (cgraph_edge *, void *) |
typedef void(* cgraph_node_hook) (cgraph_node *, void *) |
typedef cgraph_node_set_def* cgraph_node_set |
typedef function_summary<clone_info *> clone_summary |
typedef ipa_opt_pass_d* ipa_opt_pass |
typedef function_summary<thunk_info *> thunk_summary |
typedef void(* varpool_node_hook) (varpool_node *, void *) |
typedef struct varpool_node_set_def* varpool_node_set |
enum availability |
Reasons for inlining failures.
enum symtab_state |
enum symtab_type |
cgraph_indirect_call_info * cgraph_allocate_init_indirect_info | ( | void | ) |
Allocate cgraph_indirect_call_info and set its fields to default values.
References ggc_cleared_alloc(), and cgraph_indirect_call_info::param_index.
Referenced by cgraph_node::create_indirect_edge().
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(), 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().
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(), nested_function_info::release(), thunk_info::release(), symtab, version_info_node, and x_cgraph_nodes_queue.
Referenced by toplev::finalize().
Return true when the DECL can possibly be inlined.
References DECL_POSSIBLY_INLINED, DECL_UNINLINABLE, symbol_table::global_info_ready, and symtab.
Referenced by premark_types_used_by_global_vars_helper().
const char * cgraph_inline_failed_string | ( | cgraph_inline_failed_t | reason | ) |
Return a string describing the failure REASON.
This file contains the definitions of the cgraph_inline_failed_t enums used in GCC. Copyright (C) 2008-2024 Free Software Foundation, Inc. Contributed by Doug Kwan <dougkwan@google.com> 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 format of this file is DEFCIFCODE(code, string). Where symbol is the enumeration name without the ``''. The argument STRING is a explain the failure. Except for OK, which is a NULL pointer.
Inlining successful. This must be the first code.
Inlining failed for an unspecified reason.
Function has not be considered for inlining. This is the code for functions that have not been rejected for inlining yet.
Caller is compiled with optimizations disabled.
Inlining failed owing to unavailable function body.
Extern inline function that has been redefined.
Function is not inlinable.
Function is overwritable.
Function is not an inlining candidate.
Inlining failed because of various limit parameters.
Recursive inlining.
Call is unlikely.
Call is considered never executed.
Function is not declared as inline.
Caller and callee disagree on the arguments.
Caller is variadic thunk.
Call was originally indirect.
Ths edge represents an indirect edge with a yet-undetermined callee .
We can't inline different EH personalities together.
We can't inline if the callee can throw non-call exceptions but the caller cannot.
We can't inline because of mismatched target specific options.
We can't inline because of mismatched optimization levels.
We can't inline because the callee refers to comdat-local symbols.
We can't inline because of mismatched caller/callee sanitizer attributes.
We can't inline because the user requests only static functions but the function has external linkage for live patching purpose.
We proved that the call is unreachable.
References gcc_assert.
Referenced by dump_inline_stats(), dump_ipa_call_summary(), expand_call_inline(), and report_inline_failed_reason().
cgraph_inline_failed_type_t cgraph_inline_failed_type | ( | cgraph_inline_failed_t | reason | ) |
Return a type describing the failure REASON.
This file contains the definitions of the cgraph_inline_failed_t enums used in GCC. Copyright (C) 2008-2024 Free Software Foundation, Inc. Contributed by Doug Kwan <dougkwan@google.com> 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 format of this file is DEFCIFCODE(code, string). Where symbol is the enumeration name without the ``''. The argument STRING is a explain the failure. Except for OK, which is a NULL pointer.
Inlining successful. This must be the first code.
Inlining failed for an unspecified reason.
Function has not be considered for inlining. This is the code for functions that have not been rejected for inlining yet.
Caller is compiled with optimizations disabled.
Inlining failed owing to unavailable function body.
Extern inline function that has been redefined.
Function is not inlinable.
Function is overwritable.
Function is not an inlining candidate.
Inlining failed because of various limit parameters.
Recursive inlining.
Call is unlikely.
Call is considered never executed.
Function is not declared as inline.
Caller and callee disagree on the arguments.
Caller is variadic thunk.
Call was originally indirect.
Ths edge represents an indirect edge with a yet-undetermined callee .
We can't inline different EH personalities together.
We can't inline if the callee can throw non-call exceptions but the caller cannot.
We can't inline because of mismatched target specific options.
We can't inline because of mismatched optimization levels.
We can't inline because the callee refers to comdat-local symbols.
We can't inline because of mismatched caller/callee sanitizer attributes.
We can't inline because the user requests only static functions but the function has external linkage for live patching purpose.
We proved that the call is unreachable.
References gcc_assert.
Referenced by can_early_inline_edge_p(), can_inline_edge_by_limits_p(), can_inline_edge_p(), check_callers(), do_estimate_growth_1(), expand_call_inline(), flatten_function(), growth_positive_p(), initialize_inline_failed(), and want_inline_small_function_p().
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(), and cgraph_node::next_sibling_clone.
Referenced by fold_marked_statements().
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().
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(), 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().
Return a new assembler name ending with the string SUFFIX for a clone of DECL.
References DECL_ASSEMBLER_NAME, get_identifier(), IDENTIFIER_POINTER, and symbol_table::symbol_suffix_separator().
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.
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(), get_identifier(), hash_map< KeyId, Value, Traits >::get_or_insert(), 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().
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.
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().
hash_table< tree_descriptor_hasher > * constant_pool_htab | ( | void | ) |
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(), varpool_node::get_constructor(), 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().
|
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, gcc::dump_manager::dump_register(), g, gcc::context::get_dumps(), and OPTGROUP_NONE.
Referenced by general_init().
|
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().
|
extern |
Undo setting dump_file to the earlydebug dump file.
References NULL, and set_dump_file().
Referenced by symbol_table::finalize_compilation_unit().
|
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().
|
extern |
Initialize the debug and earlydebug dump files.
References debuginfo_dump_file, debuginfo_dump_flags, debuginfo_dump_nr, debuginfo_early_dump_file, debuginfo_early_dump_flags, debuginfo_early_dump_nr, dump_begin(), g, gcc::dump_manager::get_dump_file_info(), gcc::context::get_dumps(), NULL, and dump_file_info::pflags.
Referenced by do_compile().
|
extern |
Set dump_file to the debug dump file.
References debuginfo_dump_file, and set_dump_file().
Referenced by compile_file().
|
extern |
Undo setting dump_file to the debug dump file.
References NULL, and set_dump_file().
Referenced by compile_file().
|
inline |
Return true if DECL should have entry in symbol table if used. Those are functions and static & external variables.
References DECL_EXTERNAL, 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().
|
inline |
Return true if the TM_CLONE bit is set for a given FNDECL.
References cgraph_node::get(), and cgraph_node::tm_clone.
Referenced by dump_function_to_file(), dump_gimple_call(), execute_lower_tm(), expand_block_edges(), expand_regions_1(), gate_tm_init(), ipa_tm_transform_calls_redirect(), is_tm_builtin(), and print_node().
void dump_callgraph_transformation | ( | const cgraph_node * | original, |
const cgraph_node * | clone, | ||
const char * | suffix ) |
References hash_set< KeyId, Lazy, Traits >::add(), symtab_node::asm_name(), symbol_table::cloned_nodes, symtab_node::decl, DECL_SOURCE_COLUMN, DECL_SOURCE_FILE, DECL_SOURCE_LINE, symbol_table::ipa_clones_dump_file, symtab_node::order, and symtab.
Referenced by clone_inlined_nodes(), cgraph_node::create_clone(), and cgraph_node::create_version_clone().
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_cleared_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().
void initialize_inline_failed | ( | struct cgraph_edge * | e | ) |
In ipa-inline-analysis.cc
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().
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 symtab_node::alias, varpool_node::call_for_symbol_and_aliases(), clear_addressable_bit(), symtab_node::decl, dump_file, symtab_node::dump_name(), FOR_EACH_VARIABLE, symtab_node::get_section(), NULL, process_references(), set_readonly_bit(), set_writeonly_bit(), TREE_ADDRESSABLE, TREE_READONLY, and symtab_node::writeonly.
Referenced by propagate().
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(), 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().
void release_function_body | ( | tree | decl | ) |
Helper function for cgraph_release_function_body and free_lang_data. It releases body from function DECL without having to inspect its possibly non-existent symtab node.
References CDI_DOMINATORS, CDI_POST_DOMINATORS, function::cfg, function::curr_properties, DECL_SAVED_TREE, DECL_STRUCT_FUNCTION, delete_tree_cfg_annotations(), delete_tree_ssa(), dom_info_available_p(), function::eh, free_cfg(), free_histograms(), gcc_assert, ggc_free(), function::gimple_df, gimple_set_body(), loop_optimizer_finalize(), loops_for_fn(), NULL, and function::value_histograms.
Referenced by cgraph_node::release_body().
|
inline |
Return true when RESOLUTION indicate that linker will use the symbol from non-LTO object files.
Referenced by symtab_node::used_from_object_file_p().
bool speculation_useful_p | ( | struct cgraph_edge * | e, |
bool | anticipate_inlining ) |
Return true if speculation of edge E seems useful. If ANTICIPATE_INLINING is true, be conservative and hope that E may get inlined.
References AVAIL_AVAILABLE, cgraph_edge::callee, cgraph_edge::caller, CAN_INLINE_DISREGARD_LIMITS, can_inline_edge_by_limits_p(), can_inline_edge_p(), symtab_node::decl, ECF_CONST, cgraph_indirect_call_info::ecf_flags, ECF_PURE, flags_from_decl_or_type(), gcc_assert, cgraph_edge::indirect_info, cgraph_edge::indirect_unknown_callee, cgraph_edge::inline_failed, cgraph_node::local, cgraph_edge::maybe_hot_p(), cgraph_edge::speculative, cgraph_edge::speculative_call_indirect_edge(), and cgraph_node::ultimate_alias_target().
Referenced by check_speculations_1(), inline_small_functions(), ipa_inline(), and resolve_noninline_speculation().
void symtab_thunks_cc_finalize | ( | void | ) |
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(), 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().
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, INT_MAX, opt_for_fn, and cgraph_node::tp_first_run.
Referenced by expand_all_functions().
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, cgraph_node::callees, cgraph_node::calls_declare_variant_alt, 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, cgraph_node::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, cgraph_node::get(), clone_info::get(), hash_map< KeyId, Value, Traits >::get(), ipa_param_body_adjustments::get_new_param_chain(), ipa_param_adjustments::get_updated_indices(), 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, cgraph_node::indirect_calls, 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, ipa_replace_map::new_tree, cgraph_edge::next_callee, NULL, NULL_TREE, number_blocks(), gcc_debug_hooks::outlining_inline_function, clone_info::param_adjustments, ipa_replace_map::parm_num, 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(), cgraph_node::used_as_abstract_origin, 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().
|
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_strdup.
Referenced by dump_probability(), and dump_profile().
|
extern |
Names used to print out the availability enum.
Referenced by cgraph_node::dump(), and varpool_node::dump().
|
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().
|
extern |
Referenced by symtab_node::dump_base().
|
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.
|
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(), ipcp_transformation_t::create_ggc(), modref_summaries::create_ggc(), modref_summaries_lto::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(), cgraph_node::get_create(), clone_info::get_create(), nested_function_info::get_create(), thunk_info::get_create(), cgraph_node::get_fini_priority(), symtab_node::get_for_asmname(), symtab_node::get_init_priority(), gimple_fold_builtin_acc_on_device(), gimple_fold_builtin_omp_is_initial_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(), cgraph_node::remove(), clone_info::remove(), thunk_info::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().
|
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().