1 /* Definitions of target machine for GNU compiler. Sun 68000/68020 version.
2 Copyright (C) 1987, 1988, 1993, 1995, 1996, 1998, 1999
3 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* This comment is here to see if it will keep Sun's cpp from dying. */
24 /* If you do not need to generate floating point code for the optional
25 Sun FPA board, you can safely comment out the SUPPORT_SUN_FPA define
26 to gain a little speed and code size. */
28 #define SUPPORT_SUN_FPA
30 #include "m68k/m68k.h"
32 /* See m68k.h. 7 means 68020 with 68881. */
34 #ifndef TARGET_DEFAULT
35 #define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
38 /* Define __HAVE_FPA__ or __HAVE_68881__ in preprocessor,
39 according to the -m flags.
40 This will control the use of inline 68881 insns in certain macros.
41 Also inform the program which CPU this is for. */
43 #if TARGET_DEFAULT & MASK_68881
45 /* -m68881 is the default */
47 "%{!msoft-float:%{mfpa:-D__HAVE_FPA__ }%{!mfpa:-D__HAVE_68881__ }}\
48 %{m68000:-D__mc68010__}%{mc68000:-D__mc68010__}%{!mc68000:%{!m68000:-D__mc68020__}} \
49 %{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
53 /* -msoft-float is the default */
55 "%{m68881:-D__HAVE_68881__ }%{mfpa:-D__HAVE_FPA__ }\
56 %{m68000:-D__mc68010__}%{mc68000:-D__mc68010__}%{!mc68000:%{!m68000:-D__mc68020__}} \
57 %{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
61 /* Prevent error on `-sun3' and `-target sun3' options. */
63 #define CC1_SPEC "%{sun3:} %{target:}"
65 #define PTRDIFF_TYPE "int"
67 /* We must override m68k.h. */
69 #undef WCHAR_TYPE_SIZE
70 #define WCHAR_TYPE "short unsigned int"
71 #define WCHAR_TYPE_SIZE 16
73 /* These compiler options take an argument. We ignore -target for now. */
75 #define WORD_SWITCH_TAKES_ARG(STR) \
76 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
77 || !strcmp (STR, "target") || !strcmp (STR, "assert"))
79 /* -m68000 requires special flags to the assembler. */
82 "%{m68000:-mc68010}%{mc68000:-mc68010}%{!mc68000:%{!m68000:-mc68020}} \
83 %{fpic:-k} %{fPIC:-k} %{R} %{j} %{J} %{h} %{d2} %{keep-local-as-symbols:-L}"
85 /* Names to predefine in the preprocessor for this target machine. */
86 /* For a while, -D_CROSS_TARGET_ARCH=SUN3 was included here,
87 but it doesn't work, partly because SUN3 etc. aren't defined
88 (and shouldn't be). It seems that on a native compiler _CROSS_TARGET_ARCH
89 should not be defined. For cross compilers, let's do things as we
90 normally do in GCC. -- rms. */
92 #define CPP_PREDEFINES "-Dmc68000 -Dsun -Dunix -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
94 /* STARTFILE_SPEC to include sun floating point initialization
95 This is necessary (tr: Sun does it) for both the m68881 and the fpa
97 Note that includes knowledge of the default specs for gcc, ie. no
98 args translates to the same effect as -m68881
99 I'm not sure what would happen below if people gave contradictory
100 arguments (eg. -msoft-float -mfpa) */
102 #if TARGET_DEFAULT & MASK_FPA
103 /* -mfpa is the default */
104 #define STARTFILE_SPEC \
105 "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} \
106 %{m68881:Mcrt1.o%s} \
107 %{msoft-float:Fcrt1.o%s} \
108 %{!m68881:%{!msoft-float:Wcrt1.o%s}}"
110 #if TARGET_DEFAULT & MASK_68881
111 /* -m68881 is the default */
112 #define STARTFILE_SPEC \
113 "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} \
115 %{msoft-float:Fcrt1.o%s} \
116 %{!mfpa:%{!msoft-float:Mcrt1.o%s}}"
118 /* -msoft-float is the default */
119 #define STARTFILE_SPEC \
120 "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} \
121 %{m68881:Mcrt1.o%s} \
123 %{!m68881:%{!mfpa:Fcrt1.o%s}}"
127 /* Specify library to handle `-a' basic block profiling.
128 Control choice of libm.a (if user says -lm)
129 based on fp arith default and options. */
131 #if TARGET_DEFAULT & MASK_FPA
132 /* -mfpa is the default */
133 #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
135 %{msoft-float:-L/usr/lib/fsoft}%{m68881:-L/usr/lib/f68881}\
136 %{!msoft_float:%{!m68881:-L/usr/lib/ffpa}}"
138 #if TARGET_DEFAULT & MASK_68881
139 /* -m68881 is the default */
140 #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
142 %{msoft-float:-L/usr/lib/fsoft}%{!msoft-float:%{!mfpa:-L/usr/lib/f68881}}\
143 %{mfpa:-L/usr/lib/ffpa}"
145 /* -msoft-float is the default */
146 #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
148 %{!m68881:%{!mfpa:-L/usr/lib/fsoft}}%{m68881:-L/usr/lib/f68881}\
149 %{mfpa:-L/usr/lib/ffpa}"
153 /* Provide required defaults for linker -e and -d switches. */
156 "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
158 /* Every structure or union's size must be a multiple of 2 bytes. */
160 #define STRUCTURE_SIZE_BOUNDARY 16
162 /* This is BSD, so it wants DBX format. */
164 #define DBX_DEBUGGING_INFO
166 /* Allow folding division by zero. */
167 #define REAL_INFINITY
169 /* Generate calls to memcpy, memcmp and memset. */
170 #define TARGET_MEM_FUNCTIONS
172 /* This is not a good idea. It prevents interoperation between
173 files compiled with -m68881 and those compiled with -msoft-float. */
175 #define FUNCTION_VALUEX(MODE) \
176 gen_rtx_REG ((MODE), \
178 && ((MODE) == SFmode || (MODE) == DFmode \
179 || (MODE) == XFmode)) \
182 #undef FUNCTION_VALUE
183 #define FUNCTION_VALUE(VALTYPE,FUNC) FUNCTION_VALUEX (TYPE_MODE (VALTYPE))
186 /* This is how to output an assembler line defining a `double' constant. */
188 #undef ASM_OUTPUT_DOUBLE
189 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
191 if (REAL_VALUE_ISINF (VALUE)) \
193 if (REAL_VALUE_NEGATIVE (VALUE)) \
194 fprintf (FILE, "\t.double 0r-99e999\n"); \
196 fprintf (FILE, "\t.double 0r99e999\n"); \
198 else if (REAL_VALUE_ISNAN (VALUE)) \
200 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), l); \
201 fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", l[0], l[1]); \
205 REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr); \
206 fprintf (FILE, "\t.double 0r%s\n", dstr); \
210 /* This is how to output an assembler line defining a `float' constant. */
212 #undef ASM_OUTPUT_FLOAT
213 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
215 if (REAL_VALUE_ISINF (VALUE)) \
217 if (REAL_VALUE_NEGATIVE (VALUE)) \
218 fprintf (FILE, "\t.single 0r-99e999\n"); \
220 fprintf (FILE, "\t.single 0r99e999\n"); \
222 else if (REAL_VALUE_ISNAN (VALUE)) \
224 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), l); \
225 fprintf (FILE, "\t.long 0x%lx\n", l); \
229 REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr); \
230 fprintf (FILE, "\t.single 0r%s\n", dstr); \
234 /* This is how to output an assembler lines defining floating operands.
235 There's no way to output a NaN's fraction, so we lose it. */
237 #undef ASM_OUTPUT_FLOAT_OPERAND
238 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
243 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
244 if (sizeof (int) == sizeof (long)) \
245 asm_fprintf ((FILE), "%I0x%x", l); \
247 asm_fprintf ((FILE), "%I0x%lx", l); \
249 else if (REAL_VALUE_ISINF (VALUE)) \
251 if (REAL_VALUE_NEGATIVE (VALUE)) \
252 asm_fprintf (FILE, "%I0r-99e999"); \
254 asm_fprintf (FILE, "%I0r99e999"); \
256 else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
258 asm_fprintf (FILE, "%I0r-0.0"); \
262 REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr); \
263 asm_fprintf (FILE, "%I0r%s", dstr); \
267 #undef ASM_OUTPUT_DOUBLE_OPERAND
268 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
269 do { if (REAL_VALUE_ISINF (VALUE)) \
271 if (REAL_VALUE_NEGATIVE (VALUE)) \
272 asm_fprintf (FILE, "%I0r-99e999"); \
274 asm_fprintf (FILE, "%I0r99e999"); \
276 else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
278 asm_fprintf (FILE, "%I0r-0.0"); \
282 REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr); \
283 asm_fprintf (FILE, "%I0r%s", dstr); \
288 /* This was turned off as it caused linking errors on sunos4.1.
289 `gcc -a' links in /usr/lib/bb_link.o which does not provide __bb_link
290 but its own version of __bb_init_func. */
291 #undef BLOCK_PROFILER_CODE
292 #define BLOCK_PROFILER_CODE \
293 extern int ___tcov_init; \
295 __bb_init_func (blocks) \
298 if (! ___tcov_init) \
299 ___tcov_init_func (); \
301 ___bb_link (blocks->filename, blocks->counts, blocks->ncounts); \