OSDN Git Service

* config/a29k/xm-a29k.h, config/a29k/xm-unix.h,
[pf3gnuchains/gcc-fork.git] / gcc / config / m68k / next.h
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.
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, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22 #include "m68k/m68k.h"
23 #include "nextstep.h"
24
25 /* See m68k.h.  0407 means 68040 (or 68030 or 68020, with 68881/2).  */
26
27 #define TARGET_DEFAULT (MASK_68040|MASK_BITFIELD|MASK_68881|MASK_68020)
28
29 /* Boundary (in *bits*) on which stack pointer should be aligned.  */
30
31 #undef  STACK_BOUNDARY
32 #define STACK_BOUNDARY 32
33
34 /* Names to predefine in the preprocessor for this target machine.  */
35
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"
37
38 /* Every structure or union's size must be a multiple of 2 bytes.
39    (Why isn't this in m68k.h?)  */
40
41 #define STRUCTURE_SIZE_BOUNDARY 16
42 /* This is how to output an assembler line defining a `double' constant.  */
43
44 #undef  ASM_OUTPUT_DOUBLE
45 #ifdef REAL_VALUE_TO_TARGET_DOUBLE
46 #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                                   \
47   do {                                                                  \
48     long hex[2];                                                        \
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]);     \
51   } while (0)
52 #else
53 #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                                   \
54  do { if (REAL_VALUE_ISINF (VALUE))                                     \
55         {                                                               \
56           if (REAL_VALUE_NEGATIVE (VALUE))                              \
57             fprintf (FILE, "\t.double 0r-99e999\n");                    \
58           else                                                          \
59             fprintf (FILE, "\t.double 0r99e999\n");                     \
60         }                                                               \
61       else                                                              \
62         { char dstr[30];                                                \
63           REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr);               \
64           fprintf (FILE, "\t.double 0r%s\n", dstr);                     \
65         }                                                               \
66     } while (0)
67 #endif
68
69 /* This is how to output an assembler line defining a `float' constant.  */
70
71 #undef  ASM_OUTPUT_FLOAT
72 #ifdef REAL_VALUE_TO_TARGET_SINGLE
73 #define ASM_OUTPUT_FLOAT(FILE,VALUE)                                    \
74   do {                                                                  \
75     long hex;                                                           \
76     REAL_VALUE_TO_TARGET_SINGLE (VALUE, hex);                           \
77     fprintf (FILE, "\t.long 0x%x\n", hex);                              \
78   } while (0)
79 #else
80 #define ASM_OUTPUT_FLOAT(FILE,VALUE)                                    \
81  do { if (REAL_VALUE_ISINF (VALUE))                                     \
82         {                                                               \
83           if (REAL_VALUE_NEGATIVE (VALUE))                              \
84             fprintf (FILE, "\t.single 0r-99e999\n");                    \
85           else                                                          \
86             fprintf (FILE, "\t.single 0r99e999\n");                     \
87         }                                                               \
88       else                                                              \
89         { char dstr[30];                                                \
90           REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr);               \
91           fprintf (FILE, "\t.single 0r%s\n", dstr);                     \
92         }                                                               \
93     } while (0)
94 #endif
95
96 #undef  ASM_OUTPUT_FLOAT_OPERAND
97 #ifdef REAL_VALUE_TO_TARGET_SINGLE
98 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE)                       \
99   do {                                                                  \
100     long hex;                                                           \
101     REAL_VALUE_TO_TARGET_SINGLE (VALUE, hex);                           \
102     fprintf (FILE, "#0%c%x", (CODE) == 'f' ? 'b' : 'x', hex);           \
103   } while (0)
104 #else
105 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE)               \
106   do{                                                           \
107       if (CODE != 'f')                                          \
108         {                                                       \
109           long l;                                               \
110           REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);               \
111           if (sizeof (int) == sizeof (long))                    \
112             asm_fprintf ((FILE), "%I0x%x", l);                  \
113           else                                                  \
114             asm_fprintf ((FILE), "%I0x%lx", l);                 \
115         }                                                       \
116       else if (REAL_VALUE_ISINF (VALUE))                        \
117         {                                                       \
118           if (REAL_VALUE_NEGATIVE (VALUE))                      \
119             fprintf (FILE, "#0r-99e999");                       \
120           else                                                  \
121             fprintf (FILE, "#0r99e999");                        \
122         }                                                       \
123       else                                                      \
124         { char dstr[30];                                        \
125           REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr);        \
126           fprintf (FILE, "#0r%s", dstr);                        \
127         }                                                       \
128     } while (0)
129 #endif
130
131 #undef  ASM_OUTPUT_DOUBLE_OPERAND
132 #ifdef REAL_VALUE_TO_TARGET_DOUBLE
133 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                           \
134   do {                                                                  \
135     long hex[2];                                                        \
136     REAL_VALUE_TO_TARGET_DOUBLE (VALUE, hex);                           \
137     fprintf (FILE, "#0b%x%08x", hex[0], hex[1]);                        \
138   } while (0)
139 #else
140 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                           \
141  do { if (REAL_VALUE_ISINF (VALUE))                                     \
142         {                                                               \
143           if (REAL_VALUE_NEGATIVE (VALUE))                              \
144             fprintf (FILE, "#0r-99e999");                               \
145           else                                                          \
146             fprintf (FILE, "#0r99e999");                                \
147         }                                                               \
148       else                                                              \
149         { char dstr[30];                                                \
150           REAL_VALUE_TO_DECIMAL ((VALUE), "%.20g", dstr);               \
151           fprintf (FILE, "#0r%s", dstr);                                \
152         }                                                               \
153     } while (0)
154 #endif
155
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. */
162
163 #undef  CASE_VECTOR_MODE
164 #define CASE_VECTOR_MODE SImode
165 #undef  CASE_VECTOR_PC_RELATIVE
166
167 /* Make sure jump tables have the same alignment as other pointers.  */
168
169 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN)        \
170 { ASM_OUTPUT_ALIGN (FILE, 1); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
171
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.  */
175
176 #undef  GO_IF_INDEXABLE_BASE
177 #define GO_IF_INDEXABLE_BASE(X, ADDR)   \
178 { if (LEGITIMATE_BASE_REG_P (X)) goto ADDR; }
179
180 /* This accounts for the return pc and saved fp on the m68k. */
181
182 #define OBJC_FORWARDING_STACK_OFFSET 8
183 #define OBJC_FORWARDING_MIN_OFFSET 8
184
185 /* FINALIZE_TRAMPOLINE enables executable stack.  The
186    __enable_execute_stack also clears the insn cache. */
187
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)
192
193 /* A C expression used to clear the instruction cache from 
194    address BEG to address END.   On NeXTSTEP this i a system trap. */
195
196 #define CLEAR_INSN_CACHE(BEG, END)   \
197    asm volatile ("trap #2")
198
199 /* GCC is the primary compiler for NeXTSTEP, so we don't need this.  */
200 #undef PCC_STATIC_STRUCT_RETURN