home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gcc-2.4.5 / config / m68k / sun3.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-25  |  9.0 KB  |  279 lines

  1. /* Definitions of target machine for GNU compiler.  Sun 68000/68020 version.
  2.    Copyright (C) 1987, 1988, 1993 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  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)
  9. any later version.
  10.  
  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.
  15.  
  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, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* This comment is here to see if it will keep Sun's cpp from dying.  */
  21.  
  22. /* If you do not need to generate floating point code for the optional
  23.    Sun FPA board, you can safely comment out the SUPPORT_SUN_FPA define
  24.    to gain a little speed and code size.  */
  25.  
  26. #define SUPPORT_SUN_FPA
  27.  
  28. #include "m68k/m68k.h"
  29.  
  30. /* See m68k.h.  7 means 68020 with 68881.  */
  31.  
  32. #ifndef TARGET_DEFAULT
  33. #define TARGET_DEFAULT 7
  34. #endif
  35.  
  36. /* Define __HAVE_FPA__ or __HAVE_68881__ in preprocessor,
  37.    according to the -m flags.
  38.    This will control the use of inline 68881 insns in certain macros.
  39.    Also inform the program which CPU this is for.  */
  40.  
  41. #if TARGET_DEFAULT & 02
  42.  
  43. /* -m68881 is the default */
  44. #define CPP_SPEC \
  45. "%{!msoft-float:%{mfpa:-D__HAVE_FPA__ }%{!mfpa:-D__HAVE_68881__ }}\
  46. %{m68000:-D__mc68010__}%{mc68000:-D__mc68010__}%{!mc68000:%{!m68000:-D__mc68020__}} \
  47. %{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
  48.  
  49. #else
  50.  
  51. /* -msoft-float is the default */
  52. #define CPP_SPEC \
  53. "%{m68881:-D__HAVE_68881__ }%{mfpa:-D__HAVE_FPA__ }\
  54. %{m68000:-D__mc68010__}%{mc68000:-D__mc68010__}%{!mc68000:%{!m68000:-D__mc68020__}} \
  55. %{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
  56.  
  57. #endif
  58.  
  59. /* Prevent error on `-sun3' and `-target sun3' options.  */
  60.  
  61. #define CC1_SPEC "%{sun3:} %{target:}"
  62.  
  63. #define PTRDIFF_TYPE "int"
  64. #define SIZE_TYPE "int"
  65.  
  66. /* We must override m68k.h.  */
  67. #undef WCHAR_TYPE
  68. #undef WCHAR_TYPE_SIZE
  69. #define WCHAR_TYPE "short unsigned int"
  70. #define WCHAR_TYPE_SIZE 16
  71.  
  72. /* These compiler options take an argument.  We ignore -target for now.  */
  73.  
  74. #define WORD_SWITCH_TAKES_ARG(STR)                \
  75.  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                \
  76.   || !strcmp (STR, "target") || !strcmp (STR, "assert"))
  77.  
  78. /* -m68000 requires special flags to the assembler.  */
  79.  
  80. #define ASM_SPEC \
  81.  "%{m68000:-mc68010}%{mc68000:-mc68010}%{!mc68000:%{!m68000:-mc68020}} \
  82.   %{fpic:-k} %{fPIC:-k}"
  83.  
  84. /* Names to predefine in the preprocessor for this target machine.  */
  85.  
  86. #define CPP_PREDEFINES "-Dmc68000 -Dsun -Dunix"
  87.  
  88. /* STARTFILE_SPEC to include sun floating point initialization
  89.    This is necessary (tr: Sun does it) for both the m68881 and the fpa
  90.    routines.
  91.    Note that includes knowledge of the default specs for gcc, ie. no
  92.    args translates to the same effect as -m68881
  93.    I'm not sure what would happen below if people gave contradictory
  94.    arguments (eg. -msoft-float -mfpa) */
  95.  
  96. #if TARGET_DEFAULT & 0100
  97. /* -mfpa is the default */
  98. #define STARTFILE_SPEC                    \
  99.   "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}    \
  100.    %{m68881:Mcrt1.o%s}                    \
  101.    %{msoft-float:Fcrt1.o%s}                \
  102.    %{!m68881:%{!msoft-float:Wcrt1.o%s}}"
  103. #else
  104. #if TARGET_DEFAULT & 2
  105. /* -m68881 is the default */
  106. #define STARTFILE_SPEC                    \
  107.   "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}    \
  108.    %{mfpa:Wcrt1.o%s}                    \
  109.    %{msoft-float:Fcrt1.o%s}                \
  110.    %{!mfpa:%{!msoft-float:Mcrt1.o%s}}"
  111. #else
  112. /* -msoft-float is the default */
  113. #define STARTFILE_SPEC                    \
  114.   "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}    \
  115.    %{m68881:Mcrt1.o%s}                    \
  116.    %{mfpa:Wcrt1.o%s}                    \
  117.    %{!m68881:%{!mfpa:Fcrt1.o%s}}"
  118. #endif
  119. #endif
  120.  
  121. /* Specify library to handle `-a' basic block profiling.
  122.    Control choice of libm.a (if user says -lm)
  123.    based on fp arith default and options.  */
  124.  
  125. #if TARGET_DEFAULT & 0100
  126. /* -mfpa is the default */
  127. #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
  128. %{a:/usr/lib/bb_link.o} %{g:-lg} \
  129. %{msoft-float:-L/usr/lib/fsoft}%{m68881:-L/usr/lib/f68881}\
  130. %{!msoft_float:%{!m68881:-L/usr/lib/ffpa}}"
  131. #else
  132. #if TARGET_DEFAULT & 2
  133. /* -m68881 is the default */
  134. #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
  135. %{a:/usr/lib/bb_link.o} %{g:-lg} \
  136. %{msoft-float:-L/usr/lib/fsoft}%{!msoft-float:%{!mfpa:-L/usr/lib/f68881}}\
  137. %{mfpa:-L/usr/lib/ffpa}"
  138. #else
  139. /* -msoft-float is the default */
  140. #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
  141. %{a:/usr/lib/bb_link.o} %{g:-lg} \
  142. %{!m68881:%{!mfpa:-L/usr/lib/fsoft}}%{m68881:-L/usr/lib/f68881}\
  143. %{mfpa:-L/usr/lib/ffpa}"
  144. #endif
  145. #endif
  146.  
  147. /* Provide required defaults for linker -e and -d switches.  */
  148.  
  149. #define LINK_SPEC \
  150.  "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
  151.  
  152. /* Every structure or union's size must be a multiple of 2 bytes.  */
  153.  
  154. #define STRUCTURE_SIZE_BOUNDARY 16
  155.  
  156. /* This is BSD, so it wants DBX format.  */
  157.  
  158. #define DBX_DEBUGGING_INFO
  159.  
  160. /* Allow folding division by zero.  */
  161. #define REAL_INFINITY
  162.  
  163. /* Generate calls to memcpy, memcmp and memset.  */
  164. #define TARGET_MEM_FUNCTIONS
  165.  
  166. /* This is not a good idea.  It prevents interoperation between
  167.    files compiled with -m68881 and those compiled with -msoft-float.  */
  168. #if 0
  169. #define FUNCTION_VALUEX(MODE)                            \
  170.   gen_rtx (REG, (MODE),                                \
  171.        ((TARGET_68881                            \
  172.          && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode)) \
  173.         ? 16 : 0))
  174.  
  175. #undef FUNCTION_VALUE
  176. #define FUNCTION_VALUE(VALTYPE,FUNC) FUNCTION_VALUEX (TYPE_MODE (VALTYPE))
  177. #endif /* 0 */
  178.  
  179. /* This is how to output an assembler line defining a `double' constant.  */
  180.  
  181. #undef ASM_OUTPUT_DOUBLE
  182. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                \
  183.   {                                \
  184.     if (REAL_VALUE_ISINF (VALUE))                \
  185.       {                                \
  186.         if (REAL_VALUE_NEGATIVE (VALUE))            \
  187.           fprintf (FILE, "\t.double 0r-99e999\n");        \
  188.         else                            \
  189.           fprintf (FILE, "\t.double 0r99e999\n");        \
  190.       }                                \
  191.     else if (REAL_VALUE_ISNAN (VALUE))                \
  192.       { long l[2];                        \
  193.         REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), l);        \
  194.     fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", l[0], l[1]); \
  195.       }                                \
  196.     else                            \
  197.       { char dstr[30];                        \
  198.         REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr);        \
  199.         fprintf (FILE, "\t.double 0r%s\n", dstr);        \
  200.       }                                \
  201.     }
  202.  
  203. /* This is how to output an assembler line defining a `float' constant.  */
  204.  
  205. #undef ASM_OUTPUT_FLOAT
  206. #define ASM_OUTPUT_FLOAT(FILE,VALUE)                \
  207.   {                                \
  208.     if (REAL_VALUE_ISINF (VALUE))                \
  209.       {                                \
  210.         if (REAL_VALUE_NEGATIVE (VALUE))            \
  211.           fprintf (FILE, "\t.single 0r-99e999\n");        \
  212.         else                            \
  213.           fprintf (FILE, "\t.single 0r99e999\n");            \
  214.       }                                \
  215.     else if (REAL_VALUE_ISNAN (VALUE))                \
  216.       { long l;                            \
  217.         REAL_VALUE_TO_TARGET_SINGLE ((VALUE), l);        \
  218.         fprintf (FILE, "\t.long 0x%lx\n", l);            \
  219.       }                                \
  220.     else                            \
  221.       { char dstr[30];                        \
  222.         REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr);        \
  223.         fprintf (FILE, "\t.single 0r%s\n", dstr);        \
  224.       }                                \
  225.     }
  226.  
  227. /* This is how to output an assembler lines defining floating operands.
  228.    There's no way to output a NaN's fraction, so we lose it.  */
  229.   
  230. #undef ASM_OUTPUT_FLOAT_OPERAND
  231. #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE)        \
  232.  do {                                 \
  233.       if (CODE != 'f')                        \
  234.         {                            \
  235.           long l;                        \
  236.           REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);        \
  237.           if (sizeof (int) == sizeof (long))            \
  238.             asm_fprintf ((FILE), "%I0x%x", l);            \
  239.           else                            \
  240.             asm_fprintf ((FILE), "%I0x%lx", l);            \
  241.         }                            \
  242.       else if (REAL_VALUE_ISINF (VALUE))            \
  243.         {                            \
  244.           if (REAL_VALUE_NEGATIVE (VALUE))            \
  245.             asm_fprintf (FILE, "%I0r-99e999");            \
  246.           else                            \
  247.             asm_fprintf (FILE, "%I0r99e999");            \
  248.         }                            \
  249.       else if (REAL_VALUE_MINUS_ZERO (VALUE))            \
  250.         {                            \
  251.           asm_fprintf (FILE, "%I0r-0.0");            \
  252.         }                            \
  253.       else                            \
  254.         { char dstr[30];                    \
  255.           REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr);    \
  256.           asm_fprintf (FILE, "%I0r%s", dstr);            \
  257.         }                            \
  258.     } while (0)
  259.  
  260. #undef ASM_OUTPUT_DOUBLE_OPERAND
  261. #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                \
  262.  do { if (REAL_VALUE_ISINF (VALUE))                    \
  263.         {                                \
  264.           if (REAL_VALUE_NEGATIVE (VALUE))                \
  265.             asm_fprintf (FILE, "%I0r-99e999");                \
  266.           else                                \
  267.             asm_fprintf (FILE, "%I0r99e999");                \
  268.         }                                \
  269.       else if (REAL_VALUE_MINUS_ZERO (VALUE))                \
  270.         {                                \
  271.           asm_fprintf (FILE, "%I0r-0.0");                \
  272.         }                                \
  273.       else                                \
  274.         { char dstr[30];                        \
  275.           REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr);        \
  276.           asm_fprintf (FILE, "%I0r%s", dstr);                \
  277.         }                                \
  278.     } while (0)
  279.