xref: /openbsd/gnu/usr.bin/gcc/gcc/config/m88k/m88k.h (revision 549e7e0d)
1 /* Definitions of target machine for GNU compiler for
2    Motorola m88100 in an 88open OCS/BCS environment.
3    Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
4    2001, 2002 Free Software Foundation, Inc.
5    Contributed by Michael Tiemann (tiemann@cygnus.com).
6    Currently maintained by (gcc@dg-rtp.dg.com)
7 
8 This file is part of GNU CC.
9 
10 GNU CC is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
13 any later version.
14 
15 GNU CC is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with GNU CC; see the file COPYING.  If not, write to
22 the Free Software Foundation, 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA.  */
24 
25 /* The m88100 port of GNU CC adheres to the various standards from 88open.
26    These documents are available by writing:
27 
28 	88open Consortium Ltd.
29 	100 Homeland Court, Suite 800
30 	San Jose, CA  95112
31 	(408) 436-6600
32 
33    In brief, the current standards are:
34 
35    Binary Compatibility Standard, Release 1.1A, May 1991
36 	This provides for portability of application-level software at the
37 	executable level for AT&T System V Release 3.2.
38 
39    Object Compatibility Standard, Release 1.1A, May 1991
40 	This provides for portability of application-level software at the
41 	object file and library level for C, Fortran, and Cobol, and again,
42 	largely for SVR3.
43 
44    Under development are standards for AT&T System V Release 4, based on the
45    [generic] System V Application Binary Interface from AT&T.  These include:
46 
47    System V Application Binary Interface, Motorola 88000 Processor Supplement
48 	Another document from AT&T for SVR4 specific to the m88100.
49 	Available from Prentice Hall.
50 
51    System V Application Binary Interface, Motorola 88000 Processor Supplement,
52    Release 1.1, Draft H, May 6, 1991
53 	A proposed update to the AT&T document from 88open.
54 
55    System V ABI Implementation Guide for the M88000 Processor,
56    Release 1.0, January 1991
57 	A companion ABI document from 88open.  */
58 
59 /* External types used.  */
60 
61 /* What instructions are needed to manufacture an integer constant.  */
62 enum m88k_instruction {
63   m88k_zero,
64   m88k_or,
65   m88k_subu,
66   m88k_or_lo16,
67   m88k_or_lo8,
68   m88k_set,
69   m88k_oru_hi16,
70   m88k_oru_or
71 };
72 
73 /* Which processor to schedule for.  The elements of the enumeration
74    must match exactly the cpu attribute in the m88k.md machine description. */
75 
76 enum processor_type {
77   PROCESSOR_M88100,
78   PROCESSOR_M88110,
79   PROCESSOR_M88000
80 };
81 
82 /* Recast the cpu class to be the cpu attribute.  */
83 #define m88k_cpu_attr ((enum attr_cpu)m88k_cpu)
84 
85 /* External variables/functions defined in m88k.c.  */
86 
87 extern char m88k_volatile_code;
88 
89 extern int m88k_fp_offset;
90 extern int m88k_stack_size;
91 extern int m88k_case_index;
92 
93 extern struct rtx_def *m88k_compare_reg;
94 extern struct rtx_def *m88k_compare_op0;
95 extern struct rtx_def *m88k_compare_op1;
96 
97 extern enum processor_type m88k_cpu;
98 
99 /* external variables defined elsewhere in the compiler */
100 
101 extern int target_flags;			/* -m compiler switches */
102 
103 /*** Controlling the Compilation Driver, `gcc' ***/
104 /* Show we can debug even without a frame pointer.  */
105 #define CAN_DEBUG_WITHOUT_FP
106 
107 /* If -m88100 is in effect, add -D__m88100__; similarly for -m88110.
108    Here, the CPU_DEFAULT is assumed to be -m88100.  */
109 #undef	CPP_SPEC
110 #define	CPP_SPEC "%{!m88000:%{!m88100:%{m88110:-D__m88110__}}} \
111 		  %{!m88000:%{!m88110:-D__m88100__}}"
112 
113 /*** Run-time Target Specification ***/
114 
115 /* Names to predefine in the preprocessor for this target machine.  */
116 #define CPP_PREDEFINES "-Dm88000 -Dm88k -Dunix -D__CLASSIFY_TYPE__=2"
117 
118 #define TARGET_VERSION fprintf (stderr, " (%s)", VERSION_INFO)
119 
120 #define VERSION_INFO	"m88k"
121 
122 /* Run-time compilation parameters selecting different hardware subsets.  */
123 
124 /* Macro to define tables used to set the flags.
125    This is a list in braces of pairs in braces,
126    each pair being { "NAME", VALUE }
127    where VALUE is the bits to set or minus the bits to clear.
128    An empty string NAME is used to identify the default VALUE.  */
129 
130 #define MASK_88100		0x00000001 /* Target m88100 */
131 #define MASK_88110		0x00000002 /* Target m88110 */
132 #define MASK_88000 		(MASK_88100 | MASK_88110)
133 
134 #define MASK_TRAP_LARGE_SHIFT	0x00000100 /* Trap if shift not <= 31 */
135 #define MASK_HANDLE_LARGE_SHIFT	0x00000200 /* Handle shift count >= 32 */
136 #define MASK_CHECK_ZERO_DIV	0x00000400 /* Check for int div. by 0 */
137 #define MASK_USE_DIV		0x00000800 /* No signed div. checks */
138 #define MASK_NO_SERIALIZE_VOLATILE 0x00001000 /* Serialize volatile refs */
139 #define MASK_MEMCPY		0x00002000 /* Always use memcpy for movstr */
140 #define MASK_EITHER_LARGE_SHIFT	(MASK_TRAP_LARGE_SHIFT | \
141 				 MASK_HANDLE_LARGE_SHIFT)
142 #define MASK_OMIT_LEAF_FRAME_POINTER 0x00004000 /* omit leaf frame pointers */
143 
144 
145 #define TARGET_88100   		 ((target_flags & MASK_88000) == MASK_88100)
146 #define TARGET_88110		 ((target_flags & MASK_88000) == MASK_88110)
147 #define TARGET_88000		 ((target_flags & MASK_88000) == MASK_88000)
148 
149 #define TARGET_TRAP_LARGE_SHIFT   (target_flags & MASK_TRAP_LARGE_SHIFT)
150 #define TARGET_HANDLE_LARGE_SHIFT (target_flags & MASK_HANDLE_LARGE_SHIFT)
151 #define TARGET_CHECK_ZERO_DIV	  (target_flags & MASK_CHECK_ZERO_DIV)
152 #define	TARGET_USE_DIV		  (target_flags & MASK_USE_DIV)
153 #define TARGET_SERIALIZE_VOLATILE (!(target_flags & MASK_NO_SERIALIZE_VOLATILE))
154 #define TARGET_MEMCPY		  (target_flags & MASK_MEMCPY)
155 
156 #define TARGET_EITHER_LARGE_SHIFT (target_flags & MASK_EITHER_LARGE_SHIFT)
157 #define TARGET_OMIT_LEAF_FRAME_POINTER (target_flags & MASK_OMIT_LEAF_FRAME_POINTER)
158 
159 #define TARGET_DEFAULT	(MASK_CHECK_ZERO_DIV)
160 #define CPU_DEFAULT MASK_88100
161 
162 #define TARGET_SWITCHES							\
163 {									\
164   { "88110",				 MASK_88110,			\
165     N_("Generate code for a 88110 processor") },			\
166   { "88100",				 MASK_88100,			\
167     N_("Generate code for a 88100 processor") },			\
168   { "88000",			         MASK_88000,			\
169     N_("Generate code compatible with both 88100 and 88110 processors") }, \
170   { "trap-large-shift",			 MASK_TRAP_LARGE_SHIFT,		\
171     N_("Add code to trap on logical shift counts larger than 31") },	\
172   { "handle-large-shift",		 MASK_HANDLE_LARGE_SHIFT,	\
173     N_("Add code to handle logical shift counts larger than 31") },	\
174   { "check-zero-division",		 MASK_CHECK_ZERO_DIV,		\
175     N_("Add code to trap on integer divide by zero") },			\
176   { "no-check-zero-division",		-MASK_CHECK_ZERO_DIV,		\
177     N_("Do not add code to trap on integer divide by zero") },		\
178   { "use-div-instruction",		 MASK_USE_DIV,			\
179     N_("Use the \"div\" instruction for signed integer divide") },	\
180   { "no-serialize-volatile",		 MASK_NO_SERIALIZE_VOLATILE,	\
181     N_("Do not force serialization on volatile memory access") },	\
182   { "serialize-volatile",		-MASK_NO_SERIALIZE_VOLATILE,	\
183     N_("Force serialization on volatile memory access") },		\
184   { "omit-leaf-frame-pointer",		 MASK_OMIT_LEAF_FRAME_POINTER,	\
185     N_("Do not save the frame pointer in leaf functions") },		\
186   { "no-omit-leaf-frame-pointer",	-MASK_OMIT_LEAF_FRAME_POINTER,	\
187     N_("Save the frame pointer in leaf functions") },			\
188   { "memcpy",				 MASK_MEMCPY,			\
189     N_("Force all memory copies to use memcpy()") },			\
190   { "no-memcpy",			-MASK_MEMCPY,			\
191     N_("Allow the use of specific memory copy code") },			\
192   SUBTARGET_SWITCHES							\
193   /* Default switches */						\
194   { "",				 	TARGET_DEFAULT,			\
195     NULL },								\
196 }
197 
198 #define SUBTARGET_SWITCHES
199 
200 /* Do any checking or such that is needed after processing the -m switches.  */
201 #define OVERRIDE_OPTIONS m88k_override_options ()
202 
203 /*** Storage Layout ***/
204 
205 /* Sizes in bits of the various types.  */
206 #define SHORT_TYPE_SIZE		16
207 #define INT_TYPE_SIZE		32
208 #define LONG_TYPE_SIZE		32
209 #define LONG_LONG_TYPE_SIZE	64
210 #define FLOAT_TYPE_SIZE		32
211 #define	DOUBLE_TYPE_SIZE	64
212 #define LONG_DOUBLE_TYPE_SIZE	64
213 
214 /* Define this if most significant bit is lowest numbered
215    in instructions that operate on numbered bit-fields.
216    Somewhat arbitrary.  It matches the bit field patterns.  */
217 #define BITS_BIG_ENDIAN 1
218 
219 /* Define this if most significant byte of a word is the lowest numbered.
220    That is true on the m88000.  */
221 #define BYTES_BIG_ENDIAN 1
222 
223 /* Define this if most significant word of a multiword number is the lowest
224    numbered.
225    For the m88000 we can decide arbitrarily since there are no machine
226    instructions for them.  */
227 #define WORDS_BIG_ENDIAN 1
228 
229 /* Width of a word, in units (bytes).  */
230 #define UNITS_PER_WORD 4
231 
232 /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
233 #define PARM_BOUNDARY 32
234 
235 /* Largest alignment for stack parameters (if greater than PARM_BOUNDARY).  */
236 #define MAX_PARM_BOUNDARY 64
237 
238 /* Boundary (in *bits*) on which stack pointer should be aligned.  */
239 #define STACK_BOUNDARY 128
240 
241 /* Allocation boundary (in *bits*) for the code of a function.  */
242 #define FUNCTION_BOUNDARY 32
243 
244 /* No data type wants to be aligned rounder than this.  */
245 #define BIGGEST_ALIGNMENT 64
246 
247 /* The best alignment to use in cases where we have a choice.  */
248 #define FASTEST_ALIGNMENT (TARGET_88100 ? 32 : 64)
249 
250 /* Make strings 4/8 byte aligned so strcpy from constants will be faster.  */
251 #define CONSTANT_ALIGNMENT(EXP, ALIGN)  \
252   ((TREE_CODE (EXP) == STRING_CST	\
253     && (ALIGN) < FASTEST_ALIGNMENT)	\
254    ? FASTEST_ALIGNMENT : (ALIGN))
255 
256 /* Make arrays of chars 4/8 byte aligned for the same reasons.  */
257 #define DATA_ALIGNMENT(TYPE, ALIGN)		\
258   (TREE_CODE (TYPE) == ARRAY_TYPE		\
259    && TYPE_MODE (TREE_TYPE (TYPE)) == QImode	\
260    && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
261 
262 /* Alignment of field after `int : 0' in a structure.
263    Ignored with PCC_BITFIELD_TYPE_MATTERS.  */
264 /* #define EMPTY_FIELD_BOUNDARY 8 */
265 
266 /* Every structure's size must be a multiple of this.  */
267 #define STRUCTURE_SIZE_BOUNDARY 8
268 
269 /* Set this nonzero if move instructions will actually fail to work
270    when given unaligned data.  */
271 #define STRICT_ALIGNMENT 1
272 
273 /* A bit-field declared as `int' forces `int' alignment for the struct.  */
274 #define PCC_BITFIELD_TYPE_MATTERS 1
275 
276 /* Maximum size (in bits) to use for the largest integral type that
277    replaces a BLKmode type. */
278 /* #define MAX_FIXED_MODE_SIZE 0 */
279 
280 /*** Register Usage ***/
281 
282 /* No register prefixes by default.  Will be overriden if necessary.  */
283 #undef REGISTER_PREFIX
284 
285 /* Number of actual hardware registers.
286    The hardware registers are assigned numbers for the compiler
287    from 0 to just below FIRST_PSEUDO_REGISTER.
288    All registers that the compiler knows about must be given numbers,
289    even those that are not normally considered general registers.
290 
291    The m88100 has a General Register File (GRF) of 32 32-bit registers.
292    The m88110 adds an Extended Register File (XRF) of 32 80-bit registers.  */
293 #define FIRST_PSEUDO_REGISTER 64
294 #define FIRST_EXTENDED_REGISTER 32
295 
296 /*  General notes on extended registers, their use and misuse.
297 
298     Possible good uses:
299 
300     spill area instead of memory.
301       -waste if only used once
302 
303     floating point calculations
304       -probably a waste unless we have run out of general purpose registers
305 
306     freeing up general purpose registers
307       -e.g. may be able to have more loop invariants if floating
308        point is moved into extended registers.
309 
310 
311     I've noticed wasteful moves into and out of extended registers; e.g. a load
312     into x21, then inside a loop a move into r24, then r24 used as input to
313     an fadd.  Why not just load into r24 to begin with?  Maybe the new cse.c
314     will address this.  This wastes a move, but the load,store and move could
315     have been saved had extended registers been used throughout.
316     E.g. in the code following code, if z and xz are placed in extended
317     registers, there is no need to save preserve registers.
318 
319 	long c=1,d=1,e=1,f=1,g=1,h=1,i=1,j=1,k;
320 
321 	double z=0,xz=4.5;
322 
323 	foo(a,b)
324 	long a,b;
325 	{
326 	  while (a < b)
327 	    {
328 	      k = b + c + d + e + f + g + h + a + i + j++;
329 	      z += xz;
330 	      a++;
331 	    }
332 	  printf("k= %d; z=%f;\n", k, z);
333 	}
334 
335     I've found that it is possible to change the constraints (putting * before
336     the 'r' constraints int the fadd.ddd instruction) and get the entire
337     addition and store to go into extended registers.  However, this also
338     forces simple addition and return of floating point arguments to a
339     function into extended registers.  Not the correct solution.
340 
341     Found the following note in local-alloc.c which may explain why I can't
342     get both registers to be in extended registers since two are allocated in
343     local-alloc and one in global-alloc.  Doesn't explain (I don't believe)
344     why an extended register is used instead of just using the preserve
345     register.
346 
347 	from local-alloc.c:
348 	We have provision to exempt registers, even when they are contained
349 	within the block, that can be tied to others that are not contained in it.
350 	This is so that global_alloc could process them both and tie them then.
351 	But this is currently disabled since tying in global_alloc is not
352 	yet implemented.
353 
354     The explanation of why the preserved register is not used is as follows,
355     I believe.  The registers are being allocated in order.  Tying is not
356     done so efficiently, so when it comes time to do the first allocation,
357     there are no registers left to use without spilling except extended
358     registers.  Then when the next pseudo register needs a hard reg, there
359     are still no registers to be had for free, but this one must be a GRF
360     reg instead of an extended reg, so a preserve register is spilled.  Thus
361     the move from extended to GRF is necessitated.  I do not believe this can
362     be 'fixed' through the files in config/m88k.
363 
364     gcc seems to sometimes make worse use of register allocation -- not counting
365     moves -- whenever extended registers are present.  For example in the
366     whetstone, the simple for loop (slightly modified)
367       for(i = 1; i <= n1; i++)
368 	{
369 	  x1 = (x1 + x2 + x3 - x4) * t;
370 	  x2 = (x1 + x2 - x3 + x4) * t;
371 	  x3 = (x1 - x2 + x3 + x4) * t;
372 	  x4 = (x1 + x2 + x3 + x4) * t;
373 	}
374     in general loads the high bits of the addresses of x2-x4 and i into registers
375     outside the loop.  Whenever extended registers are used, it loads all of
376     these inside the loop. My conjecture is that since the 88110 has so many
377     registers, and gcc makes no distinction at this point -- just that they are
378     not fixed, that in loop.c it believes it can expect a number of registers
379     to be available.  Then it allocates 'too many' in local-alloc which causes
380     problems later.  'Too many' are allocated because a large portion of the
381     registers are extended registers and cannot be used for certain purposes
382     ( e.g. hold the address of a variable).  When this loop is compiled on its
383     own, the problem does not occur.  I don't know the solution yet, though it
384     is probably in the base sources.  Possibly a different way to calculate
385     "threshold".  */
386 
387 /* 1 for registers that have pervasive standard uses and are not available
388    for the register allocator.  Registers r14-r25 and x22-x29 are expected
389    to be preserved across function calls.
390 
391    On the 88000, the standard uses of the General Register File (GRF) are:
392    Reg 0	= Pseudo argument pointer (hardware fixed to 0).
393    Reg 1	= Subroutine return pointer (hardware).
394    Reg 2-9	= Parameter registers (OCS).
395    Reg 10	= OCS reserved temporary.
396    Reg 11	= Static link if needed [OCS reserved temporary].
397    Reg 12	= Address of structure return (OCS).
398    Reg 13	= OCS reserved temporary.
399    Reg 14-25	= Preserved register set.
400    Reg 26-29	= Reserved by OCS and ABI.
401    Reg 30	= Frame pointer (Common use).
402    Reg 31	= Stack pointer.
403 
404    The following follows the current 88open UCS specification for the
405    Extended Register File (XRF):
406    Reg 32       = x0		Always equal to zero
407    Reg 33-53	= x1-x21	Temporary registers (Caller Save)
408    Reg 54-61	= x22-x29	Preserver registers (Callee Save)
409    Reg 62-63	= x30-x31	Reserved for future ABI use.
410 
411    Note:  The current 88110 extended register mapping is subject to change.
412 	  The bias towards caller-save registers is based on the
413 	  presumption that memory traffic can potentially be reduced by
414 	  allowing the "caller" to save only that part of the register
415 	  which is actually being used.  (i.e. don't do a st.x if a st.d
416 	  is sufficient).  Also, in scientific code (a.k.a. Fortran), the
417 	  large number of variables defined in common blocks may require
418 	  that almost all registers be saved across calls anyway.  */
419 
420 #define FIXED_REGISTERS \
421  {1, 0, 0, 0,  0, 0, 0, 0,   0, 0, 0, 0,  0, 0, 0, 0, \
422   0, 0, 0, 0,  0, 0, 0, 0,   0, 0, 1, 1,  1, 1, 1, 1, \
423   1, 0, 0, 0,  0, 0, 0, 0,   0, 0, 0, 0,  0, 0, 0, 0, \
424   0, 0, 0, 0,  0, 0, 0, 0,   0, 0, 0, 0,  0, 0, 1, 1}
425 
426 /* 1 for registers not available across function calls.
427    These must include the FIXED_REGISTERS and also any
428    registers that can be used without being saved.
429    The latter must include the registers where values are returned
430    and the register where structure-value addresses are passed.
431    Aside from that, you can include as many other registers as you like.  */
432 
433 #define CALL_USED_REGISTERS \
434  {1, 1, 1, 1,  1, 1, 1, 1,   1, 1, 1, 1,  1, 1, 0, 0, \
435   0, 0, 0, 0,  0, 0, 0, 0,   0, 0, 1, 1,  1, 1, 1, 1, \
436   1, 1, 1, 1,  1, 1, 1, 1,   1, 1, 1, 1,  1, 1, 1, 1, \
437   1, 1, 1, 1,  1, 1, 0, 0,   0, 0, 0, 0,  0, 0, 1, 1}
438 
439 /* Macro to conditionally modify fixed_regs/call_used_regs.  */
440 #define CONDITIONAL_REGISTER_USAGE			\
441   {							\
442     if (! TARGET_88110)					\
443       {							\
444 	register int i;					\
445 	  for (i = FIRST_EXTENDED_REGISTER; i < FIRST_PSEUDO_REGISTER; i++) \
446 	    {						\
447 	      fixed_regs[i] = 1;			\
448 	      call_used_regs[i] = 1;			\
449 	    }						\
450       }							\
451     if (flag_pic)					\
452       {							\
453 	fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;	\
454 	call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1;	\
455       }							\
456   }
457 
458 /* True if register is an extended register.  */
459 #define XRF_REGNO_P(N) ((N) < FIRST_PSEUDO_REGISTER && (N) >= FIRST_EXTENDED_REGISTER)
460 
461 /* Return number of consecutive hard regs needed starting at reg REGNO
462    to hold something of mode MODE.
463    This is ordinarily the length in words of a value of mode MODE
464    but can be less for certain modes in special long registers.
465 
466    On the m88000, GRF registers hold 32-bits and XRF registers hold 80-bits.
467    An XRF register can hold any mode, but two GRF registers are required
468    for larger modes.  */
469 #define HARD_REGNO_NREGS(REGNO, MODE)					\
470   (XRF_REGNO_P (REGNO)                                                 \
471    ? 1 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
472 
473 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
474 
475    For double integers, we never put the value into an odd register so that
476    the operators don't run into the situation where the high part of one of
477    the inputs is the low part of the result register.  (It's ok if the output
478    registers are the same as the input registers.)  The XRF registers can
479    hold all modes, but only DF and SF modes can be manipulated in these
480    registers.  The compiler should be allowed to use these as a fast spill
481    area.  */
482 #define HARD_REGNO_MODE_OK(REGNO, MODE)					\
483   (XRF_REGNO_P (REGNO)							\
484     ? (TARGET_88110 && GET_MODE_CLASS (MODE) == MODE_FLOAT)             \
485     : (((MODE) != DImode && (MODE) != DFmode && (MODE) != DCmode)	\
486        || ((REGNO) & 1) == 0))
487 
488 /* Value is 1 if it is a good idea to tie two pseudo registers
489    when one has mode MODE1 and one has mode MODE2.
490    If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
491    for any hard reg, then this must be 0 for correct output.  */
492 #define MODES_TIEABLE_P(MODE1, MODE2) \
493   (((MODE1) == DFmode || (MODE1) == DCmode || (MODE1) == DImode \
494     || (TARGET_88110 && GET_MODE_CLASS (MODE1) == MODE_FLOAT)) \
495    == ((MODE2) == DFmode || (MODE2) == DCmode || (MODE2) == DImode \
496        || (TARGET_88110 && GET_MODE_CLASS (MODE2) == MODE_FLOAT)))
497 
498 /* Specify the registers used for certain standard purposes.
499    The values of these macros are register numbers.  */
500 
501 /* the m88000 pc isn't overloaded on a register that the compiler knows about.  */
502 /* #define PC_REGNUM  */
503 
504 /* Register to use for pushing function arguments.  */
505 #define STACK_POINTER_REGNUM 31
506 
507 /* Base register for access to local variables of the function.  */
508 #define FRAME_POINTER_REGNUM 30
509 
510 /* Base register for access to arguments of the function.  */
511 #define ARG_POINTER_REGNUM 0
512 
513 /* Register used in cases where a temporary is known to be safe to use.  */
514 #define TEMP_REGNUM 10
515 
516 /* Register in which static-chain is passed to a function.  */
517 #define STATIC_CHAIN_REGNUM 11
518 
519 /* Register in which address to store a structure value
520    is passed to a function.  */
521 #define STRUCT_VALUE_REGNUM 12
522 
523 /* Register to hold the addressing base for position independent
524    code access to data items.  */
525 #define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 25 : INVALID_REGNUM)
526 
527 /* Order in which registers are preferred (most to least).  Use temp
528    registers, then param registers top down.  Preserve registers are
529    top down to maximize use of double memory ops for register save.
530    The 88open reserved registers (r26-r29 and x30-x31) may commonly be used
531    in most environments with the -fcall-used- or -fcall-saved- options.  */
532 #define REG_ALLOC_ORDER		  \
533  {				  \
534   13, 12, 11, 10, 29, 28, 27, 26, \
535   62, 63,  9,  8,  7,  6,  5,  4, \
536    3,  2,  1, 53, 52, 51, 50, 49, \
537   48, 47, 46, 45, 44, 43, 42, 41, \
538   40, 39, 38, 37, 36, 35, 34, 33, \
539   25, 24, 23, 22, 21, 20, 19, 18, \
540   17, 16, 15, 14, 61, 60, 59, 58, \
541   57, 56, 55, 54, 30, 31,  0, 32}
542 
543 /* Order for leaf functions.  */
544 #define REG_LEAF_ALLOC_ORDER	  \
545  {				  \
546    9,  8,  7,  6, 13, 12, 11, 10, \
547   29, 28, 27, 26, 62, 63,  5,  4, \
548    3,  2,  0, 53, 52, 51, 50, 49, \
549   48, 47, 46, 45, 44, 43, 42, 41, \
550   40, 39, 38, 37, 36, 35, 34, 33, \
551   25, 24, 23, 22, 21, 20, 19, 18, \
552   17, 16, 15, 14, 61, 60, 59, 58, \
553   57, 56, 55, 54, 30, 31,  1, 32}
554 
555 /* Switch between the leaf and non-leaf orderings.  The purpose is to avoid
556    write-over scoreboard delays between caller and callee.  */
557 #define ORDER_REGS_FOR_LOCAL_ALLOC				\
558 {								\
559   static const int leaf[] = REG_LEAF_ALLOC_ORDER;		\
560   static const int nonleaf[] = REG_ALLOC_ORDER;			\
561 								\
562   memcpy (reg_alloc_order, regs_ever_live[1] ? nonleaf : leaf,	\
563 	  FIRST_PSEUDO_REGISTER * sizeof (int));		\
564 }
565 
566 /*** Register Classes ***/
567 
568 /* Define the classes of registers for register constraints in the
569    machine description.  Also define ranges of constants.
570 
571    One of the classes must always be named ALL_REGS and include all hard regs.
572    If there is more than one class, another class must be named NO_REGS
573    and contain no registers.
574 
575    The name GENERAL_REGS must be the name of a class (or an alias for
576    another name such as ALL_REGS).  This is the class of registers
577    that is allowed by "g" or "r" in a register constraint.
578    Also, registers outside this class are allocated only when
579    instructions express preferences for them.
580 
581    The classes must be numbered in nondecreasing order; that is,
582    a larger-numbered class must never be contained completely
583    in a smaller-numbered class.
584 
585    For any two classes, it is very desirable that there be another
586    class that represents their union.  */
587 
588 /* The m88000 hardware has two kinds of registers.  In addition, we denote
589    the arg pointer as a separate class.  */
590 
591 enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS,
592 		 XGRF_REGS, ALL_REGS, LIM_REG_CLASSES };
593 
594 #define N_REG_CLASSES (int) LIM_REG_CLASSES
595 
596 /* Give names of register classes as strings for dump file.   */
597 #define REG_CLASS_NAMES {"NO_REGS", "AP_REG", "XRF_REGS", "GENERAL_REGS", \
598 			 "AGRF_REGS", "XGRF_REGS", "ALL_REGS" }
599 
600 /* Define which registers fit in which classes.
601    This is an initializer for a vector of HARD_REG_SET
602    of length N_REG_CLASSES.  */
603 #define REG_CLASS_CONTENTS {{0x00000000, 0x00000000},	\
604 			    {0x00000001, 0x00000000},	\
605 			    {0x00000000, 0xffffffff},	\
606 			    {0xfffffffe, 0x00000000},	\
607 			    {0xffffffff, 0x00000000},	\
608 			    {0xfffffffe, 0xffffffff},	\
609 			    {0xffffffff, 0xffffffff}}
610 
611 /* The same information, inverted:
612    Return the class number of the smallest class containing
613    reg number REGNO.  This could be a conditional expression
614    or could index an array.  */
615 #define REGNO_REG_CLASS(REGNO) \
616   ((REGNO) ? ((REGNO) < 32 ? GENERAL_REGS : XRF_REGS) : AP_REG)
617 
618 /* The class value for index registers, and the one for base regs.  */
619 #define BASE_REG_CLASS AGRF_REGS
620 #define INDEX_REG_CLASS GENERAL_REGS
621 
622 /* Get reg_class from a letter such as appears in the machine description.
623    For the 88000, the following class/letter is defined for the XRF:
624 	x - Extended register file  */
625 #define REG_CLASS_FROM_LETTER(C) 	\
626    (((C) == 'x') ? XRF_REGS : NO_REGS)
627 
628 /* Macros to check register numbers against specific register classes.
629    These assume that REGNO is a hard or pseudo reg number.
630    They give nonzero only if REGNO is a hard reg of the suitable class
631    or a pseudo reg currently allocated to a suitable hard reg.
632    Since they use reg_renumber, they are safe only once reg_renumber
633    has been allocated, which happens in local-alloc.c.  */
634 #define REGNO_OK_FOR_BASE_P(REGNO)				\
635   ((REGNO) < FIRST_EXTENDED_REGISTER				\
636    || (unsigned) reg_renumber[REGNO] < FIRST_EXTENDED_REGISTER)
637 #define REGNO_OK_FOR_INDEX_P(REGNO)				\
638   (((REGNO) && (REGNO) < FIRST_EXTENDED_REGISTER)		\
639    || (unsigned) reg_renumber[REGNO] < FIRST_EXTENDED_REGISTER)
640 
641 /* Given an rtx X being reloaded into a reg required to be
642    in class CLASS, return the class of reg to actually use.
643    In general this is just CLASS; but on some machines
644    in some cases it is preferable to use a more restrictive class.
645    Double constants should be in a register iff they can be made cheaply.  */
646 #define PREFERRED_RELOAD_CLASS(X,CLASS)	\
647    (CONSTANT_P (X) && ((CLASS) == XRF_REGS) ? NO_REGS : (CLASS))
648 
649 /* Return the register class of a scratch register needed to load IN
650    into a register of class CLASS in MODE.  On the m88k, when PIC, we
651    need a temporary when loading some addresses into a register.  */
652 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, IN)		\
653   ((flag_pic							\
654     && GET_CODE (IN) == CONST					\
655     && GET_CODE (XEXP (IN, 0)) == PLUS				\
656     && GET_CODE (XEXP (XEXP (IN, 0), 0)) == CONST_INT		\
657     && ! SMALL_INT (XEXP (XEXP (IN, 0), 1))) ? GENERAL_REGS : NO_REGS)
658 
659 /* Return the maximum number of consecutive registers
660    needed to represent mode MODE in a register of class CLASS.  */
661 #define CLASS_MAX_NREGS(CLASS, MODE) \
662   ((((CLASS) == XRF_REGS) ? 1 \
663     : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)))
664 
665 /* Letters in the range `I' through `P' in a register constraint string can
666    be used to stand for particular ranges of immediate operands.  The C
667    expression is true iff C is a known letter and VALUE is appropriate for
668    that letter.
669 
670    For the m88000, the following constants are used:
671    `I' requires a non-negative 16-bit value.
672    `J' requires a non-positive 16-bit value.
673    `K' requires a non-negative value < 32.
674    `L' requires a constant with only the upper 16-bits set.
675    `M' requires constant values that can be formed with `set'.
676    `N' requires a negative value.
677    `O' requires zero.
678    `P' requires a non-negative value.  */
679 
680 /* Quick tests for certain values.  */
681 #define SMALL_INT(X) (SMALL_INTVAL (INTVAL (X)))
682 #define SMALL_INTVAL(I) ((unsigned HOST_WIDE_INT) (I) < 0x10000)
683 #define ADD_INT(X) (ADD_INTVAL (INTVAL (X)))
684 #define ADD_INTVAL(I) ((unsigned HOST_WIDE_INT) (I) + 0xffff < 0x1ffff)
685 #define POWER_OF_2(I) ((I) && POWER_OF_2_or_0(I))
686 #define POWER_OF_2_or_0(I) (((I) & ((unsigned HOST_WIDE_INT)(I) - 1)) == 0)
687 
688 #define CONST_OK_FOR_LETTER_P(VALUE, C)			\
689   ((C) == 'I' ? SMALL_INTVAL (VALUE)			\
690    : (C) == 'J' ? SMALL_INTVAL (-(VALUE))		\
691    : (C) == 'K' ? (unsigned HOST_WIDE_INT)(VALUE) < 32	\
692    : (C) == 'L' ? ((VALUE) & 0xffff) == 0		\
693    : (C) == 'M' ? integer_ok_for_set (VALUE)		\
694    : (C) == 'N' ? (VALUE) < 0				\
695    : (C) == 'O' ? (VALUE) == 0				\
696    : (C) == 'P' ? (VALUE) >= 0				\
697    : 0)
698 
699 /* Similar, but for floating constants, and defining letters G and H.
700    Here VALUE is the CONST_DOUBLE rtx itself.  For the m88000, the
701    constraints are:  `G' requires zero, and `H' requires one or two.  */
702 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)				\
703   ((C) == 'G' ? (CONST_DOUBLE_HIGH (VALUE) == 0				\
704 		 && CONST_DOUBLE_LOW (VALUE) == 0)			\
705    : 0)
706 
707 /* Letters in the range `Q' through `U' in a register constraint string
708    may be defined in a machine-dependent fashion to stand for arbitrary
709    operand types.
710 
711    For the m88k, `Q' handles addresses in a call context.  */
712 
713 #define EXTRA_CONSTRAINT(OP, C)				\
714   ((C) == 'Q' ? symbolic_address_p (OP) : 0)
715 
716 /*** Describing Stack Layout ***/
717 
718 /* Define this if pushing a word on the stack moves the stack pointer
719    to a smaller address.  */
720 #define STACK_GROWS_DOWNWARD
721 
722 /* Define this if the addresses of local variable slots are at negative
723    offsets from the frame pointer.  */
724 /* #define FRAME_GROWS_DOWNWARD */
725 
726 /* Offset from the frame pointer to the first local variable slot to be
727    allocated. For the m88k, the debugger wants the return address (r1)
728    stored at location r30+4, and the previous frame pointer stored at
729    location r30.  */
730 #define STARTING_FRAME_OFFSET 8
731 
732 /* If we generate an insn to push BYTES bytes, this says how many the
733    stack pointer really advances by.  The m88k has no push instruction.  */
734 /*  #define PUSH_ROUNDING(BYTES) */
735 
736 /* If defined, the maximum amount of space required for outgoing arguments
737    will be computed and placed into the variable
738    `current_function_outgoing_args_size'.  No space will be pushed
739    onto the stack for each call; instead, the function prologue should
740    increase the stack frame size by this amount.  */
741 #define ACCUMULATE_OUTGOING_ARGS 1
742 
743 /* Offset from the stack pointer register to the first location at which
744    outgoing arguments are placed.  Use the default value zero.  */
745 /* #define STACK_POINTER_OFFSET 0 */
746 
747 /* Offset of first parameter from the argument pointer register value.
748    Using an argument pointer, this is 0 for the m88k.  GCC knows
749    how to eliminate the argument pointer references if necessary.  */
750 #define FIRST_PARM_OFFSET(FNDECL) 0
751 
752 /* Define this if functions should assume that stack space has been
753    allocated for arguments even when their values are passed in
754    registers.
755 
756    The value of this macro is the size, in bytes, of the area reserved for
757    arguments passed in registers.
758 
759    This space can either be allocated by the caller or be a part of the
760    machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE'
761    says which.  */
762 /* #undef REG_PARM_STACK_SPACE(FNDECL) */
763 
764 /* Define this macro if REG_PARM_STACK_SPACE is defined but stack
765    parameters don't skip the area specified by REG_PARM_STACK_SPACE.
766    Normally, when a parameter is not passed in registers, it is placed on
767    the stack beyond the REG_PARM_STACK_SPACE area.  Defining this macro
768    suppresses this behavior and causes the parameter to be passed on the
769    stack in its natural location.  */
770 /* #undef STACK_PARMS_IN_REG_PARM_AREA */
771 
772 /* Define this if it is the responsibility of the caller to allocate the
773    area reserved for arguments passed in registers.  If
774    `ACCUMULATE_OUTGOING_ARGS' is also defined, the only effect of this
775    macro is to determine whether the space is included in
776    `current_function_outgoing_args_size'.  */
777 /* #define OUTGOING_REG_PARM_STACK_SPACE */
778 
779 /* Offset from the stack pointer register to an item dynamically allocated
780    on the stack, e.g., by `alloca'.
781 
782    The default value for this macro is `STACK_POINTER_OFFSET' plus the
783    length of the outgoing arguments.  The default is correct for most
784    machines.  See `function.c' for details.  */
785 /* #define STACK_DYNAMIC_OFFSET(FUNDECL) ... */
786 
787 /* Value is the number of bytes of arguments automatically
788    popped when returning from a subroutine call.
789    FUNDECL is the declaration node of the function (as a tree),
790    FUNTYPE is the data type of the function (as a tree),
791    or for a library call it is an identifier node for the subroutine name.
792    SIZE is the number of bytes of arguments passed on the stack.  */
793 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
794 
795 /* Define how to find the value returned by a function.
796    VALTYPE is the data type of the value (as a tree).
797    If the precise function being called is known, FUNC is its FUNCTION_DECL;
798    otherwise, FUNC is 0.  */
799 #define FUNCTION_VALUE(VALTYPE, FUNC) \
800   gen_rtx_REG (TYPE_MODE (VALTYPE) == BLKmode ? SImode : TYPE_MODE (VALTYPE), \
801 	       2)
802 
803 /* Define this if it differs from FUNCTION_VALUE.  */
804 /* #define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) ... */
805 
806 /* Disable the promotion of some structures and unions to registers.
807    Note that this matches FUNCTION_ARG behaviour.  */
808 #define RETURN_IN_MEMORY(TYPE) \
809   (TYPE_MODE (TYPE) == BLKmode \
810    || ((TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE (TYPE) == UNION_TYPE) \
811        && (TYPE_ALIGN (TYPE) != BITS_PER_WORD || \
812 	   GET_MODE_SIZE (TYPE_MODE (TYPE)) != UNITS_PER_WORD)))
813 
814 /* Don't default to pcc-struct-return, because we have already specified
815    exactly how to return structures in the RETURN_IN_MEMORY macro.  */
816 #define DEFAULT_PCC_STRUCT_RETURN 0
817 
818 /* Define how to find the value returned by a library function
819    assuming the value has mode MODE.  */
820 #define LIBCALL_VALUE(MODE)  gen_rtx_REG (MODE, 2)
821 
822 /* True if N is a possible register number for a function value
823    as seen by the caller.  */
824 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 2)
825 
826 /* Determine whether a function argument is passed in a register, and
827    which register.  See m88k.c.  */
828 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
829   m88k_function_arg (CUM, MODE, TYPE, NAMED)
830 
831 /* Define this if it differs from FUNCTION_ARG.  */
832 /* #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) ... */
833 
834 /* A C expression for the number of words, at the beginning of an
835    argument, must be put in registers.  The value must be zero for
836    arguments that are passed entirely in registers or that are entirely
837    pushed on the stack.  */
838 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) (0)
839 
840 /* A C expression that indicates when an argument must be passed by
841    reference.  If nonzero for an argument, a copy of that argument is
842    made in memory and a pointer to the argument is passed instead of the
843    argument itself.  The pointer is passed in whatever way is appropriate
844    for passing a pointer to that type.  */
845 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
846   m88k_function_arg_pass_by_reference(&CUM, MODE, TYPE, NAMED)
847 
848 /* A C type for declaring a variable that is used as the first argument
849    of `FUNCTION_ARG' and other related values.  It suffices to count
850    the number of words of argument so far.  */
851 #define CUMULATIVE_ARGS int
852 
853 /* Initialize a variable CUM of type CUMULATIVE_ARGS for a call to a
854    function whose data type is FNTYPE.  For a library call, FNTYPE is 0. */
855 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) ((CUM) = 0)
856 
857 /* Update the summarizer variable to advance past an argument in an
858    argument list.  See m88k.c.  */
859 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
860   m88k_function_arg_advance (& (CUM), MODE, TYPE, NAMED)
861 
862 /* True if N is a possible register number for function argument passing.
863    On the m88000, these are registers 2 through 9.  */
864 #define FUNCTION_ARG_REGNO_P(N) ((N) <= 9 && (N) >= 2)
865 
866 /* A C expression which determines whether, and in which direction,
867    to pad out an argument with extra space.  The value should be of
868    type `enum direction': either `upward' to pad above the argument,
869    `downward' to pad below, or `none' to inhibit padding.
870 
871    This macro does not control the *amount* of padding; that is always
872    just enough to reach the next multiple of `FUNCTION_ARG_BOUNDARY'.  */
873 #define FUNCTION_ARG_PADDING(MODE, TYPE) \
874   ((MODE) == BLKmode \
875    || ((TYPE) && (TREE_CODE (TYPE) == RECORD_TYPE \
876 		  || TREE_CODE (TYPE) == UNION_TYPE)) \
877    ? upward : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY ? downward : none)
878 
879 /* If defined, a C expression that gives the alignment boundary, in bits,
880    of an argument with the specified mode and type.  If it is not defined,
881    `PARM_BOUNDARY' is used for all arguments.  */
882 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
883   (((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) <= PARM_BOUNDARY \
884     ? PARM_BOUNDARY : 2 * PARM_BOUNDARY)
885 
886 /* Perform any actions needed for a function that is receiving a
887    variable number of arguments.  */
888 #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
889   m88k_setup_incoming_varargs (& (CUM), MODE, TYPE, & (PRETEND_SIZE), NO_RTL)
890 
891 /* Define the `__builtin_va_list' type for the ABI.  */
892 #define BUILD_VA_LIST_TYPE(VALIST) \
893   (VALIST) = m88k_build_va_list ()
894 
895 /* Implement `va_start' for varargs and stdarg.  */
896 #define EXPAND_BUILTIN_VA_START(valist, nextarg) \
897   m88k_va_start (valist, nextarg)
898 
899 /* Implement `va_arg'.  */
900 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
901   m88k_va_arg (valist, type)
902 
903 /* Output assembler code to FILE to increment profiler label # LABELNO
904    for profiling a function entry.  */
905 #define FUNCTION_PROFILER(FILE, LABELNO) \
906   output_function_profiler (FILE, LABELNO, "mcount")
907 
908 /* Maximum length in instructions of the code output by FUNCTION_PROFILER.  */
909 #define FUNCTION_PROFILER_LENGTH (5+3+1+5)
910 
911 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
912    the stack pointer does not matter.  The value is tested only in
913    functions that have frame pointers.
914    No definition is equivalent to always zero.  */
915 #define EXIT_IGNORE_STACK (1)
916 
917 /* Value should be nonzero if functions must have frame pointers.
918    Zero means the frame pointer need not be set up (and parms
919    may be accessed via the stack pointer) in functions that seem suitable.
920    This is computed in `reload', in reload1.c.  */
921 #define FRAME_POINTER_REQUIRED						\
922 ((current_function_profile || !leaf_function_p ()			\
923   || !TARGET_OMIT_LEAF_FRAME_POINTER)					\
924  || (write_symbols != NO_DEBUG))
925 
926 /* Define registers used by the epilogue and return instruction.  */
927 #define EPILOGUE_USES(REGNO) \
928 (reload_completed && ((REGNO) == 1 \
929 		      || (current_function_profile \
930 			  && (REGNO) == FRAME_POINTER_REGNUM)))
931 
932 /* Before the prologue, RA is in r1.  */
933 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, 1)
934 #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (1)
935 
936 /* Definitions for register eliminations.
937 
938    We have two registers that can be eliminated on the m88k.  First, the
939    frame pointer register can often be eliminated in favor of the stack
940    pointer register.  Secondly, the argument pointer register can always be
941    eliminated; it is replaced with either the stack or frame pointer.  */
942 
943 /* This is an array of structures.  Each structure initializes one pair
944    of eliminable registers.  The "from" register number is given first,
945    followed by "to".  Eliminations of the same "from" register are listed
946    in order of preference.  */
947 #define ELIMINABLE_REGS				\
948 {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM},	\
949  { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM},	\
950  { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
951 
952 /* Given FROM and TO register numbers, say whether this elimination
953    is allowed.  */
954 #define CAN_ELIMINATE(FROM, TO) \
955   (!((FROM) == FRAME_POINTER_REGNUM && FRAME_POINTER_REQUIRED))
956 
957 /* Define the offset between two registers, one to be eliminated, and the other
958    its replacement, at the start of a routine.  */
959 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)			 \
960 { m88k_layout_frame ();							 \
961   if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM)	 \
962       (OFFSET) = m88k_fp_offset;					 \
963   else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
964     (OFFSET) = m88k_stack_size - m88k_fp_offset;			 \
965   else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
966     (OFFSET) = m88k_stack_size;						 \
967   else									 \
968     abort ();								 \
969 }
970 
971 /*** Trampolines for Nested Functions ***/
972 
973 #ifndef FINALIZE_TRAMPOLINE
974 #define FINALIZE_TRAMPOLINE(TRAMP)
975 #endif
976 
977 /* Output assembler code for a block containing the constant parts
978    of a trampoline, leaving space for the variable parts.
979 
980    This block is placed on the stack and filled in.  It is aligned
981    0 mod 128 and those portions that are executed are constant.
982    This should work for instruction caches that have cache lines up
983    to the aligned amount (128 is arbitrary), provided no other code
984    producer is attempting to play the same game.  This of course is
985    in violation of any number of 88open standards.  */
986 
987 #define TRAMPOLINE_TEMPLATE(FILE)					\
988 {									\
989   char buf[256];							\
990   static int labelno = 0;						\
991   labelno++;								\
992   ASM_GENERATE_INTERNAL_LABEL (buf, "LTRMP", labelno);			\
993   /* Save the return address (r1) in the static chain reg (r11).  */	\
994   asm_fprintf (FILE, "\tor\t %R%s,%R%s,0\n",				\
995 	       reg_names[11], reg_names[1]);				\
996   /* Locate this block; transfer to the next instruction.  */		\
997   fprintf (FILE, "\tbsr\t %s\n", &buf[1]);				\
998   ASM_OUTPUT_INTERNAL_LABEL (FILE, "LTRMP", labelno);			\
999   /* Save r10; use it as the relative pointer; restore r1.  */		\
1000   asm_fprintf (FILE, "\tst\t %R%s,%R%s,24\n",				\
1001 	       reg_names[10], reg_names[1]);				\
1002   asm_fprintf (FILE, "\tor\t %R%s,%R%s,0\n",				\
1003 	       reg_names[10], reg_names[1]);				\
1004   asm_fprintf (FILE, "\tor\t %R%s,%R%s,0\n",				\
1005 	       reg_names[1], reg_names[11]);				\
1006   /* Load the function's address and go there.  */			\
1007   asm_fprintf (FILE, "\tld\t %R%s,%R%s,32\n",				\
1008 	       reg_names[11], reg_names[10]);				\
1009   asm_fprintf (FILE, "\tjmp.n\t %R%s\n", reg_names[11]);		\
1010   /* Restore r10 and load the static chain register.  */		\
1011   asm_fprintf (FILE, "\tld.d\t %R%s,%R%s,24\n",				\
1012 	       reg_names[10], reg_names[10]);				\
1013   /* Storage: r10 save area, static chain, function address.  */	\
1014   assemble_aligned_integer (UNITS_PER_WORD, const0_rtx);		\
1015   assemble_aligned_integer (UNITS_PER_WORD, const0_rtx);		\
1016   assemble_aligned_integer (UNITS_PER_WORD, const0_rtx);		\
1017 }
1018 
1019 /* Length in units of the trampoline for entering a nested function.
1020    This is really two components.  The first 32 bytes are fixed and
1021    must be copied; the last 12 bytes are just storage that's filled
1022    in later.  So for allocation purposes, it's 32+12 bytes, but for
1023    initialization purposes, it's 32 bytes.  */
1024 
1025 #define TRAMPOLINE_SIZE (32+12)
1026 
1027 /* Alignment required for a trampoline.  128 is used to find the
1028    beginning of a line in the instruction cache and to allow for
1029    instruction cache lines of up to 128 bytes.  */
1030 
1031 #define TRAMPOLINE_ALIGNMENT 128
1032 
1033 /* Emit RTL insns to initialize the variable parts of a trampoline.
1034    FNADDR is an RTX for the address of the function's pure code.
1035    CXT is an RTX for the static chain value for the function.  */
1036 
1037 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT)			\
1038 {									\
1039   emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 40)), FNADDR); \
1040   emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 36)), CXT); \
1041   FINALIZE_TRAMPOLINE (TRAMP);						\
1042 }
1043 
1044 /*** Library Subroutine Names ***/
1045 
1046 /* Define this macro if GNU CC should generate calls to the System V
1047    (and ANSI C) library functions `memcpy' and `memset' rather than
1048    the BSD functions `bcopy' and `bzero'.  */
1049 #define TARGET_MEM_FUNCTIONS
1050 
1051 /*** Addressing Modes ***/
1052 
1053 #define SELECT_CC_MODE(OP,X,Y) CCmode
1054 
1055 /* #define HAVE_POST_INCREMENT 0 */
1056 /* #define HAVE_POST_DECREMENT 0 */
1057 
1058 /* #define HAVE_PRE_DECREMENT 0 */
1059 /* #define HAVE_PRE_INCREMENT 0 */
1060 
1061 /* Recognize any constant value that is a valid address.
1062    When PIC, we do not accept an address that would require a scratch reg
1063    to load into a register.  */
1064 
1065 #define CONSTANT_ADDRESS_P(X)   \
1066   (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF		\
1067    || GET_CODE (X) == CONST_INT || GET_CODE (X) == HIGH                 \
1068    || (GET_CODE (X) == CONST                                            \
1069        && ! (flag_pic && pic_address_needs_scratch (X))))
1070 
1071 
1072 /* Maximum number of registers that can appear in a valid memory address.  */
1073 #define MAX_REGS_PER_ADDRESS 2
1074 
1075 /* The condition for memory shift insns.  */
1076 #define SCALED_ADDRESS_P(ADDR)			\
1077   (GET_CODE (ADDR) == PLUS			\
1078    && (GET_CODE (XEXP (ADDR, 0)) == MULT	\
1079        || GET_CODE (XEXP (ADDR, 1)) == MULT))
1080 
1081 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1082    that is a valid memory address for an instruction.
1083    The MODE argument is the machine mode for the MEM expression
1084    that wants to use this address.
1085 
1086    On the m88000, a legitimate address has the form REG, REG+REG,
1087    REG+SMALLINT, REG+(REG*modesize) (REG[REG]), or SMALLINT.
1088 
1089    The register elimination process should deal with the argument
1090    pointer and frame pointer changing to REG+SMALLINT.  */
1091 
1092 #define LEGITIMATE_INDEX_P(X, MODE)			\
1093    ((GET_CODE (X) == CONST_INT				\
1094      && SMALL_INT (X))					\
1095     || (REG_P (X)					\
1096 	&& REG_OK_FOR_INDEX_P (X))			\
1097     || (GET_CODE (X) == MULT				\
1098 	&& REG_P (XEXP (X, 0))				\
1099 	&& REG_OK_FOR_INDEX_P (XEXP (X, 0))		\
1100 	&& GET_CODE (XEXP (X, 1)) == CONST_INT		\
1101 	&& INTVAL (XEXP (X, 1)) == GET_MODE_SIZE (MODE)))
1102 
1103 #define RTX_OK_FOR_BASE_P(X)						\
1104   ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))			\
1105   || (GET_CODE (X) == SUBREG						\
1106       && GET_CODE (SUBREG_REG (X)) == REG				\
1107       && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
1108 
1109 #define RTX_OK_FOR_INDEX_P(X)						\
1110   ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X))			\
1111   || (GET_CODE (X) == SUBREG						\
1112       && GET_CODE (SUBREG_REG (X)) == REG				\
1113       && REG_OK_FOR_INDEX_P (SUBREG_REG (X))))
1114 
1115 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)		\
1116 {							\
1117   if (REG_P (X))					\
1118     {							\
1119       if (REG_OK_FOR_BASE_P (X))			\
1120 	goto ADDR;					\
1121     }							\
1122   else if (GET_CODE (X) == PLUS)			\
1123     {							\
1124       register rtx _x0 = XEXP (X, 0);			\
1125       register rtx _x1 = XEXP (X, 1);			\
1126       if ((flag_pic					\
1127 	   && _x0 == pic_offset_table_rtx		\
1128 	   && (flag_pic == 2				\
1129 	       ? RTX_OK_FOR_BASE_P (_x1)		\
1130 	       : (GET_CODE (_x1) == SYMBOL_REF		\
1131 		  || GET_CODE (_x1) == LABEL_REF)))	\
1132 	  || (RTX_OK_FOR_BASE_P (_x0)			\
1133 	      && LEGITIMATE_INDEX_P (_x1, MODE))	\
1134 	  || (RTX_OK_FOR_BASE_P (_x1)			\
1135 	      && LEGITIMATE_INDEX_P (_x0, MODE)))	\
1136 	goto ADDR;					\
1137     }							\
1138   else if (GET_CODE (X) == LO_SUM)			\
1139     {							\
1140       register rtx _x0 = XEXP (X, 0);			\
1141       register rtx _x1 = XEXP (X, 1);			\
1142       if (RTX_OK_FOR_BASE_P (_x0)			\
1143 	  && CONSTANT_P (_x1))				\
1144 	goto ADDR;					\
1145     }							\
1146   else if (GET_CODE (X) == CONST_INT			\
1147 	   && SMALL_INT (X))				\
1148     goto ADDR;						\
1149 }
1150 
1151 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1152    and check its validity for a certain class.
1153    We have two alternate definitions for each of them.
1154    The usual definition accepts all pseudo regs; the other rejects
1155    them unless they have been allocated suitable hard regs.
1156    The symbol REG_OK_STRICT causes the latter definition to be used.
1157 
1158    Most source files want to accept pseudo regs in the hope that
1159    they will get allocated to the class that the insn wants them to be in.
1160    Source files for reload pass need to be strict.
1161    After reload, it makes no difference, since pseudo regs have
1162    been eliminated by then.  */
1163 
1164 #ifndef REG_OK_STRICT
1165 
1166 /* Nonzero if X is a hard reg that can be used as an index
1167    or if it is a pseudo reg.  Not the argument pointer.  */
1168 #define REG_OK_FOR_INDEX_P(X)                                         \
1169   (!XRF_REGNO_P(REGNO (X)))
1170 /* Nonzero if X is a hard reg that can be used as a base reg
1171    or if it is a pseudo reg.  */
1172 #define REG_OK_FOR_BASE_P(X) (REG_OK_FOR_INDEX_P (X))
1173 
1174 #else
1175 
1176 /* Nonzero if X is a hard reg that can be used as an index.  */
1177 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1178 /* Nonzero if X is a hard reg that can be used as a base reg.  */
1179 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1180 
1181 #endif
1182 
1183 /* Try machine-dependent ways of modifying an illegitimate address
1184    to be legitimate.  If we find one, return the new, valid address.
1185    This macro is used in only one place: `memory_address' in explow.c.
1186 
1187    OLDX is the address as it was before break_out_memory_refs was called.
1188    In some cases it is useful to look at this to decide what needs to be done.
1189 
1190    MODE and WIN are passed so that this macro can use
1191    GO_IF_LEGITIMATE_ADDRESS.
1192 
1193    It is always safe for this macro to do nothing.  It exists to recognize
1194    opportunities to optimize the output.  */
1195 
1196 /* On the m88000, change REG+N into REG+REG, and REG+(X*Y) into REG+REG.  */
1197 
1198 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)			\
1199 {								\
1200   if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1)))	\
1201     (X) = gen_rtx_PLUS (SImode, XEXP (X, 0),			\
1202 			copy_to_mode_reg (SImode, XEXP (X, 1))); \
1203   if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0)))	\
1204     (X) = gen_rtx_PLUS (SImode, XEXP (X, 1),			\
1205 			copy_to_mode_reg (SImode, XEXP (X, 0))); \
1206   if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT)	\
1207     (X) = gen_rtx_PLUS (SImode, XEXP (X, 1),			\
1208 			force_operand (XEXP (X, 0), 0));	\
1209   if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT)	\
1210     (X) = gen_rtx_PLUS (SImode, XEXP (X, 0),			\
1211 			force_operand (XEXP (X, 1), 0));	\
1212   if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == PLUS)	\
1213     (X) = gen_rtx_PLUS (Pmode, force_operand (XEXP (X, 0), NULL_RTX),\
1214 			XEXP (X, 1));				\
1215   if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == PLUS)	\
1216     (X) = gen_rtx_PLUS (Pmode, XEXP (X, 0),			\
1217 			force_operand (XEXP (X, 1), NULL_RTX));	\
1218   if (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST	\
1219 	   || GET_CODE (X) == LABEL_REF)			\
1220     (X) = legitimize_address (flag_pic, X, 0, 0);		\
1221   if (memory_address_p (MODE, X))				\
1222     goto WIN; }
1223 
1224 /* Go to LABEL if ADDR (a legitimate address expression)
1225    has an effect that depends on the machine mode it is used for.
1226    On the m88000 this is never true.  */
1227 
1228 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
1229 
1230 /* Nonzero if the constant value X is a legitimate general operand.
1231    It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
1232 #define LEGITIMATE_CONSTANT_P(X) (1)
1233 
1234 /* Define this, so that when PIC, reload won't try to reload invalid
1235    addresses which require two reload registers.  */
1236 
1237 #define LEGITIMATE_PIC_OPERAND_P(X)  (! pic_address_needs_scratch (X))
1238 
1239 
1240 /*** Condition Code Information ***/
1241 
1242 /* C code for a data type which is used for declaring the `mdep'
1243    component of `cc_status'.  It defaults to `int'.  */
1244 /* #define CC_STATUS_MDEP int */
1245 
1246 /* A C expression to initialize the `mdep' field to "empty".  */
1247 /* #define CC_STATUS_MDEP_INIT (cc_status.mdep = 0) */
1248 
1249 /* Macro to zap the normal portions of CC_STATUS, but leave the
1250    machine dependent parts (ie, literal synthesis) alone.  */
1251 /* #define CC_STATUS_INIT_NO_MDEP \
1252   (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0) */
1253 
1254 /* When using a register to hold the condition codes, the cc_status
1255    mechanism cannot be used.  */
1256 #define NOTICE_UPDATE_CC(EXP, INSN) (0)
1257 
1258 /*** Miscellaneous Parameters ***/
1259 
1260 /* Define the codes that are matched by predicates in m88k.c.  */
1261 #define PREDICATE_CODES	  						\
1262   {"move_operand", {SUBREG, REG, CONST_INT, LO_SUM, MEM}},		\
1263   {"call_address_operand", {SUBREG, REG, SYMBOL_REF, LABEL_REF, CONST}}, \
1264   {"arith_operand", {SUBREG, REG, CONST_INT}},				\
1265   {"arith5_operand", {SUBREG, REG, CONST_INT}},				\
1266   {"arith32_operand", {SUBREG, REG, CONST_INT}},			\
1267   {"arith64_operand", {SUBREG, REG, CONST_INT}},			\
1268   {"int5_operand", {CONST_INT}},					\
1269   {"int32_operand", {CONST_INT}},					\
1270   {"add_operand", {SUBREG, REG, CONST_INT}},				\
1271   {"reg_or_bbx_mask_operand", {SUBREG, REG, CONST_INT}},		\
1272   {"real_or_0_operand", {SUBREG, REG, CONST_DOUBLE}},			\
1273   {"reg_or_0_operand", {SUBREG, REG, CONST_INT}},                       \
1274   {"relop", {EQ, NE, LT, LE, GE, GT, LTU, LEU, GEU, GTU}},		\
1275   {"even_relop", {EQ, LT, GT, LTU, GTU}},		\
1276   {"odd_relop", { NE, LE, GE, LEU, GEU}},		\
1277   {"partial_ccmode_register_operand", { SUBREG, REG}},			\
1278   {"relop_no_unsigned", {EQ, NE, LT, LE, GE, GT}},			\
1279   {"equality_op", {EQ, NE}},						\
1280   {"pc_or_label_ref", {PC, LABEL_REF}},					\
1281   {"label_ref", {LABEL_REF}},
1282 
1283 
1284 /* A list of predicates that do special things with modes, and so
1285    should not elicit warnings for VOIDmode match_operand.  */
1286 
1287 #define SPECIAL_MODE_PREDICATES		\
1288   "partial_ccmode_register_operand",	\
1289   "pc_or_label_ref",
1290 
1291 /* The case table contains either words or branch instructions.  This says
1292    which.  We always claim that the vector is PC-relative.  It is position
1293    independent when -fpic is used.  */
1294 #define CASE_VECTOR_INSNS (TARGET_88100 || flag_pic)
1295 
1296 /* An alias for a machine mode name.  This is the machine mode that
1297    elements of a jump-table should have.  */
1298 #define CASE_VECTOR_MODE SImode
1299 
1300 /* Define as C expression which evaluates to nonzero if the tablejump
1301    instruction expects the table to contain offsets from the address of the
1302    table.
1303    Do not define this if the table should contain absolute addresses. */
1304 #define CASE_VECTOR_PC_RELATIVE 1
1305 
1306 /* Define this if control falls through a `case' insn when the index
1307    value is out of range.  This means the specified default-label is
1308    actually ignored by the `case' insn proper.  */
1309 /* #define CASE_DROPS_THROUGH */
1310 
1311 /* Define this to be the smallest number of different values for which it
1312    is best to use a jump-table instead of a tree of conditional branches.
1313    The default is 4 for machines with a casesi instruction and 5 otherwise.
1314    The best 88110 number is around 7, though the exact number isn't yet
1315    known.  A third alternative for the 88110 is to use a binary tree of
1316    bb1 instructions on bits 2/1/0 if the range is dense.  This may not
1317    win very much though.  */
1318 #define CASE_VALUES_THRESHOLD (TARGET_88100 ? 4 : 7)
1319 
1320 /* Define this as 1 if `char' should by default be signed; else as 0.  */
1321 #define DEFAULT_SIGNED_CHAR 1
1322 
1323 /* The 88open ABI says size_t is unsigned int.  */
1324 #define SIZE_TYPE "unsigned int"
1325 
1326 /* Handle #pragma pack and sometimes #pragma weak.  */
1327 #define HANDLE_SYSV_PRAGMA 1
1328 
1329 /* Max number of bytes we can move from memory to memory
1330    in one reasonably fast instruction.  */
1331 #define MOVE_MAX 8
1332 
1333 /* Define if normal loads of shorter-than-word items from memory clears
1334    the rest of the bigs in the register.  */
1335 #define BYTE_LOADS_ZERO_EXTEND
1336 
1337 /* Zero if access to memory by bytes is faster.  */
1338 #define SLOW_BYTE_ACCESS 1
1339 
1340 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1341    is done just by pretending it is already truncated.  */
1342 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1343 
1344 /* Define this if addresses of constant functions
1345    shouldn't be put through pseudo regs where they can be cse'd.
1346    Desirable on machines where ordinary constants are expensive
1347    but a CALL with constant address is cheap.  */
1348 #define NO_FUNCTION_CSE
1349 
1350 /* Define this macro if an argument declared as `char' or
1351    `short' in a prototype should actually be passed as an
1352    `int'.  In addition to avoiding errors in certain cases of
1353    mismatch, it also makes for better code on certain machines.  */
1354 #define PROMOTE_PROTOTYPES 1
1355 
1356 /* We assume that the store-condition-codes instructions store 0 for false
1357    and some other value for true.  This is the value stored for true.  */
1358 #define STORE_FLAG_VALUE (-1)
1359 
1360 /* Specify the machine mode that pointers have.
1361    After generation of rtl, the compiler makes no further distinction
1362    between pointers and any other objects of this machine mode.  */
1363 #define Pmode SImode
1364 
1365 /* A function address in a call instruction
1366    is a word address (for indexing purposes)
1367    so give the MEM rtx word mode.  */
1368 #define FUNCTION_MODE SImode
1369 
1370 /* A barrier will be aligned so account for the possible expansion.
1371    A volatile load may be preceded by a serializing instruction.
1372    Account for profiling code output at NOTE_INSN_PROLOGUE_END.
1373    Account for block profiling code at basic block boundaries.  */
1374 #define ADJUST_INSN_LENGTH(RTX, LENGTH)					\
1375   if (GET_CODE (RTX) == BARRIER						\
1376       || (TARGET_SERIALIZE_VOLATILE					\
1377 	  && GET_CODE (RTX) == INSN					\
1378 	  && GET_CODE (PATTERN (RTX)) == SET				\
1379 	  && ((GET_CODE (SET_SRC (PATTERN (RTX))) == MEM		\
1380 	       && MEM_VOLATILE_P (SET_SRC (PATTERN (RTX)))))))		\
1381     (LENGTH) += 1;							\
1382   else if (GET_CODE (RTX) == NOTE					\
1383 	   && NOTE_LINE_NUMBER (RTX) == NOTE_INSN_PROLOGUE_END)		\
1384     {									\
1385       if (current_function_profile)					\
1386 	(LENGTH) += (FUNCTION_PROFILER_LENGTH + REG_PUSH_LENGTH		\
1387 		     + REG_POP_LENGTH);					\
1388     }									\
1389 
1390 /* Track the state of the last volatile memory reference.  Clear the
1391    state with CC_STATUS_INIT for now.  */
1392 #define CC_STATUS_INIT m88k_volatile_code = '\0'
1393 
1394 /* Compute the cost of computing a constant rtl expression RTX
1395    whose rtx-code is CODE.  The body of this macro is a portion
1396    of a switch statement.  If the code is computed here,
1397    return it with a return statement.  Otherwise, break from the switch.
1398 
1399    We assume that any 16 bit integer can easily be recreated, so we
1400    indicate 0 cost, in an attempt to get GCC not to optimize things
1401    like comparison against a constant.
1402 
1403    The cost of CONST_DOUBLE is zero (if it can be placed in an insn, it
1404    is as good as a register; since it can't be placed in any insn, it
1405    won't do anything in cse, but it will cause expand_binop to pass the
1406    constant to the define_expands).  */
1407 #define CONST_COSTS(RTX,CODE,OUTER_CODE)		\
1408   case CONST_INT:					\
1409     if (SMALL_INT (RTX))				\
1410       return 0;						\
1411     else if (SMALL_INTVAL (- INTVAL (RTX)))		\
1412       return 2;						\
1413     else if (classify_integer (SImode, INTVAL (RTX)) != m88k_oru_or) \
1414       return 4;						\
1415     return 7;						\
1416   case HIGH:						\
1417     return 2;						\
1418   case CONST:						\
1419   case LABEL_REF:					\
1420   case SYMBOL_REF:					\
1421     if (flag_pic)					\
1422       return (flag_pic == 2) ? 11 : 8;			\
1423     return 5;						\
1424   case CONST_DOUBLE:					\
1425     return 0;
1426 
1427 /* Provide the costs of an addressing mode that contains ADDR.
1428    If ADDR is not a valid address, its cost is irrelevant.
1429    REG+REG is made slightly more expensive because it might keep
1430    a register live for longer than we might like.  */
1431 #define ADDRESS_COST(ADDR)				\
1432   (GET_CODE (ADDR) == REG ? 1 :				\
1433    GET_CODE (ADDR) == LO_SUM ? 1 :			\
1434    GET_CODE (ADDR) == HIGH ? 2 :			\
1435    GET_CODE (ADDR) == MULT ? 1 :			\
1436    GET_CODE (ADDR) != PLUS ? 4 :			\
1437    (REG_P (XEXP (ADDR, 0)) && REG_P (XEXP (ADDR, 1))) ? 2 : 1)
1438 
1439 /* Provide the costs of a rtl expression.  This is in the body of a
1440    switch on CODE.  */
1441 #define RTX_COSTS(X,CODE,OUTER_CODE)				\
1442   case MEM:						\
1443     return COSTS_N_INSNS (2);				\
1444   case MULT:						\
1445     return COSTS_N_INSNS (3);				\
1446   case DIV:						\
1447   case UDIV:						\
1448   case MOD:						\
1449   case UMOD:						\
1450     return COSTS_N_INSNS (38);
1451 
1452 /* A C expressions returning the cost of moving data of MODE from a register
1453    to or from memory.  This is more costly than between registers.  */
1454 #define MEMORY_MOVE_COST(MODE,CLASS,IN) 4
1455 
1456 /* Provide the cost of a branch.  Exact meaning under development.  */
1457 #define BRANCH_COST (TARGET_88100 ? 1 : 2)
1458 
1459 /* Do not break .stabs pseudos into continuations.  */
1460 #define DBX_CONTIN_LENGTH 0
1461 
1462 /*** Output of Assembler Code ***/
1463 
1464 /* Control the assembler format that we output.  */
1465 
1466 /* A C string constant describing how to begin a comment in the target
1467    assembler language.  The compiler assumes that the comment will end at
1468    the end of the line.  */
1469 #define ASM_COMMENT_START ";"
1470 
1471 /* Assembler specific opcodes.
1472    Not overriding <elfos.h> if already included.  */
1473 #ifndef OBJECT_FORMAT_ELF
1474 
1475 /* These are used in varasm.c as well.  */
1476 #define TEXT_SECTION_ASM_OP	"\ttext"
1477 #define DATA_SECTION_ASM_OP	"\tdata"
1478 
1479 /* These are pretty much common to all assemblers.  */
1480 #undef	IDENT_ASM_OP
1481 #define IDENT_ASM_OP		"\tident\t"
1482 #define FILE_ASM_OP		"\tfile\t"
1483 #undef	SET_ASM_OP
1484 #define SET_ASM_OP		"\tdef\t"
1485 #define GLOBAL_ASM_OP		"\tglobal\t"
1486 #undef	ALIGN_ASM_OP
1487 #define ALIGN_ASM_OP		"\talign\t"
1488 #undef	SKIP_ASM_OP
1489 #define SKIP_ASM_OP		"\tzero\t"
1490 #undef	COMMON_ASM_OP
1491 #define COMMON_ASM_OP		"\tcomm\t"
1492 #define BSS_ASM_OP		"\tbss\t"
1493 #define FLOAT_ASM_OP		"\tfloat\t"
1494 #define DOUBLE_ASM_OP		"\tdouble\t"
1495 #undef	ASCII_DATA_ASM_OP
1496 #define ASCII_DATA_ASM_OP	"\tstring\t"
1497 
1498 /* These are specific to PIC.  */
1499 #undef	TYPE_ASM_OP
1500 #define TYPE_ASM_OP		"\ttype\t"
1501 #undef	SIZE_ASM_OP
1502 #define SIZE_ASM_OP		"\tsize\t"
1503 #ifndef AS_BUG_POUND_TYPE /* Faulty assemblers require @ rather than #.  */
1504 #undef	TYPE_OPERAND_FMT
1505 #define TYPE_OPERAND_FMT	"#%s"
1506 #endif
1507 
1508 /* These are specific to version 03.00 assembler syntax.  */
1509 #define INTERNAL_ASM_OP		"\tlocal\t"
1510 #define PUSHSECTION_ASM_OP	"\tsection\t"
1511 #define POPSECTION_ASM_OP	"\tprevious"
1512 
1513 /* These are specific to the version 04.00 assembler syntax.  */
1514 #define REQUIRES_88110_ASM_OP	"\trequires_88110"
1515 
1516 /* This is how we tell the assembler that a symbol is weak.  */
1517 #undef ASM_WEAKEN_LABEL
1518 #define ASM_WEAKEN_LABEL(FILE,NAME) \
1519   do { fputs ("\tweak\t", FILE); assemble_name (FILE, NAME); \
1520        fputc ('\n', FILE); } while (0)
1521 
1522 /* Write the extra assembler code needed to declare a function properly.  */
1523 #undef	ASM_DECLARE_FUNCTION_NAME
1524 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\
1525   do {									\
1526     ASM_OUTPUT_LABEL(FILE, NAME);					\
1527   } while (0)
1528 
1529 /* Write the extra assembler code needed to declare an object properly.  */
1530 #undef	ASM_DECLARE_OBJECT_NAME
1531 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)			\
1532   do {									\
1533     ASM_OUTPUT_LABEL(FILE, NAME);					\
1534   } while (0);
1535 
1536 /* Output the size directive for a decl in rest_of_decl_compilation
1537    in the case where we did not do so before the initializer.
1538    Once we find the error_mark_node, we know that the value of
1539    size_directive_output was set
1540    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
1541 
1542 #undef ASM_FINISH_DECLARE_OBJECT
1543 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)	 \
1544 do {									 \
1545    } while (0)
1546 
1547 /* This is how to declare the size of a function.  */
1548 #undef	ASM_DECLARE_FUNCTION_SIZE
1549 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)			\
1550   do {									\
1551   } while (0)
1552 
1553 /* The single-byte pseudo-op is the default.  */
1554 #undef	ASM_OUTPUT_ASCII
1555 #define ASM_OUTPUT_ASCII(FILE, P, SIZE)  \
1556   output_ascii (FILE, ASCII_DATA_ASM_OP, 48, P, SIZE)
1557 
1558 /* Code to handle #ident directives.  */
1559 #undef	ASM_OUTPUT_IDENT
1560 #ifdef DBX_DEBUGGING_INFO
1561 #define ASM_OUTPUT_IDENT(FILE, NAME)
1562 #else
1563 #define ASM_OUTPUT_IDENT(FILE, NAME) \
1564   output_ascii (FILE, IDENT_ASM_OP, 4000, NAME, strlen (NAME));
1565 #endif
1566 
1567 /* This is how to store into the string LABEL
1568    the symbol_ref name of an internal numbered label where
1569    PREFIX is the class of label and NUM is the number within the class.
1570    This is suitable for output with `assemble_name'.  This must agree
1571    with ASM_OUTPUT_INTERNAL_LABEL above, except for being prefixed
1572    with an `*'.  */
1573 
1574 #undef ASM_GENERATE_INTERNAL_LABEL
1575 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)			\
1576   sprintf (LABEL, "*@%s%u", PREFIX, (unsigned) (NUM))
1577 
1578 /* This is how to output an internal numbered label where
1579    PREFIX is the class of label and NUM is the number within the class.
1580    For ELF, labels use `.' rather than `@'.  */
1581 
1582 #undef ASM_OUTPUT_INTERNAL_LABEL
1583 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)			\
1584   fprintf (FILE, "@%s%u:\n", PREFIX, (unsigned) (NUM))
1585 
1586 /* The prefix to add to user-visible assembler symbols.  */
1587 #undef USER_LABEL_PREFIX
1588 #define USER_LABEL_PREFIX "_"
1589 
1590 #undef	ASM_OUTPUT_COMMON
1591 #undef	ASM_OUTPUT_ALIGNED_COMMON
1592 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)	\
1593 ( fprintf ((FILE), "%s", COMMON_ASM_OP), 		\
1594   assemble_name ((FILE), (NAME)),			\
1595   fprintf ((FILE), ",%u\n", (SIZE) ? (SIZE) : 1))
1596 
1597 /* This says how to output an assembler line to define a local common
1598    symbol.  */
1599 #undef	ASM_OUTPUT_LOCAL
1600 #undef	ASM_OUTPUT_ALIGNED_LOCAL
1601 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)	\
1602 ( fprintf ((FILE), "%s", BSS_ASM_OP),			\
1603   assemble_name ((FILE), (NAME)),			\
1604   fprintf ((FILE), ",%u,%d\n", (SIZE) ? (SIZE) : 1, (SIZE) <= 4 ? 4 : 8))
1605 
1606 #undef	ASM_OUTPUT_SKIP
1607 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
1608   fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (SIZE))
1609 
1610 #endif /* OBJECT_FORMAT_ELF */
1611 
1612 /* Output any initial stuff to the assembly file.  Always put out
1613    a file directive, even if not debugging.
1614 
1615    Immediately after putting out the file, put out a "sem.<value>"
1616    declaration.  This should be harmless on other systems, and
1617    is used in DG/UX by the debuggers to supplement COFF.  The
1618    fields in the integer value are as follows:
1619 
1620    Bits	Value	Meaning
1621    ----	-----	-------
1622    0-1	0	No information about stack locations
1623 	1	Auto/param locations are based on r30
1624 	2	Auto/param locations are based on CFA
1625 
1626    3-2	0	No information on dimension order
1627 	1	Array dims in sym table matches source language
1628 	2	Array dims in sym table is in reverse order
1629 
1630    5-4	0	No information about the case of global names
1631 	1	Global names appear in the symbol table as in the source
1632 	2	Global names have been converted to lower case
1633 	3	Global names have been converted to upper case.  */
1634 
1635 #undef	ASM_FILE_START
1636 #define ASM_FILE_START(FILE) \
1637   output_file_start (FILE)
1638 
1639 #undef	ASM_FILE_END
1640 
1641 #define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) \
1642   do {                                         \
1643     fputs (FILE_ASM_OP, FILE);                 \
1644     output_quoted_string (FILE, NAME);         \
1645     putc ('\n', FILE);                         \
1646   } while (0)
1647 
1648 /* Output to assembler file text saying following lines
1649    may contain character constants, extra white space, comments, etc.  */
1650 #define ASM_APP_ON ""
1651 
1652 /* Output to assembler file text saying following lines
1653    no longer contain unusual constructs.  */
1654 #define ASM_APP_OFF ""
1655 
1656 /* Format the assembly opcode so that the arguments are all aligned.
1657    The maximum instruction size is 8 characters (fxxx.xxx), so a tab and a
1658    space will do to align the output.  Abandon the output if a `%' is
1659    encountered.  */
1660 #define ASM_OUTPUT_OPCODE(STREAM, PTR)					\
1661   {									\
1662     int ch;								\
1663     const char *orig_ptr;						\
1664 									\
1665     for (orig_ptr = (PTR);						\
1666 	 (ch = *(PTR)) && ch != ' ' && ch != '\t' && ch != '\n' && ch != '%'; \
1667 	 (PTR)++)							\
1668       putc (ch, STREAM);						\
1669 									\
1670     if (ch == ' ' && orig_ptr != (PTR) && (PTR) - orig_ptr < 8)		\
1671       putc ('\t', STREAM);						\
1672   }
1673 
1674 /* How to refer to registers in assembler output.
1675    This sequence is indexed by compiler's hard-register-number.  */
1676 
1677 #define REGISTER_NAMES \
1678   { "r0",  "r1",  "r2",  "r3",  "r4",  "r5",  "r6",  "r7",	\
1679     "r8",  "r9",  "r10", "r11", "r12", "r13", "r14", "r15",	\
1680     "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",	\
1681     "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",	\
1682     "x0",  "x1",  "x2",  "x3",  "x4",  "x5",  "x6",  "x7",	\
1683     "x8",  "x9",  "x10", "x11", "x12", "x13", "x14", "x15",	\
1684     "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23",	\
1685     "x24", "x25", "x26", "x27", "x28", "x29", "x30", "x31" }
1686 
1687 /* Define additional names for use in asm clobbers and asm declarations.
1688 
1689    We define the fake Condition Code register as an alias for reg 0 (which
1690    is our `condition code' register), so that condition codes can easily
1691    be clobbered by an asm.  The carry bit in the PSR is now used.  */
1692 
1693 #define ADDITIONAL_REGISTER_NAMES	{{"psr", 0}, {"cc", 0}}
1694 
1695 /* This is how to output a reference to a user-level label named NAME.  */
1696 #undef	ASM_OUTPUT_LABELREF
1697 #define ASM_OUTPUT_LABELREF(FILE,NAME)			\
1698   asm_fprintf ((FILE), "%U%s", (NAME))
1699 
1700 /* Store in OUTPUT a string (made with alloca) containing
1701    an assembler-name for a local static variable named NAME.
1702    LABELNO is an integer which is different for each call.  */
1703 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)			\
1704   do {									\
1705     (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10);			\
1706     sprintf ((OUTPUT), "%s.%u", (NAME), (unsigned) (LABELNO));		\
1707   } while (0)
1708 
1709 /* Change to the readonly data section for a table of addresses.
1710    final_scan_insn changes back to the text section.  */
1711 #undef	ASM_OUTPUT_CASE_LABEL
1712 #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, TABLE)			\
1713   do {									\
1714     if (! CASE_VECTOR_INSNS)						\
1715       {									\
1716         readonly_data_section ();					\
1717         ASM_OUTPUT_ALIGN (FILE, 2);					\
1718       }									\
1719     ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM);			\
1720   } while (0)
1721 
1722 /* Epilogue for case labels.  This jump instruction is called by casesi
1723    to transfer to the appropriate branch instruction within the table.
1724    The label `@L<n>e' is coined to mark the end of the table.  */
1725 #define ASM_OUTPUT_CASE_END(FILE, NUM, TABLE)				\
1726   do {									\
1727     if (CASE_VECTOR_INSNS)						\
1728       {									\
1729 	char label[256]; 						\
1730 	ASM_GENERATE_INTERNAL_LABEL (label, "L", NUM);			\
1731 	fprintf (FILE, "%se:\n", &label[1]);				\
1732 	if (! flag_delayed_branch)					\
1733 	  asm_fprintf (FILE, "\tlda\t %R%s,%R%s[%R%s]\n", reg_names[1],	\
1734 		       reg_names[1], reg_names[m88k_case_index]);	\
1735 	asm_fprintf (FILE, "\tjmp\t %R%s\n", reg_names[1]);		\
1736       }									\
1737   } while (0)
1738 
1739 /* This is how to output an element of a case-vector that is absolute.  */
1740 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)				\
1741   do {									\
1742     char buffer[256];							\
1743     ASM_GENERATE_INTERNAL_LABEL (buffer, "L", VALUE);			\
1744     fprintf (FILE, CASE_VECTOR_INSNS ? "\tbr\t %s\n" : "\tword\t %s\n",	\
1745 	     &buffer[1]);						\
1746   } while (0)
1747 
1748 /* This is how to output an element of a case-vector that is relative.  */
1749 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1750   ASM_OUTPUT_ADDR_VEC_ELT (FILE, VALUE)
1751 
1752 /* This is how to output an assembler line
1753    that says to advance the location counter
1754    to a multiple of 2**LOG bytes.  */
1755 #define ASM_OUTPUT_ALIGN(FILE,LOG)	\
1756   if ((LOG) != 0)			\
1757     fprintf (FILE, "%s%d\n", ALIGN_ASM_OP, 1<<(LOG))
1758 
1759 /* Override elfos.h.  */
1760 #undef	ASM_OUTPUT_EXTERNAL_LIBCALL
1761 
1762 /* This is how to output an insn to push a register on the stack.
1763    It need not be very fast code.  */
1764 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)  \
1765   asm_fprintf (FILE, "\tsubu\t %R%s,%R%s,%d\n\tst\t %R%s,%R%s,0\n",	\
1766 	       reg_names[STACK_POINTER_REGNUM],				\
1767 	       reg_names[STACK_POINTER_REGNUM],				\
1768 	       (STACK_BOUNDARY / BITS_PER_UNIT),			\
1769 	       reg_names[REGNO],					\
1770 	       reg_names[STACK_POINTER_REGNUM])
1771 
1772 /* Length in instructions of the code output by ASM_OUTPUT_REG_PUSH.  */
1773 #define REG_PUSH_LENGTH 2
1774 
1775 /* This is how to output an insn to pop a register from the stack.  */
1776 #define ASM_OUTPUT_REG_POP(FILE,REGNO)  \
1777   asm_fprintf (FILE, "\tld\t %R%s,%R%s,0\n\taddu\t %R%s,%R%s,%d\n",	\
1778 	       reg_names[REGNO],					\
1779 	       reg_names[STACK_POINTER_REGNUM],				\
1780 	       reg_names[STACK_POINTER_REGNUM],				\
1781 	       reg_names[STACK_POINTER_REGNUM],				\
1782 	       (STACK_BOUNDARY / BITS_PER_UNIT))
1783 
1784 /* Length in instructions of the code output by ASM_OUTPUT_REG_POP.  */
1785 #define REG_POP_LENGTH 2
1786 
1787 /* Macros for debug information */
1788 #define DEBUGGER_AUTO_OFFSET(X) \
1789   (m88k_debugger_offset (X, 0) + (m88k_stack_size - m88k_fp_offset))
1790 
1791 #define DEBUGGER_ARG_OFFSET(OFFSET, X) \
1792   (m88k_debugger_offset (X, OFFSET) + (m88k_stack_size - m88k_fp_offset))
1793 
1794 /* Jump tables consist of branch instructions and should be output in
1795    the text section.  When we use a table of addresses, we explicitly
1796    change to the readonly data section.  */
1797 #define JUMP_TABLES_IN_TEXT_SECTION 1
1798 
1799 /* Print operand X (an rtx) in assembler syntax to file FILE.
1800    CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1801    For `%' followed by punctuation, CODE is the punctuation and X is null.  */
1802 #define PRINT_OPERAND_PUNCT_VALID_P(c) \
1803   ((c) == '#' || (c) == '.' || (c) == '!' || (c) == '*' || (c) == ';')
1804 
1805 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1806 
1807 /* Print a memory address as an operand to reference that memory location.  */
1808 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
1809 
1810 /* This says not to strength reduce the addr calculations within loops
1811    (otherwise it does not take advantage of m88k scaled loads and stores */
1812 #define DONT_REDUCE_ADDR
1813