home *** CD-ROM | disk | FTP | other *** search
- /* Definitions of target machine for GNU compiler. atariST/TT version.
- Copyright (C) 1987, 1988 Free Software Foundation, Inc.
-
- This file is part of GNU CC.
-
- GNU CC is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- GNU CC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU CC; see the file COPYING. If not, write to
- the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
- /* The following Macros control the compilation
- *
- * CROSSATARI defined when making cross compiler for TOS or Minix
- * MINIX defined when making cross compiler for MINIX only
- * atariminix defined when making compiler for MINIX
- * atarist defined when making compiler for TOS
- */
-
- #include "m68k/m68k.h"
-
- #if defined(__GNUC__)
- # if defined(alloca)
- # undef alloca
- # endif
- # define alloca(x) __builtin_alloca(x)
- #endif
-
- #if defined(sparc)
- # if !defined(alloca)
- # include <alloca.h>
- # endif
- #endif
-
- /* See m68k.h. 0 means 68000 with no 68881. */
-
- #define TARGET_DEFAULT 0 /* use this for a regular ST */
- /* #define TARGET_DEFAULT 2 use this for a ST with 68881/82 */
- /* #define TARGET_DEFAULT 5 use this for a TT withOUT 68881/82 */
- /* #define TARGET_DEFAULT 7 use this for a TT with 68881/82 */
- /* #define TARGET_DEFAULT 0407 use this for a Falcon */
- /* may be vaporware but we are ready for it. yeah!! */
- /* USE this for a 68040, when -m68040 is specified. In this
- mode, the 881/2 instructions not on the 040 are not produced
- see TARGET_68040 in m68k.h
- (also note the difference vs TARGET_68040_ONLY) */
-
- /* #define TARGET_DEFAULT 01000 use this for 68040_ONLY, dont know what
- this is useful for */
-
-
- /* These compiler options take an argument. We ignore -target for now. */
-
- #define WORD_SWITCH_TAKES_ARG(STR) \
- (!strcmp (STR, "Tdata") || !strcmp (STR, "include") \
- || !strcmp (STR, "imacros") || !strcmp (STR, "target") \
- || !strcmp (STR, "assert"))
-
- /* -m68040 requires special flags to the assembler. */
- /* -m68000 requires special flags to the assembler. */
-
- /* -m68000 (on atari) need this flag to assembler, otherwise pc relative
- code is produced where it should not be (in places where the
- 68000 only allows data ALTERABLE addressing modes) (++jrb 03/19/89) */
-
- #if (TARGET_DEFAULT & 01000)
- /* note atleast gas-1.38 Patchlevel 2 required for mc68040 specific
- support in the assembler.
- */
- #define ASM_SPEC \
- "%{m68000:-mc68000} %{mc68000:-mc68000} "\
- "%{!mc68000:%{!m68000:%{!m68020*:%{!mc68020:%{!m68030:%{!mc68030:-mc68040}}}}}}"
- #else
- /* falcon/TT */
- #if (TARGET_DEFAULT & 5) /* note this is true for TARGET_DEFAULT == 0407 too */
- /* for the TT etc (020/030) also appropriate for m68040 (falcon)
- ie: -m68020-40 (and not -m68040). Note that the
- assembler does not need any special indication of the 040
- when -m68020-40, only needs -mc68020. the only time
- the assembler needs -mc68040 is when -m68040
- */
- #define ASM_SPEC \
- "%{m68000:-mc68000} %{mc68000:-mc68000} "\
- "%{!mc68000:%{!m68000:%{m68040:-mc68040}}}"\
- "%{!mc68000:%{!m68000:%{mc68040:-mc68040}}}"
- #else
- /* for a regular 68k ST */
- #define ASM_SPEC \
- "%{m68040:-mc68040} "\
- "%{!m68040:%{!mc68020:%{!m68020*:%{!m68030:%{!mc68030:-mc68000}}}}}"
- #endif /* TT /falcon */
- #endif /* m68040 */
-
- /* Register to use for base-relative addressing. The BASE_ADDR_* macros
- are for using GNU cpp's stringification feature. */
-
- #define BASE_ADDR_REG 4 /* a4 */
- #undef PIC_OFFSET_TABLE_REGNUM
- #define PIC_OFFSET_TABLE_REGNUM (BASE_ADDR_REG+8) /* GCC register num */
- #define BASE_ADDR_STRING(X) "a" #X
- #define BASE_ADDR_NAME(X) BASE_ADDR_STRING(X)
-
- #define COMMON_CPP_SPEC \
- "%{mshort:-D__MSHORT__} %{mint:-D__MINT__} "\
- "%{mbaserel:-D__MBASE__=" BASE_ADDR_NAME (BASE_ADDR_REG)\
- " -D__MBASESTR__=\"" BASE_ADDR_NAME (BASE_ADDR_REG) "\"}"
-
- #if (TARGET_DEFAULT & 5)
- #if (TARGET_DEFAULT & 2)
- #define CPP_SPEC \
- "%{!msoft-float:-D__M68881__} "\
- "%{!m68000:%{!mc68000:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}}} "\
- COMMON_CPP_SPEC
- #else
- #define CPP_SPEC \
- "%{m68881:-D__M68881__} "\
- "%{!m68000:%{!mc68000:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}}} "\
- COMMON_CPP_SPEC
- #endif
- #else
- #if (TARGET_DEFAULT & 2)
- #define CPP_SPEC \
- "%{!msoft-float:-D__M68881__} "\
- "%{m68020*:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
- "%{mc68020:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
- "%{m68030:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
- "%{m68040:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
- COMMON_CPP_SPEC
- #else
- #define CPP_SPEC \
- "%{m68881:-D__M68881__} "\
- "%{m68020*:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
- "%{mc68020:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
- "%{m68030:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
- "%{m68040:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
- COMMON_CPP_SPEC
- #endif
- #endif
-
- /* Names to predefine in the preprocessor for this target machine. */
-
- #define CPP_PREDEFINES "-Datarist -Dgem -Dmc68000 -Acpu(m68k) -Amachine(m68k)"
-
- /* default exec dir */
- #ifndef STANDARD_EXEC_PREFIX
- # ifdef MINIX
- # define STANDARD_EXEC_PREFIX CROSSDIR "/lib/gcc-"
- # else
- # ifdef atariminix
- # define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-"
- # else
- # define STANDARD_EXEC_PREFIX CROSSDIR "/lib/gcc-"
- # endif
- # endif
- #endif
-
- #define STANDARD_STARTFILE_PREFIX ""
- #define EXECUTABLE_SUFFIX ".ttp"
-
- #define PTRDIFF_TYPE "long int"
- #define SIZE_TYPE "long unsigned int"
-
- /* We must override m68k.h. */
- #undef WCHAR_TYPE
- #undef WCHAR_TYPE_SIZE
- #define WCHAR_TYPE "short unsigned int"
- #define WCHAR_TYPE_SIZE 16
-
- #if 1
- /* Don't try using XFmode. */
- #undef LONG_DOUBLE_TYPE_SIZE
- #define LONG_DOUBLE_TYPE_SIZE 64
- #endif
-
- /* Alignment of field after `int : 0' in a structure. */
- /* recent gcc's have this as 16, this is left in for the benfit of */
- /* older gcc */
- #undef EMPTY_FIELD_BOUNDARY
- #define EMPTY_FIELD_BOUNDARY 16
-
- /* Every structure or union's size must be a multiple of 2 bytes. */
-
- #undef STRUCTURE_SIZE_BOUNDARY
- #define STRUCTURE_SIZE_BOUNDARY 16
-
-
- #define DBX_DEBUGGING_INFO 1
-
- #ifdef abort
- #undef abort
- #define abort fancy_abort
- #endif
-
- /* Allow folding division by zero. */
- #define REAL_INFINITY
-
- /* Generate calls to memcpy, memcmp and memset. */
- #define TARGET_MEM_FUNCTIONS
-
- /* The value of `EDOM' on the target machine. */
- #define TARGET_EDOM 89
-
- /* This is how to create a rtl expression that refers to the global
- "variable" `errno'. */
- #define GEN_ERRNO_RTX \
- gen_rtx (MEM, word_mode, gen_rtx (SYMBOL_REF, Pmode, "errno"))
-
- #define FUNCTION_VALUEX(MODE) \
- gen_rtx (REG, (MODE), \
- ((TARGET_68881 \
- && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode)) \
- ? 16 : 0))
-
- #undef FUNCTION_VALUE
- #define FUNCTION_VALUE(VALTYPE,FUNC) FUNCTION_VALUEX (TYPE_MODE (VALTYPE))
- #undef LIBCALL_VALUE
- #define LIBCALL_VALUE(MODE) FUNCTION_VALUEX (MODE)
-
- /* 1 if N is a possible register number for a function value. */
-
- #undef FUNCTION_VALUE_REGNO_P
- #define FUNCTION_VALUE_REGNO_P(N) (((N) == 0) || (TARGET_68881 && ((N) == 16)))
-
- /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
- more than one register. */
-
- #undef NEEDS_UNTYPED_CALL
- #define NEEDS_UNTYPED_CALL (TARGET_68881)
-
- /* This is how to output an assembler line defining a `double' constant. */
-
- #undef ASM_OUTPUT_DOUBLE
- #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "\t.double 0r-Inf\n"); \
- else \
- fprintf (FILE, "\t.double 0rInf\n"); \
- } \
- else if (REAL_VALUE_ISNAN (VALUE)) \
- { long l[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
- fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", l[0], l[1]); \
- } \
- else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- fprintf (FILE, "\t.double 0r-0.0\n"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.17g", dstr); \
- fprintf (FILE, "\t.double 0r%s\n", dstr); \
- } \
- }
-
- /* This is how to output an assembler line defining a `float' constant. */
-
- #undef ASM_OUTPUT_FLOAT
- #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "\t.single 0r-Inf\n"); \
- else \
- fprintf (FILE, "\t.single 0rInf\n"); \
- } \
- else if (REAL_VALUE_ISNAN (VALUE)) \
- { long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- fprintf (FILE, "\t.long 0x%lx\n", l); \
- } \
- else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- fprintf (FILE, "\t.single 0r-0.0\n"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr); \
- fprintf (FILE, "\t.single 0r%s\n", dstr); \
- } \
- }
-
- /* This is how to output an assembler lines defining floating operands. */
-
- #undef ASM_OUTPUT_FLOAT_OPERAND
- #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
- do { \
- if (CODE != 'f' || REAL_VALUE_ISNAN (VALUE)) \
- { \
- long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- asm_fprintf (FILE, "%I"); \
- fprintf (FILE, "0x%lx", l); \
- } \
- else if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- asm_fprintf (FILE, "%I0r-Inf"); \
- else \
- asm_fprintf (FILE, "%I0rInf"); \
- } \
- else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- asm_fprintf (FILE, "%I0r-0.0"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr); \
- asm_fprintf (FILE, "%I0r%s", dstr); \
- } \
- } while (0)
-
- #undef ASM_OUTPUT_DOUBLE_OPERAND
- #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
- do { if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- asm_fprintf (FILE, "%I0r-Inf"); \
- else \
- asm_fprintf (FILE, "%I0rInf"); \
- } \
- else if (REAL_VALUE_ISNAN (VALUE)) \
- { \
- long l[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
- asm_fprintf (FILE, "%I"); \
- fprintf (FILE, "0x%lx%08lx", l[0], l[1]); \
- } \
- else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- asm_fprintf (FILE, "%I0r-0.0"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.17g", dstr); \
- asm_fprintf (FILE, "%I0r%s", dstr); \
- } \
- } while (0)
-
- #ifndef ASM_COMMENT_START
- #define ASM_COMMENT_START " | "
- #endif
-
- /* given that symbolic_operand(X), return TRUE if no special
- base relative relocation is necessary */
-
- #define LEGITIMATE_BASEREL_OPERAND_P(X) \
- (flag_pic == 3 && read_only_operand (X))
-
- #undef LEGITIMATE_PIC_OPERAND_P
- #define LEGITIMATE_PIC_OPERAND_P(X) \
- (! symbolic_operand (X, VOIDmode) || LEGITIMATE_BASEREL_OPERAND_P (X))
-
- /* Define this macro if references to a symbol must be treated
- differently depending on something about the variable or
- function named by the symbol (such as what section it is in).
-
- The macro definition, if any, is executed immediately after the
- rtl for DECL or other node is created.
- The value of the rtl will be a `mem' whose address is a
- `symbol_ref'.
-
- The usual thing for this macro to do is to a flag in the
- `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
- name string in the `symbol_ref' (if one bit is not enough
- information).
-
- On the Atari we use this to indicate if a symbol is in text or
- data space, as well as to distinguish functions from data. */
-
- #define ENCODE_SECTION_INFO(DECL)\
- do \
- { \
- if (TREE_CODE (DECL) == FUNCTION_DECL) \
- { \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
- SYMBOL_REF_USED (XEXP (DECL_RTL (DECL), 0)) = 1; \
- } \
- else \
- { \
- rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
- ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
- if (RTX_UNCHANGING_P (rtl) && !MEM_VOLATILE_P (rtl)) \
- SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1; \
- } \
- } \
- while (0)
-
- #if 0
- #undef SELECT_RTX_SECTION
- #define SELECT_RTX_SECTION(MODE, X) \
- { \
- if (!flag_pic || LEGITIMATE_BASEREL_OPERAND_P (X)) \
- readonly_data_section(); \
- else if (LEGITIMATE_PIC_OPERAND_P (X)) \
- readonly_data_section(); \
- else \
- data_section(); \
- }
- #else
- #undef SELECT_RTX_SECTION
- #define SELECT_RTX_SECTION(MODE, X) readonly_data_section ();
- #endif
-
- /* according to varasm.c, RELOC referrs *only* to whether constants (!)
- are addressed by address. This doesn't matter in baserelative code,
- so we allow (inspite of flag_pic) readonly_data_section() in that
- case */
-
- #undef SELECT_SECTION
- #define SELECT_SECTION(DECL, RELOC) \
- { \
- if (TREE_CODE (DECL) == STRING_CST) \
- { \
- if (! flag_writable_strings) \
- readonly_data_section (); \
- else \
- data_section (); \
- } \
- else if (TREE_CODE (DECL) == VAR_DECL) \
- { \
- if ((flag_pic && flag_pic != 3 && RELOC) \
- || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)) \
- data_section (); \
- else \
- readonly_data_section (); \
- } \
- else \
- readonly_data_section (); \
- }
-
- #define ASM_OUTPUT_EXTERNAL_LIBCALL(asm_out_file,fun)
-
- /* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
- #undef PCC_STATIC_STRUCT_RETURN
- #define DEFAULT_PCC_STRUCT_RETURN 0
-
- /* specs for start file and link specs */
-
- #ifndef CROSSATARI
-
- #ifdef atariminix
- #define STARTFILE_SPEC \
- "%{pg:/usr/local/lib/gcrtso.o%s}\
- %{!pg:\
- %{p:/usr/local/lib/mcrtso.o%s}\
- %{!p:/usr/local/lib/crtso.o%s}}"
- #else /* atarist */
- #define STARTFILE_SPEC \
- "$GNULIB$\\%{mbaserel:b}%{mint:m}%{pg:g}%{p:m}crt0.o%s"
- #endif
-
- #else /* CROSSATARI */
-
- #ifdef MINIX
- #define STARTFILE_SPEC \
- "%{pg:" CROSSDIR "/lib/gcrtso.o%s}\
- %{!pg:\
- %{p:" CROSSDIR "/lib/mcrtso.o%s}\
- %{!p:" CROSSDIR "/lib/crtso.o%s}}"
- #else
- #define STARTFILE_SPEC \
- CROSSDIR "/lib/%{mbaserel:b}%{mint:m}%{pg:g}%{p:m}crt0.o%s"
- #endif
- #endif /* CROSSATARI */
-
- /* NOTE: for ataris we dont need to do anything special for -a or -tcov
- as bb_* routines will automatically be pulled in from the libraries
- as required when they are referenced by the generated code.
- */
-
- #ifdef MINIX
- #define LIB_SPEC \
- "%{mshort:" CROSSDIR "/lib/libc.a}\
- %{!mshort:" CROSSDIR "/lib/libc32.a}"
- #else
- #ifdef atariminix
- #define LIB_SPEC \
- "%{mshort:/usr/local/lib/libc.a}\
- %{!mshort:/usr/local/lib/libc32.a}"
- #else /* atarist cross or native */
-
- #ifndef __GPLUSPLUS__
- #define LIB_SPEC \
- "%{mint:-l%{mbaserel:b}mint%{gg:g}%{mshort:16}}\
- -l%{mbaserel:b}gnu%{gg:g}%{mshort:16}"
- #else /* atariSt g++ */
- #define LIB_SPEC \
- "%{mint:-l%{mbaserel:b}mint%{gg:g}%{mshort:16}}\
- -l%{mbaserel:b}g++%{gg:g}%{mshort:16}\
- -l%{mbaserel:b}gnu%{gg:g}%{mshort:16}"
- #endif
-
- #endif
- #endif
-
- /* Tell linker to make sharable text executable */
-
- #define LINK_SPEC "%{mbaserel:-n}"
-
- /* add -mint : meanining
- pre-procees with -D__MINT__
- compile with -mint (target_flags & 010000) (this flag is
- currently not used by cc1, but maybe later)
- link with mcrt0.o and -lmint -lgnu
-
- */
-
- #undef SUBTARGET_SWITCHES
- #define SUBTARGET_SWITCHES \
- { "int", 010000}, \
- { "noint", -010000},
-
- /* these two should never be used, #define them here so they are'nt
- in cccp.c
- */
- #define STANDARD_INCLUDE_DIR 8086_sucks
- #define LOCAL_INCLUDE_DIR 80486_sucks
-
- /* all the INCLUDE_DEFAULTS */
- #ifdef CROSSATARI /* TOS or MINIX cross compiler */
- #ifndef SYSTEM_INCLUDE_DIR
- # define SYSTEM_INCLUDE_DIR CROSSINC
- #endif
- #ifndef SYSTEM_GPLUSPLUS_INCLUDE_DIR
- # define SYSTEM_GPLUSPLUS_INCLUDE_DIR GPLUSPLUS_INCLUDE_DIR
- #endif
- #endif
-
- #ifdef atarist /* TOS native compiler */
- #ifndef SYSTEM_INCLUDE_DIR
- # define SYSTEM_INCLUDE_DIR "\\gnu\\lib"
- #endif
- #ifndef SYSTEM_GPLUSPLUS_INCLUDE_DIR
- # define SYSTEM_GPLUSPLUS_INCLUDE_DIR "\\gnu\\g++-inc"
- #endif
- #endif
-
- #ifdef atariminix /* MINIX native compiler */
- #ifndef SYSTEM_INCLUDE_DIR
- # define SYSTEM_INCLUDE_DIR "/usr/local/gcc-include"
- #endif
- #ifndef SYSTEM_GPLUSPLUS_INCLUDE_DIR
- # define SYSTEM_GPLUSPLUS_INCLUDE_DIR "/usr/local/g++-inc"
- #endif
- #endif
-
- #define INCLUDE_DEFAULTS \
- { \
- { SYSTEM_INCLUDE_DIR, 0 }, \
- { SYSTEM_GPLUSPLUS_INCLUDE_DIR, 1 }, \
- { 0, 0 } \
- }
-
- #ifdef atarist
- #define FILE_NAME_NONDIRECTORY(X) \
- atari_filename_nondirectory(X);
- extern char *atari_filename_nondirectory();
-
- #undef PATH_SEPARATOR
- #define PATH_SEPARATOR ','
- #define PATH_SEP_STR ","
- #else
- #define PATH_SEP_STR ":"
- #endif
-