]>
Commit | Line | Data |
---|---|---|
677f3fa8 | 1 | /* Common hooks for IBM S/390 and zSeries. |
a5544970 | 2 | Copyright (C) 1999-2019 Free Software Foundation, Inc. |
677f3fa8 JM |
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 "diagnostic-core.h" | |
24 | #include "tm.h" | |
25 | #include "common/common-target.h" | |
26 | #include "common/common-target-def.h" | |
27 | #include "opts.h" | |
28 | #include "flags.h" | |
29 | ||
30 | EXPORTED_CONST int processor_flags_table[] = | |
31 | { | |
677f3fa8 JM |
32 | /* z900 */ PF_IEEE_FLOAT | PF_ZARCH, |
33 | /* z990 */ PF_IEEE_FLOAT | PF_ZARCH | PF_LONG_DISPLACEMENT, | |
34 | /* z9-109 */ PF_IEEE_FLOAT | PF_ZARCH | PF_LONG_DISPLACEMENT | |
35 | | PF_EXTIMM, | |
36 | /* z9-ec */ PF_IEEE_FLOAT | PF_ZARCH | PF_LONG_DISPLACEMENT | |
37 | | PF_EXTIMM | PF_DFP, | |
38 | /* z10 */ PF_IEEE_FLOAT | PF_ZARCH | PF_LONG_DISPLACEMENT | |
39 | | PF_EXTIMM | PF_DFP | PF_Z10, | |
40 | /* z196 */ PF_IEEE_FLOAT | PF_ZARCH | PF_LONG_DISPLACEMENT | |
22ac2c2f AK |
41 | | PF_EXTIMM | PF_DFP | PF_Z10 | PF_Z196, |
42 | /* zEC12 */ PF_IEEE_FLOAT | PF_ZARCH | PF_LONG_DISPLACEMENT | |
55ac540c AK |
43 | | PF_EXTIMM | PF_DFP | PF_Z10 | PF_Z196 | PF_ZEC12 | PF_TX, |
44 | /* z13 */ PF_IEEE_FLOAT | PF_ZARCH | PF_LONG_DISPLACEMENT | |
5a3fe9b6 | 45 | | PF_EXTIMM | PF_DFP | PF_Z10 | PF_Z196 | PF_ZEC12 | PF_TX |
6654e96f | 46 | | PF_Z13 | PF_VX, |
e9e8efc9 | 47 | /* z14 */ PF_IEEE_FLOAT | PF_ZARCH | PF_LONG_DISPLACEMENT |
6654e96f | 48 | | PF_EXTIMM | PF_DFP | PF_Z10 | PF_Z196 | PF_ZEC12 | PF_TX |
e9e8efc9 | 49 | | PF_Z13 | PF_VX | PF_VXE | PF_Z14 |
677f3fa8 JM |
50 | }; |
51 | ||
52 | /* Change optimizations to be performed, depending on the | |
53 | optimization level. */ | |
54 | ||
55 | static const struct default_options s390_option_optimization_table[] = | |
56 | { | |
c881de02 | 57 | /* Enable -fsched-pressure by default when optimizing. */ |
aefa216b | 58 | { OPT_LEVELS_1_PLUS, OPT_fsched_pressure, NULL, 1 }, |
aefa216b | 59 | |
677f3fa8 JM |
60 | /* ??? There are apparently still problems with -fcaller-saves. */ |
61 | { OPT_LEVELS_ALL, OPT_fcaller_saves, NULL, 0 }, | |
62 | ||
63 | /* Use MVCLE instructions to decrease code size if requested. */ | |
64 | { OPT_LEVELS_SIZE, OPT_mmvcle, NULL, 1 }, | |
65 | ||
66 | { OPT_LEVELS_NONE, 0, NULL, 0 } | |
67 | }; | |
68 | ||
69 | /* Implement TARGET_OPTION_INIT_STRUCT. */ | |
70 | ||
71 | static void | |
72 | s390_option_init_struct (struct gcc_options *opts) | |
73 | { | |
74 | /* By default, always emit DWARF-2 unwind info. This allows debugging | |
75 | without maintaining a stack frame back-chain. */ | |
76 | opts->x_flag_asynchronous_unwind_tables = 1; | |
8c66130b IL |
77 | |
78 | /* Enable section anchors by default. */ | |
79 | opts->x_flag_section_anchors = 1; | |
677f3fa8 JM |
80 | } |
81 | ||
82 | /* Implement TARGET_HANDLE_OPTION. */ | |
83 | ||
ec47b086 DV |
84 | bool |
85 | s390_handle_option (struct gcc_options *opts ATTRIBUTE_UNUSED, | |
677f3fa8 JM |
86 | struct gcc_options *opts_set ATTRIBUTE_UNUSED, |
87 | const struct cl_decoded_option *decoded, | |
88 | location_t loc) | |
89 | { | |
90 | size_t code = decoded->opt_index; | |
677f3fa8 JM |
91 | int value = decoded->value; |
92 | ||
93 | switch (code) | |
94 | { | |
677f3fa8 | 95 | case OPT_mstack_guard_: |
ec47b086 | 96 | if (value != 0 && exact_log2 (value) == -1) |
677f3fa8 JM |
97 | error_at (loc, "stack guard value must be an exact power of 2"); |
98 | return true; | |
99 | ||
100 | case OPT_mstack_size_: | |
ec47b086 | 101 | if (value != 0 && exact_log2 (value) == -1) |
677f3fa8 JM |
102 | error_at (loc, "stack size must be an exact power of 2"); |
103 | return true; | |
104 | ||
677f3fa8 JM |
105 | default: |
106 | return true; | |
107 | } | |
108 | } | |
109 | ||
4cb4721f MK |
110 | /* -fsplit-stack uses a field in the TCB, available with glibc-2.23. |
111 | We don't verify it, since earlier versions just have padding at | |
112 | its place, which works just as well. */ | |
113 | ||
114 | static bool | |
115 | s390_supports_split_stack (bool report ATTRIBUTE_UNUSED, | |
116 | struct gcc_options *opts ATTRIBUTE_UNUSED) | |
117 | { | |
118 | return true; | |
119 | } | |
120 | ||
677f3fa8 JM |
121 | #undef TARGET_DEFAULT_TARGET_FLAGS |
122 | #define TARGET_DEFAULT_TARGET_FLAGS (TARGET_DEFAULT) | |
123 | ||
124 | #undef TARGET_HANDLE_OPTION | |
125 | #define TARGET_HANDLE_OPTION s390_handle_option | |
126 | ||
127 | #undef TARGET_OPTION_OPTIMIZATION_TABLE | |
128 | #define TARGET_OPTION_OPTIMIZATION_TABLE s390_option_optimization_table | |
129 | ||
130 | #undef TARGET_OPTION_INIT_STRUCT | |
131 | #define TARGET_OPTION_INIT_STRUCT s390_option_init_struct | |
132 | ||
4cb4721f MK |
133 | #undef TARGET_SUPPORTS_SPLIT_STACK |
134 | #define TARGET_SUPPORTS_SPLIT_STACK s390_supports_split_stack | |
135 | ||
677f3fa8 | 136 | struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; |