]> gcc.gnu.org Git - gcc.git/blame - gcc/config/m88k/m88k.h
Always use index and rindex and never strchr or strrchr.
[gcc.git] / gcc / config / m88k / m88k.h
CommitLineData
79e68feb
RS
1/* Definitions of target machine for GNU compiler.
2 Motorola m88100 in an 88open OCS/BCS environment.
3 Copyright (C) 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
4 Contributed by Michael Tiemann (tiemann@mcc.com)
5 Enhanced by Michael Meissner (meissner@osf.org)
6 Currently supported by Tom Wood (wood@dg-rtp.dg.com)
7
8This file is part of GNU CC.
9
10GNU CC is free software; you can redistribute it and/or modify
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation; either version 2, or (at your option)
13any later version.
14
15GNU CC is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with GNU CC; see the file COPYING. If not, write to
22the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
23
24/* The m88100 port of GNU CC adheres to the various standards from 88open.
25 These documents are available by writing:
26
27 88open Consortium Ltd.
28 100 Homeland Court, Suite 800
29 San Jose, CA 95112
30 (408) 436-6600
31
32 In brief, the current standards are:
33
34 Binary Compatibility Standard, Release 1.1A, May 1991
35 This provides for portability of application-level software at the
36 executable level for AT&T System V Release 3.2.
37
38 Object Compatibility Standard, Release 1.1A, May 1991
39 This provides for portability of application-level software at the
40 object file and library level for C, Fortran, and Cobol, and again,
41 largely for SVR3.
42
43 Under development are standards for AT&T System V Release 4, based on the
44 [generic] System V Application Binary Interface from AT&T. These include:
45
46 System V Application Binary Interface, Motorola 88000 Processor Supplement
47 Another document from AT&T for SVR4 specific to the m88100.
48 Available from Prentice Hall.
49
50 System V Application Binary Interface, Motorola 88000 Processor Supplement,
51 Release 1.1, Draft H, May 6, 1991
52 A proposed update to the AT&T document from 88open.
53
54 System V ABI Implementation Guide for the M88000 Processor,
55 Release 1.0, January 1991
56 A companion ABI document from 88open. */
57
58/* Other m88k*.h files include this one and override certain items.
59 At present, these are m88kv3.h, m88kv4.h, m88kdgux.h, and m88kluna.h.
60 Additionally, m88kv4.h and m88kdgux.h include svr4.h first. All other
61 m88k targets except m88kluna.h are based on svr3.h. */
62
63/* Choose SVR3 as the default. */
64#if !defined(DBX_DEBUGGING_INFO) && !defined(DWARF_DEBUGGING_INFO)
65#include "svr3.h"
66#endif
67\f
68/* External types used. */
69
70/* What instructions are needed to manufacture an integer constant. */
71enum m88k_instruction {
72 m88k_zero,
73 m88k_or,
74 m88k_subu,
75 m88k_or_lo16,
76 m88k_or_lo8,
77 m88k_set,
78 m88k_oru_hi16,
79 m88k_oru_or
80};
81
82/* External variables/functions defined in m88k.c. */
83
84extern char *m88k_pound_sign;
85extern char *m88k_short_data;
86
87extern int m88k_gp_threshold;
88extern int m88k_prologue_done;
89extern int m88k_function_number;
90extern int m88k_fp_offset;
91extern int m88k_stack_size;
92extern int m88k_case_index;
93
94extern struct rtx_def *m88k_compare_reg;
95extern struct rtx_def *m88k_compare_op0;
96extern struct rtx_def *m88k_compare_op1;
97
2d6cb879
TW
98extern enum attr_cpu m88k_cpu;
99
79e68feb
RS
100extern int null_epilogue ();
101extern int integer_ok_for_set ();
102extern int m88k_debugger_offset ();
103extern void m88k_handle_pragma_token ();
104
105extern void emit_bcnd ();
106extern void expand_block_move ();
79e68feb
RS
107extern void m88k_layout_frame ();
108extern void m88k_output_prologue ();
109extern void m88k_output_epilogue ();
110extern void output_function_profiler ();
111extern void output_function_block_profiler ();
112extern void output_block_profiler ();
113extern void output_file_start ();
114extern void output_ascii ();
115extern void output_label ();
116extern void print_operand ();
117extern void print_operand_address ();
118
119extern char *output_load_const_int ();
120extern char *output_load_const_float ();
121extern char *output_load_const_double ();
122extern char *output_load_const_dimode ();
123extern char *output_and ();
124extern char *output_ior ();
125extern char *output_xor ();
126extern char *output_call ();
127
128extern struct rtx_def *emit_test ();
129extern struct rtx_def *legitimize_address ();
130extern struct rtx_def *legitimize_operand ();
131extern struct rtx_def *m88k_function_arg ();
132extern struct rtx_def *m88k_builtin_saveregs ();
133
134extern enum m88k_instruction classify_integer ();
135
136/* external variables defined elsewhere in the compiler */
137
138extern int target_flags; /* -m compiler switches */
139extern int frame_pointer_needed; /* current function has a FP */
140extern int current_function_pretend_args_size; /* args size without ... */
141extern int flag_delayed_branch; /* -fdelayed-branch */
142extern int flag_pic; /* -fpic */
143extern char * reg_names[];
144
145/* Specify the default monitors. The meaning of these values can
146 be obtained by doing "grep MONITOR_GCC *m88k*". Generally, the
147 values downward from 0x8000 are tests that will soon go away.
148 values upward from 0x1 are generally useful tests that will remain. */
149
150#ifndef MONITOR_GCC
151#define MONITOR_GCC 0
152#endif
153\f
154/*** Controlling the Compilation Driver, `gcc' ***/
155
156/* Some machines may desire to change what optimizations are performed for
157 various optimization levels. This macro, if defined, is executed once
158 just after the optimization level is determined and before the remainder
159 of the command options have been parsed. Values set in this macro are
160 used as the default values for the other command line options.
161
162 LEVEL is the optimization level specified; 2 if -O2 is specified,
163 1 if -O is specified, and 0 if neither is specified. */
164
165/* This macro used to store 0 in flag_signed_bitfields.
166 Not only is that misuse of this macro; the whole idea is wrong.
167
168 The GNU C dialect makes bitfields signed by default,
169 regardless of machine type. Making any machine inconsistent in this
170 regard is bad for portability.
171
172 I chose to make bitfields signed by default because this is consistent
173 with the way ordinary variables are handled: `int' equals `signed int'.
174 If there is a good reason to prefer making bitfields unsigned by default,
175 it cannot have anything to do with the choice of machine.
176 If the reason is good enough, we should change the convention for all machines.
177
178 -- rms, 20 July 1991. */
179
180#define OPTIMIZATION_OPTIONS(LEVEL) \
181 do { \
182 if (LEVEL) \
183 { \
184 flag_omit_frame_pointer = 1; \
185 } \
186 } while (0)
187
188/* LIB_SPEC, LINK_SPEC, and STARTFILE_SPEC defined in svr3.h.
189 ASM_SPEC, ASM_FINAL_SPEC, LIB_SPEC, LINK_SPEC, and STARTFILE_SPEC redefined
190 in svr4.h.
191 CPP_SPEC, ASM_SPEC, ASM_FINAL_SPEC, LIB_SPEC, LINK_SPEC, and
192 STARTFILE_SPEC redefined in m88kdgux.h. */
193\f
194/*** Run-time Target Specification ***/
195
196/* Names to predefine in the preprocessor for this target machine.
197 Redefined in m88kv3.h, m88kv4.h, m88kdgux.h, and m88kluna.h. */
198#define CPP_PREDEFINES "-Dm88000 -Dm88k -Dunix -D__CLASSIFY_TYPE__=2"
199
200#define TARGET_VERSION fprintf (stderr, " (%s%s)", \
201 VERSION_INFO1, VERSION_INFO2)
202
203/* Print subsidiary information on the compiler version in use.
204 Redefined in m88kv4.h, and m88kluna.h. */
205#define VERSION_INFO1 "88open OCS/BCS, "
dfa69feb 206#define VERSION_INFO2 "29 May 1992"
79e68feb 207#define VERSION_STRING version_string
dfa69feb 208#define TM_SCCS_ID "@(#)m88k.h 2.1.11.11 29 May 1992 13:20:31"
79e68feb
RS
209
210/* Run-time compilation parameters selecting different hardware subsets. */
211
212/* Macro to define tables used to set the flags.
213 This is a list in braces of pairs in braces,
214 each pair being { "NAME", VALUE }
215 where VALUE is the bits to set or minus the bits to clear.
216 An empty string NAME is used to identify the default VALUE. */
217
218#define MASK_88100 0x00000001 /* Target m88100 */
219#define MASK_88110 0x00000002 /* Target m88110 */
220#define MASK_OCS_DEBUG_INFO 0x00000004 /* Emit .tdesc info */
221#define MASK_OCS_FRAME_POSITION 0x00000008 /* Debug frame = CFA, not r30 */
222#define MASK_SVR4 0x00000010 /* Target is AT&T System V.4 */
223#define MASK_VERSION_0300 0x00000020 /* Use version 03.00 syntax */
224#define MASK_NO_UNDERSCORES 0x00000040 /* Don't emit a leading `_' */
225#define MASK_BIG_PIC 0x00000080 /* PIC with large got-rel's -fPIC */
226#define MASK_TRAP_LARGE_SHIFT 0x00000100 /* Trap if shift not <= 31 */
227#define MASK_HANDLE_LARGE_SHIFT 0x00000200 /* Handle shift count >= 32 */
228#define MASK_CHECK_ZERO_DIV 0x00000400 /* Check for int div. by 0 */
229#define MASK_USE_DIV 0x00000800 /* No signed div. checks */
230#define MASK_IDENTIFY_REVISION 0x00001000 /* Emit ident, with GCC rev */
231#define MASK_WARN_PASS_STRUCT 0x00002000 /* Warn about passed structs */
232#define MASK_OPTIMIZE_ARG_AREA 0x00004000 /* Save stack space */
233
234#define MASK_88000 (MASK_88100 | MASK_88110)
235#define MASK_EITHER_LARGE_SHIFT (MASK_TRAP_LARGE_SHIFT | \
236 MASK_HANDLE_LARGE_SHIFT)
237
238#define TARGET_88100 ((target_flags & MASK_88000) == MASK_88100)
239#define TARGET_88110 ((target_flags & MASK_88000) == MASK_88110)
240#define TARGET_88000 ((target_flags & MASK_88000) == MASK_88000)
241
242#define TARGET_OCS_DEBUG_INFO (target_flags & MASK_OCS_DEBUG_INFO)
243#define TARGET_OCS_FRAME_POSITION (target_flags & MASK_OCS_FRAME_POSITION)
244#define TARGET_SVR4 (target_flags & MASK_SVR4)
245#define TARGET_VERSION_0300 (target_flags & MASK_VERSION_0300)
246#define TARGET_NO_UNDERSCORES (target_flags & MASK_NO_UNDERSCORES)
247#define TARGET_BIG_PIC (target_flags & MASK_BIG_PIC)
248#define TARGET_TRAP_LARGE_SHIFT (target_flags & MASK_TRAP_LARGE_SHIFT)
249#define TARGET_HANDLE_LARGE_SHIFT (target_flags & MASK_HANDLE_LARGE_SHIFT)
250#define TARGET_CHECK_ZERO_DIV (target_flags & MASK_CHECK_ZERO_DIV)
251#define TARGET_USE_DIV (target_flags & MASK_USE_DIV)
252#define TARGET_IDENTIFY_REVISION (target_flags & MASK_IDENTIFY_REVISION)
253#define TARGET_WARN_PASS_STRUCT (target_flags & MASK_WARN_PASS_STRUCT)
254#define TARGET_OPTIMIZE_ARG_AREA (target_flags & MASK_OPTIMIZE_ARG_AREA)
255
256#define TARGET_EITHER_LARGE_SHIFT (target_flags & MASK_EITHER_LARGE_SHIFT)
257
258/* Redefined in m88kv3.h,m88kv4.h, and m88kdgux.h. */
259#define TARGET_DEFAULT (MASK_CHECK_ZERO_DIV)
260#define CPU_DEFAULT MASK_88100
261
262#define TARGET_SWITCHES \
263 { \
264 { "88110", MASK_88110 }, \
265 { "88100", MASK_88100 }, \
266 { "88000", MASK_88000 }, \
267 { "ocs-debug-info", MASK_OCS_DEBUG_INFO }, \
268 { "no-ocs-debug-info", -MASK_OCS_DEBUG_INFO }, \
269 { "ocs-frame-position", MASK_OCS_FRAME_POSITION }, \
270 { "no-ocs-frame-position", -MASK_OCS_FRAME_POSITION }, \
271 { "svr4", MASK_SVR4 }, \
272 { "svr3", -MASK_SVR4 }, \
273 { "version-03.00", MASK_VERSION_0300 }, \
274 { "no-underscores", MASK_NO_UNDERSCORES }, \
275 { "big-pic", MASK_BIG_PIC }, \
276 { "trap-large-shift", MASK_TRAP_LARGE_SHIFT }, \
277 { "handle-large-shift", MASK_HANDLE_LARGE_SHIFT }, \
278 { "check-zero-division", MASK_CHECK_ZERO_DIV }, \
279 { "no-check-zero-division", -MASK_CHECK_ZERO_DIV }, \
280 { "use-div-instruction", MASK_USE_DIV }, \
281 { "identify-revision", MASK_IDENTIFY_REVISION }, \
282 { "warn-passed-structs", MASK_WARN_PASS_STRUCT }, \
283 { "optimize-arg-area", MASK_OPTIMIZE_ARG_AREA }, \
284 { "no-optimize-arg-area", -MASK_OPTIMIZE_ARG_AREA }, \
285 SUBTARGET_SWITCHES \
286 /* Default switches */ \
287 { "", TARGET_DEFAULT }, \
288 }
289
290/* Redefined in m88kdgux.h. */
291#define SUBTARGET_SWITCHES
292
293/* Macro to define table for command options with values. */
294
295#define TARGET_OPTIONS { { "short-data-", &m88k_short_data } }
296
297/* Do any checking or such that is needed after processing the -m switches. */
298
299#define OVERRIDE_OPTIONS \
300 do { \
301 register int i; \
302 \
303 if ((target_flags & MASK_88000) == 0) \
304 target_flags |= CPU_DEFAULT; \
305 \
2d6cb879
TW
306 m88k_cpu = (TARGET_88000 ? CPU_M88000 \
307 : (TARGET_88100 ? CPU_M88100 : CPU_M88110)); \
308 \
79e68feb
RS
309 if (TARGET_BIG_PIC) \
310 flag_pic = 2; \
311 \
312 if ((target_flags & MASK_EITHER_LARGE_SHIFT) == MASK_EITHER_LARGE_SHIFT) \
313 error ("-mtrap-large-shift and -mhandle-large-shift are incompatible");\
314 \
315 if (VERSION_0300_SYNTAX) \
316 { \
317 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) \
318 reg_names[i]--; \
319 m88k_pound_sign = "#"; \
320 } \
321 \
322 if (m88k_short_data) \
323 { \
324 char *p = m88k_short_data; \
325 while (*p) \
326 if (*p >= '0' && *p <= '9') \
327 p++; \
328 else \
329 { \
330 error ("Invalid option `-mshort-data-%s'", m88k_short_data); \
331 break; \
332 } \
333 m88k_gp_threshold = atoi (m88k_short_data); \
334 if (flag_pic) \
335 error ("-mshort-data-%s and PIC are incompatible", m88k_short_data); \
336 } \
337 } while (0)
338\f
339/*** Storage Layout ***/
340
341/* Sizes in bits of the various types. */
342#define CHAR_TYPE_SIZE 8
343#define SHORT_TYPE_SIZE 16
344#define INT_TYPE_SIZE 32
345#define LONG_TYPE_SIZE 32
346#define LONG_LONG_TYPE_SIZE 64
347#define FLOAT_TYPE_SIZE 32
348#define DOUBLE_TYPE_SIZE 64
349#define LONG_DOUBLE_TYPE_SIZE 64
350
351/* Define this if most significant bit is lowest numbered
352 in instructions that operate on numbered bit-fields.
353 Somewhat arbitrary. It matches the bit field patterns. */
354#define BITS_BIG_ENDIAN 1
355
356/* Define this if most significant byte of a word is the lowest numbered.
357 That is true on the m88000. */
358#define BYTES_BIG_ENDIAN 1
359
360/* Define this if most significant word of a multiword number is the lowest
361 numbered.
362 For the m88000 we can decide arbitrarily since there are no machine
363 instructions for them. */
364#define WORDS_BIG_ENDIAN 1
365
de857550 366/* Number of bits in an addressable storage unit */
79e68feb
RS
367#define BITS_PER_UNIT 8
368
369/* Width in bits of a "word", which is the contents of a machine register.
370 Note that this is not necessarily the width of data type `int';
371 if using 16-bit ints on a 68000, this would still be 32.
372 But on a machine with 16-bit registers, this would be 16. */
373#define BITS_PER_WORD 32
374
375/* Width of a word, in units (bytes). */
376#define UNITS_PER_WORD 4
377
378/* Width in bits of a pointer.
379 See also the macro `Pmode' defined below. */
380#define POINTER_SIZE 32
381
382/* Allocation boundary (in *bits*) for storing arguments in argument list. */
383#define PARM_BOUNDARY 32
384
385/* Largest alignment for stack parameters (if greater than PARM_BOUNDARY). */
386#define MAX_PARM_BOUNDARY 64
387
388/* Boundary (in *bits*) on which stack pointer should be aligned. */
389#define STACK_BOUNDARY 128
390
ad4c6463
TW
391/* Allocation boundary (in *bits*) for the code of a function.
392 Pack code tightly when compiling crtstuff.c. */
393#define FUNCTION_BOUNDARY (flag_inhibit_size_directive ? 32 : 128)
79e68feb
RS
394
395/* No data type wants to be aligned rounder than this. */
396#define BIGGEST_ALIGNMENT 64
397
398/* Make strings word-aligned so strcpy from constants will be faster. */
399#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
400 (TREE_CODE (EXP) == STRING_CST \
401 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
402
403/* Make arrays of chars word-aligned for the same reasons. */
404#define DATA_ALIGNMENT(TYPE, ALIGN) \
405 (TREE_CODE (TYPE) == ARRAY_TYPE \
406 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
407 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
408
409/* Alignment of field after `int : 0' in a structure.
410 Ignored with PCC_BITFIELD_TYPE_MATTERS. */
411/* #define EMPTY_FIELD_BOUNDARY 8 */
412
413/* Every structure's size must be a multiple of this. */
414#define STRUCTURE_SIZE_BOUNDARY 8
415
de857550 416/* Set this nonzero if move instructions will actually fail to work
79e68feb 417 when given unaligned data. */
de857550 418#define STRICT_ALIGNMENT 1
79e68feb
RS
419
420/* A bitfield declared as `int' forces `int' alignment for the struct. */
421#define PCC_BITFIELD_TYPE_MATTERS 1
422
423/* Maximum size (in bits) to use for the largest integral type that
424 replaces a BLKmode type. */
425/* #define MAX_FIXED_MODE_SIZE 0 */
426
dfa69feb
TW
427/* Check a `double' value for validity for a particular machine mode.
428 This is defined to avoid crashes outputting certain constants.
429 Since we output the number in hex, the assembler won't choke on it. */
430/* #define CHECK_FLOAT_VALUE(MODE,VALUE) */
79e68feb
RS
431
432/* A code distinguishing the floating point format of the target machine. */
433/* #define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT */
434\f
435/*** Register Usage ***/
436
437/* Number of actual hardware registers.
438 The hardware registers are assigned numbers for the compiler
439 from 0 to just below FIRST_PSEUDO_REGISTER.
440 All registers that the compiler knows about must be given numbers,
441 even those that are not normally considered general registers.
442
a9c3f03a
TW
443 The m88100 has a General Register File (GRF) of 32 32-bit registers.
444 The m88110 adds an Extended Register File (XRF) of 32 80-bit registers. */
445#define FIRST_PSEUDO_REGISTER 64
446#define FIRST_EXTENDED_REGISTER 32
447
448/* General notes on extended registers, their use and misuse.
449
450 Possible good uses:
451
452 spill area instead of memory.
453 -waste if only used once
454
2296cba3 455 floating point calculations
a9c3f03a
TW
456 -probably a waste unless we have run out of general purpose registers
457
458 freeing up general purpose registers
459 -e.g. may be able to have more loop invariants if floating
460 point is moved into extended registers.
461
462
463 I've noticed wasteful moves into and out of extended registers; e.g. a load
464 into x21, then inside a loop a move into r24, then r24 used as input to
465 an fadd. Why not just load into r24 to begin with? Maybe the new cse.c
466 will address this. This wastes a move, but the load,store and move could
467 have been saved had extended registers been used throughout.
468 E.g. in the code following code, if z and xz are placed in extended
469 registers, there is no need to save preserve registers.
470
471 long c=1,d=1,e=1,f=1,g=1,h=1,i=1,j=1,k;
472
473 double z=0,xz=4.5;
474
475 foo(a,b)
476 long a,b;
477 {
478 while (a < b)
479 {
480 k = b + c + d + e + f + g + h + a + i + j++;
481 z += xz;
482 a++;
483 }
484 printf("k= %d; z=%f;\n", k, z);
485 }
486
487 I've found that it is possible to change the constraints (putting * before
488 the 'r' constraints int the fadd.ddd instruction) and get the entire
489 addition and store to go into extended registers. However, this also
490 forces simple addition and return of floating point arguments to a
491 function into extended registers. Not the correct solution.
492
493 Found the following note in local-alloc.c which may explain why I can't
494 get both registers to be in extended registers since two are allocated in
495 local-alloc and one in global-alloc. Doesn't explain (I don't believe)
496 why an extended register is used instead of just using the preserve
497 register.
498
499 from local-alloc.c:
500 We have provision to exempt registers, even when they are contained
501 within the block, that can be tied to others that are not contained in it.
502 This is so that global_alloc could process them both and tie them then.
503 But this is currently disabled since tying in global_alloc is not
504 yet implemented.
505
2296cba3
RS
506 The explanation of why the preserved register is not used is as follows,
507 I believe. The registers are being allocated in order. Tying is not
a9c3f03a
TW
508 done so efficiently, so when it comes time to do the first allocation,
509 there are no registers left to use without spilling except extended
510 registers. Then when the next pseudo register needs a hard reg, there
511 are still no registers to be had for free, but this one must be a GRF
512 reg instead of an extended reg, so a preserve register is spilled. Thus
513 the move from extended to GRF is necessitated. I do not believe this can
514 be 'fixed' through the config/*m88k* files.
515
516 gcc seems to sometimes make worse use of register allocation -- not counting
517 moves -- whenever extended registers are present. For example in the
518 whetstone, the simple for loop (slightly modified)
519 for(i = 1; i <= n1; i++)
520 {
521 x1 = (x1 + x2 + x3 - x4) * t;
522 x2 = (x1 + x2 - x3 + x4) * t;
523 x3 = (x1 - x2 + x3 + x4) * t;
524 x4 = (x1 + x2 + x3 + x4) * t;
525 }
526 in general loads the high bits of the addresses of x2-x4 and i into registers
527 outside the loop. Whenever extended registers are used, it loads all of
528 these inside the loop. My conjecture is that since the 88110 has so many
529 registers, and gcc makes no distinction at this point -- just that they are
530 not fixed, that in loop.c it believes it can expect a number of registers
531 to be available. Then it allocates 'too many' in local-alloc which causes
532 problems later. 'Too many' are allocated because a large portion of the
533 registers are extended registers and cannot be used for certain purposes
534 ( e.g. hold the address of a variable). When this loop is compiled on its
535 own, the problem does not occur. I don't know the solution yet, though it
536 is probably in the base sources. Possibly a different way to calculate
537 "threshold". */
538
539/* 1 for registers that have pervasive standard uses and are not available
540 for the register allocator. Registers r14-r25 and x22-x29 are expected
541 to be preserved across function calls.
542
543 On the 88000, the standard uses of the General Register File (GRF) are:
79e68feb
RS
544 Reg 0 = Pseudo argument pointer (hardware fixed to 0).
545 Reg 1 = Subroutine return pointer (hardware).
546 Reg 2-9 = Parameter registers (OCS).
547 Reg 10 = OCS reserved temporary.
548 Reg 11 = Static link if needed [OCS reserved temporary].
549 Reg 12 = Address of structure return (OCS).
550 Reg 13 = OCS reserved temporary.
551 Reg 14-25 = Preserved register set.
552 Reg 26-29 = Reserved by OCS and ABI.
553 Reg 30 = Frame pointer (Common use).
a9c3f03a
TW
554 Reg 31 = Stack pointer.
555
556 The following follows the current 88open UCS specification for the
557 Extended Register File (XRF):
558 Reg 32 = x0 Always equal to zero
2296cba3 559 Reg 33-53 = x1-x21 Temporary registers (Caller Save)
a9c3f03a
TW
560 Reg 54-61 = x22-x29 Preserver registers (Callee Save)
561 Reg 62-63 = x30-x31 Reserved for future ABI use.
562
563 Note: The current 88110 extended register mapping is subject to change.
564 The bias towards caller-save registers is based on the
565 presumption that memory traffic can potentially be reduced by
566 allowing the "caller" to save only that part of the register
567 which is actually being used. (i.e. don't do a st.x if a st.d
568 is sufficient). Also, in scientific code (a.k.a. Fortran), the
569 large number of variables defined in common blocks may require
570 that almost all registers be saved across calls anyway. */
79e68feb
RS
571
572#define FIXED_REGISTERS \
dfa69feb 573 {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
a9c3f03a
TW
574 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
575 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
576 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}
79e68feb
RS
577
578/* 1 for registers not available across function calls.
579 These must include the FIXED_REGISTERS and also any
580 registers that can be used without being saved.
581 The latter must include the registers where values are returned
582 and the register where structure-value addresses are passed.
583 Aside from that, you can include as many other registers as you like. */
584
585#define CALL_USED_REGISTERS \
586 {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, \
a9c3f03a
TW
587 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
588 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
589 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}
79e68feb
RS
590
591/* Macro to conditionally modify fixed_regs/call_used_regs. */
592#define CONDITIONAL_REGISTER_USAGE \
593 { \
a9c3f03a
TW
594 if (! TARGET_88110) \
595 { \
596 register int i; \
597 for (i = FIRST_EXTENDED_REGISTER; i < FIRST_PSEUDO_REGISTER; i++) \
598 { \
599 fixed_regs[i] = 1; \
600 call_used_regs[i] = 1; \
601 } \
602 } \
79e68feb 603 if (flag_pic) \
a9c3f03a
TW
604 { \
605 /* Current hack to deal with -fpic -O2 problems. */ \
606 fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
607 call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
608 global_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
609 } \
79e68feb
RS
610 }
611
612/* These interfaces that don't apply to the m88000. */
613/* OVERLAPPING_REGNO_P(REGNO) 0 */
614/* INSN_CLOBBERS_REGNO_P(INSN, REGNO) 0 */
615/* PRESERVE_DEATH_INFO_REGNO_P(REGNO) 0 */
616
617/* Return number of consecutive hard regs needed starting at reg REGNO
618 to hold something of mode MODE.
619 This is ordinarily the length in words of a value of mode MODE
620 but can be less for certain modes in special long registers.
621
a9c3f03a
TW
622 On the m88000, GRF registers hold 32-bits and XRF registers hold 80-bits.
623 An XRF register can hold any mode, but two GRF registers are required
624 for larger modes. */
625#define HARD_REGNO_NREGS(REGNO, MODE) \
626 ((REGNO < FIRST_PSEUDO_REGISTER && REGNO >= FIRST_EXTENDED_REGISTER) \
627 ? 1 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
79e68feb
RS
628
629/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
630
631 For double integers, we never put the value into an odd register so that
632 the operators don't run into the situation where the high part of one of
a9c3f03a
TW
633 the inputs is the low part of the result register. (It's ok if the output
634 registers are the same as the input registers.) The XRF registers can
635 hold all modes, but only DF and SF modes can be manipulated in these
636 registers. The compiler should be allowed to use these as a fast spill
637 area. */
638#define HARD_REGNO_MODE_OK(REGNO, MODE) \
639 ((REGNO < FIRST_PSEUDO_REGISTER && REGNO >= FIRST_EXTENDED_REGISTER) \
640 ? TARGET_88110 \
641 : (((MODE) != DImode && (MODE) != DFmode && (MODE) != DCmode) \
642 || ((REGNO) & 1) == 0))
79e68feb
RS
643
644/* Value is 1 if it is a good idea to tie two pseudo registers
645 when one has mode MODE1 and one has mode MODE2.
646 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
647 for any hard reg, then this must be 0 for correct output. */
648#define MODES_TIEABLE_P(MODE1, MODE2) \
649 (((MODE1) == DFmode || (MODE1) == DCmode || (MODE1) == DImode) \
650 == ((MODE2) == DFmode || (MODE2) == DCmode || (MODE2) == DImode))
651
652/* Specify the registers used for certain standard purposes.
653 The values of these macros are register numbers. */
654
655/* the m88000 pc isn't overloaded on a register that the compiler knows about. */
656/* #define PC_REGNUM */
657
658/* Register to use for pushing function arguments. */
659#define STACK_POINTER_REGNUM 31
660
661/* Base register for access to local variables of the function. */
662#define FRAME_POINTER_REGNUM 30
663
664/* Base register for access to arguments of the function. */
665#define ARG_POINTER_REGNUM 0
666
667/* Register used in cases where a temporary is known to be safe to use. */
668#define TEMP_REGNUM 10
669
670/* Register in which static-chain is passed to a function. */
671#define STATIC_CHAIN_REGNUM 11
672
673/* Register in which address to store a structure value
674 is passed to a function. */
675#define STRUCT_VALUE_REGNUM 12
676
677/* Register to hold the addressing base for position independent
678 code access to data items. */
679#define PIC_OFFSET_TABLE_REGNUM 25
680
681/* Order in which registers are preferred (most to least). Use temp
682 registers, then param registers top down. Preserve registers are
683 top down to maximize use of double memory ops for register save.
a9c3f03a
TW
684 The 88open reserved registers (r26-r29 and x30-x31) may commonly be used
685 in most environments with the -fcall-used- or -fcall-saved- options. */
686#define REG_ALLOC_ORDER \
687 { \
688 13, 12, 11, 10, 29, 28, 27, 26, \
dfa69feb
TW
689 62, 63, 9, 8, 7, 6, 5, 4, \
690 3, 2, 1, 53, 52, 51, 50, 49, \
a9c3f03a
TW
691 48, 47, 46, 45, 44, 43, 42, 41, \
692 40, 39, 38, 37, 36, 35, 34, 33, \
693 25, 24, 23, 22, 21, 20, 19, 18, \
694 17, 16, 15, 14, 61, 60, 59, 58, \
695 57, 56, 55, 54, 30, 31, 0, 32}
dfa69feb
TW
696
697/* Order for leaf functions. */
698#define REG_LEAF_ALLOC_ORDER \
699 { \
700 9, 8, 7, 6, 13, 12, 11, 10, \
701 29, 28, 27, 26, 62, 63, 5, 4, \
702 3, 2, 0, 53, 52, 51, 50, 49, \
703 48, 47, 46, 45, 44, 43, 42, 41, \
704 40, 39, 38, 37, 36, 35, 34, 33, \
705 25, 24, 23, 22, 21, 20, 19, 18, \
706 17, 16, 15, 14, 61, 60, 59, 58, \
707 57, 56, 55, 54, 30, 31, 1, 32}
708
709/* Switch between the leaf and non-leaf orderings. The purpose is to avoid
710 write-over scoreboard delays between caller and callee. */
711#define ORDER_REGS_FOR_LOCAL_ALLOC \
712{ \
713 static int leaf[] = REG_LEAF_ALLOC_ORDER; \
714 static int nonleaf[] = REG_ALLOC_ORDER; \
715 \
716 bcopy (regs_ever_live[1] ? nonleaf : leaf, reg_alloc_order, \
717 FIRST_PSEUDO_REGISTER * sizeof (int)); \
718}
79e68feb
RS
719\f
720/*** Register Classes ***/
721
722/* Define the classes of registers for register constraints in the
723 machine description. Also define ranges of constants.
724
725 One of the classes must always be named ALL_REGS and include all hard regs.
726 If there is more than one class, another class must be named NO_REGS
727 and contain no registers.
728
729 The name GENERAL_REGS must be the name of a class (or an alias for
730 another name such as ALL_REGS). This is the class of registers
731 that is allowed by "g" or "r" in a register constraint.
732 Also, registers outside this class are allocated only when
733 instructions express preferences for them.
734
735 The classes must be numbered in nondecreasing order; that is,
736 a larger-numbered class must never be contained completely
737 in a smaller-numbered class.
738
739 For any two classes, it is very desirable that there be another
740 class that represents their union. */
741
a9c3f03a 742/* The m88000 hardware has two kinds of registers. In addition, we denote
79e68feb
RS
743 the arg pointer as a separate class. */
744
a9c3f03a
TW
745enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS,
746 XGRF_REGS, ALL_REGS, LIM_REG_CLASSES };
79e68feb
RS
747
748#define N_REG_CLASSES (int) LIM_REG_CLASSES
749
750/* Give names of register classes as strings for dump file. */
a9c3f03a
TW
751#define REG_CLASS_NAMES {"NO_REGS", "AP_REG", "XRF_REGS", "GENERAL_REGS", \
752 "AGRF_REGS", "XGRF_REGS", "ALL_REGS" }
79e68feb
RS
753
754/* Define which registers fit in which classes.
755 This is an initializer for a vector of HARD_REG_SET
756 of length N_REG_CLASSES. */
a9c3f03a
TW
757#define REG_CLASS_CONTENTS {{0x00000000, 0x00000000}, \
758 {0x00000001, 0x00000000}, \
759 {0x00000000, 0xffffffff}, \
760 {0xfffffffe, 0x00000000}, \
761 {0xffffffff, 0x00000000}, \
762 {0xfffffffe, 0xffffffff}, \
763 {0xffffffff, 0xffffffff}}
79e68feb
RS
764
765/* The same information, inverted:
766 Return the class number of the smallest class containing
767 reg number REGNO. This could be a conditional expression
768 or could index an array. */
a9c3f03a
TW
769#define REGNO_REG_CLASS(REGNO) \
770 ((REGNO) ? ((REGNO < 32) ? GENERAL_REGS : XRF_REGS) : AP_REG)
79e68feb
RS
771
772/* The class value for index registers, and the one for base regs. */
a9c3f03a 773#define BASE_REG_CLASS AGRF_REGS
79e68feb
RS
774#define INDEX_REG_CLASS GENERAL_REGS
775
a9c3f03a
TW
776/* Get reg_class from a letter such as appears in the machine description.
777 For the 88000, the following class/letter is defined for the XRF:
778 x - Extended register file */
779#define REG_CLASS_FROM_LETTER(C) \
780 (((C) == 'x') ? XRF_REGS : NO_REGS)
79e68feb
RS
781
782/* Macros to check register numbers against specific register classes.
783 These assume that REGNO is a hard or pseudo reg number.
784 They give nonzero only if REGNO is a hard reg of the suitable class
785 or a pseudo reg currently allocated to a suitable hard reg.
786 Since they use reg_renumber, they are safe only once reg_renumber
787 has been allocated, which happens in local-alloc.c. */
a9c3f03a
TW
788#define REGNO_OK_FOR_BASE_P(REGNO) \
789 ((REGNO) < FIRST_EXTENDED_REGISTER \
790 || (unsigned) reg_renumber[REGNO] < FIRST_EXTENDED_REGISTER)
791#define REGNO_OK_FOR_INDEX_P(REGNO) \
792 (((REGNO) && (REGNO) < FIRST_EXTENDED_REGISTER) \
793 || (unsigned) reg_renumber[REGNO] < FIRST_EXTENDED_REGISTER)
79e68feb
RS
794
795/* Given an rtx X being reloaded into a reg required to be
796 in class CLASS, return the class of reg to actually use.
797 In general this is just CLASS; but on some machines
798 in some cases it is preferable to use a more restrictive class.
799 Double constants should be in a register iff they can be made cheaply. */
a9c3f03a
TW
800#define PREFERRED_RELOAD_CLASS(X,CLASS) \
801 (CONSTANT_P(X) && (CLASS == XRF_REGS) ? NO_REGS : (CLASS))
79e68feb
RS
802
803/* Return the maximum number of consecutive registers
804 needed to represent mode MODE in a register of class CLASS. */
a9c3f03a
TW
805#define CLASS_MAX_NREGS(CLASS, MODE) \
806 ((((CLASS) == XRF_REGS) ? 1 \
807 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)))
79e68feb
RS
808
809/* Letters in the range `I' through `P' in a register constraint string can
810 be used to stand for particular ranges of immediate operands. The C
811 expression is true iff C is a known letter and VALUE is appropriate for
812 that letter.
813
de857550 814 For the m88000, the following constants are used:
79e68feb
RS
815 `I' requires a non-negative 16-bit value.
816 `J' requires a non-positive 16-bit value.
817 `K' is unused.
818 `L' requires a constant with only the upper 16-bits set.
819 `M' requires constant values that can be formed with `set'.
820 `N' requires a negative value.
821 `O' requires zero.
822 `P' requires a non-negative value. */
823
824/* Quick tests for certain values. */
825#define SMALL_INT(X) (SMALL_INTVAL (INTVAL (X)))
826#define SMALL_INTVAL(I) ((unsigned) (I) < 0x10000)
827#define ADD_INT(X) (ADD_INTVAL (INTVAL (X)))
828#define ADD_INTVAL(I) ((unsigned) (I) + 0xffff < 0x1ffff)
829#define POWER_OF_2(I) ((I) && POWER_OF_2_or_0(I))
830#define POWER_OF_2_or_0(I) (((I) & ((unsigned)(I) - 1)) == 0)
831
832#define CONST_OK_FOR_LETTER_P(VALUE, C) \
833 ((C) == 'I' ? SMALL_INTVAL (VALUE) \
834 : (C) == 'J' ? SMALL_INTVAL (-(VALUE)) \
835 : (C) == 'L' ? ((VALUE) & 0xffff) == 0 \
836 : (C) == 'M' ? integer_ok_for_set (VALUE) \
837 : (C) == 'N' ? (VALUE) < 0 \
838 : (C) == 'O' ? (VALUE) == 0 \
839 : (C) == 'P' ? (VALUE) >= 0 \
840 : 0)
841
842/* Similar, but for floating constants, and defining letters G and H.
843 Here VALUE is the CONST_DOUBLE rtx itself. For the m88000, the
844 constraints are: `G' requires zero, and `H' requires one or two. */
845#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
846 ((C) == 'G' ? (CONST_DOUBLE_HIGH (VALUE) == 0 \
847 && CONST_DOUBLE_LOW (VALUE) == 0) \
848 : 0)
849
850/* Letters in the range `Q' through `U' in a register constraint string
851 may be defined in a machine-dependent fashion to stand for arbitrary
852 operand types.
853
854 For the m88k, `Q' handles addresses in a call context. */
855
856#define EXTRA_CONSTRAINT(OP, C) \
857 ((C) == 'Q' ? symbolic_address_p (OP) : 0)
858\f
859/*** Describing Stack Layout ***/
860
861/* Define this if pushing a word on the stack moves the stack pointer
862 to a smaller address. */
863#define STACK_GROWS_DOWNWARD
864
865/* Define this if the addresses of local variable slots are at negative
866 offsets from the frame pointer. */
867/* #define FRAME_GROWS_DOWNWARD */
868
869/* Offset from the frame pointer to the first local variable slot to be
870 allocated. For the m88k, the debugger wants the return address (r1)
871 stored at location r30+4, and the previous frame pointer stored at
872 location r30. */
873#define STARTING_FRAME_OFFSET 8
874
875/* If we generate an insn to push BYTES bytes, this says how many the
876 stack pointer really advances by. The m88k has no push instruction. */
877/* #define PUSH_ROUNDING(BYTES) */
878
879/* If defined, the maximum amount of space required for outgoing arguments
880 will be computed and placed into the variable
881 `current_function_outgoing_args_size'. No space will be pushed
882 onto the stack for each call; instead, the function prologue should
883 increase the stack frame size by this amount. */
884#define ACCUMULATE_OUTGOING_ARGS
885
886/* Offset from the stack pointer register to the first location at which
887 outgoing arguments are placed. Use the default value zero. */
888/* #define STACK_POINTER_OFFSET 0 */
889
890/* Offset of first parameter from the argument pointer register value.
891 Using an argument pointer, this is 0 for the m88k. GCC knows
892 how to eliminate the argument pointer references if necessary. */
893#define FIRST_PARM_OFFSET(FNDECL) 0
894
895/* Define this if functions should assume that stack space has been
896 allocated for arguments even when their values are passed in
897 registers.
898
899 The value of this macro is the size, in bytes, of the area reserved for
900 arguments passed in registers.
901
902 This space can either be allocated by the caller or be a part of the
903 machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE'
904 says which. */
905#define REG_PARM_STACK_SPACE(FNDECL) 32
906
907/* Define this macro if REG_PARM_STACK_SPACE is defined but stack
908 parameters don't skip the area specified by REG_PARM_STACK_SPACE.
909 Normally, when a parameter is not passed in registers, it is placed on
910 the stack beyond the REG_PARM_STACK_SPACE area. Defining this macro
911 suppresses this behavior and causes the parameter to be passed on the
912 stack in its natural location. */
913#define STACK_PARMS_IN_REG_PARM_AREA
914
915/* Define this if it is the responsibility of the caller to allocate the
916 area reserved for arguments passed in registers. If
917 `ACCUMULATE_OUTGOING_ARGS' is also defined, the only effect of this
918 macro is to determine whether the space is included in
919 `current_function_outgoing_args_size'. */
920/* #define OUTGOING_REG_PARM_STACK_SPACE */
921
922/* Offset from the stack pointer register to an item dynamically allocated
923 on the stack, e.g., by `alloca'.
924
925 The default value for this macro is `STACK_POINTER_OFFSET' plus the
926 length of the outgoing arguments. The default is correct for most
927 machines. See `function.c' for details. */
928/* #define STACK_DYNAMIC_OFFSET(FUNDECL) ... */
929
930/* Value is the number of bytes of arguments automatically
931 popped when returning from a subroutine call.
932 FUNTYPE is the data type of the function (as a tree),
933 or for a library call it is an identifier node for the subroutine name.
934 SIZE is the number of bytes of arguments passed on the stack. */
935#define RETURN_POPS_ARGS(FUNTYPE,SIZE) 0
936
937/* Define how to find the value returned by a function.
938 VALTYPE is the data type of the value (as a tree).
939 If the precise function being called is known, FUNC is its FUNCTION_DECL;
940 otherwise, FUNC is 0. */
941#define FUNCTION_VALUE(VALTYPE, FUNC) \
942 gen_rtx (REG, \
943 TYPE_MODE (VALTYPE) == BLKmode ? SImode : TYPE_MODE (VALTYPE), \
944 2)
945
946/* Define this if it differs from FUNCTION_VALUE. */
947/* #define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) ... */
948
949/* Disable the promotion of some structures and unions to registers. */
950#define RETURN_IN_MEMORY(TYPE) \
951 ((TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE(TYPE) == UNION_TYPE) \
952 && !(TYPE_MODE (TYPE) == SImode \
953 || (TYPE_MODE (TYPE) == BLKmode \
954 && TYPE_ALIGN (TYPE) == BITS_PER_WORD \
955 && int_size_in_bytes (TYPE) == UNITS_PER_WORD)))
956
957/* Define how to find the value returned by a library function
958 assuming the value has mode MODE. */
959#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 2)
960
961/* True if N is a possible register number for a function value
962 as seen by the caller. */
963#define FUNCTION_VALUE_REGNO_P(N) ((N) == 2)
964
965/* Determine whether a function argument is passed in a register, and
966 which register. See m88k.c. */
967#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
968 m88k_function_arg (CUM, MODE, TYPE, NAMED)
969
970/* Define this if it differs from FUNCTION_ARG. */
971/* #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) ... */
972
973/* A C expression for the number of words, at the beginning of an
974 argument, must be put in registers. The value must be zero for
975 arguments that are passed entirely in registers or that are entirely
976 pushed on the stack. */
977#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) (0)
978
979/* A C expression that indicates when an argument must be passed by
980 reference. If nonzero for an argument, a copy of that argument is
981 made in memory and a pointer to the argument is passed instead of the
982 argument itself. The pointer is passed in whatever way is appropriate
983 for passing a pointer to that type. */
984#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) (0)
985
986/* A C type for declaring a variable that is used as the first argument
987 of `FUNCTION_ARG' and other related values. It suffices to count
988 the number of words of argument so far. */
989#define CUMULATIVE_ARGS int
990
991/* Initialize a variable CUM of type CUMULATIVE_ARGS for a call to a
992 function whose data type is FNTYPE. For a library call, FNTYPE is 0. */
993#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) ((CUM) = 0)
994
995/* A C statement (sans semicolon) to update the summarizer variable
996 CUM to advance past an argument in the argument list. The values
997 MODE, TYPE and NAMED describe that argument. Once this is done,
998 the variable CUM is suitable for analyzing the *following* argument
999 with `FUNCTION_ARG', etc. (TYPE is null for libcalls where that
1000 information may not be available.) */
1001#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1002 do { \
1003 enum machine_mode __mode = (TYPE) ? TYPE_MODE (TYPE) : (MODE); \
1004 if ((CUM & 1) \
1005 && (__mode == DImode || __mode == DFmode \
1006 || ((TYPE) && TYPE_ALIGN (TYPE) > BITS_PER_WORD))) \
1007 CUM++; \
1008 CUM += (((__mode != BLKmode) \
1009 ? GET_MODE_SIZE (MODE) : int_size_in_bytes (TYPE)) \
1010 + 3) / 4; \
1011 } while (0)
1012
1013/* True if N is a possible register number for function argument passing.
1014 On the m88000, these are registers 2 through 9. */
1015#define FUNCTION_ARG_REGNO_P(N) ((N) <= 9 && (N) >= 2)
1016
1017/* A C expression which determines whether, and in which direction,
1018 to pad out an argument with extra space. The value should be of
1019 type `enum direction': either `upward' to pad above the argument,
1020 `downward' to pad below, or `none' to inhibit padding.
1021
1022 This macro does not control the *amount* of padding; that is always
1023 just enough to reach the next multiple of `FUNCTION_ARG_BOUNDARY'. */
1024#define FUNCTION_ARG_PADDING(MODE, TYPE) \
1025 ((MODE) == BLKmode \
1026 || ((TYPE) && (TREE_CODE (TYPE) == RECORD_TYPE \
1027 || TREE_CODE (TYPE) == UNION_TYPE)) \
1028 ? upward : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY ? downward : none)
1029
1030/* If defined, a C expression that gives the alignment boundary, in bits,
1031 of an argument with the specified mode and type. If it is not defined,
1032 `PARM_BOUNDARY' is used for all arguments. */
1033#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
1034 (((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_SIZE (MODE)) <= PARM_BOUNDARY \
1035 ? PARM_BOUNDARY : 2 * PARM_BOUNDARY)
1036
1037/* Generate necessary RTL for __builtin_saveregs().
1038 ARGLIST is the argument list; see expr.c. */
1039#define EXPAND_BUILTIN_SAVEREGS(ARGLIST) m88k_builtin_saveregs (ARGLIST)
1040
1041/* Generate the assembly code for function entry. */
1042#define FUNCTION_PROLOGUE(FILE, SIZE) m88k_output_prologue(FILE, SIZE)
1043
1044/* Output assembler code to FILE to increment profiler label # LABELNO
1045 for profiling a function entry. Redefined in m88kv3.h, m88kv4.h and
1046 m88kdgux.h. */
1047#define FUNCTION_PROFILER(FILE, LABELNO) \
1048 output_function_profiler (FILE, LABELNO, "mcount", 1)
1049
1050/* Output assembler code to FILE to initialize basic-block profiling for
1051 the current module. LABELNO is unique to each instance. */
1052#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
1053 output_function_block_profiler (FILE, LABELNO)
1054
1055/* Output assembler code to FILE to increment the count associated with
1056 the basic block number BLOCKNO. */
1057#define BLOCK_PROFILER(FILE, BLOCKNO) output_block_profiler (FILE, BLOCKNO)
1058
1059/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1060 the stack pointer does not matter. The value is tested only in
1061 functions that have frame pointers.
1062 No definition is equivalent to always zero. */
1063#define EXIT_IGNORE_STACK (1)
1064
1065/* Generate the assembly code for function exit. */
1066#define FUNCTION_EPILOGUE(FILE, SIZE) m88k_output_epilogue(FILE, SIZE)
1067
1068/* Define the number of delay slots needed for the function epilogue.
1069 These are used for scheduling the function epilogue and depend on
1070 what the epilogue looks like. */
1071#define DELAY_SLOTS_FOR_EPILOGUE delay_slots_for_epilogue ()
1072
1073/* Define whether INSN can be placed in delay slot N for the epilogue. */
1074#define ELIGIBLE_FOR_EPILOGUE_DELAY(INSN,N) \
1075 eligible_for_epilogue_delay (INSN)
1076
1077/* Value should be nonzero if functions must have frame pointers.
1078 Zero means the frame pointer need not be set up (and parms
1079 may be accessed via the stack pointer) in functions that seem suitable.
1080 This is computed in `reload', in reload1.c. */
1081#define FRAME_POINTER_REQUIRED \
1082 (frame_pointer_needed \
1083 || (write_symbols != NO_DEBUG && !TARGET_OCS_FRAME_POSITION))
1084
1085/* Definitions for register eliminations.
1086
1087 We have two registers that can be eliminated on the m88k. First, the
1088 frame pointer register can often be eliminated in favor of the stack
1089 pointer register. Secondly, the argument pointer register can always be
1090 eliminated; it is replaced with either the stack or frame pointer. */
1091
1092/* This is an array of structures. Each structure initializes one pair
1093 of eliminable registers. The "from" register number is given first,
1094 followed by "to". Eliminations of the same "from" register are listed
1095 in order of preference. */
1096#define ELIMINABLE_REGS \
1097{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1098 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
1099 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
1100
1101/* Given FROM and TO register numbers, say whether this elimination
1102 is allowed. */
1103#define CAN_ELIMINATE(FROM, TO) \
1104 (!((FROM) == FRAME_POINTER_REGNUM && FRAME_POINTER_REQUIRED))
1105
1106/* Define the offset between two registers, one to be eliminated, and the other
1107 its replacement, at the start of a routine. */
1108#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1109{ m88k_layout_frame (); \
1110 if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
1111 (OFFSET) = m88k_fp_offset; \
1112 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
1113 (OFFSET) = m88k_stack_size - m88k_fp_offset; \
1114 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
1115 (OFFSET) = m88k_stack_size; \
1116 else \
1117 abort (); \
1118}
1119\f
1120/*** Trampolines for Nested Functions ***/
1121
1122/* Output assembler code for a block containing the constant parts
1123 of a trampoline, leaving space for the variable parts.
1124
1125 This block is placed on the stack and filled in. It is aligned
1126 0 mod 128 and those portions that are executed are constant.
1127 This should work for instruction caches that have cache lines up
1128 to the aligned amount (128 is arbitrary), provided no other code
1129 producer is attempting to play the same game. This of course is
1130 in violation of any number of 88open standards. */
1131
1132#define TRAMPOLINE_TEMPLATE(FILE) \
1133{ \
1134 /* Save the return address (r1) in the static chain reg (r11). */ \
1135 fprintf (FILE, "\tor\t %s,%s,0\n", reg_names[11], reg_names[1]); \
1136 /* Locate this block; transfer to the next instruction. */ \
1137 fprintf (FILE, "\tbsr\t 1\n"); \
1138 /* Save r10; use it as the relative pointer; restore r1. */ \
1139 fprintf (FILE, "\tst\t %s,%s,24\n", reg_names[10], reg_names[1]); \
1140 fprintf (FILE, "\tor\t %s,%s,0\n", reg_names[10], reg_names[1]); \
1141 fprintf (FILE, "\tor\t %s,%s,0\n", reg_names[1], reg_names[11]); \
1142 /* Load the function's address and go there. */ \
1143 fprintf (FILE, "\tld\t %s,%s,32\n", reg_names[11], reg_names[10]); \
1144 fprintf (FILE, "\tjmp.n\t %s\n", reg_names[11]); \
1145 /* Restore r10 and load the static chain register. */ \
1146 fprintf (FILE, "\tld.d\t %s,%s,24\n", reg_names[10], reg_names[10]); \
1147 /* Storage: r10 save area, static chain, function address. */ \
1148 ASM_OUTPUT_INT (FILE, const0_rtx); \
1149 ASM_OUTPUT_INT (FILE, const0_rtx); \
1150 ASM_OUTPUT_INT (FILE, const0_rtx); \
1151}
1152
1153/* Length in units of the trampoline for entering a nested function.
1154 This is really two components. The first 32 bytes are fixed and
1155 must be copied; the last 12 bytes are just storage that's filled
1156 in later. So for allocation purposes, it's 32+12 bytes, but for
de857550 1157 initialization purposes, it's 32 bytes. */
79e68feb
RS
1158
1159#define TRAMPOLINE_SIZE (32+12)
1160
1161/* Alignment required for a trampoline. 128 is used to find the
1162 beginning of a line in the instruction cache and to allow for
1163 instruction cache lines of up to 128 bytes. */
1164
1165#define TRAMPOLINE_ALIGNMENT 128
1166
1167/* Emit RTL insns to initialize the variable parts of a trampoline.
1168 FNADDR is an RTX for the address of the function's pure code.
1169 CXT is an RTX for the static chain value for the function. */
1170
1171#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1172{ \
1173 emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 40)), FNADDR); \
1174 emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 36)), CXT); \
1175}
1176
1177/*** Library Subroutine Names ***/
1178
1179/* Define this macro if GNU CC should generate calls to the System V
1180 (and ANSI C) library functions `memcpy' and `memset' rather than
1181 the BSD functions `bcopy' and `bzero'. */
1182#define TARGET_MEM_FUNCTIONS
1183\f
1184/*** Addressing Modes ***/
1185
1186/* #define HAVE_POST_INCREMENT */
1187/* #define HAVE_POST_DECREMENT */
1188
1189/* #define HAVE_PRE_DECREMENT */
1190/* #define HAVE_PRE_INCREMENT */
1191
1192/* Recognize any constant value that is a valid address. */
1193#define CONSTANT_ADDRESS_P(X) (CONSTANT_P (X))
1194
1195/* Maximum number of registers that can appear in a valid memory address. */
1196#define MAX_REGS_PER_ADDRESS 2
1197
1198/* The condition for memory shift insns. */
1199#define SCALED_ADDRESS_P(ADDR) \
1200 (GET_CODE (ADDR) == PLUS \
1201 && (GET_CODE (XEXP (ADDR, 0)) == MULT \
1202 || GET_CODE (XEXP (ADDR, 1)) == MULT))
1203
1204/* Can the reference to X be made short? */
1205#define SHORT_ADDRESS_P(X,TEMP) \
1206 ((TEMP) = (GET_CODE (X) == CONST ? get_related_value (X) : X), \
1207 ((TEMP) && GET_CODE (TEMP) == SYMBOL_REF && SYMBOL_REF_FLAG (TEMP)))
1208
1209/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1210 that is a valid memory address for an instruction.
1211 The MODE argument is the machine mode for the MEM expression
1212 that wants to use this address.
1213
1214 On the m88000, a legitimate address has the form REG, REG+REG,
1215 REG+SMALLINT, REG+(REG*modesize) (REG[REG]), or SMALLINT.
1216
1217 The register elimination process should deal with the argument
1218 pointer and frame pointer changing to REG+SMALLINT. */
1219
1220#define LEGITIMATE_INDEX_P(X, MODE) \
1221 ((GET_CODE (X) == CONST_INT \
1222 && SMALL_INT (X)) \
1223 || (REG_P (X) \
1224 && REG_OK_FOR_INDEX_P (X)) \
1225 || (GET_CODE (X) == MULT \
1226 && REG_P (XEXP (X, 0)) \
1227 && REG_OK_FOR_INDEX_P (XEXP (X, 0)) \
1228 && GET_CODE (XEXP (X, 1)) == CONST_INT \
1229 && INTVAL (XEXP (X, 1)) == GET_MODE_SIZE (MODE)))
1230
1231#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1232{ \
1233 register rtx _x; \
1234 if (REG_P (X)) \
1235 { \
1236 if (REG_OK_FOR_BASE_P (X)) \
1237 goto ADDR; \
1238 } \
1239 else if (GET_CODE (X) == PLUS) \
1240 { \
1241 register rtx _x0 = XEXP (X, 0); \
1242 register rtx _x1 = XEXP (X, 1); \
1243 if ((flag_pic \
1244 && _x0 == pic_offset_table_rtx \
1245 && (flag_pic == 2 \
1246 ? REG_P (_x1) \
1247 : (GET_CODE (_x1) == SYMBOL_REF \
1248 || GET_CODE (_x1) == LABEL_REF))) \
1249 || (REG_P (_x0) \
1250 && (REG_OK_FOR_BASE_P (_x0) \
1251 && LEGITIMATE_INDEX_P (_x1, MODE))) \
1252 || (REG_P (_x1) \
1253 && (REG_OK_FOR_BASE_P (_x1) \
1254 && LEGITIMATE_INDEX_P (_x0, MODE)))) \
1255 goto ADDR; \
1256 } \
1257 else if (GET_CODE (X) == LO_SUM) \
1258 { \
1259 register rtx _x0 = XEXP (X, 0); \
1260 register rtx _x1 = XEXP (X, 1); \
1261 if (((REG_P (_x0) \
1262 && REG_OK_FOR_BASE_P (_x0)) \
1263 || (GET_CODE (_x0) == SUBREG \
1264 && REG_P (SUBREG_REG (_x0)) \
1265 && REG_OK_FOR_BASE_P (SUBREG_REG (_x0)))) \
1266 && CONSTANT_P (_x1)) \
1267 goto ADDR; \
1268 } \
1269 else if (GET_CODE (X) == CONST_INT \
1270 && SMALL_INT (X)) \
1271 goto ADDR; \
1272 else if (SHORT_ADDRESS_P (X, _x)) \
1273 goto ADDR; \
1274}
1275
1276/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1277 and check its validity for a certain class.
1278 We have two alternate definitions for each of them.
1279 The usual definition accepts all pseudo regs; the other rejects
1280 them unless they have been allocated suitable hard regs.
1281 The symbol REG_OK_STRICT causes the latter definition to be used.
1282
1283 Most source files want to accept pseudo regs in the hope that
1284 they will get allocated to the class that the insn wants them to be in.
1285 Source files for reload pass need to be strict.
1286 After reload, it makes no difference, since pseudo regs have
1287 been eliminated by then. */
1288
1289#ifndef REG_OK_STRICT
1290
1291/* Nonzero if X is a hard reg that can be used as an index
1292 or if it is a pseudo reg. Not the argument pointer. */
1293#define REG_OK_FOR_INDEX_P(X) (X)
1294/* Nonzero if X is a hard reg that can be used as a base reg
1295 or if it is a pseudo reg. */
1296#define REG_OK_FOR_BASE_P(X) (1)
1297
1298#else
1299
1300/* Nonzero if X is a hard reg that can be used as an index. */
1301#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1302/* Nonzero if X is a hard reg that can be used as a base reg. */
1303#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1304
1305#endif
1306
1307/* Try machine-dependent ways of modifying an illegitimate address
1308 to be legitimate. If we find one, return the new, valid address.
1309 This macro is used in only one place: `memory_address' in explow.c.
1310
1311 OLDX is the address as it was before break_out_memory_refs was called.
1312 In some cases it is useful to look at this to decide what needs to be done.
1313
1314 MODE and WIN are passed so that this macro can use
1315 GO_IF_LEGITIMATE_ADDRESS.
1316
1317 It is always safe for this macro to do nothing. It exists to recognize
1318 opportunities to optimize the output. */
1319
1320/* On the m88000, change REG+N into REG+REG, and REG+(X*Y) into REG+REG. */
1321
1322#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
1323{ \
1324 if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
1325 (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
1326 copy_to_mode_reg (SImode, XEXP (X, 1))); \
1327 if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
1328 (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
1329 copy_to_mode_reg (SImode, XEXP (X, 0))); \
1330 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \
1331 (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
1332 force_operand (XEXP (X, 0), 0)); \
1333 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \
1334 (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
1335 force_operand (XEXP (X, 1), 0)); \
1336 if (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST \
1337 || GET_CODE (X) == LABEL_REF) \
1338 (X) = legitimize_address (flag_pic, X, gen_reg_rtx (Pmode)); \
1339 if (memory_address_p (MODE, X)) \
1340 goto WIN; }
1341
1342/* Go to LABEL if ADDR (a legitimate address expression)
1343 has an effect that depends on the machine mode it is used for.
1344 On the the m88000 this is never true. */
1345
1346#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
1347
1348/* Nonzero if the constant value X is a legitimate general operand.
1349 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1350#define LEGITIMATE_CONSTANT_P(X) (1)
1351\f
1352/*** Condition Code Information ***/
1353
1354/* C code for a data type which is used for declaring the `mdep'
1355 component of `cc_status'. It defaults to `int'. */
1356/* #define CC_STATUS_MDEP int */
1357
1358/* A C expression to initialize the `mdep' field to "empty". */
1359/* #define CC_STATUS_MDEP_INIT (cc_status.mdep = 0) */
1360
1361/* Macro to zap the normal portions of CC_STATUS, but leave the
1362 machine dependent parts (ie, literal synthesis) alone. */
1363/* #define CC_STATUS_INIT_NO_MDEP \
1364 (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0) */
1365
1366/* When using a register to hold the condition codes, the cc_status
1367 mechanism cannot be used. */
1368#define NOTICE_UPDATE_CC(EXP, INSN) (0)
1369\f
1370/*** Miscellaneous Parameters ***/
1371
1372/* Define the codes that are matched by predicates in m88k.c. */
1373#define PREDICATE_CODES \
1374 {"move_operand", {SUBREG, REG, CONST_INT, LO_SUM, MEM}}, \
1375 {"call_address_operand", {SUBREG, REG, SYMBOL_REF, LABEL_REF, CONST}}, \
1376 {"arith_operand", {SUBREG, REG, CONST_INT}}, \
1377 {"arith5_operand", {SUBREG, REG, CONST_INT}}, \
1378 {"arith32_operand", {SUBREG, REG, CONST_INT}}, \
1379 {"arith64_operand", {SUBREG, REG, CONST_INT}}, \
1380 {"int5_operand", {CONST_INT}}, \
1381 {"int32_operand", {CONST_INT}}, \
1382 {"add_operand", {SUBREG, REG, CONST_INT}}, \
1383 {"reg_or_bbx_mask_operand", {SUBREG, REG, CONST_INT}}, \
1384 {"real_or_0_operand", {SUBREG, REG, CONST_DOUBLE}}, \
1385 {"relop", {EQ, NE, LT, LE, GE, GT, LTU, LEU, GEU, GTU}}, \
1386 {"relop_no_unsigned", {EQ, NE, LT, LE, GE, GT}}, \
1387 {"equality_op", {EQ, NE}}, \
1388 {"pc_or_label_ref", {PC, LABEL_REF}},
1389
dfa69feb
TW
1390/* The case table contains either words or branch instructions. This says
1391 which. We always claim that the vector is PC-relative. It is position
1392 independent when -fpic is used. */
1393#define CASE_VECTOR_INSNS (TARGET_88100 || flag_pic)
1394
79e68feb
RS
1395/* An alias for a machine mode name. This is the machine mode that
1396 elements of a jump-table should have. */
1397#define CASE_VECTOR_MODE SImode
1398
1399/* Define this macro if jump-tables should contain relative addresses. */
1400#define CASE_VECTOR_PC_RELATIVE
1401
1402/* Define this if control falls through a `case' insn when the index
1403 value is out of range. This means the specified default-label is
1404 actually ignored by the `case' insn proper. */
1405/* #define CASE_DROPS_THROUGH */
1406
cc61d0de
TW
1407/* Define this to be the smallest number of different values for which it
1408 is best to use a jump-table instead of a tree of conditional branches.
1409 The default is 4 for machines with a casesi instruction and 5 otherwise.
1410 The best 88110 number is around 7, though the exact number isn't yet
1411 known. A third alternative for the 88110 is to use a binary tree of
1412 bb1 instructions on bits 2/1/0 if the range is dense. This may not
1413 win very much though. */
1414#define CASE_VALUES_THRESHOLD (TARGET_88100 ? 4 : 7)
1415
79e68feb
RS
1416/* Specify the tree operation to be used to convert reals to integers. */
1417#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1418
1419/* This is the kind of divide that is easiest to do in the general case. */
1420#define EASY_DIV_EXPR TRUNC_DIV_EXPR
1421
1422/* Define this as 1 if `char' should by default be signed; else as 0. */
1423#define DEFAULT_SIGNED_CHAR 1
1424
1425/* The 88open ABI says size_t is unsigned int. */
1426#define SIZE_TYPE "unsigned int"
1427
1428/* Allow and ignore #sccs directives */
1429#define SCCS_DIRECTIVE
1430
1431/* Code to handle #pragma directives. The interface is a bit messy,
1432 but there's no simpler way to do this while still using yylex. */
1433#define HANDLE_PRAGMA(FILE) \
1434 do { \
1435 while (c == ' ' || c == '\t') \
1436 c = getc (FILE); \
1437 if (c == '\n' || c == EOF) \
1438 { \
1439 m88k_handle_pragma_token (0, 0); \
1440 return c; \
1441 } \
1442 ungetc (c, FILE); \
1443 switch (yylex ()) \
1444 { \
1445 case IDENTIFIER: \
1446 case TYPENAME: \
1447 case STRING: \
1448 case CONSTANT: \
1449 m88k_handle_pragma_token (token_buffer, yylval.ttype); \
1450 break; \
1451 default: \
1452 m88k_handle_pragma_token (token_buffer, 0); \
1453 } \
1454 if (nextchar >= 0) \
1455 c = nextchar, nextchar = -1; \
1456 else \
1457 c = getc (FILE); \
1458 } while (1)
1459
1460/* Tell when to handle #pragma weak. This is only done for V.4. */
1461#define HANDLE_PRAGMA_WEAK TARGET_SVR4
1462
1463/* Max number of bytes we can move from memory to memory
1464 in one reasonably fast instruction. */
1465#define MOVE_MAX 64
1466
1467/* Define if normal loads of shorter-than-word items from memory clears
1468 the rest of the bigs in the register. */
1469#define BYTE_LOADS_ZERO_EXTEND
1470
1471/* Zero if access to memory by bytes is faster. */
1472#define SLOW_BYTE_ACCESS 1
1473
1474/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1475 is done just by pretending it is already truncated. */
1476#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1477
1478/* Define this if addresses of constant functions
1479 shouldn't be put through pseudo regs where they can be cse'd.
1480 Desirable on machines where ordinary constants are expensive
1481 but a CALL with constant address is cheap. */
1482#define NO_FUNCTION_CSE
1483
1484/* Define this macro if an argument declared as `char' or
1485 `short' in a prototype should actually be passed as an
1486 `int'. In addition to avoiding errors in certain cases of
1487 mismatch, it also makes for better code on certain machines. */
1488#define PROMOTE_PROTOTYPES
1489
1490/* Define this macro if a float function always returns float
1491 (even in traditional mode). Redefined in m88kluna.h. */
1492#define TRADITIONAL_RETURN_FLOAT
1493
1494/* We assume that the store-condition-codes instructions store 0 for false
1495 and some other value for true. This is the value stored for true. */
1496#define STORE_FLAG_VALUE -1
1497
1498/* Specify the machine mode that pointers have.
1499 After generation of rtl, the compiler makes no further distinction
1500 between pointers and any other objects of this machine mode. */
1501#define Pmode SImode
1502
1503/* A function address in a call instruction
1504 is a word address (for indexing purposes)
1505 so give the MEM rtx word mode. */
1506#define FUNCTION_MODE SImode
1507
17c672d7
TW
1508/* A barrier will be aligned so account for the possible expansion. */
1509#define ADJUST_INSN_LENGTH(INSN, LENGTH) \
1510 if (GET_CODE (INSN) == BARRIER) \
1511 LENGTH += 1;
1512
79e68feb
RS
1513/* Compute the cost of computing a constant rtl expression RTX
1514 whose rtx-code is CODE. The body of this macro is a portion
1515 of a switch statement. If the code is computed here,
1516 return it with a return statement. Otherwise, break from the switch.
1517
1518 We assume that any 16 bit integer can easily be recreated, so we
1519 indicate 0 cost, in an attempt to get GCC not to optimize things
1520 like comparison against a constant.
1521
1522 The cost of CONST_DOUBLE is zero (if it can be placed in an insn, it
1523 is as good as a register; since it can't be placed in any insn, it
1524 won't do anything in cse, but it will cause expand_binop to pass the
1525 constant to the define_expands). */
3bb22aee 1526#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
79e68feb
RS
1527 case CONST_INT: \
1528 if (SMALL_INT (RTX)) \
1529 return 0; \
1530 else if (SMALL_INTVAL (- INTVAL (RTX))) \
1531 return 2; \
1532 else if (classify_integer (SImode, INTVAL (RTX)) != m88k_oru_or) \
1533 return 4; \
1534 return 7; \
1535 case HIGH: \
1536 return 2; \
1537 case CONST: \
1538 case LABEL_REF: \
1539 case SYMBOL_REF: \
1540 if (flag_pic) \
1541 return (flag_pic == 2) ? 11 : 8; \
1542 return 5; \
1543 case CONST_DOUBLE: \
1544 return 0;
1545
1546/* Provide the costs of an addressing mode that contains ADDR.
de857550 1547 If ADDR is not a valid address, its cost is irrelevant.
79e68feb
RS
1548 REG+REG is made slightly more expensive because it might keep
1549 a register live for longer than we might like. */
1550#define ADDRESS_COST(ADDR) \
1551 (GET_CODE (ADDR) == REG ? 1 : \
1552 GET_CODE (ADDR) == LO_SUM ? 1 : \
1553 GET_CODE (ADDR) == HIGH ? 2 : \
1554 GET_CODE (ADDR) == MULT ? 1 : \
1555 GET_CODE (ADDR) != PLUS ? 4 : \
1556 (REG_P (XEXP (ADDR, 0)) && REG_P (XEXP (ADDR, 1))) ? 2 : 1)
1557
1558/* Provide the costs of a rtl expression. This is in the body of a
1559 switch on CODE. */
3bb22aee 1560#define RTX_COSTS(X,CODE,OUTER_CODE) \
79e68feb
RS
1561 case MEM: \
1562 return COSTS_N_INSNS (2); \
1563 case MULT: \
1564 return COSTS_N_INSNS (3); \
1565 case DIV: \
1566 case UDIV: \
1567 case MOD: \
1568 case UMOD: \
1569 return COSTS_N_INSNS (38);
1570
1571/* A C expressions returning the cost of moving data of MODE from a register
1572 to or from memory. This is more costly than between registers. */
1573#define MEMORY_MOVE_COST(MODE) 4
1574
1575/* Provide the cost of a branch. Exact meaning under development. */
1576#define BRANCH_COST (TARGET_88100 ? 1 : 2)
1577
1578/* Define this to be nonzero if the character `$' should be allowed
1579 by default in identifier names. */
1580#define DOLLARS_IN_IDENTIFIERS 1
1581
1582/* Do not break .stabs pseudos into continuations. */
1583#define DBX_CONTIN_LENGTH 0
1584\f
1585/*** Output of Assembler Code ***/
1586
1587/* Control the assembler format that we output. */
1588
1589/* Which assembler syntax. Redefined in m88kdgux.h. */
1590#define VERSION_0300_SYNTAX TARGET_SVR4
1591
1592/* Allow pseudo-ops to be overridden. Override these in svr[34].h. */
1593#undef INT_ASM_OP
1594#undef ASCII_DATA_ASM_OP
79e68feb
RS
1595#undef CONST_SECTION_ASM_OP
1596#undef CTORS_SECTION_ASM_OP
1597#undef DTORS_SECTION_ASM_OP
1598#undef INIT_SECTION_ASM_OP
1599#undef FINI_SECTION_ASM_OP
1600#undef TYPE_ASM_OP
1601#undef SIZE_ASM_OP
e6a821bc 1602#undef WEAK_ASM_OP
ea9c2c2a 1603#undef SET_ASM_OP
31c0c8ea
TW
1604#undef SKIP_ASM_OP
1605#undef COMMON_ASM_OP
79e68feb
RS
1606
1607/* These are used in varasm.c as well. */
de857550
RS
1608#define TEXT_SECTION_ASM_OP "text"
1609#define DATA_SECTION_ASM_OP "data"
79e68feb
RS
1610
1611/* Other sections. */
1612#define CONST_SECTION_ASM_OP (VERSION_0300_SYNTAX \
de857550
RS
1613 ? "section\t .rodata,\"a\"" \
1614 : "section\t .rodata,\"x\"")
79e68feb 1615#define TDESC_SECTION_ASM_OP (VERSION_0300_SYNTAX \
de857550
RS
1616 ? "section\t .tdesc,\"a\"" \
1617 : "section\t .tdesc,\"x\"")
79e68feb
RS
1618
1619/* These must be constant strings for crtstuff.c. */
88a08f12
TW
1620#define CTORS_SECTION_ASM_OP "section\t .ctors,\"d\""
1621#define DTORS_SECTION_ASM_OP "section\t .dtors,\"d\""
de857550
RS
1622#define INIT_SECTION_ASM_OP "section\t .init,\"x\""
1623#define FINI_SECTION_ASM_OP "section\t .fini,\"x\""
79e68feb
RS
1624
1625/* These are pretty much common to all assemblers. */
de857550
RS
1626#define IDENT_ASM_OP "ident"
1627#define FILE_ASM_OP "file"
1628#define SECTION_ASM_OP "section"
648ebe7b 1629#define SET_ASM_OP "def"
de857550
RS
1630#define GLOBAL_ASM_OP "global"
1631#define ALIGN_ASM_OP "align"
1632#define SKIP_ASM_OP "zero"
1633#define COMMON_ASM_OP "comm"
31c0c8ea 1634#define BSS_ASM_OP "bss"
de857550
RS
1635#define FLOAT_ASM_OP "float"
1636#define DOUBLE_ASM_OP "double"
1637#define INT_ASM_OP "word"
79e68feb 1638#define ASM_LONG INT_ASM_OP
de857550
RS
1639#define SHORT_ASM_OP "half"
1640#define CHAR_ASM_OP "byte"
1641#define ASCII_DATA_ASM_OP "string"
79e68feb
RS
1642
1643/* These are particular to the global pool optimization. */
de857550
RS
1644#define SBSS_ASM_OP "sbss"
1645#define SCOMM_ASM_OP "scomm"
1646#define SDATA_SECTION_ASM_OP "sdata"
79e68feb
RS
1647
1648/* These are specific to PIC. */
de857550
RS
1649#define TYPE_ASM_OP "type"
1650#define SIZE_ASM_OP "size"
1651#define WEAK_ASM_OP "weak"
79e68feb
RS
1652#ifndef AS_BUG_POUND_TYPE /* Faulty assemblers require @ rather than #. */
1653#undef TYPE_OPERAND_FMT
1654#define TYPE_OPERAND_FMT "#%s"
1655#endif
1656
1657/* These are specific to version 03.00 assembler syntax. */
de857550
RS
1658#define INTERNAL_ASM_OP "local"
1659#define VERSION_ASM_OP "version"
de857550
RS
1660#define UNALIGNED_SHORT_ASM_OP "uahalf"
1661#define UNALIGNED_INT_ASM_OP "uaword"
a9c3f03a
TW
1662#define PUSHSECTION_ASM_OP "section"
1663#define POPSECTION_ASM_OP "previous"
79e68feb
RS
1664
1665/* Output any initial stuff to the assembly file. Always put out
1666 a file directive, even if not debugging.
1667
1668 Immediately after putting out the file, put out a "sem.<value>"
1669 declaration. This should be harmless on other systems, and
de857550 1670 is used in DG/UX by the debuggers to supplement COFF. The
79e68feb
RS
1671 fields in the integer value are as follows:
1672
1673 Bits Value Meaning
1674 ---- ----- -------
1675 0-1 0 No information about stack locations
1676 1 Auto/param locations are based on r30
1677 2 Auto/param locations are based on CFA
1678
1679 3-2 0 No information on dimension order
1680 1 Array dims in sym table matches source language
1681 2 Array dims in sym table is in reverse order
1682
1683 5-4 0 No information about the case of global names
1684 1 Global names appear in the symbol table as in the source
1685 2 Global names have been converted to lower case
1686 3 Global names have been converted to upper case. */
1687
1688#ifdef SDB_DEBUGGING_INFO
1689#define ASM_COFFSEM(FILE) \
1690 if (write_symbols == SDB_DEBUG) \
1691 { \
1692 fprintf (FILE, "\nsem.%x:\t\t; %s\n", \
1693 (((TARGET_OCS_FRAME_POSITION) ? 2 : 1) << 0) + (1 << 2) + (1 << 4),\
1694 (TARGET_OCS_FRAME_POSITION) \
1695 ? "frame is CFA, normal array dims, case unchanged" \
1696 : "frame is r30, normal array dims, case unchanged"); \
1697 }
1698#else
1699#define ASM_COFFSEM(FILE)
1700#endif
1701
1702/* Output the first line of the assembly file. Redefined in m88kdgux.h. */
1703
1704#define ASM_FIRST_LINE(FILE) \
1705 do { \
1706 if (VERSION_0300_SYNTAX) \
de857550 1707 fprintf (FILE, "\t%s\t \"03.00\"\n", VERSION_ASM_OP); \
79e68feb
RS
1708 } while (0)
1709
1710/* Override svr[34].h. */
1711#undef ASM_FILE_START
1712#define ASM_FILE_START(FILE) \
1713 output_file_start (FILE, f_options, sizeof f_options / sizeof f_options[0], \
1714 W_options, sizeof W_options / sizeof W_options[0])
1715
1716#undef ASM_FILE_END
1717
1718#define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) \
de857550 1719 fprintf (FILE, "\t%s\t \"%s\"\n", FILE_ASM_OP, NAME)
79e68feb
RS
1720
1721#ifdef SDB_DEBUGGING_INFO
1722#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
1723 if (m88k_prologue_done) \
1724 fprintf (FILE, "\n\tln\t %d\t\t\t\t; Real source line %d\n",\
1725 LINE - sdb_begin_function_line, LINE)
1726#endif
1727
1728/* Code to handle #ident directives. Override svr[34].h definition. */
1729#undef ASM_OUTPUT_IDENT
1730#ifdef DBX_DEBUGGING_INFO
1731#define ASM_OUTPUT_IDENT(FILE, NAME)
1732#else
1733#define ASM_OUTPUT_IDENT(FILE, NAME) \
a9c3f03a 1734 output_ascii (FILE, IDENT_ASM_OP, 4000, NAME, strlen (NAME));
79e68feb
RS
1735#endif
1736
1737/* Output to assembler file text saying following lines
1738 may contain character constants, extra white space, comments, etc. */
1739#define ASM_APP_ON ""
1740
1741/* Output to assembler file text saying following lines
1742 no longer contain unusual constructs. */
1743#define ASM_APP_OFF ""
1744
1745/* Format the assembly opcode so that the arguments are all aligned.
1746 The maximum instruction size is 8 characters (fxxx.xxx), so a tab and a
1747 space will do to align the output. Abandon the output if a `%' is
1748 encountered. */
1749#define ASM_OUTPUT_OPCODE(STREAM, PTR) \
1750 { \
1751 int ch; \
1752 char *orig_ptr; \
1753 \
1754 for (orig_ptr = (PTR); \
1755 (ch = *(PTR)) && ch != ' ' && ch != '\t' && ch != '\n' && ch != '%'; \
1756 (PTR)++) \
1757 putc (ch, STREAM); \
1758 \
1759 if (ch == ' ' && orig_ptr != (PTR) && (PTR) - orig_ptr < 8) \
1760 putc ('\t', STREAM); \
1761 }
1762
1763/* How to refer to registers in assembler output.
1764 This sequence is indexed by compiler's hard-register-number.
1765 Updated by OVERRIDE_OPTIONS to include the # for version 03.00 syntax. */
1766
1767#define REGISTER_NAMES \
1768 {"#r0"+1, "#r1"+1, "#r2"+1, "#r3"+1, "#r4"+1, "#r5"+1, "#r6"+1, "#r7"+1, \
1769 "#r8"+1, "#r9"+1, "#r10"+1,"#r11"+1,"#r12"+1,"#r13"+1,"#r14"+1,"#r15"+1,\
1770 "#r16"+1,"#r17"+1,"#r18"+1,"#r19"+1,"#r20"+1,"#r21"+1,"#r22"+1,"#r23"+1,\
a9c3f03a
TW
1771 "#r24"+1,"#r25"+1,"#r26"+1,"#r27"+1,"#r28"+1,"#r29"+1,"#r30"+1,"#r31"+1,\
1772 "#x0"+1, "#x1"+1, "#x2"+1, "#x3"+1, "#x4"+1, "#x5"+1, "#x6"+1, "#x7"+1, \
1773 "#x8"+1, "#x9"+1, "#x10"+1,"#x11"+1,"#x12"+1,"#x13"+1,"#x14"+1,"#x15"+1,\
1774 "#x16"+1,"#x17"+1,"#x18"+1,"#x19"+1,"#x20"+1,"#x21"+1,"#x22"+1,"#x23"+1,\
1775 "#x24"+1,"#x25"+1,"#x26"+1,"#x27"+1,"#x28"+1,"#x29"+1,"#x30"+1,"#x31"+1}
79e68feb
RS
1776
1777/* How to renumber registers for dbx and gdb. */
1778#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
1779
1780/* Tell when to declare ASM names. Override svr4.h to provide this hook. */
1781#undef DECLARE_ASM_NAME
1782#define DECLARE_ASM_NAME TARGET_SVR4
1783
1784/* Write the extra assembler code needed to declare a function properly. */
1785#undef ASM_DECLARE_FUNCTION_NAME
1786#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
1787 do { \
1788 if (DECLARE_ASM_NAME) \
1789 { \
de857550 1790 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
79e68feb
RS
1791 assemble_name (FILE, NAME); \
1792 putc (',', FILE); \
1793 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
1794 putc ('\n', FILE); \
1795 } \
1796 ASM_OUTPUT_LABEL(FILE, NAME); \
1797 } while (0)
1798
1799/* Write the extra assembler code needed to declare an object properly. */
1800#undef ASM_DECLARE_OBJECT_NAME
1801#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
1802 do { \
1803 if (DECLARE_ASM_NAME) \
1804 { \
de857550 1805 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
79e68feb
RS
1806 assemble_name (FILE, NAME); \
1807 putc (',', FILE); \
1808 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
1809 putc ('\n', FILE); \
1810 if (!flag_inhibit_size_directive) \
1811 { \
de857550 1812 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
79e68feb
RS
1813 assemble_name (FILE, NAME); \
1814 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (decl))); \
1815 } \
1816 } \
1817 ASM_OUTPUT_LABEL(FILE, NAME); \
1818 } while (0)
1819
1820/* This is how to declare the size of a function. */
1821#undef ASM_DECLARE_FUNCTION_SIZE
1822#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
1823 do { \
1824 if (DECLARE_ASM_NAME) \
1825 { \
1826 if (!flag_inhibit_size_directive) \
1827 { \
1828 char label[256]; \
1829 static int labelno; \
1830 labelno++; \
1831 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
1832 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
de857550 1833 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
79e68feb
RS
1834 assemble_name (FILE, (FNAME)); \
1835 fprintf (FILE, ",%s-", &label[1]); \
1836 assemble_name (FILE, (FNAME)); \
1837 putc ('\n', FILE); \
1838 } \
1839 } \
1840 } while (0)
1841
1842/* This is how to output the definition of a user-level label named NAME,
1843 such as the label on a static function or variable NAME. */
1844#define ASM_OUTPUT_LABEL(FILE,NAME) \
1845 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1846
1847/* This is how to output a command to make the user-level label named NAME
1848 defined for reference from other files. */
1849#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
1850 do { \
de857550 1851 fprintf (FILE, "\t%s\t ", GLOBAL_ASM_OP); \
79e68feb
RS
1852 assemble_name (FILE, NAME); \
1853 putc ('\n', FILE); \
1854 } while (0)
1855
1856/* This is how to output a reference to a user-level label named NAME.
1857 Override svr[34].h. */
1858#undef ASM_OUTPUT_LABELREF
1859#define ASM_OUTPUT_LABELREF(FILE,NAME) \
1860 { \
1861 if (! TARGET_NO_UNDERSCORES && ! VERSION_0300_SYNTAX) \
1862 fputc ('_', FILE); \
1863 fputs (NAME, FILE); \
1864 }
1865
1866/* This is how to output an internal numbered label where
1867 PREFIX is the class of label and NUM is the number within the class.
1868 For V.4, labels use `.' rather than `@'. */
1869
31c0c8ea 1870#undef ASM_OUTPUT_INTERNAL_LABEL
79e68feb
RS
1871#ifdef AS_BUG_DOT_LABELS /* The assembler requires a declaration of local. */
1872#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
de857550 1873 fprintf (FILE, VERSION_0300_SYNTAX ? ".%s%d:\n\t%s\t .%s%d\n" : "@%s%d:\n", \
79e68feb
RS
1874 PREFIX, NUM, INTERNAL_ASM_OP, PREFIX, NUM)
1875#else
1876#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1877 fprintf (FILE, VERSION_0300_SYNTAX ? ".%s%d:\n" : "@%s%d:\n", PREFIX, NUM)
1878#endif /* AS_BUG_DOT_LABELS */
1879
1880/* This is how to store into the string LABEL
1881 the symbol_ref name of an internal numbered label where
1882 PREFIX is the class of label and NUM is the number within the class.
1883 This is suitable for output with `assemble_name'. This must agree
1884 with ASM_OUTPUT_INTERNAL_LABEL above, except for being prefixed
1885 with an `*'. */
1886
31c0c8ea 1887#undef ASM_GENERATE_INTERNAL_LABEL
79e68feb
RS
1888#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1889 sprintf (LABEL, VERSION_0300_SYNTAX ? "*.%s%d" : "*@%s%d", PREFIX, NUM)
1890
1891/* Internal macro to get a single precision floating point value into
1892 an int, so we can print it's value in hex. */
1893#define FLOAT_TO_INT_INTERNAL( FVALUE, IVALUE ) \
1894 { union { \
1895 REAL_VALUE_TYPE d; \
1896 struct { \
1897 unsigned sign : 1; \
1898 unsigned exponent1 : 1; \
1899 unsigned exponent2 : 3; \
1900 unsigned exponent3 : 7; \
1901 unsigned mantissa1 : 20; \
1902 unsigned mantissa2 : 3; \
1903 unsigned mantissa3 : 29; \
1904 } s; \
1905 } _u; \
1906 \
1907 union { \
1908 int i; \
1909 struct { \
1910 unsigned sign : 1; \
1911 unsigned exponent1 : 1; \
1912 unsigned exponent3 : 7; \
1913 unsigned mantissa1 : 20; \
1914 unsigned mantissa2 : 3; \
1915 } s; \
1916 } _u2; \
1917 \
1918 _u.d = REAL_VALUE_TRUNCATE (SFmode, FVALUE); \
1919 _u2.s.sign = _u.s.sign; \
1920 _u2.s.exponent1 = _u.s.exponent1; \
1921 _u2.s.exponent3 = _u.s.exponent3; \
1922 _u2.s.mantissa1 = _u.s.mantissa1; \
1923 _u2.s.mantissa2 = _u.s.mantissa2; \
1924 IVALUE = _u2.i; \
1925 }
1926
1927/* This is how to output an assembler line defining a `double' constant.
1928 Use "word" pseudos to avoid printing NaNs, infinity, etc. */
1929#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
1930 do { \
1931 union { REAL_VALUE_TYPE d; long l[2]; } x; \
1932 x.d = (VALUE); \
de857550 1933 fprintf (FILE, "\t%s\t 0x%.8x, 0x%.8x\n", INT_ASM_OP, \
79e68feb
RS
1934 x.l[0], x.l[1]); \
1935 } while (0)
1936
1937/* This is how to output an assembler line defining a `float' constant. */
1938#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
1939 do { \
1940 int i; \
1941 FLOAT_TO_INT_INTERNAL (VALUE, i); \
de857550 1942 fprintf (FILE, "\t%s\t 0x%.8x\n", INT_ASM_OP, i); \
79e68feb
RS
1943 } while (0)
1944
1945/* Likewise for `int', `short', and `char' constants. */
1946#define ASM_OUTPUT_INT(FILE,VALUE) \
de857550 1947( fprintf (FILE, "\t%s\t ", INT_ASM_OP), \
79e68feb
RS
1948 output_addr_const (FILE, (VALUE)), \
1949 fprintf (FILE, "\n"))
1950
1951#define ASM_OUTPUT_SHORT(FILE,VALUE) \
de857550 1952( fprintf (FILE, "\t%s\t ", SHORT_ASM_OP), \
79e68feb
RS
1953 output_addr_const (FILE, (VALUE)), \
1954 fprintf (FILE, "\n"))
1955
1956#define ASM_OUTPUT_CHAR(FILE,VALUE) \
de857550 1957( fprintf (FILE, "\t%s\t ", CHAR_ASM_OP), \
79e68feb
RS
1958 output_addr_const (FILE, (VALUE)), \
1959 fprintf (FILE, "\n"))
1960
1961/* This is how to output an assembler line for a numeric constant byte. */
1962#define ASM_OUTPUT_BYTE(FILE,VALUE) \
de857550 1963 fprintf (FILE, "\t%s\t 0x%x\n", CHAR_ASM_OP, (VALUE))
79e68feb 1964
668681ef 1965/* The single-byte pseudo-op is the default. Override svr[34].h. */
79e68feb 1966#undef ASM_BYTE_OP
668681ef 1967#define ASM_BYTE_OP "byte"
79e68feb
RS
1968#undef ASM_OUTPUT_ASCII
1969#define ASM_OUTPUT_ASCII(FILE, P, SIZE) \
a9c3f03a 1970 output_ascii (FILE, ASCII_DATA_ASM_OP, 48, P, SIZE)
79e68feb
RS
1971
1972/* Epilogue for case labels. This jump instruction is called by casesi
1973 to transfer to the appropriate branch instruction within the table.
1974 The label `@L<n>e' is coined to mark the end of the table. */
1975#define ASM_OUTPUT_CASE_END(FILE, NUM, TABLE) \
1976 do { \
668681ef
TW
1977 if (CASE_VECTOR_INSNS) \
1978 { \
1979 char label[256]; \
1980 ASM_GENERATE_INTERNAL_LABEL (label, "L", NUM); \
1981 fprintf (FILE, "%se:\n", &label[1]); \
1982 if (! flag_delayed_branch) \
1983 fprintf (FILE, "\tlda\t %s,%s[%s]\n", reg_names[1], \
1984 reg_names[1], reg_names[m88k_case_index]); \
1985 fprintf (FILE, "\tjmp\t %s\n", reg_names[1]); \
1986 } \
79e68feb
RS
1987 } while (0)
1988
1989/* This is how to output an element of a case-vector that is absolute. */
1990#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1991 do { \
1992 char buffer[256]; \
1993 ASM_GENERATE_INTERNAL_LABEL (buffer, "L", VALUE); \
668681ef
TW
1994 fprintf (FILE, CASE_VECTOR_INSNS ? "\tbr\t %s\n" : "\tword\t %s\n", \
1995 &buffer[1]); \
79e68feb
RS
1996 } while (0)
1997
1998/* This is how to output an element of a case-vector that is relative. */
1999#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
2000 ASM_OUTPUT_ADDR_VEC_ELT (FILE, VALUE)
2001
2002/* This is how to output an assembler line
2003 that says to advance the location counter
2004 to a multiple of 2**LOG bytes. */
2005#define ASM_OUTPUT_ALIGN(FILE,LOG) \
2006 if ((LOG) != 0) \
de857550 2007 fprintf (FILE, "\t%s\t %d\n", ALIGN_ASM_OP, 1<<(LOG))
79e68feb
RS
2008
2009/* Align the text address to half a cache boundary when it can only be
ad4c6463
TW
2010 reached by jumping. Pack code tightly when compiling crtstuff.c. */
2011#define ASM_OUTPUT_ALIGN_CODE(FILE) \
2012 ASM_OUTPUT_ALIGN (FILE, (flag_inhibit_size_directive ? 2 : 3))
79e68feb
RS
2013
2014/* Override svr[34].h. */
2015#undef ASM_OUTPUT_SKIP
2016#define ASM_OUTPUT_SKIP(FILE,SIZE) \
de857550 2017 fprintf (FILE, "\t%s\t %u\n", SKIP_ASM_OP, (SIZE))
79e68feb
RS
2018
2019/* Override svr4.h. */
2020#undef ASM_OUTPUT_EXTERNAL_LIBCALL
2021
2022/* This says how to output an assembler line to define a global common
2023 symbol. Size can be zero for the unusual case of a `struct { int : 0; }'.
2024 Override svr[34].h. */
2025#undef ASM_OUTPUT_COMMON
2026#undef ASM_OUTPUT_ALIGNED_COMMON
2027#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
de857550
RS
2028( fprintf ((FILE), "\t%s\t ", \
2029 ((SIZE) ? (SIZE) : 1) <= m88k_gp_threshold ? SCOMM_ASM_OP : COMMON_ASM_OP), \
79e68feb
RS
2030 assemble_name ((FILE), (NAME)), \
2031 fprintf ((FILE), ",%u\n", (SIZE) ? (SIZE) : 1))
2032
de857550 2033/* This says how to output an assembler line to define a local common
79e68feb
RS
2034 symbol. Override svr[34].h. */
2035#undef ASM_OUTPUT_LOCAL
2036#undef ASM_OUTPUT_ALIGNED_LOCAL
2037#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
de857550 2038( fprintf ((FILE), "\t%s\t ", \
31c0c8ea 2039 ((SIZE) ? (SIZE) : 1) <= m88k_gp_threshold ? SBSS_ASM_OP : BSS_ASM_OP), \
79e68feb
RS
2040 assemble_name ((FILE), (NAME)), \
2041 fprintf ((FILE), ",%u,%d\n", (SIZE) ? (SIZE) : 1, (SIZE) <= 4 ? 4 : 8))
2042
2043/* Store in OUTPUT a string (made with alloca) containing
2044 an assembler-name for a local static variable named NAME.
2045 LABELNO is an integer which is different for each call. */
2046#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
2047( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
2048 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
2049
2050/* This is how to output an insn to push a register on the stack.
2051 It need not be very fast code. */
2052#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
2053 fprintf (FILE, "\tsubu\t %s,%s,%d\n\tst\t %s,%s,0\n", \
2054 reg_names[STACK_POINTER_REGNUM], \
2055 reg_names[STACK_POINTER_REGNUM], \
2056 (STACK_BOUNDARY / BITS_PER_UNIT), \
2057 reg_names[REGNO], \
2058 reg_names[STACK_POINTER_REGNUM])
2059
2060/* This is how to output an insn to pop a register from the stack. */
2061#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
2062 fprintf (FILE, "\tld\t %s,%s,0\n\taddu\t %s,%s,%d\n", \
2063 reg_names[REGNO], \
2064 reg_names[STACK_POINTER_REGNUM], \
2065 reg_names[STACK_POINTER_REGNUM], \
2066 reg_names[STACK_POINTER_REGNUM], \
2067 (STACK_BOUNDARY / BITS_PER_UNIT))
2068
2069/* Define the parentheses used to group arithmetic operations
2070 in assembler code. */
2071#define ASM_OPEN_PAREN "("
2072#define ASM_CLOSE_PAREN ")"
2073
2074/* Define results of standard character escape sequences. */
2075#define TARGET_BELL 007
2076#define TARGET_BS 010
2077#define TARGET_TAB 011
2078#define TARGET_NEWLINE 012
2079#define TARGET_VT 013
2080#define TARGET_FF 014
2081#define TARGET_CR 015
2082\f
2083/* Macros to deal with OCS debug information */
2084
2085#define OCS_START_PREFIX "Ltb"
2086#define OCS_END_PREFIX "Lte"
2087
2088#define PUT_OCS_FUNCTION_START(FILE) \
2089 { ASM_OUTPUT_INTERNAL_LABEL (FILE, OCS_START_PREFIX, m88k_function_number); }
2090
2091#define PUT_OCS_FUNCTION_END(FILE) \
2092 { ASM_OUTPUT_INTERNAL_LABEL (FILE, OCS_END_PREFIX, m88k_function_number); }
2093
2094/* Macros for debug information */
2095#define DEBUGGER_AUTO_OFFSET(X) \
2096 (m88k_debugger_offset (X, 0) \
2097 + (TARGET_OCS_FRAME_POSITION ? 0 : m88k_stack_size - m88k_fp_offset))
2098
2099#define DEBUGGER_ARG_OFFSET(OFFSET, X) \
2100 (m88k_debugger_offset (X, OFFSET) \
2101 + (TARGET_OCS_FRAME_POSITION ? 0 : m88k_stack_size - m88k_fp_offset))
2102
2103/* Macros to deal with SDB debug information */
2104#ifdef SDB_DEBUGGING_INFO
2105
2106/* Output structure tag names even when it causes a forward reference. */
2107#define SDB_ALLOW_FORWARD_REFERENCES
2108
2109/* Print out extra debug information in the assembler file */
2110#define PUT_SDB_SCL(a) \
2111 do { \
2112 register int s = (a); \
2113 register char *scl; \
2114 switch (s) \
2115 { \
2116 case C_EFCN: scl = "end of function"; break; \
2117 case C_NULL: scl = "NULL storage class"; break; \
2118 case C_AUTO: scl = "automatic"; break; \
2119 case C_EXT: scl = "external"; break; \
2120 case C_STAT: scl = "static"; break; \
2121 case C_REG: scl = "register"; break; \
2122 case C_EXTDEF: scl = "external definition"; break; \
2123 case C_LABEL: scl = "label"; break; \
2124 case C_ULABEL: scl = "undefined label"; break; \
2125 case C_MOS: scl = "structure member"; break; \
2126 case C_ARG: scl = "argument"; break; \
2127 case C_STRTAG: scl = "structure tag"; break; \
2128 case C_MOU: scl = "union member"; break; \
2129 case C_UNTAG: scl = "union tag"; break; \
2130 case C_TPDEF: scl = "typedef"; break; \
2131 case C_USTATIC: scl = "uninitialized static"; break; \
2132 case C_ENTAG: scl = "enumeration tag"; break; \
2133 case C_MOE: scl = "member of enumeration"; break; \
2134 case C_REGPARM: scl = "register parameter"; break; \
2135 case C_FIELD: scl = "bit field"; break; \
2136 case C_BLOCK: scl = "block start/end"; break; \
2137 case C_FCN: scl = "function start/end"; break; \
2138 case C_EOS: scl = "end of structure"; break; \
2139 case C_FILE: scl = "filename"; break; \
2140 case C_LINE: scl = "line"; break; \
2141 case C_ALIAS: scl = "duplicated tag"; break; \
2142 case C_HIDDEN: scl = "hidden"; break; \
2143 default: scl = "unknown"; break; \
2144 } \
2145 \
2146 fprintf(asm_out_file, "\tscl\t %d\t\t\t\t; %s\n", s, scl); \
2147 } while (0)
2148
2149#define PUT_SDB_TYPE(a) \
2150 do { \
2151 register int t = (a); \
2152 static char buffer[100]; \
2153 register char *p = buffer, *q; \
2154 register int typ = t; \
2155 register int i,d; \
2156 \
2157 for (i = 0; i <= 5; i++) \
2158 { \
2159 switch ((typ >> ((i*N_TSHIFT) + N_BTSHFT)) & 03) \
2160 { \
2161 case DT_PTR: \
2162 strcpy (p, "ptr to "); \
2163 p += sizeof("ptr to"); \
2164 break; \
2165 \
2166 case DT_ARY: \
2167 strcpy (p, "array of "); \
2168 p += sizeof("array of"); \
2169 break; \
2170 \
2171 case DT_FCN: \
2172 strcpy (p, "func ret "); \
2173 p += sizeof("func ret"); \
2174 break; \
2175 } \
2176 } \
2177 \
2178 switch (typ & N_BTMASK) \
2179 { \
2180 case T_NULL: q = "<no type>"; break; \
2181 case T_CHAR: q = "char"; break; \
2182 case T_SHORT: q = "short"; break; \
2183 case T_INT: q = "int"; break; \
2184 case T_LONG: q = "long"; break; \
2185 case T_FLOAT: q = "float"; break; \
2186 case T_DOUBLE: q = "double"; break; \
2187 case T_STRUCT: q = "struct"; break; \
2188 case T_UNION: q = "union"; break; \
2189 case T_ENUM: q = "enum"; break; \
2190 case T_MOE: q = "enum member"; break; \
2191 case T_UCHAR: q = "unsigned char"; break; \
2192 case T_USHORT: q = "unsigned short"; break; \
2193 case T_UINT: q = "unsigned int"; break; \
2194 case T_ULONG: q = "unsigned long"; break; \
2195 default: q = "void"; break; \
2196 } \
2197 \
2198 strcpy (p, q); \
2199 fprintf(asm_out_file, "\ttype\t %d\t\t\t\t; %s\n", \
2200 t, buffer); \
2201 } while (0)
2202
2203#define PUT_SDB_INT_VAL(a) \
2204 fprintf (asm_out_file, "\tval\t %d\n", (a))
2205
2206#define PUT_SDB_VAL(a) \
2207( fprintf (asm_out_file, "\tval\t "), \
2208 output_addr_const (asm_out_file, (a)), \
2209 fputc ('\n', asm_out_file))
2210
2211#define PUT_SDB_DEF(a) \
2212 do { fprintf (asm_out_file, "\tsdef\t "); \
2213 ASM_OUTPUT_LABELREF (asm_out_file, a); \
2214 fputc ('\n', asm_out_file); \
2215 } while (0)
2216
2217#define PUT_SDB_PLAIN_DEF(a) \
2218 fprintf(asm_out_file,"\tsdef\t .%s\n", a)
2219
2220/* Simply and endef now. */
2221#define PUT_SDB_ENDEF \
2222 fputs("\tendef\n\n", asm_out_file)
2223
2224#define PUT_SDB_SIZE(a) \
2225 fprintf (asm_out_file, "\tsize\t %d\n", (a))
2226
2227/* Max dimensions to store for debug information (limited by COFF). */
2228#define SDB_MAX_DIM 6
2229
2230/* New method for dim operations. */
2231#define PUT_SDB_START_DIM \
2232 fputs("\tdim\t ", asm_out_file)
2233
2234/* How to end the DIM sequence. */
2235#define PUT_SDB_LAST_DIM(a) \
2236 fprintf(asm_out_file, "%d\n", a)
2237
2238#define PUT_SDB_TAG(a) \
2239 do { \
2240 fprintf (asm_out_file, "\ttag\t "); \
2241 ASM_OUTPUT_LABELREF (asm_out_file, a); \
2242 fputc ('\n', asm_out_file); \
2243 } while( 0 )
2244
2245#define PUT_SDB_BLOCK_OR_FUNCTION(NAME, SCL, LINE) \
2246 do { \
2247 fprintf (asm_out_file, "\n\tsdef\t %s\n\tval\t .\n", \
2248 NAME); \
2249 PUT_SDB_SCL( SCL ); \
2250 fprintf (asm_out_file, "\tline\t %d\n\tendef\n\n", \
2251 (LINE)); \
2252 } while (0)
2253
2254#define PUT_SDB_BLOCK_START(LINE) \
2255 PUT_SDB_BLOCK_OR_FUNCTION (".bb", C_BLOCK, (LINE))
2256
2257#define PUT_SDB_BLOCK_END(LINE) \
2258 PUT_SDB_BLOCK_OR_FUNCTION (".eb", C_BLOCK, (LINE))
2259
2260#define PUT_SDB_FUNCTION_START(LINE) \
2261 do { \
2262 fprintf (asm_out_file, "\tln\t 1\n"); \
2263 PUT_SDB_BLOCK_OR_FUNCTION (".bf", C_FCN, (LINE)); \
2264 } while (0)
2265
2266#define PUT_SDB_FUNCTION_END(LINE) \
2267 do { \
2268 PUT_SDB_BLOCK_OR_FUNCTION (".ef", C_FCN, (LINE)); \
2269 } while (0)
2270
2271#define PUT_SDB_EPILOGUE_END(NAME) \
2272 do { \
2273 text_section (); \
2274 fprintf (asm_out_file, "\n\tsdef\t "); \
2275 ASM_OUTPUT_LABELREF(asm_out_file, (NAME)); \
2276 fputc('\n', asm_out_file); \
2277 PUT_SDB_SCL( C_EFCN ); \
2278 fprintf (asm_out_file, "\tendef\n\n"); \
2279 } while (0)
2280
2281#define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
2282 sprintf ((BUFFER), ".%dfake", (NUMBER));
2283
2284#endif /* SDB_DEBUGGING_INFO */
2285\f
2286/* Support const and tdesc sections. Generally, a const section will
2287 be distinct from the text section whenever we do V.4-like things
2288 and so follows DECLARE_ASM_NAME. Note that strings go in text
2289 rather than const. Override svr[34].h. */
2290
2291#undef USE_CONST_SECTION
2292#undef EXTRA_SECTIONS
2293
2294#define USE_CONST_SECTION DECLARE_ASM_NAME
2295
2296#if defined(CTORS_SECTION_FUNCTION) /* SVR4 */
2297
2298#define EXTRA_SECTIONS in_const, in_tdesc, in_sdata, in_ctors, in_dtors
2299#define INIT_SECTION_FUNCTION
2300#define FINI_SECTION_FUNCTION
2301
2302#elif defined(FINI_SECTION_FUNCTION) /* SVR3 */
2303
2304#define EXTRA_SECTIONS in_const, in_tdesc, in_sdata, in_init, in_fini
2305#define CTORS_SECTION_FUNCTION
2306#define DTORS_SECTION_FUNCTION
2307
2308#else /* m88kluna or other not based on svr[34].h. */
2309
17c672d7 2310#undef INIT_SECTION_ASM_OP
79e68feb
RS
2311#define EXTRA_SECTIONS in_const, in_tdesc, in_sdata
2312#define CONST_SECTION_FUNCTION \
2313void \
2314const_section () \
2315{ \
2316 text_section(); \
2317}
2318#define CTORS_SECTION_FUNCTION
2319#define DTORS_SECTION_FUNCTION
2320#define INIT_SECTION_FUNCTION
2321#define FINI_SECTION_FUNCTION
2322
2323#endif /* CTORS_SECTION_FUNCTION */
2324
2325#undef EXTRA_SECTION_FUNCTIONS
2326#define EXTRA_SECTION_FUNCTIONS \
2327 CONST_SECTION_FUNCTION \
2328 \
2329void \
2330tdesc_section () \
2331{ \
2332 if (in_section != in_tdesc) \
2333 { \
2334 fprintf (asm_out_file, "%s\n", TDESC_SECTION_ASM_OP); \
2335 in_section = in_tdesc; \
2336 } \
2337} \
2338 \
2339void \
2340sdata_section () \
2341{ \
2342 if (in_section != in_sdata) \
2343 { \
2344 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
2345 in_section = in_sdata; \
2346 } \
2347} \
2348 \
2349 CTORS_SECTION_FUNCTION \
2350 DTORS_SECTION_FUNCTION \
2351 INIT_SECTION_FUNCTION \
2352 FINI_SECTION_FUNCTION
2353
2354#undef READONLY_DATA_SECTION
2355
2356/* A C statement or statements to switch to the appropriate
2357 section for output of DECL. DECL is either a `VAR_DECL' node
2358 or a constant of some sort. RELOC indicates whether forming
2359 the initial value of DECL requires link-time relocations.
2360
2361 For strings, the section is selected before the segment info is encoded. */
2362#undef SELECT_SECTION
2363#define SELECT_SECTION(DECL,RELOC) \
2364{ \
2365 if (TREE_CODE (DECL) == STRING_CST) \
2366 { \
2367 if (! flag_writable_strings) \
2368 const_section (); \
2369 else if (m88k_gp_threshold > 0 \
2370 && TREE_STRING_LENGTH (DECL) <= m88k_gp_threshold) \
2371 sdata_section (); \
2372 else \
2373 data_section (); \
2374 } \
2375 else if (TREE_CODE (DECL) == VAR_DECL) \
2376 { \
2377 if (SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0))) \
2378 sdata_section (); \
2379 else if ((flag_pic && RELOC) \
2380 || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)) \
2381 data_section (); \
2382 else \
2383 const_section (); \
2384 } \
2385 else \
2386 const_section (); \
2387}
2388
2389/* Define this macro if references to a symbol must be treated differently
2390 depending on something about the variable or function named by the
2391 symbol (such as what section it is in).
2392
2393 The macro definition, if any, is executed immediately after the rtl for
2394 DECL has been created and stored in `DECL_RTL (DECL)'. The value of the
2395 rtl will be a `mem' whose address is a `symbol_ref'.
2396
2397 For the m88k, determine if the item should go in the global pool. */
2398#define ENCODE_SECTION_INFO(DECL) \
2399 do { \
2400 if (m88k_gp_threshold > 0) \
2401 if (TREE_CODE (DECL) == VAR_DECL) \
2402 { \
2403 if (!TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)) \
2404 { \
2405 int size = int_size_in_bytes (TREE_TYPE (DECL)); \
2406 \
2407 if (size > 0 && size <= m88k_gp_threshold) \
2408 SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
2409 } \
2410 } \
2411 else if (TREE_CODE (DECL) == STRING_CST \
2412 && flag_writable_strings \
2413 && TREE_STRING_LENGTH (DECL) <= m88k_gp_threshold) \
2414 SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (DECL), 0)) = 1; \
2415 } while (0)
2416\f
2417/* Print operand X (an rtx) in assembler syntax to file FILE.
2418 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
2419 For `%' followed by punctuation, CODE is the punctuation and X is null. */
2420#define PRINT_OPERAND_PUNCT_VALID_P(c) \
2421 ((c) == '#' || (c) == '.' || (c) == '!' || (c) == '*' || (c) == ';')
2422
2423#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
2424
2425/* Print a memory address as an operand to reference that memory location. */
2426#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
This page took 0.284329 seconds and 5 git commands to generate.