PR c++/3637
[official-gcc.git] / gcc / config / m68k / mot3300.h
blob4b96a50ce4c88e489d41bbd8d503e024c130ccc8
1 /* Definitions of target machine for GNU compiler,
2 SysV68 Motorola 3300 Delta Series.
3 Copyright (C) 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
4 Free Software Foundation, Inc.
5 Contributed by Abramo and Roberto Bagnara (bagnara@dipisa.di.unipi.it)
6 based on Alex Crain's 3B1 definitions.
7 Maintained by Philippe De Muyter (phdm@info.ucl.ac.be).
8 Support for GAS added by merging mot3300g.h into this file by
9 Manfred Hollstein (manfred@lts.sel.alcatel.de).
11 This file is part of GNU CC.
13 GNU CC is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2, or (at your option)
16 any later version.
18 GNU CC is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with GNU CC; see the file COPYING. If not, write to
25 the Free Software Foundation, 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. */
28 #ifndef USE_GAS
29 #define MOTOROLA /* Use Motorola syntax rather than "MIT" */
30 #define MOTOROLA_BSR /* Use Span-dependent optimized bsr */
31 #define SGS /* Uses SGS assembler */
32 #define SGS_CMP_ORDER /* Takes cmp operands in reverse order */
33 #define SGS_SWAP_W /* Use swap.w rather than just plain swap */
34 #endif /* USE_GAS */
36 #define NO_DOLLAR_IN_LABEL
37 #define NO_DOT_IN_LABEL
39 #include "m68k/m68k.h"
41 /* GDB expects a slightly different marker on this target. */
42 #define STABS_GCC_MARKER "gcc2_compiled%"
44 /* See m68k.h. 0407 means 68020-68040. */
46 #ifndef TARGET_DEFAULT
47 #define TARGET_DEFAULT (MASK_68040|MASK_BITFIELD|MASK_68881|MASK_68020)
48 #endif
50 /* -m[c]6800 requires special flag to the assembler. */
52 #undef ASM_SPEC
53 #ifndef USE_GAS
54 #define ASM_SPEC "%{m68000:-p 000}%{mc68000:-p 000}"
55 #else /* USE_GAS */
56 #define ASM_SPEC \
57 "%{v:-v} %{m68000:-mc68000}%{mc68000:-mc68000}%{!mc68000:%{!m68000:-mc68020}}"
58 #endif /* USE_GAS */
60 /* NYI: FP= is equivalent to -msoft-float */
62 /* We use /lib/libp/lib* when profiling. */
64 /* NYI: if FP=M68881U library is -lc881u */
65 /* NYI: if FP= library is -lc. */
66 /* Default for us: FP=M68881 library is -lc881 */
67 #undef LIB_SPEC
68 #define LIB_SPEC "%{!shlib:%{!msoft-float:-lc881}%{msoft-float:-lc}}"
69 #ifdef CROSS_COMPILE
70 #ifndef USE_GLD
71 #define DEFAULT_A_OUT_NAME "m68ka.out"
72 #endif
73 #endif
75 #ifdef USE_GLD
76 #undef LINK_SPEC
77 #define LINK_SPEC "%{v:-v}"
78 #endif /* defined (USE_GLD) */
80 #define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__}\
81 %{!mc68000:%{!m68000: -D__mc68020__}}"
83 /* Shared libraries need to use crt0s.o */
85 #undef STARTFILE_SPEC
86 #ifdef CROSS_COMPILE
87 #define STARTFILE_SPEC \
88 "%{!shlib:%{pg:mcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}\
89 %{shlib:crt0s.o%s shlib.ifile%s} %{p:-L"TOOLDIR_BASE_PREFIX DEFAULT_TARGET_MACHINE"/lib/libp} %{pg:-L"TOOLDIR_BASE_PREFIX DEFAULT_TARGET_MACHINE"/lib/libp} "
90 #else /* CROSS_COMPILE */
91 #define STARTFILE_SPEC \
92 "%{!shlib:%{pg:mcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}\
93 %{shlib:crt0s.o%s shlib.ifile%s} %{p:-L/usr/lib/libp} %{pg:-L/usr/lib/libp} "
94 #endif /* CROSS_COMPILE */
96 /* Generate calls to memcpy, memcmp and memset. */
98 #define TARGET_MEM_FUNCTIONS
100 /* size_t is unsigned int. */
102 #define SIZE_TYPE "unsigned int"
104 /* We need POSIX/XOPEN symbols; otherwise building libio will fail. */
105 #define ADD_MISSING_POSIX 1
106 #define ADD_MISSING_XOPEN 1
108 /* Every structure or union's size must be a multiple of 2 bytes. */
110 #define STRUCTURE_SIZE_BOUNDARY 16
112 /* Follow sysV68 cc regarding alignment imposed by char:0; */
114 #define PCC_BITFIELD_TYPE_MATTERS 1
116 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
117 /* Be compatible with native compiler. */
118 #undef PARM_BOUNDARY
119 #define PARM_BOUNDARY 16
121 /* cpp has to support a #sccs directive for the /usr/include files */
123 #define SCCS_DIRECTIVE
125 /* Make output for SDB. */
127 #define SDB_DEBUGGING_INFO
129 #undef REGISTER_PREFIX
130 #define REGISTER_PREFIX "%"
132 #undef LOCAL_LABEL_PREFIX
133 #ifdef USE_GAS
134 #define LOCAL_LABEL_PREFIX ".L"
135 #else
136 #define LOCAL_LABEL_PREFIX "L%"
137 #endif
139 #undef USER_LABEL_PREFIX
141 #undef IMMEDIATE_PREFIX
142 #define IMMEDIATE_PREFIX "&"
144 #undef REGISTER_NAMES
145 #define REGISTER_NAMES \
146 {"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
147 "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", \
148 "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7"}
150 #undef FUNCTION_EXTRA_EPILOGUE
151 #define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
152 { if (current_function_returns_pointer \
153 && ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode)) \
154 asm_fprintf (FILE, "\tmov.l %Ra0,%Rd0\n"); }
156 #undef FUNCTION_PROFILER
157 #define FUNCTION_PROFILER(FILE, LABEL_NO) \
158 asm_fprintf (FILE, "\tmov.l %I%LLP%d,%Ra0\n\tjsr mcount%%\n", (LABEL_NO))
160 /* This is how to output an insn to push a register on the stack.
161 It need not be very fast code. */
163 #undef ASM_OUTPUT_REG_PUSH
164 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
165 fprintf (FILE, "\tmov.l %s,-(%%sp)\n", reg_names[REGNO])
167 /* This is how to output an insn to pop a register from the stack.
168 It need not be very fast code. */
170 #undef ASM_OUTPUT_REG_POP
171 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
172 fprintf (FILE, "\tmov.l (%%sp)+,%s\n", reg_names[REGNO])
174 #ifndef USE_GAS
176 #undef ASM_APP_ON
177 #define ASM_APP_ON ""
179 #undef ASM_APP_OFF
180 #define ASM_APP_OFF ""
182 #undef TEXT_SECTION_ASM_OP
183 #define TEXT_SECTION_ASM_OP "\ttext"
184 #undef DATA_SECTION_ASM_OP
185 #define DATA_SECTION_ASM_OP "\tdata"
186 #undef ASCII_DATA_ASM_OP
187 #define ASCII_DATA_ASM_OP "\tbyte\t"
189 #undef SET_ASM_OP
190 #define SET_ASM_OP "\tset\t"
192 #endif /* USE_GAS */
194 #ifdef USE_GLD
195 /* Support the ctors and dtors sections for g++. */
197 #define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"x\""
198 #define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"x\""
199 #endif /* defined (USE_GLD) */
201 /* The file command should always begin the output. */
203 #undef ASM_FILE_START
204 #ifndef USE_GAS
205 #define ASM_FILE_START(FILE) \
206 output_file_directive ((FILE), main_input_filename)
207 #else /* USE_GAS */
208 #define ASM_FILE_START(FILE) \
210 fprintf (FILE, "%s", ASM_APP_OFF); \
211 output_file_directive ((FILE), main_input_filename); \
213 #endif /* USE_GAS */
215 /* Names to predefine in the preprocessor for this target machine. */
216 /* ihnp4!lmayk!lgm@eddie.mit.edu says mc68000 and m68k should not be here,
217 on the other hand I don't care what he says. */
219 #undef CPP_PREDEFINES
220 #define CPP_PREDEFINES "-Dm68k -Dunix -DsysV68 -D__motorola__ -Asystem=unix -Asystem=svr3 -Acpu=m68k -Amachine=m68k"
222 #undef TARGET_VERSION
223 #ifndef USE_GAS
224 #define TARGET_VERSION fprintf (stderr, " (68k, SGS/AT&T sysV68 syntax)");
225 #endif /* USE_GAS */
227 /* This will return small structs in d0. */
228 #define RETURN_IN_MEMORY(type) \
229 ((TYPE_MODE (type) == BLKmode) \
230 || (AGGREGATE_TYPE_P (type) \
231 && GET_MODE_SIZE (TYPE_MODE (type)) > UNITS_PER_WORD))
233 /* Don't default to pcc-struct-return, because we have already specified
234 exactly how to return structures in the RETURN_IN_MEMORY macro. */
235 #define DEFAULT_PCC_STRUCT_RETURN 0
237 /* If TARGET_68881, return SF and DF values in fp0 instead of d0. */
238 /* NYI: If FP=M68881U return SF and DF values in d0. */
239 /* NYI: If -mold return pointer in a0 and d0 */
241 #undef FUNCTION_VALUE
242 /* sysV68 (brain damaged) cc convention support. */
243 #define FUNCTION_VALUE(VALTYPE,FUNC) \
244 (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881 \
245 ? gen_rtx_REG (TYPE_MODE (VALTYPE), 16) \
246 : (POINTER_TYPE_P (VALTYPE) \
247 ? gen_rtx_REG (TYPE_MODE (VALTYPE), 8) \
248 : gen_rtx_REG (TYPE_MODE (VALTYPE), 0)))
250 /* If TARGET_68881, SF and DF values are returned in fp0 instead of d0. */
252 /* Is LIBCALL_VALUE never called with a pointer ? */
253 #undef LIBCALL_VALUE
254 #define LIBCALL_VALUE(MODE) \
255 gen_rtx_REG ((MODE), \
256 ((TARGET_68881 \
257 && ((MODE) == SFmode || (MODE) == DFmode \
258 || (MODE) == XFmode)) \
259 ? 16 : 0))
261 /* 1 if N is a possible register number for a function value.
262 d0 may be used, and fp0 as well if -msoft-float is not specified. */
264 #undef FUNCTION_VALUE_REGNO_P
265 /* sysV68 (brain damaged) cc convention support. */
266 #define FUNCTION_VALUE_REGNO_P(N) \
267 ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
269 /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
270 more than one register. */
272 #undef NEEDS_UNTYPED_CALL
273 #define NEEDS_UNTYPED_CALL 1
275 #ifndef USE_GAS
276 /* This is the command to make the user-level label named NAME
277 defined for reference from other files. */
279 #undef GLOBAL_ASM_OP
280 #define GLOBAL_ASM_OP "\tglobal\t"
281 #endif /* USE_GAS */
283 /* Store in OUTPUT a string (made with alloca) containing
284 an assembler-name for a local static variable named NAME.
285 LABELNO is an integer which is different for each call. */
287 #undef ASM_FORMAT_PRIVATE_NAME
288 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
289 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
290 sprintf ((OUTPUT), "%s_%%%d", (NAME), (LABELNO)))
292 #ifdef USE_GAS
293 #undef ASM_LONG
294 #define ASM_LONG ".long"
295 #undef ASM_SHORT
296 #define ASM_SHORT ".short"
297 #undef ASM_CHAR
298 #define ASM_CHAR ".byte"
299 #undef ASM_BYTE
300 #define ASM_BYTE ".byte"
301 #undef ASM_BYTE_OP
302 #define ASM_BYTE_OP "\t.byte\t"
303 #else
304 #undef ASM_LONG
305 #define ASM_LONG "long"
306 #undef ASM_SHORT
307 #define ASM_SHORT "short"
308 #undef ASM_CHAR
309 #define ASM_CHAR "byte"
310 #undef ASM_BYTE
311 #define ASM_BYTE "byte"
312 #undef ASM_BYTE_OP
313 #define ASM_BYTE_OP "\tbyte\t"
314 #endif /* USE_GAS */
316 /* The sysV68 as doesn't know about double's and float's. */
317 /* This is how to output an assembler line defining a `double' constant. */
319 #undef ASM_OUTPUT_DOUBLE
320 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
321 do { long l[2]; \
322 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
323 fprintf (FILE, "\t%s 0x%lx,0x%lx\n", ASM_LONG, l[0], l[1]); \
324 } while (0)
326 #undef ASM_OUTPUT_LONG_DOUBLE
327 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
328 do { long l[3]; \
329 REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
330 fprintf (FILE, "\t%s 0x%lx,0x%lx,0x%lx\n", ASM_LONG, l[0], l[1], l[2]); \
331 } while (0)
333 /* This is how to output an assembler line defining a `float' constant. */
335 #undef ASM_OUTPUT_FLOAT
336 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
337 do { long l; \
338 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
339 fprintf ((FILE), "\t%s 0x%lx\n", ASM_LONG, l); \
340 } while (0)
342 /* This is how to output an assembler line defining an `int' constant. */
344 #undef ASM_OUTPUT_INT
345 #define ASM_OUTPUT_INT(FILE,VALUE) \
346 ( fprintf (FILE, "\t%s ", ASM_LONG), \
347 output_addr_const (FILE, (VALUE)), \
348 fprintf (FILE, "\n"))
350 /* Likewise for `char' and `short' constants. */
352 #undef ASM_OUTPUT_SHORT
353 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
354 ( fprintf (FILE, "\t%s ", ASM_SHORT), \
355 output_addr_const (FILE, (VALUE)), \
356 fprintf (FILE, "\n"))
358 #undef ASM_OUTPUT_CHAR
359 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
360 ( fprintf (FILE, "\t%s ", ASM_CHAR), \
361 output_addr_const (FILE, (VALUE)), \
362 fprintf (FILE, "\n"))
364 /* This is how to output an assembler line for a numeric constant byte. */
366 #undef ASM_OUTPUT_BYTE
367 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
368 fprintf (FILE, "\t%s 0x%x\n", ASM_BYTE, (int)(VALUE))
370 /* This is how to output an assembler line
371 that says to advance the location counter
372 to a multiple of 2**LOG bytes. */
374 #ifndef USE_GAS
375 #define ALIGN_ASM_OP "\teven"
376 #else /* USE_GAS */
377 #define ALIGN_ASM_OP "\t.even"
378 #endif /* USE_GAS */
380 #undef ASM_OUTPUT_ALIGN
381 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
382 if ((LOG) >= 1) \
383 fprintf (FILE, "%s\n", ALIGN_ASM_OP);
385 #ifndef USE_GAS
386 #define SKIP_ASM_OP "\tspace\t"
387 #else /* USE_GAS */
388 #define SKIP_ASM_OP "\t.skip\t"
389 #endif /* USE_GAS */
391 #undef ASM_OUTPUT_SKIP
392 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
393 fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (SIZE))
395 /* Can't use ASM_OUTPUT_SKIP in text section. */
397 #define ASM_NO_SKIP_IN_TEXT 1
399 /* The beginnings of sdb support... */
401 /* Undefining these will allow `output_file_directive' (in toplev.c)
402 to default to the right thing. */
403 #undef ASM_OUTPUT_MAIN_SOURCE_FILENAME
404 #ifndef USE_GAS
405 #define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME) \
406 do { fprintf (FILE, "\tfile\t"); \
407 output_quoted_string (FILE, FILENAME); \
408 fprintf (FILE, "\n"); \
409 } while (0)
411 #undef ASM_OUTPUT_SOURCE_LINE
412 #define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \
413 fprintf (FILE, "\tln\t%d\n", \
414 (sdb_begin_function_line \
415 ? (LINENO) - sdb_begin_function_line : 1))
417 /* Yet another null terminated string format. */
419 #undef ASM_OUTPUT_ASCII
420 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
421 do { register int sp = 0, lp = 0; \
422 fprintf ((FILE), "%s", ASM_BYTE_OP); \
423 loop: \
424 if ((PTR)[sp] > ' ' && ! ((PTR)[sp] & 0x80) && (PTR)[sp] != '\\') \
425 { lp += 3; \
426 fprintf ((FILE), "'%c", (PTR)[sp]); } \
427 else \
428 { lp += 5; \
429 fprintf ((FILE), "0x%x", (PTR)[sp]); } \
430 if (++sp < (LEN)) \
431 { if (lp > 60) \
432 { lp = 0; \
433 fprintf ((FILE), "\n%s", ASCII_DATA_ASM_OP); } \
434 else \
435 putc (',', (FILE)); \
436 goto loop; } \
437 putc ('\n', (FILE)); } while (0)
438 #endif /* USE_GAS */
440 #ifndef USE_GAS
441 /* Output a float value (represented as a C double) as an immediate operand.
442 This macro is a 68k-specific macro. */
444 #undef ASM_OUTPUT_FLOAT_OPERAND
445 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
446 do { long l; \
447 REAL_VALUE_TO_TARGET_SINGLE (r, l); \
448 /* Use hex representation even if CODE is f. as needs it. */ \
449 fprintf ((FILE), "&0x%lx", l); \
450 } while (0)
452 /* Output a double value (represented as a C double) as an immediate operand.
453 This macro is a 68k-specific macro. */
454 #undef ASM_OUTPUT_DOUBLE_OPERAND
455 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
456 do { long l[2]; \
457 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
458 fprintf ((FILE), "&0x%lx%08lx", l[0], l[1]); \
459 } while (0)
460 #endif /* USE_GAS */
462 /* This is how to store into the string LABEL
463 the symbol_ref name of an internal numbered label where
464 PREFIX is the class of label and NUM is the number within the class.
465 This is suitable for output with `assemble_name'. */
467 #undef ASM_GENERATE_INTERNAL_LABEL
468 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
469 sprintf ((LABEL), "%s%s%ld", LOCAL_LABEL_PREFIX, (PREFIX), (long)(NUM))
471 /* This is how to output an internal numbered label where
472 PREFIX is the class of label and NUM is the number within the class. */
474 #undef ASM_OUTPUT_INTERNAL_LABEL
475 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
476 asm_fprintf (FILE, "%L%s%d:\n", PREFIX, NUM)
478 /* The prefix to add to user-visible assembler symbols. */
480 #undef USER_LABEL_PREFIX
481 #define USER_LABEL_PREFIX ""
483 /* This is how to output an element of a case-vector that is absolute.
484 (The 68000 does not use such vectors,
485 but we must define this macro anyway.) */
486 /* The L after the local prefix is the "L" prefix for the normal labels
487 generated by gcc; why are ASM_OUTPUT_ADDR_VEC_ELT and
488 ASM_OUTPUT_ADDR_DIFF_ELT not called with a PREFIX parameter, like
489 ASM_OUTPUT_INTERNAL_LABEL ? */
491 #undef ASM_OUTPUT_ADDR_VEC_ELT
492 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
493 asm_fprintf (FILE, "\t%s %LL%d\n", ASM_LONG, (VALUE))
495 /* This is how to output an element of a case-vector that is relative. */
497 #undef ASM_OUTPUT_ADDR_DIFF_ELT
498 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
499 asm_fprintf (FILE, "\t%s %LL%d-%LL%d\n", ASM_SHORT, (VALUE), (REL))
501 #ifndef USE_GAS
503 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
504 asm_fprintf (FILE, "\tswbeg &%d\n%L%s%d:\n", \
505 XVECLEN (PATTERN (TABLE), 1), (PREFIX), (NUM))
507 /* sysV68 as cannot handle LD%n(%pc,%reg) */
508 #define SGS_NO_LI
510 /* labelno is not used here */
511 #define ASM_OUTPUT_CASE_FETCH(file, labelno, regname)\
512 asm_fprintf (file, "12(%Rpc,%s.", regname)
514 #define ASM_RETURN_CASE_JUMP \
515 do { \
516 if (TARGET_5200) \
517 return "ext%.l %0\n\tjmp 8(%%pc,%0.l)"; \
518 else \
519 return "jmp 8(%%pc,%0.w)"; \
520 } while (0)
522 #else /* USE_GAS */
524 /* labelno is not used here */
525 #define ASM_OUTPUT_CASE_FETCH(file, labelno, regname)\
526 asm_fprintf (file, "%Rpc@(6,%s:", regname)
528 #define ASM_RETURN_CASE_JUMP return "jmp %%pc@(2,%0:w)"
530 #endif /* USE_GAS */
532 #ifndef USE_GAS
534 /* Translate some opcodes to fit the sysV68 assembler syntax. */
535 /* The opcodes fdmov and fsmov are guesses. */
537 /* cliffm@netcom.com says no need for .w suffix on jumps. */
538 #undef ASM_OUTPUT_OPCODE
539 #define ASM_OUTPUT_OPCODE(FILE, PTR) \
540 { if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
541 { ++(PTR); \
542 while (*(PTR) != ' ') \
543 { putc (*(PTR), (FILE)); ++(PTR); } \
545 else if ((PTR)[0] == 's') \
547 if (!strncmp ((PTR), "swap", 4)) \
548 { fprintf ((FILE), "swap.w"); (PTR) += 4; } \
550 else if ((PTR)[0] == 'f') \
552 if (!strncmp ((PTR), "fmove", 5)) \
553 { fprintf ((FILE), "fmov"); (PTR) += 5; } \
554 else if (!strncmp ((PTR), "f%$move", 7)) \
555 { if (TARGET_68040_ONLY) \
556 { fprintf ((FILE), "fsmov"); (PTR) += 7; } \
557 else \
558 { fprintf ((FILE), "fmov"); (PTR) += 7; } } \
559 else if (!strncmp ((PTR), "f%&move", 7)) \
560 { if (TARGET_68040_ONLY) \
561 { fprintf ((FILE), "fdmov"); (PTR) += 7; } \
562 else \
563 { fprintf ((FILE), "fmov"); (PTR) += 7; } } \
564 else if (!strncmp ((PTR), "ftst", 4)) \
565 { fprintf ((FILE), "ftest"); (PTR) += 4; } \
566 else if (!strncmp ((PTR), "fbne", 4)) \
567 { fprintf ((FILE), "fbneq"); (PTR) += 4; } \
568 else if (!strncmp ((PTR), "fsne", 4)) \
569 { fprintf ((FILE), "fsneq"); (PTR) += 4; } \
571 /* MOVE, MOVEA, MOVEQ, MOVEC ==> MOV */ \
572 else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \
573 && (PTR)[2] == 'v' && (PTR)[3] == 'e') \
574 { fprintf ((FILE), "mov"); (PTR) += 4; \
575 if ((PTR)[0] == 'q' || (PTR)[0] == 'a' \
576 || (PTR)[0] == 'c') (PTR)++; } \
577 /* SUB, SUBQ, SUBA, SUBI ==> SUB */ \
578 else if ((PTR)[0] == 's' && (PTR)[1] == 'u' \
579 && (PTR)[2] == 'b') \
580 { fprintf ((FILE), "sub"); (PTR) += 3; \
581 if ((PTR)[0] == 'q' || (PTR)[0] == 'i' \
582 || (PTR)[0] == 'a') (PTR)++; } \
583 /* CMP, CMPA, CMPI, CMPM ==> CMP */ \
584 else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \
585 && (PTR)[2] == 'p') \
586 { fprintf ((FILE), "cmp"); (PTR) += 3; \
587 if ((PTR)[0] == 'a' || (PTR)[0] == 'i' \
588 || (PTR)[0] == 'm') (PTR)++; } \
590 #endif /* USE_GAS */
592 /* phdm@info.ucl.ac.be says to pass SIZE, not ROUNDED. */
594 /* This says how to output an assembler line
595 to define a global common symbol. */
597 #undef ASM_OUTPUT_COMMON
598 #ifndef USE_GAS
599 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
600 ( fputs ("\tcomm ", (FILE)), \
601 assemble_name ((FILE), (NAME)), \
602 fprintf ((FILE), ",%u\n", (SIZE)))
603 #else /* USE_GAS */
604 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
605 ( fputs ("\t.comm ", (FILE)), \
606 assemble_name ((FILE), (NAME)), \
607 fprintf ((FILE), ",%u\n", (SIZE)))
608 #endif /* USE_GAS */
610 /* This says how to output an assembler line
611 to define a local common symbol. */
613 #undef ASM_OUTPUT_LOCAL
614 #ifndef USE_GAS
615 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
616 ( fputs ("\tlcomm ", (FILE)), \
617 assemble_name ((FILE), (NAME)), \
618 fprintf ((FILE), ",%u\n", (SIZE)))
619 #else /* USE_GAS */
620 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
621 ( fputs ("\t.lcomm ", (FILE)), \
622 assemble_name ((FILE), (NAME)), \
623 fprintf ((FILE), ",%u\n", (SIZE)))
624 #endif /* USE_GAS */
626 #ifndef USE_GAS
627 /* Override usual definitions of SDB output macros.
628 These definitions differ only in the absence of the period
629 at the beginning of the name of the directive
630 and in the use of `~' as the symbol for the current location. */
632 #define PUT_SDB_SCL(a) fprintf(asm_out_file, "\tscl\t%d;", (a))
633 #define PUT_SDB_INT_VAL(a) fprintf (asm_out_file, "\tval\t%d;", (a))
634 #define PUT_SDB_VAL(a) \
635 ( fputs ("\tval\t", asm_out_file), \
636 output_addr_const (asm_out_file, (a)), \
637 fputc (';', asm_out_file))
639 #define PUT_SDB_DEF(a) \
640 do { fprintf (asm_out_file, "\tdef\t"); \
641 ASM_OUTPUT_LABELREF (asm_out_file, a); \
642 fprintf (asm_out_file, ";"); } while (0)
644 #define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\tdef\t~%s;",a)
645 #define PUT_SDB_ENDEF fputs("\tendef\n", asm_out_file)
646 #define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\ttype\t0%o;", a)
647 #define PUT_SDB_SIZE(a) fprintf(asm_out_file, "\tsize\t%d;", a)
648 #define PUT_SDB_START_DIM fprintf(asm_out_file, "\tdim\t")
649 #define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a)
650 #define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d;", a)
652 #define PUT_SDB_TAG(a) \
653 do { fprintf (asm_out_file, "\ttag\t"); \
654 ASM_OUTPUT_LABELREF (asm_out_file, a); \
655 fprintf (asm_out_file, ";"); } while (0)
657 #define PUT_SDB_BLOCK_START(LINE) \
658 fprintf (asm_out_file, \
659 "\tdef\t~bb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \
660 (LINE))
662 #define PUT_SDB_BLOCK_END(LINE) \
663 fprintf (asm_out_file, \
664 "\tdef\t~eb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \
665 (LINE))
667 #define PUT_SDB_FUNCTION_START(LINE) \
668 fprintf (asm_out_file, \
669 "\tdef\t~bf;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \
670 (LINE))
672 #define PUT_SDB_FUNCTION_END(LINE) \
673 fprintf (asm_out_file, \
674 "\tdef\t~ef;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \
675 (LINE))
677 #define PUT_SDB_EPILOGUE_END(NAME) \
678 fprintf (asm_out_file, \
679 "\tdef\t%s;\tval\t~;\tscl\t-1;\tendef\n", \
680 (NAME))
682 #define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
683 sprintf ((BUFFER), "~%dfake", (NUMBER));
685 #endif /* USE_GAS */
687 /* Define subroutines to call to handle multiply, divide, and remainder.
688 Use the subroutines that the sysV68's library provides.
689 The `*' prevents an underscore from being prepended by the compiler. */
690 /* The '*' is also used by INIT_CUMULATIVE_ARGS */
692 #define DIVSI3_LIBCALL "*ldiv%%"
693 #define UDIVSI3_LIBCALL "*uldiv%%"
694 #define MODSI3_LIBCALL "*lrem%%"
695 #define UMODSI3_LIBCALL "*ulrem%%"
696 #define MULSI3_LIBCALL "*lmul%%"
698 struct sysV68_cumulative_args
700 int offset;
701 int libcall;
704 #undef CUMULATIVE_ARGS
705 #define CUMULATIVE_ARGS struct sysV68_cumulative_args
707 #undef INIT_CUMULATIVE_ARGS
708 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
709 do {(CUM).offset = 0;\
710 (CUM).libcall = (LIBNAME) && (*XSTR((LIBNAME), 0) == '*');} while(0)
712 #undef FUNCTION_ARG_ADVANCE
713 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
714 ((CUM).offset += ((MODE) != BLKmode \
715 ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
716 : (int_size_in_bytes (TYPE) + 3) & ~3))
718 #undef FUNCTION_ARG
719 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
720 (((CUM).libcall && (CUM).offset == 0) ? gen_rtx_REG ((MODE), 0)\
721 : (TARGET_REGPARM && (CUM).offset < 8) ? gen_rtx_REG ((MODE), (CUM).offset / 4) : 0)
723 #undef FUNCTION_ARG_PARTIAL_NREGS
724 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
725 ((TARGET_REGPARM && (CUM).offset < 8 \
726 && 8 < ((CUM).offset + ((MODE) == BLKmode \
727 ? int_size_in_bytes (TYPE) \
728 : GET_MODE_SIZE (MODE)))) \
729 ? 2 - (CUM).offset / 4 : 0)
731 #undef FUNCTION_ARG_REGNO_P
732 #define FUNCTION_ARG_REGNO_P(N) (TARGET_68020 ? 0 : (N) == 0)
734 /* manfred@lts.sel.alcatel.de: I believe that most delta machines are configured to have
735 a 6888[12] FPU for which we need to link -lm881 instead of -lm; define ALT_LIBM to
736 tell g++.c about that. */
737 #define ALT_LIBM "-lm881"
739 #if (TARGET_DEFAULT & MASK_68881) /* The default configuration has a 6888[12] FPU. */
740 #define MATH_LIBRARY "-lm881"
741 #endif
743 /* Currently we do not have the atexit() function,
744 so take that from libgcc2.c */
746 #define NEED_ATEXIT 1
748 #define EXIT_BODY \
749 do \
751 __stop_monitor (); \
752 _cleanup (); \
753 } while (0)
755 /* FINALIZE_TRAMPOLINE clears the instruction cache. */
757 #undef FINALIZE_TRAMPOLINE
758 #define FINALIZE_TRAMPOLINE(TRAMP) \
759 if (!TARGET_68040) \
761 else \
762 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_insn_cache"), \
763 0, VOIDmode, 0)