|
|
1.1 root 1: /* Target definitions for GNU compiler for Intel 80386 running System V.4
2: Copyright (C) 1991 Free Software Foundation, Inc.
3:
4: Written by Ron Guilmette ([email protected]).
5:
6: This file is part of GNU CC.
7:
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)
11: any later version.
12:
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.
17:
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. */
21:
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 */
25:
26: #undef TARGET_VERSION
27: #define TARGET_VERSION fprintf (stderr, " (i386 System V Release 4)");
28:
29: /* By default, target has a 80387. */
30:
31: #define TARGET_DEFAULT 1
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: #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: #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N)== FIRST_FLOAT_REG)
46:
47: /* The svr4 ABI for the i386 says that records and unions are returned
48: in memory. */
49:
50: #undef RETURN_IN_MEMORY
51: #define RETURN_IN_MEMORY(TYPE) \
52: (TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE(TYPE) == UNION_TYPE)
53:
54: /* Define which macros to predefine. __svr4__ is our extension. */
55: /* This used to define X86, but [email protected] 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)"
59:
60: /* Output at beginning of assembler file. */
61: /* The .file command should always begin the output. */
62:
63: #undef ASM_FILE_START
64: #define ASM_FILE_START(FILE) \
65: do { \
66: output_file_directive (FILE, main_input_filename); \
67: fprintf (FILE, "\t.version\t\"01.01\"\n"); \
68: } while (0)
69:
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:
73:
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)
82:
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)
91: */
92:
93: #undef DBX_REGISTER_NUMBER
94: #define DBX_REGISTER_NUMBER(n) \
95: ((n) == 0 ? 0 \
96: : (n) == 1 ? 2 \
97: : (n) == 2 ? 1 \
98: : (n) == 3 ? 3 \
99: : (n) == 4 ? 6 \
100: : (n) == 5 ? 7 \
101: : (n) == 6 ? 5 \
102: : (n) == 7 ? 4 \
103: : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n) \
104: : (abort (), 0))
105:
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. */
112:
113: #undef ASM_OUTPUT_ASCII
114: #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
115: do \
116: { \
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++) \
121: { \
122: register unsigned char *p; \
123: if (bytes_in_chunk >= 64) \
124: { \
125: fputc ('\n', (FILE)); \
126: bytes_in_chunk = 0; \
127: } \
128: for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
129: continue; \
130: if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \
131: { \
132: if (bytes_in_chunk > 0) \
133: { \
134: fputc ('\n', (FILE)); \
135: bytes_in_chunk = 0; \
136: } \
137: ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
138: _ascii_bytes = p; \
139: } \
140: else \
141: { \
142: if (bytes_in_chunk == 0) \
143: fprintf ((FILE), "\t.byte\t"); \
144: else \
145: fputc (',', (FILE)); \
146: fprintf ((FILE), "0x%02x", *_ascii_bytes); \
147: bytes_in_chunk += 5; \
148: } \
149: } \
150: if (bytes_in_chunk > 0) \
151: fprintf ((FILE), "\n"); \
152: } \
153: while (0)
154:
155: /* This is how to output an element of a case-vector that is relative.
156: This is only used for PIC code. See comments by the `casesi' insn in
157: i386.md for an explanation of the expression this outputs. */
158:
159: #undef ASM_OUTPUT_ADDR_DIFF_ELT
160: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
161: fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
162:
163: /* Indicate that jump tables go in the text section. This is
164: necessary when compiling PIC code. */
165:
166: #define JUMP_TABLES_IN_TEXT_SECTION
167:
168: #define WEAK_ASM_OP ".weak"
169: #define DEF_ASM_OP ".set"
170:
171: /* Biggest alignment that any structure field can require on this
172: machine, in bits. If packing is in effect, this can be smaller than
173: normal. */
174:
175: #define BIGGEST_FIELD_ALIGNMENT \
176: (maximum_field_alignment ? maximum_field_alignment : 32)
177:
178: extern int maximum_field_alignment;
179:
180: /* If bit field type is int, don't let it cross an int,
181: and give entire struct the alignment of an int. */
182: /* Required on the 386 since it doesn't have bitfield insns. */
183: /* If packing is in effect, then the type doesn't matter. */
184:
185: #undef PCC_BITFIELD_TYPE_MATTERS
186: #define PCC_BITFIELD_TYPE_MATTERS (maximum_field_alignment == 0)
187:
188: /* Code to handle #pragma directives. The interface is a bit messy,
189: but there's no simpler way to do this while still using yylex. */
190: #define HANDLE_PRAGMA(FILE) \
191: do { \
192: while (c == ' ' || c == '\t') \
193: c = getc (FILE); \
194: if (c == '\n' || c == EOF) \
195: { \
196: handle_pragma_token (0, 0); \
197: return c; \
198: } \
199: ungetc (c, FILE); \
200: switch (yylex ()) \
201: { \
202: case IDENTIFIER: \
203: case TYPENAME: \
204: case STRING: \
205: case CONSTANT: \
206: handle_pragma_token (token_buffer, yylval.ttype); \
207: break; \
208: default: \
209: handle_pragma_token (token_buffer, 0); \
210: } \
211: if (nextchar >= 0) \
212: c = nextchar, nextchar = -1; \
213: else \
214: c = getc (FILE); \
215: } while (1)
216:
217: /* This says how to output assembler code to declare an
218: uninitialized internal linkage data object. Under SVR4,
219: the linker seems to want the alignment of data objects
220: to depend on their types. We do exactly that here. */
221:
222: #undef ASM_OUTPUT_ALIGNED_LOCAL
223: #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
224: do { \
225: fprintf (FILE, "\t.local\t%s\n", NAME); \
226: ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN); \
227: } while (0)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.