1 | /* Target hook definitions for common hooks. |
2 | Copyright (C) 2011-2023 Free Software Foundation, Inc. |
3 | |
4 | This program is free software; you can redistribute it and/or modify it |
5 | under the terms of the GNU General Public License as published by the |
6 | Free Software Foundation; either version 3, or (at your option) any |
7 | later version. |
8 | |
9 | This program is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU General Public License |
15 | along with this program; see the file COPYING3. If not see |
16 | <http://www.gnu.org/licenses/>. */ |
17 | |
18 | /* See target-hooks-macros.h for details of macros that should be |
19 | provided by the including file, and how to use them here. */ |
20 | #include "target-hooks-macros.h" |
21 | |
22 | #undef HOOK_TYPE |
23 | #define HOOK_TYPE "Common Target Hook" |
24 | |
25 | HOOK_VECTOR (TARGETM_COMMON_INITIALIZER, gcc_targetm_common) |
26 | |
27 | #undef HOOK_PREFIX |
28 | #define HOOK_PREFIX "TARGET_" |
29 | |
30 | /* Handle target switch DECODED for options structures OPTS and |
31 | OPTS_SET, at location LOC. Return true if the switch was valid. */ |
32 | DEFHOOK |
33 | (handle_option, |
34 | "" , |
35 | bool, (struct gcc_options *opts, struct gcc_options *opts_set, |
36 | const struct cl_decoded_option *decoded, |
37 | location_t loc), |
38 | default_target_handle_option) |
39 | |
40 | DEFHOOK |
41 | (option_init_struct, |
42 | "Set target-dependent initial values of fields in @var{opts}." , |
43 | void, (struct gcc_options *opts), |
44 | hook_void_gcc_optionsp) |
45 | |
46 | /* Set default optimizations for the target. */ |
47 | DEFHOOKPOD |
48 | (option_optimization_table, |
49 | "" , |
50 | const struct default_options *, empty_optimization_table) |
51 | |
52 | /* The initial value of target_flags. */ |
53 | DEFHOOKPOD |
54 | (default_target_flags, |
55 | "" , |
56 | int, 0) |
57 | |
58 | /* Determine the type of unwind info to emit for exceptions. */ |
59 | DEFHOOK |
60 | (except_unwind_info, |
61 | "" , |
62 | enum unwind_info_type, (struct gcc_options *opts), |
63 | default_except_unwind_info) |
64 | |
65 | DEFHOOK |
66 | (supports_split_stack, |
67 | "Whether this target supports splitting the stack when the options\n\ |
68 | described in @var{opts} have been passed. This is called\n\ |
69 | after options have been parsed, so the target may reject splitting\n\ |
70 | the stack in some configurations. The default version of this hook\n\ |
71 | returns false. If @var{report} is true, this function may issue a warning\n\ |
72 | or error; if @var{report} is false, it must simply return a value" , |
73 | bool, (bool report, struct gcc_options *opts), |
74 | hook_bool_bool_gcc_optionsp_false) |
75 | |
76 | DEFHOOK |
77 | (get_valid_option_values, |
78 | "The hook is used for options that have a non-trivial list of\n\ |
79 | possible option values. OPTION_CODE is option code of opt_code\n\ |
80 | enum type. PREFIX is used for bash completion and allows an implementation\n\ |
81 | to return more specific completion based on the prefix. All string values\n\ |
82 | should be allocated from heap memory and consumers should release them.\n\ |
83 | The result will be pruned to cases with PREFIX if not NULL." , |
84 | vec<const char *>, (int option_code, const char *prefix), |
85 | default_get_valid_option_values) |
86 | |
87 | DEFHOOK |
88 | (compute_multilib, |
89 | "Some targets like RISC-V might have complicated multilib reuse rules which\n\ |
90 | are hard to implement with the current multilib scheme. This hook allows\n\ |
91 | targets to override the result from the built-in multilib mechanism.\n\ |
92 | @var{switches} is the raw option list with @var{n_switches} items;\n\ |
93 | @var{multilib_dir} is the multi-lib result which is computed by the built-in\n\ |
94 | multi-lib mechanism;\n\ |
95 | @var{multilib_defaults} is the default options list for multi-lib;\n\ |
96 | @var{multilib_select} is the string containing the list of supported\n\ |
97 | multi-libs, and the option checking list.\n\ |
98 | @var{multilib_matches}, @var{multilib_exclusions}, and @var{multilib_reuse}\n\ |
99 | are corresponding to @var{MULTILIB_MATCHES}, @var{MULTILIB_EXCLUSIONS},\n\ |
100 | and @var{MULTILIB_REUSE}.\n\ |
101 | The default definition does nothing but return @var{multilib_dir} directly." , |
102 | const char *, (const struct switchstr *switches, |
103 | int n_switches, |
104 | const char *multilib_dir, |
105 | const char *multilib_defaults, |
106 | const char *multilib_select, |
107 | const char *multilib_matches, |
108 | const char *multilib_exclusions, |
109 | const char *multilib_reuse), |
110 | default_compute_multilib) |
111 | |
112 | /* Leave the boolean fields at the end. */ |
113 | |
114 | /* True if unwinding tables should be generated by default. */ |
115 | DEFHOOKPOD |
116 | (unwind_tables_default, |
117 | "" , |
118 | bool, false) |
119 | |
120 | /* True if arbitrary sections are supported. */ |
121 | DEFHOOKPOD |
122 | (have_named_sections, |
123 | "" , |
124 | bool, true) |
125 | |
126 | DEFHOOKPOD |
127 | (always_strip_dotdot, |
128 | "True if @file{..} components should always be removed from directory names\n\ |
129 | computed relative to GCC's internal directories, false (default) if such\n\ |
130 | components should be preserved and directory names containing them passed\n\ |
131 | to other tools such as the linker." , |
132 | bool, false) |
133 | |
134 | HOOK_VECTOR_END (C90_EMPTY_HACK) |
135 | |
136 | #undef HOOK_PREFIX |
137 | |