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