OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [config/] [s390/] [s390.h] - Blame information for rev 154

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.