OSDN Git Service

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