]>
Commit | Line | Data |
---|---|---|
9db1d521 | 1 | /* Definitions of target machine for GNU compiler, for IBM S/390 |
5624e564 | 2 | Copyright (C) 1999-2015 Free Software Foundation, Inc. |
9db1d521 | 3 | Contributed by Hartmut Penner (hpenner@de.ibm.com) and |
f314b9b1 | 4 | Ulrich Weigand (uweigand@de.ibm.com). |
963fc8d0 | 5 | Andreas Krebbel (Andreas.Krebbel@de.ibm.com) |
9db1d521 | 6 | |
58add37a | 7 | This file is part of GCC. |
9db1d521 | 8 | |
58add37a UW |
9 | GCC is free software; you can redistribute it and/or modify it under |
10 | the terms of the GNU General Public License as published by the Free | |
2f83c7d6 | 11 | Software Foundation; either version 3, or (at your option) any later |
58add37a UW |
12 | version. |
13 | ||
14 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
15 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
16 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
17 | for more details. | |
9db1d521 HP |
18 | |
19 | You should have received a copy of the GNU General Public License | |
2f83c7d6 NC |
20 | along with GCC; see the file COPYING3. If not see |
21 | <http://www.gnu.org/licenses/>. */ | |
9db1d521 HP |
22 | |
23 | #ifndef _S390_H | |
24 | #define _S390_H | |
25 | ||
f13e0d4e UW |
26 | /* Optional architectural facilities supported by the processor. */ |
27 | ||
28 | enum processor_flags | |
29 | { | |
30 | PF_IEEE_FLOAT = 1, | |
31 | PF_ZARCH = 2, | |
ec24698e | 32 | PF_LONG_DISPLACEMENT = 4, |
85dae55a | 33 | PF_EXTIMM = 8, |
93538e8e | 34 | PF_DFP = 16, |
65b1d8ea | 35 | PF_Z10 = 32, |
22ac2c2f | 36 | PF_Z196 = 64, |
5a3fe9b6 | 37 | PF_ZEC12 = 128, |
55ac540c AK |
38 | PF_TX = 256, |
39 | PF_Z13 = 512, | |
40 | PF_VX = 1024 | |
f13e0d4e UW |
41 | }; |
42 | ||
90c6fd8a AK |
43 | /* This is necessary to avoid a warning about comparing different enum |
44 | types. */ | |
45 | #define s390_tune_attr ((enum attr_cpu)s390_tune) | |
46 | ||
963fc8d0 AK |
47 | /* These flags indicate that the generated code should run on a cpu |
48 | providing the respective hardware facility regardless of the | |
49 | current cpu mode (ESA or z/Architecture). */ | |
50 | ||
f13e0d4e UW |
51 | #define TARGET_CPU_IEEE_FLOAT \ |
52 | (s390_arch_flags & PF_IEEE_FLOAT) | |
53 | #define TARGET_CPU_ZARCH \ | |
54 | (s390_arch_flags & PF_ZARCH) | |
55 | #define TARGET_CPU_LONG_DISPLACEMENT \ | |
56 | (s390_arch_flags & PF_LONG_DISPLACEMENT) | |
ec24698e UW |
57 | #define TARGET_CPU_EXTIMM \ |
58 | (s390_arch_flags & PF_EXTIMM) | |
85dae55a AK |
59 | #define TARGET_CPU_DFP \ |
60 | (s390_arch_flags & PF_DFP) | |
93538e8e AK |
61 | #define TARGET_CPU_Z10 \ |
62 | (s390_arch_flags & PF_Z10) | |
65b1d8ea AK |
63 | #define TARGET_CPU_Z196 \ |
64 | (s390_arch_flags & PF_Z196) | |
22ac2c2f AK |
65 | #define TARGET_CPU_ZEC12 \ |
66 | (s390_arch_flags & PF_ZEC12) | |
5a3fe9b6 AK |
67 | #define TARGET_CPU_HTM \ |
68 | (s390_arch_flags & PF_TX) | |
55ac540c AK |
69 | #define TARGET_CPU_Z13 \ |
70 | (s390_arch_flags & PF_Z13) | |
71 | #define TARGET_CPU_VX \ | |
72 | (s390_arch_flags & PF_VX) | |
f13e0d4e | 73 | |
963fc8d0 AK |
74 | /* These flags indicate that the generated code should run on a cpu |
75 | providing the respective hardware facility when run in | |
76 | z/Architecture mode. */ | |
77 | ||
f13e0d4e UW |
78 | #define TARGET_LONG_DISPLACEMENT \ |
79 | (TARGET_ZARCH && TARGET_CPU_LONG_DISPLACEMENT) | |
ec24698e UW |
80 | #define TARGET_EXTIMM \ |
81 | (TARGET_ZARCH && TARGET_CPU_EXTIMM) | |
85dae55a | 82 | #define TARGET_DFP \ |
fb068247 | 83 | (TARGET_ZARCH && TARGET_CPU_DFP && TARGET_HARD_FLOAT) |
93538e8e AK |
84 | #define TARGET_Z10 \ |
85 | (TARGET_ZARCH && TARGET_CPU_Z10) | |
65b1d8ea AK |
86 | #define TARGET_Z196 \ |
87 | (TARGET_ZARCH && TARGET_CPU_Z196) | |
22ac2c2f AK |
88 | #define TARGET_ZEC12 \ |
89 | (TARGET_ZARCH && TARGET_CPU_ZEC12) | |
167f68ed | 90 | #define TARGET_HTM (TARGET_OPT_HTM) |
55ac540c AK |
91 | #define TARGET_Z13 \ |
92 | (TARGET_ZARCH && TARGET_CPU_Z13) | |
93 | #define TARGET_VX \ | |
94 | (TARGET_ZARCH && TARGET_CPU_VX && TARGET_OPT_VX && TARGET_HARD_FLOAT) | |
65b1d8ea | 95 | |
55ac540c AK |
96 | /* Use the ABI introduced with IBM z13: |
97 | - pass vector arguments <= 16 bytes in VRs | |
98 | - align *all* vector types to 8 bytes */ | |
99 | #define TARGET_VX_ABI TARGET_VX | |
65b1d8ea AK |
100 | |
101 | #define TARGET_AVOID_CMP_AND_BRANCH (s390_tune == PROCESSOR_2817_Z196) | |
42c78618 | 102 | |
862a2d83 | 103 | /* Run-time target specification. */ |
9db1d521 | 104 | |
a771c4b3 UW |
105 | /* Defaults for option flags defined only on some subtargets. */ |
106 | #ifndef TARGET_TPF_PROFILING | |
107 | #define TARGET_TPF_PROFILING 0 | |
108 | #endif | |
109 | ||
4798630c D |
110 | /* This will be overridden by OS headers. */ |
111 | #define TARGET_TPF 0 | |
112 | ||
862a2d83 | 113 | /* Target CPU builtins. */ |
5a3fe9b6 AK |
114 | #define TARGET_CPU_CPP_BUILTINS() \ |
115 | do \ | |
116 | { \ | |
117 | builtin_assert ("cpu=s390"); \ | |
118 | builtin_assert ("machine=s390"); \ | |
119 | builtin_define ("__s390__"); \ | |
120 | if (TARGET_ZARCH) \ | |
121 | builtin_define ("__zarch__"); \ | |
122 | if (TARGET_64BIT) \ | |
123 | builtin_define ("__s390x__"); \ | |
124 | if (TARGET_LONG_DOUBLE_128) \ | |
125 | builtin_define ("__LONG_DOUBLE_128__"); \ | |
126 | if (TARGET_HTM) \ | |
127 | builtin_define ("__HTM__"); \ | |
128 | } \ | |
862a2d83 | 129 | while (0) |
9db1d521 | 130 | |
58d10f89 | 131 | #ifdef DEFAULT_TARGET_64BIT |
55ac540c AK |
132 | #define TARGET_DEFAULT (MASK_64BIT | MASK_ZARCH | MASK_HARD_DFP \ |
133 | | MASK_OPT_HTM | MASK_OPT_VX) | |
58d10f89 | 134 | #else |
85dae55a | 135 | #define TARGET_DEFAULT 0 |
58d10f89 UW |
136 | #endif |
137 | ||
f13e0d4e UW |
138 | /* Support for configure-time defaults. */ |
139 | #define OPTION_DEFAULT_SPECS \ | |
140 | { "mode", "%{!mesa:%{!mzarch:-m%(VALUE)}}" }, \ | |
141 | { "arch", "%{!march=*:-march=%(VALUE)}" }, \ | |
142 | { "tune", "%{!mtune=*:-mtune=%(VALUE)}" } | |
143 | ||
144 | /* Defaulting rules. */ | |
145 | #ifdef DEFAULT_TARGET_64BIT | |
146 | #define DRIVER_SELF_SPECS \ | |
147 | "%{!m31:%{!m64:-m64}}", \ | |
148 | "%{!mesa:%{!mzarch:%{m31:-mesa}%{m64:-mzarch}}}", \ | |
149 | "%{!march=*:%{mesa:-march=g5}%{mzarch:-march=z900}}" | |
150 | #else | |
151 | #define DRIVER_SELF_SPECS \ | |
152 | "%{!m31:%{!m64:-m31}}", \ | |
153 | "%{!mesa:%{!mzarch:%{m31:-mesa}%{m64:-mzarch}}}", \ | |
154 | "%{!march=*:%{mesa:-march=g5}%{mzarch:-march=z900}}" | |
155 | #endif | |
156 | ||
638e37c2 | 157 | /* Constants needed to control the TEST DATA CLASS (TDC) instruction. */ |
0387c142 WG |
158 | #define S390_TDC_POSITIVE_ZERO (1 << 11) |
159 | #define S390_TDC_NEGATIVE_ZERO (1 << 10) | |
160 | #define S390_TDC_POSITIVE_NORMALIZED_BFP_NUMBER (1 << 9) | |
161 | #define S390_TDC_NEGATIVE_NORMALIZED_BFP_NUMBER (1 << 8) | |
162 | #define S390_TDC_POSITIVE_DENORMALIZED_BFP_NUMBER (1 << 7) | |
163 | #define S390_TDC_NEGATIVE_DENORMALIZED_BFP_NUMBER (1 << 6) | |
164 | #define S390_TDC_POSITIVE_INFINITY (1 << 5) | |
165 | #define S390_TDC_NEGATIVE_INFINITY (1 << 4) | |
166 | #define S390_TDC_POSITIVE_QUIET_NAN (1 << 3) | |
167 | #define S390_TDC_NEGATIVE_QUIET_NAN (1 << 2) | |
168 | #define S390_TDC_POSITIVE_SIGNALING_NAN (1 << 1) | |
169 | #define S390_TDC_NEGATIVE_SIGNALING_NAN (1 << 0) | |
170 | ||
171 | /* The following values are different for DFP. */ | |
172 | #define S390_TDC_POSITIVE_DENORMALIZED_DFP_NUMBER (1 << 9) | |
173 | #define S390_TDC_NEGATIVE_DENORMALIZED_DFP_NUMBER (1 << 8) | |
174 | #define S390_TDC_POSITIVE_NORMALIZED_DFP_NUMBER (1 << 7) | |
175 | #define S390_TDC_NEGATIVE_NORMALIZED_DFP_NUMBER (1 << 6) | |
176 | ||
f4aa3848 | 177 | /* For signbit, the BFP-DFP-difference makes no difference. */ |
0f67fa83 | 178 | #define S390_TDC_SIGNBIT_SET (S390_TDC_NEGATIVE_ZERO \ |
0387c142 WG |
179 | | S390_TDC_NEGATIVE_NORMALIZED_BFP_NUMBER \ |
180 | | S390_TDC_NEGATIVE_DENORMALIZED_BFP_NUMBER\ | |
0f67fa83 WG |
181 | | S390_TDC_NEGATIVE_INFINITY \ |
182 | | S390_TDC_NEGATIVE_QUIET_NAN \ | |
183 | | S390_TDC_NEGATIVE_SIGNALING_NAN ) | |
184 | ||
638e37c2 WG |
185 | #define S390_TDC_INFINITY (S390_TDC_POSITIVE_INFINITY \ |
186 | | S390_TDC_NEGATIVE_INFINITY ) | |
9db1d521 | 187 | |
a5ba7b92 AK |
188 | /* This is used by float.h to define the float_t and double_t data |
189 | types. For historical reasons both are double on s390 what cannot | |
190 | be changed anymore. */ | |
191 | #define TARGET_FLT_EVAL_METHOD 1 | |
192 | ||
9db1d521 HP |
193 | /* Target machine storage layout. */ |
194 | ||
862a2d83 | 195 | /* Everything is big-endian. */ |
9db1d521 | 196 | #define BITS_BIG_ENDIAN 1 |
9db1d521 | 197 | #define BYTES_BIG_ENDIAN 1 |
9db1d521 HP |
198 | #define WORDS_BIG_ENDIAN 1 |
199 | ||
9602b6a1 AK |
200 | #define STACK_SIZE_MODE (Pmode) |
201 | ||
085261c8 AK |
202 | /* Vector arguments are left-justified when placed on the stack during |
203 | parameter passing. */ | |
204 | #define FUNCTION_ARG_PADDING(MODE, TYPE) \ | |
205 | (s390_function_arg_vector ((MODE), (TYPE)) \ | |
206 | ? upward \ | |
207 | : DEFAULT_FUNCTION_ARG_PADDING ((MODE), (TYPE))) | |
208 | ||
fe86047c | 209 | #ifndef IN_LIBGCC2 |
9602b6a1 AK |
210 | |
211 | /* Width of a word, in units (bytes). */ | |
212 | #define UNITS_PER_WORD (TARGET_ZARCH ? 8 : 4) | |
213 | ||
214 | /* Width of a pointer. To be used instead of UNITS_PER_WORD in | |
215 | ABI-relevant contexts. This always matches | |
216 | GET_MODE_SIZE (Pmode). */ | |
217 | #define UNITS_PER_LONG (TARGET_64BIT ? 8 : 4) | |
218 | #define MIN_UNITS_PER_WORD 4 | |
219 | #define MAX_BITS_PER_WORD 64 | |
220 | #else | |
221 | ||
222 | /* In libgcc, UNITS_PER_WORD has ABI-relevant effects, e.g. whether | |
223 | the library should export TImode functions or not. Thus, we have | |
224 | to redefine UNITS_PER_WORD depending on __s390x__ for libgcc. */ | |
225 | #ifdef __s390x__ | |
226 | #define UNITS_PER_WORD 8 | |
227 | #else | |
228 | #define UNITS_PER_WORD 4 | |
229 | #endif | |
fe86047c | 230 | #endif |
9602b6a1 AK |
231 | |
232 | /* Width of a pointer, in bits. */ | |
233 | #define POINTER_SIZE (TARGET_64BIT ? 64 : 32) | |
9db1d521 | 234 | |
9db1d521 | 235 | /* Allocation boundary (in *bits*) for storing arguments in argument list. */ |
9db1d521 HP |
236 | #define PARM_BOUNDARY (TARGET_64BIT ? 64 : 32) |
237 | ||
238 | /* Boundary (in *bits*) on which stack pointer should be aligned. */ | |
9db1d521 HP |
239 | #define STACK_BOUNDARY 64 |
240 | ||
241 | /* Allocation boundary (in *bits*) for the code of a function. */ | |
d0de9e13 | 242 | #define FUNCTION_BOUNDARY 64 |
9db1d521 HP |
243 | |
244 | /* There is no point aligning anything to a rounder boundary than this. */ | |
9db1d521 HP |
245 | #define BIGGEST_ALIGNMENT 64 |
246 | ||
247 | /* Alignment of field after `int : 0' in a structure. */ | |
9db1d521 HP |
248 | #define EMPTY_FIELD_BOUNDARY 32 |
249 | ||
f710504c | 250 | /* Alignment on even addresses for LARL instruction. */ |
9db1d521 | 251 | #define CONSTANT_ALIGNMENT(EXP, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN) |
df8a1d28 | 252 | #define DATA_ABI_ALIGNMENT(TYPE, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN) |
9db1d521 | 253 | |
862a2d83 | 254 | /* Alignment is not required by the hardware. */ |
9db1d521 HP |
255 | #define STRICT_ALIGNMENT 0 |
256 | ||
862a2d83 UW |
257 | /* Mode of stack savearea. |
258 | FUNCTION is VOIDmode because calling convention maintains SP. | |
259 | BLOCK needs Pmode for SP. | |
260 | NONLOCAL needs twice Pmode to maintain both backchain and SP. */ | |
261 | #define STACK_SAVEAREA_MODE(LEVEL) \ | |
262 | (LEVEL == SAVE_FUNCTION ? VOIDmode \ | |
43ab026f | 263 | : LEVEL == SAVE_NONLOCAL ? (TARGET_64BIT ? OImode : TImode) : Pmode) |
862a2d83 | 264 | |
9db1d521 | 265 | |
862a2d83 | 266 | /* Type layout. */ |
9db1d521 | 267 | |
862a2d83 UW |
268 | /* Sizes in bits of the source language data types. */ |
269 | #define SHORT_TYPE_SIZE 16 | |
270 | #define INT_TYPE_SIZE 32 | |
271 | #define LONG_TYPE_SIZE (TARGET_64BIT ? 64 : 32) | |
862a2d83 UW |
272 | #define LONG_LONG_TYPE_SIZE 64 |
273 | #define FLOAT_TYPE_SIZE 32 | |
274 | #define DOUBLE_TYPE_SIZE 64 | |
f61a2c7d AK |
275 | #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) |
276 | ||
f61a2c7d AK |
277 | /* Work around target_flags dependency in ada/targtyps.c. */ |
278 | #define WIDEST_HARDWARE_FP_SIZE 64 | |
862a2d83 UW |
279 | |
280 | /* We use "unsigned char" as default. */ | |
281 | #define DEFAULT_SIGNED_CHAR 0 | |
282 | ||
283 | ||
284 | /* Register usage. */ | |
285 | ||
286 | /* We have 16 general purpose registers (registers 0-15), | |
287 | and 16 floating point registers (registers 16-31). | |
288 | (On non-IEEE machines, we have only 4 fp registers.) | |
c7453384 | 289 | |
862a2d83 UW |
290 | Amongst the general purpose registers, some are used |
291 | for specific purposes: | |
292 | GPR 11: Hard frame pointer (if needed) | |
293 | GPR 12: Global offset table pointer (if needed) | |
294 | GPR 13: Literal pool base register | |
295 | GPR 14: Return address register | |
296 | GPR 15: Stack pointer | |
c7453384 | 297 | |
c5aa1d12 | 298 | Registers 32-35 are 'fake' hard registers that do not |
862a2d83 UW |
299 | correspond to actual hardware: |
300 | Reg 32: Argument pointer | |
301 | Reg 33: Condition code | |
f4aa3848 | 302 | Reg 34: Frame pointer |
c5aa1d12 | 303 | Reg 35: Return address pointer |
862a2d83 | 304 | |
f4aa3848 | 305 | Registers 36 and 37 are mapped to access registers |
085261c8 AK |
306 | 0 and 1, used to implement thread-local storage. |
307 | ||
308 | Reg 38-53: Vector registers v16-v31 */ | |
c5aa1d12 | 309 | |
085261c8 | 310 | #define FIRST_PSEUDO_REGISTER 54 |
862a2d83 UW |
311 | |
312 | /* Standard register usage. */ | |
8e509cf9 UW |
313 | #define GENERAL_REGNO_P(N) ((int)(N) >= 0 && (N) < 16) |
314 | #define ADDR_REGNO_P(N) ((N) >= 1 && (N) < 16) | |
142cd70f | 315 | #define FP_REGNO_P(N) ((N) >= 16 && (N) < 32) |
8e509cf9 | 316 | #define CC_REGNO_P(N) ((N) == 33) |
a38e09bc | 317 | #define FRAME_REGNO_P(N) ((N) == 32 || (N) == 34 || (N) == 35) |
c5aa1d12 | 318 | #define ACCESS_REGNO_P(N) ((N) == 36 || (N) == 37) |
085261c8 AK |
319 | #define VECTOR_NOFP_REGNO_P(N) ((N) >= 38 && (N) <= 53) |
320 | #define VECTOR_REGNO_P(N) (FP_REGNO_P (N) || VECTOR_NOFP_REGNO_P (N)) | |
8e509cf9 UW |
321 | |
322 | #define GENERAL_REG_P(X) (REG_P (X) && GENERAL_REGNO_P (REGNO (X))) | |
323 | #define ADDR_REG_P(X) (REG_P (X) && ADDR_REGNO_P (REGNO (X))) | |
324 | #define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X))) | |
325 | #define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X))) | |
4888ec5d | 326 | #define FRAME_REG_P(X) (REG_P (X) && FRAME_REGNO_P (REGNO (X))) |
c5aa1d12 | 327 | #define ACCESS_REG_P(X) (REG_P (X) && ACCESS_REGNO_P (REGNO (X))) |
085261c8 AK |
328 | #define VECTOR_NOFP_REG_P(X) (REG_P (X) && VECTOR_NOFP_REGNO_P (REGNO (X))) |
329 | #define VECTOR_REG_P(X) (REG_P (X) && VECTOR_REGNO_P (REGNO (X))) | |
9db1d521 | 330 | |
862a2d83 | 331 | /* Set up fixed registers and calling convention: |
9db1d521 | 332 | |
862a2d83 UW |
333 | GPRs 0-5 are always call-clobbered, |
334 | GPRs 6-15 are always call-saved. | |
335 | GPR 12 is fixed if used as GOT pointer. | |
336 | GPR 13 is always fixed (as literal pool pointer). | |
545d16ff | 337 | GPR 14 is always fixed on S/390 machines (as return address). |
862a2d83 UW |
338 | GPR 15 is always fixed (as stack pointer). |
339 | The 'fake' hard registers are call-clobbered and fixed. | |
c5aa1d12 | 340 | The access registers are call-saved and fixed. |
9db1d521 | 341 | |
862a2d83 UW |
342 | On 31-bit, FPRs 18-19 are call-clobbered; |
343 | on 64-bit, FPRs 24-31 are call-clobbered. | |
085261c8 AK |
344 | The remaining FPRs are call-saved. |
345 | ||
346 | All non-FP vector registers are call-clobbered v16-v31. */ | |
9db1d521 HP |
347 | |
348 | #define FIXED_REGISTERS \ | |
349 | { 0, 0, 0, 0, \ | |
350 | 0, 0, 0, 0, \ | |
351 | 0, 0, 0, 0, \ | |
352 | 0, 1, 1, 1, \ | |
353 | 0, 0, 0, 0, \ | |
354 | 0, 0, 0, 0, \ | |
355 | 0, 0, 0, 0, \ | |
356 | 0, 0, 0, 0, \ | |
c5aa1d12 | 357 | 1, 1, 1, 1, \ |
085261c8 AK |
358 | 1, 1, \ |
359 | 0, 0, 0, 0, \ | |
360 | 0, 0, 0, 0, \ | |
361 | 0, 0, 0, 0, \ | |
362 | 0, 0, 0, 0 } | |
9db1d521 | 363 | |
9db1d521 HP |
364 | #define CALL_USED_REGISTERS \ |
365 | { 1, 1, 1, 1, \ | |
366 | 1, 1, 0, 0, \ | |
367 | 0, 0, 0, 0, \ | |
368 | 0, 1, 1, 1, \ | |
4023fb28 UW |
369 | 1, 1, 1, 1, \ |
370 | 1, 1, 1, 1, \ | |
371 | 1, 1, 1, 1, \ | |
372 | 1, 1, 1, 1, \ | |
c5aa1d12 | 373 | 1, 1, 1, 1, \ |
085261c8 AK |
374 | 1, 1, \ |
375 | 1, 1, 1, 1, \ | |
376 | 1, 1, 1, 1, \ | |
377 | 1, 1, 1, 1, \ | |
378 | 1, 1, 1, 1 } | |
4023fb28 | 379 | |
4023fb28 | 380 | #define CALL_REALLY_USED_REGISTERS \ |
085261c8 | 381 | { 1, 1, 1, 1, /* r0 - r15 */ \ |
9db1d521 | 382 | 1, 1, 0, 0, \ |
4023fb28 UW |
383 | 0, 0, 0, 0, \ |
384 | 0, 0, 0, 0, \ | |
085261c8 | 385 | 1, 1, 1, 1, /* f0 (16) - f15 (31) */ \ |
9db1d521 HP |
386 | 1, 1, 1, 1, \ |
387 | 1, 1, 1, 1, \ | |
388 | 1, 1, 1, 1, \ | |
085261c8 AK |
389 | 1, 1, 1, 1, /* arg, cc, fp, ret addr */ \ |
390 | 0, 0, /* a0 (36), a1 (37) */ \ | |
391 | 1, 1, 1, 1, /* v16 (38) - v23 (45) */ \ | |
c5aa1d12 | 392 | 1, 1, 1, 1, \ |
085261c8 AK |
393 | 1, 1, 1, 1, /* v24 (46) - v31 (53) */ \ |
394 | 1, 1, 1, 1 } | |
9db1d521 | 395 | |
862a2d83 | 396 | /* Preferred register allocation order. */ |
085261c8 AK |
397 | #define REG_ALLOC_ORDER \ |
398 | { 1, 2, 3, 4, 5, 0, 12, 11, 10, 9, 8, 7, 6, 14, 13, \ | |
399 | 16, 17, 18, 19, 20, 21, 22, 23, \ | |
400 | 24, 25, 26, 27, 28, 29, 30, 31, \ | |
401 | 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, \ | |
402 | 15, 32, 33, 34, 35, 36, 37 } | |
9db1d521 | 403 | |
9db1d521 | 404 | |
862a2d83 | 405 | /* Fitting values into registers. */ |
c7453384 | 406 | |
862a2d83 UW |
407 | /* Integer modes <= word size fit into any GPR. |
408 | Integer modes > word size fit into successive GPRs, starting with | |
409 | an even-numbered register. | |
410 | SImode and DImode fit into FPRs as well. | |
c7453384 | 411 | |
862a2d83 UW |
412 | Floating point modes <= word size fit into any FPR or GPR. |
413 | Floating point modes > word size (i.e. DFmode on 32-bit) fit | |
414 | into any FPR, or an even-odd GPR pair. | |
f61a2c7d | 415 | TFmode fits only into an even-odd FPR pair. |
c7453384 | 416 | |
862a2d83 UW |
417 | Complex floating point modes fit either into two FPRs, or into |
418 | successive GPRs (again starting with an even number). | |
f61a2c7d | 419 | TCmode fits only into two successive even-odd FPR pairs. |
c7453384 | 420 | |
862a2d83 | 421 | Condition code modes fit only into the CC register. */ |
9db1d521 | 422 | |
74aa8b4b AK |
423 | /* Because all registers in a class have the same size HARD_REGNO_NREGS |
424 | is equivalent to CLASS_MAX_NREGS. */ | |
9db1d521 | 425 | #define HARD_REGNO_NREGS(REGNO, MODE) \ |
74aa8b4b AK |
426 | s390_class_max_nregs (REGNO_REG_CLASS (REGNO), (MODE)) |
427 | ||
428 | #define HARD_REGNO_MODE_OK(REGNO, MODE) \ | |
429 | s390_hard_regno_mode_ok ((REGNO), (MODE)) | |
430 | ||
431 | #define HARD_REGNO_RENAME_OK(FROM, TO) \ | |
7633f08e UW |
432 | s390_hard_regno_rename_ok (FROM, TO) |
433 | ||
9db1d521 HP |
434 | #define MODES_TIEABLE_P(MODE1, MODE2) \ |
435 | (((MODE1) == SFmode || (MODE1) == DFmode) \ | |
436 | == ((MODE2) == SFmode || (MODE2) == DFmode)) | |
437 | ||
9602b6a1 AK |
438 | /* When generating code that runs in z/Architecture mode, |
439 | but conforms to the 31-bit ABI, GPRs can hold 8 bytes; | |
440 | the ABI guarantees only that the lower 4 bytes are | |
441 | saved across calls, however. */ | |
085261c8 AK |
442 | #define HARD_REGNO_CALL_PART_CLOBBERED(REGNO, MODE) \ |
443 | ((!TARGET_64BIT && TARGET_ZARCH \ | |
444 | && GET_MODE_SIZE (MODE) > 4 \ | |
445 | && (((REGNO) >= 6 && (REGNO) <= 15) || (REGNO) == 32)) \ | |
446 | || (TARGET_VX \ | |
447 | && GET_MODE_SIZE (MODE) > 8 \ | |
448 | && (((TARGET_64BIT && (REGNO) >= 24 && (REGNO) <= 31)) \ | |
449 | || (!TARGET_64BIT && ((REGNO) == 18 || (REGNO) == 19))))) | |
9602b6a1 | 450 | |
862a2d83 UW |
451 | /* Maximum number of registers to represent a value of mode MODE |
452 | in a register of class CLASS. */ | |
453 | #define CLASS_MAX_NREGS(CLASS, MODE) \ | |
74aa8b4b | 454 | s390_class_max_nregs ((CLASS), (MODE)) |
4023fb28 | 455 | |
f61a2c7d | 456 | #define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \ |
085261c8 | 457 | s390_cannot_change_mode_class ((FROM), (TO), (CLASS)) |
9db1d521 | 458 | |
862a2d83 | 459 | /* Register classes. */ |
c7453384 | 460 | |
862a2d83 UW |
461 | /* We use the following register classes: |
462 | GENERAL_REGS All general purpose registers | |
463 | ADDR_REGS All general purpose registers except %r0 | |
464 | (These registers can be used in address generation) | |
465 | FP_REGS All floating point registers | |
c5aa1d12 UW |
466 | CC_REGS The condition code register |
467 | ACCESS_REGS The access registers | |
c7453384 | 468 | |
862a2d83 UW |
469 | GENERAL_FP_REGS Union of GENERAL_REGS and FP_REGS |
470 | ADDR_FP_REGS Union of ADDR_REGS and FP_REGS | |
c5aa1d12 UW |
471 | GENERAL_CC_REGS Union of GENERAL_REGS and CC_REGS |
472 | ADDR_CC_REGS Union of ADDR_REGS and CC_REGS | |
c7453384 | 473 | |
862a2d83 UW |
474 | NO_REGS No registers |
475 | ALL_REGS All registers | |
c7453384 | 476 | |
862a2d83 | 477 | Note that the 'fake' frame pointer and argument pointer registers |
c5aa1d12 | 478 | are included amongst the address registers here. */ |
9db1d521 HP |
479 | |
480 | enum reg_class | |
481 | { | |
c5aa1d12 | 482 | NO_REGS, CC_REGS, ADDR_REGS, GENERAL_REGS, ACCESS_REGS, |
f4aa3848 | 483 | ADDR_CC_REGS, GENERAL_CC_REGS, |
4023fb28 | 484 | FP_REGS, ADDR_FP_REGS, GENERAL_FP_REGS, |
085261c8 | 485 | VEC_REGS, ADDR_VEC_REGS, GENERAL_VEC_REGS, |
4023fb28 | 486 | ALL_REGS, LIM_REG_CLASSES |
9db1d521 | 487 | }; |
9db1d521 HP |
488 | #define N_REG_CLASSES (int) LIM_REG_CLASSES |
489 | ||
c5aa1d12 UW |
490 | #define REG_CLASS_NAMES \ |
491 | { "NO_REGS", "CC_REGS", "ADDR_REGS", "GENERAL_REGS", "ACCESS_REGS", \ | |
492 | "ADDR_CC_REGS", "GENERAL_CC_REGS", \ | |
085261c8 AK |
493 | "FP_REGS", "ADDR_FP_REGS", "GENERAL_FP_REGS", \ |
494 | "VEC_REGS", "ADDR_VEC_REGS", "GENERAL_VEC_REGS", \ | |
495 | "ALL_REGS" } | |
9db1d521 | 496 | |
862a2d83 | 497 | /* Class -> register mapping. */ |
085261c8 AK |
498 | #define REG_CLASS_CONTENTS \ |
499 | { \ | |
9db1d521 | 500 | { 0x00000000, 0x00000000 }, /* NO_REGS */ \ |
9dc62c00 | 501 | { 0x00000000, 0x00000002 }, /* CC_REGS */ \ |
a38e09bc AK |
502 | { 0x0000fffe, 0x0000000d }, /* ADDR_REGS */ \ |
503 | { 0x0000ffff, 0x0000000d }, /* GENERAL_REGS */ \ | |
c5aa1d12 | 504 | { 0x00000000, 0x00000030 }, /* ACCESS_REGS */ \ |
9dc62c00 AK |
505 | { 0x0000fffe, 0x0000000f }, /* ADDR_CC_REGS */ \ |
506 | { 0x0000ffff, 0x0000000f }, /* GENERAL_CC_REGS */ \ | |
9db1d521 | 507 | { 0xffff0000, 0x00000000 }, /* FP_REGS */ \ |
a38e09bc AK |
508 | { 0xfffffffe, 0x0000000d }, /* ADDR_FP_REGS */ \ |
509 | { 0xffffffff, 0x0000000d }, /* GENERAL_FP_REGS */ \ | |
085261c8 AK |
510 | { 0xffff0000, 0x003fffc0 }, /* VEC_REGS */ \ |
511 | { 0xfffffffe, 0x003fffcd }, /* ADDR_VEC_REGS */ \ | |
512 | { 0xffffffff, 0x003fffcd }, /* GENERAL_VEC_REGS */ \ | |
513 | { 0xffffffff, 0x003fffff }, /* ALL_REGS */ \ | |
9db1d521 HP |
514 | } |
515 | ||
058e97ec VM |
516 | /* In some case register allocation order is not enough for IRA to |
517 | generate a good code. The following macro (if defined) increases | |
518 | cost of REGNO for a pseudo approximately by pseudo usage frequency | |
519 | multiplied by the macro value. | |
520 | ||
521 | We avoid usage of BASE_REGNUM by nonzero macro value because the | |
522 | reload can decide not to use the hard register because some | |
523 | constant was forced to be in memory. */ | |
524 | #define IRA_HARD_REGNO_ADD_COST_MULTIPLIER(regno) \ | |
dba0dd68 | 525 | (regno != BASE_REGNUM ? 0.0 : 0.5) |
058e97ec | 526 | |
862a2d83 UW |
527 | /* Register -> class mapping. */ |
528 | extern const enum reg_class regclass_map[FIRST_PSEUDO_REGISTER]; | |
529 | #define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO]) | |
9db1d521 | 530 | |
862a2d83 UW |
531 | /* ADDR_REGS can be used as base or index register. */ |
532 | #define INDEX_REG_CLASS ADDR_REGS | |
533 | #define BASE_REG_CLASS ADDR_REGS | |
9db1d521 | 534 | |
862a2d83 UW |
535 | /* Check whether REGNO is a hard register of the suitable class |
536 | or a pseudo register currently allocated to one such. */ | |
537 | #define REGNO_OK_FOR_INDEX_P(REGNO) \ | |
538 | (((REGNO) < FIRST_PSEUDO_REGISTER \ | |
93fa8428 AK |
539 | && REGNO_REG_CLASS ((REGNO)) == ADDR_REGS) \ |
540 | || ADDR_REGNO_P (reg_renumber[REGNO])) | |
862a2d83 | 541 | #define REGNO_OK_FOR_BASE_P(REGNO) REGNO_OK_FOR_INDEX_P (REGNO) |
9db1d521 | 542 | |
9db1d521 | 543 | |
085261c8 AK |
544 | /* We need secondary memory to move data between GPRs and FPRs. |
545 | ||
546 | - With DFP the ldgr lgdr instructions are available. Due to the | |
547 | different alignment we cannot use them for SFmode. For 31 bit a | |
548 | 64 bit value in GPR would be a register pair so here we still | |
549 | need to go via memory. | |
550 | ||
551 | - With z13 we can do the SF/SImode moves with vlgvf. Due to the | |
552 | overlapping of FPRs and VRs we still disallow TF/TD modes to be | |
553 | in full VRs so as before also on z13 we do these moves via | |
554 | memory. | |
555 | ||
556 | FIXME: Should we try splitting it into two vlgvg's/vlvg's instead? */ | |
557 | #define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \ | |
558 | (((reg_classes_intersect_p (CLASS1, VEC_REGS) \ | |
559 | && reg_classes_intersect_p (CLASS2, GENERAL_REGS)) \ | |
560 | || (reg_classes_intersect_p (CLASS1, GENERAL_REGS) \ | |
561 | && reg_classes_intersect_p (CLASS2, VEC_REGS))) \ | |
562 | && (!TARGET_DFP || !TARGET_64BIT || GET_MODE_SIZE (MODE) != 8) \ | |
563 | && (!TARGET_VX || (SCALAR_FLOAT_MODE_P (MODE) \ | |
564 | && GET_MODE_SIZE (MODE) > 8))) | |
862a2d83 UW |
565 | |
566 | /* Get_secondary_mem widens its argument to BITS_PER_WORD which loses on 64bit | |
567 | because the movsi and movsf patterns don't handle r/f moves. */ | |
568 | #define SECONDARY_MEMORY_NEEDED_MODE(MODE) \ | |
569 | (GET_MODE_BITSIZE (MODE) < 32 \ | |
570 | ? mode_for_size (32, GET_MODE_CLASS (MODE), 0) \ | |
571 | : MODE) | |
572 | ||
573 | ||
862a2d83 | 574 | /* Stack layout and calling conventions. */ |
c7453384 | 575 | |
862a2d83 UW |
576 | /* Our stack grows from higher to lower addresses. However, local variables |
577 | are accessed by positive offsets, and function arguments are stored at | |
578 | increasing addresses. */ | |
579 | #define STACK_GROWS_DOWNWARD | |
63296cb1 | 580 | #define FRAME_GROWS_DOWNWARD 1 |
862a2d83 | 581 | /* #undef ARGS_GROW_DOWNWARD */ |
9db1d521 | 582 | |
862a2d83 UW |
583 | /* The basic stack layout looks like this: the stack pointer points |
584 | to the register save area for called functions. Above that area | |
585 | is the location to place outgoing arguments. Above those follow | |
586 | dynamic allocations (alloca), and finally the local variables. */ | |
9db1d521 | 587 | |
862a2d83 UW |
588 | /* Offset from stack-pointer to first location of outgoing args. */ |
589 | #define STACK_POINTER_OFFSET (TARGET_64BIT ? 160 : 96) | |
9db1d521 | 590 | |
862a2d83 | 591 | /* Offset within stack frame to start allocating local variables at. */ |
63296cb1 | 592 | #define STARTING_FRAME_OFFSET 0 |
9db1d521 | 593 | |
862a2d83 UW |
594 | /* Offset from the stack pointer register to an item dynamically |
595 | allocated on the stack, e.g., by `alloca'. */ | |
63296cb1 | 596 | #define STACK_DYNAMIC_OFFSET(FUNDECL) \ |
38173d38 | 597 | (STACK_POINTER_OFFSET + crtl->outgoing_args_size) |
9db1d521 | 598 | |
862a2d83 UW |
599 | /* Offset of first parameter from the argument pointer register value. |
600 | We have a fake argument pointer register that points directly to | |
601 | the argument area. */ | |
602 | #define FIRST_PARM_OFFSET(FNDECL) 0 | |
9db1d521 | 603 | |
f4aa3848 | 604 | /* Defining this macro makes __builtin_frame_address(0) and |
c6d01079 AK |
605 | __builtin_return_address(0) work with -fomit-frame-pointer. */ |
606 | #define INITIAL_FRAME_ADDRESS_RTX \ | |
0a81f074 | 607 | (plus_constant (Pmode, arg_pointer_rtx, -STACK_POINTER_OFFSET)) |
c6d01079 | 608 | |
c7453384 | 609 | /* The return address of the current frame is retrieved |
4023fb28 UW |
610 | from the initial value of register RETURN_REGNUM. |
611 | For frames farther back, we use the stack slot where | |
612 | the corresponding RETURN_REGNUM register was saved. */ | |
c6d01079 AK |
613 | #define DYNAMIC_CHAIN_ADDRESS(FRAME) \ |
614 | (TARGET_PACKED_STACK ? \ | |
0a81f074 RS |
615 | plus_constant (Pmode, (FRAME), \ |
616 | STACK_POINTER_OFFSET - UNITS_PER_LONG) : (FRAME)) | |
4023fb28 | 617 | |
78791a80 AK |
618 | /* For -mpacked-stack this adds 160 - 8 (96 - 4) to the output of |
619 | builtin_frame_address. Otherwise arg pointer - | |
620 | STACK_POINTER_OFFSET would be returned for | |
621 | __builtin_frame_address(0) what might result in an address pointing | |
622 | somewhere into the middle of the local variables since the packed | |
623 | stack layout generally does not need all the bytes in the register | |
624 | save area. */ | |
625 | #define FRAME_ADDR_RTX(FRAME) \ | |
626 | DYNAMIC_CHAIN_ADDRESS ((FRAME)) | |
627 | ||
c6d01079 | 628 | #define RETURN_ADDR_RTX(COUNT, FRAME) \ |
5d4d885c | 629 | s390_return_addr_rtx ((COUNT), DYNAMIC_CHAIN_ADDRESS ((FRAME))) |
9db1d521 | 630 | |
862a2d83 | 631 | /* In 31-bit mode, we need to mask off the high bit of return addresses. */ |
a556fd39 | 632 | #define MASK_RETURN_ADDR (TARGET_64BIT ? constm1_rtx : GEN_INT (0x7fffffff)) |
9db1d521 | 633 | |
4023fb28 | 634 | |
862a2d83 | 635 | /* Exception handling. */ |
c7453384 | 636 | |
862a2d83 UW |
637 | /* Describe calling conventions for DWARF-2 exception handling. */ |
638 | #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, RETURN_REGNUM) | |
4023fb28 | 639 | #define INCOMING_FRAME_SP_OFFSET STACK_POINTER_OFFSET |
9db1d521 HP |
640 | #define DWARF_FRAME_RETURN_COLUMN 14 |
641 | ||
642 | /* Describe how we implement __builtin_eh_return. */ | |
643 | #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 6 : INVALID_REGNUM) | |
a38e09bc | 644 | #define EH_RETURN_HANDLER_RTX gen_rtx_MEM (Pmode, return_address_pointer_rtx) |
f4aa3848 | 645 | |
18789f4e UW |
646 | /* Select a format to encode pointers in exception handling data. */ |
647 | #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ | |
648 | (flag_pic \ | |
649 | ? ((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4 \ | |
650 | : DW_EH_PE_absptr) | |
651 | ||
9602b6a1 AK |
652 | /* Register save slot alignment. */ |
653 | #define DWARF_CIE_DATA_ALIGNMENT (-UNITS_PER_LONG) | |
654 | ||
f276b762 AK |
655 | /* Let the assembler generate debug line info. */ |
656 | #define DWARF2_ASM_LINE_DEBUG_INFO 1 | |
657 | ||
085261c8 AK |
658 | /* Define the dwarf register mapping. |
659 | v16-v31 -> 68-83 | |
660 | rX -> X otherwise */ | |
661 | #define DBX_REGISTER_NUMBER(regno) \ | |
662 | ((regno >= 38 && regno <= 53) ? regno + 30 : regno) | |
9db1d521 | 663 | |
862a2d83 | 664 | /* Frame registers. */ |
9db1d521 | 665 | |
862a2d83 UW |
666 | #define STACK_POINTER_REGNUM 15 |
667 | #define FRAME_POINTER_REGNUM 34 | |
668 | #define HARD_FRAME_POINTER_REGNUM 11 | |
669 | #define ARG_POINTER_REGNUM 32 | |
a38e09bc | 670 | #define RETURN_ADDRESS_POINTER_REGNUM 35 |
9db1d521 | 671 | |
c7453384 EC |
672 | /* The static chain must be call-clobbered, but not used for |
673 | function argument passing. As register 1 is clobbered by | |
862a2d83 UW |
674 | the trampoline code, we only have one option. */ |
675 | #define STATIC_CHAIN_REGNUM 0 | |
9db1d521 | 676 | |
862a2d83 UW |
677 | /* Number of hardware registers that go into the DWARF-2 unwind info. |
678 | To avoid ABI incompatibility, this number must not change even as | |
679 | 'fake' hard registers are added or removed. */ | |
680 | #define DWARF_FRAME_REGISTERS 34 | |
9db1d521 | 681 | |
9db1d521 | 682 | |
862a2d83 | 683 | /* Frame pointer and argument pointer elimination. */ |
9db1d521 | 684 | |
7633f08e UW |
685 | #define ELIMINABLE_REGS \ |
686 | {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \ | |
687 | { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \ | |
688 | { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \ | |
689 | { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \ | |
690 | { RETURN_ADDRESS_POINTER_REGNUM, STACK_POINTER_REGNUM }, \ | |
691 | { RETURN_ADDRESS_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \ | |
692 | { BASE_REGNUM, BASE_REGNUM }} | |
9db1d521 | 693 | |
91086990 UW |
694 | #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ |
695 | (OFFSET) = s390_initial_elimination_offset ((FROM), (TO)) | |
9db1d521 | 696 | |
9db1d521 | 697 | |
862a2d83 | 698 | /* Stack arguments. */ |
c7453384 | 699 | |
862a2d83 UW |
700 | /* We need current_function_outgoing_args to be valid. */ |
701 | #define ACCUMULATE_OUTGOING_ARGS 1 | |
9db1d521 | 702 | |
9db1d521 | 703 | |
862a2d83 | 704 | /* Register arguments. */ |
c7453384 | 705 | |
9db1d521 HP |
706 | typedef struct s390_arg_structure |
707 | { | |
708 | int gprs; /* gpr so far */ | |
709 | int fprs; /* fpr so far */ | |
085261c8 | 710 | int vrs; /* vr so far */ |
9db1d521 HP |
711 | } |
712 | CUMULATIVE_ARGS; | |
713 | ||
07711f53 | 714 | #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, NN, N_NAMED_ARGS) \ |
085261c8 AK |
715 | ((CUM).gprs=0, (CUM).fprs=0, (CUM).vrs=0) |
716 | ||
717 | #define FIRST_VEC_ARG_REGNO 46 | |
718 | #define LAST_VEC_ARG_REGNO 53 | |
9db1d521 | 719 | |
96e2afa8 AK |
720 | /* Arguments can be placed in general registers 2 to 6, or in floating |
721 | point registers 0 and 2 for 31 bit and fprs 0, 2, 4 and 6 for 64 | |
722 | bit. */ | |
085261c8 AK |
723 | #define FUNCTION_ARG_REGNO_P(N) \ |
724 | (((N) >=2 && (N) < 7) || (N) == 16 || (N) == 17 \ | |
725 | || (TARGET_64BIT && ((N) == 18 || (N) == 19)) \ | |
726 | || (TARGET_VX && ((N) >= FIRST_VEC_ARG_REGNO && (N) <= LAST_VEC_ARG_REGNO))) | |
9db1d521 | 727 | |
9db1d521 | 728 | |
085261c8 AK |
729 | /* Only gpr 2, fpr 0, and v24 are ever used as return registers. */ |
730 | #define FUNCTION_VALUE_REGNO_P(N) \ | |
731 | ((N) == 2 || (N) == 16 \ | |
732 | || (TARGET_VX && (N) == FIRST_VEC_ARG_REGNO)) | |
9db1d521 | 733 | |
9db1d521 | 734 | |
862a2d83 | 735 | /* Function entry and exit. */ |
c7453384 | 736 | |
862a2d83 UW |
737 | /* When returning from a function, the stack pointer does not matter. */ |
738 | #define EXIT_IGNORE_STACK 1 | |
9db1d521 | 739 | |
9db1d521 | 740 | |
862a2d83 | 741 | /* Profiling. */ |
9db1d521 HP |
742 | |
743 | #define FUNCTION_PROFILER(FILE, LABELNO) \ | |
862a2d83 | 744 | s390_function_profiler ((FILE), ((LABELNO))) |
9db1d521 | 745 | |
c52a375d | 746 | #define PROFILE_BEFORE_PROLOGUE 1 |
9db1d521 | 747 | |
9db1d521 | 748 | |
862a2d83 | 749 | /* Trampolines for nested functions. */ |
9db1d521 | 750 | |
b81ecf6f RH |
751 | #define TRAMPOLINE_SIZE (TARGET_64BIT ? 32 : 16) |
752 | #define TRAMPOLINE_ALIGNMENT BITS_PER_WORD | |
9db1d521 | 753 | |
862a2d83 | 754 | /* Addressing modes, and classification of registers for them. */ |
9db1d521 | 755 | |
862a2d83 UW |
756 | /* Recognize any constant value that is a valid address. */ |
757 | #define CONSTANT_ADDRESS_P(X) 0 | |
9db1d521 | 758 | |
862a2d83 UW |
759 | /* Maximum number of registers that can appear in a valid memory address. */ |
760 | #define MAX_REGS_PER_ADDRESS 2 | |
9db1d521 | 761 | |
963fc8d0 | 762 | /* This definition replaces the formerly used 'm' constraint with a |
c6c3dba9 PB |
763 | different constraint letter in order to avoid changing semantics of |
764 | the 'm' constraint when accepting new address formats in | |
765 | TARGET_LEGITIMATE_ADDRESS_P. The constraint letter defined here | |
766 | must not be used in insn definitions or inline assemblies. */ | |
963fc8d0 AK |
767 | #define TARGET_MEM_CONSTRAINT 'e' |
768 | ||
0b540f12 UW |
769 | /* Try a machine-dependent way of reloading an illegitimate address |
770 | operand. If we find one, push the reload and jump to WIN. This | |
771 | macro is used in only one place: `find_reloads_address' in reload.c. */ | |
772 | #define LEGITIMIZE_RELOAD_ADDRESS(AD, MODE, OPNUM, TYPE, IND, WIN) \ | |
773 | do { \ | |
0a2aaacc KG |
774 | rtx new_rtx = legitimize_reload_address (AD, MODE, OPNUM, (int)(TYPE)); \ |
775 | if (new_rtx) \ | |
0b540f12 | 776 | { \ |
0a2aaacc | 777 | (AD) = new_rtx; \ |
0b540f12 UW |
778 | goto WIN; \ |
779 | } \ | |
780 | } while (0) | |
781 | ||
862a2d83 UW |
782 | /* Helper macro for s390.c and s390.md to check for symbolic constants. */ |
783 | #define SYMBOLIC_CONST(X) \ | |
784 | (GET_CODE (X) == SYMBOL_REF \ | |
785 | || GET_CODE (X) == LABEL_REF \ | |
786 | || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X))) | |
9db1d521 | 787 | |
fd3cd001 UW |
788 | #define TLS_SYMBOLIC_CONST(X) \ |
789 | ((GET_CODE (X) == SYMBOL_REF && tls_symbolic_operand (X)) \ | |
790 | || (GET_CODE (X) == CONST && tls_symbolic_reference_mentioned_p (X))) | |
791 | ||
9db1d521 | 792 | |
862a2d83 | 793 | /* Condition codes. */ |
9db1d521 | 794 | |
862a2d83 UW |
795 | /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, |
796 | return the mode to be used for the comparison. */ | |
797 | #define SELECT_CC_MODE(OP, X, Y) s390_select_ccmode ((OP), (X), (Y)) | |
c7453384 | 798 | |
862a2d83 | 799 | /* Relative costs of operations. */ |
9db1d521 | 800 | |
9db1d521 HP |
801 | /* A C expression for the cost of a branch instruction. A value of 1 |
802 | is the default; other values are interpreted relative to that. */ | |
3d427cc1 | 803 | #define BRANCH_COST(speed_p, predictable_p) s390_branch_cost |
9db1d521 | 804 | |
862a2d83 UW |
805 | /* Nonzero if access to memory by bytes is slow and undesirable. */ |
806 | #define SLOW_BYTE_ACCESS 1 | |
807 | ||
c5443745 | 808 | /* An integer expression for the size in bits of the largest integer machine |
f4aa3848 | 809 | mode that should actually be used. We allow pairs of registers. */ |
c5443745 UW |
810 | #define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TARGET_64BIT ? TImode : DImode) |
811 | ||
862a2d83 | 812 | /* The maximum number of bytes that a single instruction can move quickly |
ff482c8d | 813 | between memory and registers or between two memory locations. */ |
9602b6a1 AK |
814 | #define MOVE_MAX (TARGET_ZARCH ? 16 : 8) |
815 | #define MOVE_MAX_PIECES (TARGET_ZARCH ? 8 : 4) | |
862a2d83 | 816 | #define MAX_MOVE_MAX 16 |
9db1d521 | 817 | |
862a2d83 | 818 | /* Don't perform CSE on function addresses. */ |
1e8552c2 | 819 | #define NO_FUNCTION_CSE 1 |
862a2d83 | 820 | |
5f1b2ee6 AK |
821 | /* This value is used in tree-sra to decide whether it might benefical |
822 | to split a struct move into several word-size moves. For S/390 | |
823 | only small values make sense here since struct moves are relatively | |
073a8998 | 824 | cheap thanks to mvc so the small default value chosen for archs |
5f1b2ee6 AK |
825 | with memmove patterns should be ok. But this value is multiplied |
826 | in tree-sra with UNITS_PER_WORD to make a decision so we adjust it | |
827 | here to compensate for that factor since mvc costs exactly the same | |
828 | on 31 and 64 bit. */ | |
e04ad03d | 829 | #define MOVE_RATIO(speed) (TARGET_64BIT? 2 : 4) |
5f1b2ee6 | 830 | |
862a2d83 UW |
831 | |
832 | /* Sections. */ | |
833 | ||
834 | /* Output before read-only data. */ | |
835 | #define TEXT_SECTION_ASM_OP ".text" | |
836 | ||
837 | /* Output before writable (initialized) data. */ | |
838 | #define DATA_SECTION_ASM_OP ".data" | |
839 | ||
840 | /* Output before writable (uninitialized) data. */ | |
841 | #define BSS_SECTION_ASM_OP ".bss" | |
842 | ||
843 | /* S/390 constant pool breaks the devices in crtstuff.c to control section | |
844 | in where code resides. We have to write it as asm code. */ | |
845 | #ifndef __s390x__ | |
846 | #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ | |
847 | asm (SECTION_OP "\n\ | |
848 | bras\t%r2,1f\n\ | |
849 | 0: .long\t" USER_LABEL_PREFIX #FUNC " - 0b\n\ | |
850 | 1: l\t%r3,0(%r2)\n\ | |
851 | bas\t%r14,0(%r3,%r2)\n\ | |
852 | .previous"); | |
853 | #endif | |
63a1ff86 | 854 | |
862a2d83 UW |
855 | |
856 | /* Position independent code. */ | |
857 | ||
862a2d83 UW |
858 | #define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 12 : INVALID_REGNUM) |
859 | ||
860 | #define LEGITIMATE_PIC_OPERAND_P(X) legitimate_pic_operand_p (X) | |
63a1ff86 UW |
861 | |
862 | ||
863 | /* Assembler file format. */ | |
864 | ||
865 | /* Character to start a comment. */ | |
866 | #define ASM_COMMENT_START "#" | |
867 | ||
868 | /* Declare an uninitialized external linkage data object. */ | |
869 | #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ | |
870 | asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) | |
871 | ||
872 | /* Globalizing directive for a label. */ | |
873 | #define GLOBAL_ASM_OP ".globl " | |
874 | ||
875 | /* Advance the location counter to a multiple of 2**LOG bytes. */ | |
876 | #define ASM_OUTPUT_ALIGN(FILE, LOG) \ | |
877 | if ((LOG)) fprintf ((FILE), "\t.align\t%d\n", 1 << (LOG)) | |
878 | ||
879 | /* Advance the location counter by SIZE bytes. */ | |
880 | #define ASM_OUTPUT_SKIP(FILE, SIZE) \ | |
16998094 | 881 | fprintf ((FILE), "\t.set\t.,.+" HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE)) |
63a1ff86 | 882 | |
63a1ff86 UW |
883 | /* The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */ |
884 | #define LOCAL_LABEL_PREFIX "." | |
9db1d521 | 885 | |
5d304e47 AK |
886 | #define LABEL_ALIGN(LABEL) \ |
887 | s390_label_align (LABEL) | |
888 | ||
9db1d521 HP |
889 | /* How to refer to registers in assembler output. This sequence is |
890 | indexed by compiler's hard-register-number (see above). */ | |
9db1d521 | 891 | #define REGISTER_NAMES \ |
085261c8 AK |
892 | { "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7", \ |
893 | "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", \ | |
894 | "%f0", "%f2", "%f4", "%f6", "%f1", "%f3", "%f5", "%f7", \ | |
895 | "%f8", "%f10", "%f12", "%f14", "%f9", "%f11", "%f13", "%f15", \ | |
896 | "%ap", "%cc", "%fp", "%rp", "%a0", "%a1", \ | |
897 | "%v16", "%v18", "%v20", "%v22", "%v17", "%v19", "%v21", "%v23", \ | |
898 | "%v24", "%v26", "%v28", "%v30", "%v25", "%v27", "%v29", "%v31" \ | |
899 | } | |
900 | ||
901 | #define ADDITIONAL_REGISTER_NAMES \ | |
902 | { { "v0", 16 }, { "v2", 17 }, { "v4", 18 }, { "v6", 19 }, \ | |
903 | { "v1", 20 }, { "v3", 21 }, { "v5", 22 }, { "v7", 23 }, \ | |
904 | { "v8", 24 }, { "v10", 25 }, { "v12", 26 }, { "v14", 27 }, \ | |
905 | { "v9", 28 }, { "v11", 29 }, { "v13", 30 }, { "v15", 31 } }; | |
9db1d521 | 906 | |
63a1ff86 | 907 | /* Print operand X (an rtx) in assembler syntax to file FILE. */ |
9db1d521 | 908 | #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE) |
9db1d521 HP |
909 | #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR) |
910 | ||
63a1ff86 UW |
911 | /* Output an element of a case-vector that is absolute. */ |
912 | #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ | |
913 | do { \ | |
914 | char buf[32]; \ | |
9602b6a1 | 915 | fputs (integer_asm_op (UNITS_PER_LONG, TRUE), (FILE)); \ |
63a1ff86 UW |
916 | ASM_GENERATE_INTERNAL_LABEL (buf, "L", (VALUE)); \ |
917 | assemble_name ((FILE), buf); \ | |
918 | fputc ('\n', (FILE)); \ | |
919 | } while (0) | |
920 | ||
921 | /* Output an element of a case-vector that is relative. */ | |
922 | #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ | |
923 | do { \ | |
924 | char buf[32]; \ | |
9602b6a1 | 925 | fputs (integer_asm_op (UNITS_PER_LONG, TRUE), (FILE)); \ |
63a1ff86 UW |
926 | ASM_GENERATE_INTERNAL_LABEL (buf, "L", (VALUE)); \ |
927 | assemble_name ((FILE), buf); \ | |
928 | fputc ('-', (FILE)); \ | |
929 | ASM_GENERATE_INTERNAL_LABEL (buf, "L", (REL)); \ | |
930 | assemble_name ((FILE), buf); \ | |
931 | fputc ('\n', (FILE)); \ | |
932 | } while (0) | |
933 | ||
177bc204 RS |
934 | /* Mark the return register as used by the epilogue so that we can |
935 | use it in unadorned (return) and (simple_return) instructions. */ | |
936 | #define EPILOGUE_USES(REGNO) ((REGNO) == RETURN_REGNUM) | |
937 | ||
d0de9e13 DV |
938 | #undef ASM_OUTPUT_FUNCTION_LABEL |
939 | #define ASM_OUTPUT_FUNCTION_LABEL(FILE, NAME, DECL) \ | |
940 | s390_asm_output_function_label (FILE, NAME, DECL) | |
9db1d521 | 941 | |
862a2d83 UW |
942 | /* Miscellaneous parameters. */ |
943 | ||
862a2d83 UW |
944 | /* Specify the machine mode that this machine uses for the index in the |
945 | tablejump instruction. */ | |
946 | #define CASE_VECTOR_MODE (TARGET_64BIT ? DImode : SImode) | |
947 | ||
862a2d83 UW |
948 | /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits |
949 | is done just by pretending it is already truncated. */ | |
950 | #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 | |
951 | ||
952 | /* Specify the machine mode that pointers have. | |
953 | After generation of rtl, the compiler makes no further distinction | |
954 | between pointers and any other objects of this machine mode. */ | |
ef4bddc2 | 955 | #define Pmode ((machine_mode) (TARGET_64BIT ? DImode : SImode)) |
862a2d83 | 956 | |
c7453384 EC |
957 | /* This is -1 for "pointer mode" extend. See ptr_extend in s390.md. */ |
958 | #define POINTERS_EXTEND_UNSIGNED -1 | |
959 | ||
862a2d83 UW |
960 | /* A function address in a call instruction is a byte address (for |
961 | indexing purposes) so give the MEM rtx a byte's mode. */ | |
962 | #define FUNCTION_MODE QImode | |
963 | ||
ec24698e UW |
964 | /* Specify the value which is used when clz operand is zero. */ |
965 | #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 64, 1) | |
966 | ||
0bfc3f69 | 967 | /* Machine-specific symbol_ref flags. */ |
963fc8d0 AK |
968 | #define SYMBOL_FLAG_ALIGN1 (SYMBOL_FLAG_MACH_DEP << 0) |
969 | #define SYMBOL_REF_ALIGN1_P(X) \ | |
970 | ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_ALIGN1)) | |
971 | #define SYMBOL_FLAG_NOT_NATURALLY_ALIGNED (SYMBOL_FLAG_MACH_DEP << 1) | |
972 | #define SYMBOL_REF_NOT_NATURALLY_ALIGNED_P(X) \ | |
973 | ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_NOT_NATURALLY_ALIGNED)) | |
0bfc3f69 | 974 | |
085261c8 AK |
975 | /* Check whether integer displacement is in range for a short displacement. */ |
976 | #define SHORT_DISP_IN_RANGE(d) ((d) >= 0 && (d) <= 4095) | |
977 | ||
0bfc3f69 AS |
978 | /* Check whether integer displacement is in range. */ |
979 | #define DISP_IN_RANGE(d) \ | |
980 | (TARGET_LONG_DISPLACEMENT? ((d) >= -524288 && (d) <= 524287) \ | |
085261c8 | 981 | : SHORT_DISP_IN_RANGE(d)) |
0bfc3f69 | 982 | |
24a235c8 CB |
983 | /* Reads can reuse write prefetches, used by tree-ssa-prefetch-loops.c. */ |
984 | #define READ_CAN_USE_WRITE_PREFETCH 1 | |
677f3fa8 JM |
985 | |
986 | extern const int processor_flags_table[]; | |
085261c8 AK |
987 | |
988 | /* The truth element value for vector comparisons. Our instructions | |
989 | always generate -1 in that case. */ | |
990 | #define VECTOR_STORE_FLAG_VALUE(MODE) CONSTM1_RTX (GET_MODE_INNER (MODE)) | |
991 | ||
992 | #endif /* S390_H */ |