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