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