1 | /* Default common target hook functions. |
2 | Copyright (C) 2003-2024 Free Software Foundation, Inc. |
3 | |
4 | This file is part of GCC. |
5 | |
6 | GCC is free software; you can redistribute it and/or modify it under |
7 | the terms of the GNU General Public License as published by the Free |
8 | Software Foundation; either version 3, or (at your option) any later |
9 | version. |
10 | |
11 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
12 | WARRANTY; without even the implied warranty of MERCHANTABILITY or |
13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
14 | for more details. |
15 | |
16 | You should have received a copy of the GNU General Public License |
17 | along with GCC; see the file COPYING3. If not see |
18 | <http://www.gnu.org/licenses/>. */ |
19 | |
20 | #include "config.h" |
21 | #include "system.h" |
22 | #include "coretypes.h" |
23 | #include "tm.h" |
24 | #include "common/common-target.h" |
25 | #include "common/common-targhooks.h" |
26 | #include "opts.h" |
27 | |
28 | /* Determine the exception handling mechanism for the target. */ |
29 | |
30 | enum unwind_info_type |
31 | default_except_unwind_info (struct gcc_options *opts ATTRIBUTE_UNUSED) |
32 | { |
33 | /* Obey the configure switch to turn on sjlj exceptions. */ |
34 | #ifdef CONFIG_SJLJ_EXCEPTIONS |
35 | if (CONFIG_SJLJ_EXCEPTIONS) |
36 | return UI_SJLJ; |
37 | #endif |
38 | |
39 | /* ??? Change all users to the hook, then poison this. */ |
40 | #ifdef DWARF2_UNWIND_INFO |
41 | if (DWARF2_UNWIND_INFO) |
42 | return UI_DWARF2; |
43 | #endif |
44 | |
45 | return UI_SJLJ; |
46 | } |
47 | |
48 | /* To be used by targets that force dwarf2 unwind enabled. */ |
49 | |
50 | enum unwind_info_type |
51 | dwarf2_except_unwind_info (struct gcc_options *opts ATTRIBUTE_UNUSED) |
52 | { |
53 | /* Obey the configure switch to turn on sjlj exceptions. */ |
54 | #ifdef CONFIG_SJLJ_EXCEPTIONS |
55 | if (CONFIG_SJLJ_EXCEPTIONS) |
56 | return UI_SJLJ; |
57 | #endif |
58 | |
59 | return UI_DWARF2; |
60 | } |
61 | |
62 | /* To be used by targets that force sjlj unwind enabled. */ |
63 | |
64 | enum unwind_info_type |
65 | sjlj_except_unwind_info (struct gcc_options *opts ATTRIBUTE_UNUSED) |
66 | { |
67 | return UI_SJLJ; |
68 | } |
69 | |
70 | /* Default version of TARGET_HANDLE_OPTION. */ |
71 | |
72 | bool |
73 | default_target_handle_option (struct gcc_options *opts ATTRIBUTE_UNUSED, |
74 | struct gcc_options *opts_set ATTRIBUTE_UNUSED, |
75 | const struct cl_decoded_option *decoded ATTRIBUTE_UNUSED, |
76 | location_t loc ATTRIBUTE_UNUSED) |
77 | { |
78 | return true; |
79 | } |
80 | |
81 | /* Default version of TARGET_GET_VALID_OPTION_VALUES. */ |
82 | |
83 | vec<const char *> |
84 | default_get_valid_option_values (int, const char *) |
85 | { |
86 | return vec<const char *> (); |
87 | } |
88 | |
89 | const struct default_options empty_optimization_table[] = |
90 | { |
91 | { .levels: OPT_LEVELS_NONE, .opt_index: 0, NULL, .value: 0 } |
92 | }; |
93 | |
94 | /* Default version of TARGET_COMPUTE_MULTILIB. */ |
95 | const char * |
96 | default_compute_multilib( |
97 | const struct switchstr *, |
98 | int, |
99 | const char *multilib, |
100 | const char *, |
101 | const char *, |
102 | const char *, |
103 | const char *, |
104 | const char *) |
105 | { |
106 | return multilib; |
107 | } |
108 | |