GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "stringpool.h"
#include "gimple.h"
#include "diagnostic-core.h"
#include "gimple-ssa.h"
#include "cgraph.h"
#include "tree-pass.h"
#include "target.h"
#include "attribs.h"
#include "pretty-print.h"
#include "gimple-iterator.h"
#include "gimple-walk.h"
#include "tree-inline.h"
#include "intl.h"
Functions | |
static tree | replace_function_decl (tree *op, int *walk_subtrees, void *data) |
static void | create_dispatcher_calls (struct cgraph_node *node) |
static cgraph_node * | create_target_clone (cgraph_node *node, bool definition, char *name, tree attributes) |
static bool | expand_target_clones (struct cgraph_node *node, bool definition) |
static void | redirect_to_specific_clone (cgraph_node *node) |
static bool | is_simple_target_clones_case (cgraph_node *node) |
static unsigned int | ipa_target_clone (bool early) |
simple_ipa_opt_pass * | make_pass_target_clone (gcc::context *ctxt) |
|
static |
In target FMV attributes, if the call in NODE has multiple target attribute with multiple fields, replace it with calls to the dispatched symbol and create the dispatcher body (once). In target_version semantics, if it is a lone annotated default, then the dispatched symbol is changed to be an alias and no resolver is required. Otherwise, redirect all calls and references to the dispatched symbol, but only create the resolver body if the default version is implemented.
References symtab_node::add_to_same_comdat_group(), symtab_node::alias, symtab_node::alias_target, symtab_node::analyzed, cgraph_node::callers, symtab_node::create_reference(), symtab_node::decl, DECL_ARTIFICIAL, DECL_ASSEMBLER_NAME, DECL_ATTRIBUTES, DECL_EXTERNAL, DECL_INITIAL, DECL_SOURCE_LOCATION, symtab_node::definition, dyn_cast(), error_at(), symtab_node::externally_visible, FOR_EACH_VEC_ELT, symtab_node::force_output, symtab_node::forced_by_abi, cgraph_node::function_version(), gcc_assert, gcc_unreachable, cgraph_node::get(), symtab_node::get_comdat_group(), gsi_for_stmt(), i, IDENTIFIER_POINTER, IPA_REF_ADDR, IPA_REF_ALIAS, symtab_node::iterate_referring(), make_attribute(), symtab_node::make_decl_local(), cgraph_function_version_info::next, NULL, cgraph_edge::redirect_call_stmt_to_callee(), ipa_ref::referring, symtab_node::remove_from_same_comdat_group(), ipa_ref::remove_reference(), replace_function_decl(), symtab_node::resolve_alias(), symtab_node::same_comdat_group, symtab_node::set_comdat_group(), symtab_node::set_section(), ipa_ref::stmt, TARGET_HAS_FMV_TARGET_ATTRIBUTE, targetm, cgraph_function_version_info::this_node, TREE_STATIC, TREE_USED, ipa_ref::use, walk_gimple_stmt(), and walk_tree.
Referenced by ipa_target_clone().
|
static |
Creates target clone of NODE.
References clone_function_name(), copy_node(), cgraph_node::create_version_clone_with_body(), symtab_node::decl, DECL_ATTRIBUTES, symtab_node::force_output, cgraph_node::get_create(), NULL, symtab, and vNULL.
Referenced by expand_target_clones().
|
static |
If the function in NODE has multiple target attributes create the appropriate clone for each valid target attribute.
References cgraph_node::add_function_version(), symtab_node::alias, cgraph_function_version_info::assembler_name, copy_forbidden(), create_target_clone(), symtab_node::decl, DECL_ATTRIBUTES, DECL_FUNCTION_VERSIONED, DECL_SOURCE_LOCATION, DECL_STRUCT_FUNCTION, symtab_node::definition, cgraph_node::delete_function_version(), error_at(), cgraph_node::function_version(), G_, gcc_assert, get_clone_versions(), inform(), cgraph_node::insert_new_function_version(), cgraph_node::is_target_clone, cgraph_node::local, lookup_attribute(), make_attribute(), cgraph_function_version_info::next, NULL, cgraph_function_version_info::prev, cgraph_node::remove(), remove_attribute(), symtab, TARGET_HAS_FMV_TARGET_ATTRIBUTE, targetm, tree_versionable_function_p(), and warning_at().
Referenced by ipa_target_clone().
|
static |
References create_dispatcher_calls(), symtab_node::decl, DECL_ATTRIBUTES, DECL_FUNCTION_VERSIONED, symtab_node::definition, expand_target_clones(), FOR_EACH_FUNCTION, FOR_EACH_FUNCTION_REMOVABLE, i, is_function_default_version(), is_simple_target_clones_case(), lookup_attribute(), redirect_to_specific_clone(), and TARGET_HAS_FMV_TARGET_ATTRIBUTE.
|
static |
Checks if NODE is in the 'simple' target_clones case, which is where NODE is a declaration annotated with target_clones containing the default, and it is the sole function declaration in the FMV function set.
References symtab_node::decl, cgraph_node::function_version(), get_clone_versions(), cgraph_function_version_info::next, cgraph_function_version_info::prev, and TARGET_HAS_FMV_TARGET_ATTRIBUTE.
Referenced by ipa_target_clone().
simple_ipa_opt_pass * make_pass_target_clone | ( | gcc::context * | ctxt | ) |
|
static |
When NODE is part of an FMV function set, consider all callees and check if any can provably always resolve a certain version and then call that version directly.
References symtab_node::binds_to_current_def_p(), cgraph_node::callees, symtab_node::decl, gcc_assert, is_function_default_version(), cgraph_function_version_info::next, NULL, cgraph_function_version_info::prev, cgraph_edge::redirect_call_stmt_to_callee(), targetm, and cgraph_function_version_info::this_node.
Referenced by ipa_target_clone().
Pass for parsing functions with multiple target attributes. Contributed by Evgeny Stupachenko <evstupac@gmail.com> Copyright (C) 2015-2025 Free Software Foundation, Inc. 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/>.
Walker callback that replaces all FUNCTION_DECL of a function that's going to be versioned.
References walk_stmt_info::info, NULL, and TREE_CODE.
Referenced by create_dispatcher_calls().