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