OSDN Git Service

* config/m68k/m68k.c (output_move_const_into_data_reg,
[pf3gnuchains/gcc-fork.git] / gcc / config / s390 / s390.h
1 /* Definitions of target machine for GNU compiler, for IBM S/390
2    Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
3    Contributed by Hartmut Penner (hpenner@de.ibm.com) and
4                   Ulrich Weigand (uweigand@de.ibm.com).
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING.  If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 02111-1307, USA.  */
22
23 #ifndef _S390_H
24 #define _S390_H
25
26 /* Override the __fixdfdi etc. routines when building libgcc2.
27    ??? This should be done in a cleaner way ...  */
28 #if defined (IN_LIBGCC2) && !defined (__s390x__)
29 #include <s390/fixdfdi.h>
30 #endif
31
32 /* Which processor to generate code or schedule for. The cpu attribute
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 {
38   PROCESSOR_9672_G5,
39   PROCESSOR_9672_G6,
40   PROCESSOR_2064_Z900,
41   PROCESSOR_2084_Z990,
42   PROCESSOR_max
43 };
44
45 /* Optional architectural facilities supported by the processor.  */
46
47 enum processor_flags
48 {
49   PF_IEEE_FLOAT = 1,
50   PF_ZARCH = 2,
51   PF_LONG_DISPLACEMENT = 4
52 };
53
54 extern enum processor_type s390_tune;
55 extern enum processor_flags s390_tune_flags;
56 extern const char *s390_tune_string;
57
58 extern enum processor_type s390_arch;
59 extern enum processor_flags s390_arch_flags;
60 extern const char *s390_arch_string;
61
62 #define TARGET_CPU_IEEE_FLOAT \
63         (s390_arch_flags & PF_IEEE_FLOAT)
64 #define TARGET_CPU_ZARCH \
65         (s390_arch_flags & PF_ZARCH)
66 #define TARGET_CPU_LONG_DISPLACEMENT \
67         (s390_arch_flags & PF_LONG_DISPLACEMENT)
68
69 #define TARGET_LONG_DISPLACEMENT \
70        (TARGET_ZARCH && TARGET_CPU_LONG_DISPLACEMENT)
71
72
73 /* Run-time target specification.  */
74
75 /* Target CPU builtins.  */
76 #define TARGET_CPU_CPP_BUILTINS()                       \
77   do                                                    \
78     {                                                   \
79       builtin_assert ("cpu=s390");                      \
80       builtin_assert ("machine=s390");                  \
81       builtin_define ("__s390__");                      \
82       if (TARGET_64BIT)                                 \
83         builtin_define ("__s390x__");                   \
84     }                                                   \
85   while (0)
86
87 /* Optional target features.  */
88 extern int target_flags;
89
90 #define MASK_HARD_FLOAT            0x01
91 #define MASK_BACKCHAIN             0x02
92 #define MASK_SMALL_EXEC            0x04
93 #define MASK_DEBUG_ARG             0x08
94 #define MASK_64BIT                 0x10
95 #define MASK_ZARCH                 0x20
96 #define MASK_MVCLE                 0x40
97 #define MASK_TPF                   0x80
98
99 #define TARGET_HARD_FLOAT          (target_flags & MASK_HARD_FLOAT)
100 #define TARGET_SOFT_FLOAT          (!(target_flags & MASK_HARD_FLOAT))
101 #define TARGET_BACKCHAIN           (target_flags & MASK_BACKCHAIN)
102 #define TARGET_SMALL_EXEC          (target_flags & MASK_SMALL_EXEC)
103 #define TARGET_DEBUG_ARG           (target_flags & MASK_DEBUG_ARG)
104 #define TARGET_64BIT               (target_flags & MASK_64BIT)
105 #define TARGET_ZARCH               (target_flags & MASK_ZARCH)
106 #define TARGET_MVCLE               (target_flags & MASK_MVCLE)
107 #define TARGET_TPF                 (target_flags & MASK_TPF)
108
109 /* ??? Once this actually works, it could be made a runtime option.  */
110 #define TARGET_IBM_FLOAT           0
111 #define TARGET_IEEE_FLOAT          1
112
113 #ifdef DEFAULT_TARGET_64BIT
114 #define TARGET_DEFAULT             0x33
115 #else
116 #define TARGET_DEFAULT             0x3
117 #endif
118
119 #define TARGET_SWITCHES                                                \
120 { { "hard-float",    1, N_("Use hardware fp")},                        \
121   { "soft-float",   -1, N_("Don't use hardware fp")},                  \
122   { "backchain",     2, N_("Set backchain")},                          \
123   { "no-backchain", -2, N_("Don't set backchain (faster, but debug harder")}, \
124   { "small-exec",    4, N_("Use bras for executable < 64k")},          \
125   { "no-small-exec",-4, N_("Don't use bras")},                         \
126   { "debug",         8, N_("Additional debug prints")},                \
127   { "no-debug",     -8, N_("Don't print additional debug prints")},    \
128   { "64",           16, N_("64 bit ABI")},                             \
129   { "31",          -16, N_("31 bit ABI")},                             \
130   { "zarch",        32, N_("z/Architecture")},                         \
131   { "esa",         -32, N_("ESA/390 architecture")},                   \
132   { "mvcle",        64, N_("mvcle use")},                              \
133   { "no-mvcle",    -64, N_("mvc&ex")},                                 \
134   { "tpf",         128, N_("enable tpf OS code")},                     \
135   { "no-tpf",     -128, N_("disable tpf OS code")},                    \
136   { "", TARGET_DEFAULT, 0 } }
137
138 #define TARGET_OPTIONS                                          \
139 { { "tune=",            &s390_tune_string,                      \
140     N_("Schedule code for given CPU"), 0},                      \
141   { "arch=",            &s390_arch_string,                      \
142     N_("Generate code for given CPU"), 0},                      \
143 }
144
145 /* Support for configure-time defaults.  */
146 #define OPTION_DEFAULT_SPECS                                    \
147   { "mode", "%{!mesa:%{!mzarch:-m%(VALUE)}}" },                 \
148   { "arch", "%{!march=*:-march=%(VALUE)}" },                    \
149   { "tune", "%{!mtune=*:-mtune=%(VALUE)}" }
150
151 /* Defaulting rules.  */
152 #ifdef DEFAULT_TARGET_64BIT
153 #define DRIVER_SELF_SPECS                                       \
154   "%{!m31:%{!m64:-m64}}",                                       \
155   "%{!mesa:%{!mzarch:%{m31:-mesa}%{m64:-mzarch}}}",             \
156   "%{!march=*:%{mesa:-march=g5}%{mzarch:-march=z900}}"
157 #else
158 #define DRIVER_SELF_SPECS                                       \
159   "%{!m31:%{!m64:-m31}}",                                       \
160   "%{!mesa:%{!mzarch:%{m31:-mesa}%{m64:-mzarch}}}",             \
161   "%{!march=*:%{mesa:-march=g5}%{mzarch:-march=z900}}"
162 #endif
163
164 /* Target version string.  Overridden by the OS header.  */
165 #ifdef DEFAULT_TARGET_64BIT
166 #define TARGET_VERSION fprintf (stderr, " (zSeries)");
167 #else
168 #define TARGET_VERSION fprintf (stderr, " (S/390)");
169 #endif
170
171 /* Hooks to override options.  */
172 #define OPTIMIZATION_OPTIONS(LEVEL, SIZE) optimization_options(LEVEL, SIZE)
173 #define OVERRIDE_OPTIONS override_options ()
174
175 /* Frame pointer is not used for debugging.  */
176 #define CAN_DEBUG_WITHOUT_FP
177
178
179 /* In libgcc2, determine target settings as compile-time constants.  */
180 #ifdef IN_LIBGCC2
181 #undef TARGET_64BIT
182 #ifdef __s390x__
183 #define TARGET_64BIT 1
184 #else
185 #define TARGET_64BIT 0
186 #endif
187 #endif
188
189
190 /* Target machine storage layout.  */
191
192 /* Everything is big-endian.  */
193 #define BITS_BIG_ENDIAN 1
194 #define BYTES_BIG_ENDIAN 1
195 #define WORDS_BIG_ENDIAN 1
196
197 /* Width of a word, in units (bytes).  */
198 #define UNITS_PER_WORD (TARGET_64BIT ? 8 : 4)
199 #ifndef IN_LIBGCC2
200 #define MIN_UNITS_PER_WORD 4
201 #endif
202 #define MAX_BITS_PER_WORD 64
203
204 /* Function arguments and return values are promoted to word size.  */
205 #define PROMOTE_FUNCTION_ARGS
206 #define PROMOTE_FUNCTION_RETURN
207 #define PROMOTE_FOR_CALL_ONLY
208
209 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE)             \
210 if (INTEGRAL_MODE_P (MODE) &&                           \
211     GET_MODE_SIZE (MODE) < UNITS_PER_WORD) {            \
212   (MODE) = Pmode;                                       \
213           }
214
215 /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
216 #define PARM_BOUNDARY (TARGET_64BIT ? 64 : 32)
217
218 /* Boundary (in *bits*) on which stack pointer should be aligned.  */
219 #define STACK_BOUNDARY 64
220
221 /* Allocation boundary (in *bits*) for the code of a function.  */
222 #define FUNCTION_BOUNDARY 32
223
224 /* There is no point aligning anything to a rounder boundary than this.  */
225 #define BIGGEST_ALIGNMENT 64
226
227 /* Alignment of field after `int : 0' in a structure.  */
228 #define EMPTY_FIELD_BOUNDARY 32
229
230 /* Alignment on even addresses for LARL instruction.  */
231 #define CONSTANT_ALIGNMENT(EXP, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN)
232 #define DATA_ALIGNMENT(TYPE, ALIGN) (ALIGN) < 16 ? 16 : (ALIGN)
233
234 /* Alignment is not required by the hardware.  */
235 #define STRICT_ALIGNMENT 0
236
237 /* Mode of stack savearea.
238    FUNCTION is VOIDmode because calling convention maintains SP.
239    BLOCK needs Pmode for SP.
240    NONLOCAL needs twice Pmode to maintain both backchain and SP.  */
241 #define STACK_SAVEAREA_MODE(LEVEL)      \
242   (LEVEL == SAVE_FUNCTION ? VOIDmode    \
243   : LEVEL == SAVE_NONLOCAL ? (TARGET_64BIT ? TImode : DImode) : Pmode)
244
245 /* Define target floating point format.  */
246 #define TARGET_FLOAT_FORMAT \
247   (TARGET_IEEE_FLOAT? IEEE_FLOAT_FORMAT : IBM_FLOAT_FORMAT)
248
249
250 /* Type layout.  */
251
252 /* Sizes in bits of the source language data types.  */
253 #define SHORT_TYPE_SIZE 16
254 #define INT_TYPE_SIZE 32
255 #define LONG_TYPE_SIZE (TARGET_64BIT ? 64 : 32)
256 #define MAX_LONG_TYPE_SIZE 64
257 #define LONG_LONG_TYPE_SIZE 64
258 #define FLOAT_TYPE_SIZE 32
259 #define DOUBLE_TYPE_SIZE 64
260 #define LONG_DOUBLE_TYPE_SIZE 64  /* ??? Should support extended format.  */
261
262 /* We use "unsigned char" as default.  */
263 #define DEFAULT_SIGNED_CHAR 0
264
265
266 /* Register usage.  */
267
268 /* We have 16 general purpose registers (registers 0-15),
269    and 16 floating point registers (registers 16-31).
270    (On non-IEEE machines, we have only 4 fp registers.)
271
272    Amongst the general purpose registers, some are used
273    for specific purposes:
274    GPR 11: Hard frame pointer (if needed)
275    GPR 12: Global offset table pointer (if needed)
276    GPR 13: Literal pool base register
277    GPR 14: Return address register
278    GPR 15: Stack pointer
279
280    Registers 32-34 are 'fake' hard registers that do not
281    correspond to actual hardware:
282    Reg 32: Argument pointer
283    Reg 33: Condition code
284    Reg 34: Frame pointer  */
285
286 #define FIRST_PSEUDO_REGISTER 35
287
288 /* Standard register usage.  */
289 #define GENERAL_REGNO_P(N)      ((int)(N) >= 0 && (N) < 16)
290 #define ADDR_REGNO_P(N)         ((N) >= 1 && (N) < 16)
291 #define FP_REGNO_P(N)           ((N) >= 16 && (N) < (TARGET_IEEE_FLOAT? 32 : 20))
292 #define CC_REGNO_P(N)           ((N) == 33)
293 #define FRAME_REGNO_P(N)        ((N) == 32 || (N) == 34)
294
295 #define GENERAL_REG_P(X)        (REG_P (X) && GENERAL_REGNO_P (REGNO (X)))
296 #define ADDR_REG_P(X)           (REG_P (X) && ADDR_REGNO_P (REGNO (X)))
297 #define FP_REG_P(X)             (REG_P (X) && FP_REGNO_P (REGNO (X)))
298 #define CC_REG_P(X)             (REG_P (X) && CC_REGNO_P (REGNO (X)))
299 #define FRAME_REG_P(X)          (REG_P (X) && FRAME_REGNO_P (REGNO (X)))
300
301 #define BASE_REGISTER 13
302 #define RETURN_REGNUM 14
303 #define CC_REGNUM 33
304
305 /* Set up fixed registers and calling convention:
306
307    GPRs 0-5 are always call-clobbered,
308    GPRs 6-15 are always call-saved.
309    GPR 12 is fixed if used as GOT pointer.
310    GPR 13 is always fixed (as literal pool pointer).
311    GPR 14 is always fixed (as return address).
312    GPR 15 is always fixed (as stack pointer).
313    The 'fake' hard registers are call-clobbered and fixed.
314
315    On 31-bit, FPRs 18-19 are call-clobbered;
316    on 64-bit, FPRs 24-31 are call-clobbered.
317    The remaining FPRs are call-saved.  */
318
319 #define FIXED_REGISTERS                         \
320 { 0, 0, 0, 0,                                   \
321   0, 0, 0, 0,                                   \
322   0, 0, 0, 0,                                   \
323   0, 1, 1, 1,                                   \
324   0, 0, 0, 0,                                   \
325   0, 0, 0, 0,                                   \
326   0, 0, 0, 0,                                   \
327   0, 0, 0, 0,                                   \
328   1, 1, 1 }
329
330 #define CALL_USED_REGISTERS                     \
331 { 1, 1, 1, 1,                                   \
332   1, 1, 0, 0,                                   \
333   0, 0, 0, 0,                                   \
334   0, 1, 1, 1,                                   \
335   1, 1, 1, 1,                                   \
336   1, 1, 1, 1,                                   \
337   1, 1, 1, 1,                                   \
338   1, 1, 1, 1,                                   \
339   1, 1, 1 }
340
341 #define CALL_REALLY_USED_REGISTERS              \
342 { 1, 1, 1, 1,                                   \
343   1, 1, 0, 0,                                   \
344   0, 0, 0, 0,                                   \
345   0, 0, 0, 0,                                   \
346   1, 1, 1, 1,                                   \
347   1, 1, 1, 1,                                   \
348   1, 1, 1, 1,                                   \
349   1, 1, 1, 1,                                   \
350   1, 1, 1 }
351
352 #define CONDITIONAL_REGISTER_USAGE                              \
353 do                                                              \
354   {                                                             \
355     int i;                                                      \
356                                                                 \
357     if (flag_pic)                                               \
358       {                                                         \
359         fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;                \
360         call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1;            \
361       }                                                         \
362     if (TARGET_64BIT)                                           \
363       {                                                         \
364         for (i = 24; i < 32; i++)                               \
365             call_used_regs[i] = call_really_used_regs[i] = 0;   \
366       }                                                         \
367     else                                                        \
368       {                                                         \
369         for (i = 18; i < 20; i++)                               \
370             call_used_regs[i] = call_really_used_regs[i] = 0;   \
371       }                                                         \
372  } while (0)
373
374 /* Preferred register allocation order.  */
375 #define REG_ALLOC_ORDER                                         \
376 {  1, 2, 3, 4, 5, 0, 14, 13, 12, 11, 10, 9, 8, 7, 6,            \
377    16, 17, 18, 19, 20, 21, 22, 23,                              \
378    24, 25, 26, 27, 28, 29, 30, 31,                              \
379    15, 32, 33, 34 }
380
381
382 /* Fitting values into registers.  */
383
384 /* Integer modes <= word size fit into any GPR.
385    Integer modes > word size fit into successive GPRs, starting with
386    an even-numbered register.
387    SImode and DImode fit into FPRs as well.
388
389    Floating point modes <= word size fit into any FPR or GPR.
390    Floating point modes > word size (i.e. DFmode on 32-bit) fit
391    into any FPR, or an even-odd GPR pair.
392
393    Complex floating point modes fit either into two FPRs, or into
394    successive GPRs (again starting with an even number).
395
396    Condition code modes fit only into the CC register.  */
397
398 #define HARD_REGNO_NREGS(REGNO, MODE)                           \
399   (FP_REGNO_P(REGNO)?                                           \
400     (GET_MODE_CLASS(MODE) == MODE_COMPLEX_FLOAT ? 2 : 1) :      \
401    GENERAL_REGNO_P(REGNO)?                                      \
402     ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1) / UNITS_PER_WORD) : \
403    1)
404
405 #define HARD_REGNO_MODE_OK(REGNO, MODE)                             \
406   (FP_REGNO_P(REGNO)?                                               \
407    ((MODE) == SImode || (MODE) == DImode ||                         \
408     GET_MODE_CLASS(MODE) == MODE_FLOAT ||                           \
409     GET_MODE_CLASS(MODE) == MODE_COMPLEX_FLOAT) :                   \
410    GENERAL_REGNO_P(REGNO)?                                          \
411     (HARD_REGNO_NREGS(REGNO, MODE) == 1 || !((REGNO) & 1)) :        \
412    CC_REGNO_P(REGNO)?                                               \
413      GET_MODE_CLASS (MODE) == MODE_CC :                             \
414    FRAME_REGNO_P(REGNO)?                                            \
415      (enum machine_mode) (MODE) == Pmode :                          \
416    0)
417
418 #define MODES_TIEABLE_P(MODE1, MODE2)           \
419    (((MODE1) == SFmode || (MODE1) == DFmode)    \
420    == ((MODE2) == SFmode || (MODE2) == DFmode))
421
422 /* Maximum number of registers to represent a value of mode MODE
423    in a register of class CLASS.  */
424 #define CLASS_MAX_NREGS(CLASS, MODE)                                    \
425      ((CLASS) == FP_REGS ?                                              \
426       (GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT ? 2 : 1) :           \
427       (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
428
429 /* If a 4-byte value is loaded into a FPR, it is placed into the
430    *upper* half of the register, not the lower.  Therefore, we
431    cannot use SUBREGs to switch between modes in FP registers.  */
432 #define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS)               \
433   (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO)                   \
434    ? reg_classes_intersect_p (FP_REGS, CLASS) : 0)
435
436 /* Register classes.  */
437
438 /* We use the following register classes:
439    GENERAL_REGS     All general purpose registers
440    ADDR_REGS        All general purpose registers except %r0
441                     (These registers can be used in address generation)
442    FP_REGS          All floating point registers
443
444    GENERAL_FP_REGS  Union of GENERAL_REGS and FP_REGS
445    ADDR_FP_REGS     Union of ADDR_REGS and FP_REGS
446
447    NO_REGS          No registers
448    ALL_REGS         All registers
449
450    Note that the 'fake' frame pointer and argument pointer registers
451    are included amongst the address registers here.  The condition
452    code register is only included in ALL_REGS.  */
453
454 enum reg_class
455 {
456   NO_REGS, ADDR_REGS, GENERAL_REGS,
457   FP_REGS, ADDR_FP_REGS, GENERAL_FP_REGS,
458   ALL_REGS, LIM_REG_CLASSES
459 };
460 #define N_REG_CLASSES (int) LIM_REG_CLASSES
461
462 #define REG_CLASS_NAMES                                                 \
463 { "NO_REGS", "ADDR_REGS", "GENERAL_REGS",                               \
464   "FP_REGS", "ADDR_FP_REGS", "GENERAL_FP_REGS", "ALL_REGS" }
465
466 /* Class -> register mapping.  */
467 #define REG_CLASS_CONTENTS \
468 {                                                       \
469   { 0x00000000, 0x00000000 },   /* NO_REGS */           \
470   { 0x0000fffe, 0x00000005 },   /* ADDR_REGS */         \
471   { 0x0000ffff, 0x00000005 },   /* GENERAL_REGS */      \
472   { 0xffff0000, 0x00000000 },   /* FP_REGS */           \
473   { 0xfffffffe, 0x00000005 },   /* ADDR_FP_REGS */      \
474   { 0xffffffff, 0x00000005 },   /* GENERAL_FP_REGS */   \
475   { 0xffffffff, 0x00000007 },   /* ALL_REGS */          \
476 }
477
478 /* Register -> class mapping.  */
479 extern const enum reg_class regclass_map[FIRST_PSEUDO_REGISTER];
480 #define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO])
481
482 /* ADDR_REGS can be used as base or index register.  */
483 #define INDEX_REG_CLASS ADDR_REGS
484 #define BASE_REG_CLASS ADDR_REGS
485
486 /* Check whether REGNO is a hard register of the suitable class
487    or a pseudo register currently allocated to one such.  */
488 #define REGNO_OK_FOR_INDEX_P(REGNO)                                     \
489     (((REGNO) < FIRST_PSEUDO_REGISTER                                   \
490      && REGNO_REG_CLASS ((REGNO)) == ADDR_REGS)                         \
491     || (reg_renumber[REGNO] > 0 && reg_renumber[REGNO] < 16))
492 #define REGNO_OK_FOR_BASE_P(REGNO) REGNO_OK_FOR_INDEX_P (REGNO)
493
494
495 /* Given an rtx X being reloaded into a reg required to be in class CLASS,
496    return the class of reg to actually use.  */
497 #define PREFERRED_RELOAD_CLASS(X, CLASS)        \
498   s390_preferred_reload_class ((X), (CLASS))
499
500 /* We need a secondary reload when loading a PLUS which is
501    not a valid operand for LOAD ADDRESS.  */
502 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, IN)   \
503   s390_secondary_input_reload_class ((CLASS), (MODE), (IN))
504
505 /* We need a secondary reload when storing a double-word
506    to a non-offsettable memory address.  */
507 #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, OUT) \
508   s390_secondary_output_reload_class ((CLASS), (MODE), (OUT))
509
510 /* We need secondary memory to move data between GPRs and FPRs.  */
511 #define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
512  ((CLASS1) != (CLASS2) && ((CLASS1) == FP_REGS || (CLASS2) == FP_REGS))
513
514 /* Get_secondary_mem widens its argument to BITS_PER_WORD which loses on 64bit
515    because the movsi and movsf patterns don't handle r/f moves.  */
516 #define SECONDARY_MEMORY_NEEDED_MODE(MODE)              \
517  (GET_MODE_BITSIZE (MODE) < 32                          \
518   ? mode_for_size (32, GET_MODE_CLASS (MODE), 0)        \
519   : MODE)
520
521
522 /* Define various machine-dependent constraint letters.  */
523
524 #define REG_CLASS_FROM_LETTER(C)                                        \
525   ((C) == 'a' ? ADDR_REGS :                                             \
526    (C) == 'd' ? GENERAL_REGS :                                          \
527    (C) == 'f' ? FP_REGS : NO_REGS)
528
529 #define CONST_OK_FOR_LETTER_P(VALUE, C)                                 \
530   ((C) == 'I' ? (unsigned long) (VALUE) < 256 :                         \
531    (C) == 'J' ? (unsigned long) (VALUE) < 4096 :                        \
532    (C) == 'K' ? (VALUE) >= -32768 && (VALUE) < 32768 :                  \
533    (C) == 'L' ? (unsigned long) (VALUE) < 65536 : 0)
534
535 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)  1
536
537 #define EXTRA_CONSTRAINT(OP, C)                                 \
538   s390_extra_constraint ((OP), (C))
539 #define EXTRA_MEMORY_CONSTRAINT(C, STR)                         \
540   ((C) == 'Q' || (C) == 'R' || (C) == 'S' || (C) == 'T')
541 #define EXTRA_ADDRESS_CONSTRAINT(C, STR)                        \
542   ((C) == 'U' || (C) == 'W')
543
544
545 /* Stack layout and calling conventions.  */
546
547 /* Our stack grows from higher to lower addresses.  However, local variables
548    are accessed by positive offsets, and function arguments are stored at
549    increasing addresses.  */
550 #define STACK_GROWS_DOWNWARD
551 /* #undef FRAME_GROWS_DOWNWARD */
552 /* #undef ARGS_GROW_DOWNWARD */
553
554 /* The basic stack layout looks like this: the stack pointer points
555    to the register save area for called functions.  Above that area
556    is the location to place outgoing arguments.  Above those follow
557    dynamic allocations (alloca), and finally the local variables.  */
558
559 /* Offset from stack-pointer to first location of outgoing args.  */
560 #define STACK_POINTER_OFFSET (TARGET_64BIT ? 160 : 96)
561
562 /* Offset within stack frame to start allocating local variables at.  */
563 extern int current_function_outgoing_args_size;
564 #define STARTING_FRAME_OFFSET \
565      (STACK_POINTER_OFFSET + current_function_outgoing_args_size)
566
567 /* Offset from the stack pointer register to an item dynamically
568    allocated on the stack, e.g., by `alloca'.  */
569 #define STACK_DYNAMIC_OFFSET(FUNDECL) (STARTING_FRAME_OFFSET)
570
571 /* Offset of first parameter from the argument pointer register value.
572    We have a fake argument pointer register that points directly to
573    the argument area.  */
574 #define FIRST_PARM_OFFSET(FNDECL) 0
575
576 /* The return address of the current frame is retrieved
577    from the initial value of register RETURN_REGNUM.
578    For frames farther back, we use the stack slot where
579    the corresponding RETURN_REGNUM register was saved.  */
580
581 #define DYNAMIC_CHAIN_ADDRESS(FRAME)                                            \
582   ((FRAME) != hard_frame_pointer_rtx ? (FRAME) :                                \
583    plus_constant (arg_pointer_rtx, -STACK_POINTER_OFFSET))
584
585 #define RETURN_ADDR_RTX(COUNT, FRAME)                                           \
586   s390_return_addr_rtx ((COUNT), DYNAMIC_CHAIN_ADDRESS ((FRAME)))
587
588 /* In 31-bit mode, we need to mask off the high bit of return addresses.  */
589 #define MASK_RETURN_ADDR (TARGET_64BIT ? GEN_INT (-1) : GEN_INT (0x7fffffff))
590
591
592 /* Exception handling.  */
593
594 /* Describe calling conventions for DWARF-2 exception handling.  */
595 #define INCOMING_RETURN_ADDR_RTX  gen_rtx_REG (Pmode, RETURN_REGNUM)
596 #define INCOMING_FRAME_SP_OFFSET STACK_POINTER_OFFSET
597 #define DWARF_FRAME_RETURN_COLUMN  14
598
599 /* Describe how we implement __builtin_eh_return.  */
600 #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 6 : INVALID_REGNUM)
601 #define EH_RETURN_HANDLER_RTX \
602   gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, \
603                -STACK_POINTER_OFFSET + UNITS_PER_WORD*RETURN_REGNUM))
604
605 /* Select a format to encode pointers in exception handling data.  */
606 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL)                          \
607   (flag_pic                                                                 \
608     ? ((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4 \
609    : DW_EH_PE_absptr)
610
611
612 /* Frame registers.  */
613
614 #define STACK_POINTER_REGNUM 15
615 #define FRAME_POINTER_REGNUM 34
616 #define HARD_FRAME_POINTER_REGNUM 11
617 #define ARG_POINTER_REGNUM 32
618
619 /* The static chain must be call-clobbered, but not used for
620    function argument passing.  As register 1 is clobbered by
621    the trampoline code, we only have one option.  */
622 #define STATIC_CHAIN_REGNUM 0
623
624 /* Number of hardware registers that go into the DWARF-2 unwind info.
625    To avoid ABI incompatibility, this number must not change even as
626    'fake' hard registers are added or removed.  */
627 #define DWARF_FRAME_REGISTERS 34
628
629
630 /* Frame pointer and argument pointer elimination.  */
631
632 #define FRAME_POINTER_REQUIRED 0
633
634 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0
635
636 #define ELIMINABLE_REGS                                 \
637 {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM},         \
638  { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM},    \
639  { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM},           \
640  { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
641
642 #define CAN_ELIMINATE(FROM, TO) (1)
643
644 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)                      \
645 { if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM)     \
646   { (OFFSET) = 0; }                                                       \
647   else  if ((FROM) == FRAME_POINTER_REGNUM                                \
648             && (TO) == HARD_FRAME_POINTER_REGNUM)                         \
649   { (OFFSET) = 0; }                                                       \
650   else if ((FROM) == ARG_POINTER_REGNUM                                   \
651             && (TO) == HARD_FRAME_POINTER_REGNUM)                         \
652   { (OFFSET) = s390_arg_frame_offset (); }                                \
653   else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM)  \
654   { (OFFSET) = s390_arg_frame_offset (); }                                \
655   else                                                                    \
656     abort();                                                              \
657 }
658
659
660 /* Stack arguments.  */
661
662 /* We need current_function_outgoing_args to be valid.  */
663 #define ACCUMULATE_OUTGOING_ARGS 1
664
665 /* Return doesn't modify the stack.  */
666 #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) 0
667
668
669 /* Register arguments.  */
670
671 typedef struct s390_arg_structure
672 {
673   int gprs;                     /* gpr so far */
674   int fprs;                     /* fpr so far */
675 }
676 CUMULATIVE_ARGS;
677
678 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, NN) \
679   ((CUM).gprs=0, (CUM).fprs=0)
680
681 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)                    \
682   s390_function_arg_advance (&CUM, MODE, TYPE, NAMED)
683
684 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED)   \
685   s390_function_arg (&CUM, MODE, TYPE, NAMED)
686
687 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
688   s390_function_arg_pass_by_reference (MODE, TYPE)
689
690 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
691
692 /* Arguments can be placed in general registers 2 to 6,
693    or in floating point registers 0 and 2.  */
694 #define FUNCTION_ARG_REGNO_P(N) (((N) >=2 && (N) <7) || \
695                                  (N) == 16 || (N) == 17)
696
697
698 /* Scalar return values.  */
699
700 /* We return scalars in general purpose register 2 for integral values,
701    and floating point register 0 for fp values.  */
702 #define FUNCTION_VALUE(VALTYPE, FUNC)                           \
703   gen_rtx_REG ((INTEGRAL_TYPE_P (VALTYPE)                       \
704                 && TYPE_PRECISION (VALTYPE) < BITS_PER_WORD)    \
705                || POINTER_TYPE_P (VALTYPE)                      \
706                ? word_mode : TYPE_MODE (VALTYPE),               \
707                TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_HARD_FLOAT ? 16 : 2)
708
709 /* Define how to find the value returned by a library function assuming
710    the value has mode MODE.  */
711 #define RET_REG(MODE) ((GET_MODE_CLASS (MODE) == MODE_INT       \
712                        || TARGET_SOFT_FLOAT ) ? 2 : 16)
713 #define LIBCALL_VALUE(MODE)  gen_rtx (REG, MODE, RET_REG (MODE))
714
715 /* Only gpr 2 and fpr 0 are ever used as return registers.  */
716 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 2 || (N) == 16)
717
718
719 /* Aggregate return values.  */
720
721 /* The definition of this macro implies that there are cases where
722    a scalar value cannot be returned in registers.  */
723 #define RETURN_IN_MEMORY(type)                                  \
724   (TYPE_MODE (type) == BLKmode ||                               \
725    GET_MODE_CLASS (TYPE_MODE (type)) == MODE_COMPLEX_INT  ||    \
726    GET_MODE_CLASS (TYPE_MODE (type)) == MODE_COMPLEX_FLOAT)
727
728 /* Structure value address is passed as invisible first argument (gpr 2).  */
729 #define STRUCT_VALUE 0
730
731
732 /* Function entry and exit.  */
733
734 /* When returning from a function, the stack pointer does not matter.  */
735 #define EXIT_IGNORE_STACK       1
736
737
738 /* Profiling.  */
739
740 #define FUNCTION_PROFILER(FILE, LABELNO)                        \
741   s390_function_profiler ((FILE), ((LABELNO)))
742
743 #define PROFILE_BEFORE_PROLOGUE 1
744
745
746 /* Implementing the varargs macros.  */
747
748 #define BUILD_VA_LIST_TYPE(VALIST) \
749   (VALIST) = s390_build_va_list ()
750
751 #define EXPAND_BUILTIN_VA_START(valist, nextarg) \
752   s390_va_start (valist, nextarg)
753
754 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
755   s390_va_arg (valist, type)
756
757
758 /* Trampolines for nested functions.  */
759
760 #define TRAMPOLINE_SIZE (TARGET_64BIT ? 36 : 20)
761
762 #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT)                       \
763    s390_initialize_trampoline ((ADDR), (FNADDR), (CXT))
764
765 #define TRAMPOLINE_TEMPLATE(FILE)                                       \
766    s390_trampoline_template (FILE)
767
768
769 /* Library calls.  */
770
771 /* We should use memcpy, not bcopy.  */
772 #define TARGET_MEM_FUNCTIONS
773
774
775 /* Addressing modes, and classification of registers for them.  */
776
777 /* Recognize any constant value that is a valid address.  */
778 #define CONSTANT_ADDRESS_P(X) 0
779
780 /* Maximum number of registers that can appear in a valid memory address.  */
781 #define MAX_REGS_PER_ADDRESS 2
782
783 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx and check
784    its validity for a certain class.  We have two alternate definitions
785    for each of them.  The usual definition accepts all pseudo regs; the
786    other rejects them all.  The symbol REG_OK_STRICT causes the latter
787    definition to be used.
788
789    Most source files want to accept pseudo regs in the hope that they will
790    get allocated to the class that the insn wants them to be in.
791    Some source files that are used after register allocation
792    need to be strict.  */
793
794 #define REG_OK_FOR_INDEX_NONSTRICT_P(X)         \
795 ((GET_MODE (X) == Pmode) &&                     \
796  ((REGNO (X) >= FIRST_PSEUDO_REGISTER)          \
797   || REGNO_REG_CLASS (REGNO (X)) == ADDR_REGS))
798
799 #define REG_OK_FOR_BASE_NONSTRICT_P(X)    REG_OK_FOR_INDEX_NONSTRICT_P (X)
800
801 #define REG_OK_FOR_INDEX_STRICT_P(X)                            \
802 ((GET_MODE (X) == Pmode) && (REGNO_OK_FOR_INDEX_P (REGNO (X))))
803
804 #define REG_OK_FOR_BASE_STRICT_P(X)                             \
805 ((GET_MODE (X) == Pmode) && (REGNO_OK_FOR_BASE_P (REGNO (X))))
806
807 #ifndef REG_OK_STRICT
808 #define REG_OK_FOR_INDEX_P(X)  REG_OK_FOR_INDEX_NONSTRICT_P(X)
809 #define REG_OK_FOR_BASE_P(X)   REG_OK_FOR_BASE_NONSTRICT_P(X)
810 #else
811 #define REG_OK_FOR_INDEX_P(X)  REG_OK_FOR_INDEX_STRICT_P(X)
812 #define REG_OK_FOR_BASE_P(X)   REG_OK_FOR_BASE_STRICT_P(X)
813 #endif
814
815 /* S/390 has no mode dependent addresses.  */
816 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)
817
818 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression that is a
819    valid memory address for an instruction.
820    The MODE argument is the machine mode for the MEM expression
821    that wants to use this address.  */
822 #ifdef REG_OK_STRICT
823 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)                         \
824 {                                                                       \
825   if (legitimate_address_p (MODE, X, 1))                                \
826     goto ADDR;                                                          \
827 }
828 #else
829 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)                         \
830 {                                                                       \
831   if (legitimate_address_p (MODE, X, 0))                                \
832     goto ADDR;                                                          \
833 }
834 #endif
835
836 /* Try machine-dependent ways of modifying an illegitimate address
837    to be legitimate.  If we find one, return the new, valid address.
838    This macro is used in only one place: `memory_address' in explow.c.  */
839 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)                          \
840 {                                                                       \
841   (X) = legitimize_address (X, OLDX, MODE);                             \
842   if (memory_address_p (MODE, X))                                       \
843     goto WIN;                                                           \
844 }
845
846 /* Nonzero if the constant value X is a legitimate general operand.
847    It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
848 #define LEGITIMATE_CONSTANT_P(X) \
849      legitimate_constant_p (X)
850
851 /* Helper macro for s390.c and s390.md to check for symbolic constants.  */
852 #define SYMBOLIC_CONST(X)       \
853 (GET_CODE (X) == SYMBOL_REF                                             \
854  || GET_CODE (X) == LABEL_REF                                           \
855  || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
856
857 #define TLS_SYMBOLIC_CONST(X)   \
858 ((GET_CODE (X) == SYMBOL_REF && tls_symbolic_operand (X))       \
859  || (GET_CODE (X) == CONST && tls_symbolic_reference_mentioned_p (X)))
860
861
862 /* Condition codes.  */
863
864 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
865    return the mode to be used for the comparison.  */
866 #define SELECT_CC_MODE(OP, X, Y) s390_select_ccmode ((OP), (X), (Y))
867
868 /* Define the information needed to generate branch and scc insns.  This is
869    stored from the compare operation.  Note that we can't use "rtx" here
870    since it hasn't been defined!  */
871 extern struct rtx_def *s390_compare_op0, *s390_compare_op1;
872
873
874 /* Relative costs of operations.  */
875
876 /* On s390, copy between fprs and gprs is expensive.  */
877 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2)                        \
878   ((   (   reg_classes_intersect_p ((CLASS1), GENERAL_REGS)             \
879         && reg_classes_intersect_p ((CLASS2), FP_REGS))                 \
880     || (   reg_classes_intersect_p ((CLASS1), FP_REGS)                  \
881         && reg_classes_intersect_p ((CLASS2), GENERAL_REGS))) ? 10 : 1)
882
883 /* A C expression for the cost of moving data of mode M between a
884    register and memory.  A value of 2 is the default; this cost is
885    relative to those in `REGISTER_MOVE_COST'.  */
886 #define MEMORY_MOVE_COST(M, C, I) 1
887
888 /* A C expression for the cost of a branch instruction.  A value of 1
889    is the default; other values are interpreted relative to that.  */
890 #define BRANCH_COST 1
891
892 /* Nonzero if access to memory by bytes is slow and undesirable.  */
893 #define SLOW_BYTE_ACCESS 1
894
895 /* The maximum number of bytes that a single instruction can move quickly
896    between memory and registers or between two memory locations. */
897 #define MOVE_MAX (TARGET_64BIT ? 16 : 8)
898 #define MAX_MOVE_MAX 16
899
900 /* Determine whether to use move_by_pieces or block move insn.  */
901 #define MOVE_BY_PIECES_P(SIZE, ALIGN)           \
902   ( (SIZE) == 1 || (SIZE) == 2 || (SIZE) == 4   \
903     || (TARGET_64BIT && (SIZE) == 8) )
904
905 /* Determine whether to use clear_by_pieces or block clear insn.  */
906 #define CLEAR_BY_PIECES_P(SIZE, ALIGN)          \
907   ( (SIZE) == 1 || (SIZE) == 2 || (SIZE) == 4   \
908     || (TARGET_64BIT && (SIZE) == 8) )
909
910 /* Don't perform CSE on function addresses.  */
911 #define NO_FUNCTION_CSE
912
913
914 /* Sections.  */
915
916 /* Output before read-only data.  */
917 #define TEXT_SECTION_ASM_OP ".text"
918
919 /* Output before writable (initialized) data.  */
920 #define DATA_SECTION_ASM_OP ".data"
921
922 /* Output before writable (uninitialized) data.  */
923 #define BSS_SECTION_ASM_OP ".bss"
924
925 /* S/390 constant pool breaks the devices in crtstuff.c to control section
926    in where code resides.  We have to write it as asm code.  */
927 #ifndef __s390x__
928 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
929     asm (SECTION_OP "\n\
930         bras\t%r2,1f\n\
931 0:      .long\t" USER_LABEL_PREFIX #FUNC " - 0b\n\
932 1:      l\t%r3,0(%r2)\n\
933         bas\t%r14,0(%r3,%r2)\n\
934         .previous");
935 #endif
936
937
938 /* Position independent code.  */
939
940 extern int flag_pic;
941
942 #define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 12 : INVALID_REGNUM)
943
944 #define LEGITIMATE_PIC_OPERAND_P(X)  legitimate_pic_operand_p (X)
945
946
947 /* Assembler file format.  */
948
949 /* Character to start a comment.  */
950 #define ASM_COMMENT_START "#"
951
952 /* Declare an uninitialized external linkage data object.  */
953 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
954   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
955
956 /* Globalizing directive for a label.  */
957 #define GLOBAL_ASM_OP ".globl "
958
959 /* Advance the location counter to a multiple of 2**LOG bytes.  */
960 #define ASM_OUTPUT_ALIGN(FILE, LOG) \
961   if ((LOG)) fprintf ((FILE), "\t.align\t%d\n", 1 << (LOG))
962
963 /* Advance the location counter by SIZE bytes.  */
964 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
965   fprintf ((FILE), "\t.set\t.,.+"HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE))
966
967 /* The LOCAL_LABEL_PREFIX variable is used by dbxelf.h.  */
968 #define LOCAL_LABEL_PREFIX "."
969
970 /* How to refer to registers in assembler output.  This sequence is
971    indexed by compiler's hard-register-number (see above).  */
972 #define REGISTER_NAMES                                                  \
973 { "%r0",  "%r1",  "%r2",  "%r3",  "%r4",  "%r5",  "%r6",  "%r7",        \
974   "%r8",  "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15",        \
975   "%f0",  "%f2",  "%f4",  "%f6",  "%f1",  "%f3",  "%f5",  "%f7",        \
976   "%f8",  "%f10", "%f12", "%f14", "%f9", "%f11", "%f13", "%f15",        \
977   "%ap",  "%cc",  "%fp"                                                 \
978 }
979
980 /* Emit a dtp-relative reference to a TLS variable.  */
981
982 #ifdef HAVE_AS_TLS
983 #define ASM_OUTPUT_DWARF_DTPREL(FILE, SIZE, X) \
984   s390_output_dwarf_dtprel (FILE, SIZE, X)
985 #endif
986
987 /* Print operand X (an rtx) in assembler syntax to file FILE.  */
988 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
989 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
990
991 /* Output an element of a case-vector that is absolute.  */
992 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)                            \
993 do {                                                                    \
994   char buf[32];                                                         \
995   fputs (integer_asm_op (UNITS_PER_WORD, TRUE), (FILE));                \
996   ASM_GENERATE_INTERNAL_LABEL (buf, "L", (VALUE));                      \
997   assemble_name ((FILE), buf);                                          \
998   fputc ('\n', (FILE));                                                 \
999 } while (0)
1000
1001 /* Output an element of a case-vector that is relative.  */
1002 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL)                \
1003 do {                                                                    \
1004   char buf[32];                                                         \
1005   fputs (integer_asm_op (UNITS_PER_WORD, TRUE), (FILE));                \
1006   ASM_GENERATE_INTERNAL_LABEL (buf, "L", (VALUE));                      \
1007   assemble_name ((FILE), buf);                                          \
1008   fputc ('-', (FILE));                                                  \
1009   ASM_GENERATE_INTERNAL_LABEL (buf, "L", (REL));                        \
1010   assemble_name ((FILE), buf);                                          \
1011   fputc ('\n', (FILE));                                                 \
1012 } while (0)
1013
1014
1015 /* Constant Pool for all symbols operands which are changed with
1016    force_const_mem during insn generation (expand_insn).  */
1017
1018 extern int s390_pool_count;
1019 extern int s390_nr_constants;
1020
1021 #define ASM_OUTPUT_POOL_PROLOGUE(FILE, FUNNAME, fndecl, size)           \
1022 {                                                                       \
1023   struct pool_constant *pool;                                           \
1024                                                                         \
1025     if (s390_pool_count == -1)                                          \
1026      {                                                                  \
1027        s390_nr_constants = 0;                                           \
1028        for (pool = first_pool; pool; pool = pool->next)                 \
1029          if (pool->mark) s390_nr_constants++;                           \
1030        return;                                                          \
1031      }                                                                  \
1032 }
1033
1034 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY(FILE, EXP, MODE, ALIGN, LABELNO, WIN) \
1035 {                                                                           \
1036   fprintf (FILE, ".LC%d:\n", LABELNO);                                      \
1037                                                                             \
1038   /* Output the value of the constant itself.  */                           \
1039   switch (GET_MODE_CLASS (MODE))                                            \
1040     {                                                                       \
1041     case MODE_FLOAT:                                                        \
1042       if (GET_CODE (EXP) != CONST_DOUBLE)                                   \
1043         abort ();                                                           \
1044                                                                             \
1045       REAL_VALUE_FROM_CONST_DOUBLE (r, EXP);                                \
1046       assemble_real (r, MODE, ALIGN);                                       \
1047       break;                                                                \
1048                                                                             \
1049     case MODE_INT:                                                          \
1050     case MODE_PARTIAL_INT:                                                  \
1051       if (GET_CODE (EXP) == CONST                                           \
1052           || GET_CODE (EXP) == SYMBOL_REF                                   \
1053           || GET_CODE (EXP) == LABEL_REF)                                   \
1054         {                                                                   \
1055           fputs (integer_asm_op (UNITS_PER_WORD, TRUE), FILE);              \
1056           s390_output_symbolic_const (FILE, EXP);                           \
1057           fputc ('\n', (FILE));                                             \
1058         }                                                                   \
1059       else                                                                  \
1060         {                                                                   \
1061           assemble_integer (EXP, GET_MODE_SIZE (MODE), ALIGN, 1);           \
1062           if (GET_MODE_SIZE (MODE) == 1)                                    \
1063             ASM_OUTPUT_SKIP ((FILE), (unsigned HOST_WIDE_INT)1);            \
1064         }                                                                   \
1065       break;                                                                \
1066                                                                             \
1067     default:                                                                \
1068       abort ();                                                             \
1069     }                                                                       \
1070   goto WIN;                                                                 \
1071 }
1072
1073
1074 /* Miscellaneous parameters.  */
1075
1076 /* Define the codes that are matched by predicates in aux-output.c.  */
1077 #define PREDICATE_CODES                                                 \
1078   {"s_operand",       { SUBREG, MEM }},                                 \
1079   {"s_imm_operand",   { CONST_INT, CONST_DOUBLE, SUBREG, MEM }},        \
1080   {"bras_sym_operand",{ SYMBOL_REF, CONST }},                           \
1081   {"larl_operand",    { SYMBOL_REF, CONST, CONST_INT, CONST_DOUBLE }},  \
1082   {"load_multiple_operation", {PARALLEL}},                              \
1083   {"store_multiple_operation", {PARALLEL}},                             \
1084   {"const0_operand",  { CONST_INT, CONST_DOUBLE }},                     \
1085   {"consttable_operand", { SYMBOL_REF, LABEL_REF, CONST,                \
1086                            CONST_INT, CONST_DOUBLE }},                  \
1087   {"s390_plus_operand", { PLUS }},
1088
1089 /* Specify the machine mode that this machine uses for the index in the
1090    tablejump instruction.  */
1091 #define CASE_VECTOR_MODE (TARGET_64BIT ? DImode : SImode)
1092
1093 /* Load from integral MODE < SI from memory into register makes sign_extend
1094    or zero_extend
1095    In our case sign_extension happens for Halfwords, other no extension.  */
1096 #define LOAD_EXTEND_OP(MODE)                                    \
1097 (TARGET_64BIT ? ((MODE) == QImode ? ZERO_EXTEND :               \
1098                  (MODE) == HImode ? SIGN_EXTEND : NIL)          \
1099               : ((MODE) == HImode ? SIGN_EXTEND : NIL))
1100
1101 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1102    is done just by pretending it is already truncated.  */
1103 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC)  1
1104
1105 /* Specify the machine mode that pointers have.
1106    After generation of rtl, the compiler makes no further distinction
1107    between pointers and any other objects of this machine mode.  */
1108 #define Pmode ((enum machine_mode) (TARGET_64BIT ? DImode : SImode))
1109
1110 /* This is -1 for "pointer mode" extend.  See ptr_extend in s390.md.  */
1111 #define POINTERS_EXTEND_UNSIGNED -1
1112
1113 /* A function address in a call instruction is a byte address (for
1114    indexing purposes) so give the MEM rtx a byte's mode.  */
1115 #define FUNCTION_MODE QImode
1116
1117 /* This macro definition sets up a default value for `main' to return.  */
1118 #define DEFAULT_MAIN_RETURN  c_expand_return (integer_zero_node)
1119
1120 #endif