]>
Commit | Line | Data |
---|---|---|
9db1d521 | 1 | /* Definitions of target machine for GNU compiler, for IBM S/390 |
2f83c7d6 NC |
2 | Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
3 | 2007 Free Software Foundation, Inc. | |
9db1d521 | 4 | Contributed by Hartmut Penner (hpenner@de.ibm.com) and |
f314b9b1 | 5 | Ulrich Weigand (uweigand@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 | ||
42c78618 UW |
26 | /* Override the __fixdfdi etc. routines when building libgcc2. |
27 | ??? This should be done in a cleaner way ... */ | |
fe86047c | 28 | #if defined (IN_LIBGCC2) && !defined (__s390x__) |
ca11c37c | 29 | #include <config/s390/fixdfdi.h> |
42c78618 UW |
30 | #endif |
31 | ||
c7453384 | 32 | /* Which processor to generate code or schedule for. The cpu attribute |
1fec52be HP |
33 | defines a list that mirrors this list, so changes to s390.md must be |
34 | made at the same time. */ | |
35 | ||
36 | enum processor_type | |
37 | { | |
c7453384 EC |
38 | PROCESSOR_9672_G5, |
39 | PROCESSOR_9672_G6, | |
40 | PROCESSOR_2064_Z900, | |
f13e0d4e | 41 | PROCESSOR_2084_Z990, |
ec24698e | 42 | PROCESSOR_2094_Z9_109, |
1fec52be HP |
43 | PROCESSOR_max |
44 | }; | |
45 | ||
f13e0d4e UW |
46 | /* Optional architectural facilities supported by the processor. */ |
47 | ||
48 | enum processor_flags | |
49 | { | |
50 | PF_IEEE_FLOAT = 1, | |
51 | PF_ZARCH = 2, | |
ec24698e | 52 | PF_LONG_DISPLACEMENT = 4, |
85dae55a AK |
53 | PF_EXTIMM = 8, |
54 | PF_DFP = 16 | |
f13e0d4e UW |
55 | }; |
56 | ||
57 | extern enum processor_type s390_tune; | |
58 | extern enum processor_flags s390_tune_flags; | |
1fec52be HP |
59 | |
60 | extern enum processor_type s390_arch; | |
f13e0d4e | 61 | extern enum processor_flags s390_arch_flags; |
d75f90f1 | 62 | |
f13e0d4e UW |
63 | #define TARGET_CPU_IEEE_FLOAT \ |
64 | (s390_arch_flags & PF_IEEE_FLOAT) | |
65 | #define TARGET_CPU_ZARCH \ | |
66 | (s390_arch_flags & PF_ZARCH) | |
67 | #define TARGET_CPU_LONG_DISPLACEMENT \ | |
68 | (s390_arch_flags & PF_LONG_DISPLACEMENT) | |
ec24698e UW |
69 | #define TARGET_CPU_EXTIMM \ |
70 | (s390_arch_flags & PF_EXTIMM) | |
85dae55a AK |
71 | #define TARGET_CPU_DFP \ |
72 | (s390_arch_flags & PF_DFP) | |
f13e0d4e UW |
73 | |
74 | #define TARGET_LONG_DISPLACEMENT \ | |
75 | (TARGET_ZARCH && TARGET_CPU_LONG_DISPLACEMENT) | |
ec24698e UW |
76 | #define TARGET_EXTIMM \ |
77 | (TARGET_ZARCH && TARGET_CPU_EXTIMM) | |
85dae55a AK |
78 | #define TARGET_DFP \ |
79 | (TARGET_ZARCH && TARGET_CPU_DFP) | |
42c78618 | 80 | |
862a2d83 | 81 | /* Run-time target specification. */ |
9db1d521 | 82 | |
a771c4b3 UW |
83 | /* Defaults for option flags defined only on some subtargets. */ |
84 | #ifndef TARGET_TPF_PROFILING | |
85 | #define TARGET_TPF_PROFILING 0 | |
86 | #endif | |
87 | ||
4798630c D |
88 | /* This will be overridden by OS headers. */ |
89 | #define TARGET_TPF 0 | |
90 | ||
862a2d83 UW |
91 | /* Target CPU builtins. */ |
92 | #define TARGET_CPU_CPP_BUILTINS() \ | |
93 | do \ | |
94 | { \ | |
95 | builtin_assert ("cpu=s390"); \ | |
96 | builtin_assert ("machine=s390"); \ | |
97 | builtin_define ("__s390__"); \ | |
98 | if (TARGET_64BIT) \ | |
99 | builtin_define ("__s390x__"); \ | |
f61a2c7d AK |
100 | if (TARGET_LONG_DOUBLE_128) \ |
101 | builtin_define ("__LONG_DOUBLE_128__"); \ | |
862a2d83 UW |
102 | } \ |
103 | while (0) | |
9db1d521 | 104 | |
58d10f89 | 105 | #ifdef DEFAULT_TARGET_64BIT |
47d94c1a | 106 | #define TARGET_DEFAULT (MASK_64BIT | MASK_ZARCH | MASK_HARD_DFP) |
58d10f89 | 107 | #else |
85dae55a | 108 | #define TARGET_DEFAULT 0 |
58d10f89 UW |
109 | #endif |
110 | ||
f13e0d4e UW |
111 | /* Support for configure-time defaults. */ |
112 | #define OPTION_DEFAULT_SPECS \ | |
113 | { "mode", "%{!mesa:%{!mzarch:-m%(VALUE)}}" }, \ | |
114 | { "arch", "%{!march=*:-march=%(VALUE)}" }, \ | |
115 | { "tune", "%{!mtune=*:-mtune=%(VALUE)}" } | |
116 | ||
117 | /* Defaulting rules. */ | |
118 | #ifdef DEFAULT_TARGET_64BIT | |
119 | #define DRIVER_SELF_SPECS \ | |
120 | "%{!m31:%{!m64:-m64}}", \ | |
121 | "%{!mesa:%{!mzarch:%{m31:-mesa}%{m64:-mzarch}}}", \ | |
122 | "%{!march=*:%{mesa:-march=g5}%{mzarch:-march=z900}}" | |
123 | #else | |
124 | #define DRIVER_SELF_SPECS \ | |
125 | "%{!m31:%{!m64:-m31}}", \ | |
126 | "%{!mesa:%{!mzarch:%{m31:-mesa}%{m64:-mzarch}}}", \ | |
127 | "%{!march=*:%{mesa:-march=g5}%{mzarch:-march=z900}}" | |
128 | #endif | |
129 | ||
862a2d83 UW |
130 | /* Target version string. Overridden by the OS header. */ |
131 | #ifdef DEFAULT_TARGET_64BIT | |
132 | #define TARGET_VERSION fprintf (stderr, " (zSeries)"); | |
133 | #else | |
134 | #define TARGET_VERSION fprintf (stderr, " (S/390)"); | |
135 | #endif | |
9db1d521 | 136 | |
862a2d83 UW |
137 | /* Hooks to override options. */ |
138 | #define OPTIMIZATION_OPTIONS(LEVEL, SIZE) optimization_options(LEVEL, SIZE) | |
4023fb28 UW |
139 | #define OVERRIDE_OPTIONS override_options () |
140 | ||
862a2d83 UW |
141 | /* Frame pointer is not used for debugging. */ |
142 | #define CAN_DEBUG_WITHOUT_FP | |
9db1d521 | 143 | |
638e37c2 WG |
144 | /* Constants needed to control the TEST DATA CLASS (TDC) instruction. */ |
145 | #define S390_TDC_POSITIVE_ZERO (1 << 11) | |
146 | #define S390_TDC_NEGATIVE_ZERO (1 << 10) | |
147 | #define S390_TDC_POSITIVE_NORMALIZED_NUMBER (1 << 9) | |
148 | #define S390_TDC_NEGATIVE_NORMALIZED_NUMBER (1 << 8) | |
149 | #define S390_TDC_POSITIVE_DENORMALIZED_NUMBER (1 << 7) | |
150 | #define S390_TDC_NEGATIVE_DENORMALIZED_NUMBER (1 << 6) | |
151 | #define S390_TDC_POSITIVE_INFINITY (1 << 5) | |
152 | #define S390_TDC_NEGATIVE_INFINITY (1 << 4) | |
153 | #define S390_TDC_POSITIVE_QUIET_NAN (1 << 3) | |
154 | #define S390_TDC_NEGATIVE_QUIET_NAN (1 << 2) | |
155 | #define S390_TDC_POSITIVE_SIGNALING_NAN (1 << 1) | |
156 | #define S390_TDC_NEGATIVE_SIGNALING_NAN (1 << 0) | |
157 | ||
0f67fa83 WG |
158 | #define S390_TDC_SIGNBIT_SET (S390_TDC_NEGATIVE_ZERO \ |
159 | | S390_TDC_NEGATIVE_NORMALIZED_NUMBER \ | |
160 | | S390_TDC_NEGATIVE_DENORMALIZED_NUMBER\ | |
161 | | S390_TDC_NEGATIVE_INFINITY \ | |
162 | | S390_TDC_NEGATIVE_QUIET_NAN \ | |
163 | | S390_TDC_NEGATIVE_SIGNALING_NAN ) | |
164 | ||
638e37c2 WG |
165 | #define S390_TDC_INFINITY (S390_TDC_POSITIVE_INFINITY \ |
166 | | S390_TDC_NEGATIVE_INFINITY ) | |
9db1d521 | 167 | |
fe86047c UW |
168 | /* In libgcc2, determine target settings as compile-time constants. */ |
169 | #ifdef IN_LIBGCC2 | |
170 | #undef TARGET_64BIT | |
171 | #ifdef __s390x__ | |
172 | #define TARGET_64BIT 1 | |
173 | #else | |
174 | #define TARGET_64BIT 0 | |
175 | #endif | |
176 | #endif | |
177 | ||
178 | ||
9db1d521 HP |
179 | /* Target machine storage layout. */ |
180 | ||
862a2d83 | 181 | /* Everything is big-endian. */ |
9db1d521 | 182 | #define BITS_BIG_ENDIAN 1 |
9db1d521 | 183 | #define BYTES_BIG_ENDIAN 1 |
9db1d521 HP |
184 | #define WORDS_BIG_ENDIAN 1 |
185 | ||
9db1d521 | 186 | /* Width of a word, in units (bytes). */ |
9db1d521 | 187 | #define UNITS_PER_WORD (TARGET_64BIT ? 8 : 4) |
fe86047c | 188 | #ifndef IN_LIBGCC2 |
9db1d521 | 189 | #define MIN_UNITS_PER_WORD 4 |
fe86047c | 190 | #endif |
862a2d83 | 191 | #define MAX_BITS_PER_WORD 64 |
9db1d521 | 192 | |
862a2d83 | 193 | /* Function arguments and return values are promoted to word size. */ |
d4453b7a | 194 | #define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \ |
9db1d521 HP |
195 | if (INTEGRAL_MODE_P (MODE) && \ |
196 | GET_MODE_SIZE (MODE) < UNITS_PER_WORD) { \ | |
197 | (MODE) = Pmode; \ | |
198 | } | |
199 | ||
9db1d521 | 200 | /* Allocation boundary (in *bits*) for storing arguments in argument list. */ |
9db1d521 HP |
201 | #define PARM_BOUNDARY (TARGET_64BIT ? 64 : 32) |
202 | ||
203 | /* Boundary (in *bits*) on which stack pointer should be aligned. */ | |
9db1d521 HP |
204 | #define STACK_BOUNDARY 64 |
205 | ||
206 | /* Allocation boundary (in *bits*) for the code of a function. */ | |
9db1d521 HP |
207 | #define FUNCTION_BOUNDARY 32 |
208 | ||
209 | /* There is no point aligning anything to a rounder boundary than this. */ | |
9db1d521 HP |
210 | #define BIGGEST_ALIGNMENT 64 |
211 | ||
212 | /* Alignment of field after `int : 0' in a structure. */ | |
9db1d521 HP |
213 | #define EMPTY_FIELD_BOUNDARY 32 |
214 | ||
f710504c | 215 | /* Alignment on even addresses for LARL instruction. */ |
9db1d521 | 216 | #define CONSTANT_ALIGNMENT(EXP, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN) |
9db1d521 HP |
217 | #define DATA_ALIGNMENT(TYPE, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN) |
218 | ||
862a2d83 | 219 | /* Alignment is not required by the hardware. */ |
9db1d521 HP |
220 | #define STRICT_ALIGNMENT 0 |
221 | ||
862a2d83 UW |
222 | /* Mode of stack savearea. |
223 | FUNCTION is VOIDmode because calling convention maintains SP. | |
224 | BLOCK needs Pmode for SP. | |
225 | NONLOCAL needs twice Pmode to maintain both backchain and SP. */ | |
226 | #define STACK_SAVEAREA_MODE(LEVEL) \ | |
227 | (LEVEL == SAVE_FUNCTION ? VOIDmode \ | |
43ab026f | 228 | : LEVEL == SAVE_NONLOCAL ? (TARGET_64BIT ? OImode : TImode) : Pmode) |
862a2d83 | 229 | |
9db1d521 | 230 | |
862a2d83 | 231 | /* Type layout. */ |
9db1d521 | 232 | |
862a2d83 UW |
233 | /* Sizes in bits of the source language data types. */ |
234 | #define SHORT_TYPE_SIZE 16 | |
235 | #define INT_TYPE_SIZE 32 | |
236 | #define LONG_TYPE_SIZE (TARGET_64BIT ? 64 : 32) | |
862a2d83 UW |
237 | #define LONG_LONG_TYPE_SIZE 64 |
238 | #define FLOAT_TYPE_SIZE 32 | |
239 | #define DOUBLE_TYPE_SIZE 64 | |
f61a2c7d AK |
240 | #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) |
241 | ||
242 | /* Define this to set long double type size to use in libgcc2.c, which can | |
243 | not depend on target_flags. */ | |
244 | #ifdef __LONG_DOUBLE_128__ | |
245 | #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 | |
246 | #else | |
247 | #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 | |
248 | #endif | |
249 | ||
250 | /* Work around target_flags dependency in ada/targtyps.c. */ | |
251 | #define WIDEST_HARDWARE_FP_SIZE 64 | |
862a2d83 UW |
252 | |
253 | /* We use "unsigned char" as default. */ | |
254 | #define DEFAULT_SIGNED_CHAR 0 | |
255 | ||
256 | ||
257 | /* Register usage. */ | |
258 | ||
259 | /* We have 16 general purpose registers (registers 0-15), | |
260 | and 16 floating point registers (registers 16-31). | |
261 | (On non-IEEE machines, we have only 4 fp registers.) | |
c7453384 | 262 | |
862a2d83 UW |
263 | Amongst the general purpose registers, some are used |
264 | for specific purposes: | |
265 | GPR 11: Hard frame pointer (if needed) | |
266 | GPR 12: Global offset table pointer (if needed) | |
267 | GPR 13: Literal pool base register | |
268 | GPR 14: Return address register | |
269 | GPR 15: Stack pointer | |
c7453384 | 270 | |
c5aa1d12 | 271 | Registers 32-35 are 'fake' hard registers that do not |
862a2d83 UW |
272 | correspond to actual hardware: |
273 | Reg 32: Argument pointer | |
274 | Reg 33: Condition code | |
c5aa1d12 UW |
275 | Reg 34: Frame pointer |
276 | Reg 35: Return address pointer | |
862a2d83 | 277 | |
c5aa1d12 UW |
278 | Registers 36 and 37 are mapped to access registers |
279 | 0 and 1, used to implement thread-local storage. */ | |
280 | ||
281 | #define FIRST_PSEUDO_REGISTER 38 | |
862a2d83 UW |
282 | |
283 | /* Standard register usage. */ | |
8e509cf9 UW |
284 | #define GENERAL_REGNO_P(N) ((int)(N) >= 0 && (N) < 16) |
285 | #define ADDR_REGNO_P(N) ((N) >= 1 && (N) < 16) | |
142cd70f | 286 | #define FP_REGNO_P(N) ((N) >= 16 && (N) < 32) |
8e509cf9 | 287 | #define CC_REGNO_P(N) ((N) == 33) |
a38e09bc | 288 | #define FRAME_REGNO_P(N) ((N) == 32 || (N) == 34 || (N) == 35) |
c5aa1d12 | 289 | #define ACCESS_REGNO_P(N) ((N) == 36 || (N) == 37) |
8e509cf9 UW |
290 | |
291 | #define GENERAL_REG_P(X) (REG_P (X) && GENERAL_REGNO_P (REGNO (X))) | |
292 | #define ADDR_REG_P(X) (REG_P (X) && ADDR_REGNO_P (REGNO (X))) | |
293 | #define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X))) | |
294 | #define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X))) | |
4888ec5d | 295 | #define FRAME_REG_P(X) (REG_P (X) && FRAME_REGNO_P (REGNO (X))) |
c5aa1d12 | 296 | #define ACCESS_REG_P(X) (REG_P (X) && ACCESS_REGNO_P (REGNO (X))) |
9db1d521 | 297 | |
862a2d83 | 298 | /* Set up fixed registers and calling convention: |
9db1d521 | 299 | |
862a2d83 UW |
300 | GPRs 0-5 are always call-clobbered, |
301 | GPRs 6-15 are always call-saved. | |
302 | GPR 12 is fixed if used as GOT pointer. | |
303 | GPR 13 is always fixed (as literal pool pointer). | |
545d16ff | 304 | GPR 14 is always fixed on S/390 machines (as return address). |
862a2d83 UW |
305 | GPR 15 is always fixed (as stack pointer). |
306 | The 'fake' hard registers are call-clobbered and fixed. | |
c5aa1d12 | 307 | The access registers are call-saved and fixed. |
9db1d521 | 308 | |
862a2d83 UW |
309 | On 31-bit, FPRs 18-19 are call-clobbered; |
310 | on 64-bit, FPRs 24-31 are call-clobbered. | |
311 | The remaining FPRs are call-saved. */ | |
9db1d521 HP |
312 | |
313 | #define FIXED_REGISTERS \ | |
314 | { 0, 0, 0, 0, \ | |
315 | 0, 0, 0, 0, \ | |
316 | 0, 0, 0, 0, \ | |
317 | 0, 1, 1, 1, \ | |
318 | 0, 0, 0, 0, \ | |
319 | 0, 0, 0, 0, \ | |
320 | 0, 0, 0, 0, \ | |
321 | 0, 0, 0, 0, \ | |
c5aa1d12 UW |
322 | 1, 1, 1, 1, \ |
323 | 1, 1 } | |
9db1d521 | 324 | |
9db1d521 HP |
325 | #define CALL_USED_REGISTERS \ |
326 | { 1, 1, 1, 1, \ | |
327 | 1, 1, 0, 0, \ | |
328 | 0, 0, 0, 0, \ | |
329 | 0, 1, 1, 1, \ | |
4023fb28 UW |
330 | 1, 1, 1, 1, \ |
331 | 1, 1, 1, 1, \ | |
332 | 1, 1, 1, 1, \ | |
333 | 1, 1, 1, 1, \ | |
c5aa1d12 UW |
334 | 1, 1, 1, 1, \ |
335 | 1, 1 } | |
4023fb28 | 336 | |
4023fb28 UW |
337 | #define CALL_REALLY_USED_REGISTERS \ |
338 | { 1, 1, 1, 1, \ | |
9db1d521 | 339 | 1, 1, 0, 0, \ |
4023fb28 UW |
340 | 0, 0, 0, 0, \ |
341 | 0, 0, 0, 0, \ | |
9db1d521 HP |
342 | 1, 1, 1, 1, \ |
343 | 1, 1, 1, 1, \ | |
344 | 1, 1, 1, 1, \ | |
4023fb28 | 345 | 1, 1, 1, 1, \ |
c5aa1d12 UW |
346 | 1, 1, 1, 1, \ |
347 | 0, 0 } | |
9db1d521 | 348 | |
38899e29 | 349 | #define CONDITIONAL_REGISTER_USAGE s390_conditional_register_usage () |
9db1d521 | 350 | |
862a2d83 UW |
351 | /* Preferred register allocation order. */ |
352 | #define REG_ALLOC_ORDER \ | |
7633f08e | 353 | { 1, 2, 3, 4, 5, 0, 12, 11, 10, 9, 8, 7, 6, 14, 13, \ |
862a2d83 UW |
354 | 16, 17, 18, 19, 20, 21, 22, 23, \ |
355 | 24, 25, 26, 27, 28, 29, 30, 31, \ | |
c5aa1d12 | 356 | 15, 32, 33, 34, 35, 36, 37 } |
9db1d521 | 357 | |
9db1d521 | 358 | |
862a2d83 | 359 | /* Fitting values into registers. */ |
c7453384 | 360 | |
862a2d83 UW |
361 | /* Integer modes <= word size fit into any GPR. |
362 | Integer modes > word size fit into successive GPRs, starting with | |
363 | an even-numbered register. | |
364 | SImode and DImode fit into FPRs as well. | |
c7453384 | 365 | |
862a2d83 UW |
366 | Floating point modes <= word size fit into any FPR or GPR. |
367 | Floating point modes > word size (i.e. DFmode on 32-bit) fit | |
368 | into any FPR, or an even-odd GPR pair. | |
f61a2c7d | 369 | TFmode fits only into an even-odd FPR pair. |
c7453384 | 370 | |
862a2d83 UW |
371 | Complex floating point modes fit either into two FPRs, or into |
372 | successive GPRs (again starting with an even number). | |
f61a2c7d | 373 | TCmode fits only into two successive even-odd FPR pairs. |
c7453384 | 374 | |
862a2d83 | 375 | Condition code modes fit only into the CC register. */ |
9db1d521 | 376 | |
74aa8b4b AK |
377 | /* Because all registers in a class have the same size HARD_REGNO_NREGS |
378 | is equivalent to CLASS_MAX_NREGS. */ | |
9db1d521 | 379 | #define HARD_REGNO_NREGS(REGNO, MODE) \ |
74aa8b4b AK |
380 | s390_class_max_nregs (REGNO_REG_CLASS (REGNO), (MODE)) |
381 | ||
382 | #define HARD_REGNO_MODE_OK(REGNO, MODE) \ | |
383 | s390_hard_regno_mode_ok ((REGNO), (MODE)) | |
384 | ||
385 | #define HARD_REGNO_RENAME_OK(FROM, TO) \ | |
7633f08e UW |
386 | s390_hard_regno_rename_ok (FROM, TO) |
387 | ||
9db1d521 HP |
388 | #define MODES_TIEABLE_P(MODE1, MODE2) \ |
389 | (((MODE1) == SFmode || (MODE1) == DFmode) \ | |
390 | == ((MODE2) == SFmode || (MODE2) == DFmode)) | |
391 | ||
862a2d83 UW |
392 | /* Maximum number of registers to represent a value of mode MODE |
393 | in a register of class CLASS. */ | |
394 | #define CLASS_MAX_NREGS(CLASS, MODE) \ | |
74aa8b4b | 395 | s390_class_max_nregs ((CLASS), (MODE)) |
4023fb28 | 396 | |
862a2d83 UW |
397 | /* If a 4-byte value is loaded into a FPR, it is placed into the |
398 | *upper* half of the register, not the lower. Therefore, we | |
c5aa1d12 UW |
399 | cannot use SUBREGs to switch between modes in FP registers. |
400 | Likewise for access registers, since they have only half the | |
401 | word size on 64-bit. */ | |
f61a2c7d AK |
402 | #define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \ |
403 | (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \ | |
404 | ? ((reg_classes_intersect_p (FP_REGS, CLASS) \ | |
405 | && (GET_MODE_SIZE (FROM) < 8 || GET_MODE_SIZE (TO) < 8)) \ | |
406 | || reg_classes_intersect_p (ACCESS_REGS, CLASS)) : 0) | |
9db1d521 | 407 | |
862a2d83 | 408 | /* Register classes. */ |
c7453384 | 409 | |
862a2d83 UW |
410 | /* We use the following register classes: |
411 | GENERAL_REGS All general purpose registers | |
412 | ADDR_REGS All general purpose registers except %r0 | |
413 | (These registers can be used in address generation) | |
414 | FP_REGS All floating point registers | |
c5aa1d12 UW |
415 | CC_REGS The condition code register |
416 | ACCESS_REGS The access registers | |
c7453384 | 417 | |
862a2d83 UW |
418 | GENERAL_FP_REGS Union of GENERAL_REGS and FP_REGS |
419 | ADDR_FP_REGS Union of ADDR_REGS and FP_REGS | |
c5aa1d12 UW |
420 | GENERAL_CC_REGS Union of GENERAL_REGS and CC_REGS |
421 | ADDR_CC_REGS Union of ADDR_REGS and CC_REGS | |
c7453384 | 422 | |
862a2d83 UW |
423 | NO_REGS No registers |
424 | ALL_REGS All registers | |
c7453384 | 425 | |
862a2d83 | 426 | Note that the 'fake' frame pointer and argument pointer registers |
c5aa1d12 | 427 | are included amongst the address registers here. */ |
9db1d521 HP |
428 | |
429 | enum reg_class | |
430 | { | |
c5aa1d12 | 431 | NO_REGS, CC_REGS, ADDR_REGS, GENERAL_REGS, ACCESS_REGS, |
9dc62c00 | 432 | ADDR_CC_REGS, GENERAL_CC_REGS, |
4023fb28 UW |
433 | FP_REGS, ADDR_FP_REGS, GENERAL_FP_REGS, |
434 | ALL_REGS, LIM_REG_CLASSES | |
9db1d521 | 435 | }; |
9db1d521 HP |
436 | #define N_REG_CLASSES (int) LIM_REG_CLASSES |
437 | ||
c5aa1d12 UW |
438 | #define REG_CLASS_NAMES \ |
439 | { "NO_REGS", "CC_REGS", "ADDR_REGS", "GENERAL_REGS", "ACCESS_REGS", \ | |
440 | "ADDR_CC_REGS", "GENERAL_CC_REGS", \ | |
441 | "FP_REGS", "ADDR_FP_REGS", "GENERAL_FP_REGS", "ALL_REGS" } | |
9db1d521 | 442 | |
862a2d83 | 443 | /* Class -> register mapping. */ |
9db1d521 HP |
444 | #define REG_CLASS_CONTENTS \ |
445 | { \ | |
446 | { 0x00000000, 0x00000000 }, /* NO_REGS */ \ | |
9dc62c00 | 447 | { 0x00000000, 0x00000002 }, /* CC_REGS */ \ |
a38e09bc AK |
448 | { 0x0000fffe, 0x0000000d }, /* ADDR_REGS */ \ |
449 | { 0x0000ffff, 0x0000000d }, /* GENERAL_REGS */ \ | |
c5aa1d12 | 450 | { 0x00000000, 0x00000030 }, /* ACCESS_REGS */ \ |
9dc62c00 AK |
451 | { 0x0000fffe, 0x0000000f }, /* ADDR_CC_REGS */ \ |
452 | { 0x0000ffff, 0x0000000f }, /* GENERAL_CC_REGS */ \ | |
9db1d521 | 453 | { 0xffff0000, 0x00000000 }, /* FP_REGS */ \ |
a38e09bc AK |
454 | { 0xfffffffe, 0x0000000d }, /* ADDR_FP_REGS */ \ |
455 | { 0xffffffff, 0x0000000d }, /* GENERAL_FP_REGS */ \ | |
c5aa1d12 | 456 | { 0xffffffff, 0x0000003f }, /* ALL_REGS */ \ |
9db1d521 HP |
457 | } |
458 | ||
862a2d83 UW |
459 | /* Register -> class mapping. */ |
460 | extern const enum reg_class regclass_map[FIRST_PSEUDO_REGISTER]; | |
461 | #define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO]) | |
9db1d521 | 462 | |
862a2d83 UW |
463 | /* ADDR_REGS can be used as base or index register. */ |
464 | #define INDEX_REG_CLASS ADDR_REGS | |
465 | #define BASE_REG_CLASS ADDR_REGS | |
9db1d521 | 466 | |
862a2d83 UW |
467 | /* Check whether REGNO is a hard register of the suitable class |
468 | or a pseudo register currently allocated to one such. */ | |
469 | #define REGNO_OK_FOR_INDEX_P(REGNO) \ | |
470 | (((REGNO) < FIRST_PSEUDO_REGISTER \ | |
93fa8428 AK |
471 | && REGNO_REG_CLASS ((REGNO)) == ADDR_REGS) \ |
472 | || ADDR_REGNO_P (reg_renumber[REGNO])) | |
862a2d83 | 473 | #define REGNO_OK_FOR_BASE_P(REGNO) REGNO_OK_FOR_INDEX_P (REGNO) |
9db1d521 | 474 | |
9db1d521 | 475 | |
862a2d83 UW |
476 | /* Given an rtx X being reloaded into a reg required to be in class CLASS, |
477 | return the class of reg to actually use. */ | |
478 | #define PREFERRED_RELOAD_CLASS(X, CLASS) \ | |
479 | s390_preferred_reload_class ((X), (CLASS)) | |
9db1d521 | 480 | |
862a2d83 UW |
481 | /* We need secondary memory to move data between GPRs and FPRs. */ |
482 | #define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \ | |
85dae55a AK |
483 | ((CLASS1) != (CLASS2) \ |
484 | && ((CLASS1) == FP_REGS || (CLASS2) == FP_REGS) \ | |
485 | && (!TARGET_DFP || GET_MODE_SIZE (MODE) != 8)) | |
862a2d83 UW |
486 | |
487 | /* Get_secondary_mem widens its argument to BITS_PER_WORD which loses on 64bit | |
488 | because the movsi and movsf patterns don't handle r/f moves. */ | |
489 | #define SECONDARY_MEMORY_NEEDED_MODE(MODE) \ | |
490 | (GET_MODE_BITSIZE (MODE) < 32 \ | |
491 | ? mode_for_size (32, GET_MODE_CLASS (MODE), 0) \ | |
492 | : MODE) | |
493 | ||
494 | ||
862a2d83 | 495 | /* Stack layout and calling conventions. */ |
c7453384 | 496 | |
862a2d83 UW |
497 | /* Our stack grows from higher to lower addresses. However, local variables |
498 | are accessed by positive offsets, and function arguments are stored at | |
499 | increasing addresses. */ | |
500 | #define STACK_GROWS_DOWNWARD | |
63296cb1 | 501 | #define FRAME_GROWS_DOWNWARD 1 |
862a2d83 | 502 | /* #undef ARGS_GROW_DOWNWARD */ |
9db1d521 | 503 | |
862a2d83 UW |
504 | /* The basic stack layout looks like this: the stack pointer points |
505 | to the register save area for called functions. Above that area | |
506 | is the location to place outgoing arguments. Above those follow | |
507 | dynamic allocations (alloca), and finally the local variables. */ | |
9db1d521 | 508 | |
862a2d83 UW |
509 | /* Offset from stack-pointer to first location of outgoing args. */ |
510 | #define STACK_POINTER_OFFSET (TARGET_64BIT ? 160 : 96) | |
9db1d521 | 511 | |
862a2d83 | 512 | /* Offset within stack frame to start allocating local variables at. */ |
63296cb1 | 513 | #define STARTING_FRAME_OFFSET 0 |
9db1d521 | 514 | |
862a2d83 UW |
515 | /* Offset from the stack pointer register to an item dynamically |
516 | allocated on the stack, e.g., by `alloca'. */ | |
63296cb1 AK |
517 | extern int current_function_outgoing_args_size; |
518 | #define STACK_DYNAMIC_OFFSET(FUNDECL) \ | |
519 | (STACK_POINTER_OFFSET + current_function_outgoing_args_size) | |
9db1d521 | 520 | |
862a2d83 UW |
521 | /* Offset of first parameter from the argument pointer register value. |
522 | We have a fake argument pointer register that points directly to | |
523 | the argument area. */ | |
524 | #define FIRST_PARM_OFFSET(FNDECL) 0 | |
9db1d521 | 525 | |
c6d01079 AK |
526 | /* Defining this macro makes __builtin_frame_address(0) and |
527 | __builtin_return_address(0) work with -fomit-frame-pointer. */ | |
528 | #define INITIAL_FRAME_ADDRESS_RTX \ | |
529 | (TARGET_PACKED_STACK ? \ | |
530 | plus_constant (arg_pointer_rtx, -UNITS_PER_WORD) : \ | |
531 | plus_constant (arg_pointer_rtx, -STACK_POINTER_OFFSET)) | |
532 | ||
c7453384 | 533 | /* The return address of the current frame is retrieved |
4023fb28 UW |
534 | from the initial value of register RETURN_REGNUM. |
535 | For frames farther back, we use the stack slot where | |
536 | the corresponding RETURN_REGNUM register was saved. */ | |
c6d01079 AK |
537 | #define DYNAMIC_CHAIN_ADDRESS(FRAME) \ |
538 | (TARGET_PACKED_STACK ? \ | |
539 | plus_constant ((FRAME), STACK_POINTER_OFFSET - UNITS_PER_WORD) : (FRAME)) | |
4023fb28 | 540 | |
c6d01079 | 541 | #define RETURN_ADDR_RTX(COUNT, FRAME) \ |
5d4d885c | 542 | s390_return_addr_rtx ((COUNT), DYNAMIC_CHAIN_ADDRESS ((FRAME))) |
9db1d521 | 543 | |
862a2d83 | 544 | /* In 31-bit mode, we need to mask off the high bit of return addresses. */ |
a556fd39 | 545 | #define MASK_RETURN_ADDR (TARGET_64BIT ? constm1_rtx : GEN_INT (0x7fffffff)) |
9db1d521 | 546 | |
4023fb28 | 547 | |
862a2d83 | 548 | /* Exception handling. */ |
c7453384 | 549 | |
862a2d83 UW |
550 | /* Describe calling conventions for DWARF-2 exception handling. */ |
551 | #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, RETURN_REGNUM) | |
4023fb28 | 552 | #define INCOMING_FRAME_SP_OFFSET STACK_POINTER_OFFSET |
9db1d521 HP |
553 | #define DWARF_FRAME_RETURN_COLUMN 14 |
554 | ||
555 | /* Describe how we implement __builtin_eh_return. */ | |
556 | #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 6 : INVALID_REGNUM) | |
a38e09bc AK |
557 | #define EH_RETURN_HANDLER_RTX gen_rtx_MEM (Pmode, return_address_pointer_rtx) |
558 | ||
18789f4e UW |
559 | /* Select a format to encode pointers in exception handling data. */ |
560 | #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ | |
561 | (flag_pic \ | |
562 | ? ((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4 \ | |
563 | : DW_EH_PE_absptr) | |
564 | ||
9db1d521 | 565 | |
862a2d83 | 566 | /* Frame registers. */ |
9db1d521 | 567 | |
862a2d83 UW |
568 | #define STACK_POINTER_REGNUM 15 |
569 | #define FRAME_POINTER_REGNUM 34 | |
570 | #define HARD_FRAME_POINTER_REGNUM 11 | |
571 | #define ARG_POINTER_REGNUM 32 | |
a38e09bc | 572 | #define RETURN_ADDRESS_POINTER_REGNUM 35 |
9db1d521 | 573 | |
c7453384 EC |
574 | /* The static chain must be call-clobbered, but not used for |
575 | function argument passing. As register 1 is clobbered by | |
862a2d83 UW |
576 | the trampoline code, we only have one option. */ |
577 | #define STATIC_CHAIN_REGNUM 0 | |
9db1d521 | 578 | |
862a2d83 UW |
579 | /* Number of hardware registers that go into the DWARF-2 unwind info. |
580 | To avoid ABI incompatibility, this number must not change even as | |
581 | 'fake' hard registers are added or removed. */ | |
582 | #define DWARF_FRAME_REGISTERS 34 | |
9db1d521 | 583 | |
9db1d521 | 584 | |
862a2d83 | 585 | /* Frame pointer and argument pointer elimination. */ |
9db1d521 | 586 | |
862a2d83 | 587 | #define FRAME_POINTER_REQUIRED 0 |
9db1d521 | 588 | |
7633f08e UW |
589 | #define ELIMINABLE_REGS \ |
590 | {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \ | |
591 | { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \ | |
592 | { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \ | |
593 | { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \ | |
594 | { RETURN_ADDRESS_POINTER_REGNUM, STACK_POINTER_REGNUM }, \ | |
595 | { RETURN_ADDRESS_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \ | |
596 | { BASE_REGNUM, BASE_REGNUM }} | |
9db1d521 | 597 | |
91086990 UW |
598 | #define CAN_ELIMINATE(FROM, TO) \ |
599 | s390_can_eliminate ((FROM), (TO)) | |
600 | ||
601 | #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ | |
602 | (OFFSET) = s390_initial_elimination_offset ((FROM), (TO)) | |
9db1d521 | 603 | |
9db1d521 | 604 | |
862a2d83 | 605 | /* Stack arguments. */ |
c7453384 | 606 | |
862a2d83 UW |
607 | /* We need current_function_outgoing_args to be valid. */ |
608 | #define ACCUMULATE_OUTGOING_ARGS 1 | |
9db1d521 | 609 | |
862a2d83 UW |
610 | /* Return doesn't modify the stack. */ |
611 | #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) 0 | |
9db1d521 | 612 | |
9db1d521 | 613 | |
862a2d83 | 614 | /* Register arguments. */ |
c7453384 | 615 | |
9db1d521 HP |
616 | typedef struct s390_arg_structure |
617 | { | |
618 | int gprs; /* gpr so far */ | |
619 | int fprs; /* fpr so far */ | |
620 | } | |
621 | CUMULATIVE_ARGS; | |
622 | ||
07711f53 | 623 | #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, NN, N_NAMED_ARGS) \ |
9db1d521 HP |
624 | ((CUM).gprs=0, (CUM).fprs=0) |
625 | ||
9db1d521 | 626 | #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ |
994fe660 | 627 | s390_function_arg_advance (&CUM, MODE, TYPE, NAMED) |
9db1d521 | 628 | |
9db1d521 | 629 | #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ |
994fe660 | 630 | s390_function_arg (&CUM, MODE, TYPE, NAMED) |
9db1d521 | 631 | |
862a2d83 UW |
632 | /* Arguments can be placed in general registers 2 to 6, |
633 | or in floating point registers 0 and 2. */ | |
634 | #define FUNCTION_ARG_REGNO_P(N) (((N) >=2 && (N) <7) || \ | |
635 | (N) == 16 || (N) == 17) | |
9db1d521 | 636 | |
9db1d521 | 637 | |
862a2d83 | 638 | /* Scalar return values. */ |
c7453384 | 639 | |
8c17530e UW |
640 | #define FUNCTION_VALUE(VALTYPE, FUNC) \ |
641 | s390_function_value ((VALTYPE), VOIDmode) | |
642 | ||
643 | #define LIBCALL_VALUE(MODE) \ | |
644 | s390_function_value (NULL, (MODE)) | |
9db1d521 | 645 | |
862a2d83 | 646 | /* Only gpr 2 and fpr 0 are ever used as return registers. */ |
9db1d521 HP |
647 | #define FUNCTION_VALUE_REGNO_P(N) ((N) == 2 || (N) == 16) |
648 | ||
9db1d521 | 649 | |
862a2d83 | 650 | /* Function entry and exit. */ |
c7453384 | 651 | |
862a2d83 UW |
652 | /* When returning from a function, the stack pointer does not matter. */ |
653 | #define EXIT_IGNORE_STACK 1 | |
9db1d521 | 654 | |
9db1d521 | 655 | |
862a2d83 | 656 | /* Profiling. */ |
9db1d521 HP |
657 | |
658 | #define FUNCTION_PROFILER(FILE, LABELNO) \ | |
862a2d83 | 659 | s390_function_profiler ((FILE), ((LABELNO))) |
9db1d521 | 660 | |
c52a375d | 661 | #define PROFILE_BEFORE_PROLOGUE 1 |
9db1d521 | 662 | |
9db1d521 | 663 | |
862a2d83 | 664 | /* Trampolines for nested functions. */ |
9db1d521 | 665 | |
cadc42db | 666 | #define TRAMPOLINE_SIZE (TARGET_64BIT ? 32 : 16) |
9db1d521 | 667 | |
862a2d83 UW |
668 | #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT) \ |
669 | s390_initialize_trampoline ((ADDR), (FNADDR), (CXT)) | |
9db1d521 | 670 | |
862a2d83 UW |
671 | #define TRAMPOLINE_TEMPLATE(FILE) \ |
672 | s390_trampoline_template (FILE) | |
9db1d521 | 673 | |
9db1d521 | 674 | |
862a2d83 | 675 | /* Addressing modes, and classification of registers for them. */ |
9db1d521 | 676 | |
862a2d83 UW |
677 | /* Recognize any constant value that is a valid address. */ |
678 | #define CONSTANT_ADDRESS_P(X) 0 | |
9db1d521 | 679 | |
862a2d83 UW |
680 | /* Maximum number of registers that can appear in a valid memory address. */ |
681 | #define MAX_REGS_PER_ADDRESS 2 | |
9db1d521 | 682 | |
862a2d83 UW |
683 | /* S/390 has no mode dependent addresses. */ |
684 | #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) | |
9db1d521 HP |
685 | |
686 | /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression that is a | |
687 | valid memory address for an instruction. | |
688 | The MODE argument is the machine mode for the MEM expression | |
862a2d83 | 689 | that wants to use this address. */ |
9db1d521 HP |
690 | #ifdef REG_OK_STRICT |
691 | #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ | |
692 | { \ | |
693 | if (legitimate_address_p (MODE, X, 1)) \ | |
694 | goto ADDR; \ | |
695 | } | |
696 | #else | |
697 | #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ | |
698 | { \ | |
699 | if (legitimate_address_p (MODE, X, 0)) \ | |
700 | goto ADDR; \ | |
701 | } | |
702 | #endif | |
703 | ||
9db1d521 HP |
704 | /* Try machine-dependent ways of modifying an illegitimate address |
705 | to be legitimate. If we find one, return the new, valid address. | |
706 | This macro is used in only one place: `memory_address' in explow.c. */ | |
9db1d521 HP |
707 | #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \ |
708 | { \ | |
709 | (X) = legitimize_address (X, OLDX, MODE); \ | |
710 | if (memory_address_p (MODE, X)) \ | |
711 | goto WIN; \ | |
712 | } | |
713 | ||
0b540f12 UW |
714 | /* Try a machine-dependent way of reloading an illegitimate address |
715 | operand. If we find one, push the reload and jump to WIN. This | |
716 | macro is used in only one place: `find_reloads_address' in reload.c. */ | |
717 | #define LEGITIMIZE_RELOAD_ADDRESS(AD, MODE, OPNUM, TYPE, IND, WIN) \ | |
718 | do { \ | |
719 | rtx new = legitimize_reload_address (AD, MODE, OPNUM, (int)(TYPE)); \ | |
720 | if (new) \ | |
721 | { \ | |
722 | (AD) = new; \ | |
723 | goto WIN; \ | |
724 | } \ | |
725 | } while (0) | |
726 | ||
862a2d83 UW |
727 | /* Nonzero if the constant value X is a legitimate general operand. |
728 | It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ | |
729 | #define LEGITIMATE_CONSTANT_P(X) \ | |
730 | legitimate_constant_p (X) | |
9db1d521 | 731 | |
862a2d83 UW |
732 | /* Helper macro for s390.c and s390.md to check for symbolic constants. */ |
733 | #define SYMBOLIC_CONST(X) \ | |
734 | (GET_CODE (X) == SYMBOL_REF \ | |
735 | || GET_CODE (X) == LABEL_REF \ | |
736 | || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X))) | |
9db1d521 | 737 | |
fd3cd001 UW |
738 | #define TLS_SYMBOLIC_CONST(X) \ |
739 | ((GET_CODE (X) == SYMBOL_REF && tls_symbolic_operand (X)) \ | |
740 | || (GET_CODE (X) == CONST && tls_symbolic_reference_mentioned_p (X))) | |
741 | ||
9db1d521 | 742 | |
862a2d83 | 743 | /* Condition codes. */ |
9db1d521 | 744 | |
862a2d83 UW |
745 | /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, |
746 | return the mode to be used for the comparison. */ | |
747 | #define SELECT_CC_MODE(OP, X, Y) s390_select_ccmode ((OP), (X), (Y)) | |
c7453384 | 748 | |
68f9c5e2 UW |
749 | /* Canonicalize a comparison from one we don't have to one we do have. */ |
750 | #define CANONICALIZE_COMPARISON(CODE, OP0, OP1) \ | |
751 | s390_canonicalize_comparison (&(CODE), &(OP0), &(OP1)) | |
752 | ||
862a2d83 UW |
753 | /* Define the information needed to generate branch and scc insns. This is |
754 | stored from the compare operation. Note that we can't use "rtx" here | |
755 | since it hasn't been defined! */ | |
e0374221 | 756 | extern struct rtx_def *s390_compare_op0, *s390_compare_op1, *s390_compare_emitted; |
9db1d521 | 757 | |
9db1d521 | 758 | |
862a2d83 | 759 | /* Relative costs of operations. */ |
9db1d521 | 760 | |
9db1d521 | 761 | /* On s390, copy between fprs and gprs is expensive. */ |
9db1d521 | 762 | #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \ |
14b3e8ef UW |
763 | (( ( reg_classes_intersect_p ((CLASS1), GENERAL_REGS) \ |
764 | && reg_classes_intersect_p ((CLASS2), FP_REGS)) \ | |
765 | || ( reg_classes_intersect_p ((CLASS1), FP_REGS) \ | |
766 | && reg_classes_intersect_p ((CLASS2), GENERAL_REGS))) ? 10 : 1) | |
9db1d521 | 767 | |
9db1d521 HP |
768 | /* A C expression for the cost of moving data of mode M between a |
769 | register and memory. A value of 2 is the default; this cost is | |
862a2d83 | 770 | relative to those in `REGISTER_MOVE_COST'. */ |
9db1d521 HP |
771 | #define MEMORY_MOVE_COST(M, C, I) 1 |
772 | ||
773 | /* A C expression for the cost of a branch instruction. A value of 1 | |
774 | is the default; other values are interpreted relative to that. */ | |
9db1d521 HP |
775 | #define BRANCH_COST 1 |
776 | ||
862a2d83 UW |
777 | /* Nonzero if access to memory by bytes is slow and undesirable. */ |
778 | #define SLOW_BYTE_ACCESS 1 | |
779 | ||
c5443745 UW |
780 | /* An integer expression for the size in bits of the largest integer machine |
781 | mode that should actually be used. We allow pairs of registers. */ | |
782 | #define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TARGET_64BIT ? TImode : DImode) | |
783 | ||
862a2d83 | 784 | /* The maximum number of bytes that a single instruction can move quickly |
ff482c8d | 785 | between memory and registers or between two memory locations. */ |
862a2d83 | 786 | #define MOVE_MAX (TARGET_64BIT ? 16 : 8) |
c5443745 | 787 | #define MOVE_MAX_PIECES (TARGET_64BIT ? 8 : 4) |
862a2d83 | 788 | #define MAX_MOVE_MAX 16 |
9db1d521 | 789 | |
862a2d83 UW |
790 | /* Determine whether to use move_by_pieces or block move insn. */ |
791 | #define MOVE_BY_PIECES_P(SIZE, ALIGN) \ | |
792 | ( (SIZE) == 1 || (SIZE) == 2 || (SIZE) == 4 \ | |
793 | || (TARGET_64BIT && (SIZE) == 8) ) | |
794 | ||
795 | /* Determine whether to use clear_by_pieces or block clear insn. */ | |
796 | #define CLEAR_BY_PIECES_P(SIZE, ALIGN) \ | |
797 | ( (SIZE) == 1 || (SIZE) == 2 || (SIZE) == 4 \ | |
798 | || (TARGET_64BIT && (SIZE) == 8) ) | |
799 | ||
45d78e7f | 800 | /* This macro is used to determine whether store_by_pieces should be |
cfa31150 | 801 | called to "memcpy" storage when the source is a constant string. */ |
45d78e7f JJ |
802 | #define STORE_BY_PIECES_P(SIZE, ALIGN) MOVE_BY_PIECES_P (SIZE, ALIGN) |
803 | ||
cfa31150 SL |
804 | /* Likewise to decide whether to "memset" storage with byte values |
805 | other than zero. */ | |
806 | #define SET_BY_PIECES_P(SIZE, ALIGN) STORE_BY_PIECES_P (SIZE, ALIGN) | |
807 | ||
862a2d83 UW |
808 | /* Don't perform CSE on function addresses. */ |
809 | #define NO_FUNCTION_CSE | |
810 | ||
811 | ||
812 | /* Sections. */ | |
813 | ||
814 | /* Output before read-only data. */ | |
815 | #define TEXT_SECTION_ASM_OP ".text" | |
816 | ||
817 | /* Output before writable (initialized) data. */ | |
818 | #define DATA_SECTION_ASM_OP ".data" | |
819 | ||
820 | /* Output before writable (uninitialized) data. */ | |
821 | #define BSS_SECTION_ASM_OP ".bss" | |
822 | ||
823 | /* S/390 constant pool breaks the devices in crtstuff.c to control section | |
824 | in where code resides. We have to write it as asm code. */ | |
825 | #ifndef __s390x__ | |
826 | #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ | |
827 | asm (SECTION_OP "\n\ | |
828 | bras\t%r2,1f\n\ | |
829 | 0: .long\t" USER_LABEL_PREFIX #FUNC " - 0b\n\ | |
830 | 1: l\t%r3,0(%r2)\n\ | |
831 | bas\t%r14,0(%r3,%r2)\n\ | |
832 | .previous"); | |
833 | #endif | |
63a1ff86 | 834 | |
862a2d83 UW |
835 | |
836 | /* Position independent code. */ | |
837 | ||
c7453384 | 838 | extern int flag_pic; |
862a2d83 UW |
839 | |
840 | #define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 12 : INVALID_REGNUM) | |
841 | ||
842 | #define LEGITIMATE_PIC_OPERAND_P(X) legitimate_pic_operand_p (X) | |
63a1ff86 UW |
843 | |
844 | ||
845 | /* Assembler file format. */ | |
846 | ||
847 | /* Character to start a comment. */ | |
848 | #define ASM_COMMENT_START "#" | |
849 | ||
850 | /* Declare an uninitialized external linkage data object. */ | |
851 | #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ | |
852 | asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) | |
853 | ||
854 | /* Globalizing directive for a label. */ | |
855 | #define GLOBAL_ASM_OP ".globl " | |
856 | ||
857 | /* Advance the location counter to a multiple of 2**LOG bytes. */ | |
858 | #define ASM_OUTPUT_ALIGN(FILE, LOG) \ | |
859 | if ((LOG)) fprintf ((FILE), "\t.align\t%d\n", 1 << (LOG)) | |
860 | ||
861 | /* Advance the location counter by SIZE bytes. */ | |
862 | #define ASM_OUTPUT_SKIP(FILE, SIZE) \ | |
58e15542 | 863 | fprintf ((FILE), "\t.set\t.,.+"HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE)) |
63a1ff86 | 864 | |
63a1ff86 UW |
865 | /* The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */ |
866 | #define LOCAL_LABEL_PREFIX "." | |
9db1d521 HP |
867 | |
868 | /* How to refer to registers in assembler output. This sequence is | |
869 | indexed by compiler's hard-register-number (see above). */ | |
9db1d521 HP |
870 | #define REGISTER_NAMES \ |
871 | { "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7", \ | |
a38e09bc | 872 | "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", \ |
9db1d521 | 873 | "%f0", "%f2", "%f4", "%f6", "%f1", "%f3", "%f5", "%f7", \ |
a38e09bc | 874 | "%f8", "%f10", "%f12", "%f14", "%f9", "%f11", "%f13", "%f15", \ |
c5aa1d12 | 875 | "%ap", "%cc", "%fp", "%rp", "%a0", "%a1" \ |
9db1d521 HP |
876 | } |
877 | ||
63a1ff86 | 878 | /* Print operand X (an rtx) in assembler syntax to file FILE. */ |
9db1d521 | 879 | #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE) |
9db1d521 HP |
880 | #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR) |
881 | ||
faeb9bb6 UW |
882 | /* Output machine-dependent UNSPECs in address constants. */ |
883 | #define OUTPUT_ADDR_CONST_EXTRA(FILE, X, FAIL) \ | |
884 | do { \ | |
885 | if (!s390_output_addr_const_extra (FILE, (X))) \ | |
886 | goto FAIL; \ | |
887 | } while (0); | |
888 | ||
63a1ff86 UW |
889 | /* Output an element of a case-vector that is absolute. */ |
890 | #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ | |
891 | do { \ | |
892 | char buf[32]; \ | |
893 | fputs (integer_asm_op (UNITS_PER_WORD, TRUE), (FILE)); \ | |
894 | ASM_GENERATE_INTERNAL_LABEL (buf, "L", (VALUE)); \ | |
895 | assemble_name ((FILE), buf); \ | |
896 | fputc ('\n', (FILE)); \ | |
897 | } while (0) | |
898 | ||
899 | /* Output an element of a case-vector that is relative. */ | |
900 | #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ | |
901 | do { \ | |
902 | char buf[32]; \ | |
903 | fputs (integer_asm_op (UNITS_PER_WORD, TRUE), (FILE)); \ | |
904 | ASM_GENERATE_INTERNAL_LABEL (buf, "L", (VALUE)); \ | |
905 | assemble_name ((FILE), buf); \ | |
906 | fputc ('-', (FILE)); \ | |
907 | ASM_GENERATE_INTERNAL_LABEL (buf, "L", (REL)); \ | |
908 | assemble_name ((FILE), buf); \ | |
909 | fputc ('\n', (FILE)); \ | |
910 | } while (0) | |
911 | ||
9db1d521 | 912 | |
862a2d83 UW |
913 | /* Miscellaneous parameters. */ |
914 | ||
862a2d83 UW |
915 | /* Specify the machine mode that this machine uses for the index in the |
916 | tablejump instruction. */ | |
917 | #define CASE_VECTOR_MODE (TARGET_64BIT ? DImode : SImode) | |
918 | ||
862a2d83 UW |
919 | /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits |
920 | is done just by pretending it is already truncated. */ | |
921 | #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 | |
922 | ||
923 | /* Specify the machine mode that pointers have. | |
924 | After generation of rtl, the compiler makes no further distinction | |
925 | between pointers and any other objects of this machine mode. */ | |
926 | #define Pmode ((enum machine_mode) (TARGET_64BIT ? DImode : SImode)) | |
927 | ||
c7453384 EC |
928 | /* This is -1 for "pointer mode" extend. See ptr_extend in s390.md. */ |
929 | #define POINTERS_EXTEND_UNSIGNED -1 | |
930 | ||
862a2d83 UW |
931 | /* A function address in a call instruction is a byte address (for |
932 | indexing purposes) so give the MEM rtx a byte's mode. */ | |
933 | #define FUNCTION_MODE QImode | |
934 | ||
ec24698e UW |
935 | /* Specify the value which is used when clz operand is zero. */ |
936 | #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 64, 1) | |
937 | ||
0bfc3f69 AS |
938 | /* Machine-specific symbol_ref flags. */ |
939 | #define SYMBOL_FLAG_ALIGN1 (SYMBOL_FLAG_MACH_DEP << 0) | |
940 | ||
941 | /* Check whether integer displacement is in range. */ | |
942 | #define DISP_IN_RANGE(d) \ | |
943 | (TARGET_LONG_DISPLACEMENT? ((d) >= -524288 && (d) <= 524287) \ | |
944 | : ((d) >= 0 && (d) <= 4095)) | |
945 | ||
c7453384 | 946 | #endif |