Added arg to RETURN_POPS_ARGS.
[platform/upstream/gcc.git] / gcc / config / ns32k / ns32k.h
1 /* Definitions of target machine for GNU compiler.  NS32000 version.
2    Copyright (C) 1988, 1993, 1994, 1995 Free Software Foundation, Inc.
3    Contributed by Michael Tiemann (tiemann@cygnus.com)
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
20
21
22 /* Note that some other tm.h files include this one and then override
23    many of the definitions that relate to assembler syntax.  */
24
25 extern enum reg_class secondary_reload_class();
26
27 /* Names to predefine in the preprocessor for this target machine.  */
28
29 #define CPP_PREDEFINES "-Dns32000 -Dunix -Asystem(unix) -Acpu(ns32k) -Amachine(ns32k)"
30
31 /* Print subsidiary information on the compiler version in use.  */
32 #define TARGET_VERSION fprintf (stderr, " (32000, GAS syntax)");
33
34 \f
35 /* ABSOLUTE PREFIX, IMMEDIATE_PREFIX and EXTERNAL_PREFIX can be defined
36    to cover most NS32k addressing syntax variations.  This way we don't
37    need to redefine long macros in all the tm.h files for just slight
38    variations in assembler syntax. */
39
40 #ifndef ABSOLUTE_PREFIX
41 #define ABSOLUTE_PREFIX '@'
42 #endif
43
44 #if defined(IMMEDIATE_PREFIX) && IMMEDIATE_PREFIX
45 #define PUT_IMMEDIATE_PREFIX(FILE) putc(IMMEDIATE_PREFIX, FILE)
46 #else
47 #define PUT_IMMEDIATE_PREFIX(FILE)
48 #endif
49 #if defined(ABSOLUTE_PREFIX) && ABSOLUTE_PREFIX
50 #define PUT_ABSOLUTE_PREFIX(FILE) putc(ABSOLUTE_PREFIX, FILE)
51 #else
52 #define PUT_ABSOLUTE_PREFIX(FILE)
53 #endif
54 #if defined(EXTERNAL_PREFIX) && EXTERNAL_PREFIX
55 #define PUT_EXTERNAL_PREFIX(FILE) putc(EXTERNAL_PREFIX, FILE)
56 #else
57 #define PUT_EXTERNAL_PREFIX(FILE)
58 #endif
59
60 /* Run-time compilation parameters selecting different hardware subsets.  */
61
62 extern int target_flags;
63
64 /* Macros used in the machine description to test the flags.  */
65
66 /* Compile 32081 insns for floating point (not library calls). */
67 #define TARGET_32081 (target_flags & 1)
68
69 /* Compile using rtd insn calling sequence.
70    This will not work unless you use prototypes at least
71    for all functions that can take varying numbers of args.  */
72 #define TARGET_RTD (target_flags & 2)
73
74 /* Compile passing first two args in regs 0 and 1.  */
75 #define TARGET_REGPARM (target_flags & 4)
76
77 /* Options to select type of CPU, for better optimization.
78    The output is correct for any kind of 32000 regardless of these options.  */
79 #define TARGET_32532 (target_flags & 8)
80 #define TARGET_32332 (target_flags & 16)
81
82 /* Ok to use the static base register (and presume it's 0) */
83 #define TARGET_SB    ((target_flags & 32) == 0)
84 #define TARGET_HIMEM (target_flags & 128)
85
86 /* Compile using bitfield insns.  */
87 #define TARGET_BITFIELD ((target_flags & 64) == 0)
88
89 /* Macro to define tables used to set the flags.
90    This is a list in braces of pairs in braces,
91    each pair being { "NAME", VALUE }
92    where VALUE is the bits to set or minus the bits to clear.
93    An empty string NAME is used to identify the default VALUE.  */
94
95 #define TARGET_SWITCHES  \
96   { { "32081", 1},                              \
97     { "soft-float", -1},                        \
98     { "rtd", 2},                                \
99     { "nortd", -2},                             \
100     { "regparm", 4},                            \
101     { "noregparm", -4},                         \
102     { "32532", 24},                             \
103     { "32332", -8},                             \
104     { "32332", 16},                             \
105     { "32032", -24},                            \
106     { "sb", -32},                               \
107     { "nosb", 32},                              \
108     { "bitfield", -64},                         \
109     { "nobitfield", 64},                        \
110     { "himem", 128},                            \
111     { "nohimem", -128},                         \
112     { "", TARGET_DEFAULT}}
113 /* TARGET_DEFAULT is defined in encore.h, pc532.h, etc.  */
114
115 /* When we are generating PIC, the sb is used as a pointer
116    to the GOT.  */
117
118 #define OVERRIDE_OPTIONS                \
119 {                                       \
120   if (flag_pic || TARGET_HIMEM) target_flags |= 32;     \
121 }
122
123 \f
124 /* target machine storage layout */
125
126 /* Define this if most significant bit is lowest numbered
127    in instructions that operate on numbered bit-fields.
128    This is not true on the ns32k.  */
129 #define BITS_BIG_ENDIAN 0
130
131 /* Define this if most significant byte of a word is the lowest numbered.  */
132 /* That is not true on the ns32k.  */
133 #define BYTES_BIG_ENDIAN 0
134
135 /* Define this if most significant word of a multiword number is lowest
136    numbered. This is not true on the ns32k.  */
137 #define WORDS_BIG_ENDIAN 0
138
139 /* Number of bits in an addressable storage unit */
140 #define BITS_PER_UNIT 8
141
142 /* Width in bits of a "word", which is the contents of a machine register.
143    Note that this is not necessarily the width of data type `int';
144    if using 16-bit ints on a 32000, this would still be 32.
145    But on a machine with 16-bit registers, this would be 16.  */
146 #define BITS_PER_WORD 32
147
148 /* Width of a word, in units (bytes).  */
149 #define UNITS_PER_WORD 4
150
151 /* Width in bits of a pointer.
152    See also the macro `Pmode' defined below.  */
153 #define POINTER_SIZE 32
154
155 /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
156 #define PARM_BOUNDARY 32
157
158 /* Boundary (in *bits*) on which stack pointer should be aligned.  */
159 #define STACK_BOUNDARY 32
160
161 /* Allocation boundary (in *bits*) for the code of a function.  */
162 #define FUNCTION_BOUNDARY 16
163
164 /* Alignment of field after `int : 0' in a structure.  */
165 #define EMPTY_FIELD_BOUNDARY 32
166
167 /* Every structure's size must be a multiple of this.  */
168 #define STRUCTURE_SIZE_BOUNDARY 8
169
170 /* No data type wants to be aligned rounder than this.  */
171 #define BIGGEST_ALIGNMENT 32
172
173 /* Set this nonzero if move instructions will actually fail to work
174    when given unaligned data.  National claims that the NS32032
175    works without strict alignment, but rumor has it that operands
176    crossing a page boundary cause unpredictable results.  */
177 #define STRICT_ALIGNMENT 1
178
179 /* If bit field type is int, dont let it cross an int,
180    and give entire struct the alignment of an int.  */
181 /* Required on the 386 since it doesn't have a full set of bitfield insns.
182    (There is no signed extv insn.)  */
183 #define PCC_BITFIELD_TYPE_MATTERS 1
184 \f
185 /* Standard register usage.  */
186
187 /* Number of actual hardware registers.
188    The hardware registers are assigned numbers for the compiler
189    from 0 to just below FIRST_PSEUDO_REGISTER.
190    All registers that the compiler knows about must be given numbers,
191    even those that are not normally considered general registers.  */
192 #define FIRST_PSEUDO_REGISTER 18
193
194 /* 1 for registers that have pervasive standard uses
195    and are not available for the register allocator.
196    On the ns32k, these are the FP, SP, (SB and PC are not included here).  */
197 #define FIXED_REGISTERS {0, 0, 0, 0, 0, 0, 0, 0, \
198                          0, 0, 0, 0, 0, 0, 0, 0, \
199                          1, 1}
200
201 /* 1 for registers not available across function calls.
202    These must include the FIXED_REGISTERS and also any
203    registers that can be used without being saved.
204    The latter must include the registers where values are returned
205    and the register where structure-value addresses are passed.
206    Aside from that, you can include as many other registers as you like.  */
207 #define CALL_USED_REGISTERS {1, 1, 1, 0, 0, 0, 0, 0, \
208                              1, 1, 1, 1, 0, 0, 0, 0, \
209                              1, 1}
210
211 /* Return number of consecutive hard regs needed starting at reg REGNO
212    to hold something of mode MODE.
213    This is ordinarily the length in words of a value of mode MODE
214    but can be less for certain modes in special long registers.
215    On the ns32k, all registers are 32 bits long.  */
216 #define HARD_REGNO_NREGS(REGNO, MODE)   \
217  ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
218
219 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
220 #define HARD_REGNO_MODE_OK(REGNO, MODE) hard_regno_mode_ok (REGNO, MODE)
221
222 /* Value is 1 if it is a good idea to tie two pseudo registers
223    when one has mode MODE1 and one has mode MODE2.
224    If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
225    for any hard reg, then this must be 0 for correct output.  */
226 #define MODES_TIEABLE_P(MODE1, MODE2) \
227   (((MODE1) == DFmode || (MODE1) == DCmode || (MODE1) == DImode) ==     \
228    ((MODE2) == DFmode || (MODE2) == DCmode || (MODE2) == DImode))
229
230 /* Specify the registers used for certain standard purposes.
231    The values of these macros are register numbers.  */
232
233 /* NS32000 pc is not overloaded on a register.  */
234 /* #define PC_REGNUM */
235
236 /* Register to use for pushing function arguments. */
237 #define STACK_POINTER_REGNUM 17
238
239 /* Base register for access to local variables of the function. */
240 #define FRAME_POINTER_REGNUM 16
241
242 /* Value should be nonzero if functions must have frame pointers.
243    Zero means the frame pointer need not be set up (and parms
244    may be accessed via the stack pointer) in functions that seem suitable.
245    This is computed in `reload', in reload1.c.  */
246 #define FRAME_POINTER_REQUIRED 0
247
248 /* Base register for access to arguments of the function.  */
249 #define ARG_POINTER_REGNUM 16
250
251 /* Register in which static-chain is passed to a function.  */
252 #define STATIC_CHAIN_REGNUM 1
253
254 /* Register in which address to store a structure value
255    is passed to a function.  */
256 #define STRUCT_VALUE_REGNUM 2
257 \f
258 /* Define the classes of registers for register constraints in the
259    machine description.  Also define ranges of constants.
260
261    One of the classes must always be named ALL_REGS and include all hard regs.
262    If there is more than one class, another class must be named NO_REGS
263    and contain no registers.
264
265    The name GENERAL_REGS must be the name of a class (or an alias for
266    another name such as ALL_REGS).  This is the class of registers
267    that is allowed by "g" or "r" in a register constraint.
268    Also, registers outside this class are allocated only when
269    instructions express preferences for them.
270
271    The classes must be numbered in nondecreasing order; that is,
272    a larger-numbered class must never be contained completely
273    in a smaller-numbered class.
274
275    For any two classes, it is very desirable that there be another
276    class that represents their union.  */
277    
278 enum reg_class { NO_REGS, GENERAL_REGS, FLOAT_REGS, GEN_AND_FP_REGS,
279                  FRAME_POINTER_REG, STACK_POINTER_REG, 
280                  GEN_AND_MEM_REGS, ALL_REGS, LIM_REG_CLASSES };
281
282 #define N_REG_CLASSES (int) LIM_REG_CLASSES
283
284 /* Give names of register classes as strings for dump file.   */
285
286 #define REG_CLASS_NAMES \
287  {"NO_REGS", "GENERAL_REGS", "FLOAT_REGS", "GEN_AND_FP_REGS",  \
288   "FRAME_POINTER_REG", "STACK_POINTER_REG", "GEN_AND_MEM_REGS", "ALL_REGS" }
289
290 /* Define which registers fit in which classes.
291    This is an initializer for a vector of HARD_REG_SET
292    of length N_REG_CLASSES.  */
293
294 #define REG_CLASS_CONTENTS {0, 0x00ff, 0xff00, 0xffff, \
295                             0x10000, 0x20000, 0x300ff, 0x3ffff }
296
297 /* The same information, inverted:
298    Return the class number of the smallest class containing
299    reg number REGNO.  This could be a conditional expression
300    or could index an array.  */
301
302 #define REGNO_REG_CLASS(REGNO) \
303   ((REGNO) < 8 ? GENERAL_REGS          \
304    : (REGNO) < 16 ? FLOAT_REGS         \
305    : (REGNO) == 16 ? FRAME_POINTER_REG \
306    : (REGNO) == 17 ? STACK_POINTER_REG \
307    : NO_REGS)
308
309 /* The class value for index registers, and the one for base regs.  */
310
311 #define INDEX_REG_CLASS GENERAL_REGS
312 #define BASE_REG_CLASS  GEN_AND_MEM_REGS
313
314 /* Get reg_class from a letter such as appears in the machine description.  */
315
316 #define REG_CLASS_FROM_LETTER(C)        \
317  ((C) == 'f' ? FLOAT_REGS               \
318   : (C) == 'x' ? FRAME_POINTER_REG      \
319   : (C) == 'y' ? STACK_POINTER_REG      \
320   : NO_REGS)
321
322 /* The letters I, J, K, L and M in a register constraint string
323    can be used to stand for particular ranges of immediate operands.
324    This macro defines what the ranges are.
325    C is the letter, and VALUE is a constant value.
326    Return 1 if VALUE is in the range specified by C.
327
328    On the ns32k, these letters are used as follows:
329
330    I : Matches integers which are valid shift amounts for scaled indexing.
331        These are 0, 1, 2, 3 for byte, word, double, and quadword.
332        Used for matching arithmetic shifts only on 32032 & 32332.
333    J : Matches integers which fit a "quick" operand.
334    K : Matches integers 0 to 7 (for inss and exts instructions).
335   */
336
337 #define CONST_OK_FOR_LETTER_P(VALUE, C)  \
338   ((VALUE) < 8 && (VALUE) + 8 >= 0 ?            \
339    ((C) == 'I' ? (!TARGET_32532 && 0 <= (VALUE) && (VALUE) <= 3) : \
340     (C) == 'J' ? (VALUE) <= 7 :                 \
341     (C) == 'K' ? 0 <= (VALUE) : 0) : 0)
342
343 /* Similar, but for floating constants, and defining letters G and H.
344    Here VALUE is the CONST_DOUBLE rtx itself.  */
345
346 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1
347
348 /* Given an rtx X being reloaded into a reg required to be
349    in class CLASS, return the class of reg to actually use.
350    In general this is just CLASS; but on some machines
351    in some cases it is preferable to use a more restrictive class.  */
352
353 /* We return GENERAL_REGS instead of GEN_AND_MEM_REGS.
354    The latter offers no real additional possibilities
355    and can cause spurious secondary reloading.  */ 
356 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
357  ((CLASS) == GEN_AND_MEM_REGS ? GENERAL_REGS : (CLASS))
358
359 /* Return the maximum number of consecutive registers
360    needed to represent mode MODE in a register of class CLASS.  */
361 /* On the 32000, this is the size of MODE in words */
362 #define CLASS_MAX_NREGS(CLASS, MODE) \
363   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
364 \f
365 /* Stack layout; function entry, exit and calling.  */
366
367 /* Define this if pushing a word on the stack
368    makes the stack pointer a smaller address.  */
369 #define STACK_GROWS_DOWNWARD
370
371 /* Define this if the nominal address of the stack frame
372    is at the high-address end of the local variables;
373    that is, each additional local variable allocated
374    goes at a more negative offset in the frame.  */
375 #define FRAME_GROWS_DOWNWARD
376
377 /* Offset within stack frame to start allocating local variables at.
378    If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
379    first local allocated.  Otherwise, it is the offset to the BEGINNING
380    of the first local allocated.  */
381 #define STARTING_FRAME_OFFSET 0
382
383 /* If we generate an insn to push BYTES bytes,
384    this says how many the stack pointer really advances by.
385    On the 32000, sp@- in a byte insn really pushes a BYTE.  */
386 #define PUSH_ROUNDING(BYTES) (BYTES)
387
388 /* Offset of first parameter from the argument pointer register value.  */
389 #define FIRST_PARM_OFFSET(FNDECL) 8
390
391 /* Value is the number of byte of arguments automatically
392    popped when returning from a subroutine call.
393    FUNDECL is the declaration node of the function (as a tree),
394    FUNTYPE is the data type of the function (as a tree),
395    or for a library call it is an identifier node for the subroutine name.
396    SIZE is the number of bytes of arguments passed on the stack.
397
398    On the 32000, the RET insn may be used to pop them if the number
399      of args is fixed, but if the number is variable then the caller
400      must pop them all.  RET can't be used for library calls now
401      because the library is compiled with the Unix compiler.
402    Use of RET is a selectable option, since it is incompatible with
403    standard Unix calling sequences.  If the option is not selected,
404    the caller must always pop the args.  */
405
406 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE)   \
407   ((TARGET_RTD && TREE_CODE (FUNTYPE) != IDENTIFIER_NODE        \
408     && (TYPE_ARG_TYPES (FUNTYPE) == 0                           \
409         || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE)))   \
410             == void_type_node)))                                \
411    ? (SIZE) : 0)
412
413 /* Define how to find the value returned by a function.
414    VALTYPE is the data type of the value (as a tree).
415    If the precise function being called is known, FUNC is its FUNCTION_DECL;
416    otherwise, FUNC is 0.  */
417
418 /* On the 32000 the return value is in R0,
419    or perhaps in F0 is there is fp support.  */   
420
421 #define FUNCTION_VALUE(VALTYPE, FUNC)  \
422   (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_32081 \
423    ? gen_rtx (REG, TYPE_MODE (VALTYPE), 8) \
424    : gen_rtx (REG, TYPE_MODE (VALTYPE), 0))
425
426 /* Define how to find the value returned by a library function
427    assuming the value has mode MODE.  */
428
429 /* On the 32000 the return value is in R0,
430    or perhaps F0 is there is fp support.  */   
431
432 #define LIBCALL_VALUE(MODE)  \
433   (((MODE) == DFmode || (MODE) == SFmode) && TARGET_32081 \
434    ? gen_rtx (REG, MODE, 8) \
435    : gen_rtx (REG, MODE, 0))
436
437 /* Define this if PCC uses the nonreentrant convention for returning
438    structure and union values.  */
439
440 #define PCC_STATIC_STRUCT_RETURN
441
442 /* 1 if N is a possible register number for a function value.
443    On the 32000, R0 and F0 are the only registers thus used.  */
444
445 #define FUNCTION_VALUE_REGNO_P(N) (((N) & ~8) == 0)
446
447 /* 1 if N is a possible register number for function argument passing.
448    On the 32000, no registers are used in this way.  */
449
450 #define FUNCTION_ARG_REGNO_P(N) 0
451 \f
452 /* Define a data type for recording info about an argument list
453    during the scan of that argument list.  This data type should
454    hold all necessary information about the function itself
455    and about the args processed so far, enough to enable macros
456    such as FUNCTION_ARG to determine where the next arg should go.
457
458    On the ns32k, this is a single integer, which is a number of bytes
459    of arguments scanned so far.  */
460
461 #define CUMULATIVE_ARGS int
462
463 /* Initialize a variable CUM of type CUMULATIVE_ARGS
464    for a call to a function whose data type is FNTYPE.
465    For a library call, FNTYPE is 0.
466
467    On the ns32k, the offset starts at 0.  */
468
469 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME)        \
470  ((CUM) = 0)
471
472 /* Update the data in CUM to advance over an argument
473    of mode MODE and data type TYPE.
474    (TYPE is null for libcalls where that information may not be available.)  */
475
476 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)    \
477  ((CUM) += ((MODE) != BLKmode                   \
478             ? (GET_MODE_SIZE (MODE) + 3) & ~3   \
479             : (int_size_in_bytes (TYPE) + 3) & ~3))
480
481 /* Define where to put the arguments to a function.
482    Value is zero to push the argument on the stack,
483    or a hard register in which to store the argument.
484
485    MODE is the argument's machine mode.
486    TYPE is the data type of the argument (as a tree).
487     This is null for libcalls where that information may
488     not be available.
489    CUM is a variable of type CUMULATIVE_ARGS which gives info about
490     the preceding args and about the function being called.
491    NAMED is nonzero if this argument is a named parameter
492     (otherwise it is an extra parameter matching an ellipsis).  */
493
494 /* On the 32000 all args are pushed, except if -mregparm is specified
495    then the first two words of arguments are passed in r0, r1.
496    *NOTE* -mregparm does not work.
497    It exists only to test register calling conventions.  */
498
499 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
500 ((TARGET_REGPARM && (CUM) < 8) ? gen_rtx (REG, (MODE), (CUM) / 4) : 0)
501
502 /* For an arg passed partly in registers and partly in memory,
503    this is the number of registers used.
504    For args passed entirely in registers or entirely in memory, zero.  */
505
506 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED)      \
507 ((TARGET_REGPARM && (CUM) < 8                                   \
508   && 8 < ((CUM) + ((MODE) == BLKmode                            \
509                       ? int_size_in_bytes (TYPE)                \
510                       : GET_MODE_SIZE (MODE))))                 \
511  ? 2 - (CUM) / 4 : 0)
512
513 #ifndef MAIN_FUNCTION_PROLOGUE
514 #define MAIN_FUNCTION_PROLOGUE
515 #endif
516
517 /*
518  * The function prologue for the ns32k is fairly simple.
519  * If a frame pointer is needed (decided in reload.c ?) then
520  * we need assembler of the form
521  *
522  *  # Save the oldframe pointer, set the new frame pointer, make space
523  *  # on the stack and save any general purpose registers necessary
524  *
525  *  enter [<general purpose regs to save>], <local stack space>
526  *
527  *  movf  fn, tos    # Save any floating point registers necessary
528  *  .
529  *  .
530  *
531  * If a frame pointer is not needed we need assembler of the form
532  *
533  *  # Make space on the stack
534  *
535  *  adjspd <local stack space + 4>
536  *
537  *  # Save any general purpose registers necessary
538  *
539  *  save [<general purpose regs to save>]
540  *
541  *  movf  fn, tos    # Save any floating point registers necessary
542  *  .
543  *  .
544  */
545 #if defined(IMMEDIATE_PREFIX) && IMMEDIATE_PREFIX
546 #define ADJSP(FILE, n) \
547         fprintf (FILE, "\tadjspd %c%d\n", IMMEDIATE_PREFIX, (n))
548 #else
549 #define ADJSP(FILE, n) \
550         fprintf (FILE, "\tadjspd %d\n", (n))
551 #endif
552
553 #define FUNCTION_PROLOGUE(FILE, SIZE)     \
554 { register int regno, g_regs_used = 0;                          \
555   int used_regs_buf[8], *bufp = used_regs_buf;                  \
556   int used_fregs_buf[8], *fbufp = used_fregs_buf;               \
557   extern char call_used_regs[];                                 \
558   extern int current_function_uses_pic_offset_table, flag_pic;  \
559   MAIN_FUNCTION_PROLOGUE;                                       \
560   for (regno = 0; regno < 8; regno++)                           \
561     if (regs_ever_live[regno]                                   \
562         && ! call_used_regs[regno])                             \
563       {                                                         \
564         *bufp++ = regno; g_regs_used++;                         \
565       }                                                         \
566   *bufp = -1;                                                   \
567   for (; regno < 16; regno++)                                   \
568     if (regs_ever_live[regno] && !call_used_regs[regno])        \
569       {                                                         \
570         *fbufp++ = regno;                                       \
571       }                                                         \
572   *fbufp = -1;                                                  \
573   bufp = used_regs_buf;                                         \
574   if (frame_pointer_needed)                                     \
575     fprintf (FILE, "\tenter [");                                \
576   else                                                          \
577     {                                                           \
578       if (SIZE)                                                 \
579         ADJSP (FILE, SIZE + 4);                                 \
580       if (g_regs_used && g_regs_used > 4)                       \
581         fprintf (FILE, "\tsave [");                             \
582       else                                                      \
583         {                                                       \
584           while (*bufp >= 0)                                    \
585             fprintf (FILE, "\tmovd r%d,tos\n", *bufp++);        \
586           g_regs_used = 0;                                      \
587         }                                                       \
588     }                                                           \
589   while (*bufp >= 0)                                            \
590     {                                                           \
591       fprintf (FILE, "r%d", *bufp++);                           \
592       if (*bufp >= 0)                                           \
593         fputc (',', FILE);                                      \
594     }                                                           \
595   if (frame_pointer_needed)                                     \
596     fprintf (FILE, "],%d\n", SIZE);                             \
597   else if (g_regs_used)                                         \
598     fprintf (FILE, "]\n");                                      \
599   fbufp = used_fregs_buf;                                       \
600   while (*fbufp >= 0)                                           \
601     {                                                           \
602       if ((*fbufp & 1) || (fbufp[0] != fbufp[1] - 1))           \
603         fprintf (FILE, "\tmovf f%d,tos\n", *fbufp++ - 8);       \
604       else                                                      \
605         {                                                       \
606           fprintf (FILE, "\tmovl f%d,tos\n", fbufp[0] - 8);     \
607           fbufp += 2;                                           \
608         }                                                       \
609     }                                                           \
610   if (flag_pic && current_function_uses_pic_offset_table)       \
611     {                                                           \
612       fprintf (FILE, "\tsprd sb,tos\n");                        \
613       if (TARGET_REGPARM)                                       \
614         {                                                       \
615           fprintf (FILE, "\taddr __GLOBAL_OFFSET_TABLE_(pc),tos\n"); \
616           fprintf (FILE, "\tlprd sb,tos\n");                    \
617         }                                                       \
618       else                                                      \
619         {                                                       \
620           fprintf (FILE, "\taddr __GLOBAL_OFFSET_TABLE_(pc),r0\n"); \
621           fprintf (FILE, "\tlprd sb,r0\n");                     \
622         }                                                       \
623     }                                                           \
624 }
625
626 /* Output assembler code to FILE to increment profiler label # LABELNO
627    for profiling a function entry.
628
629    THIS DEFINITION FOR THE 32000 IS A GUESS.  IT HAS NOT BEEN TESTED.  */
630
631 #define FUNCTION_PROFILER(FILE, LABELNO)  \
632    fprintf (FILE, "\taddr LP%d,r0\n\tbsr mcount\n", (LABELNO))
633
634 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
635    the stack pointer does not matter.  The value is tested only in
636    functions that have frame pointers.
637    No definition is equivalent to always zero.
638
639    We use 0, because using 1 requires hair in FUNCTION_EPILOGUE
640    that is worse than the stack adjust we could save.  */
641
642 /* #define EXIT_IGNORE_STACK 1 */
643
644 /* This macro generates the assembly code for function exit,
645    on machines that need it.  If FUNCTION_EPILOGUE is not defined
646    then individual return instructions are generated for each
647    return statement.  Args are same as for FUNCTION_PROLOGUE.
648
649    The function epilogue should not depend on the current stack pointer,
650    if EXIT_IGNORE_STACK is nonzero.  That doesn't apply here.
651
652    If a frame pointer is needed (decided in reload.c ?) then
653    we need assembler of the form
654
655     movf  tos, fn       # Restore any saved floating point registers
656     .
657     .
658
659     # Restore any saved general purpose registers, restore the stack
660     # pointer from the frame pointer, restore the old frame pointer.
661     exit [<general purpose regs to save>]
662
663    If a frame pointer is not needed we need assembler of the form
664     # Restore any general purpose registers saved
665
666     movf  tos, fn       # Restore any saved floating point registers
667     .
668     .
669     .
670     restore [<general purpose regs to save>]
671
672     # reclaim space allocated on stack
673
674     adjspd <-(local stack space + 4)> */
675
676
677 #define FUNCTION_EPILOGUE(FILE, SIZE) \
678 { register int regno, g_regs_used = 0, f_regs_used = 0;         \
679   int used_regs_buf[8], *bufp = used_regs_buf;                  \
680   int used_fregs_buf[8], *fbufp = used_fregs_buf;               \
681   extern char call_used_regs[];                                 \
682   extern int current_function_uses_pic_offset_table, flag_pic;  \
683   if (flag_pic && current_function_uses_pic_offset_table)       \
684     fprintf (FILE, "\tlprd sb,tos\n");                          \
685   *fbufp++ = -2;                                                \
686   for (regno = 8; regno < 16; regno++)                          \
687     if (regs_ever_live[regno] && !call_used_regs[regno])        \
688       {                                                         \
689        *fbufp++ = regno; f_regs_used++;                         \
690       }                                                         \
691   fbufp--;                                                      \
692   for (regno = 0; regno < 8; regno++)                           \
693     if (regs_ever_live[regno]                                   \
694         && ! call_used_regs[regno])                             \
695       {                                                         \
696         *bufp++ = regno; g_regs_used++;                         \
697       }                                                         \
698   while (fbufp > used_fregs_buf)                                \
699     {                                                           \
700       if ((*fbufp & 1) && fbufp[0] == fbufp[-1] + 1)            \
701         {                                                       \
702           fprintf (FILE, "\tmovl tos,f%d\n", fbufp[-1] - 8);    \
703           fbufp -= 2;                                           \
704         }                                                       \
705       else fprintf (FILE, "\tmovf tos,f%d\n", *fbufp-- - 8);    \
706     }                                                           \
707   if (frame_pointer_needed)                                     \
708     fprintf (FILE, "\texit [");                                 \
709   else                                                          \
710     {                                                           \
711       if (g_regs_used && g_regs_used > 4)                       \
712         fprintf (FILE, "\trestore [");                          \
713       else                                                      \
714         {                                                       \
715           while (bufp > used_regs_buf)                          \
716             fprintf (FILE, "\tmovd tos,r%d\n", *--bufp);        \
717           g_regs_used = 0;                                      \
718         }                                                       \
719     }                                                           \
720   while (bufp > used_regs_buf)                                  \
721     {                                                           \
722       fprintf (FILE, "r%d", *--bufp);                           \
723       if (bufp > used_regs_buf)                                 \
724         fputc (',', FILE);                                      \
725     }                                                           \
726   if (g_regs_used || frame_pointer_needed)                      \
727     fprintf (FILE, "]\n");                                      \
728   if (SIZE && !frame_pointer_needed)                            \
729     ADJSP (FILE, -(SIZE + 4));                                  \
730   if (current_function_pops_args)                               \
731     fprintf (FILE, "\tret %d\n", current_function_pops_args);   \
732   else fprintf (FILE, "\tret 0\n"); }
733
734 /* Store in the variable DEPTH the initial difference between the
735    frame pointer reg contents and the stack pointer reg contents,
736    as of the start of the function body.  This depends on the layout
737    of the fixed parts of the stack frame and on how registers are saved.  */
738
739 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH)                     \
740 {                                                               \
741   int regno;                                                    \
742   int offset = -4;                                              \
743   extern int current_function_uses_pic_offset_table, flag_pic;  \
744   for (regno = 0; regno < 16; regno++)                          \
745     if (regs_ever_live[regno] && ! call_used_regs[regno])       \
746       offset += 4;                                              \
747   if (flag_pic && current_function_uses_pic_offset_table)       \
748     offset += 4;                                                \
749   (DEPTH) = (offset + get_frame_size ()                         \
750              + (get_frame_size () == 0 ? 0 : 4));               \
751 }
752 \f
753
754 /* Output assembler code for a block containing the constant parts
755    of a trampoline, leaving space for the variable parts.  */
756
757 /* On the 32k, the trampoline looks like this:
758      addr  .,r2
759      jump  @__trampoline
760      .int STATIC
761      .int FUNCTION
762 Doing trampolines with a library assist function is easier than figuring
763 out how to do stores to memory in reverse byte order (the way immediate
764 operands on the 32k are stored).  */
765
766 #define TRAMPOLINE_TEMPLATE(FILE)                                       \
767 {                                                                       \
768   fprintf (FILE, "\taddr .,r2\n" );                                     \
769   fprintf (FILE, "\tjump " );                                           \
770   PUT_ABSOLUTE_PREFIX (FILE);                                           \
771   fprintf (FILE, "__trampoline\n" );                                    \
772   ASM_OUTPUT_INT (FILE, const0_rtx);                                    \
773   ASM_OUTPUT_INT (FILE, const0_rtx);                                    \
774 }
775
776 /* Length in units of the trampoline for entering a nested function.  */
777
778 #define TRAMPOLINE_SIZE 20
779
780 /* Emit RTL insns to initialize the variable parts of a trampoline.
781    FNADDR is an RTX for the address of the function's pure code.
782    CXT is an RTX for the static chain value for the function.  */
783
784 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT)                            \
785 {                                                                            \
786   emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 12)), CXT);    \
787   emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 16)), FNADDR); \
788 }
789
790 /* This is the library routine that is used
791    to transfer control from the trampoline
792    to the actual nested function.  */
793
794 /* The function name __transfer_from_trampoline is not actually used.
795    The function definition just permits use of "asm with operands"
796    (though the operand list is empty).  */
797 #define TRANSFER_FROM_TRAMPOLINE        \
798 void                                    \
799 __transfer_from_trampoline ()           \
800 {                                       \
801   asm ("___trampoline:");               \
802   asm ("movd 16(r2),tos");              \
803   asm ("movd 12(r2),r2");               \
804   asm ("ret 0");                        \
805 }
806 \f
807 /* Addressing modes, and classification of registers for them.  */
808
809 /* #define HAVE_POST_INCREMENT */
810 /* #define HAVE_POST_DECREMENT */
811
812 /* #define HAVE_PRE_DECREMENT */
813 /* #define HAVE_PRE_INCREMENT */
814
815 /* Macros to check register numbers against specific register classes.  */
816
817 /* These assume that REGNO is a hard or pseudo reg number.
818    They give nonzero only if REGNO is a hard reg of the suitable class
819    or a pseudo reg currently allocated to a suitable hard reg.
820    Since they use reg_renumber, they are safe only once reg_renumber
821    has been allocated, which happens in local-alloc.c.  */
822
823 /* note that FP and SP cannot be used as an index. What about PC? */
824 #define REGNO_OK_FOR_INDEX_P(REGNO)  \
825 ((REGNO) < 8 || (unsigned)reg_renumber[REGNO] < 8)
826 #define REGNO_OK_FOR_BASE_P(REGNO)   \
827 ((REGNO) < 8 || (unsigned)reg_renumber[REGNO] < 8 \
828  || (REGNO) == FRAME_POINTER_REGNUM || (REGNO) == STACK_POINTER_REGNUM)
829
830 #define FP_REG_P(X)  (GET_CODE (X) == REG && REGNO (X) > 7 && REGNO (X) < 16)
831 \f
832 /* Maximum number of registers that can appear in a valid memory address.  */
833
834 #define MAX_REGS_PER_ADDRESS 2
835
836 /* Recognize any constant value that is a valid address.
837    This might not work on future ns32k processors as negative
838    displacements are not officially allowed but a mode reserved
839    to National.  This works on processors up to 32532, though. */
840
841 #define CONSTANT_ADDRESS_P(X)   \
842   (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF              \
843    || GET_CODE (X) == CONST                                             \
844    || (GET_CODE (X) == CONST_INT                                        \
845        && ((unsigned)INTVAL (X) >= 0xe0000000                           \
846            || (unsigned)INTVAL (X) < 0x20000000)))
847
848 #define CONSTANT_ADDRESS_NO_LABEL_P(X)   \
849   (GET_CODE (X) == CONST_INT                                            \
850    && ((unsigned)INTVAL (X) >= 0xe0000000                               \
851        || (unsigned)INTVAL (X) < 0x20000000))
852
853 /* Return the register class of a scratch register needed to copy IN into
854    or out of a register in CLASS in MODE.  If it can be done directly,
855    NO_REGS is returned.  */
856
857 #define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
858   secondary_reload_class (CLASS, MODE, IN)
859
860 /* Nonzero if the constant value X is a legitimate general operand.
861    It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
862
863 #define LEGITIMATE_CONSTANT_P(X) 1
864
865 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
866    and check its validity for a certain class.
867    We have two alternate definitions for each of them.
868    The usual definition accepts all pseudo regs; the other rejects
869    them unless they have been allocated suitable hard regs.
870    The symbol REG_OK_STRICT causes the latter definition to be used.
871
872    Most source files want to accept pseudo regs in the hope that
873    they will get allocated to the class that the insn wants them to be in.
874    Source files for reload pass need to be strict.
875    After reload, it makes no difference, since pseudo regs have
876    been eliminated by then.  */
877
878 #ifndef REG_OK_STRICT
879
880 /* Nonzero if X is a hard reg that can be used as an index
881    or if it is a pseudo reg.  */
882 #define REG_OK_FOR_INDEX_P(X) \
883   (REGNO (X) < 8 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
884 /* Nonzero if X is a hard reg that can be used as a base reg
885    of if it is a pseudo reg.  */
886 #define REG_OK_FOR_BASE_P(X) (REGNO (X) < 8 || REGNO (X) >= FRAME_POINTER_REGNUM)
887 /* Nonzero if X is a floating point reg or a pseudo reg.  */
888
889 #else
890
891 /* Nonzero if X is a hard reg that can be used as an index.  */
892 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
893 /* Nonzero if X is a hard reg that can be used as a base reg.  */
894 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
895
896 #endif
897 \f
898 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
899    that is a valid memory address for an instruction.
900    The MODE argument is the machine mode for the MEM expression
901    that wants to use this address.
902
903    The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS.  */
904
905 /* 1 if X is an address that we could indirect through.  */
906 /***** NOTE ***** There is a bug in the Sequent assembler which fails
907  to fixup addressing information for symbols used as offsets
908  from registers which are not FP or SP (or SB or PC).  This
909  makes _x(fp) valid, while _x(r0) is invalid.  */
910
911 #define INDIRECTABLE_1_ADDRESS_P(X)  \
912   (CONSTANT_ADDRESS_P (X)                                               \
913    || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))                    \
914    || (GET_CODE (X) == PLUS                                             \
915        && GET_CODE (XEXP (X, 0)) == REG                                 \
916        && REG_OK_FOR_BASE_P (XEXP (X, 0))                               \
917        && ((flag_pic || TARGET_HIMEM) ?                                 \
918              CONSTANT_ADDRESS_NO_LABEL_P (XEXP (X, 1))                  \
919            :                                                            \
920              CONSTANT_ADDRESS_P (XEXP (X, 1)))                          \
921        && (GET_CODE (X) != CONST_INT || NS32K_DISPLACEMENT_P (INTVAL (X)))))
922
923 /* 1 if integer I will fit in a 4 byte displacement field.
924    Strictly speaking, we can't be sure that a symbol will fit this range.
925    But, in practice, it always will.  */
926
927 /* idall@eleceng.adelaide.edu.au says that the 32016 and 32032
928    can handle the full range of displacements--it is only the addresses
929    that have a limited range.  So the following was deleted:
930  (((i) <= 16777215 && (i) >= -16777216)
931   || ((TARGET_32532 || TARGET_32332) && ...))  */
932 #define NS32K_DISPLACEMENT_P(i)                                 \
933   ((i) < (1 << 29) && (i) >= - (1 << 29))
934
935 /* Check for frame pointer or stack pointer.  */
936 #define MEM_REG(X) \
937   (GET_CODE (X) == REG && (REGNO (X) ^ 16) < 2)
938
939 /* A memory ref whose address is the FP or SP, with optional integer offset,
940    or (on certain machines) a constant address.  */
941 #define INDIRECTABLE_2_ADDRESS_P(X)  \
942   (GET_CODE (X) == MEM                                                  \
943    && (((xfoo0 = XEXP (X, 0), MEM_REG (xfoo0))                          \
944        || (GET_CODE (xfoo0) == PLUS                                     \
945            && MEM_REG (XEXP (xfoo0, 0))                                 \
946            && CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfoo0, 1))))           \
947        || (TARGET_SB && CONSTANT_ADDRESS_P (xfoo0))))
948
949 /* Go to ADDR if X is a valid address not using indexing.
950    (This much is the easy part.)  */
951 #define GO_IF_NONINDEXED_ADDRESS(X, ADDR)  \
952 { register rtx xfoob = (X);                                             \
953   if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR;                          \
954   if (INDIRECTABLE_2_ADDRESS_P (X)) goto ADDR;                          \
955   if (GET_CODE (X) == PLUS)                                             \
956     if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (X, 1)))                      \
957       if (INDIRECTABLE_2_ADDRESS_P (XEXP (X, 0)))                       \
958         goto ADDR;                                                      \
959 }
960
961 /* Go to ADDR if X is a valid address not using indexing.
962    (This much is the easy part.)  */
963 #define GO_IF_INDEXING(X, MODE, ADDR)  \
964 { register rtx xfoob = (X);                                             \
965   if (GET_CODE (xfoob) == PLUS && INDEX_TERM_P (XEXP (xfoob, 0), MODE)) \
966     GO_IF_INDEXABLE_ADDRESS (XEXP (xfoob, 1), ADDR);                    \
967   if (GET_CODE (xfoob) == PLUS && INDEX_TERM_P (XEXP (xfoob, 1), MODE)) \
968     GO_IF_INDEXABLE_ADDRESS (XEXP (xfoob, 0), ADDR); }                  \
969
970 #define GO_IF_INDEXABLE_ADDRESS(X, ADDR) \
971 { if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) goto ADDR;          \
972   if (INDIRECTABLE_2_ADDRESS_P (X)) goto ADDR;                          \
973   if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR;                          \
974 }
975
976 /* 1 if PROD is either a reg times size of mode MODE
977    or just a reg, if MODE is just one byte. Actually, on the ns32k,
978    since the index mode is independent of the operand size,
979    we can match more stuff...
980
981    This macro's expansion uses the temporary variables xfoo0, xfoo1
982    and xfoo2 that must be declared in the surrounding context.  */
983 #define INDEX_TERM_P(PROD, MODE)   \
984 ((GET_CODE (PROD) == REG && REG_OK_FOR_INDEX_P (PROD))                  \
985  || (GET_CODE (PROD) == MULT                                            \
986      && (xfoo0 = XEXP (PROD, 0), xfoo1 = XEXP (PROD, 1),                \
987          (GET_CODE (xfoo1) == CONST_INT                                 \
988           && GET_CODE (xfoo0) == REG                                    \
989           && FITS_INDEX_RANGE (INTVAL (xfoo1))                          \
990           && REG_OK_FOR_INDEX_P (xfoo0)))))
991
992 #define FITS_INDEX_RANGE(X)  \
993   ((xfoo2 = (unsigned)(X)-1),                                           \
994    ((xfoo2 < 4 && xfoo2 != 2) || xfoo2 == 7))
995
996 /* Note that xfoo0, xfoo1, xfoo2 are used in some of the submacros above.  */
997 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
998 { register rtx xfooy, xfoo0, xfoo1;                                     \
999   unsigned xfoo2;                                                       \
1000   extern int current_function_uses_pic_offset_table, flag_pic;          \
1001   xfooy = X;                                                            \
1002   if (flag_pic && ! current_function_uses_pic_offset_table              \
1003       && global_symbolic_reference_mentioned_p (X, 1))                  \
1004     current_function_uses_pic_offset_table = 1;                         \
1005   GO_IF_NONINDEXED_ADDRESS (xfooy, ADDR);                               \
1006   if (GET_CODE (xfooy) == PLUS)                                         \
1007     {                                                                   \
1008       if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfooy, 1))                 \
1009           && GET_CODE (XEXP (xfooy, 0)) == PLUS)                        \
1010         xfooy = XEXP (xfooy, 0);                                        \
1011       else if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfooy, 0))            \
1012           && GET_CODE (XEXP (xfooy, 1)) == PLUS)                        \
1013         xfooy = XEXP (xfooy, 1);                                        \
1014       GO_IF_INDEXING (xfooy, MODE, ADDR);                               \
1015     }                                                                   \
1016   else if (INDEX_TERM_P (xfooy, MODE))                                  \
1017     goto ADDR;                                                          \
1018   else if (GET_CODE (xfooy) == PRE_DEC)                                 \
1019     if (REGNO (XEXP (xfooy, 0)) == STACK_POINTER_REGNUM) goto ADDR;     \
1020   else abort ();                                                        \
1021 }
1022
1023 /* Try machine-dependent ways of modifying an illegitimate address
1024    to be legitimate.  If we find one, return the new, valid address.
1025    This macro is used in only one place: `memory_address' in explow.c.
1026
1027    OLDX is the address as it was before break_out_memory_refs was called.
1028    In some cases it is useful to look at this to decide what needs to be done.
1029
1030    MODE and WIN are passed so that this macro can use
1031    GO_IF_LEGITIMATE_ADDRESS.
1032
1033    It is always safe for this macro to do nothing.  It exists to recognize
1034    opportunities to optimize the output.
1035
1036    For the ns32k, we do nothing */
1037
1038 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)   {}
1039
1040 /* Nonzero if the constant value X is a legitimate general operand
1041    when generating PIC code.  It is given that flag_pic is on and 
1042    that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
1043
1044 extern int current_function_uses_pic_offset_table, flag_pic;
1045 #define LEGITIMATE_PIC_OPERAND_P(X) \
1046   (((! current_function_uses_pic_offset_table                   \
1047      && global_symbolic_reference_mentioned_p (X, 1))?          \
1048       (current_function_uses_pic_offset_table = 1):0            \
1049    ), 1)
1050
1051 /* Define this macro if references to a symbol must be treated
1052    differently depending on something about the variable or
1053    function named by the symbol (such as what section it is in).
1054
1055    On the ns32k, if using PIC, mark a SYMBOL_REF for a non-global
1056    symbol or a code symbol. These symbols are referenced via pc
1057    and not via sb. */
1058
1059 #define ENCODE_SECTION_INFO(DECL) \
1060 do                                                                      \
1061   {                                                                     \
1062     extern int flag_pic;                                                \
1063     if (flag_pic)                                                       \
1064       {                                                                 \
1065         rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'            \
1066                    ? TREE_CST_RTL (DECL) : DECL_RTL (DECL));            \
1067         SYMBOL_REF_FLAG (XEXP (rtl, 0))                                 \
1068           = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'                  \
1069              || ! TREE_PUBLIC (DECL));                                  \
1070       }                                                                 \
1071   }                                                                     \
1072 while (0)
1073
1074 /* Go to LABEL if ADDR (a legitimate address expression)
1075    has an effect that depends on the machine mode it is used for.
1076    On the ns32k, only predecrement and postincrement address depend thus
1077    (the amount of decrement or increment being the length of the operand).  */
1078
1079 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)        \
1080  { if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC)       \
1081      goto LABEL;}
1082 \f
1083 /* Specify the machine mode that this machine uses
1084    for the index in the tablejump instruction.
1085    HI mode is more efficient but the range is not wide enough for
1086    all programs. */
1087 #define CASE_VECTOR_MODE SImode
1088
1089 /* Define this if the tablejump instruction expects the table
1090    to contain offsets from the address of the table.
1091    Do not define this if the table should contain absolute addresses.  */
1092 #define CASE_VECTOR_PC_RELATIVE
1093
1094 /* Specify the tree operation to be used to convert reals to integers.  */
1095 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1096
1097 /* This is the kind of divide that is easiest to do in the general case.  */
1098 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1099
1100 /* Define this as 1 if `char' should by default be signed; else as 0.  */
1101 #define DEFAULT_SIGNED_CHAR 1
1102
1103 /* Max number of bytes we can move from memory to memory
1104    in one reasonably fast instruction.  */
1105 #define MOVE_MAX 4
1106
1107 /* Define this if zero-extension is slow (more than one real instruction).  */
1108 /* #define SLOW_ZERO_EXTEND */
1109
1110 /* Nonzero if access to memory by bytes is slow and undesirable.  */
1111 #define SLOW_BYTE_ACCESS 0
1112
1113 /* Define if shifts truncate the shift count
1114    which implies one can omit a sign-extension or zero-extension
1115    of a shift count.  */
1116 /* #define SHIFT_COUNT_TRUNCATED */
1117
1118 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1119    is done just by pretending it is already truncated.  */
1120 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1121
1122 /* We assume that the store-condition-codes instructions store 0 for false
1123    and some other value for true.  This is the value stored for true.  */
1124
1125 #define STORE_FLAG_VALUE 1
1126
1127 /* Specify the machine mode that pointers have.
1128    After generation of rtl, the compiler makes no further distinction
1129    between pointers and any other objects of this machine mode.  */
1130 #define Pmode SImode
1131
1132 /* A function address in a call instruction
1133    is a byte address (for indexing purposes)
1134    so give the MEM rtx a byte's mode.  */
1135 #define FUNCTION_MODE QImode
1136
1137 /* Compute the cost of address ADDRESS. */
1138
1139 #define ADDRESS_COST(RTX) calc_address_cost (RTX)
1140
1141 /* Compute the cost of computing a constant rtl expression RTX
1142    whose rtx-code is CODE.  The body of this macro is a portion
1143    of a switch statement.  If the code is computed here,
1144    return it with a return statement.  Otherwise, break from the switch.  */
1145
1146 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1147   case CONST_INT:                                               \
1148     if (INTVAL (RTX) <= 7 && INTVAL (RTX) >= -8) return 0;      \
1149     if (INTVAL (RTX) < 0x2000 && INTVAL (RTX) >= -0x2000)       \
1150       return 1;                                                 \
1151   case CONST:                                                   \
1152   case LABEL_REF:                                               \
1153   case SYMBOL_REF:                                              \
1154     return 3;                                                   \
1155   case CONST_DOUBLE:                                            \
1156     return 5;
1157 \f
1158 /* Tell final.c how to eliminate redundant test instructions.  */
1159
1160 /* Here we define machine-dependent flags and fields in cc_status
1161    (see `conditions.h').  */
1162
1163 /* This bit means that what ought to be in the Z bit
1164    should be tested in the F bit.  */
1165 #define CC_Z_IN_F 04000
1166
1167 /* This bit means that what ought to be in the Z bit
1168    is complemented in the F bit.  */
1169 #define CC_Z_IN_NOT_F 010000
1170
1171 /* Store in cc_status the expressions
1172    that the condition codes will describe
1173    after execution of an instruction whose pattern is EXP.
1174    Do not alter them if the instruction would not alter the cc's.  */
1175
1176 #define NOTICE_UPDATE_CC(EXP, INSN) \
1177 { if (GET_CODE (EXP) == SET)                                    \
1178     { if (GET_CODE (SET_DEST (EXP)) == CC0)                     \
1179         { cc_status.flags = 0;                                  \
1180           cc_status.value1 = SET_DEST (EXP);                    \
1181           cc_status.value2 = SET_SRC (EXP);                     \
1182         }                                                       \
1183       else if (GET_CODE (SET_SRC (EXP)) == CALL)                \
1184         { CC_STATUS_INIT; }                                     \
1185       else if (GET_CODE (SET_DEST (EXP)) == REG)                \
1186         { if (cc_status.value1                                  \
1187               && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value1)) \
1188             cc_status.value1 = 0;                               \
1189           if (cc_status.value2                                  \
1190               && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value2)) \
1191             cc_status.value2 = 0;                               \
1192         }                                                       \
1193       else if (GET_CODE (SET_DEST (EXP)) == MEM)                \
1194         { CC_STATUS_INIT; }                                     \
1195     }                                                           \
1196   else if (GET_CODE (EXP) == PARALLEL                           \
1197            && GET_CODE (XVECEXP (EXP, 0, 0)) == SET)            \
1198     { if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == CC0)     \
1199         { cc_status.flags = 0;                                  \
1200           cc_status.value1 = SET_DEST (XVECEXP (EXP, 0, 0));    \
1201           cc_status.value2 = SET_SRC (XVECEXP (EXP, 0, 0));     \
1202         }                                                       \
1203       else if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == REG) \
1204         { if (cc_status.value1                                  \
1205               && reg_overlap_mentioned_p (SET_DEST (XVECEXP (EXP, 0, 0)), cc_status.value1)) \
1206             cc_status.value1 = 0;                               \
1207           if (cc_status.value2                                  \
1208               && reg_overlap_mentioned_p (SET_DEST (XVECEXP (EXP, 0, 0)), cc_status.value2)) \
1209             cc_status.value2 = 0;                               \
1210         }                                                       \
1211       else if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == MEM) \
1212         { CC_STATUS_INIT; }                                     \
1213     }                                                           \
1214   else if (GET_CODE (EXP) == CALL)                              \
1215     { /* all bets are off */ CC_STATUS_INIT; }                  \
1216   else { /* nothing happens? CC_STATUS_INIT; */}                \
1217   if (cc_status.value1 && GET_CODE (cc_status.value1) == REG    \
1218       && cc_status.value2                                       \
1219       && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2))  \
1220     abort ();                   \
1221 }
1222
1223 /* Describe the costs of the following register moves which are discouraged:
1224    1.) Moves between the Floating point registers and the frame pointer and stack pointer
1225    2.) Moves between the stack pointer and the frame pointer
1226    3.) Moves between the floating point and general registers */
1227
1228 #define REGISTER_MOVE_COST(CLASS1, CLASS2)   \
1229   ((((CLASS1) == FLOAT_REGS && ((CLASS2) == STACK_POINTER_REG || (CLASS2) == FRAME_POINTER_REG))    \
1230    || ((CLASS2) == FLOAT_REGS && ((CLASS1) == STACK_POINTER_REG || (CLASS1) == FRAME_POINTER_REG))  \
1231    || ((CLASS1) == STACK_POINTER_REG && (CLASS2) == FRAME_POINTER_REG)                              \
1232    || ((CLASS2) == STACK_POINTER_REG && (CLASS1) == FRAME_POINTER_REG)                              \
1233    || ((CLASS1) == FLOAT_REGS && (CLASS2) == GENERAL_REGS)                                          \
1234    || ((CLASS1) == GENERAL_REGS && (CLASS2) == FLOAT_REGS))                                         \
1235  ? 4  : 2)
1236
1237 #define OUTPUT_JUMP(NORMAL, NO_OV)  \
1238 { if (cc_status.flags & CC_NO_OVERFLOW)                         \
1239     return NO_OV;                                               \
1240   return NORMAL; }
1241 \f
1242 /* Dividing the output into sections */
1243
1244 /* Output before read-only data.  */
1245
1246 #define TEXT_SECTION_ASM_OP ".text"
1247
1248 /* Output before writable data.  */
1249
1250 #define DATA_SECTION_ASM_OP ".data"
1251
1252 /* Define the output Assembly Language */
1253
1254 /* Output at beginning of assembler file.  */
1255
1256 #define ASM_FILE_START(FILE) fprintf (FILE, "#NO_APP\n");
1257
1258 /* Output to assembler file text saying following lines
1259    may contain character constants, extra white space, comments, etc.  */
1260
1261 #define ASM_APP_ON "#APP\n"
1262
1263 /* Output to assembler file text saying following lines
1264    no longer contain unusual constructs.  */
1265
1266 #define ASM_APP_OFF "#NO_APP\n"
1267
1268 /* Output of Data */
1269
1270 /* This is how to output an assembler line defining a `double' constant.  */
1271
1272 #define ASM_OUTPUT_DOUBLE(FILE,VALUE)  \
1273   fprintf (FILE, "\t.double 0d%.20e\n", (VALUE))
1274
1275 /* This is how to output an assembler line defining a `float' constant.  */
1276
1277 #define ASM_OUTPUT_FLOAT(FILE,VALUE)  \
1278   fprintf (FILE, "\t.float 0f%.20e\n", (VALUE))
1279
1280 /* This is how to output an assembler line defining an `int' constant.  */
1281
1282 #define ASM_OUTPUT_INT(FILE,VALUE)  \
1283 ( fprintf (FILE, "\t.long "),                   \
1284   output_addr_const (FILE, (VALUE)),            \
1285   fprintf (FILE, "\n"))
1286
1287 /* Likewise for `char' and `short' constants.  */
1288
1289 #define ASM_OUTPUT_SHORT(FILE,VALUE)  \
1290 ( fprintf (FILE, "\t.word "),                   \
1291   output_addr_const (FILE, (VALUE)),            \
1292   fprintf (FILE, "\n"))
1293
1294 #define ASM_OUTPUT_CHAR(FILE,VALUE)  \
1295 ( fprintf (FILE, "\t.byte "),                   \
1296   output_addr_const (FILE, (VALUE)),            \
1297   fprintf (FILE, "\n"))
1298
1299 /* This is how to output an assembler line for a numeric constant byte.  */
1300
1301 #define ASM_OUTPUT_BYTE(FILE,VALUE)  \
1302   fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1303
1304 /* This is how to output an assembler line defining an external/static
1305    address which is not in tree format (for collect.c).  */
1306
1307 #define ASM_OUTPUT_LABELREF_AS_INT(STREAM, NAME)                        \
1308 do {                                                                    \
1309   fprintf (STREAM, "\t.long\t");                                        \
1310   ASM_OUTPUT_LABELREF (STREAM, NAME);                                   \
1311   fprintf (STREAM, "\n");                                               \
1312 } while (0)
1313
1314 /* This is how to output an insn to push a register on the stack.
1315    It need not be very fast code.  */
1316
1317 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)  \
1318   fprintf (FILE, "\tmovd %s,tos\n", reg_names[REGNO])
1319
1320 /* This is how to output an insn to pop a register from the stack.
1321    It need not be very fast code.  */
1322
1323 #define ASM_OUTPUT_REG_POP(FILE,REGNO)  \
1324   fprintf (FILE, "\tmovd tos,%s\n", reg_names[REGNO])
1325
1326 /* How to refer to registers in assembler output.
1327    This sequence is indexed by compiler's hard-register-number (see above).  */
1328
1329 #define REGISTER_NAMES \
1330 {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
1331  "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
1332  "fp", "sp"}
1333
1334 /* How to renumber registers for dbx and gdb.
1335    NS32000 may need more change in the numeration.  */
1336
1337 #define DBX_REGISTER_NUMBER(REGNO) ((REGNO < 8) ? (REGNO)+4 : (REGNO))
1338
1339 /* This is how to output the definition of a user-level label named NAME,
1340    such as the label on a static function or variable NAME.  */
1341
1342 #ifndef COLLECT
1343 #define ASM_OUTPUT_LABEL(FILE,NAME)     \
1344   do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1345 #else
1346 #define ASM_OUTPUT_LABEL(STREAM,NAME)                                   \
1347 do {                                                                    \
1348   fprintf (STREAM, "%s:\n", NAME);                                      \
1349 } while (0)
1350 #endif
1351
1352 /* This is how to output a command to make the user-level label named NAME
1353    defined for reference from other files.  */
1354
1355 #ifndef COLLECT
1356 #define ASM_GLOBALIZE_LABEL(FILE,NAME)  \
1357   do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
1358 #else
1359 #define ASM_GLOBALIZE_LABEL(STREAM,NAME)                                \
1360 do {                                                                    \
1361   fprintf (STREAM, "\t.globl\t%s\n", NAME);                             \
1362 } while (0)
1363 #endif
1364
1365 /* This is how to output a reference to a user-level label named NAME.
1366    `assemble_name' uses this.  */
1367
1368 #define ASM_OUTPUT_LABELREF(FILE,NAME)  \
1369   fprintf (FILE, "_%s", NAME)
1370
1371 /* This is how to output an internal numbered label where
1372    PREFIX is the class of label and NUM is the number within the class.  */
1373
1374 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)      \
1375   fprintf (FILE, "%s%d:\n", PREFIX, NUM)
1376
1377 /* This is how to store into the string LABEL
1378    the symbol_ref name of an internal numbered label where
1379    PREFIX is the class of label and NUM is the number within the class.
1380    This is suitable for output with `assemble_name'.  */
1381
1382 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)   \
1383   sprintf (LABEL, "*%s%d", PREFIX, NUM)
1384
1385 /* This is how to align the code that follows an unconditional branch.
1386    Note that 0xa2 is a no-op.  */
1387
1388 #define ASM_OUTPUT_ALIGN_CODE(FILE)     \
1389   fprintf (FILE, "\t.align 2,0xa2\n")
1390
1391 /* This is how to output an element of a case-vector that is absolute.
1392    (The ns32k does not use such vectors,
1393    but we must define this macro anyway.)  */
1394
1395 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
1396   fprintf (FILE, "\t.long L%d\n", VALUE)
1397
1398 /* This is how to output an element of a case-vector that is relative.  */
1399 /* ** Notice that the second element is LI format! */
1400 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL)  \
1401   fprintf (FILE, "\t.long L%d-LI%d\n", VALUE, REL)
1402
1403 /* This is how to output an assembler line
1404    that says to advance the location counter
1405    to a multiple of 2**LOG bytes.  */
1406
1407 #define ASM_OUTPUT_ALIGN(FILE,LOG)  \
1408   fprintf (FILE, "\t.align %d\n", (LOG))
1409
1410 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
1411   fprintf (FILE, "\t.space %u\n", (SIZE))
1412
1413 /* This says how to output an assembler line
1414    to define a global common symbol.  */
1415
1416 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
1417 ( fputs (".comm ", (FILE)),                     \
1418   assemble_name ((FILE), (NAME)),               \
1419   fprintf ((FILE), ",%u\n", (ROUNDED)))
1420
1421 /* This says how to output an assembler line
1422    to define a local common symbol.  */
1423
1424 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
1425 ( fputs (".lcomm ", (FILE)),                    \
1426   assemble_name ((FILE), (NAME)),               \
1427   fprintf ((FILE), ",%u\n", (ROUNDED)))
1428
1429 /* Store in OUTPUT a string (made with alloca) containing
1430    an assembler-name for a local static variable named NAME.
1431    LABELNO is an integer which is different for each call.  */
1432
1433 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)  \
1434 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),    \
1435   sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1436
1437 /* Define the parentheses used to group arithmetic operations
1438    in assembler code.  */
1439
1440 #define ASM_OPEN_PAREN "("
1441 #define ASM_CLOSE_PAREN ")"
1442
1443 /* Define results of standard character escape sequences.  */
1444 #define TARGET_BELL 007
1445 #define TARGET_BS 010
1446 #define TARGET_TAB 011
1447 #define TARGET_NEWLINE 012
1448 #define TARGET_VT 013
1449 #define TARGET_FF 014
1450 #define TARGET_CR 015
1451
1452 /* Print an instruction operand X on file FILE.
1453    CODE is the code from the %-spec that requested printing this operand;
1454    if `%z3' was used to print operand 3, then CODE is 'z'. */
1455
1456 /* %$ means print the prefix for an immediate operand.  */
1457
1458 #define PRINT_OPERAND_PUNCT_VALID_P(CODE)                               \
1459   ((CODE) == '$' || (CODE) == '?')
1460
1461 #define PRINT_OPERAND(FILE, X, CODE)       print_operand(FILE, X, CODE)
1462
1463 /* Print a memory operand whose address is X, on file FILE.  */
1464
1465 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address(FILE, ADDR)
1466
1467 /* Define functions in ns32k.c and used in insn-output.c.  */
1468
1469 extern char *output_move_double ();
1470 extern char *output_shift_insn ();
1471 extern char *output_move_dconst ();
1472
1473 /*
1474 Local variables:
1475 version-control: t
1476 End:
1477 */