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 1 165 166 /* Generate calls to memcpy, memcmp and memset. */ 167 #define TARGET_MEM_FUNCTIONS 168 169 /* This is not a good idea. It prevents interoperation between 170 files compiled with -m68881 and those compiled with -msoft-float. */ 171 #if 0 172 #define FUNCTION_VALUEX(MODE) \ 173 gen_rtx_REG ((MODE), \ 174 ((TARGET_68881 \ 175 && ((MODE) == SFmode || (MODE) == DFmode \ 176 || (MODE) == XFmode)) \ 177 ? 16 : 0)) 178 179 #undef FUNCTION_VALUE 180 #define FUNCTION_VALUE(VALTYPE,FUNC) FUNCTION_VALUEX (TYPE_MODE (VALTYPE)) 181 #endif /* 0 */ 182 183 /* This is how to output an assembler lines defining floating operands. 184 There's no way to output a NaN's fraction, so we lose it. */ 185 186 #undef ASM_OUTPUT_FLOAT_OPERAND 187 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \ 188 do { \ 189 if (CODE != 'f') \ 190 { \ 191 long l; \ 192 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \ 193 if (sizeof (int) == sizeof (long)) \ 194 asm_fprintf ((FILE), "%I0x%x", (int) l); \ 195 else \ 196 asm_fprintf ((FILE), "%I0x%lx", l); \ 197 } \ 198 else if (REAL_VALUE_ISINF (VALUE)) \ 199 { \ 200 if (REAL_VALUE_NEGATIVE (VALUE)) \ 201 asm_fprintf (FILE, "%I0r-99e999"); \ 202 else \ 203 asm_fprintf (FILE, "%I0r99e999"); \ 204 } \ 205 else if (REAL_VALUE_MINUS_ZERO (VALUE)) \ 206 { \ 207 asm_fprintf (FILE, "%I0r-0.0"); \ 208 } \ 209 else \ 210 { char dstr[30]; \ 211 real_to_decimal (dstr, &(VALUE), sizeof (dstr), 9, 0); \ 212 asm_fprintf (FILE, "%I0r%s", dstr); \ 213 } \ 214 } while (0) 215 216 #undef ASM_OUTPUT_DOUBLE_OPERAND 217 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \ 218 do { if (REAL_VALUE_ISINF (VALUE)) \ 219 { \ 220 if (REAL_VALUE_NEGATIVE (VALUE)) \ 221 asm_fprintf (FILE, "%I0r-99e999"); \ 222 else \ 223 asm_fprintf (FILE, "%I0r99e999"); \ 224 } \ 225 else if (REAL_VALUE_MINUS_ZERO (VALUE)) \ 226 { \ 227 asm_fprintf (FILE, "%I0r-0.0"); \ 228 } \ 229 else \ 230 { char dstr[30]; \ 231 real_to_decimal (dstr, &(VALUE), sizeof (dstr), 0, 1); \ 232 asm_fprintf (FILE, "%I0r%s", dstr); \ 233 } \ 234 } while (0) 235