1 /* Target definitions for GNU compiler for mc680x0 running NeXTSTEP
2 Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999
3 Free Software Foundation, Inc.
5 This file is part of GNU CC.
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)
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.
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. */
22 #include "m68k/m68k.h"
25 /* See m68k.h. 0407 means 68040 (or 68030 or 68020, with 68881/2). */
27 #define TARGET_DEFAULT (MASK_68040|MASK_BITFIELD|MASK_68881|MASK_68020)
29 /* Boundary (in *bits*) on which stack pointer should be aligned. */
32 #define STACK_BOUNDARY 32
34 /* Names to predefine in the preprocessor for this target machine. */
36 #define CPP_PREDEFINES "-Dmc68000 -Dm68k -DNeXT -Dunix -D__MACH__ -D__BIG_ENDIAN__ -D__ARCHITECTURE__=\"m68k\" -Asystem=unix -Asystem=mach -Acpu=m68k -Amachine=m68k -D_NEXT_SOURCE"
38 /* Every structure or union's size must be a multiple of 2 bytes.
39 (Why isn't this in m68k.h?) */
41 #define STRUCTURE_SIZE_BOUNDARY 16
42 /* This is how to output an assembler line defining a `double' constant. */
44 #undef ASM_OUTPUT_DOUBLE
45 #ifdef REAL_VALUE_TO_TARGET_DOUBLE
46 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
49 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, hex); \
50 fprintf (FILE, "\t.long 0x%x\n\t.long 0x%x\n", hex[0], hex[1]); \
53 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
54 do { if (REAL_VALUE_ISINF (VALUE)) \
56 if (REAL_VALUE_NEGATIVE (VALUE)) \
57 fprintf (FILE, "\t.double 0r-99e999\n"); \
59 fprintf (FILE, "\t.double 0r99e999\n"); \
63 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
64 fprintf (FILE, "\t.double 0r%s\n", dstr); \
69 /* This is how to output an assembler line defining a `float' constant. */
71 #undef ASM_OUTPUT_FLOAT
72 #ifdef REAL_VALUE_TO_TARGET_SINGLE
73 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
76 REAL_VALUE_TO_TARGET_SINGLE (VALUE, hex); \
77 fprintf (FILE, "\t.long 0x%x\n", hex); \
80 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
81 do { if (REAL_VALUE_ISINF (VALUE)) \
83 if (REAL_VALUE_NEGATIVE (VALUE)) \
84 fprintf (FILE, "\t.single 0r-99e999\n"); \
86 fprintf (FILE, "\t.single 0r99e999\n"); \
90 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
91 fprintf (FILE, "\t.single 0r%s\n", dstr); \
96 #undef ASM_OUTPUT_FLOAT_OPERAND
97 #ifdef REAL_VALUE_TO_TARGET_SINGLE
98 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
101 REAL_VALUE_TO_TARGET_SINGLE (VALUE, hex); \
102 fprintf (FILE, "#0%c%x", (CODE) == 'f' ? 'b' : 'x', hex); \
105 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
110 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
111 if (sizeof (int) == sizeof (long)) \
112 asm_fprintf ((FILE), "%I0x%x", l); \
114 asm_fprintf ((FILE), "%I0x%lx", l); \
116 else if (REAL_VALUE_ISINF (VALUE)) \
118 if (REAL_VALUE_NEGATIVE (VALUE)) \
119 fprintf (FILE, "#0r-99e999"); \
121 fprintf (FILE, "#0r99e999"); \
125 REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr); \
126 fprintf (FILE, "#0r%s", dstr); \
131 #undef ASM_OUTPUT_DOUBLE_OPERAND
132 #ifdef REAL_VALUE_TO_TARGET_DOUBLE
133 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
136 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, hex); \
137 fprintf (FILE, "#0b%x%08x", hex[0], hex[1]); \
140 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
141 do { if (REAL_VALUE_ISINF (VALUE)) \
143 if (REAL_VALUE_NEGATIVE (VALUE)) \
144 fprintf (FILE, "#0r-99e999"); \
146 fprintf (FILE, "#0r99e999"); \
150 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20g", dstr); \
151 fprintf (FILE, "#0r%s", dstr); \
156 /* We do not define JUMP_TABLES_IN_TEXT_SECTION, since we wish to keep
157 the text section pure. There is no point in addressing the jump
158 tables using pc relative addressing, since they are not in the text
159 section, so we undefine CASE_VECTOR_PC_RELATIVE. This also
160 causes the compiler to use absolute addresses in the jump table,
161 so we redefine CASE_VECTOR_MODE to be SImode. */
163 #undef CASE_VECTOR_MODE
164 #define CASE_VECTOR_MODE SImode
165 #undef CASE_VECTOR_PC_RELATIVE
167 /* Make sure jump tables have the same alignment as other pointers. */
169 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
170 { ASM_OUTPUT_ALIGN (FILE, 1); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
172 /* Don't treat addresses involving labels differently from symbol names.
173 Previously, references to labels generated pc-relative addressing modes
174 while references to symbol names generated absolute addressing modes. */
176 #undef GO_IF_INDEXABLE_BASE
177 #define GO_IF_INDEXABLE_BASE(X, ADDR) \
178 { if (LEGITIMATE_BASE_REG_P (X)) goto ADDR; }
180 /* This accounts for the return pc and saved fp on the m68k. */
182 #define OBJC_FORWARDING_STACK_OFFSET 8
183 #define OBJC_FORWARDING_MIN_OFFSET 8
185 /* FINALIZE_TRAMPOLINE enables executable stack. The
186 __enable_execute_stack also clears the insn cache. */
188 #undef FINALIZE_TRAMPOLINE
189 #define FINALIZE_TRAMPOLINE(TRAMP) \
190 emit_library_call(gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"), \
191 0, VOIDmode, 1, memory_address (SImode, (TRAMP)), Pmode)
193 /* A C expression used to clear the instruction cache from
194 address BEG to address END. On NeXTSTEP this i a system trap. */
196 #define CLEAR_INSN_CACHE(BEG, END) \
197 asm volatile ("trap #2")
199 /* GCC is the primary compiler for NeXTSTEP, so we don't need this. */
200 #undef PCC_STATIC_STRUCT_RETURN