OSDN Git Service

46a1eaa24d9ed5017841a45fef9a4be87ff7aaed
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / sysv4.h
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 (rfg@ncd.com).
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 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)"
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)