/* Target hook definitions for common hooks. Copyright (C) 2011-2023 Free Software Foundation, Inc. This program 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. This program 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 this program; see the file COPYING3. If not see . */ /* See target-hooks-macros.h for details of macros that should be provided by the including file, and how to use them here. */ #include "target-hooks-macros.h" #undef HOOK_TYPE #define HOOK_TYPE "Common Target Hook" HOOK_VECTOR (TARGETM_COMMON_INITIALIZER, gcc_targetm_common) #undef HOOK_PREFIX #define HOOK_PREFIX "TARGET_" /* Handle target switch DECODED for options structures OPTS and OPTS_SET, at location LOC. Return true if the switch was valid. */ DEFHOOK (handle_option, "", bool, (struct gcc_options *opts, struct gcc_options *opts_set, const struct cl_decoded_option *decoded, location_t loc), default_target_handle_option) DEFHOOK (option_init_struct, "Set target-dependent initial values of fields in @var{opts}.", void, (struct gcc_options *opts), hook_void_gcc_optionsp) /* Set default optimizations for the target. */ DEFHOOKPOD (option_optimization_table, "", const struct default_options *, empty_optimization_table) /* The initial value of target_flags. */ DEFHOOKPOD (default_target_flags, "", int, 0) /* Determine the type of unwind info to emit for exceptions. */ DEFHOOK (except_unwind_info, "", enum unwind_info_type, (struct gcc_options *opts), default_except_unwind_info) DEFHOOK (supports_split_stack, "Whether this target supports splitting the stack when the options\n\ described in @var{opts} have been passed. This is called\n\ after options have been parsed, so the target may reject splitting\n\ the stack in some configurations. The default version of this hook\n\ returns false. If @var{report} is true, this function may issue a warning\n\ or error; if @var{report} is false, it must simply return a value", bool, (bool report, struct gcc_options *opts), hook_bool_bool_gcc_optionsp_false) DEFHOOK (get_valid_option_values, "The hook is used for options that have a non-trivial list of\n\ possible option values. OPTION_CODE is option code of opt_code\n\ enum type. PREFIX is used for bash completion and allows an implementation\n\ to return more specific completion based on the prefix. All string values\n\ should be allocated from heap memory and consumers should release them.\n\ The result will be pruned to cases with PREFIX if not NULL.", vec, (int option_code, const char *prefix), default_get_valid_option_values) DEFHOOK (compute_multilib, "Some targets like RISC-V might have complicated multilib reuse rules which\n\ are hard to implement with the current multilib scheme. This hook allows\n\ targets to override the result from the built-in multilib mechanism.\n\ @var{switches} is the raw option list with @var{n_switches} items;\n\ @var{multilib_dir} is the multi-lib result which is computed by the built-in\n\ multi-lib mechanism;\n\ @var{multilib_defaults} is the default options list for multi-lib;\n\ @var{multilib_select} is the string containing the list of supported\n\ multi-libs, and the option checking list.\n\ @var{multilib_matches}, @var{multilib_exclusions}, and @var{multilib_reuse}\n\ are corresponding to @var{MULTILIB_MATCHES}, @var{MULTILIB_EXCLUSIONS},\n\ and @var{MULTILIB_REUSE}.\n\ The default definition does nothing but return @var{multilib_dir} directly.", const char *, (const struct switchstr *switches, int n_switches, const char *multilib_dir, const char *multilib_defaults, const char *multilib_select, const char *multilib_matches, const char *multilib_exclusions, const char *multilib_reuse), default_compute_multilib) /* Leave the boolean fields at the end. */ /* True if unwinding tables should be generated by default. */ DEFHOOKPOD (unwind_tables_default, "", bool, false) /* True if arbitrary sections are supported. */ DEFHOOKPOD (have_named_sections, "", bool, true) DEFHOOKPOD (always_strip_dotdot, "True if @file{..} components should always be removed from directory names\n\ computed relative to GCC's internal directories, false (default) if such\n\ components should be preserved and directory names containing them passed\n\ to other tools such as the linker.", bool, false) HOOK_VECTOR_END (C90_EMPTY_HACK) #undef HOOK_PREFIX