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