OSDN Git Service

(TARGET_SWITCHES): Add SUBTARGET_SWITCHES.
[pf3gnuchains/gcc-fork.git] / gcc / config / m68k / m68k.h
1 /* Definitions of target machine for GNU compiler.  Sun 68000/68020 version.
2    Copyright (C) 1987, 1988, 1993 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
19
20
21 /* Note that some other tm.h files include this one and then override
22    many of the definitions that relate to assembler syntax.  */
23
24
25 /* Names to predefine in the preprocessor for this target machine.  */
26
27 /* See sun3.h, sun2.h, isi.h for different CPP_PREDEFINES.  */
28
29 /* Print subsidiary information on the compiler version in use.  */
30 #ifdef MOTOROLA
31 #define TARGET_VERSION fprintf (stderr, " (68k, Motorola syntax)");
32 #else
33 #define TARGET_VERSION fprintf (stderr, " (68k, MIT syntax)");
34 #endif
35
36 /* Define SUPPORT_SUN_FPA to include support for generating code for
37    the Sun Floating Point Accelerator, an optional product for Sun 3
38    machines.  By default, it is not defined.  Avoid defining it unless
39    you need to output code for the Sun3+FPA architecture, as it has the
40    effect of slowing down the register set operations in hard-reg-set.h
41    (total number of registers will exceed number of bits in a long,
42    if defined, causing the set operations to expand to loops).
43    SUPPORT_SUN_FPA is typically defined in sun3.h.  */
44
45 /* Run-time compilation parameters selecting different hardware subsets.  */
46
47 extern int target_flags;
48
49 /* Macros used in the machine description to test the flags.  */
50
51 /* Compile for a 68020 (not a 68000 or 68010).  */
52 #define TARGET_68020 (target_flags & 1)
53
54 /* Compile 68881 insns for floating point (not library calls).  */
55 #define TARGET_68881 (target_flags & 2)
56
57 /* Compile using 68020 bitfield insns.  */
58 #define TARGET_BITFIELD (target_flags & 4)
59
60 /* Compile using rtd insn calling sequence.
61    This will not work unless you use prototypes at least
62    for all functions that can take varying numbers of args.  */
63 #define TARGET_RTD (target_flags & 8)
64
65 /* Compile passing first two args in regs 0 and 1.
66    This exists only to test compiler features that will
67    be needed for RISC chips.  It is not usable
68    and is not intended to be usable on this cpu.  */
69 #define TARGET_REGPARM (target_flags & 020)
70
71 /* Compile with 16-bit `int'.  */
72 #define TARGET_SHORT (target_flags & 040)
73
74 /* Compile with special insns for Sun FPA.  */
75 #ifdef SUPPORT_SUN_FPA
76 #define TARGET_FPA (target_flags & 0100)
77 #else
78 #define TARGET_FPA 0
79 #endif
80
81 /* Compile (actually, link) for Sun SKY board.  */
82 #define TARGET_SKY (target_flags & 0200)
83
84 /* Optimize for 68040, but still allow execution on 68020
85    (-m68020-40 or -m68040).
86    The 68040 will execute all 68030 and 68881/2 instructions, but some
87    of them must be emulated in software by the OS.  When TARGET_68040 is
88    turned on, these instructions won't be used.  This code will still
89    run on a 68030 and 68881/2. */
90 #define TARGET_68040 (target_flags & 01400)
91
92 /* Use the 68040-only fp instructions (-m68040).  */
93 #define TARGET_68040_ONLY (target_flags & 01000)
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   { { "68020", -01400},                         \
103     { "c68020", -01400},                        \
104     { "68020", 5},                              \
105     { "c68020", 5},                             \
106     { "68881", 2},                              \
107     { "bitfield", 4},                           \
108     { "68000", -01405},                         \
109     { "c68000", -01405},                        \
110     { "soft-float", -01102},                    \
111     { "nobitfield", -4},                        \
112     { "rtd", 8},                                \
113     { "nortd", -8},                             \
114     { "short", 040},                            \
115     { "noshort", -040},                         \
116     { "fpa", 0100},                             \
117     { "nofpa", -0100},                          \
118     { "sky", 0200},                             \
119     { "nosky", -0200},                          \
120     { "68020-40", 0407},                        \
121     { "68030", -01400},                         \
122     { "68030", 5},                              \
123     { "68040", 01007},                          \
124     SUBTARGET_SWITCHES                          \
125     { "", TARGET_DEFAULT}}
126 /* TARGET_DEFAULT is defined in sun*.h and isi.h, etc.  */
127
128 /* This is meant to be redefined in the host dependent files */
129 #define SUBTARGET_SWITCHES
130
131 #ifdef SUPPORT_SUN_FPA
132 /* Blow away 68881 flag silently on TARGET_FPA (since we can't clear
133    any bits in TARGET_SWITCHES above) */
134 #define OVERRIDE_OPTIONS                \
135 {                                       \
136   if (TARGET_FPA) target_flags &= ~2;   \
137   if (! TARGET_68020 && flag_pic == 2)  \
138     error("-fPIC is not currently supported on the 68000 or 68010\n");  \
139   SUBTARGET_OVERRIDE_OPTIONS            \
140 }
141 #else
142 #define OVERRIDE_OPTIONS                \
143 {                                       \
144   if (! TARGET_68020 && flag_pic == 2)  \
145     error("-fPIC is not currently supported on the 68000 or 68010\n");  \
146   SUBTARGET_OVERRIDE_OPTIONS            \
147 }
148 #endif /* defined SUPPORT_SUN_FPA */
149
150 /* This is meant to be redefined in the host dependent files */
151 #define SUBTARGET_OVERRIDE_OPTIONS
152 \f
153 /* target machine storage layout */
154
155 /* Define for XFmode extended real floating point support.
156    This will automatically cause REAL_ARITHMETIC to be defined.  */
157 #define LONG_DOUBLE_TYPE_SIZE 96
158
159 /* Define if you don't want extended real, but do want to use the
160    software floating point emulator for REAL_ARITHMETIC and
161    decimal <-> binary conversion. */
162 /* #define REAL_ARITHMETIC */
163
164 /* Define this if most significant bit is lowest numbered
165    in instructions that operate on numbered bit-fields.
166    This is true for 68020 insns such as bfins and bfexts.
167    We make it true always by avoiding using the single-bit insns
168    except in special cases with constant bit numbers.  */
169 #define BITS_BIG_ENDIAN 1
170
171 /* Define this if most significant byte of a word is the lowest numbered.  */
172 /* That is true on the 68000.  */
173 #define BYTES_BIG_ENDIAN 1
174
175 /* Define this if most significant word of a multiword number is the lowest
176    numbered.  */
177 /* For 68000 we can decide arbitrarily
178    since there are no machine instructions for them.
179    So let's be consistent.  */
180 #define WORDS_BIG_ENDIAN 1
181
182 /* number of bits in an addressable storage unit */
183 #define BITS_PER_UNIT 8
184
185 /* Width in bits of a "word", which is the contents of a machine register.
186    Note that this is not necessarily the width of data type `int';
187    if using 16-bit ints on a 68000, this would still be 32.
188    But on a machine with 16-bit registers, this would be 16.  */
189 #define BITS_PER_WORD 32
190
191 /* Width of a word, in units (bytes).  */
192 #define UNITS_PER_WORD 4
193
194 /* Width in bits of a pointer.
195    See also the macro `Pmode' defined below.  */
196 #define POINTER_SIZE 32
197
198 /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
199 #define PARM_BOUNDARY (TARGET_SHORT ? 16 : 32)
200
201 /* Boundary (in *bits*) on which stack pointer should be aligned.  */
202 #define STACK_BOUNDARY 16
203
204 /* Allocation boundary (in *bits*) for the code of a function.  */
205 #define FUNCTION_BOUNDARY 16
206
207 /* Alignment of field after `int : 0' in a structure.  */
208 #define EMPTY_FIELD_BOUNDARY 16
209
210 /* No data type wants to be aligned rounder than this.  */
211 #define BIGGEST_ALIGNMENT 16
212
213 /* Set this nonzero if move instructions will actually fail to work
214    when given unaligned data.  */
215 #define STRICT_ALIGNMENT 1
216
217 #define SELECT_RTX_SECTION(MODE, X)                                     \
218 {                                                                       \
219   if (!flag_pic)                                                        \
220     readonly_data_section();                                            \
221   else if (LEGITIMATE_PIC_OPERAND_P (X))                                \
222     readonly_data_section();                                            \
223   else                                                                  \
224     data_section();                                                     \
225 }
226
227 /* Define number of bits in most basic integer type.
228    (If undefined, default is BITS_PER_WORD).  */
229
230 #define INT_TYPE_SIZE (TARGET_SHORT ? 16 : 32)
231
232 /* Define these to avoid dependence on meaning of `int'.
233    Note that WCHAR_TYPE_SIZE is used in cexp.y,
234    where TARGET_SHORT is not available.  */
235
236 #define WCHAR_TYPE "long int"
237 #define WCHAR_TYPE_SIZE 32
238 \f
239 /* Standard register usage.  */
240
241 /* Number of actual hardware registers.
242    The hardware registers are assigned numbers for the compiler
243    from 0 to just below FIRST_PSEUDO_REGISTER.
244    All registers that the compiler knows about must be given numbers,
245    even those that are not normally considered general registers.
246    For the 68000, we give the data registers numbers 0-7,
247    the address registers numbers 010-017,
248    and the 68881 floating point registers numbers 020-027.  */
249 #ifndef SUPPORT_SUN_FPA
250 #define FIRST_PSEUDO_REGISTER 24
251 #else
252 #define FIRST_PSEUDO_REGISTER 56
253 #endif
254
255 /* This defines the register which is used to hold the offset table for PIC. */
256 #define PIC_OFFSET_TABLE_REGNUM 13
257
258 /* Used to output a (use pic_offset_table_rtx) so that we 
259    always save/restore a5 in functions that use PIC relocation
260    at *any* time during the compilation process. */
261 #define FINALIZE_PIC finalize_pic()
262
263 #ifndef SUPPORT_SUN_FPA
264
265 /* 1 for registers that have pervasive standard uses
266    and are not available for the register allocator.
267    On the 68000, only the stack pointer is such.  */
268
269 #define FIXED_REGISTERS        \
270  {/* Data registers.  */       \
271   0, 0, 0, 0, 0, 0, 0, 0,      \
272                                \
273   /* Address registers.  */    \
274   0, 0, 0, 0, 0, 0, 0, 1,      \
275                                \
276   /* Floating point registers  \
277      (if available).  */       \
278   0, 0, 0, 0, 0, 0, 0, 0 }
279
280 /* 1 for registers not available across function calls.
281    These must include the FIXED_REGISTERS and also any
282    registers that can be used without being saved.
283    The latter must include the registers where values are returned
284    and the register where structure-value addresses are passed.
285    Aside from that, you can include as many other registers as you like.  */
286 #define CALL_USED_REGISTERS \
287  {1, 1, 0, 0, 0, 0, 0, 0,   \
288   1, 1, 0, 0, 0, 0, 0, 1,   \
289   1, 1, 0, 0, 0, 0, 0, 0 }
290
291 #else /* SUPPORT_SUN_FPA */
292
293 /* 1 for registers that have pervasive standard uses
294    and are not available for the register allocator.
295    On the 68000, only the stack pointer is such.  */
296
297 /* fpa0 is also reserved so that it can be used to move shit back and
298    forth between high fpa regs and everything else. */
299
300 #define FIXED_REGISTERS        \
301  {/* Data registers.  */       \
302   0, 0, 0, 0, 0, 0, 0, 0,      \
303                                \
304   /* Address registers.  */    \
305   0, 0, 0, 0, 0, 0, 0, 1,      \
306                                \
307   /* Floating point registers  \
308      (if available).  */       \
309   0, 0, 0, 0, 0, 0, 0, 0,      \
310                                \
311   /* Sun3 FPA registers.  */   \
312   1, 0, 0, 0, 0, 0, 0, 0,      \
313   0, 0, 0, 0, 0, 0, 0, 0,      \
314   0, 0, 0, 0, 0, 0, 0, 0,      \
315   0, 0, 0, 0, 0, 0, 0, 0 }
316
317 /* 1 for registers not available across function calls.
318    These must include the FIXED_REGISTERS and also any
319    registers that can be used without being saved.
320    The latter must include the registers where values are returned
321    and the register where structure-value addresses are passed.
322    Aside from that, you can include as many other registers as you like.  */
323 #define CALL_USED_REGISTERS \
324  {1, 1, 0, 0, 0, 0, 0, 0, \
325   1, 1, 0, 0, 0, 0, 0, 1, \
326   1, 1, 0, 0, 0, 0, 0, 0, \
327   /* FPA registers.  */   \
328   1, 1, 1, 1, 0, 0, 0, 0, \
329   0, 0, 0, 0, 0, 0, 0, 0, \
330   0, 0, 0, 0, 0, 0, 0, 0, \
331   0, 0, 0, 0, 0, 0, 0, 0  }
332
333 #endif /* defined SUPPORT_SUN_FPA */
334
335
336 /* Make sure everything's fine if we *don't* have a given processor.
337    This assumes that putting a register in fixed_regs will keep the
338    compiler's mitts completely off it.  We don't bother to zero it out
339    of register classes.  If neither TARGET_FPA or TARGET_68881 is set,
340    the compiler won't touch since no instructions that use these
341    registers will be valid.  
342
343    Reserve PIC_OFFSET_TABLE_REGNUM (a5) for doing PIC relocation if
344    position independent code is being generated by making it a 
345    fixed register */
346
347 #ifndef SUPPORT_SUN_FPA
348
349 #define CONDITIONAL_REGISTER_USAGE \
350 {                                               \
351   if (flag_pic)                                 \
352     fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;    \
353 }
354
355 #else /* defined SUPPORT_SUN_FPA */
356
357 #define CONDITIONAL_REGISTER_USAGE \
358 {                                               \
359   int i;                                        \
360   HARD_REG_SET x;                               \
361   if (!TARGET_FPA)                              \
362     {                                           \
363       COPY_HARD_REG_SET (x, reg_class_contents[(int)FPA_REGS]); \
364       for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
365        if (TEST_HARD_REG_BIT (x, i))            \
366         fixed_regs[i] = call_used_regs[i] = 1;  \
367     }                                           \
368   if (TARGET_FPA)                               \
369     {                                           \
370       COPY_HARD_REG_SET (x, reg_class_contents[(int)FP_REGS]); \
371       for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
372        if (TEST_HARD_REG_BIT (x, i))            \
373         fixed_regs[i] = call_used_regs[i] = 1;  \
374     }                                           \
375   if (flag_pic)                                 \
376     fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;    \
377 }
378
379 #endif /* defined SUPPORT_SUN_FPA */
380
381 /* Return number of consecutive hard regs needed starting at reg REGNO
382    to hold something of mode MODE.
383    This is ordinarily the length in words of a value of mode MODE
384    but can be less for certain modes in special long registers.
385
386    On the 68000, ordinary registers hold 32 bits worth;
387    for the 68881 registers, a single register is always enough for
388    anything that can be stored in them at all.  */
389 #define HARD_REGNO_NREGS(REGNO, MODE)   \
390   ((REGNO) >= 16 ? GET_MODE_NUNITS (MODE)       \
391    : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
392
393 #ifndef SUPPORT_SUN_FPA
394
395 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
396    On the 68000, the cpu registers can hold any mode but the 68881 registers
397    can hold only SFmode or DFmode.  The 68881 registers can't hold anything
398    if 68881 use is disabled.  */
399
400 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
401   (((REGNO) < 16)                                       \
402    || ((REGNO) < 24                                     \
403        && TARGET_68881                                  \
404        && (GET_MODE_CLASS (MODE) == MODE_FLOAT          \
405            || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)))
406
407 #else /* defined SUPPORT_SUN_FPA */
408
409 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
410    On the 68000, the cpu registers can hold any mode but the 68881 registers
411    can hold only SFmode or DFmode.  And the 68881 registers can't hold anything
412    if 68881 use is disabled.  However, the Sun FPA register can
413    (apparently) hold whatever you feel like putting in them.
414    If using the fpa, don't put a double in d7/a0.  */
415
416 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
417 (((REGNO) < 16                                                          \
418   && !(TARGET_FPA                                                       \
419        && GET_MODE_CLASS ((MODE)) != MODE_INT                           \
420        && GET_MODE_UNIT_SIZE ((MODE)) > 4                               \
421        && (REGNO) < 8 && (REGNO) + GET_MODE_SIZE ((MODE)) / 4 > 8       \
422        && (REGNO) % (GET_MODE_UNIT_SIZE ((MODE)) / 4) != 0))            \
423  || ((REGNO) < 24                                                       \
424      ? TARGET_68881 && (GET_MODE_CLASS (MODE) == MODE_FLOAT             \
425                         || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
426      : ((REGNO) < 56 ? TARGET_FPA : 0)))
427
428 #endif /* defined SUPPORT_SUN_FPA */
429
430 /* Value is 1 if it is a good idea to tie two pseudo registers
431    when one has mode MODE1 and one has mode MODE2.
432    If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
433    for any hard reg, then this must be 0 for correct output.  */
434 #define MODES_TIEABLE_P(MODE1, MODE2)                   \
435   (! TARGET_68881                                       \
436    || ((GET_MODE_CLASS (MODE1) == MODE_FLOAT            \
437         || GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT)        \
438        == (GET_MODE_CLASS (MODE2) == MODE_FLOAT         \
439            || GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT)))
440
441 /* Specify the registers used for certain standard purposes.
442    The values of these macros are register numbers.  */
443
444 /* m68000 pc isn't overloaded on a register.  */
445 /* #define PC_REGNUM  */
446
447 /* Register to use for pushing function arguments.  */
448 #define STACK_POINTER_REGNUM 15
449
450 /* Base register for access to local variables of the function.  */
451 #define FRAME_POINTER_REGNUM 14
452
453 /* Value should be nonzero if functions must have frame pointers.
454    Zero means the frame pointer need not be set up (and parms
455    may be accessed via the stack pointer) in functions that seem suitable.
456    This is computed in `reload', in reload1.c.  */
457 #define FRAME_POINTER_REQUIRED 0
458
459 /* Base register for access to arguments of the function.  */
460 #define ARG_POINTER_REGNUM 14
461
462 /* Register in which static-chain is passed to a function.  */
463 #define STATIC_CHAIN_REGNUM 8
464
465 /* Register in which address to store a structure value
466    is passed to a function.  */
467 #define STRUCT_VALUE_REGNUM 9
468 \f
469 /* Define the classes of registers for register constraints in the
470    machine description.  Also define ranges of constants.
471
472    One of the classes must always be named ALL_REGS and include all hard regs.
473    If there is more than one class, another class must be named NO_REGS
474    and contain no registers.
475
476    The name GENERAL_REGS must be the name of a class (or an alias for
477    another name such as ALL_REGS).  This is the class of registers
478    that is allowed by "g" or "r" in a register constraint.
479    Also, registers outside this class are allocated only when
480    instructions express preferences for them.
481
482    The classes must be numbered in nondecreasing order; that is,
483    a larger-numbered class must never be contained completely
484    in a smaller-numbered class.
485
486    For any two classes, it is very desirable that there be another
487    class that represents their union.  */
488
489 /* The 68000 has three kinds of registers, so eight classes would be
490    a complete set.  One of them is not needed.  */
491
492 #ifndef SUPPORT_SUN_FPA
493
494 enum reg_class {
495   NO_REGS, DATA_REGS,
496   ADDR_REGS, FP_REGS,
497   GENERAL_REGS, DATA_OR_FP_REGS,
498   ADDR_OR_FP_REGS, ALL_REGS,
499   LIM_REG_CLASSES };
500
501 #define N_REG_CLASSES (int) LIM_REG_CLASSES
502
503 /* Give names of register classes as strings for dump file.   */
504
505 #define REG_CLASS_NAMES \
506  { "NO_REGS", "DATA_REGS",              \
507    "ADDR_REGS", "FP_REGS",              \
508    "GENERAL_REGS", "DATA_OR_FP_REGS",   \
509    "ADDR_OR_FP_REGS", "ALL_REGS" }
510
511 /* Define which registers fit in which classes.
512    This is an initializer for a vector of HARD_REG_SET
513    of length N_REG_CLASSES.  */
514
515 #define REG_CLASS_CONTENTS \
516 {                                       \
517  0x00000000,    /* NO_REGS */           \
518  0x000000ff,    /* DATA_REGS */         \
519  0x0000ff00,    /* ADDR_REGS */         \
520  0x00ff0000,    /* FP_REGS */           \
521  0x0000ffff,    /* GENERAL_REGS */      \
522  0x00ff00ff,    /* DATA_OR_FP_REGS */   \
523  0x00ffff00,    /* ADDR_OR_FP_REGS */   \
524  0x00ffffff,    /* ALL_REGS */          \
525 }
526
527 /* The same information, inverted:
528    Return the class number of the smallest class containing
529    reg number REGNO.  This could be a conditional expression
530    or could index an array.  */
531
532 #define REGNO_REG_CLASS(REGNO) (((REGNO)>>3)+1)
533
534 #else /* defined SUPPORT_SUN_FPA */
535
536 /*
537  * Notes on final choices:
538  *
539  *   1) Didn't feel any need to union-ize LOW_FPA_REGS with anything
540  * else.
541  *   2) Removed all unions that involve address registers with
542  * floating point registers (left in unions of address and data with
543  * floating point).
544  *   3) Defined GENERAL_REGS as ADDR_OR_DATA_REGS.
545  *   4) Defined ALL_REGS as FPA_OR_FP_OR_GENERAL_REGS.
546  *   4) Left in everything else.
547  */
548 enum reg_class { NO_REGS, LO_FPA_REGS, FPA_REGS, FP_REGS,
549   FP_OR_FPA_REGS, DATA_REGS, DATA_OR_FPA_REGS, DATA_OR_FP_REGS,
550   DATA_OR_FP_OR_FPA_REGS, ADDR_REGS, GENERAL_REGS,
551   GENERAL_OR_FPA_REGS, GENERAL_OR_FP_REGS, ALL_REGS,
552   LIM_REG_CLASSES };
553
554 #define N_REG_CLASSES (int) LIM_REG_CLASSES
555
556 /* Give names of register classes as strings for dump file.   */
557
558 #define REG_CLASS_NAMES \
559  { "NO_REGS", "LO_FPA_REGS", "FPA_REGS", "FP_REGS",  \
560    "FP_OR_FPA_REGS", "DATA_REGS", "DATA_OR_FPA_REGS", "DATA_OR_FP_REGS",  \
561    "DATA_OR_FP_OR_FPA_REGS", "ADDR_REGS", "GENERAL_REGS",  \
562    "GENERAL_OR_FPA_REGS", "GENERAL_OR_FP_REGS", "ALL_REGS" }
563
564 /* Define which registers fit in which classes.
565    This is an initializer for a vector of HARD_REG_SET
566    of length N_REG_CLASSES.  */
567
568 #define REG_CLASS_CONTENTS \
569 {                                                       \
570  {0, 0},                        /* NO_REGS */           \
571  {0xff000000, 0x000000ff},      /* LO_FPA_REGS */       \
572  {0xff000000, 0x00ffffff},      /* FPA_REGS */          \
573  {0x00ff0000, 0x00000000},      /* FP_REGS */           \
574  {0xffff0000, 0x00ffffff},      /* FP_OR_FPA_REGS */    \
575  {0x000000ff, 0x00000000},      /* DATA_REGS */         \
576  {0xff0000ff, 0x00ffffff},      /* DATA_OR_FPA_REGS */  \
577  {0x00ff00ff, 0x00000000},      /* DATA_OR_FP_REGS */   \
578  {0xffff00ff, 0x00ffffff},      /* DATA_OR_FP_OR_FPA_REGS */\
579  {0x0000ff00, 0x00000000},      /* ADDR_REGS */         \
580  {0x0000ffff, 0x00000000},      /* GENERAL_REGS */      \
581  {0xff00ffff, 0x00ffffff},      /* GENERAL_OR_FPA_REGS */\
582  {0x00ffffff, 0x00000000},      /* GENERAL_OR_FP_REGS */\
583  {0xffffffff, 0x00ffffff},      /* ALL_REGS */          \
584 }
585
586 /* The same information, inverted:
587    Return the class number of the smallest class containing
588    reg number REGNO.  This could be a conditional expression
589    or could index an array.  */
590
591 extern enum reg_class regno_reg_class[];
592 #define REGNO_REG_CLASS(REGNO) (regno_reg_class[(REGNO)>>3])
593
594 #endif /* SUPPORT_SUN_FPA */
595
596 /* The class value for index registers, and the one for base regs.  */
597
598 #define INDEX_REG_CLASS GENERAL_REGS
599 #define BASE_REG_CLASS ADDR_REGS
600
601 /* Get reg_class from a letter such as appears in the machine description.
602    We do a trick here to modify the effective constraints on the
603    machine description; we zorch the constraint letters that aren't
604    appropriate for a specific target.  This allows us to guarantee
605    that a specific kind of register will not be used for a given target
606    without fiddling with the register classes above. */
607
608 #ifndef SUPPORT_SUN_FPA
609
610 #define REG_CLASS_FROM_LETTER(C) \
611   ((C) == 'a' ? ADDR_REGS :                     \
612    ((C) == 'd' ? DATA_REGS :                    \
613     ((C) == 'f' ? (TARGET_68881 ? FP_REGS :     \
614                    NO_REGS) :                   \
615      NO_REGS)))
616
617 #else /* defined SUPPORT_SUN_FPA */
618
619 #define REG_CLASS_FROM_LETTER(C) \
620   ((C) == 'a' ? ADDR_REGS :                     \
621    ((C) == 'd' ? DATA_REGS :                    \
622     ((C) == 'f' ? (TARGET_68881 ? FP_REGS :     \
623                    NO_REGS) :                   \
624      ((C) == 'x' ? (TARGET_FPA ? FPA_REGS :     \
625                     NO_REGS) :                  \
626       ((C) == 'y' ? (TARGET_FPA ? LO_FPA_REGS : \
627                      NO_REGS) :                 \
628        NO_REGS)))))
629
630 #endif /* defined SUPPORT_SUN_FPA */
631
632 /* The letters I, J, K, L and M in a register constraint string
633    can be used to stand for particular ranges of immediate operands.
634    This macro defines what the ranges are.
635    C is the letter, and VALUE is a constant value.
636    Return 1 if VALUE is in the range specified by C.
637
638    For the 68000, `I' is used for the range 1 to 8
639    allowed as immediate shift counts and in addq.
640    `J' is used for the range of signed numbers that fit in 16 bits.
641    `K' is for numbers that moveq can't handle.
642    `L' is for range -8 to -1, range of values that can be added with subq.  */
643
644 #define CONST_OK_FOR_LETTER_P(VALUE, C)  \
645   ((C) == 'I' ? (VALUE) > 0 && (VALUE) <= 8 :    \
646    (C) == 'J' ? (VALUE) >= -0x8000 && (VALUE) <= 0x7FFF :       \
647    (C) == 'K' ? (VALUE) < -0x80 || (VALUE) >= 0x80 :    \
648    (C) == 'L' ? (VALUE) < 0 && (VALUE) >= -8 : 0)
649
650 /*
651  * A small bit of explanation:
652  * "G" defines all of the floating constants that are *NOT* 68881
653  * constants.  this is so 68881 constants get reloaded and the
654  * fpmovecr is used.  "H" defines *only* the class of constants that
655  * the fpa can use, because these can be gotten at in any fpa
656  * instruction and there is no need to force reloads.
657  */
658 #ifndef SUPPORT_SUN_FPA
659 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)  \
660   ((C) == 'G' ? ! (TARGET_68881 && standard_68881_constant_p (VALUE)) : 0 )
661 #else /* defined SUPPORT_SUN_FPA */
662 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)  \
663   ((C) == 'G' ? ! (TARGET_68881 && standard_68881_constant_p (VALUE)) : \
664    (C) == 'H' ? (TARGET_FPA && standard_sun_fpa_constant_p (VALUE)) : 0)
665 #endif /* defined SUPPORT_SUN_FPA */
666
667 /* Given an rtx X being reloaded into a reg required to be
668    in class CLASS, return the class of reg to actually use.
669    In general this is just CLASS; but on some machines
670    in some cases it is preferable to use a more restrictive class.
671    On the 68000 series, use a data reg if possible when the
672    value is a constant in the range where moveq could be used
673    and we ensure that QImodes are reloaded into data regs.
674    Also, if a floating constant needs reloading, put it in memory
675    if possible.  */
676
677 #define PREFERRED_RELOAD_CLASS(X,CLASS)  \
678   ((GET_CODE (X) == CONST_INT                   \
679     && (unsigned) (INTVAL (X) + 0x80) < 0x100   \
680     && (CLASS) != ADDR_REGS)                    \
681    ? DATA_REGS                                  \
682    : (GET_MODE (X) == QImode && (CLASS) != ADDR_REGS) \
683    ? DATA_REGS                                  \
684    : (GET_CODE (X) == CONST_DOUBLE              \
685       && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
686    ? NO_REGS                                    \
687    : (CLASS))
688
689 /* Return the maximum number of consecutive registers
690    needed to represent mode MODE in a register of class CLASS.  */
691 /* On the 68000, this is the size of MODE in words,
692    except in the FP regs, where a single reg is always enough.  */
693 #ifndef SUPPORT_SUN_FPA
694
695 #define CLASS_MAX_NREGS(CLASS, MODE)    \
696  ((CLASS) == FP_REGS ? 1 \
697   : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
698
699 /* Moves between fp regs and other regs are two insns.  */
700 #define REGISTER_MOVE_COST(CLASS1, CLASS2)              \
701   (((CLASS1) == FP_REGS && (CLASS2) != FP_REGS)         \
702     || ((CLASS2) == FP_REGS && (CLASS1) != FP_REGS)     \
703     ? 4 : 2)
704
705 #else /* defined SUPPORT_SUN_FPA */
706
707 #define CLASS_MAX_NREGS(CLASS, MODE)    \
708  ((CLASS) == FP_REGS || (CLASS) == FPA_REGS || (CLASS) == LO_FPA_REGS ? 1 \
709   : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
710
711 /* Moves between fp regs and other regs are two insns.  */
712 /* Likewise for high fpa regs and other regs.  */
713 #define REGISTER_MOVE_COST(CLASS1, CLASS2)              \
714   ((((CLASS1) == FP_REGS && (CLASS2) != FP_REGS)        \
715     || ((CLASS2) == FP_REGS && (CLASS1) != FP_REGS)     \
716     || ((CLASS1) == FPA_REGS && (CLASS2) != FPA_REGS)   \
717     || ((CLASS2) == FPA_REGS && (CLASS1) != FPA_REGS))  \
718    ? 4 : 2)
719
720 #endif /* define SUPPORT_SUN_FPA */
721 \f
722 /* Stack layout; function entry, exit and calling.  */
723
724 /* Define this if pushing a word on the stack
725    makes the stack pointer a smaller address.  */
726 #define STACK_GROWS_DOWNWARD
727
728 /* Nonzero if we need to generate stack-probe insns.
729    On most systems they are not needed.
730    When they are needed, define this as the stack offset to probe at.  */
731 #define NEED_PROBE 0
732
733 /* Define this if the nominal address of the stack frame
734    is at the high-address end of the local variables;
735    that is, each additional local variable allocated
736    goes at a more negative offset in the frame.  */
737 #define FRAME_GROWS_DOWNWARD
738
739 /* Offset within stack frame to start allocating local variables at.
740    If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
741    first local allocated.  Otherwise, it is the offset to the BEGINNING
742    of the first local allocated.  */
743 #define STARTING_FRAME_OFFSET 0
744
745 /* If we generate an insn to push BYTES bytes,
746    this says how many the stack pointer really advances by.
747    On the 68000, sp@- in a byte insn really pushes a word.  */
748 #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
749
750 /* Offset of first parameter from the argument pointer register value.  */
751 #define FIRST_PARM_OFFSET(FNDECL) 8
752
753 /* Value is the number of byte of arguments automatically
754    popped when returning from a subroutine call.
755    FUNTYPE is the data type of the function (as a tree),
756    or for a library call it is an identifier node for the subroutine name.
757    SIZE is the number of bytes of arguments passed on the stack.
758
759    On the 68000, the RTS insn cannot pop anything.
760    On the 68010, the RTD insn may be used to pop them if the number
761      of args is fixed, but if the number is variable then the caller
762      must pop them all.  RTD can't be used for library calls now
763      because the library is compiled with the Unix compiler.
764    Use of RTD is a selectable option, since it is incompatible with
765    standard Unix calling sequences.  If the option is not selected,
766    the caller must always pop the args.  */
767
768 #define RETURN_POPS_ARGS(FUNTYPE,SIZE)   \
769   ((TARGET_RTD && TREE_CODE (FUNTYPE) != IDENTIFIER_NODE        \
770     && (TYPE_ARG_TYPES (FUNTYPE) == 0                           \
771         || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE)))   \
772             == void_type_node)))                                \
773    ? (SIZE) : 0)
774
775 /* Define how to find the value returned by a function.
776    VALTYPE is the data type of the value (as a tree).
777    If the precise function being called is known, FUNC is its FUNCTION_DECL;
778    otherwise, FUNC is 0.  */
779
780 /* On the 68000 the return value is in D0 regardless.  */
781
782 #define FUNCTION_VALUE(VALTYPE, FUNC)  \
783   gen_rtx (REG, TYPE_MODE (VALTYPE), 0)
784
785 /* Define how to find the value returned by a library function
786    assuming the value has mode MODE.  */
787
788 /* On the 68000 the return value is in D0 regardless.  */
789
790 #define LIBCALL_VALUE(MODE)  gen_rtx (REG, MODE, 0)
791
792 /* 1 if N is a possible register number for a function value.
793    On the 68000, d0 is the only register thus used.  */
794
795 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
796
797 /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
798    more than one register.  */
799
800 #define NEEDS_UNTYPED_CALL 0
801
802 /* Define this if PCC uses the nonreentrant convention for returning
803    structure and union values.  */
804
805 #define PCC_STATIC_STRUCT_RETURN
806
807 /* 1 if N is a possible register number for function argument passing.
808    On the 68000, no registers are used in this way.  */
809
810 #define FUNCTION_ARG_REGNO_P(N) 0
811 \f
812 /* Define a data type for recording info about an argument list
813    during the scan of that argument list.  This data type should
814    hold all necessary information about the function itself
815    and about the args processed so far, enough to enable macros
816    such as FUNCTION_ARG to determine where the next arg should go.
817
818    On the m68k, this is a single integer, which is a number of bytes
819    of arguments scanned so far.  */
820
821 #define CUMULATIVE_ARGS int
822
823 /* Initialize a variable CUM of type CUMULATIVE_ARGS
824    for a call to a function whose data type is FNTYPE.
825    For a library call, FNTYPE is 0.
826
827    On the m68k, the offset starts at 0.  */
828
829 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME)        \
830  ((CUM) = 0)
831
832 /* Update the data in CUM to advance over an argument
833    of mode MODE and data type TYPE.
834    (TYPE is null for libcalls where that information may not be available.)  */
835
836 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)    \
837  ((CUM) += ((MODE) != BLKmode                   \
838             ? (GET_MODE_SIZE (MODE) + 3) & ~3   \
839             : (int_size_in_bytes (TYPE) + 3) & ~3))
840
841 /* Define where to put the arguments to a function.
842    Value is zero to push the argument on the stack,
843    or a hard register in which to store the argument.
844
845    MODE is the argument's machine mode.
846    TYPE is the data type of the argument (as a tree).
847     This is null for libcalls where that information may
848     not be available.
849    CUM is a variable of type CUMULATIVE_ARGS which gives info about
850     the preceding args and about the function being called.
851    NAMED is nonzero if this argument is a named parameter
852     (otherwise it is an extra parameter matching an ellipsis).  */
853
854 /* On the 68000 all args are pushed, except if -mregparm is specified
855    then the first two words of arguments are passed in d0, d1.
856    *NOTE* -mregparm does not work.
857    It exists only to test register calling conventions.  */
858
859 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
860 ((TARGET_REGPARM && (CUM) < 8) ? gen_rtx (REG, (MODE), (CUM) / 4) : 0)
861
862 /* For an arg passed partly in registers and partly in memory,
863    this is the number of registers used.
864    For args passed entirely in registers or entirely in memory, zero.  */
865
866 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
867 ((TARGET_REGPARM && (CUM) < 8                                   \
868   && 8 < ((CUM) + ((MODE) == BLKmode                            \
869                       ? int_size_in_bytes (TYPE)                \
870                       : GET_MODE_SIZE (MODE))))                 \
871  ? 2 - (CUM) / 4 : 0)
872
873 /* Generate the assembly code for function entry. */
874 #define FUNCTION_PROLOGUE(FILE, SIZE) output_function_prologue(FILE, SIZE)
875
876 /* Output assembler code to FILE to increment profiler label # LABELNO
877    for profiling a function entry.  */
878
879 #define FUNCTION_PROFILER(FILE, LABELNO)  \
880   asm_fprintf (FILE, "\tlea %LLP%d,%Ra0\n\tjsr mcount\n", (LABELNO))
881
882 /* Output assembler code to FILE to initialize this source file's
883    basic block profiling info, if that has not already been done.  */
884
885 #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO)  \
886   asm_fprintf (FILE, "\ttstl %LLPBX0\n\tbne %LLPI%d\n\tpea %LLPBX0\n\tjsr %U__bb_init_func\n\taddql %I4,%Rsp\n%LLPI%d:\n",  \
887            LABELNO, LABELNO);
888
889 /* Output assembler code to FILE to increment the entry-count for
890    the BLOCKNO'th basic block in this source file.  */
891
892 #define BLOCK_PROFILER(FILE, BLOCKNO)   \
893   asm_fprintf (FILE, "\taddql %I1,%LLPBX2+%d\n", 4 * BLOCKNO)
894
895 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
896    the stack pointer does not matter.  The value is tested only in
897    functions that have frame pointers.
898    No definition is equivalent to always zero.  */
899
900 #define EXIT_IGNORE_STACK 1
901
902 /* Generate the assembly code for function exit. */
903 #define FUNCTION_EPILOGUE(FILE, SIZE) output_function_epilogue (FILE, SIZE)
904   
905 /* This is a hook for other tm files to change.  */
906 /* #define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) */
907
908 /* Determine if the epilogue should be output as RTL.
909    You should override this if you define FUNCTION_EXTRA_EPILOGUE.  */
910 #define USE_RETURN_INSN use_return_insn ()
911
912 /* Store in the variable DEPTH the initial difference between the
913    frame pointer reg contents and the stack pointer reg contents,
914    as of the start of the function body.  This depends on the layout
915    of the fixed parts of the stack frame and on how registers are saved.
916
917    On the 68k, if we have a frame, we must add one word to its length
918    to allow for the place that a6 is stored when we do have a frame pointer.
919    Otherwise, we would need to compute the offset from the frame pointer
920    of a local variable as a function of frame_pointer_needed, which
921    is hard.  */
922
923 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH)                     \
924 { int regno;                                                    \
925   int offset = -4;                                              \
926   for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++)      \
927     if (regs_ever_live[regno] && ! call_used_regs[regno])       \
928       offset += 12;                                             \
929   for (regno = 0; regno < 16; regno++)                          \
930     if (regs_ever_live[regno] && ! call_used_regs[regno])       \
931       offset += 4;                                              \
932   (DEPTH) = (offset + ((get_frame_size () + 3) & -4)            \
933              + (get_frame_size () == 0 ? 0 : 4));               \
934 }
935
936 /* Output assembler code for a block containing the constant parts
937    of a trampoline, leaving space for the variable parts.  */
938
939 /* On the 68k, the trampoline looks like this:
940      mov  @#.,a0
941      jsr  @#___trampoline
942      jsr  @#___trampoline
943      .long STATIC
944      .long FUNCTION
945 The reason for having three jsr insns is so that an entire line
946 of the instruction cache is filled in a predictable way
947 that will always be the same.
948
949 We always use the assembler label ___trampoline
950 regardless of whether the system adds underscores.  */
951
952 #define TRAMPOLINE_TEMPLATE(FILE)                                       \
953 {                                                                       \
954   ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x207c));       \
955   ASM_OUTPUT_SHORT (FILE, const0_rtx);                                  \
956   ASM_OUTPUT_SHORT (FILE, const0_rtx);                                  \
957   ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x4eb9));       \
958   ASM_OUTPUT_INT (FILE, gen_rtx (SYMBOL_REF, SImode, "*___trampoline"));\
959   ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x4eb9));       \
960   ASM_OUTPUT_INT (FILE, gen_rtx (SYMBOL_REF, SImode, "*___trampoline"));\
961   ASM_OUTPUT_SHORT (FILE, const0_rtx);                                  \
962   ASM_OUTPUT_SHORT (FILE, const0_rtx);                                  \
963   ASM_OUTPUT_SHORT (FILE, const0_rtx);                                  \
964   ASM_OUTPUT_SHORT (FILE, const0_rtx);                                  \
965 }
966
967 /* Length in units of the trampoline for entering a nested function.  */
968
969 #define TRAMPOLINE_SIZE 26
970
971 /* Alignment required for a trampoline.  16 is used to find the
972    beginning of a line in the instruction cache.  */
973
974 #define TRAMPOLINE_ALIGN 16
975
976 /* Emit RTL insns to initialize the variable parts of a trampoline.
977    FNADDR is an RTX for the address of the function's pure code.
978    CXT is an RTX for the static chain value for the function.  */
979
980 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT)                       \
981 {                                                                       \
982   emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 2)), TRAMP); \
983   emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 18)), CXT); \
984   emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 22)), FNADDR); \
985 }
986
987 /* This is the library routine that is used
988    to transfer control from the trampoline
989    to the actual nested function.  */
990
991 /* A colon is used with no explicit operands
992    to cause the template string to be scanned for %-constructs.  */
993 /* The function name __transfer_from_trampoline is not actually used.
994    The function definition just permits use of "asm with operands"
995    (though the operand list is empty).  */
996 #define TRANSFER_FROM_TRAMPOLINE                                \
997 void                                                            \
998 __transfer_from_trampoline ()                                   \
999 {                                                               \
1000   register char *a0 asm ("%a0");                                \
1001   asm (GLOBAL_ASM_OP " ___trampoline");                         \
1002   asm ("___trampoline:");                                       \
1003   asm volatile ("move%.l %0,%@" : : "m" (a0[22]));              \
1004   asm volatile ("move%.l %1,%0" : "=a" (a0) : "m" (a0[18]));    \
1005   asm ("rts":);                                                 \
1006 }
1007 \f
1008 /* Addressing modes, and classification of registers for them.  */
1009
1010 #define HAVE_POST_INCREMENT
1011 /* #define HAVE_POST_DECREMENT */
1012
1013 #define HAVE_PRE_DECREMENT
1014 /* #define HAVE_PRE_INCREMENT */
1015
1016 /* Macros to check register numbers against specific register classes.  */
1017
1018 /* These assume that REGNO is a hard or pseudo reg number.
1019    They give nonzero only if REGNO is a hard reg of the suitable class
1020    or a pseudo reg currently allocated to a suitable hard reg.
1021    Since they use reg_renumber, they are safe only once reg_renumber
1022    has been allocated, which happens in local-alloc.c.  */
1023
1024 #define REGNO_OK_FOR_INDEX_P(REGNO) \
1025 ((REGNO) < 16 || (unsigned) reg_renumber[REGNO] < 16)
1026 #define REGNO_OK_FOR_BASE_P(REGNO) \
1027 (((REGNO) ^ 010) < 8 || (unsigned) (reg_renumber[REGNO] ^ 010) < 8)
1028 #define REGNO_OK_FOR_DATA_P(REGNO) \
1029 ((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
1030 #define REGNO_OK_FOR_FP_P(REGNO) \
1031 (((REGNO) ^ 020) < 8 || (unsigned) (reg_renumber[REGNO] ^ 020) < 8)
1032 #ifdef SUPPORT_SUN_FPA
1033 #define REGNO_OK_FOR_FPA_P(REGNO) \
1034 (((REGNO) >= 24 && (REGNO) < 56) || (reg_renumber[REGNO] >= 24 && reg_renumber[REGNO] < 56))
1035 #endif
1036
1037 /* Now macros that check whether X is a register and also,
1038    strictly, whether it is in a specified class.
1039
1040    These macros are specific to the 68000, and may be used only
1041    in code for printing assembler insns and in conditions for
1042    define_optimization.  */
1043
1044 /* 1 if X is a data register.  */
1045
1046 #define DATA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_DATA_P (REGNO (X)))
1047
1048 /* 1 if X is an fp register.  */
1049
1050 #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
1051
1052 /* 1 if X is an address register  */
1053
1054 #define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))
1055
1056 #ifdef SUPPORT_SUN_FPA
1057 /* 1 if X is a register in the Sun FPA.  */
1058 #define FPA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FPA_P (REGNO (X)))
1059 #else
1060 /* Answer must be no if we don't have an FPA.  */
1061 #define FPA_REG_P(X) 0
1062 #endif
1063 \f
1064 /* Maximum number of registers that can appear in a valid memory address.  */
1065
1066 #define MAX_REGS_PER_ADDRESS 2
1067
1068 /* Recognize any constant value that is a valid address.  */
1069
1070 #define CONSTANT_ADDRESS_P(X)   \
1071   (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF              \
1072    || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST                \
1073    || GET_CODE (X) == HIGH)
1074
1075 /* Nonzero if the constant value X is a legitimate general operand.
1076    It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
1077
1078 #define LEGITIMATE_CONSTANT_P(X) 1
1079
1080 /* Nonzero if the constant value X is a legitimate general operand
1081    when generating PIC code.  It is given that flag_pic is on and 
1082    that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
1083
1084 #define LEGITIMATE_PIC_OPERAND_P(X)     \
1085   (! symbolic_operand (X, VOIDmode))
1086
1087 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1088    and check its validity for a certain class.
1089    We have two alternate definitions for each of them.
1090    The usual definition accepts all pseudo regs; the other rejects
1091    them unless they have been allocated suitable hard regs.
1092    The symbol REG_OK_STRICT causes the latter definition to be used.
1093
1094    Most source files want to accept pseudo regs in the hope that
1095    they will get allocated to the class that the insn wants them to be in.
1096    Source files for reload pass need to be strict.
1097    After reload, it makes no difference, since pseudo regs have
1098    been eliminated by then.  */
1099
1100 #ifndef REG_OK_STRICT
1101
1102 /* Nonzero if X is a hard reg that can be used as an index
1103    or if it is a pseudo reg.  */
1104 #define REG_OK_FOR_INDEX_P(X) ((REGNO (X) ^ 020) >= 8)
1105 /* Nonzero if X is a hard reg that can be used as a base reg
1106    or if it is a pseudo reg.  */
1107 #define REG_OK_FOR_BASE_P(X) ((REGNO (X) & ~027) != 0)
1108
1109 #else
1110
1111 /* Nonzero if X is a hard reg that can be used as an index.  */
1112 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1113 /* Nonzero if X is a hard reg that can be used as a base reg.  */
1114 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1115
1116 #endif
1117 \f
1118 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1119    that is a valid memory address for an instruction.
1120    The MODE argument is the machine mode for the MEM expression
1121    that wants to use this address.
1122
1123    When generating PIC, an address involving a SYMBOL_REF is legitimate
1124    if and only if it is the sum of pic_offset_table_rtx and the SYMBOL_REF.
1125    We use LEGITIMATE_PIC_OPERAND_P to throw out the illegitimate addresses,
1126    and we explicitly check for the sum of pic_offset_table_rtx and a SYMBOL_REF.
1127
1128    Likewise for a LABEL_REF when generating PIC.
1129
1130    The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS.  */
1131
1132 /* Allow SUBREG everywhere we allow REG.  This results in better code.  It
1133    also makes function inlining work when inline functions are called with
1134    arguments that are SUBREGs.  */
1135
1136 #define LEGITIMATE_BASE_REG_P(X)   \
1137   ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))       \
1138    || (GET_CODE (X) == SUBREG                           \
1139        && GET_CODE (SUBREG_REG (X)) == REG              \
1140        && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
1141
1142 #define INDIRECTABLE_1_ADDRESS_P(X)  \
1143   ((CONSTANT_ADDRESS_P (X) && (!flag_pic || LEGITIMATE_PIC_OPERAND_P (X))) \
1144    || LEGITIMATE_BASE_REG_P (X)                                         \
1145    || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC)            \
1146        && LEGITIMATE_BASE_REG_P (XEXP (X, 0)))                          \
1147    || (GET_CODE (X) == PLUS                                             \
1148        && LEGITIMATE_BASE_REG_P (XEXP (X, 0))                           \
1149        && GET_CODE (XEXP (X, 1)) == CONST_INT                           \
1150        && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000)         \
1151    || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx      \
1152        && flag_pic && GET_CODE (XEXP (X, 1)) == SYMBOL_REF)             \
1153    || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx      \
1154        && flag_pic && GET_CODE (XEXP (X, 1)) == LABEL_REF))             \
1155
1156 #if 0
1157 /* This should replace the last two (non-pic) lines
1158    except that Sun's assembler does not seem to handle such operands.  */
1159        && (TARGET_68020 ? CONSTANT_ADDRESS_P (XEXP (X, 1))              \
1160            : (GET_CODE (XEXP (X, 1)) == CONST_INT                       \
1161               && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000))))
1162 #endif
1163
1164
1165 #define GO_IF_NONINDEXED_ADDRESS(X, ADDR)  \
1166 { if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; }
1167
1168 /* Only labels on dispatch tables are valid for indexing from.  */
1169 #define GO_IF_INDEXABLE_BASE(X, ADDR)                           \
1170 { rtx temp;                                                     \
1171   if (GET_CODE (X) == LABEL_REF                                 \
1172       && (temp = next_nonnote_insn (XEXP (X, 0))) != 0          \
1173       && GET_CODE (temp) == JUMP_INSN                           \
1174       && (GET_CODE (PATTERN (temp)) == ADDR_VEC                 \
1175           || GET_CODE (PATTERN (temp)) == ADDR_DIFF_VEC))       \
1176     goto ADDR;                                                  \
1177   if (LEGITIMATE_BASE_REG_P (X)) goto ADDR; }
1178
1179 #define GO_IF_INDEXING(X, ADDR) \
1180 { if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 0)))         \
1181     { GO_IF_INDEXABLE_BASE (XEXP (X, 1), ADDR); }                       \
1182   if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 1)))         \
1183     { GO_IF_INDEXABLE_BASE (XEXP (X, 0), ADDR); } }
1184
1185 #define GO_IF_INDEXED_ADDRESS(X, ADDR)   \
1186 { GO_IF_INDEXING (X, ADDR);                                             \
1187   if (GET_CODE (X) == PLUS)                                             \
1188     { if (GET_CODE (XEXP (X, 1)) == CONST_INT                           \
1189           && (unsigned) INTVAL (XEXP (X, 1)) + 0x80 < 0x100)            \
1190         { rtx go_temp = XEXP (X, 0); GO_IF_INDEXING (go_temp, ADDR); }  \
1191       if (GET_CODE (XEXP (X, 0)) == CONST_INT                           \
1192           && (unsigned) INTVAL (XEXP (X, 0)) + 0x80 < 0x100)            \
1193         { rtx go_temp = XEXP (X, 1); GO_IF_INDEXING (go_temp, ADDR); } } }
1194
1195 #define LEGITIMATE_INDEX_REG_P(X)   \
1196   ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X))      \
1197    || (GET_CODE (X) == SIGN_EXTEND                      \
1198        && GET_CODE (XEXP (X, 0)) == REG                 \
1199        && GET_MODE (XEXP (X, 0)) == HImode              \
1200        && REG_OK_FOR_INDEX_P (XEXP (X, 0)))             \
1201    || (GET_CODE (X) == SUBREG                           \
1202        && GET_CODE (SUBREG_REG (X)) == REG              \
1203        && REG_OK_FOR_INDEX_P (SUBREG_REG (X))))
1204
1205 #define LEGITIMATE_INDEX_P(X)   \
1206    (LEGITIMATE_INDEX_REG_P (X)                          \
1207     || (TARGET_68020 && GET_CODE (X) == MULT            \
1208         && LEGITIMATE_INDEX_REG_P (XEXP (X, 0))         \
1209         && GET_CODE (XEXP (X, 1)) == CONST_INT          \
1210         && (INTVAL (XEXP (X, 1)) == 2                   \
1211             || INTVAL (XEXP (X, 1)) == 4                \
1212             || INTVAL (XEXP (X, 1)) == 8)))
1213
1214 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)  \
1215 { GO_IF_NONINDEXED_ADDRESS (X, ADDR);                   \
1216   GO_IF_INDEXED_ADDRESS (X, ADDR); }
1217 \f
1218 /* Try machine-dependent ways of modifying an illegitimate address
1219    to be legitimate.  If we find one, return the new, valid address.
1220    This macro is used in only one place: `memory_address' in explow.c.
1221
1222    OLDX is the address as it was before break_out_memory_refs was called.
1223    In some cases it is useful to look at this to decide what needs to be done.
1224
1225    MODE and WIN are passed so that this macro can use
1226    GO_IF_LEGITIMATE_ADDRESS.
1227
1228    It is always safe for this macro to do nothing.  It exists to recognize
1229    opportunities to optimize the output.
1230
1231    For the 68000, we handle X+REG by loading X into a register R and
1232    using R+REG.  R will go in an address reg and indexing will be used.
1233    However, if REG is a broken-out memory address or multiplication,
1234    nothing needs to be done because REG can certainly go in an address reg.  */
1235
1236 #define COPY_ONCE(Y) if (!copied) { Y = copy_rtx (Y); copied = ch = 1; }
1237 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)   \
1238 { register int ch = (X) != (OLDX);                                      \
1239   if (GET_CODE (X) == PLUS)                                             \
1240     { int copied = 0;                                                   \
1241       if (GET_CODE (XEXP (X, 0)) == MULT)                               \
1242         { COPY_ONCE (X); XEXP (X, 0) = force_operand (XEXP (X, 0), 0);} \
1243       if (GET_CODE (XEXP (X, 1)) == MULT)                               \
1244         { COPY_ONCE (X); XEXP (X, 1) = force_operand (XEXP (X, 1), 0);} \
1245       if (ch && GET_CODE (XEXP (X, 1)) == REG                           \
1246           && GET_CODE (XEXP (X, 0)) == REG)                             \
1247         goto WIN;                                                       \
1248       if (ch) { GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN); }              \
1249       if (GET_CODE (XEXP (X, 0)) == REG                                 \
1250                || (GET_CODE (XEXP (X, 0)) == SIGN_EXTEND                \
1251                    && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG           \
1252                    && GET_MODE (XEXP (XEXP (X, 0), 0)) == HImode))      \
1253         { register rtx temp = gen_reg_rtx (Pmode);                      \
1254           register rtx val = force_operand (XEXP (X, 1), 0);            \
1255           emit_move_insn (temp, val);                                   \
1256           COPY_ONCE (X);                                                \
1257           XEXP (X, 1) = temp;                                           \
1258           goto WIN; }                                                   \
1259       else if (GET_CODE (XEXP (X, 1)) == REG                            \
1260                || (GET_CODE (XEXP (X, 1)) == SIGN_EXTEND                \
1261                    && GET_CODE (XEXP (XEXP (X, 1), 0)) == REG           \
1262                    && GET_MODE (XEXP (XEXP (X, 1), 0)) == HImode))      \
1263         { register rtx temp = gen_reg_rtx (Pmode);                      \
1264           register rtx val = force_operand (XEXP (X, 0), 0);            \
1265           emit_move_insn (temp, val);                                   \
1266           COPY_ONCE (X);                                                \
1267           XEXP (X, 0) = temp;                                           \
1268           goto WIN; }}}
1269
1270 /* Go to LABEL if ADDR (a legitimate address expression)
1271    has an effect that depends on the machine mode it is used for.
1272    On the 68000, only predecrement and postincrement address depend thus
1273    (the amount of decrement or increment being the length of the operand).  */
1274
1275 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)        \
1276  if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) goto LABEL
1277 \f
1278 /* Specify the machine mode that this machine uses
1279    for the index in the tablejump instruction.  */
1280 #define CASE_VECTOR_MODE HImode
1281
1282 /* Define this if the tablejump instruction expects the table
1283    to contain offsets from the address of the table.
1284    Do not define this if the table should contain absolute addresses.  */
1285 #define CASE_VECTOR_PC_RELATIVE
1286
1287 /* Specify the tree operation to be used to convert reals to integers.  */
1288 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1289
1290 /* This is the kind of divide that is easiest to do in the general case.  */
1291 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1292
1293 /* Define this as 1 if `char' should by default be signed; else as 0.  */
1294 #define DEFAULT_SIGNED_CHAR 1
1295
1296 /* Don't cse the address of the function being compiled.  */
1297 #define NO_RECURSIVE_FUNCTION_CSE
1298
1299 /* Max number of bytes we can move from memory to memory
1300    in one reasonably fast instruction.  */
1301 #define MOVE_MAX 4
1302
1303 /* Define this if zero-extension is slow (more than one real instruction).  */
1304 #define SLOW_ZERO_EXTEND
1305
1306 /* Nonzero if access to memory by bytes is slow and undesirable.  */
1307 #define SLOW_BYTE_ACCESS 0
1308
1309 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1310    is done just by pretending it is already truncated.  */
1311 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1312
1313 /* We assume that the store-condition-codes instructions store 0 for false
1314    and some other value for true.  This is the value stored for true.  */
1315
1316 #define STORE_FLAG_VALUE -1
1317
1318 /* When a prototype says `char' or `short', really pass an `int'.  */
1319 #define PROMOTE_PROTOTYPES
1320
1321 /* Specify the machine mode that pointers have.
1322    After generation of rtl, the compiler makes no further distinction
1323    between pointers and any other objects of this machine mode.  */
1324 #define Pmode SImode
1325
1326 /* A function address in a call instruction
1327    is a byte address (for indexing purposes)
1328    so give the MEM rtx a byte's mode.  */
1329 #define FUNCTION_MODE QImode
1330
1331 /* Compute the cost of computing a constant rtl expression RTX
1332    whose rtx-code is CODE.  The body of this macro is a portion
1333    of a switch statement.  If the code is computed here,
1334    return it with a return statement.  Otherwise, break from the switch.  */
1335
1336 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1337   case CONST_INT:                                               \
1338     /* Constant zero is super cheap due to clr instruction.  */ \
1339     if (RTX == const0_rtx) return 0;                            \
1340     /* Constants between -128 and 127 are cheap due to moveq */ \
1341     if (INTVAL (RTX) >= -128 && INTVAL (RTX) <= 127) return 1;  \
1342     /* Constants between -136 and 254 are easily generated */   \
1343     /* by intelligent uses of moveq, add[q], and subq      */   \
1344     if ((OUTER_CODE) == SET && INTVAL (RTX) >= -136             \
1345         && INTVAL (RTX) <= 254) return 2;                       \
1346   case CONST:                                                   \
1347   case LABEL_REF:                                               \
1348   case SYMBOL_REF:                                              \
1349     return 3;                                                   \
1350   case CONST_DOUBLE:                                            \
1351     return 5;
1352
1353 /* Compute the cost of various arithmetic operations.
1354    These are vaguely right for a 68020.  */
1355 /* The costs for long multiply have been adjusted to
1356    work properly in synth_mult on the 68020,
1357    relative to an average of the time for add and the time for shift,
1358    taking away a little more because sometimes move insns are needed.  */
1359 #define MULL_COST (TARGET_68040 ? 5 : 13)
1360 #define MULW_COST (TARGET_68040 ? 3 : 8)
1361
1362 #define RTX_COSTS(X,CODE,OUTER_CODE)                            \
1363   case PLUS:                                                    \
1364     /* An lea costs about three times as much as a simple add.  */  \
1365     if (GET_MODE (X) == SImode                                  \
1366         && GET_CODE (XEXP (X, 0)) == REG                        \
1367         && GET_CODE (XEXP (X, 1)) == MULT                       \
1368         && GET_CODE (XEXP (XEXP (X, 1), 0)) == REG              \
1369         && GET_CODE (XEXP (XEXP (X, 1), 1)) == CONST_INT        \
1370         && (INTVAL (XEXP (XEXP (X, 1), 1)) == 2                 \
1371             || INTVAL (XEXP (XEXP (X, 1), 1)) == 4              \
1372             || INTVAL (XEXP (XEXP (X, 1), 1)) == 8))            \
1373       return COSTS_N_INSNS (3);  /* lea an@(dx:l:i),am */       \
1374     break;                                                      \
1375   case ASHIFT:                                                  \
1376   case ASHIFTRT:                                                \
1377   case LSHIFT:                                                  \
1378   case LSHIFTRT:                                                \
1379     /* A shift by a big integer takes an extra instruction.  */ \
1380     if (GET_CODE (XEXP (X, 1)) == CONST_INT                     \
1381         && (INTVAL (XEXP (X, 1)) == 16))                        \
1382       return COSTS_N_INSNS (2);  /* clrw;swap */                \
1383     if (GET_CODE (XEXP (X, 1)) == CONST_INT                     \
1384         && !(INTVAL (XEXP (X, 1)) > 0                           \
1385              && INTVAL (XEXP (X, 1)) <= 8))                     \
1386       return COSTS_N_INSNS (3);  /* lsr #i,dn */                \
1387     break;                                                      \
1388   case MULT:                                                    \
1389     if (GET_CODE (XEXP (x, 1)) == CONST_INT                     \
1390         && exact_log2 (INTVAL (XEXP (x, 1))) >= 0)              \
1391       {                                                         \
1392         /* A shift by a big integer takes an extra instruction.  */ \
1393         if (GET_CODE (XEXP (X, 1)) == CONST_INT                 \
1394             && (INTVAL (XEXP (X, 1)) == (1 << 16)))             \
1395           return COSTS_N_INSNS (2);      /* clrw;swap */        \
1396         if (GET_CODE (XEXP (X, 1)) == CONST_INT                 \
1397             && !(INTVAL (XEXP (X, 1)) > 1                       \
1398                  && INTVAL (XEXP (X, 1)) <= 256))               \
1399           return COSTS_N_INSNS (3);      /* lsr #i,dn */        \
1400         break;                                                  \
1401       }                                                         \
1402     else if (GET_MODE (X) == QImode || GET_MODE (X) == HImode)  \
1403       return COSTS_N_INSNS (MULW_COST);                         \
1404     else                                                        \
1405       return COSTS_N_INSNS (MULL_COST);                         \
1406     break;                                                      \
1407   case DIV:                                                     \
1408   case UDIV:                                                    \
1409   case MOD:                                                     \
1410   case UMOD:                                                    \
1411     if (GET_MODE (X) == QImode || GET_MODE (X) == HImode)       \
1412       return COSTS_N_INSNS (27); /* div.w */                    \
1413     return COSTS_N_INSNS (43);   /* div.l */
1414 \f
1415 /* Tell final.c how to eliminate redundant test instructions.  */
1416
1417 /* Here we define machine-dependent flags and fields in cc_status
1418    (see `conditions.h').  */
1419
1420 /* Set if the cc value is actually in the 68881, so a floating point
1421    conditional branch must be output.  */
1422 #define CC_IN_68881 04000
1423
1424 /* Store in cc_status the expressions that the condition codes will
1425    describe after execution of an instruction whose pattern is EXP.
1426    Do not alter them if the instruction would not alter the cc's.  */
1427
1428 /* On the 68000, all the insns to store in an address register fail to
1429    set the cc's.  However, in some cases these instructions can make it
1430    possibly invalid to use the saved cc's.  In those cases we clear out
1431    some or all of the saved cc's so they won't be used.  */
1432
1433 #define NOTICE_UPDATE_CC(EXP,INSN) notice_update_cc (EXP, INSN)
1434
1435 #define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV)  \
1436 { if (cc_prev_status.flags & CC_IN_68881)                       \
1437     return FLOAT;                                               \
1438   if (cc_prev_status.flags & CC_NO_OVERFLOW)                    \
1439     return NO_OV;                                               \
1440   return NORMAL; }
1441 \f
1442 /* Control the assembler format that we output.  */
1443
1444 /* Output at beginning of assembler file.  */
1445
1446 #define ASM_FILE_START(FILE)    \
1447   fprintf (FILE, "#NO_APP\n");
1448
1449 /* Output to assembler file text saying following lines
1450    may contain character constants, extra white space, comments, etc.  */
1451
1452 #define ASM_APP_ON "#APP\n"
1453
1454 /* Output to assembler file text saying following lines
1455    no longer contain unusual constructs.  */
1456
1457 #define ASM_APP_OFF "#NO_APP\n"
1458
1459 /* Output before read-only data.  */
1460
1461 #define TEXT_SECTION_ASM_OP ".text"
1462
1463 /* Output before writable data.  */
1464
1465 #define DATA_SECTION_ASM_OP ".data"
1466
1467 /* Here are four prefixes that are used by asm_fprintf to
1468    facilitate customization for alternate assembler syntaxes.
1469    Machines with no likelihood of an alternate syntax need not
1470    define these and need not use asm_fprintf.  */
1471
1472 /* The prefix for register names.  Note that REGISTER_NAMES
1473    is supposed to include this prefix.  */
1474
1475 #define REGISTER_PREFIX ""
1476
1477 /* The prefix for local labels.  You should be able to define this as
1478    an empty string, or any arbitrary string (such as ".", ".L%", etc)
1479    without having to make any other changes to account for the specific
1480    definition.  Note it is a string literal, not interpreted by printf
1481    and friends. */
1482
1483 #define LOCAL_LABEL_PREFIX ""
1484
1485 /* The prefix to add to user-visible assembler symbols.  */
1486
1487 #define USER_LABEL_PREFIX "_"
1488
1489 /* The prefix for immediate operands.  */
1490
1491 #define IMMEDIATE_PREFIX "#"
1492
1493 /* How to refer to registers in assembler output.
1494    This sequence is indexed by compiler's hard-register-number (see above).  */
1495
1496 #ifndef SUPPORT_SUN_FPA
1497
1498 #define REGISTER_NAMES \
1499 {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",        \
1500  "a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp",        \
1501  "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7" }
1502
1503 #else /* SUPPORTED_SUN_FPA */
1504
1505 #define REGISTER_NAMES \
1506 {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",        \
1507  "a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp",        \
1508  "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7", \
1509  "fpa0", "fpa1", "fpa2", "fpa3", "fpa4", "fpa5", "fpa6", "fpa7", \
1510  "fpa8", "fpa9", "fpa10", "fpa11", "fpa12", "fpa13", "fpa14", "fpa15", \
1511  "fpa16", "fpa17", "fpa18", "fpa19", "fpa20", "fpa21", "fpa22", "fpa23", \
1512  "fpa24", "fpa25", "fpa26", "fpa27", "fpa28", "fpa29", "fpa30", "fpa31" }
1513
1514 #endif /* defined SUPPORT_SUN_FPA */
1515
1516 /* How to renumber registers for dbx and gdb.
1517    On the Sun-3, the floating point registers have numbers
1518    18 to 25, not 16 to 23 as they do in the compiler.  */
1519
1520 #define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2)
1521
1522 /* This is how to output the definition of a user-level label named NAME,
1523    such as the label on a static function or variable NAME.  */
1524
1525 #define ASM_OUTPUT_LABEL(FILE,NAME)     \
1526   do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1527
1528 /* This is how to output a command to make the user-level label named NAME
1529    defined for reference from other files.  */
1530
1531 #define GLOBAL_ASM_OP ".globl"
1532 #define ASM_GLOBALIZE_LABEL(FILE,NAME)  \
1533   do { fprintf (FILE, "%s ", GLOBAL_ASM_OP);            \
1534        assemble_name (FILE, NAME);                      \
1535        fputs ("\n", FILE);} while (0)
1536
1537 /* This is how to output a reference to a user-level label named NAME.
1538    `assemble_name' uses this.  */
1539
1540 #define ASM_OUTPUT_LABELREF(FILE,NAME)  \
1541   asm_fprintf (FILE, "%0U%s", NAME)
1542
1543 /* This is how to output an internal numbered label where
1544    PREFIX is the class of label and NUM is the number within the class.  */
1545
1546 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)      \
1547   asm_fprintf (FILE, "%0L%s%d:\n", PREFIX, NUM)
1548
1549 /* This is how to store into the string LABEL
1550    the symbol_ref name of an internal numbered label where
1551    PREFIX is the class of label and NUM is the number within the class.
1552    This is suitable for output with `assemble_name'.  */
1553
1554 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)   \
1555   sprintf (LABEL, "*%s%s%d", LOCAL_LABEL_PREFIX, PREFIX, NUM)
1556
1557 /* This is how to output a `long double' extended real constant. */
1558   
1559 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE)                              \
1560 do { long l[3];                                                         \
1561      REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l);                       \
1562      if (sizeof (int) == sizeof (long))                                 \
1563        fprintf (FILE, "\t.long 0x%x,0x%x,0x%x\n", l[0], l[1], l[2]);    \
1564      else                                                               \
1565        fprintf (FILE, "\t.long 0x%lx,0x%lx,0x%lx\n", l[0], l[1], l[2]); \
1566    } while (0)
1567   
1568 /* This is how to output an assembler line defining a `double' constant.  */
1569
1570 #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                           \
1571   do { char dstr[30];                                           \
1572        REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr);            \
1573        fprintf (FILE, "\t.double 0r%s\n", dstr);                \
1574      } while (0)
1575
1576 /* This is how to output an assembler line defining a `float' constant.  */
1577
1578 #define ASM_OUTPUT_FLOAT(FILE,VALUE)                    \
1579 do { long l;                                            \
1580      REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);            \
1581      if (sizeof (int) == sizeof (long))                 \
1582        fprintf (FILE, "\t.long 0x%x\n", l);             \
1583      else                                               \
1584        fprintf (FILE, "\t.long 0x%lx\n", l);            \
1585    } while (0)
1586
1587 /* This is how to output an assembler line defining an `int' constant.  */
1588
1589 #define ASM_OUTPUT_INT(FILE,VALUE)  \
1590 ( fprintf (FILE, "\t.long "),                   \
1591   output_addr_const (FILE, (VALUE)),            \
1592   fprintf (FILE, "\n"))
1593
1594 /* Likewise for `char' and `short' constants.  */
1595
1596 #define ASM_OUTPUT_SHORT(FILE,VALUE)  \
1597 ( fprintf (FILE, "\t.word "),                   \
1598   output_addr_const (FILE, (VALUE)),            \
1599   fprintf (FILE, "\n"))
1600
1601 #define ASM_OUTPUT_CHAR(FILE,VALUE)  \
1602 ( fprintf (FILE, "\t.byte "),                   \
1603   output_addr_const (FILE, (VALUE)),            \
1604   fprintf (FILE, "\n"))
1605
1606 /* This is how to output an assembler line for a numeric constant byte.  */
1607
1608 #define ASM_OUTPUT_BYTE(FILE,VALUE)  \
1609   fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1610
1611 /* This is how to output an insn to push a register on the stack.
1612    It need not be very fast code.  */
1613
1614 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)  \
1615   asm_fprintf (FILE, "\tmovel %s,%Rsp@-\n", reg_names[REGNO])
1616
1617 /* This is how to output an insn to pop a register from the stack.
1618    It need not be very fast code.  */
1619
1620 #define ASM_OUTPUT_REG_POP(FILE,REGNO)  \
1621   asm_fprintf (FILE, "\tmovel %Rsp@+,%s\n", reg_names[REGNO])
1622
1623 /* This is how to output an element of a case-vector that is absolute.
1624    (The 68000 does not use such vectors,
1625    but we must define this macro anyway.)  */
1626
1627 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
1628   asm_fprintf (FILE, "\t.long %LL%d\n", VALUE)
1629
1630 /* This is how to output an element of a case-vector that is relative.  */
1631
1632 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL)  \
1633   asm_fprintf (FILE, "\t.word %LL%d-%LL%d\n", VALUE, REL)
1634
1635 /* This is how to output an assembler line
1636    that says to advance the location counter
1637    to a multiple of 2**LOG bytes.  */
1638
1639 /* We don't have a way to align to more than a two-byte boundary, so do the
1640    best we can and don't complain.  */
1641 #define ASM_OUTPUT_ALIGN(FILE,LOG)      \
1642   if ((LOG) >= 1)                       \
1643     fprintf (FILE, "\t.even\n");
1644
1645 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
1646   fprintf (FILE, "\t.skip %u\n", (SIZE))
1647
1648 /* This says how to output an assembler line
1649    to define a global common symbol.  */
1650
1651 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
1652 ( fputs (".comm ", (FILE)),                     \
1653   assemble_name ((FILE), (NAME)),               \
1654   fprintf ((FILE), ",%u\n", (ROUNDED)))
1655
1656 /* This says how to output an assembler line
1657    to define a local common symbol.  */
1658
1659 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
1660 ( fputs (".lcomm ", (FILE)),                    \
1661   assemble_name ((FILE), (NAME)),               \
1662   fprintf ((FILE), ",%u\n", (ROUNDED)))
1663
1664 /* Store in OUTPUT a string (made with alloca) containing
1665    an assembler-name for a local static variable named NAME.
1666    LABELNO is an integer which is different for each call.  */
1667
1668 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)  \
1669 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),    \
1670   sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1671
1672 /* Define the parentheses used to group arithmetic operations
1673    in assembler code.  */
1674
1675 #define ASM_OPEN_PAREN "("
1676 #define ASM_CLOSE_PAREN ")"
1677
1678 /* Define results of standard character escape sequences.  */
1679 #define TARGET_BELL 007
1680 #define TARGET_BS 010
1681 #define TARGET_TAB 011
1682 #define TARGET_NEWLINE 012
1683 #define TARGET_VT 013
1684 #define TARGET_FF 014
1685 #define TARGET_CR 015
1686
1687 /* Output a float value (represented as a C double) as an immediate operand.
1688    This macro is a 68k-specific macro.  */
1689
1690 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE)               \
1691  do {                                                           \
1692       if (CODE == 'f')                                          \
1693         {                                                       \
1694           char dstr[30];                                        \
1695           REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr);          \
1696           asm_fprintf ((FILE), "%I0r%s", dstr);                 \
1697         }                                                       \
1698       else                                                      \
1699         {                                                       \
1700           long l;                                               \
1701           REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);               \
1702           if (sizeof (int) == sizeof (long))                    \
1703             asm_fprintf ((FILE), "%I0x%x", l);                  \
1704           else                                                  \
1705             asm_fprintf ((FILE), "%I0x%lx", l);                 \
1706         }                                                       \
1707      } while (0)
1708
1709 /* Output a double value (represented as a C double) as an immediate operand.
1710    This macro is a 68k-specific macro.  */
1711 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                           \
1712  do { char dstr[30];                                                    \
1713       REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr);                     \
1714       asm_fprintf (FILE, "%I0r%s", dstr);                               \
1715     } while (0)
1716
1717 /* Note, long double immediate operands are not actually
1718    generated by m68k.md.  */
1719 #define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE)                      \
1720  do { char dstr[30];                                                    \
1721       REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr);                     \
1722       asm_fprintf (FILE, "%I0r%s", dstr);                               \
1723     } while (0)
1724
1725 /* Print operand X (an rtx) in assembler syntax to file FILE.
1726    CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1727    For `%' followed by punctuation, CODE is the punctuation and X is null.
1728
1729    On the 68000, we use several CODE characters:
1730    '.' for dot needed in Motorola-style opcode names.
1731    '-' for an operand pushing on the stack:
1732        sp@-, -(sp) or -(%sp) depending on the style of syntax.
1733    '+' for an operand pushing on the stack:
1734        sp@+, (sp)+ or (%sp)+ depending on the style of syntax.
1735    '@' for a reference to the top word on the stack:
1736        sp@, (sp) or (%sp) depending on the style of syntax.
1737    '#' for an immediate operand prefix (# in MIT and Motorola syntax
1738        but & in SGS syntax).
1739    '!' for the fpcr register (used in some float-to-fixed conversions).
1740    '$' for the letter `s' in an op code, but only on the 68040.
1741    '&' for the letter `d' in an op code, but only on the 68040.
1742    '/' for register prefix needed by longlong.h.
1743
1744    'b' for byte insn (no effect, on the Sun; this is for the ISI).
1745    'd' to force memory addressing to be absolute, not relative.
1746    'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
1747    'w' for FPA insn (print a CONST_DOUBLE as a SunFPA constant rather
1748        than directly).  Second part of 'y' below.
1749    'x' for float insn (print a CONST_DOUBLE as a float rather than in hex),
1750        or print pair of registers as rx:ry.
1751    'y' for a FPA insn (print pair of registers as rx:ry).  This also outputs
1752        CONST_DOUBLE's as SunFPA constant RAM registers if
1753        possible, so it should not be used except for the SunFPA. */
1754
1755 #define PRINT_OPERAND_PUNCT_VALID_P(CODE)                               \
1756   ((CODE) == '.' || (CODE) == '#' || (CODE) == '-'                      \
1757    || (CODE) == '+' || (CODE) == '@' || (CODE) == '!'                   \
1758    || (CODE) == '$' || (CODE) == '&' || (CODE) == '/')
1759
1760 /* A C compound statement to output to stdio stream STREAM the
1761    assembler syntax for an instruction operand X.  X is an RTL
1762    expression.
1763
1764    CODE is a value that can be used to specify one of several ways
1765    of printing the operand.  It is used when identical operands
1766    must be printed differently depending on the context.  CODE
1767    comes from the `%' specification that was used to request
1768    printing of the operand.  If the specification was just `%DIGIT'
1769    then CODE is 0; if the specification was `%LTR DIGIT' then CODE
1770    is the ASCII code for LTR.
1771
1772    If X is a register, this macro should print the register's name.
1773    The names can be found in an array `reg_names' whose type is
1774    `char *[]'.  `reg_names' is initialized from `REGISTER_NAMES'.
1775
1776    When the machine description has a specification `%PUNCT' (a `%'
1777    followed by a punctuation character), this macro is called with
1778    a null pointer for X and the punctuation character for CODE.
1779
1780    See m68k.c for the m68k specific codes.  */
1781
1782 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1783
1784 /* A C compound statement to output to stdio stream STREAM the
1785    assembler syntax for an instruction operand that is a memory
1786    reference whose address is ADDR.  ADDR is an RTL expression.
1787
1788    On some machines, the syntax for a symbolic address depends on
1789    the section that the address refers to.  On these machines,
1790    define the macro `ENCODE_SECTION_INFO' to store the information
1791    into the `symbol_ref', and then check for it here.  */
1792
1793 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
1794
1795
1796 /* Define functions defined in aux-output.c and used in templates.  */
1797
1798 extern char *output_move_double ();
1799 extern char *output_move_const_single ();
1800 extern char *output_move_const_double ();
1801 extern char *output_btst ();
1802 \f
1803 /*
1804 Local variables:
1805 version-control: t
1806 End:
1807 */