OSDN Git Service

* calls.c, function.c: Always define PREFERRED_STACK_BOUNDARY
[pf3gnuchains/gcc-fork.git] / gcc / config / i860 / sysv4.h
1 /* Target definitions for GNU compiler for Intel 80860 running System V.4
2    Copyright (C) 1991, 1996, 2000 Free Software Foundation, Inc.
3    Contributed by Ron Guilmette (rfg@monkeys.com).
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22 #undef TARGET_VERSION
23 #define TARGET_VERSION fprintf (stderr, " (i860 System V Release 4)");
24
25 /* Provide a set of pre-definitions and pre-assertions appropriate for
26    the i860 running svr4.  Note that the symbol `__svr4__' MUST BE
27    DEFINED!  It is needed so that the va_list struct in va-i860.h
28    will get correctly defined for the svr4 (ABI compliant) case rather
29    than for the previous (svr3, svr2, ...) case.  It also needs to be
30    defined so that the correct (svr4) version of __builtin_saveregs
31    will be selected when we are building gnulib2.c.
32    __svr4__ is our extension.  */
33
34 #define CPP_PREDEFINES \
35   "-Di860 -Dunix -DSVR4 -D__svr4__ -Asystem=unix -Asystem=svr4 -Acpu=i860 -Amachine=i860"
36
37 /* For the benefit of i860_va_arg, flag it this way too.  */
38
39 #define I860_SVR4_VA_LIST 1
40
41 /* The prefix to be used in assembler output for all names of registers.
42    This string gets prepended to all i860 register names (svr4 only).  */
43
44 #define I860_REG_PREFIX "%"
45
46 #define ASM_COMMENT_START "#"
47
48 #undef TYPE_OPERAND_FMT
49 #define TYPE_OPERAND_FMT      "\"%s\""
50
51 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
52
53 /* The following macro definition overrides the one in i860.h
54    because the svr4 i860 assembler requires a different syntax
55    for getting parts of constant/relocatable values.  */
56
57 #undef PRINT_OPERAND_PART
58 #define PRINT_OPERAND_PART(FILE, X, PART_CODE)                          \
59   do { fprintf (FILE, "[");                                             \
60         output_address (X);                                             \
61         fprintf (FILE, "]@%s", PART_CODE);                              \
62   } while (0)
63
64 /* If the host and target formats match, output the floats as hex.  */
65 #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
66 #if defined (HOST_WORDS_BIG_ENDIAN) == WORDS_BIG_ENDIAN
67
68 /* This is how to output an assembler line defining a `double' constant.
69    Note that the native i860/svr4 ELF assembler can't properly handle
70    infinity.  It generates an incorrect (non-infinity) value when given
71    `.double 99e9999' and it doesn't grok `inf' at all.  It also mishandles
72    NaNs and -0.0.  */
73
74 #undef ASM_OUTPUT_DOUBLE
75 #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                                   \
76   {                                                                     \
77     if (REAL_VALUE_ISINF (VALUE)                                        \
78         || REAL_VALUE_ISNAN (VALUE)                                     \
79         || REAL_VALUE_MINUS_ZERO (VALUE))                               \
80       {                                                                 \
81         long t[2];                                                      \
82         REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t);                       \
83         fprintf (FILE, "\t.word 0x%lx\n\t.word 0x%lx\n", t[0], t[1]);   \
84       }                                                                 \
85     else                                                                \
86       fprintf (FILE, "\t.double %.20e\n", VALUE);                       \
87   }
88
89 /* This is how to output an assembler line defining a `float' constant.
90    Note that the native i860/svr4 ELF assembler can't properly handle
91    infinity.  It actually generates an assembly time error when given
92    `.float 99e9999' and it doesn't grok `inf' at all.  It also mishandles
93    NaNs and -0.0.  */
94
95 #undef ASM_OUTPUT_FLOAT
96 #define ASM_OUTPUT_FLOAT(FILE,VALUE)                                    \
97   {                                                                     \
98     if (REAL_VALUE_ISINF (VALUE)                                        \
99         || REAL_VALUE_ISNAN (VALUE)                                     \
100         || REAL_VALUE_MINUS_ZERO (VALUE))                               \
101       {                                                                 \
102         long t;                                                         \
103         REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t);                       \
104         fprintf (FILE, "\t.word 0x%lx\n", t);                           \
105       }                                                                 \
106     else                                                                \
107       fprintf (FILE, "\t.float %.12e\n", VALUE);                        \
108   }
109
110 #endif /* word order matches */
111 #endif /* HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT */
112
113 #undef ASM_FILE_START
114 #define ASM_FILE_START(FILE)                                            \
115   do {  output_file_directive (FILE, main_input_filename);              \
116         fprintf (FILE, "\t.version\t\"01.01\"\n");                      \
117   } while (0)
118
119 /* Output the special word the svr4 SDB wants to see just before
120    the first word of each function's prologue code.  */
121
122 extern char *current_function_original_name;
123
124 /* This special macro is used to output a magic word just before the
125    first word of each function.  On some versions of UNIX running on
126    the i860, this word can be any word that looks like a NOP, however
127    under svr4, this neds to be an `shr r0,r0,r0' instruction in which
128    the normally unused low-order bits contain the length of the function
129    prologue code (in bytes).  This is needed to make the svr4 SDB debugger
130    happy.  */
131
132 #undef ASM_OUTPUT_FUNCTION_PREFIX
133 #define ASM_OUTPUT_FUNCTION_PREFIX(FILE, FNNAME)                        \
134   do {  ASM_OUTPUT_ALIGN (FILE, 2);                                     \
135         fprintf ((FILE), "\t.long\t.ep.");                              \
136         assemble_name (FILE, FNNAME);                                   \
137         fprintf (FILE, "-");                                            \
138         assemble_name (FILE, FNNAME);                                   \
139         fprintf (FILE, "+0xc8000000\n");                                \
140         current_function_original_name = (FNNAME);                      \
141   } while (0)
142
143 /* Output the special label that must go just after each function's
144    prologue code to support svr4 SDB.  */
145
146 #define ASM_OUTPUT_PROLOGUE_SUFFIX(FILE)                                \
147   do {  fprintf (FILE, ".ep.");                                         \
148         assemble_name (FILE, current_function_original_name);           \
149         fprintf (FILE, ":\n");                                          \
150   } while (0)
151
152 /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
153  
154    Note that we want to give these sections the SHF_WRITE attribute
155    because these sections will actually contain data (i.e. tables of
156    addresses of functions in the current root executable or shared library
157    file) and, in the case of a shared library, the relocatable addresses
158    will have to be properly resolved/relocated (and then written into) by
159    the dynamic linker when it actually attaches the given shared library
160    to the executing process.  (Note that on SVR4, you may wish to use the
161    `-z text' option to the ELF linker, when building a shared library, as
162    an additional check that you are doing everything right.  But if you do
163    use the `-z text' option when building a shared library, you will get
164    errors unless the .ctors and .dtors sections are marked as writable
165    via the SHF_WRITE attribute.)  */
166  
167 #undef CTORS_SECTION_ASM_OP
168 #define CTORS_SECTION_ASM_OP    "\t.section\t.ctors,\"aw\""
169 #undef DTORS_SECTION_ASM_OP
170 #define DTORS_SECTION_ASM_OP    "\t.section\t.dtors,\"aw\""
171
172 /* Add definitions to support the .tdesc section as specified in the svr4
173    ABI for the i860.  */
174
175 #define TDESC_SECTION_ASM_OP    "\t.section\t.tdesc"
176
177 #undef EXTRA_SECTIONS
178 #define EXTRA_SECTIONS in_const, in_tdesc
179
180 #undef EXTRA_SECTION_FUNCTIONS
181 #define EXTRA_SECTION_FUNCTIONS                                         \
182   CONST_SECTION_FUNCTION                                                \
183   TDESC_SECTION_FUNCTION
184
185 #define TDESC_SECTION_FUNCTION                                          \
186 void                                                                    \
187 tdesc_section ()                                                        \
188 {                                                                       \
189   if (in_section != in_tdesc)                                           \
190     {                                                                   \
191       fprintf (asm_out_file, "%s\n", TDESC_SECTION_ASM_OP);             \
192       in_section = in_tdesc;                                            \
193     }                                                                   \
194 }
195