OSDN Git Service

1bb4e069e0a6a385a82981eb76e63241cb6219bf
[pf3gnuchains/gcc-fork.git] / gcc / config / i370 / i370.h
1 /* Definitions of target machine for GNU compiler.  System/370 version.
2    Copyright (C) 1989, 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
3    Contributed by Jan Stein (jan@cd.chalmers.se).
4    Modified for C/370 MVS by Dave Pitts (dpitts@nyx.cs.du.edu)
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23 #define TARGET_VERSION printf (" (370/MVS)");
24
25 /* Options for the preprocessor for this target machine.  */
26
27 #define CPP_SPEC "-trigraphs"
28
29 /* Names to predefine in the preprocessor for this target machine.  */
30
31 #define CPP_PREDEFINES "-DGCC -Dgcc -DMVS -Dmvs -Asystem(mvs) -Acpu(i370) -Amachine(i370)"
32
33 /* Run-time compilation parameters selecting different hardware subsets.  */
34
35 extern int target_flags;
36
37 /* The sizes of the code and literals on the current page.  */
38
39 extern int mvs_page_code, mvs_page_lit;
40
41 /* The current page number and the base page number for the function.  */
42
43 extern int mvs_page_num, function_base_page;
44
45 /* True if a label has been emitted.  */
46
47 extern int mvs_label_emitted;
48
49 /* The name of the current function.  */
50
51 extern char *mvs_function_name;
52
53 /* The length of the function name malloc'd area.  */
54
55 extern int mvs_function_name_length;
56
57 /* The amount of space used for outgoing arguments.  */
58
59 extern int current_function_outgoing_args_size;
60
61 /* Compile using char instructions (mvc, nc, oc, xc).  On 4341 use this since
62    these are more than twice as fast as load-op-store.
63    On 3090 don't use this since load-op-store is much faster.  */
64
65 #define TARGET_CHAR_INSTRUCTIONS (target_flags & 1)
66
67 /* Default target switches */
68
69 #define TARGET_DEFAULT 1
70
71 /* Macro to define tables used to set the flags.  This is a list in braces
72    of pairs in braces, each pair being { "NAME", VALUE }
73    where VALUE is the bits to set or minus the bits to clear.
74    An empty string NAME is used to identify the default VALUE.  */
75
76 #define TARGET_SWITCHES                                                 \
77 { { "char-instructions", 1},                                            \
78   { "no-char-instructions", -1},                                        \
79   { "", TARGET_DEFAULT} }
80
81 /* To use IBM supplied macro function prologue and epilogue, define the
82    following to 1.  Should only be needed if IBM changes the definition
83    of their prologue and epilogue.  */
84
85 #define MACROPROLOGUE 0
86 #define MACROEPILOGUE 0
87
88 /* Target machine storage layout */
89
90 /* Define this if most significant bit is lowest numbered in instructions
91    that operate on numbered bit-fields.  */
92
93 #define BITS_BIG_ENDIAN 1
94
95 /* Define this if most significant byte of a word is the lowest numbered.  */
96
97 #define BYTES_BIG_ENDIAN 1
98
99 /* Define this if MS word of a multiword is the lowest numbered.  */
100
101 #define WORDS_BIG_ENDIAN 1
102
103 /* Number of bits in an addressable storage unit.  */
104
105 #define BITS_PER_UNIT 8
106
107 /* Width in bits of a "word", which is the contents of a machine register.  */
108
109 #define BITS_PER_WORD 32
110
111 /* Width of a word, in units (bytes).  */
112
113 #define UNITS_PER_WORD 4
114
115 /* Width in bits of a pointer.  See also the macro `Pmode' defined below.  */
116
117 #define POINTER_SIZE 32
118
119 /* Allocation boundary (in *bits*) for storing pointers in memory.  */
120
121 #define POINTER_BOUNDARY 32
122
123 /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
124
125 #define PARM_BOUNDARY 32
126
127 /* Boundary (in *bits*) on which stack pointer should be aligned.  */
128
129 #define STACK_BOUNDARY 32
130
131 /* Allocation boundary (in *bits*) for the code of a function.  */
132
133 #define FUNCTION_BOUNDARY 32
134
135 /* There is no point aligning anything to a rounder boundary than this.  */
136
137 #define BIGGEST_ALIGNMENT 64
138
139 /* Alignment of field after `int : 0' in a structure.  */
140
141 #define EMPTY_FIELD_BOUNDARY 32
142
143 /* Define this if move instructions will actually fail to work when given
144    unaligned data.  */
145
146 #define STRICT_ALIGNMENT 0
147
148 /* Define target floating point format.  */
149
150 #define TARGET_FLOAT_FORMAT IBM_FLOAT_FORMAT
151
152 /* Define character mapping for cross-compiling.  */
153
154 #define TARGET_EBCDIC 1
155
156 #ifdef HOST_EBCDIC
157 #define MAP_CHARACTER(c) ((char)(c))
158 #else
159 #define MAP_CHARACTER(c) ((char)mvs_map_char (c))
160 #endif
161
162 /* Define maximum length of page minus page escape overhead.  */
163
164 #define MAX_MVS_PAGE_LENGTH 4080
165
166 /* Define if special allocation order desired.  */
167
168 #define REG_ALLOC_ORDER                                                 \
169 { 0, 1, 2, 3, 14, 15, 12, 10, 9, 8, 7, 6, 5, 4, 16, 17, 18, 19, 11, 13 }
170
171 /* Standard register usage.  */
172
173 /* Number of actual hardware registers.  The hardware registers are
174    assigned numbers for the compiler from 0 to just below
175    FIRST_PSEUDO_REGISTER.
176    All registers that the compiler knows about must be given numbers,
177    even those that are not normally considered general registers.
178    For the 370, we give the data registers numbers 0-15,
179    and the floating point registers numbers 16-19.  */
180
181 #define FIRST_PSEUDO_REGISTER 20
182
183 /* Define base and page registers.  */
184
185 #define BASE_REGISTER 3
186 #define PAGE_REGISTER 4
187
188 /* 1 for registers that have pervasive standard uses and are not available
189    for the register allocator.  On the 370 under C/370, R13 is stack (DSA)
190    pointer, R12 is the TCA pointer, R3 is the base register, R4 is the page
191    origin table pointer and R11 is the arg pointer.  */
192
193 #define FIXED_REGISTERS                                                 \
194 { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0 }
195 /*0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19*/
196
197 /* 1 for registers not available across function calls.  These must include
198    the FIXED_REGISTERS and also any registers that can be used without being
199    saved.
200    The latter must include the registers where values are returned
201    and the register where structure-value addresses are passed.
202    NOTE: all floating registers are undefined across calls.  */
203
204 #define CALL_USED_REGISTERS                                             \
205 { 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
206 /*0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19*/
207
208 /* Return number of consecutive hard regs needed starting at reg REGNO
209    to hold something of mode MODE.
210    This is ordinarily the length in words of a value of mode MODE
211    but can be less for certain modes in special long registers.  */
212
213 #define HARD_REGNO_NREGS(REGNO, MODE)                                   \
214   ((REGNO) > 15 ? 1 : (GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1) / UNITS_PER_WORD)
215
216 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
217    On the 370, the cpu registers can hold QI, HI, SI, SF and DF.  The
218    even registers can hold DI.  The floating point registers can hold
219    either SF or DF.  */
220
221 #define HARD_REGNO_MODE_OK(REGNO, MODE)                                 \
222   ((REGNO) < 16 ? ((REGNO) & 1) == 0 || (MODE) != DImode                \
223                 : (MODE) == SFmode || (MODE) == DFmode)
224
225 /* Value is 1 if it is a good idea to tie two pseudo registers when one has
226    mode MODE1 and one has mode MODE2.
227    If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
228    for any hard reg, then this must be 0 for correct output.  */
229
230 #define MODES_TIEABLE_P(MODE1, MODE2)                                   \
231   (((MODE1) == SFmode || (MODE1) == DFmode)                             \
232    == ((MODE2) == SFmode || (MODE2) == DFmode))
233
234 /* Mark external references.  */
235
236 #define ENCODE_SECTION_INFO(decl)                                       \
237   if (DECL_EXTERNAL (decl) && TREE_PUBLIC (decl))                       \
238     SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
239
240 /* Specify the registers used for certain standard purposes.
241    The values of these macros are register numbers.  */
242
243 /* 370 PC isn't overloaded on a register.  */
244
245 /* #define PC_REGNUM */
246
247 /* Register to use for pushing function arguments.  */
248
249 #define STACK_POINTER_REGNUM 13
250
251 /* Base register for access to local variables of the function.  */
252
253 #define FRAME_POINTER_REGNUM 13
254
255 /* Value should be nonzero if functions must have frame pointers.
256    Zero means the frame pointer need not be set up (and parms may be
257    accessed via the stack pointer) in functions that seem suitable.
258    This is computed in `reload', in reload1.c.  */
259
260 #define FRAME_POINTER_REQUIRED 1
261
262 /* Base register for access to arguments of the function.  */
263
264 #define ARG_POINTER_REGNUM 11
265
266 /* Register in which static-chain is passed to a function.  */
267
268 #define STATIC_CHAIN_REGNUM 10
269
270 /* Register in which address to store a structure value is passed to
271    a function.  */
272
273 #define STRUCT_VALUE_REGNUM 1
274
275 /* Define the classes of registers for register constraints in the
276    machine description.  Also define ranges of constants.
277
278    One of the classes must always be named ALL_REGS and include all hard regs.
279    If there is more than one class, another class must be named NO_REGS
280    and contain no registers.
281
282    The name GENERAL_REGS must be the name of a class (or an alias for
283    another name such as ALL_REGS).  This is the class of registers
284    that is allowed by "g" or "r" in a register constraint.
285    Also, registers outside this class are allocated only when
286    instructions express preferences for them.
287
288    The classes must be numbered in nondecreasing order; that is,
289    a larger-numbered class must never be contained completely
290    in a smaller-numbered class.
291
292    For any two classes, it is very desirable that there be another
293    class that represents their union.  */
294
295 enum reg_class
296   {
297     NO_REGS, ADDR_REGS, DATA_REGS,
298     FP_REGS, ALL_REGS, LIM_REG_CLASSES
299   };
300
301 #define GENERAL_REGS DATA_REGS
302 #define N_REG_CLASSES (int) LIM_REG_CLASSES
303
304 /* Give names of register classes as strings for dump file.  */
305
306 #define REG_CLASS_NAMES                                                 \
307 { "NO_REGS", "ADDR_REGS", "DATA_REGS", "FP_REGS", "ALL_REGS" }
308
309 /* Define which registers fit in which classes.  This is an initializer for
310    a vector of HARD_REG_SET of length N_REG_CLASSES.  */
311
312 #define REG_CLASS_CONTENTS {0, 0x0fffe, 0x0ffff, 0xf0000, 0xfffff}
313
314 /* The same information, inverted:
315    Return the class number of the smallest class containing
316    reg number REGNO.  This could be a conditional expression
317    or could index an array.  */
318
319 #define REGNO_REG_CLASS(REGNO)                                          \
320   ((REGNO) >= 16 ? FP_REGS : (REGNO) != 0 ? ADDR_REGS : DATA_REGS)
321
322 /* The class value for index registers, and the one for base regs.  */
323
324 #define INDEX_REG_CLASS ADDR_REGS
325 #define BASE_REG_CLASS ADDR_REGS
326
327 /* Get reg_class from a letter such as appears in the machine description.  */
328
329 #define REG_CLASS_FROM_LETTER(C)                                        \
330   ((C) == 'a' ? ADDR_REGS :                                             \
331   ((C) == 'd' ? DATA_REGS :                                             \
332   ((C) == 'f' ? FP_REGS   : NO_REGS)))
333
334 /* The letters I, J, K, L and M in a register constraint string can be used
335    to stand for particular ranges of immediate operands.
336    This macro defines what the ranges are.
337    C is the letter, and VALUE is a constant value.
338    Return 1 if VALUE is in the range specified by C.  */
339
340 #define CONST_OK_FOR_LETTER_P(VALUE, C)                                 \
341   ((C) == 'I' ? (unsigned) (VALUE) < 256 :                              \
342    (C) == 'J' ? (unsigned) (VALUE) < 4096 :                             \
343    (C) == 'K' ? (VALUE) >= -32768 && (VALUE) < 32768 : 0)
344
345 /* Similar, but for floating constants, and defining letters G and H.
346    Here VALUE is the CONST_DOUBLE rtx itself.  */
347
348 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)  1
349
350 /* Given an rtx X being reloaded into a reg required to be in class CLASS,
351    return the class of reg to actually use.  In general this is just CLASS;
352    but on some machines in some cases it is preferable to use a more
353    restrictive class.  */
354
355 #define PREFERRED_RELOAD_CLASS(X, CLASS)                                \
356     (GET_CODE(X) == CONST_DOUBLE ? FP_REGS :                            \
357      GET_CODE(X) == CONST_INT ? DATA_REGS :                             \
358      GET_CODE(X) == LABEL_REF ||                                        \
359      GET_CODE(X) == SYMBOL_REF ||                                       \
360      GET_CODE(X) == CONST ? ADDR_REGS : (CLASS))
361
362 /* Return the maximum number of consecutive registers needed to represent
363    mode MODE in a register of class CLASS.  */
364
365 #define CLASS_MAX_NREGS(CLASS, MODE)                                    \
366   ((CLASS) == FP_REGS ? 1 :                                             \
367    (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
368
369 /* Stack layout; function entry, exit and calling.  */
370
371 /* Define this if pushing a word on the stack makes the stack pointer a
372    smaller address.  */
373
374 /* #define STACK_GROWS_DOWNWARD */
375
376 /* Define this if the nominal address of the stack frame is at the
377    high-address end of the local variables; that is, each additional local
378    variable allocated goes at a more negative offset in the frame.  */
379
380 /* #define FRAME_GROWS_DOWNWARD */
381
382 /* Offset within stack frame to start allocating local variables at.
383    If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
384    first local allocated.  Otherwise, it is the offset to the BEGINNING
385    of the first local allocated.  */
386
387 #define STARTING_FRAME_OFFSET                                           \
388      (STACK_POINTER_OFFSET + current_function_outgoing_args_size)
389
390 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = STARTING_FRAME_OFFSET
391
392 /* If we generate an insn to push BYTES bytes, this says how many the stack
393    pointer really advances by.  On the 370, we have no push instruction.  */
394
395 /* #define PUSH_ROUNDING(BYTES) */
396
397 /* Accumulate the outgoing argument count so we can request the right
398    DSA size and determine stack offset.  */
399
400 #define ACCUMULATE_OUTGOING_ARGS
401
402 /* Define offset from stack pointer, to location where a parm can be
403    pushed.  */
404
405 #define STACK_POINTER_OFFSET 148
406
407 /* Offset of first parameter from the argument pointer register value.  */
408
409 #define FIRST_PARM_OFFSET(FNDECL) 0
410
411 /* 1 if N is a possible register number for function argument passing.
412    On the 370, no registers are used in this way.  */
413
414 #define FUNCTION_ARG_REGNO_P(N) 0
415
416 /* Define a data type for recording info about an argument list during
417    the scan of that argument list.  This data type should hold all
418    necessary information about the function itself and about the args
419    processed so far, enough to enable macros such as FUNCTION_ARG to
420    determine where the next arg should go.  */
421
422 #define CUMULATIVE_ARGS int
423
424 /* Initialize a variable CUM of type CUMULATIVE_ARGS for a call to
425    a function whose data type is FNTYPE.
426    For a library call, FNTYPE is 0.  */
427
428 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT)  ((CUM) = 0)
429
430 /* Update the data in CUM to advance over an argument of mode MODE and
431    data type TYPE.  (TYPE is null for libcalls where that information
432    may not be available.) */
433
434 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)                    \
435  ((CUM) += ((MODE) == DFmode || (MODE) == SFmode                        \
436             ? 256                                                       \
437             : (MODE) != BLKmode                                         \
438             ? (GET_MODE_SIZE (MODE) + 3) / 4                            \
439             : (int_size_in_bytes (TYPE) + 3) / 4))
440
441 /* Define where to put the arguments to a function.  Value is zero to push
442    the argument on the stack, or a hard register in which to store the
443    argument.  */
444
445 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
446
447 /* For an arg passed partly in registers and partly in memory, this is the
448    number of registers used.  For args passed entirely in registers or
449    entirely in memory, zero.  */
450
451 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
452
453 /* Define if returning from a function call automatically pops the
454    arguments described by the number-of-args field in the call.  */
455
456 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
457
458 /* Define how to find the value returned by a function.  VALTYPE is the
459    data type of the value (as a tree).
460    If the precise function being called is known, FUNC is its FUNCTION_DECL;
461    otherwise, FUNC is 15.  */
462
463 #define RET_REG(MODE)   ((MODE) == DFmode || (MODE) == SFmode ? 16 : 15)
464
465 /* On the 370 the return value is in R15 or R16.  */
466
467 #define FUNCTION_VALUE(VALTYPE, FUNC)                                   \
468   gen_rtx(REG, TYPE_MODE (VALTYPE), RET_REG(TYPE_MODE(VALTYPE)))
469
470 /* Define how to find the value returned by a library function assuming
471    the value has mode MODE.  */
472
473 #define LIBCALL_VALUE(MODE)  gen_rtx(REG, MODE, RET_REG(MODE))
474
475 /* 1 if N is a possible register number for a function value.
476    On the 370 under C/370, R15 and R16 are thus used.  */
477
478 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 15 || (N) == 16)
479
480 /* This macro definition sets up a default value for `main' to return.  */
481
482 #define DEFAULT_MAIN_RETURN  c_expand_return (integer_zero_node)
483
484 /* This macro generates the assembly code for function entry.
485    All of the C/370 environment is preserved.  */
486 #define FUNCTION_PROLOGUE(FILE, LSIZE) i370_function_prolog ((FILE), (LSIZE));
487
488 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                     \
489 {                                                                       \
490   if (strlen (NAME) * 2 > mvs_function_name_length)                     \
491     {                                                                   \
492       if (mvs_function_name)                                            \
493         free (mvs_function_name);                                       \
494       mvs_function_name = 0;                                            \
495     }                                                                   \
496   if (!mvs_function_name)                                               \
497     {                                                                   \
498       mvs_function_name_length = strlen (NAME) * 2;                     \
499       mvs_function_name = (char *) malloc (mvs_function_name_length);   \
500       if (mvs_function_name == 0)                                       \
501         {                                                               \
502           fatal ("virtual memory exceeded");                            \
503           abort ();                                                     \
504         }                                                               \
505     }                                                                   \
506   if (!strcmp (NAME, "main"))                                           \
507     strcpy (mvs_function_name, "gccmain");                              \
508   else                                                                  \
509     strcpy (mvs_function_name, NAME);                                   \
510 }
511
512 /* This macro generates the assembly code for function exit, on machines
513    that need it.  If FUNCTION_EPILOGUE is not defined then individual
514    return instructions are generated for each return statement.  Args are
515    same as for FUNCTION_PROLOGUE.
516
517    The function epilogue should not depend on the current stack pointer!
518    It should use the frame pointer only.  This is mandatory because
519    of alloca; we also take advantage of it to omit stack adjustments
520    before returning.  */
521
522 #if MACROEPILOGUE == 1
523 #define FUNCTION_EPILOGUE(FILE, LSIZE)                                  \
524 {                                                                       \
525   int i;                                                                \
526   check_label_emit();                                                   \
527   mvs_check_page (FILE,14,0);                                           \
528   fprintf (FILE, "\tEDCEPIL\n");                                        \
529   mvs_page_num++;                                                       \
530   fprintf (FILE, "\tDS\t0F\n" );                                        \
531   fprintf (FILE, "\tLTORG\n");                                          \
532   fprintf (FILE, "\tDS\t0F\n");                                         \
533   fprintf (FILE, "PGT%d\tEQU\t*\n", function_base_page);                \
534   mvs_free_label();                                                     \
535   for ( i = function_base_page; i < mvs_page_num; i++ )                 \
536     fprintf (FILE, "\tDC\tA(PG%d)\n", i);                               \
537 }
538 #else /* MACROEPILOGUE != 1 */
539 #define FUNCTION_EPILOGUE(FILE, LSIZE)                                  \
540 {                                                                       \
541   int i;                                                                \
542   check_label_emit();                                                   \
543   mvs_check_page (FILE,14,0);                                           \
544   fprintf (FILE, "\tL\t13,4(,13)\n");                                   \
545   fprintf (FILE, "\tL\t14,12(,13)\n");                                  \
546   fprintf (FILE, "\tLM\t2,12,28(13)\n");                                \
547   fprintf (FILE, "\tBALR\t1,14\n");                                     \
548   fprintf (FILE, "\tDC\tA(");                                           \
549   mvs_page_num++;                                                       \
550   assemble_name (FILE, mvs_function_name);                              \
551   fprintf (FILE, ")\n" );                                               \
552   fprintf (FILE, "\tDS\t0F\n" );                                        \
553   fprintf (FILE, "\tLTORG\n");                                          \
554   fprintf (FILE, "\tDS\t0F\n");                                         \
555   fprintf (FILE, "PGT%d\tEQU\t*\n", function_base_page);                \
556   mvs_free_label();                                                     \
557   for ( i = function_base_page; i < mvs_page_num; i++ )                 \
558     fprintf (FILE, "\tDC\tA(PG%d)\n", i);                               \
559 }
560 #endif /* MACROEPILOGUE */
561
562
563 /* Output assembler code for a block containing the constant parts of a
564    trampoline, leaving space for the variable parts.
565
566    On the 370, the trampoline contains these instructions:
567
568         BALR  14,0
569         USING *,14
570         L     STATIC_CHAIN_REGISTER,X
571         L     15,Y
572         BR    15
573    X    DS    0F
574    Y    DS    0F  */
575
576 #define TRAMPOLINE_TEMPLATE(FILE)                                       \
577 {                                                                       \
578   ASM_OUTPUT_SHORT (FILE, GEN_INT (0x05E0));                            \
579   ASM_OUTPUT_SHORT (FILE, GEN_INT (0x5800 | STATIC_CHAIN_REGNUM << 4)); \
580   ASM_OUTPUT_SHORT (FILE, GEN_INT (0xE00A));                            \
581   ASM_OUTPUT_SHORT (FILE, GEN_INT (0x58F0));                            \
582   ASM_OUTPUT_SHORT (FILE, GEN_INT (0xE00E));                            \
583   ASM_OUTPUT_SHORT (FILE, GEN_INT (0x07FF));                            \
584   ASM_OUTPUT_SHORT (FILE, const0_rtx);                                  \
585   ASM_OUTPUT_SHORT (FILE, const0_rtx);                                  \
586   ASM_OUTPUT_SHORT (FILE, const0_rtx);                                  \
587   ASM_OUTPUT_SHORT (FILE, const0_rtx);                                  \
588 }
589
590 /* Length in units of the trampoline for entering a nested function.  */
591
592 #define TRAMPOLINE_SIZE 20
593
594 /* Emit RTL insns to initialize the variable parts of a trampoline.  */
595
596 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT)                       \
597 {                                                                       \
598   emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 12)), CXT); \
599   emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 16)), FNADDR); \
600 }
601
602 /* Output assembler code to FILE to increment profiler label # LABELNO
603    for profiling a function entry.  */
604
605 #define FUNCTION_PROFILER(FILE, LABELNO)                                \
606   fprintf (FILE, "Error: No profiling available.\n")
607
608 /* Define EXIT_IGNORE_STACK if, when returning from a function, the stack
609    pointer does not matter (provided there is a frame pointer).  */
610
611 #define EXIT_IGNORE_STACK       1
612
613 /* Addressing modes, and classification of registers for them.  */
614
615 /* #define HAVE_POST_INCREMENT */
616 /* #define HAVE_POST_DECREMENT */
617
618 /* #define HAVE_PRE_DECREMENT */
619 /* #define HAVE_PRE_INCREMENT */
620
621 /* These assume that REGNO is a hard or pseudo reg number.  They give
622    nonzero only if REGNO is a hard reg of the suitable class or a pseudo
623    reg currently allocated to a suitable hard reg.
624    These definitions are NOT overridden anywhere.  */
625
626 #define REGNO_OK_FOR_INDEX_P(REGNO)                                     \
627   (((REGNO) > 0 && (REGNO) < 16)                                        \
628     || (reg_renumber[REGNO] > 0 && reg_renumber[REGNO] < 16))
629
630 #define REGNO_OK_FOR_BASE_P(REGNO) REGNO_OK_FOR_INDEX_P(REGNO)
631
632 #define REGNO_OK_FOR_DATA_P(REGNO)                                      \
633   ((REGNO) < 16 || (unsigned) reg_renumber[REGNO] < 16)
634
635 #define REGNO_OK_FOR_FP_P(REGNO)                                        \
636   ((unsigned) ((REGNO) - 16) < 4 || (unsigned) (reg_renumber[REGNO] - 16) < 4)
637
638 /* Now macros that check whether X is a register and also,
639    strictly, whether it is in a specified class.  */
640
641 /* 1 if X is a data register.  */
642
643 #define DATA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_DATA_P (REGNO (X)))
644
645 /* 1 if X is an fp register.  */
646
647 #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
648
649 /* 1 if X is an address register.  */
650
651 #define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))
652
653 /* Maximum number of registers that can appear in a valid memory address.  */
654
655 #define MAX_REGS_PER_ADDRESS 2
656
657 /* Recognize any constant value that is a valid address.  */
658
659 #define CONSTANT_ADDRESS_P(X)                                           \
660   (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF              \
661   || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST_DOUBLE          \
662   || (GET_CODE (X) == CONST                                             \
663           && GET_CODE (XEXP (XEXP (X, 0), 0)) == LABEL_REF)             \
664   || (GET_CODE (X) == CONST                                             \
665           && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF             \
666           && !SYMBOL_REF_FLAG (XEXP (XEXP (X, 0), 0))))
667
668 /* Nonzero if the constant value X is a legitimate general operand.
669    It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
670
671 #define LEGITIMATE_CONSTANT_P(X) 1
672
673 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx and check
674    its validity for a certain class.  We have two alternate definitions
675    for each of them.  The usual definition accepts all pseudo regs; the
676    other rejects them all.  The symbol REG_OK_STRICT causes the latter
677    definition to be used.
678
679    Most source files want to accept pseudo regs in the hope that they will
680    get allocated to the class that the insn wants them to be in.
681    Some source files that are used after register allocation
682    need to be strict.  */
683
684 #ifndef REG_OK_STRICT
685
686 /* Nonzero if X is a hard reg that can be used as an index or if it is
687   a pseudo reg.  */
688
689 #define REG_OK_FOR_INDEX_P(X)                                           \
690   ((REGNO(X) > 0 && REGNO(X) < 16) || REGNO(X) >= 20)
691
692 /* Nonzero if X is a hard reg that can be used as a base reg or if it is
693    a pseudo reg.  */
694
695 #define REG_OK_FOR_BASE_P(X)    REG_OK_FOR_INDEX_P(X)
696
697 #else /* REG_OK_STRICT */
698
699 /* Nonzero if X is a hard reg that can be used as an index.  */
700
701 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P(REGNO(X))
702
703 /* Nonzero if X is a hard reg that can be used as a base reg.  */
704
705 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P(REGNO(X))
706
707 #endif /* REG_OK_STRICT */
708
709 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression that is a
710    valid memory address for an instruction.
711    The MODE argument is the machine mode for the MEM expression
712    that wants to use this address.
713
714    The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
715    except for CONSTANT_ADDRESS_P which is actually machine-independent.  */
716
717 #define COUNT_REGS(X, REGS, FAIL)                                       \
718  if (REG_P (X) && REG_OK_FOR_BASE_P (X))                                \
719    REGS += 1;                                                           \
720  else if (GET_CODE (X) != CONST_INT || (unsigned) INTVAL (X) >= 4096)   \
721    goto FAIL;
722
723 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)                         \
724 {                                                                       \
725   if (REG_P (X) && REG_OK_FOR_BASE_P (X))                               \
726     goto ADDR;                                                          \
727   if (GET_CODE (X) == PLUS)                                             \
728     {                                                                   \
729       int regs = 0;                                                     \
730       rtx x0 = XEXP (X, 0);                                             \
731       rtx x1 = XEXP (X, 1);                                             \
732       if (GET_CODE (x0) == PLUS)                                        \
733         {                                                               \
734           COUNT_REGS (XEXP (x0, 0), regs, FAIL);                        \
735           COUNT_REGS (XEXP (x0, 1), regs, FAIL);                        \
736           COUNT_REGS (x1, regs, FAIL);                                  \
737           if (regs == 2)                                                \
738             goto ADDR;                                                  \
739         }                                                               \
740       else if (GET_CODE (x1) == PLUS)                                   \
741         {                                                               \
742           COUNT_REGS (x0, regs, FAIL);                                  \
743           COUNT_REGS (XEXP (x1, 0), regs, FAIL);                        \
744           COUNT_REGS (XEXP (x1, 1), regs, FAIL);                        \
745           if (regs == 2)                                                \
746             goto ADDR;                                                  \
747         }                                                               \
748       else                                                              \
749         {                                                               \
750           COUNT_REGS (x0, regs, FAIL);                                  \
751           COUNT_REGS (x1, regs, FAIL);                                  \
752           if (regs != 0)                                                \
753             goto ADDR;                                                  \
754         }                                                               \
755     }                                                                   \
756   FAIL: ;                                                               \
757 }
758
759 /* The 370 has no mode dependent addresses.  */
760
761 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)
762
763 /* Try machine-dependent ways of modifying an illegitimate address
764    to be legitimate.  If we find one, return the new, valid address.
765    This macro is used in only one place: `memory_address' in explow.c.  */
766
767 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)                          \
768 {                                                                       \
769   if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1)))         \
770     (X) = gen_rtx (PLUS, SImode, XEXP (X, 0),                           \
771                    copy_to_mode_reg (SImode, XEXP (X, 1)));             \
772   if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0)))         \
773     (X) = gen_rtx (PLUS, SImode, XEXP (X, 1),                           \
774                    copy_to_mode_reg (SImode, XEXP (X, 0)));             \
775   if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT)           \
776     (X) = gen_rtx (PLUS, SImode, XEXP (X, 1),                           \
777                    force_operand (XEXP (X, 0), 0));                     \
778   if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT)           \
779     (X) = gen_rtx (PLUS, SImode, XEXP (X, 0),                           \
780                    force_operand (XEXP (X, 1), 0));                     \
781   if (memory_address_p (MODE, X))                                       \
782     goto WIN;                                                           \
783 }
784
785 /* Specify the machine mode that this machine uses for the index in the
786    tablejump instruction.  */
787
788 #define CASE_VECTOR_MODE SImode
789
790 /* Define as C expression which evaluates to nonzero if the tablejump
791    instruction expects the table to contain offsets from the address of the
792    table.
793    Do not define this if the table should contain absolute addresses. */
794 /* #define CASE_VECTOR_PC_RELATIVE 1 */
795
796 /* Specify the tree operation to be used to convert reals to integers.  */
797
798 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
799
800 /* Define this if fixuns_trunc is the same as fix_trunc.  */
801
802 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC
803
804 /* We use "unsigned char" as default.  */
805
806 #define DEFAULT_SIGNED_CHAR 0
807
808 /* This is the kind of divide that is easiest to do in the general case.  */
809
810 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
811
812 /* Max number of bytes we can move from memory to memory in one reasonably
813    fast instruction.  */
814
815 #define MOVE_MAX 256
816
817 /* Define this if zero-extension is slow (more than one real instruction).  */
818
819 #define SLOW_ZERO_EXTEND
820
821 /* Nonzero if access to memory by bytes is slow and undesirable.  */
822
823 #define SLOW_BYTE_ACCESS 1
824
825 /* Define if shifts truncate the shift count which implies one can omit
826    a sign-extension or zero-extension of a shift count.  */
827
828 /* #define SHIFT_COUNT_TRUNCATED */
829
830 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
831    is done just by pretending it is already truncated.  */
832
833 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC)  (OUTPREC != 16)
834
835 /* We assume that the store-condition-codes instructions store 0 for false
836    and some other value for true.  This is the value stored for true.  */
837
838 /* #define STORE_FLAG_VALUE -1 */
839
840 /* When a prototype says `char' or `short', really pass an `int'.  */
841
842 #define PROMOTE_PROTOTYPES
843
844 /* Don't perform CSE on function addresses.  */
845
846 #define NO_FUNCTION_CSE
847
848 /* Specify the machine mode that pointers have.
849    After generation of rtl, the compiler makes no further distinction
850    between pointers and any other objects of this machine mode.  */
851
852 #define Pmode SImode
853
854 /* A function address in a call instruction is a byte address (for
855    indexing purposes) so give the MEM rtx a byte's mode.  */
856
857 #define FUNCTION_MODE QImode
858
859 /* Compute the cost of computing a constant rtl expression RTX whose
860    rtx-code is CODE.  The body of this macro is a portion of a switch
861    statement.  If the code is computed here, return it with a return
862    statement.  Otherwise, break from the switch.  */
863
864 #define CONST_COSTS(RTX, CODE, OUTERCODE)                               \
865   case CONST_INT:                                                       \
866     if ((unsigned) INTVAL (RTX) < 0xfff) return 1;                      \
867   case CONST:                                                           \
868   case LABEL_REF:                                                       \
869   case SYMBOL_REF:                                                      \
870     return 2;                                                           \
871   case CONST_DOUBLE:                                                    \
872     return 4;
873
874 /* Tell final.c how to eliminate redundant test instructions.  */
875
876 /* Here we define machine-dependent flags and fields in cc_status
877    (see `conditions.h').  */
878
879 /* Store in cc_status the expressions that the condition codes will
880    describe after execution of an instruction whose pattern is EXP.
881    Do not alter them if the instruction would not alter the cc's.
882
883    On the 370, load insns do not alter the cc's.  However, in some
884    cases these instructions can make it possibly invalid to use the
885    saved cc's.  In those cases we clear out some or all of the saved
886    cc's so they won't be used.  */
887
888 #define NOTICE_UPDATE_CC(EXP, INSN)                                     \
889 {                                                                       \
890   rtx exp = (EXP);                                                      \
891   if (GET_CODE (exp) == PARALLEL) /* Check this */                      \
892     exp = XVECEXP (exp, 0, 0);                                          \
893   if (GET_CODE (exp) != SET)                                            \
894     CC_STATUS_INIT;                                                     \
895   else                                                                  \
896     {                                                                   \
897       if (XEXP (exp, 0) == cc0_rtx)                                     \
898         {                                                               \
899           cc_status.value1 = XEXP (exp, 0);                             \
900           cc_status.value2 = XEXP (exp, 1);                             \
901           cc_status.flags = 0;                                          \
902         }                                                               \
903       else                                                              \
904         {                                                               \
905           if (cc_status.value1                                          \
906               && reg_mentioned_p (XEXP (exp, 0), cc_status.value1))     \
907             cc_status.value1 = 0;                                       \
908           if (cc_status.value2                                          \
909               && reg_mentioned_p (XEXP (exp, 0), cc_status.value2))     \
910             cc_status.value2 = 0;                                       \
911           switch (GET_CODE (XEXP (exp, 1)))                             \
912             {                                                           \
913               case PLUS:     case MINUS: case MULT:   /* case UMULT: */ \
914               case DIV:      case UDIV:  case NEG:    case ASHIFT:      \
915               case ASHIFTRT: case AND:   case IOR:    case XOR:         \
916               case ABS:      case NOT:                                  \
917                 CC_STATUS_SET (XEXP (exp, 0), XEXP (exp, 1));           \
918             }                                                           \
919         }                                                               \
920     }                                                                   \
921 }
922
923
924 #define CC_STATUS_SET(V1, V2)                                           \
925 {                                                                       \
926   cc_status.flags = 0;                                                  \
927   cc_status.value1 = (V1);                                              \
928   cc_status.value2 = (V2);                                              \
929   if (cc_status.value1                                                  \
930       && reg_mentioned_p (cc_status.value1, cc_status.value2))          \
931     cc_status.value2 = 0;                                               \
932 }
933
934 #define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV)                               \
935 { if (cc_status.flags & CC_NO_OVERFLOW) return NO_OV; return NORMAL; }
936
937 /* Control the assembler format that we output.  */
938
939 #define TEXT_SECTION_ASM_OP "* Program text area"
940 #define DATA_SECTION_ASM_OP "* Program data area"
941 #define INIT_SECTION_ASM_OP "* Program initialization area"
942 #define CTOR_LIST_BEGIN         /* NO OP */
943 #define CTOR_LIST_END           /* NO OP */
944
945 /* How to refer to registers in assembler output.  This sequence is
946    indexed by compiler's hard-register-number (see above).  */
947
948 #define REGISTER_NAMES                                                  \
949 { "0",  "1",  "2",  "3",  "4",  "5",  "6",  "7",                        \
950   "8",  "9", "10", "11", "12", "13", "14", "15",                        \
951   "0",  "2",  "4",  "6"                                                 \
952 }
953
954 /* How to renumber registers for dbx and gdb.  */
955
956 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
957
958 #define ASM_FILE_START(FILE) fputs ("\tCSECT\n", FILE);
959 #define ASM_FILE_END(FILE) fputs ("\tEND\n", FILE);
960 #define ASM_IDENTIFY_GCC(FILE)
961 #define ASM_COMMENT_START "*"
962 #define ASM_APP_OFF ""
963 #define ASM_APP_ON ""
964
965 #define ASM_OUTPUT_LABEL(FILE, NAME)                                    \
966 { assemble_name (FILE, NAME); fputs ("\tEQU\t*\n", FILE); }
967
968 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)   /* NO OP */
969
970 #define ASM_GLOBALIZE_LABEL(FILE, NAME)                                 \
971 { fputs ("\tENTRY\t", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE); }
972
973 /* MVS externals are limited to 8 characters, upper case only.
974    The '_' is mapped to '@', except for MVS functions, then '#'.  */
975
976 #define MAX_MVS_LABEL_SIZE 8
977
978 #define ASM_OUTPUT_LABELREF(FILE, NAME)                                 \
979 {                                                                       \
980   char *bp, ch, temp[MAX_MVS_LABEL_SIZE + 1];                           \
981   if (strlen (NAME) > MAX_MVS_LABEL_SIZE)                               \
982     {                                                                   \
983       strncpy (temp, NAME, MAX_MVS_LABEL_SIZE);                         \
984       temp[MAX_MVS_LABEL_SIZE] = '\0';                                  \
985     }                                                                   \
986   else                                                                  \
987     strcpy (temp,NAME);                                                 \
988   if (!strcmp (temp,"main"))                                            \
989     strcpy (temp,"gccmain");                                            \
990   if (mvs_function_check (temp))                                        \
991     ch = '#';                                                           \
992   else                                                                  \
993     ch = '@';                                                           \
994   for (bp = temp; *bp; bp++)                                            \
995     {                                                                   \
996       if (islower (*bp)) *bp = toupper (*bp);                           \
997       if (*bp == '_') *bp = ch;                                         \
998     }                                                                   \
999   fprintf (FILE, "%s", temp);                                           \
1000 }
1001
1002 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM)                 \
1003   sprintf (LABEL, "*%s%d", PREFIX, NUM)
1004
1005 /* Generate internal label.  Since we can branch here from off page, we
1006    must reload the base register.  */
1007
1008 #define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM)                    \
1009 {                                                                       \
1010   if (!strcmp (PREFIX,"L"))                                             \
1011     {                                                                   \
1012       mvs_add_label(NUM);                                               \
1013       mvs_label_emitted = 1;                                            \
1014     }                                                                   \
1015   fprintf (FILE, "%s%d\tEQU\t*\n", PREFIX, NUM);                        \
1016 }
1017
1018 /* Generate case label.  */
1019
1020 #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, TABLE)                 \
1021    fprintf (FILE, "%s%d\tEQU\t*\n", PREFIX, NUM)
1022
1023 /* This is how to output an element of a case-vector that is absolute.  */
1024
1025 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)                            \
1026   mvs_check_page (FILE, 4, 0);                                          \
1027   fprintf (FILE, "\tDC\tA(L%d)\n", VALUE)
1028
1029 /* This is how to output an element of a case-vector that is relative.  */
1030
1031 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL)                \
1032   mvs_check_page (FILE, 4, 0);                                          \
1033   fprintf (FILE, "\tDC\tA(L%d-L%d)\n", VALUE, REL)
1034
1035 /* This is how to output an insn to push a register on the stack.
1036    It need not be very fast code.  */
1037
1038 #define ASM_OUTPUT_REG_PUSH(FILE, REGNO)                                \
1039   mvs_check_page (FILE, 8, 4);                                          \
1040   fprintf (FILE, "\tS\t13,=F'4'\n\tST\t%s,%d(13)\n",                    \
1041      reg_names[REGNO], STACK_POINTER_OFFSET)
1042
1043 /* This is how to output an insn to pop a register from the stack.
1044    It need not be very fast code.  */
1045
1046 #define ASM_OUTPUT_REG_POP(FILE, REGNO)                                 \
1047   mvs_check_page (FILE, 8, 0);                                          \
1048   fprintf (FILE, "\tL\t%s,%d(13)\n\tLA\t13,4(13)\n",                    \
1049      reg_names[REGNO], STACK_POINTER_OFFSET)
1050
1051 /* This is how to output an assembler line defining a `double' constant.  */
1052
1053 #define ASM_OUTPUT_DOUBLE(FILE, VALUE)                                  \
1054   fprintf (FILE, "\tDC\tD'%.18G'\n", (VALUE))
1055
1056 /* This is how to output an assembler line defining a `float' constant.  */
1057
1058 #define ASM_OUTPUT_FLOAT(FILE, VALUE)                                   \
1059   fprintf (FILE, "\tDC\tE'%.9G'\n", (VALUE))
1060
1061 /* This outputs an integer, if not a CONST_INT must be address constant.  */
1062
1063 #define ASM_OUTPUT_INT(FILE, EXP)                                       \
1064 {                                                                       \
1065   if (GET_CODE (EXP) == CONST_INT)                                      \
1066     {                                                                   \
1067       fprintf (FILE, "\tDC\tF'");                                       \
1068       output_addr_const (FILE, EXP);                                    \
1069       fprintf (FILE, "'\n");                                            \
1070     }                                                                   \
1071   else                                                                  \
1072     {                                                                   \
1073       fprintf (FILE, "\tDC\tA(");                                       \
1074       output_addr_const (FILE, EXP);                                    \
1075       fprintf (FILE, ")\n");                                            \
1076     }                                                                   \
1077 }
1078
1079 /* This outputs a short integer.  */
1080
1081 #define ASM_OUTPUT_SHORT(FILE, EXP)                                     \
1082 {                                                                       \
1083   fprintf (FILE, "\tDC\tX'%04X'\n", INTVAL(EXP) & 0xFFFF);              \
1084 }
1085
1086 /* This outputs a byte sized integer.  */
1087
1088 #define ASM_OUTPUT_CHAR(FILE, EXP)                                      \
1089   fprintf (FILE, "\tDC\tX'%02X'\n", INTVAL (EXP) )
1090
1091 #define ASM_OUTPUT_BYTE(FILE, VALUE)                                    \
1092   fprintf (FILE, "\tDC\tX'%02X'\n", VALUE)
1093
1094 /* This outputs a text string.  The string are chopped up to fit into
1095    an 80 byte record.  Also, control and special characters, interpreted
1096    by the IBM assembler, are output numerically.  */
1097
1098 #define MVS_ASCII_TEXT_LENGTH 48
1099
1100 #define ASM_OUTPUT_ASCII(FILE, PTR, LEN)                                \
1101 {                                                                       \
1102   int i, j;                                                             \
1103   int c;                                                                \
1104   for (j = 0, i = 0; i < LEN; j++, i++)                                 \
1105     {                                                                   \
1106       c = PTR[i];                                                       \
1107       if (iscntrl (c) || c == '&')                                      \
1108         {                                                               \
1109           if (j % MVS_ASCII_TEXT_LENGTH != 0 )                          \
1110             fprintf (FILE, "'\n");                                      \
1111           j = -1;                                                       \
1112           if (c == '&') c = MAP_CHARACTER (c);                          \
1113           fprintf (FILE, "\tDC\tX'%X'\n", c );                          \
1114         }                                                               \
1115       else                                                              \
1116         {                                                               \
1117           if (j % MVS_ASCII_TEXT_LENGTH == 0)                           \
1118             fprintf (FILE, "\tDC\tC'");                                 \
1119           if ( c == '\'' )                                              \
1120             fprintf (FILE, "%c%c", c, c);                               \
1121           else                                                          \
1122             fprintf (FILE, "%c", c);                                    \
1123           if (j % MVS_ASCII_TEXT_LENGTH == MVS_ASCII_TEXT_LENGTH - 1)   \
1124             fprintf (FILE, "'\n" );                                     \
1125         }                                                               \
1126     }                                                                   \
1127   if (j % MVS_ASCII_TEXT_LENGTH != 0)                                   \
1128     fprintf (FILE, "'\n");                                              \
1129 }
1130
1131 /* This is how to output an assembler line that says to advance the
1132    location counter to a multiple of 2**LOG bytes.  */
1133
1134 #define ASM_OUTPUT_ALIGN(FILE, LOG)                                     \
1135   if (LOG)                                                              \
1136     {                                                                   \
1137       if ((LOG) == 1)                                                   \
1138         fprintf (FILE, "\tDS\t0H\n" );                                  \
1139       else                                                              \
1140         fprintf (FILE, "\tDS\t0F\n" );                                  \
1141     }                                                                   \
1142
1143 /* The maximum length of memory that the IBM assembler will allow in one
1144    DS operation.  */
1145
1146 #define MAX_CHUNK 32767
1147
1148 /* A C statement to output to the stdio stream FILE an assembler
1149    instruction to advance the location counter by SIZE bytes. Those
1150    bytes should be zero when loaded.  */
1151
1152 #define ASM_OUTPUT_SKIP(FILE, SIZE)                                     \
1153 {                                                                       \
1154   int s, k;                                                             \
1155   for (s = (SIZE); s > 0; s -= MAX_CHUNK)                               \
1156     {                                                                   \
1157       if (s > MAX_CHUNK)                                                \
1158         k = MAX_CHUNK;                                                  \
1159       else                                                              \
1160         k = s;                                                          \
1161       fprintf (FILE, "\tDS\tXL%d\n", k);                                \
1162     }                                                                   \
1163 }
1164
1165 /* A C statement (sans semicolon) to output to the stdio stream
1166    FILE the assembler definition of a common-label named NAME whose
1167    size is SIZE bytes.  The variable ROUNDED is the size rounded up
1168    to whatever alignment the caller wants.  */
1169
1170 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)                    \
1171 {                                                                       \
1172   fputs ("\tENTRY\t", FILE);                                            \
1173   assemble_name (FILE, NAME);                                           \
1174   fputs ("\n", FILE);                                                   \
1175   fprintf (FILE, "\tDS\t0F\n");                                         \
1176   ASM_OUTPUT_LABEL (FILE,NAME);                                         \
1177   ASM_OUTPUT_SKIP (FILE,SIZE);                                          \
1178 }
1179
1180 /* A C statement (sans semicolon) to output to the stdio stream
1181    FILE the assembler definition of a local-common-label named NAME
1182    whose size is SIZE bytes.  The variable ROUNDED is the size
1183    rounded up to whatever alignment the caller wants.  */
1184
1185 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)                     \
1186 {                                                                       \
1187   fprintf (FILE, "\tDS\t0F\n");                                         \
1188   ASM_OUTPUT_LABEL (FILE,NAME);                                         \
1189   ASM_OUTPUT_SKIP (FILE,SIZE);                                          \
1190 }
1191
1192 /* Store in OUTPUT a string (made with alloca) containing an
1193    assembler-name for a local static variable named NAME.
1194    LABELNO is an integer which is different for each call.  */
1195
1196 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)                  \
1197 {                                                                       \
1198   (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10);                    \
1199   sprintf ((OUTPUT), "%s%d", (NAME), (LABELNO));                        \
1200 }
1201
1202 /* Define the parentheses used to group arithmetic operations
1203    in assembler code.  */
1204
1205 #define ASM_OPEN_PAREN "("
1206 #define ASM_CLOSE_PAREN ")"
1207
1208 /* Define results of standard character escape sequences.  */
1209
1210 #define TARGET_BELL     47
1211 #define TARGET_BS       22
1212 #define TARGET_TAB      5
1213 #define TARGET_NEWLINE  21
1214 #define TARGET_VT       11
1215 #define TARGET_FF       12
1216 #define TARGET_CR       13
1217
1218 /* Print operand X (an rtx) in assembler syntax to file FILE.
1219    CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1220    For `%' followed by punctuation, CODE is the punctuation and X is null.  */
1221
1222 #define PRINT_OPERAND(FILE, X, CODE)                                    \
1223 {                                                                       \
1224   switch (GET_CODE (X))                                                 \
1225     {                                                                   \
1226       static char curreg[4];                                            \
1227       case REG:                                                         \
1228         if (CODE == 'N')                                                \
1229             strcpy (curreg, reg_names[REGNO (X) + 1]);                  \
1230         else                                                            \
1231             strcpy (curreg, reg_names[REGNO (X)]);                      \
1232         fprintf (FILE, "%s", curreg);                                   \
1233         break;                                                          \
1234       case MEM:                                                         \
1235         {                                                               \
1236           rtx addr = XEXP (X, 0);                                       \
1237           if (CODE == 'O')                                              \
1238             {                                                           \
1239               if (GET_CODE (addr) == PLUS)                              \
1240                 fprintf (FILE, "%d", INTVAL (XEXP (addr, 1)));          \
1241               else                                                      \
1242                 fprintf (FILE, "0");                                    \
1243             }                                                           \
1244           else if (CODE == 'R')                                         \
1245             {                                                           \
1246               if (GET_CODE (addr) == PLUS)                              \
1247                 fprintf (FILE, "%s", reg_names[REGNO (XEXP (addr, 0))]);\
1248               else                                                      \
1249                 fprintf (FILE, "%s", reg_names[REGNO (addr)]);          \
1250             }                                                           \
1251           else                                                          \
1252             output_address (XEXP (X, 0));                               \
1253         }                                                               \
1254         break;                                                          \
1255       case SYMBOL_REF:                                                  \
1256       case LABEL_REF:                                                   \
1257         mvs_page_lit += 4;                                              \
1258         if (SYMBOL_REF_FLAG (X)) fprintf (FILE, "=V(");                 \
1259         else                     fprintf (FILE, "=A(");                 \
1260         output_addr_const (FILE, X);                                    \
1261         fprintf (FILE, ")");                                            \
1262         break;                                                          \
1263       case CONST_INT:                                                   \
1264         if (CODE == 'B')                                                \
1265           fprintf (FILE, "%d", INTVAL (X) & 0xff);                      \
1266         else if (CODE == 'X')                                           \
1267           fprintf (FILE, "%02X", INTVAL (X) & 0xff);                    \
1268         else if (CODE == 'h')                                           \
1269           fprintf (FILE, "%d", (INTVAL (X) << 16) >> 16);               \
1270         else if (CODE == 'H')                                           \
1271           {                                                             \
1272             mvs_page_lit += 2;                                          \
1273             fprintf (FILE, "=H'%d'", (INTVAL (X) << 16) >> 16);         \
1274           }                                                             \
1275         else                                                            \
1276           {                                                             \
1277             mvs_page_lit += 4;                                          \
1278             fprintf (FILE, "=F'%d'", INTVAL (X));                       \
1279           }                                                             \
1280         break;                                                          \
1281       case CONST_DOUBLE:                                                \
1282         if (GET_MODE (X) == DImode)                                     \
1283           {                                                             \
1284             if (CODE == 'M')                                            \
1285               {                                                         \
1286                 mvs_page_lit += 4;                                      \
1287                 fprintf (FILE, "=XL4'%08X'", CONST_DOUBLE_LOW (X));     \
1288               }                                                         \
1289             else if (CODE == 'L')                                       \
1290               {                                                         \
1291                 mvs_page_lit += 4;                                      \
1292                 fprintf (FILE, "=XL4'%08X'", CONST_DOUBLE_HIGH (X));    \
1293               }                                                         \
1294             else                                                        \
1295               {                                                         \
1296                 mvs_page_lit += 8;                                      \
1297                 fprintf (FILE, "=XL8'%08X%08X'", CONST_DOUBLE_LOW (X),  \
1298                         CONST_DOUBLE_HIGH (X));                         \
1299               }                                                         \
1300           }                                                             \
1301         else                                                            \
1302           {                                                             \
1303             union { double d; int i[2]; } u;                            \
1304             u.i[0] = CONST_DOUBLE_LOW (X);                              \
1305             u.i[1] = CONST_DOUBLE_HIGH (X);                             \
1306             if (GET_MODE (X) == SFmode)                                 \
1307               {                                                         \
1308                 mvs_page_lit += 4;                                      \
1309                 fprintf (FILE, "=E'%.9G'", u.d);                        \
1310               }                                                         \
1311             else                                                        \
1312               {                                                         \
1313                 mvs_page_lit += 8;                                      \
1314                 fprintf (FILE, "=D'%.18G'", u.d);                       \
1315               }                                                         \
1316           }                                                             \
1317         break;                                                          \
1318       case CONST:                                                       \
1319         if (GET_CODE (XEXP (X, 0)) == PLUS                              \
1320            && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF)           \
1321           {                                                             \
1322             mvs_page_lit += 4;                                          \
1323             if (SYMBOL_REF_FLAG (XEXP (XEXP (X, 0), 0)))                \
1324               {                                                         \
1325                 fprintf (FILE, "=V(");                                  \
1326                 ASM_OUTPUT_LABELREF (FILE,                              \
1327                                   XSTR (XEXP (XEXP (X, 0), 0), 0));     \
1328                 fprintf (FILE, ")\n\tA\t%s,=F'%d'", curreg,             \
1329                                   INTVAL (XEXP (XEXP (X, 0), 1)));      \
1330               }                                                         \
1331             else                                                        \
1332               {                                                         \
1333                 fprintf (FILE, "=A(");                                  \
1334                 output_addr_const (FILE, X);                            \
1335                 fprintf (FILE, ")");                                    \
1336               }                                                         \
1337           }                                                             \
1338         else                                                            \
1339           {                                                             \
1340             mvs_page_lit += 4;                                          \
1341             fprintf (FILE, "=F'");                                      \
1342             output_addr_const (FILE, X);                                \
1343             fprintf (FILE, "'");                                        \
1344           }                                                             \
1345         break;                                                          \
1346       default:                                                          \
1347         abort();                                                        \
1348     }                                                                   \
1349 }
1350
1351 #define PRINT_OPERAND_ADDRESS(FILE, ADDR)                               \
1352 {                                                                       \
1353   rtx breg, xreg, offset, plus;                                         \
1354                                                                         \
1355   switch (GET_CODE (ADDR))                                              \
1356     {                                                                   \
1357       case REG:                                                         \
1358         fprintf (FILE, "0(%s)", reg_names[REGNO (ADDR)]);               \
1359         break;                                                          \
1360       case PLUS:                                                        \
1361         breg = 0;                                                       \
1362         xreg = 0;                                                       \
1363         offset = 0;                                                     \
1364         if (GET_CODE (XEXP (ADDR, 0)) == PLUS)                          \
1365           {                                                             \
1366             if (GET_CODE (XEXP (ADDR, 1)) == REG)                       \
1367               breg = XEXP (ADDR, 1);                                    \
1368             else                                                        \
1369               offset = XEXP (ADDR, 1);                                  \
1370             plus = XEXP (ADDR, 0);                                      \
1371           }                                                             \
1372         else                                                            \
1373           {                                                             \
1374             if (GET_CODE (XEXP (ADDR, 0)) == REG)                       \
1375               breg = XEXP (ADDR, 0);                                    \
1376             else                                                        \
1377               offset = XEXP (ADDR, 0);                                  \
1378             plus = XEXP (ADDR, 1);                                      \
1379           }                                                             \
1380         if (GET_CODE (plus) == PLUS)                                    \
1381           {                                                             \
1382             if (GET_CODE (XEXP (plus, 0)) == REG)                       \
1383               {                                                         \
1384                 if (breg)                                               \
1385                   xreg = XEXP (plus, 0);                                \
1386                 else                                                    \
1387                   breg = XEXP (plus, 0);                                \
1388               }                                                         \
1389             else                                                        \
1390               {                                                         \
1391                 offset = XEXP (plus, 0);                                \
1392               }                                                         \
1393             if (GET_CODE (XEXP (plus, 1)) == REG)                       \
1394               {                                                         \
1395                 if (breg)                                               \
1396                   xreg = XEXP (plus, 1);                                \
1397                 else                                                    \
1398                   breg = XEXP (plus, 1);                                \
1399               }                                                         \
1400             else                                                        \
1401               {                                                         \
1402                 offset = XEXP (plus, 1);                                \
1403               }                                                         \
1404           }                                                             \
1405         else if (GET_CODE (plus) == REG)                                \
1406           {                                                             \
1407             if (breg)                                                   \
1408               xreg = plus;                                              \
1409             else                                                        \
1410               breg = plus;                                              \
1411           }                                                             \
1412         else                                                            \
1413           {                                                             \
1414             offset = plus;                                              \
1415           }                                                             \
1416         if (offset)                                                     \
1417           {                                                             \
1418             if (GET_CODE (offset) == LABEL_REF)                         \
1419               fprintf (FILE, "L%d",                                     \
1420                         CODE_LABEL_NUMBER (XEXP (offset, 0)));          \
1421             else                                                        \
1422               output_addr_const (FILE, offset);                         \
1423           }                                                             \
1424         else                                                            \
1425           fprintf (FILE, "0");                                          \
1426         if (xreg)                                                       \
1427             fprintf (FILE, "(%s,%s)",                                   \
1428                     reg_names[REGNO (xreg)], reg_names[REGNO (breg)]);  \
1429         else                                                            \
1430           fprintf (FILE, "(%s)", reg_names[REGNO (breg)]);              \
1431         break;                                                          \
1432       default:                                                          \
1433         mvs_page_lit += 4;                                              \
1434         if (SYMBOL_REF_FLAG (ADDR)) fprintf (FILE, "=V(");              \
1435         else                        fprintf (FILE, "=A(");              \
1436         output_addr_const (FILE, ADDR);                                 \
1437         fprintf (FILE, ")");                                            \
1438         break;                                                          \
1439     }                                                                   \
1440 }