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