home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / config / m68k / sun3.h < prev    next >
C/C++ Source or Header  |  1995-06-15  |  10KB  |  297 lines

  1. /* Definitions of target machine for GNU compiler.  Sun 68000/68020 version.
  2.    Copyright (C) 1987, 1988, 1993, 1995 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, 59 Temple Place - Suite 330,
  19. Boston, MA 02111-1307, USA.  */
  20.  
  21. /* This comment is here to see if it will keep Sun's cpp from dying.  */
  22.  
  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.  */
  26.  
  27. #define SUPPORT_SUN_FPA
  28.  
  29. #include "m68k/m68k.h"
  30.  
  31. /* See m68k.h.  7 means 68020 with 68881.  */
  32.  
  33. #ifndef TARGET_DEFAULT
  34. #define TARGET_DEFAULT 7
  35. #endif
  36.  
  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.  */
  41.  
  42. #if TARGET_DEFAULT & 02
  43.  
  44. /* -m68881 is the default */
  45. #define CPP_SPEC \
  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}}}"
  49.  
  50. #else
  51.  
  52. /* -msoft-float is the default */
  53. #define CPP_SPEC \
  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}}}"
  57.  
  58. #endif
  59.  
  60. /* Prevent error on `-sun3' and `-target sun3' options.  */
  61.  
  62. #define CC1_SPEC "%{sun3:} %{target:}"
  63.  
  64. #define PTRDIFF_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} %{R} %{j} %{J} %{h} %{d2} %{keep-local-as-symbols:-L}"
  83.  
  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.  */
  90.  
  91. #define CPP_PREDEFINES "-Dmc68000 -Dsun -Dunix -Asystem(unix)  -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
  92.  
  93. /* STARTFILE_SPEC to include sun floating point initialization
  94.    This is necessary (tr: Sun does it) for both the m68881 and the fpa
  95.    routines.
  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) */
  100.  
  101. #if TARGET_DEFAULT & 0100
  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}}"
  108. #else
  109. #if TARGET_DEFAULT & 2
  110. /* -m68881 is the default */
  111. #define STARTFILE_SPEC                    \
  112.   "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}    \
  113.    %{mfpa:Wcrt1.o%s}                    \
  114.    %{msoft-float:Fcrt1.o%s}                \
  115.    %{!mfpa:%{!msoft-float:Mcrt1.o%s}}"
  116. #else
  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}                    \
  121.    %{mfpa:Wcrt1.o%s}                    \
  122.    %{!m68881:%{!mfpa:Fcrt1.o%s}}"
  123. #endif
  124. #endif
  125.  
  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.  */
  129.  
  130. #if TARGET_DEFAULT & 0100
  131. /* -mfpa is the default */
  132. #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
  133. %{a:/usr/lib/bb_link.o} %{g:-lg} \
  134. %{msoft-float:-L/usr/lib/fsoft}%{m68881:-L/usr/lib/f68881}\
  135. %{!msoft_float:%{!m68881:-L/usr/lib/ffpa}}"
  136. #else
  137. #if TARGET_DEFAULT & 2
  138. /* -m68881 is the default */
  139. #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
  140. %{a:/usr/lib/bb_link.o} %{g:-lg} \
  141. %{msoft-float:-L/usr/lib/fsoft}%{!msoft-float:%{!mfpa:-L/usr/lib/f68881}}\
  142. %{mfpa:-L/usr/lib/ffpa}"
  143. #else
  144. /* -msoft-float is the default */
  145. #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
  146. %{a:/usr/lib/bb_link.o} %{g:-lg} \
  147. %{!m68881:%{!mfpa:-L/usr/lib/fsoft}}%{m68881:-L/usr/lib/f68881}\
  148. %{mfpa:-L/usr/lib/ffpa}"
  149. #endif
  150. #endif
  151.  
  152. /* Provide required defaults for linker -e and -d switches.  */
  153.  
  154. #define LINK_SPEC \
  155.  "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
  156.  
  157. /* Every structure or union's size must be a multiple of 2 bytes.  */
  158.  
  159. #define STRUCTURE_SIZE_BOUNDARY 16
  160.  
  161. /* This is BSD, so it wants DBX format.  */
  162.  
  163. #define DBX_DEBUGGING_INFO
  164.  
  165. /* Allow folding division by zero.  */
  166. #define REAL_INFINITY
  167.  
  168. /* Generate calls to memcpy, memcmp and memset.  */
  169. #define TARGET_MEM_FUNCTIONS
  170.  
  171. /* This is not a good idea.  It prevents interoperation between
  172.    files compiled with -m68881 and those compiled with -msoft-float.  */
  173. #if 0
  174. #define FUNCTION_VALUEX(MODE)                            \
  175.   gen_rtx (REG, (MODE),                                \
  176.        ((TARGET_68881                            \
  177.          && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode)) \
  178.         ? 16 : 0))
  179.  
  180. #undef FUNCTION_VALUE
  181. #define FUNCTION_VALUE(VALTYPE,FUNC) FUNCTION_VALUEX (TYPE_MODE (VALTYPE))
  182. #endif /* 0 */
  183.  
  184. /* This is how to output an assembler line defining a `double' constant.  */
  185.  
  186. #undef ASM_OUTPUT_DOUBLE
  187. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                \
  188.   {                                \
  189.     if (REAL_VALUE_ISINF (VALUE))                \
  190.       {                                \
  191.         if (REAL_VALUE_NEGATIVE (VALUE))            \
  192.           fprintf (FILE, "\t.double 0r-99e999\n");        \
  193.         else                            \
  194.           fprintf (FILE, "\t.double 0r99e999\n");        \
  195.       }                                \
  196.     else if (REAL_VALUE_ISNAN (VALUE))                \
  197.       { long l[2];                        \
  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]); \
  200.       }                                \
  201.     else                            \
  202.       { char dstr[30];                        \
  203.         REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr);        \
  204.         fprintf (FILE, "\t.double 0r%s\n", dstr);        \
  205.       }                                \
  206.     }
  207.  
  208. /* This is how to output an assembler line defining a `float' constant.  */
  209.  
  210. #undef ASM_OUTPUT_FLOAT
  211. #define ASM_OUTPUT_FLOAT(FILE,VALUE)                \
  212.   {                                \
  213.     if (REAL_VALUE_ISINF (VALUE))                \
  214.       {                                \
  215.         if (REAL_VALUE_NEGATIVE (VALUE))            \
  216.           fprintf (FILE, "\t.single 0r-99e999\n");        \
  217.         else                            \
  218.           fprintf (FILE, "\t.single 0r99e999\n");            \
  219.       }                                \
  220.     else if (REAL_VALUE_ISNAN (VALUE))                \
  221.       { long l;                            \
  222.         REAL_VALUE_TO_TARGET_SINGLE ((VALUE), l);        \
  223.         fprintf (FILE, "\t.long 0x%lx\n", l);            \
  224.       }                                \
  225.     else                            \
  226.       { char dstr[30];                        \
  227.         REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr);        \
  228.         fprintf (FILE, "\t.single 0r%s\n", dstr);        \
  229.       }                                \
  230.     }
  231.  
  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.  */
  234.   
  235. #undef ASM_OUTPUT_FLOAT_OPERAND
  236. #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE)        \
  237.  do {                                 \
  238.       if (CODE != 'f')                        \
  239.         {                            \
  240.           long l;                        \
  241.           REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);        \
  242.           if (sizeof (int) == sizeof (long))            \
  243.             asm_fprintf ((FILE), "%I0x%x", l);            \
  244.           else                            \
  245.             asm_fprintf ((FILE), "%I0x%lx", l);            \
  246.         }                            \
  247.       else if (REAL_VALUE_ISINF (VALUE))            \
  248.         {                            \
  249.           if (REAL_VALUE_NEGATIVE (VALUE))            \
  250.             asm_fprintf (FILE, "%I0r-99e999");            \
  251.           else                            \
  252.             asm_fprintf (FILE, "%I0r99e999");            \
  253.         }                            \
  254.       else if (REAL_VALUE_MINUS_ZERO (VALUE))            \
  255.         {                            \
  256.           asm_fprintf (FILE, "%I0r-0.0");            \
  257.         }                            \
  258.       else                            \
  259.         { char dstr[30];                    \
  260.           REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr);    \
  261.           asm_fprintf (FILE, "%I0r%s", dstr);            \
  262.         }                            \
  263.     } while (0)
  264.  
  265. #undef ASM_OUTPUT_DOUBLE_OPERAND
  266. #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                \
  267.  do { if (REAL_VALUE_ISINF (VALUE))                    \
  268.         {                                \
  269.           if (REAL_VALUE_NEGATIVE (VALUE))                \
  270.             asm_fprintf (FILE, "%I0r-99e999");                \
  271.           else                                \
  272.             asm_fprintf (FILE, "%I0r99e999");                \
  273.         }                                \
  274.       else if (REAL_VALUE_MINUS_ZERO (VALUE))                \
  275.         {                                \
  276.           asm_fprintf (FILE, "%I0r-0.0");                \
  277.         }                                \
  278.       else                                \
  279.         { char dstr[30];                        \
  280.           REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr);        \
  281.           asm_fprintf (FILE, "%I0r%s", dstr);                \
  282.         }                                \
  283.     } while (0)
  284.  
  285. #undef BLOCK_PROFILER_CODE
  286. #define BLOCK_PROFILER_CODE                        \
  287. extern int ___tcov_init;                        \
  288.                                     \
  289. __bb_init_func (blocks)                            \
  290.     struct bb *blocks;                        \
  291. {                                    \
  292.   if (! ___tcov_init)                            \
  293.     ___tcov_init_func ();                        \
  294.                                     \
  295.   ___bb_link (blocks->filename, blocks->counts, blocks->ncounts);    \
  296. }
  297.