1 /* Target definitions for GNU compiler for Intel x86 CPU running NeXTSTEP
2 Copyright (C) 1993, 1995, 1996, 1999 Free Software Foundation, Inc.
4 This file is part of GNU CC.
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)
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.
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. */
24 /* By default, target has a 80387, with IEEE FP. */
26 #undef TARGET_SUBTARGET_DEFAULT
27 #define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP)
29 /* Implicit library calls should use memcpy, not bcopy, etc. */
31 #define TARGET_MEM_FUNCTIONS
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. */
41 #define VALUE_REGNO(MODE) \
42 ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode \
43 ? FIRST_FLOAT_REG : 0)
45 /* A C statement or statements which output an assembler instruction
46 opcode to the stdio stream STREAM. The macro-operand PTR is a
47 variable of type `char *' which points to the opcode name in its
48 "internal" form--the form that is written in the machine description.
50 GAS version 1.38.1 doesn't understand the `repz' opcode mnemonic.
51 So use `repe' instead. */
53 #undef ASM_OUTPUT_OPCODE
54 #define ASM_OUTPUT_OPCODE(STREAM, PTR) \
60 if ((PTR)[3] == 'z') \
62 fprintf (STREAM, "repe"); \
65 else if ((PTR)[3] == 'n' && (PTR)[4] == 'z') \
67 fprintf (STREAM, "repne"); \
73 /* Define macro used to output shift-double opcodes when the shift
74 count is in %cl. Some assemblers require %cl as an argument;
77 GAS requires the %cl argument, so override unx386.h. */
79 #undef SHIFT_DOUBLE_OMITS_COUNT
80 #define SHIFT_DOUBLE_OMITS_COUNT 0
82 /* Print opcodes the way that GAS expects them. */
83 #define GAS_MNEMONICS 1
85 /* Names to predefine in the preprocessor for this target machine. */
88 #define CPP_PREDEFINES "-DNeXT -Dunix -D__MACH__ -D__LITTLE_ENDIAN__ \
89 -D__ARCHITECTURE__=\"i386\" -Asystem=unix -Asystem=mach"
91 /* This accounts for the return pc and saved fp on the i386. */
93 #define OBJC_FORWARDING_STACK_OFFSET 8
94 #define OBJC_FORWARDING_MIN_OFFSET 8
96 /* We do not want a dot in internal labels. */
101 #undef ASM_GENERATE_INTERNAL_LABEL
102 #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
103 sprintf ((BUF), "*%s%ld", (PREFIX), (long)(NUMBER))
105 #undef ASM_OUTPUT_INTERNAL_LABEL
106 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
107 fprintf (FILE, "%s%d:\n", PREFIX, NUM)
109 /* Output to assembler file text saying following lines
110 may contain character constants, extra white space, comments, etc. */
113 #define ASM_APP_ON "#APP\n"
115 /* Output to assembler file text saying following lines
116 no longer contain unusual constructs. */
119 #define ASM_APP_OFF "#NO_APP\n"
121 #undef ASM_OUTPUT_REG_PUSH
122 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
123 fprintf (FILE, "\tpushl %se%s\n", "%", reg_names[REGNO])
125 #undef ASM_OUTPUT_REG_POP
126 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
127 fprintf (FILE, "\tpopl %se%s\n", "%", reg_names[REGNO])
129 /* This is being overridden because the default i386 configuration
130 generates calls to "_mcount". NeXT system libraries all use
133 #undef FUNCTION_PROFILER
134 #define FUNCTION_PROFILER(FILE, LABELNO) \
138 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
139 LPREFIX, (LABELNO)); \
140 fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
144 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \
145 fprintf (FILE, "\tcall mcount\n"); \
149 /* BEGIN Calling Convention CHANGES */
151 /* These changes violate the Intel/Unix ABI. Specifically, they
152 change the way that space for a block return value is passed to a
153 function. The ABI says that the pointer is passed on the stack.
154 We change to pass the pointer in %ebx. This makes the NeXT
155 Objective-C forwarding mechanism possible to implement on an i386. */
157 /* Do NOT pass address of structure values on the stack. */
159 #undef STRUCT_VALUE_INCOMING
162 /* Pass them in %ebx. */
164 #undef STRUCT_VALUE_REGNUM
165 #define STRUCT_VALUE_REGNUM 3
167 /* Because we are passing the pointer in a register, we don't need to
168 rely on the callee to pop it. */
170 #undef RETURN_POPS_ARGS
171 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
172 ((FUNDECL) && TREE_CODE (FUNDECL) == IDENTIFIER_NODE \
175 && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
176 || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
177 == void_type_node))) ? (SIZE) : 0)
179 /* END Calling Convention CHANGES */
181 /* NeXT still uses old binutils that don't insert nops by default
182 when the .align directive demands to insert extra space in the text
184 #undef ASM_OUTPUT_ALIGN
185 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
186 if ((LOG)!=0) fprintf ((FILE), "\t.align %d,0x90\n", (LOG))