1 /* Target definitions for GNU compiler for Intel 80386 running System V.4
2 Copyright (C) 1991 Free Software Foundation, Inc.
4 Written by Ron Guilmette (rfg@ncd.com).
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
22 #include "i386.h" /* Base i386 target machine definitions */
23 #include "att386.h" /* Use the i386 AT&T assembler syntax */
24 #include "svr4.h" /* Definitions common to all SVR4 targets */
27 #define TARGET_VERSION fprintf (stderr, " (i386 System V Release 4)");
29 /* By default, target has a 80387. */
31 #define TARGET_DEFAULT 1
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. */
40 #define VALUE_REGNO(MODE) \
41 (((MODE) == SFmode || (MODE) == DFmode) ? FIRST_FLOAT_REG : 0)
43 /* 1 if N is a possible register number for a function value. */
45 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N)== FIRST_FLOAT_REG)
47 /* The svr4 ABI for the i386 says that records and unions are returned
50 #undef RETURN_IN_MEMORY
51 #define RETURN_IN_MEMORY(TYPE) \
52 (TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE(TYPE) == UNION_TYPE)
54 /* Define which macros to predefine. __svr4__ is our extension. */
55 /* This used to define X86, but james@bigtex.cactus.org says that
56 is supposed to be defined optionally by user programs--not by default. */
57 #define CPP_PREDEFINES \
58 "-Di386 -Dunix -D__svr4__ -Asystem(unix) -Acpu(i386) -Amachine(i386)"
60 /* Output at beginning of assembler file. */
61 /* The .file command should always begin the output. */
64 #define ASM_FILE_START(FILE) \
66 output_file_directive (FILE, main_input_filename); \
67 fprintf (FILE, "\t.version\t\"01.01\"\n"); \
70 /* Define the register numbers to be used in Dwarf debugging information.
71 The SVR4 reference port C compiler uses the following register numbers
72 in its Dwarf output code:
74 0 for %eax (regno = 0)
75 1 for %ecx (regno = 2)
76 2 for %edx (regno = 1)
77 3 for %ebx (regno = 3)
78 4 for %esp (regno = 7)
79 5 for %ebp (regno = 6)
80 6 for %esi (regno = 4)
81 7 for %edi (regno = 5)
83 8 for FP_REGS[tos] (regno = 8)
84 9 for FP_REGS[tos-1] (regno = 9)
85 10 for FP_REGS[tos-2] (regno = 10)
86 11 for FP_REGS[tos-3] (regno = 11)
87 12 for FP_REGS[tos-4] (regno = 12)
88 13 for FP_REGS[tos-5] (regno = 13)
89 14 for FP_REGS[tos-6] (regno = 14)
90 15 for FP_REGS[tos-7] (regno = 15)
93 #undef DBX_REGISTER_NUMBER
94 #define DBX_REGISTER_NUMBER(n) \
103 : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n) \
106 /* The routine used to output sequences of byte values. We use a special
107 version of this for most svr4 targets because doing so makes the
108 generated assembly code more compact (and thus faster to assemble)
109 as well as more readable. Note that if we find subparts of the
110 character sequence which end with NUL (and which are shorter than
111 STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
113 #undef ASM_OUTPUT_ASCII
114 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
117 register unsigned char *_ascii_bytes = (unsigned char *) (STR); \
118 register unsigned char *limit = _ascii_bytes + (LENGTH); \
119 register unsigned bytes_in_chunk = 0; \
120 for (; _ascii_bytes < limit; _ascii_bytes++) \
122 register unsigned char *p; \
123 if (bytes_in_chunk >= 64) \
125 fputc ('\n', (FILE)); \
126 bytes_in_chunk = 0; \
128 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
130 if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \
132 if (bytes_in_chunk > 0) \
134 fputc ('\n', (FILE)); \
135 bytes_in_chunk = 0; \
137 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
142 if (bytes_in_chunk == 0) \
143 fprintf ((FILE), "\t.byte\t"); \
145 fputc (',', (FILE)); \
146 fprintf ((FILE), "0x%02x", *_ascii_bytes); \
147 bytes_in_chunk += 5; \
150 if (bytes_in_chunk > 0) \
151 fprintf ((FILE), "\n"); \