OSDN Git Service

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