1 /* Definitions of target machine for GNU compiler. Sun 68000/68020 version.
2 Copyright (C) 1987, 1988, 1993, 1995, 1996 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* This comment is here to see if it will keep Sun's cpp from dying. */
23 /* If you do not need to generate floating point code for the optional
24 Sun FPA board, you can safely comment out the SUPPORT_SUN_FPA define
25 to gain a little speed and code size. */
27 #define SUPPORT_SUN_FPA
29 #include "m68k/m68k.h"
31 /* See m68k.h. 7 means 68020 with 68881. */
33 #ifndef TARGET_DEFAULT
34 #define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
37 /* Define __HAVE_FPA__ or __HAVE_68881__ in preprocessor,
38 according to the -m flags.
39 This will control the use of inline 68881 insns in certain macros.
40 Also inform the program which CPU this is for. */
42 #if TARGET_DEFAULT & MASK_68881
44 /* -m68881 is the default */
46 "%{!msoft-float:%{mfpa:-D__HAVE_FPA__ }%{!mfpa:-D__HAVE_68881__ }}\
47 %{m68000:-D__mc68010__}%{mc68000:-D__mc68010__}%{!mc68000:%{!m68000:-D__mc68020__}} \
48 %{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
52 /* -msoft-float is the default */
54 "%{m68881:-D__HAVE_68881__ }%{mfpa:-D__HAVE_FPA__ }\
55 %{m68000:-D__mc68010__}%{mc68000:-D__mc68010__}%{!mc68000:%{!m68000:-D__mc68020__}} \
56 %{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
60 /* Prevent error on `-sun3' and `-target sun3' options. */
62 #define CC1_SPEC "%{sun3:} %{target:}"
64 #define PTRDIFF_TYPE "int"
66 /* We must override m68k.h. */
68 #undef WCHAR_TYPE_SIZE
69 #define WCHAR_TYPE "short unsigned int"
70 #define WCHAR_TYPE_SIZE 16
72 /* These compiler options take an argument. We ignore -target for now. */
74 #define WORD_SWITCH_TAKES_ARG(STR) \
75 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
76 || !strcmp (STR, "target") || !strcmp (STR, "assert"))
78 /* -m68000 requires special flags to the assembler. */
81 "%{m68000:-mc68010}%{mc68000:-mc68010}%{!mc68000:%{!m68000:-mc68020}} \
82 %{fpic:-k} %{fPIC:-k} %{R} %{j} %{J} %{h} %{d2} %{keep-local-as-symbols:-L}"
84 /* Names to predefine in the preprocessor for this target machine. */
85 /* For a while, -D_CROSS_TARGET_ARCH=SUN3 was included here,
86 but it doesn't work, partly because SUN3 etc. aren't defined
87 (and shouldn't be). It seems that on a native compiler _CROSS_TARGET_ARCH
88 should not be defined. For cross compilers, let's do things as we
89 normally do in GCC. -- rms. */
91 #define CPP_PREDEFINES "-Dmc68000 -Dsun -Dunix -Asystem(unix) -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
93 /* STARTFILE_SPEC to include sun floating point initialization
94 This is necessary (tr: Sun does it) for both the m68881 and the fpa
96 Note that includes knowledge of the default specs for gcc, ie. no
97 args translates to the same effect as -m68881
98 I'm not sure what would happen below if people gave contradictory
99 arguments (eg. -msoft-float -mfpa) */
101 #if TARGET_DEFAULT & MASK_FPA
102 /* -mfpa is the default */
103 #define STARTFILE_SPEC \
104 "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} \
105 %{m68881:Mcrt1.o%s} \
106 %{msoft-float:Fcrt1.o%s} \
107 %{!m68881:%{!msoft-float:Wcrt1.o%s}}"
109 #if TARGET_DEFAULT & MASK_68881
110 /* -m68881 is the default */
111 #define STARTFILE_SPEC \
112 "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} \
114 %{msoft-float:Fcrt1.o%s} \
115 %{!mfpa:%{!msoft-float:Mcrt1.o%s}}"
117 /* -msoft-float is the default */
118 #define STARTFILE_SPEC \
119 "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} \
120 %{m68881:Mcrt1.o%s} \
122 %{!m68881:%{!mfpa:Fcrt1.o%s}}"
126 /* Specify library to handle `-a' basic block profiling.
127 Control choice of libm.a (if user says -lm)
128 based on fp arith default and options. */
130 #if TARGET_DEFAULT & MASK_FPA
131 /* -mfpa is the default */
132 #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
134 %{msoft-float:-L/usr/lib/fsoft}%{m68881:-L/usr/lib/f68881}\
135 %{!msoft_float:%{!m68881:-L/usr/lib/ffpa}}"
137 #if TARGET_DEFAULT & MASK_68881
138 /* -m68881 is the default */
139 #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
141 %{msoft-float:-L/usr/lib/fsoft}%{!msoft-float:%{!mfpa:-L/usr/lib/f68881}}\
142 %{mfpa:-L/usr/lib/ffpa}"
144 /* -msoft-float is the default */
145 #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
147 %{!m68881:%{!mfpa:-L/usr/lib/fsoft}}%{m68881:-L/usr/lib/f68881}\
148 %{mfpa:-L/usr/lib/ffpa}"
152 /* Provide required defaults for linker -e and -d switches. */
155 "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
157 /* Every structure or union's size must be a multiple of 2 bytes. */
159 #define STRUCTURE_SIZE_BOUNDARY 16
161 /* This is BSD, so it wants DBX format. */
163 #define DBX_DEBUGGING_INFO
165 /* Allow folding division by zero. */
166 #define REAL_INFINITY
168 /* Generate calls to memcpy, memcmp and memset. */
169 #define TARGET_MEM_FUNCTIONS
171 /* This is not a good idea. It prevents interoperation between
172 files compiled with -m68881 and those compiled with -msoft-float. */
174 #define FUNCTION_VALUEX(MODE) \
175 gen_rtx (REG, (MODE), \
177 && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode)) \
180 #undef FUNCTION_VALUE
181 #define FUNCTION_VALUE(VALTYPE,FUNC) FUNCTION_VALUEX (TYPE_MODE (VALTYPE))
184 /* This is how to output an assembler line defining a `double' constant. */
186 #undef ASM_OUTPUT_DOUBLE
187 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
189 if (REAL_VALUE_ISINF (VALUE)) \
191 if (REAL_VALUE_NEGATIVE (VALUE)) \
192 fprintf (FILE, "\t.double 0r-99e999\n"); \
194 fprintf (FILE, "\t.double 0r99e999\n"); \
196 else if (REAL_VALUE_ISNAN (VALUE)) \
198 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), l); \
199 fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", l[0], l[1]); \
203 REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr); \
204 fprintf (FILE, "\t.double 0r%s\n", dstr); \
208 /* This is how to output an assembler line defining a `float' constant. */
210 #undef ASM_OUTPUT_FLOAT
211 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
213 if (REAL_VALUE_ISINF (VALUE)) \
215 if (REAL_VALUE_NEGATIVE (VALUE)) \
216 fprintf (FILE, "\t.single 0r-99e999\n"); \
218 fprintf (FILE, "\t.single 0r99e999\n"); \
220 else if (REAL_VALUE_ISNAN (VALUE)) \
222 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), l); \
223 fprintf (FILE, "\t.long 0x%lx\n", l); \
227 REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr); \
228 fprintf (FILE, "\t.single 0r%s\n", dstr); \
232 /* This is how to output an assembler lines defining floating operands.
233 There's no way to output a NaN's fraction, so we lose it. */
235 #undef ASM_OUTPUT_FLOAT_OPERAND
236 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
241 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
242 if (sizeof (int) == sizeof (long)) \
243 asm_fprintf ((FILE), "%I0x%x", l); \
245 asm_fprintf ((FILE), "%I0x%lx", l); \
247 else if (REAL_VALUE_ISINF (VALUE)) \
249 if (REAL_VALUE_NEGATIVE (VALUE)) \
250 asm_fprintf (FILE, "%I0r-99e999"); \
252 asm_fprintf (FILE, "%I0r99e999"); \
254 else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
256 asm_fprintf (FILE, "%I0r-0.0"); \
260 REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr); \
261 asm_fprintf (FILE, "%I0r%s", dstr); \
265 #undef ASM_OUTPUT_DOUBLE_OPERAND
266 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
267 do { if (REAL_VALUE_ISINF (VALUE)) \
269 if (REAL_VALUE_NEGATIVE (VALUE)) \
270 asm_fprintf (FILE, "%I0r-99e999"); \
272 asm_fprintf (FILE, "%I0r99e999"); \
274 else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
276 asm_fprintf (FILE, "%I0r-0.0"); \
280 REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr); \
281 asm_fprintf (FILE, "%I0r%s", dstr); \
286 /* This was turned off as it caused linking errors on sunos4.1.
287 `gcc -a' links in /usr/lib/bb_link.o which does not provide __bb_link
288 but its own version of __bb_init_func. */
289 #undef BLOCK_PROFILER_CODE
290 #define BLOCK_PROFILER_CODE \
291 extern int ___tcov_init; \
293 __bb_init_func (blocks) \
296 if (! ___tcov_init) \
297 ___tcov_init_func (); \
299 ___bb_link (blocks->filename, blocks->counts, blocks->ncounts); \