OSDN Git Service

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