home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / gcc-2.3.3-src.lha / GNU / src / amiga / gcc-2.3.3 / config / amigados.h < prev    next >
C/C++ Source or Header  |  1994-07-09  |  13KB  |  389 lines

  1. /* Definitions of target machine for GNU compiler.  amiga 68000/68020 version.
  2.    Copyright (C) 1992 Free Software Foundation, Inc.
  3.    Contributed by Markus M. Wild (wild@amiga.physik.unizh.ch).
  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, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. #include "m68k.h"
  22.  
  23. /* See m68k.h for bits in TARGET_DEFAULT.
  24.    0 means 68000, no hardware fpu (68881/68882/68040).
  25.    7 means 68020 (or higher) with hardware fpu.  */
  26.  
  27. #ifndef TARGET_DEFAULT
  28. #define TARGET_DEFAULT 0
  29. #endif
  30.  
  31. /* Define __HAVE_68881__ in preprocessor according to the -m flags.
  32.    This will control the use of inline 68881 insns in certain macros.
  33.    Also inform the program which CPU this is for.  */
  34.  
  35. #if TARGET_DEFAULT & 02
  36.  
  37. /* -m68881 is the default */
  38. #define CPP_SPEC \
  39. "%{!msoft-float:-D__HAVE_68881__ }\
  40. %{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
  41.  
  42. #else
  43.  
  44. /* -msoft-float is the default, assume -mc68000 as well */
  45. #define CPP_SPEC \
  46. "%{m68881:-D__HAVE_68881__ }\
  47. %{!ansi:%{m68020:-Dmc68020}%{mc68020:-Dmc68020}%{!mc68020:%{!m68020:-Dmc68010}}}"
  48.  
  49. #endif
  50.  
  51. /* -m68000 requires special flags to the assembler.  */
  52.  
  53. #if TARGET_DEFAULT & 01
  54.  
  55. #define ASM_SPEC \
  56.  "%{m68000:-mc68010}%{mc68000:-mc68010}%{!mc68000:%{!m68000:-mc68020}} %{msmall-code:-l} "
  57.  
  58. #else
  59.  
  60. #define ASM_SPEC \
  61.  "%{m68020:-mc68020}%{mc68020:-mc68020}%{!mc68020:%{!m68020:-mc68010}} %{msmall-code:-l} "
  62.  
  63. #endif
  64.  
  65. /* amiga/amigados are the new "standard" defines for the Amiga, MCH_AMIGA
  66.  * was used before and is included for compatibility reasons */
  67.  
  68. #define CPP_PREDEFINES "-Dmc68000 -Damiga -Damigados -DMCH_AMIGA -DAMIGA"
  69.  
  70. /* Choose the right startup file, depending on whether we use base relative
  71.    code, base relative code with automatic relocation (-resident), or plain
  72.    crt0.o. 
  73.   
  74.    Profiling is currently only available for plain startup.
  75.    mcrt0.o does not (yet) exist. */
  76.  
  77. #define STARTFILE_SPEC \
  78.   "%{resident:rcrt0.o%s}%{!resident:%{!fbaserel:%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}%{fbaserel:%{pg:bgcrt0.o%s}%{!pg:%{p:bmcrt0.o%s}%{!p:bcrt0.o%s}}}}"
  79.  
  80.  
  81. /* Automatically search libamiga.a for AmigaDOS specific functions.  Note
  82.    that we first search the standard C library to resolve as much as
  83.    possible from there, since it has names that are duplicated in libamiga.a
  84.    which we *don't* want from there.  Then search the standard C library
  85.    again to resolve any references that libamiga.a might have generated.
  86.    This may only be a temporary solution since it might be better to simply
  87.    remove the things from libamiga.a that should be pulled in from libc.a
  88.    instead, which would eliminate the first reference to libc.a. */
  89.  
  90. #define LIB_SPEC "%{!p:%{!pg:-lc -lamiga -lc}}%{p:-lc_p -lamiga -lc_p}%{pg:-lc_p -lamiga -lc_p}"
  91.  
  92. /* if debugging, tell the linker to output amiga-hunk symbols *and* a BSD
  93.    compatible debug hunk (which will probably change in the future, it's not
  94.    tremendously useful in its current state). */
  95.  
  96. #define LINK_SPEC "%{g:-amiga-debug-hunk} %{fbaserel:-databss-together} %{resident:-databss-together -datadata-reloc -flavor libb} "
  97.  
  98. #define CC1_SPEC "%{resident:-fbaserel} "
  99.  
  100. #define CC1PLUS_SPEC "%{resident:-fbaserel} "
  101.  
  102. /* Omit frame pointer at high optimization levels. (This doesn't hurt, since
  103.    GDB doesn't work under AmigaDOS at the moment anyway..) */
  104.   
  105. #define OPTIMIZATION_OPTIONS(OPTIMIZE) \
  106. {                                  \
  107.   if (OPTIMIZE >= 2)                         \
  108.     flag_omit_frame_pointer = 1;                \
  109. }
  110.  
  111. /* provide a dummy entry for the small-code switch. This is currently only
  112.    needed by the assembler (explanations: m68k.h), but will be used by cc1
  113.    to output 16bit pc-relative code later. */
  114.  
  115. #undef TARGET_SWITCHES
  116. #define TARGET_SWITCHES  \
  117.   { { "68020", 5},                \
  118.     { "c68020", 5},                \
  119.     { "68881", 2},                \
  120.     { "bitfield", 4},                \
  121.     { "68000", -5},                \
  122.     { "c68000", -5},                \
  123.     { "soft-float", -0102},            \
  124.     { "nobitfield", -4},            \
  125.     { "rtd", 8},                \
  126.     { "nortd", -8},                \
  127.     { "short", 040},                \
  128.     { "noshort", -040},                \
  129.     { "fpa", 0100},                \
  130.     { "nofpa", -0100},                \
  131.     { "sky", 0200},                \
  132.     { "nosky", -0200},                \
  133.     { "68040", 0407},                \
  134.     { "68030", -01400},                \
  135.     { "68030", 7},                \
  136.     { "68040-only", 01000},            \
  137.     { "small-code", 0 },            \
  138.     { "", TARGET_DEFAULT}}
  139.  
  140. /* Every structure or union's size must be a multiple of 2 bytes.  */
  141.  
  142. #define STRUCTURE_SIZE_BOUNDARY 16
  143.  
  144. /* This is (almost;-)) BSD, so it wants DBX format.  */
  145.  
  146. #define DBX_DEBUGGING_INFO
  147.  
  148. /* Allow folding division by zero.  */
  149. #define REAL_INFINITY
  150.  
  151. /* This is how to output an assembler line defining a `double' constant.  */
  152.  
  153. #undef ASM_OUTPUT_DOUBLE
  154. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                    \
  155.   {                                    \
  156.     if (REAL_VALUE_ISINF (VALUE))                    \
  157.       fprintf (FILE, "\t.double 0r%s99e999\n", (VALUE) > 0 ? "" : "-");    \
  158.     else if (isnan (VALUE))                        \
  159.       {                                    \
  160.     union { double d; long l[2];} t;                \
  161.     t.d = (VALUE);                            \
  162.     fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", t.l[0], t.l[1]); \
  163.       }                                    \
  164.     else                                \
  165.       fprintf (FILE, "\t.double 0r%.17g\n", VALUE);            \
  166.   }
  167.  
  168. /* This is how to output an assembler line defining a `float' constant.  */
  169.  
  170. #undef ASM_OUTPUT_FLOAT
  171. #define ASM_OUTPUT_FLOAT(FILE,VALUE)                    \
  172.   {                                    \
  173.     if (REAL_VALUE_ISINF (VALUE))                    \
  174.       fprintf (FILE, "\t.single 0r%s99e999\n", (VALUE) > 0 ? "" : "-");    \
  175.     else if (isnan (VALUE))                        \
  176.       {                                    \
  177.     union { float f; long l;} t;                    \
  178.     t.f = (VALUE);                            \
  179.     fprintf (FILE, "\t.long 0x%lx\n", t.l);                \
  180.       }                                    \
  181.     else                                \
  182.       fprintf (FILE, "\t.single 0r%.9g\n", VALUE);            \
  183.   }
  184.  
  185. /* This is how to output an assembler lines defining floating operands.
  186.    There's no way to output a NaN's fraction, so we lose it.  */
  187.   
  188. #undef ASM_OUTPUT_FLOAT_OPERAND
  189. #define ASM_OUTPUT_FLOAT_OPERAND(FILE,VALUE)                \
  190.   (REAL_VALUE_ISINF ((VALUE))                        \
  191.    ? asm_fprintf (FILE, "%I0r%s99e999", ((VALUE) > 0 ? "" : "-")) \
  192.    : (VALUE) == -0.0                            \
  193.    ? asm_fprintf (FILE, "%I0r-0.0")                    \
  194.    : asm_fprintf (FILE, "%I0r%.9g", (VALUE)))
  195.  
  196. #undef ASM_OUTPUT_DOUBLE_OPERAND
  197. #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                \
  198.   (REAL_VALUE_ISINF ((VALUE))                        \
  199.    ? asm_fprintf (FILE, "%I0r%s99e999", ((VALUE) > 0 ? "" : "-")) \
  200.    : (VALUE) == -0.0                            \
  201.    ? asm_fprintf (FILE, "%I0r-0.0")                    \
  202.    : asm_fprintf (FILE, "%I0r%.17g", (VALUE)))
  203.  
  204.  
  205. /* use A5 as framepointer instead of A6, this makes A6 available as a
  206.    general purpose register, and can thus be used without problems in
  207.    direct library calls. */
  208.  
  209. #undef FRAME_POINTER_REGNUM
  210. #define FRAME_POINTER_REGNUM 13
  211. #undef ARG_POINTER_REGNUM
  212. #define ARG_POINTER_REGNUM 13
  213.  
  214. /* we use A4 for this, not A5, which is the framepointer */
  215. #undef PIC_OFFSET_TABLE_REGNUM
  216. #define PIC_OFFSET_TABLE_REGNUM 12
  217.  
  218. /* setup a default shell return value for those (gazillion..) programs that
  219.    (inspite of ANSI-C) declare main() to be void (or even VOID...) and thus
  220.    cause the shell to randomly caugh upon executing such programs (contrary
  221.    to Unix, AmigaDOS scripts are terminated with an error if a program returns
  222.    with an error code above the `error' or even `failure' level
  223.    (which is configurable with the FAILAT command) */
  224.  
  225. #define DEFAULT_MAIN_RETURN c_expand_return (integer_zero_node)
  226.  
  227. /* we do have an ansi-compliant c-library ;-) */
  228. #define HAVE_VPRINTF
  229. #define HAVE_VFPRINTF
  230. #define HAVE_PUTENV
  231. #define HAVE_STRERROR
  232. #define HAVE_ATEXIT
  233.  
  234. /* given that symbolic_operand(X), return TRUE if no special
  235.    base relative relocation is necessary */
  236.  
  237. #define LEGITIMATE_BASEREL_OPERAND_P(X) \
  238.