OSDN Git Service

* i386.c (split_ti): New function.
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / next.h
1 /* Target definitions for GNU compiler for Intel x86 CPU running NeXTSTEP
2    Copyright (C) 1993, 1995, 1996, 1999 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 "i386/gas.h"
22 #include "nextstep.h"
23
24 /* By default, target has a 80387, with IEEE FP.  */
25
26 #undef  TARGET_SUBTARGET_DEFAULT
27 #define TARGET_SUBTARGET_DEFAULT  (MASK_80387 | MASK_IEEE_FP)
28
29 /* Implicit library calls should use memcpy, not bcopy, etc.  */
30
31 #define TARGET_MEM_FUNCTIONS
32
33 /* Machines that use the AT&T assembler syntax
34    also return floating point values in an FP register.
35    Define how to find the value returned by a function.
36    VALTYPE is the data type of the value (as a tree).
37    If the precise function being called is known, FUNC is its FUNCTION_DECL;
38    otherwise, FUNC is 0.  */
39
40 #undef  VALUE_REGNO
41 #define VALUE_REGNO(MODE) \
42   ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode     \
43    ? FIRST_FLOAT_REG : 0)
44
45 #ifdef REAL_VALUE_TO_TARGET_LONG_DOUBLE
46 #undef  ASM_OUTPUT_LONG_DOUBLE
47 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE)                              \
48   do {                                                                  \
49     long hex[3];                                                        \
50     REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, hex);                      \
51     if (sizeof (int) == sizeof (long))                                  \
52       fprintf (FILE, "\t.long 0x%x\n\t.long 0x%x\n\t.long 0x%x\n",      \
53                 hex[0], hex[1], hex[2]);                                \
54     else                                                                \
55       fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n\t.long 0x%lx\n",   \
56                 hex[0], hex[1], hex[2]);                                \
57   } while (0)
58 #endif
59
60 #ifdef REAL_VALUE_TO_TARGET_DOUBLE
61 #undef  ASM_OUTPUT_DOUBLE
62 #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                                   \
63   do {                                                                  \
64     long hex[2];                                                        \
65     REAL_VALUE_TO_TARGET_DOUBLE (VALUE, hex);                           \
66     if (sizeof (int) == sizeof (long))                                  \
67       fprintf (FILE, "\t.long 0x%x\n\t.long 0x%x\n", hex[0], hex[1]);   \
68     else                                                                \
69       fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", hex[0], hex[1]); \
70   } while (0)
71 #endif
72
73 /* This is how to output an assembler line defining a `float' constant.  */
74
75 #ifdef REAL_VALUE_TO_TARGET_SINGLE
76 #undef  ASM_OUTPUT_FLOAT
77 #define ASM_OUTPUT_FLOAT(FILE,VALUE)                                    \
78   do {                                                                  \
79     long hex;                                                           \
80     REAL_VALUE_TO_TARGET_SINGLE (VALUE, hex);                           \
81     if (sizeof (int) == sizeof (long))                                  \
82       fprintf (FILE, "\t.long 0x%x\n", hex);                            \
83     else                                                                \
84       fprintf (FILE, "\t.long 0x%lx\n", hex);                           \
85   } while (0)
86 #endif
87
88 /* A C statement or statements which output an assembler instruction
89    opcode to the stdio stream STREAM.  The macro-operand PTR is a
90    variable of type `char *' which points to the opcode name in its
91    "internal" form--the form that is written in the machine description.
92
93    GAS version 1.38.1 doesn't understand the `repz' opcode mnemonic.
94    So use `repe' instead.  */
95
96 #undef  ASM_OUTPUT_OPCODE
97 #define ASM_OUTPUT_OPCODE(STREAM, PTR)  \
98 {                                                       \
99   if ((PTR)[0] == 'r'                                   \
100       && (PTR)[1] == 'e'                                \
101       && (PTR)[2] == 'p')                               \
102     {                                                   \
103       if ((PTR)[3] == 'z')                              \
104         {                                               \
105           fprintf (STREAM, "repe");                     \
106           (PTR) += 4;                                   \
107         }                                               \
108       else if ((PTR)[3] == 'n' && (PTR)[4] == 'z')      \
109         {                                               \
110           fprintf (STREAM, "repne");                    \
111           (PTR) += 5;                                   \
112         }                                               \
113     }                                                   \
114 }
115
116 /* Define macro used to output shift-double opcodes when the shift
117    count is in %cl.  Some assemblers require %cl as an argument;
118    some don't.
119
120    GAS requires the %cl argument, so override unx386.h. */
121
122 #undef  SHIFT_DOUBLE_OMITS_COUNT
123 #define SHIFT_DOUBLE_OMITS_COUNT 0
124
125 /* Print opcodes the way that GAS expects them. */
126 #define GAS_MNEMONICS 1
127
128 /* Names to predefine in the preprocessor for this target machine.  */
129
130 #undef  CPP_PREDEFINES
131 #define CPP_PREDEFINES "-DNeXT -Dunix -D__MACH__ -D__LITTLE_ENDIAN__ \
132   -D__ARCHITECTURE__=\"i386\" -Asystem=unix -Asystem=mach"
133
134 /* This accounts for the return pc and saved fp on the i386. */
135
136 #define OBJC_FORWARDING_STACK_OFFSET 8
137 #define OBJC_FORWARDING_MIN_OFFSET 8
138
139 /* We do not want a dot in internal labels.  */
140
141 #undef LPREFIX
142 #define LPREFIX "L"
143
144 #undef  ASM_GENERATE_INTERNAL_LABEL
145 #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER)  \
146     sprintf ((BUF), "*%s%d", (PREFIX), (NUMBER))
147
148 #undef ASM_OUTPUT_INTERNAL_LABEL
149 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)      \
150   fprintf (FILE, "%s%d:\n", PREFIX, NUM)
151
152 /* Output to assembler file text saying following lines
153    may contain character constants, extra white space, comments, etc.  */
154
155 #undef  ASM_APP_ON
156 #define ASM_APP_ON "#APP\n"
157
158 /* Output to assembler file text saying following lines
159    no longer contain unusual constructs.  */
160
161 #undef  ASM_APP_OFF
162 #define ASM_APP_OFF "#NO_APP\n"
163
164 #undef  ASM_OUTPUT_REG_PUSH
165 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)  \
166   fprintf (FILE, "\tpushl %se%s\n", "%", reg_names[REGNO])
167
168 #undef  ASM_OUTPUT_REG_POP
169 #define ASM_OUTPUT_REG_POP(FILE,REGNO)  \
170   fprintf (FILE, "\tpopl %se%s\n", "%", reg_names[REGNO])
171
172 /* This is being overridden because the default i386 configuration
173    generates calls to "_mcount".  NeXT system libraries all use
174    "mcount".  */
175
176 #undef  FUNCTION_PROFILER
177 #define FUNCTION_PROFILER(FILE, LABELNO)                                \
178 {                                                                       \
179   if (flag_pic)                                                         \
180     {                                                                   \
181       fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n",              \
182                LPREFIX, (LABELNO));                                     \
183       fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n");                    \
184     }                                                                   \
185   else                                                                  \
186     {                                                                   \
187       fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO));      \
188       fprintf (FILE, "\tcall mcount\n");                                \
189     }                                                                   \
190 }
191
192 /* BEGIN Calling Convention CHANGES */
193
194 /* These changes violate the Intel/Unix ABI.  Specifically, they
195    change the way that space for a block return value is passed to a
196    function.  The ABI says that the pointer is passed on the stack.
197    We change to pass the pointer in %ebx.  This makes the NeXT
198    Objective-C forwarding mechanism possible to implement on an i386.  */
199
200 /* Do NOT pass address of structure values on the stack.  */
201
202 #undef  STRUCT_VALUE_INCOMING
203 #undef  STRUCT_VALUE
204
205 /* Pass them in %ebx.  */
206
207 #undef  STRUCT_VALUE_REGNUM
208 #define STRUCT_VALUE_REGNUM 3
209
210 /* Because we are passing the pointer in a register, we don't need to
211    rely on the callee to pop it.  */
212
213 #undef  RETURN_POPS_ARGS
214 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE)                          \
215   ((FUNDECL) && TREE_CODE (FUNDECL) == IDENTIFIER_NODE          \
216    ? 0                                                          \
217    : (TARGET_RTD                                                \
218       && (TYPE_ARG_TYPES (FUNTYPE) == 0                         \
219           || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
220               == void_type_node))) ? (SIZE) : 0)
221
222 /* END Calling Convention CHANGES */
223
224 /* NeXT still uses old binutils that don't insert nops by default
225    when the .align directive demands to insert extra space in the text
226    segment.  */
227 #undef ASM_OUTPUT_ALIGN
228 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
229   if ((LOG)!=0) fprintf ((FILE), "\t.align %d,0x90\n", (LOG))