OSDN Git Service

* config/a29k/xm-a29k.h, config/a29k/xm-unix.h,
[pf3gnuchains/gcc-fork.git] / gcc / config / m68k / sun3.h
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.
4
5 This file is part of GNU CC.
6
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)
10 any later version.
11
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.
16
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.  */
21
22 /* This comment is here to see if it will keep Sun's cpp from dying.  */
23
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.  */
27
28 #define SUPPORT_SUN_FPA
29
30 #include "m68k/m68k.h"
31
32 /* See m68k.h.  7 means 68020 with 68881.  */
33
34 #ifndef TARGET_DEFAULT
35 #define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
36 #endif
37
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.  */
42
43 #if TARGET_DEFAULT & MASK_68881
44
45 /* -m68881 is the default */
46 #define CPP_SPEC \
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}}}"
50
51 #else
52
53 /* -msoft-float is the default */
54 #define CPP_SPEC \
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}}}"
58
59 #endif
60
61 /* Prevent error on `-sun3' and `-target sun3' options.  */
62
63 #define CC1_SPEC "%{sun3:} %{target:}"
64
65 #define PTRDIFF_TYPE "int"
66
67 /* We must override m68k.h.  */
68 #undef WCHAR_TYPE
69 #undef WCHAR_TYPE_SIZE
70 #define WCHAR_TYPE "short unsigned int"
71 #define WCHAR_TYPE_SIZE 16
72
73 /* These compiler options take an argument.  We ignore -target for now.  */
74
75 #define WORD_SWITCH_TAKES_ARG(STR)                              \
76  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                           \
77   || !strcmp (STR, "target") || !strcmp (STR, "assert"))
78
79 /* -m68000 requires special flags to the assembler.  */
80
81 #define ASM_SPEC \
82  "%{m68000:-mc68010}%{mc68000:-mc68010}%{!mc68000:%{!m68000:-mc68020}} \
83   %{fpic:-k} %{fPIC:-k} %{R} %{j} %{J} %{h} %{d2} %{keep-local-as-symbols:-L}"
84
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.  */
91
92 #define CPP_PREDEFINES "-Dmc68000 -Dsun -Dunix -Asystem=unix  -Asystem=bsd -Acpu=m68k -Amachine=m68k"
93
94 /* STARTFILE_SPEC to include sun floating point initialization
95    This is necessary (tr: Sun does it) for both the m68881 and the fpa
96    routines.
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) */
101
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}}"
109 #else
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}}   \
114    %{mfpa:Wcrt1.o%s}                                    \
115    %{msoft-float:Fcrt1.o%s}                             \
116    %{!mfpa:%{!msoft-float:Mcrt1.o%s}}"
117 #else
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}                                  \
122    %{mfpa:Wcrt1.o%s}                                    \
123    %{!m68881:%{!mfpa:Fcrt1.o%s}}"
124 #endif
125 #endif
126
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.  */
130
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} \
134 %{g:-lg} \
135 %{msoft-float:-L/usr/lib/fsoft}%{m68881:-L/usr/lib/f68881}\
136 %{!msoft_float:%{!m68881:-L/usr/lib/ffpa}}"
137 #else
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} \
141 %{g:-lg} \
142 %{msoft-float:-L/usr/lib/fsoft}%{!msoft-float:%{!mfpa:-L/usr/lib/f68881}}\
143 %{mfpa:-L/usr/lib/ffpa}"
144 #else
145 /* -msoft-float is the default */
146 #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
147 %{g:-lg} \
148 %{!m68881:%{!mfpa:-L/usr/lib/fsoft}}%{m68881:-L/usr/lib/f68881}\
149 %{mfpa:-L/usr/lib/ffpa}"
150 #endif
151 #endif
152
153 /* Provide required defaults for linker -e and -d switches.  */
154
155 #define LINK_SPEC \
156  "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
157
158 /* Every structure or union's size must be a multiple of 2 bytes.  */
159
160 #define STRUCTURE_SIZE_BOUNDARY 16
161
162 /* This is BSD, so it wants DBX format.  */
163
164 #define DBX_DEBUGGING_INFO
165
166 /* Allow folding division by zero.  */
167 #define REAL_INFINITY
168
169 /* Generate calls to memcpy, memcmp and memset.  */
170 #define TARGET_MEM_FUNCTIONS
171
172 /* This is not a good idea.  It prevents interoperation between
173    files compiled with -m68881 and those compiled with -msoft-float.  */
174 #if 0
175 #define FUNCTION_VALUEX(MODE)                                   \
176   gen_rtx_REG ((MODE),                                          \
177                ((TARGET_68881                                   \
178                  && ((MODE) == SFmode || (MODE) == DFmode       \
179                      || (MODE) == XFmode))                      \
180                 ? 16 : 0))
181
182 #undef FUNCTION_VALUE
183 #define FUNCTION_VALUE(VALTYPE,FUNC) FUNCTION_VALUEX (TYPE_MODE (VALTYPE))
184 #endif /* 0 */
185
186 /* This is how to output an assembler line defining a `double' constant.  */
187
188 #undef ASM_OUTPUT_DOUBLE
189 #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                           \
190   {                                                             \
191     if (REAL_VALUE_ISINF (VALUE))                               \
192       {                                                         \
193         if (REAL_VALUE_NEGATIVE (VALUE))                        \
194           fprintf (FILE, "\t.double 0r-99e999\n");              \
195         else                                                    \
196           fprintf (FILE, "\t.double 0r99e999\n");               \
197       }                                                         \
198     else if (REAL_VALUE_ISNAN (VALUE))                          \
199       { long l[2];                                              \
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]); \
202       }                                                         \
203     else                                                        \
204       { char dstr[30];                                          \
205         REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr);         \
206         fprintf (FILE, "\t.double 0r%s\n", dstr);               \
207       }                                                         \
208     }
209
210 /* This is how to output an assembler line defining a `float' constant.  */
211
212 #undef ASM_OUTPUT_FLOAT
213 #define ASM_OUTPUT_FLOAT(FILE,VALUE)                            \
214   {                                                             \
215     if (REAL_VALUE_ISINF (VALUE))                               \
216       {                                                         \
217         if (REAL_VALUE_NEGATIVE (VALUE))                        \
218           fprintf (FILE, "\t.single 0r-99e999\n");              \
219         else                                                    \
220           fprintf (FILE, "\t.single 0r99e999\n");                       \
221       }                                                         \
222     else if (REAL_VALUE_ISNAN (VALUE))                          \
223       { long l;                                                 \
224         REAL_VALUE_TO_TARGET_SINGLE ((VALUE), l);               \
225         fprintf (FILE, "\t.long 0x%lx\n", l);                   \
226       }                                                         \
227     else                                                        \
228       { char dstr[30];                                          \
229         REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr);          \
230         fprintf (FILE, "\t.single 0r%s\n", dstr);               \
231       }                                                         \
232     }
233
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.  */
236   
237 #undef ASM_OUTPUT_FLOAT_OPERAND
238 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE)               \
239  do {                                                           \
240       if (CODE != 'f')                                          \
241         {                                                       \
242           long l;                                               \
243           REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);               \
244           if (sizeof (int) == sizeof (long))                    \
245             asm_fprintf ((FILE), "%I0x%x", l);                  \
246           else                                                  \
247             asm_fprintf ((FILE), "%I0x%lx", l);                 \
248         }                                                       \
249       else if (REAL_VALUE_ISINF (VALUE))                        \
250         {                                                       \
251           if (REAL_VALUE_NEGATIVE (VALUE))                      \
252             asm_fprintf (FILE, "%I0r-99e999");                  \
253           else                                                  \
254             asm_fprintf (FILE, "%I0r99e999");                   \
255         }                                                       \
256       else if (REAL_VALUE_MINUS_ZERO (VALUE))                   \
257         {                                                       \
258           asm_fprintf (FILE, "%I0r-0.0");                       \
259         }                                                       \
260       else                                                      \
261         { char dstr[30];                                        \
262           REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr);        \
263           asm_fprintf (FILE, "%I0r%s", dstr);                   \
264         }                                                       \
265     } while (0)
266
267 #undef ASM_OUTPUT_DOUBLE_OPERAND
268 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                           \
269  do { if (REAL_VALUE_ISINF (VALUE))                                     \
270         {                                                               \
271           if (REAL_VALUE_NEGATIVE (VALUE))                              \
272             asm_fprintf (FILE, "%I0r-99e999");                          \
273           else                                                          \
274             asm_fprintf (FILE, "%I0r99e999");                           \
275         }                                                               \
276       else if (REAL_VALUE_MINUS_ZERO (VALUE))                           \
277         {                                                               \
278           asm_fprintf (FILE, "%I0r-0.0");                               \
279         }                                                               \
280       else                                                              \
281         { char dstr[30];                                                \
282           REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr);               \
283           asm_fprintf (FILE, "%I0r%s", dstr);                           \
284         }                                                               \
285     } while (0)
286
287 #if 0
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;                                                \
294                                                                         \
295 __bb_init_func (blocks)                                                 \
296         struct bb *blocks;                                              \
297 {                                                                       \
298   if (! ___tcov_init)                                                   \
299     ___tcov_init_func ();                                               \
300                                                                         \
301   ___bb_link (blocks->filename, blocks->counts, blocks->ncounts);       \
302 }
303 #endif