]>
Commit | Line | Data |
---|---|---|
ba8ab355 | 1 | /* Definitions of target machine for GNU compiler, for Intel 80960 |
16c484c7 | 2 | Copyright (C) 1992, 1993, 1995, 1996, 1998, 1999, 2000, 2001, 2002 |
c2749e2d | 3 | Free Software Foundation, Inc. |
ba8ab355 JW |
4 | Contributed by Steven McGeady, Intel Corp. |
5 | Additional Work by Glenn Colon-Bonet, Jonathan Shapiro, Andy Wilson | |
6 | Converted to GCC 2.0 by Jim Wilson and Michael Tiemann, Cygnus Support. | |
7 | ||
7ec022b2 | 8 | This file is part of GCC. |
ba8ab355 | 9 | |
7ec022b2 | 10 | GCC is free software; you can redistribute it and/or modify |
ba8ab355 JW |
11 | it under the terms of the GNU General Public License as published by |
12 | the Free Software Foundation; either version 2, or (at your option) | |
13 | any later version. | |
14 | ||
7ec022b2 | 15 | GCC is distributed in the hope that it will be useful, |
ba8ab355 JW |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | GNU General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU General Public License | |
7ec022b2 | 21 | along with GCC; see the file COPYING. If not, write to |
5b1a918b RK |
22 | the Free Software Foundation, 59 Temple Place - Suite 330, |
23 | Boston, MA 02111-1307, USA. */ | |
ba8ab355 JW |
24 | |
25 | /* Note that some other tm.h files may include this one and then override | |
26 | many of the definitions that relate to assembler syntax. */ | |
27 | ||
8d55c164 NB |
28 | /* Target CPU builtins. */ |
29 | #define TARGET_CPU_CPP_BUILTINS() \ | |
30 | do \ | |
31 | { \ | |
32 | builtin_define_std ("i960"); \ | |
33 | builtin_define_std ("I960"); \ | |
34 | builtin_define_std ("i80960"); \ | |
35 | builtin_define_std ("I80960"); \ | |
36 | builtin_assert ("cpu=i960"); \ | |
37 | builtin_assert ("machine=i960"); \ | |
38 | } \ | |
39 | while (0) | |
eaa4b44c | 40 | |
8d55c164 | 41 | #define MULTILIB_DEFAULTS { "mnumerics" } |
ba8ab355 | 42 | |
0fef3fd0 NB |
43 | /* Name to predefine in the preprocessor for processor variations. |
44 | -mic* options make characters signed by default. */ | |
45 | #define CPP_SPEC "%{mic*:-D__i960 -fsigned-char\ | |
c3eebffb | 46 | %{mka:-D__i960KA}%{mkb:-D__i960KB}\ |
555d459c RK |
47 | %{mja:-D__i960JA}%{mjd:-D__i960JD}%{mjf:-D__i960JF}\ |
48 | %{mrp:-D__i960RP}\ | |
c3eebffb | 49 | %{msa:-D__i960SA}%{msb:-D__i960SB}\ |
ba8ab355 | 50 | %{mmc:-D__i960MC}\ |
c3eebffb | 51 | %{mca:-D__i960CA}%{mcc:-D__i960CC}\ |
ba8ab355 | 52 | %{mcf:-D__i960CF}}\ |
303e979a | 53 | %{msoft-float:-D_SOFT_FLOAT}\ |
ba8ab355 JW |
54 | %{mka:-D__i960KA__ -D__i960_KA__}\ |
55 | %{mkb:-D__i960KB__ -D__i960_KB__}\ | |
ba8ab355 JW |
56 | %{msa:-D__i960SA__ -D__i960_SA__}\ |
57 | %{msb:-D__i960SB__ -D__i960_SB__}\ | |
ba8ab355 JW |
58 | %{mmc:-D__i960MC__ -D__i960_MC__}\ |
59 | %{mca:-D__i960CA__ -D__i960_CA__}\ | |
ba8ab355 JW |
60 | %{mcc:-D__i960CC__ -D__i960_CC__}\ |
61 | %{mcf:-D__i960CF__ -D__i960_CF__}\ | |
c3eebffb | 62 | %{!mka:%{!mkb:%{!msa:%{!msb:%{!mmc:%{!mca:\ |
eaa4b44c VM |
63 | %{!mcc:%{!mcf:-D__i960_KB -D__i960KB__ %{mic*:-D__i960KB}}}}}}}}}\ |
64 | %{mlong-double-64:-D__LONG_DOUBLE_64__}" | |
ba8ab355 | 65 | |
0e089454 JW |
66 | /* Specs for the compiler, to handle processor variations. |
67 | If the user gives an explicit -gstabs or -gcoff option, then do not | |
0fef3fd0 NB |
68 | try to add an implicit one, as this will fail. |
69 | -mic* options make characters signed by default. */ | |
ba8ab355 | 70 | #define CC1_SPEC \ |
0fef3fd0 NB |
71 | "%{mic*:-fsigned-char}\ |
72 | %{!mka:%{!mkb:%{!msa:%{!msb:%{!mmc:%{!mca:%{!mcc:%{!mcf:%{!mja:%{!mjd:%{!mjf:%{!mrp:-mka}}}}}}}}}}}}\ | |
0e089454 JW |
73 | %{!gs*:%{!gc*:%{mbout:%{g*:-gstabs}}\ |
74 | %{mcoff:%{g*:-gcoff}}\ | |
75 | %{!mbout:%{!mcoff:%{g*:-gstabs}}}}}" | |
ba8ab355 JW |
76 | |
77 | /* Specs for the assembler, to handle processor variations. | |
78 | For compatibility with Intel's gnu960 tool chain, pass -A options to | |
79 | the assembler. */ | |
80 | #define ASM_SPEC \ | |
c3eebffb JW |
81 | "%{mka:-AKA}%{mkb:-AKB}%{msa:-ASA}%{msb:-ASB}\ |
82 | %{mmc:-AMC}%{mca:-ACA}%{mcc:-ACC}%{mcf:-ACF}\ | |
555d459c RK |
83 | %{mja:-AJX}%{mjd:-AJX}%{mjf:-AJX}%{mrp:-AJX}\ |
84 | %{!mka:%{!mkb:%{!msa:%{!msb:%{!mmc:%{!mca:%{!mcc:%{!mcf:%{!mja:%{!mjd:%{!mjf:%{!mrp:-AKB}}}}}}}}}}}}\ | |
647902e0 | 85 | %{mlink-relax:-linkrelax}" |
ba8ab355 JW |
86 | |
87 | /* Specs for the linker, to handle processor variations. | |
88 | For compatibility with Intel's gnu960 tool chain, pass -F and -A options | |
89 | to the linker. */ | |
90 | #define LINK_SPEC \ | |
c3eebffb JW |
91 | "%{mka:-AKA}%{mkb:-AKB}%{msa:-ASA}%{msb:-ASB}\ |
92 | %{mmc:-AMC}%{mca:-ACA}%{mcc:-ACC}%{mcf:-ACF}\ | |
e9a25f70 | 93 | %{mja:-AJX}%{mjd:-AJX}%{mjf:-AJX}%{mrp:-AJX}\ |
c3eebffb JW |
94 | %{mbout:-Fbout}%{mcoff:-Fcoff}\ |
95 | %{mlink-relax:-relax}" | |
ba8ab355 JW |
96 | |
97 | /* Specs for the libraries to link with, to handle processor variations. | |
98 | Compatible with Intel's gnu960 tool chain. */ | |
99 | #define LIB_SPEC "%{!nostdlib:-lcg %{p:-lprof}%{pg:-lgprof}\ | |
100 | %{mka:-lfpg}%{msa:-lfpg}%{mca:-lfpg}%{mcf:-lfpg} -lgnu}" | |
101 | ||
bcf783f4 VM |
102 | /* Defining the macro shows we can debug even without a frame pointer. |
103 | Actually, we can debug without FP. But defining the macro results in | |
104 | that -O means FP elimination. Addressing through sp requires | |
105 | negative offset and more one word addressing in the most cases | |
106 | (offsets except for 0-4095 require one more word). Therefore we've | |
e5837c07 | 107 | not defined the macro. */ |
bcf783f4 | 108 | /*#define CAN_DEBUG_WITHOUT_FP*/ |
b0f43a24 RK |
109 | |
110 | /* Do leaf procedure and tail call optimizations for -O2 and higher. */ | |
c6aded7c | 111 | #define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \ |
ba8ab355 JW |
112 | { \ |
113 | if ((LEVEL) >= 2) \ | |
114 | { \ | |
ba8ab355 JW |
115 | target_flags |= TARGET_FLAG_LEAFPROC; \ |
116 | target_flags |= TARGET_FLAG_TAILCALL; \ | |
117 | } \ | |
ba8ab355 JW |
118 | } |
119 | ||
120 | /* Print subsidiary information on the compiler version in use. */ | |
121 | #define TARGET_VERSION fprintf (stderr," (intel 80960)"); | |
122 | ||
123 | /* Generate DBX debugging information. */ | |
23532de9 | 124 | #define DBX_DEBUGGING_INFO 1 |
ba8ab355 JW |
125 | |
126 | /* Generate SDB style debugging information. */ | |
23532de9 | 127 | #define SDB_DEBUGGING_INFO 1 |
6321d910 | 128 | #define EXTENDED_SDB_BASIC_TYPES |
ba8ab355 JW |
129 | |
130 | /* Generate DBX_DEBUGGING_INFO by default. */ | |
131 | #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG | |
132 | ||
6321d910 JW |
133 | /* Redefine this to print in hex. No value adjustment is necessary |
134 | anymore. */ | |
3c2eb9e1 | 135 | #define PUT_SDB_TYPE(A) \ |
6321d910 | 136 | fprintf (asm_out_file, "\t.type\t0x%x;", A) |
ba8ab355 | 137 | |
c9040e2c | 138 | /* Handle pragmas for compatibility with Intel's compilers. */ |
43fabf7d JW |
139 | |
140 | extern int i960_maxbitalignment; | |
141 | extern int i960_last_maxbitalignment; | |
142 | ||
c58b209a NB |
143 | #define REGISTER_TARGET_PRAGMAS() do { \ |
144 | c_register_pragma (0, "align", i960_pr_align); \ | |
145 | c_register_pragma (0, "noalign", i960_pr_noalign); \ | |
8b97c5f8 | 146 | } while (0) |
c9040e2c | 147 | |
ba8ab355 JW |
148 | /* Run-time compilation parameters selecting different hardware subsets. */ |
149 | ||
150 | /* 960 architecture with floating-point. */ | |
151 | #define TARGET_FLAG_NUMERICS 0x01 | |
152 | #define TARGET_NUMERICS (target_flags & TARGET_FLAG_NUMERICS) | |
153 | ||
154 | /* 960 architecture with memory management. */ | |
155 | /* ??? Not used currently. */ | |
156 | #define TARGET_FLAG_PROTECTED 0x02 | |
157 | #define TARGET_PROTECTED (target_flags & TARGET_FLAG_PROTECTED) | |
158 | ||
159 | /* The following three are mainly used to provide a little sanity checking | |
555d459c | 160 | against the -mARCH flags given. The Jx series, for the purposes of |
e5837c07 | 161 | gcc, is a Kx with a data cache. */ |
ba8ab355 JW |
162 | |
163 | /* Nonzero if we should generate code for the KA and similar processors. | |
164 | No FPU, no microcode instructions. */ | |
165 | #define TARGET_FLAG_K_SERIES 0x04 | |
166 | #define TARGET_K_SERIES (target_flags & TARGET_FLAG_K_SERIES) | |
167 | ||
168 | /* Nonzero if we should generate code for the MC processor. | |
169 | Not really different from KB for our purposes. */ | |
170 | #define TARGET_FLAG_MC 0x08 | |
171 | #define TARGET_MC (target_flags & TARGET_FLAG_MC) | |
172 | ||
173 | /* Nonzero if we should generate code for the CA processor. | |
174 | Enables different optimization strategies. */ | |
175 | #define TARGET_FLAG_C_SERIES 0x10 | |
176 | #define TARGET_C_SERIES (target_flags & TARGET_FLAG_C_SERIES) | |
177 | ||
178 | /* Nonzero if we should generate leaf-procedures when we find them. | |
179 | You may not want to do this because leaf-proc entries are | |
180 | slower when not entered via BAL - this would be true when | |
181 | a linker not supporting the optimization is used. */ | |
182 | #define TARGET_FLAG_LEAFPROC 0x20 | |
183 | #define TARGET_LEAFPROC (target_flags & TARGET_FLAG_LEAFPROC) | |
184 | ||
185 | /* Nonzero if we should perform tail-call optimizations when we find them. | |
186 | You may not want to do this because the detection of cases where | |
187 | this is not valid is not totally complete. */ | |
188 | #define TARGET_FLAG_TAILCALL 0x40 | |
189 | #define TARGET_TAILCALL (target_flags & TARGET_FLAG_TAILCALL) | |
190 | ||
191 | /* Nonzero if use of a complex addressing mode is a win on this implementation. | |
192 | Complex addressing modes are probably not worthwhile on the K-series, | |
193 | but they definitely are on the C-series. */ | |
194 | #define TARGET_FLAG_COMPLEX_ADDR 0x80 | |
195 | #define TARGET_COMPLEX_ADDR (target_flags & TARGET_FLAG_COMPLEX_ADDR) | |
196 | ||
197 | /* Align code to 8 byte boundaries for faster fetching. */ | |
198 | #define TARGET_FLAG_CODE_ALIGN 0x100 | |
199 | #define TARGET_CODE_ALIGN (target_flags & TARGET_FLAG_CODE_ALIGN) | |
200 | ||
201 | /* Append branch prediction suffixes to branch opcodes. */ | |
202 | /* ??? Not used currently. */ | |
203 | #define TARGET_FLAG_BRANCH_PREDICT 0x200 | |
204 | #define TARGET_BRANCH_PREDICT (target_flags & TARGET_FLAG_BRANCH_PREDICT) | |
205 | ||
206 | /* Forces prototype and return promotions. */ | |
207 | /* ??? This does not work. */ | |
208 | #define TARGET_FLAG_CLEAN_LINKAGE 0x400 | |
209 | #define TARGET_CLEAN_LINKAGE (target_flags & TARGET_FLAG_CLEAN_LINKAGE) | |
210 | ||
211 | /* For compatibility with iC960 v3.0. */ | |
212 | #define TARGET_FLAG_IC_COMPAT3_0 0x800 | |
213 | #define TARGET_IC_COMPAT3_0 (target_flags & TARGET_FLAG_IC_COMPAT3_0) | |
214 | ||
215 | /* For compatibility with iC960 v2.0. */ | |
216 | #define TARGET_FLAG_IC_COMPAT2_0 0x1000 | |
217 | #define TARGET_IC_COMPAT2_0 (target_flags & TARGET_FLAG_IC_COMPAT2_0) | |
218 | ||
219 | /* If no unaligned accesses are to be permitted. */ | |
220 | #define TARGET_FLAG_STRICT_ALIGN 0x2000 | |
221 | #define TARGET_STRICT_ALIGN (target_flags & TARGET_FLAG_STRICT_ALIGN) | |
222 | ||
223 | /* For compatibility with iC960 assembler. */ | |
224 | #define TARGET_FLAG_ASM_COMPAT 0x4000 | |
225 | #define TARGET_ASM_COMPAT (target_flags & TARGET_FLAG_ASM_COMPAT) | |
226 | ||
227 | /* For compatibility with the gcc960 v1.2 compiler. Use the old structure | |
13d39dbc | 228 | alignment rules. Also, turns on STRICT_ALIGNMENT. */ |
ba8ab355 JW |
229 | #define TARGET_FLAG_OLD_ALIGN 0x8000 |
230 | #define TARGET_OLD_ALIGN (target_flags & TARGET_FLAG_OLD_ALIGN) | |
231 | ||
eaa4b44c VM |
232 | /* Nonzero if long doubles are to be 64 bits. Useful for soft-float targets |
233 | if 80 bit long double support is missing. */ | |
234 | #define TARGET_FLAG_LONG_DOUBLE_64 0x10000 | |
235 | #define TARGET_LONG_DOUBLE_64 (target_flags & TARGET_FLAG_LONG_DOUBLE_64) | |
236 | ||
ba8ab355 JW |
237 | extern int target_flags; |
238 | ||
239 | /* Macro to define tables used to set the flags. | |
240 | This is a list in braces of pairs in braces, | |
241 | each pair being { "NAME", VALUE } | |
242 | where VALUE is the bits to set or minus the bits to clear. | |
243 | An empty string NAME is used to identify the default VALUE. */ | |
244 | ||
245 | /* ??? Not all ten of these architecture variations actually exist, but I | |
246 | am not sure which are real and which aren't. */ | |
247 | ||
248 | #define TARGET_SWITCHES \ | |
4e8d7ddc | 249 | { {"sa", (TARGET_FLAG_K_SERIES|TARGET_FLAG_COMPLEX_ADDR), \ |
047142d3 | 250 | N_("Generate SA code")}, \ |
4e8d7ddc JW |
251 | {"sb", (TARGET_FLAG_NUMERICS|TARGET_FLAG_K_SERIES| \ |
252 | TARGET_FLAG_COMPLEX_ADDR), \ | |
047142d3 | 253 | N_("Generate SB code")}, \ |
4e8d7ddc JW |
254 | /* {"sc", (TARGET_FLAG_NUMERICS|TARGET_FLAG_PROTECTED| \ |
255 | TARGET_FLAG_MC|TARGET_FLAG_COMPLEX_ADDR), \ | |
047142d3 | 256 | N_("Generate SC code")}, */ \ |
4e8d7ddc | 257 | {"ka", (TARGET_FLAG_K_SERIES|TARGET_FLAG_COMPLEX_ADDR), \ |
047142d3 | 258 | N_("Generate KA code")}, \ |
4e8d7ddc JW |
259 | {"kb", (TARGET_FLAG_NUMERICS|TARGET_FLAG_K_SERIES| \ |
260 | TARGET_FLAG_COMPLEX_ADDR), \ | |
047142d3 | 261 | N_("Generate KB code")}, \ |
4e8d7ddc JW |
262 | /* {"kc", (TARGET_FLAG_NUMERICS|TARGET_FLAG_PROTECTED| \ |
263 | TARGET_FLAG_MC|TARGET_FLAG_COMPLEX_ADDR), \ | |
047142d3 | 264 | N_("Generate KC code")}, */ \ |
4e8d7ddc | 265 | {"ja", (TARGET_FLAG_K_SERIES|TARGET_FLAG_COMPLEX_ADDR), \ |
047142d3 | 266 | N_("Generate JA code")}, \ |
4e8d7ddc | 267 | {"jd", (TARGET_FLAG_K_SERIES|TARGET_FLAG_COMPLEX_ADDR), \ |
047142d3 | 268 | N_("Generate JD code")}, \ |
4e8d7ddc JW |
269 | {"jf", (TARGET_FLAG_NUMERICS|TARGET_FLAG_K_SERIES| \ |
270 | TARGET_FLAG_COMPLEX_ADDR), \ | |
047142d3 | 271 | N_("Generate JF code")}, \ |
4e8d7ddc | 272 | {"rp", (TARGET_FLAG_K_SERIES|TARGET_FLAG_COMPLEX_ADDR), \ |
047142d3 | 273 | N_("generate RP code")}, \ |
4e8d7ddc JW |
274 | {"mc", (TARGET_FLAG_NUMERICS|TARGET_FLAG_PROTECTED| \ |
275 | TARGET_FLAG_MC|TARGET_FLAG_COMPLEX_ADDR), \ | |
047142d3 | 276 | N_("Generate MC code")}, \ |
4e8d7ddc JW |
277 | {"ca", (TARGET_FLAG_C_SERIES|TARGET_FLAG_BRANCH_PREDICT| \ |
278 | TARGET_FLAG_CODE_ALIGN|TARGET_FLAG_COMPLEX_ADDR),\ | |
047142d3 | 279 | N_("Generate CA code")}, \ |
4e8d7ddc JW |
280 | /* {"cb", (TARGET_FLAG_NUMERICS|TARGET_FLAG_C_SERIES| \ |
281 | TARGET_FLAG_BRANCH_PREDICT|TARGET_FLAG_CODE_ALIGN),\ | |
047142d3 | 282 | N_("Generate CB code")}, \ |
4e8d7ddc | 283 | {"cc", (TARGET_FLAG_NUMERICS|TARGET_FLAG_PROTECTED| \ |
ba8ab355 | 284 | TARGET_FLAG_C_SERIES|TARGET_FLAG_BRANCH_PREDICT|\ |
4e8d7ddc | 285 | TARGET_FLAG_CODE_ALIGN), \ |
047142d3 | 286 | N_("Generate CC code")}, */ \ |
4e8d7ddc JW |
287 | {"cf", (TARGET_FLAG_C_SERIES|TARGET_FLAG_BRANCH_PREDICT| \ |
288 | TARGET_FLAG_CODE_ALIGN|TARGET_FLAG_COMPLEX_ADDR),\ | |
047142d3 | 289 | N_("Generate CF code")}, \ |
4e8d7ddc | 290 | {"numerics", (TARGET_FLAG_NUMERICS), \ |
047142d3 | 291 | N_("Use hardware floating point instructions")}, \ |
4e8d7ddc | 292 | {"soft-float", -(TARGET_FLAG_NUMERICS), \ |
047142d3 | 293 | N_("Use software floating point")}, \ |
4e8d7ddc | 294 | {"leaf-procedures", TARGET_FLAG_LEAFPROC, \ |
047142d3 | 295 | N_("Use alternate leaf function entries")}, \ |
4e8d7ddc | 296 | {"no-leaf-procedures", -(TARGET_FLAG_LEAFPROC), \ |
047142d3 | 297 | N_("Do not use alternate leaf function entries")}, \ |
4e8d7ddc | 298 | {"tail-call", TARGET_FLAG_TAILCALL, \ |
047142d3 | 299 | N_("Perform tail call optimization")}, \ |
4e8d7ddc | 300 | {"no-tail-call", -(TARGET_FLAG_TAILCALL), \ |
047142d3 | 301 | N_("Do not perform tail call optimization")}, \ |
4e8d7ddc | 302 | {"complex-addr", TARGET_FLAG_COMPLEX_ADDR, \ |
047142d3 | 303 | N_("Use complex addressing modes")}, \ |
4e8d7ddc | 304 | {"no-complex-addr", -(TARGET_FLAG_COMPLEX_ADDR), \ |
047142d3 | 305 | N_("Do not use complex addressing modes")}, \ |
4e8d7ddc | 306 | {"code-align", TARGET_FLAG_CODE_ALIGN, \ |
047142d3 | 307 | N_("Align code to 8 byte boundary")}, \ |
4e8d7ddc | 308 | {"no-code-align", -(TARGET_FLAG_CODE_ALIGN), \ |
047142d3 | 309 | N_("Do not align code to 8 byte boundary")}, \ |
4e8d7ddc | 310 | /* {"clean-linkage", (TARGET_FLAG_CLEAN_LINKAGE), \ |
047142d3 | 311 | N_("Force use of prototypes")}, \ |
4e8d7ddc | 312 | {"no-clean-linkage", -(TARGET_FLAG_CLEAN_LINKAGE), \ |
047142d3 | 313 | N_("Do not force use of prototypes")}, */ \ |
4e8d7ddc | 314 | {"ic-compat", TARGET_FLAG_IC_COMPAT2_0, \ |
047142d3 | 315 | N_("Enable compatibility with iC960 v2.0")}, \ |
4e8d7ddc | 316 | {"ic2.0-compat", TARGET_FLAG_IC_COMPAT2_0, \ |
047142d3 | 317 | N_("Enable compatibility with iC960 v2.0")}, \ |
4e8d7ddc | 318 | {"ic3.0-compat", TARGET_FLAG_IC_COMPAT3_0, \ |
047142d3 | 319 | N_("Enable compatibility with iC960 v3.0")}, \ |
4e8d7ddc | 320 | {"asm-compat", TARGET_FLAG_ASM_COMPAT, \ |
047142d3 | 321 | N_("Enable compatibility with ic960 assembler")}, \ |
4e8d7ddc | 322 | {"intel-asm", TARGET_FLAG_ASM_COMPAT, \ |
047142d3 | 323 | N_("Enable compatibility with ic960 assembler")}, \ |
4e8d7ddc | 324 | {"strict-align", TARGET_FLAG_STRICT_ALIGN, \ |
047142d3 | 325 | N_("Do not permit unaligned accesses")}, \ |
4e8d7ddc | 326 | {"no-strict-align", -(TARGET_FLAG_STRICT_ALIGN), \ |
047142d3 | 327 | N_("Permit unaligned accesses")}, \ |
4e8d7ddc | 328 | {"old-align", (TARGET_FLAG_OLD_ALIGN|TARGET_FLAG_STRICT_ALIGN), \ |
047142d3 | 329 | N_("Layout types like Intel's v1.3 gcc")}, \ |
4e8d7ddc | 330 | {"no-old-align", -(TARGET_FLAG_OLD_ALIGN|TARGET_FLAG_STRICT_ALIGN), \ |
047142d3 | 331 | N_("Do not layout types like Intel's v1.3 gcc")}, \ |
4e8d7ddc | 332 | {"long-double-64", TARGET_FLAG_LONG_DOUBLE_64, \ |
047142d3 | 333 | N_("Use 64 bit long doubles")}, \ |
4e8d7ddc | 334 | {"link-relax", 0, \ |
047142d3 | 335 | N_("Enable linker relaxation")}, \ |
4e8d7ddc | 336 | {"no-link-relax", 0, \ |
047142d3 | 337 | N_("Do not enable linker relaxation")}, \ |
5d84b57e | 338 | SUBTARGET_SWITCHES \ |
4e8d7ddc JW |
339 | { "", TARGET_DEFAULT, \ |
340 | NULL}} | |
ba8ab355 | 341 | |
02d7a569 JS |
342 | /* This are meant to be redefined in the host dependent files */ |
343 | #define SUBTARGET_SWITCHES | |
344 | ||
ba8ab355 JW |
345 | /* Override conflicting target switch options. |
346 | Doesn't actually detect if more than one -mARCH option is given, but | |
347 | does handle the case of two blatantly conflicting -mARCH options. */ | |
3dc85dfb | 348 | #define OVERRIDE_OPTIONS i960_initialize () |
ba8ab355 JW |
349 | |
350 | /* Don't enable anything by default. The user is expected to supply a -mARCH | |
555d459c | 351 | option. If none is given, then -mka is added by CC1_SPEC. */ |
ba8ab355 JW |
352 | #define TARGET_DEFAULT 0 |
353 | \f | |
354 | /* Target machine storage layout. */ | |
355 | ||
356 | /* Define this if most significant bit is lowest numbered | |
357 | in instructions that operate on numbered bit-fields. */ | |
358 | #define BITS_BIG_ENDIAN 0 | |
359 | ||
360 | /* Define this if most significant byte of a word is the lowest numbered. | |
361 | The i960 case be either big endian or little endian. We only support | |
362 | little endian, which is the most common. */ | |
363 | #define BYTES_BIG_ENDIAN 0 | |
364 | ||
365 | /* Define this if most significant word of a multiword number is lowest | |
366 | numbered. */ | |
367 | #define WORDS_BIG_ENDIAN 0 | |
368 | ||
ba8ab355 JW |
369 | /* Bitfields cannot cross word boundaries. */ |
370 | #define BITFIELD_NBYTES_LIMITED 1 | |
371 | ||
ba8ab355 JW |
372 | /* Width of a word, in units (bytes). */ |
373 | #define UNITS_PER_WORD 4 | |
374 | ||
87cb2a87 RH |
375 | /* Width in bits of a long double. */ |
376 | #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_64 ? 64 : 128) | |
377 | #define MAX_LONG_DOUBLE_TYPE_SIZE 128 | |
d86037fa | 378 | |
eaa4b44c VM |
379 | /* Define this to set long double type size to use in libgcc2.c, which can |
380 | not depend on target_flags. */ | |
381 | #if defined(__LONG_DOUBLE_64__) | |
382 | #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 | |
383 | #else | |
87cb2a87 | 384 | #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 |
eaa4b44c | 385 | #endif |
ba8ab355 JW |
386 | |
387 | /* Allocation boundary (in *bits*) for storing pointers in memory. */ | |
388 | #define POINTER_BOUNDARY 32 | |
389 | ||
390 | /* Allocation boundary (in *bits*) for storing arguments in argument list. */ | |
391 | #define PARM_BOUNDARY 32 | |
392 | ||
393 | /* Boundary (in *bits*) on which stack pointer should be aligned. */ | |
394 | #define STACK_BOUNDARY 128 | |
395 | ||
396 | /* Allocation boundary (in *bits*) for the code of a function. */ | |
397 | #define FUNCTION_BOUNDARY 128 | |
398 | ||
399 | /* Alignment of field after `int : 0' in a structure. */ | |
400 | #define EMPTY_FIELD_BOUNDARY 32 | |
401 | ||
402 | /* This makes zero-length anonymous fields lay the next field | |
403 | at a word boundary. It also makes the whole struct have | |
404 | at least word alignment if there are any bitfields at all. */ | |
405 | #define PCC_BITFIELD_TYPE_MATTERS 1 | |
406 | ||
407 | /* Every structure's size must be a multiple of this. */ | |
408 | #define STRUCTURE_SIZE_BOUNDARY 8 | |
409 | ||
410 | /* No data type wants to be aligned rounder than this. | |
411 | Extended precision floats gets 4-word alignment. */ | |
412 | #define BIGGEST_ALIGNMENT 128 | |
413 | ||
414 | /* Define this if move instructions will actually fail to work | |
415 | when given unaligned data. | |
416 | 80960 will work even with unaligned data, but it is slow. */ | |
3a011f48 | 417 | #define STRICT_ALIGNMENT TARGET_STRICT_ALIGN |
ba8ab355 JW |
418 | |
419 | /* Specify alignment for string literals (which might be higher than the | |
13d39dbc | 420 | base type's minimal alignment requirement. This allows strings to be |
ba8ab355 JW |
421 | aligned on word boundaries, and optimizes calls to the str* and mem* |
422 | library functions. */ | |
423 | #define CONSTANT_ALIGNMENT(EXP, ALIGN) \ | |
ad237340 | 424 | (TREE_CODE (EXP) == STRING_CST \ |
ad929cd5 | 425 | && i960_object_bytes_bitalign (int_size_in_bytes (TREE_TYPE (EXP))) > (int)(ALIGN) \ |
ba8ab355 | 426 | ? i960_object_bytes_bitalign (int_size_in_bytes (TREE_TYPE (EXP))) \ |
ad929cd5 | 427 | : (int)(ALIGN)) |
ba8ab355 JW |
428 | |
429 | /* Macros to determine size of aggregates (structures and unions | |
430 | in C). Normally, these may be defined to simply return the maximum | |
431 | alignment and simple rounded-up size, but on some machines (like | |
432 | the i960), the total size of a structure is based on a non-trivial | |
433 | rounding method. */ | |
434 | ||
87cb2a87 RH |
435 | #define ROUND_TYPE_ALIGN(TYPE, COMPUTED, SPECIFIED) \ |
436 | i960_round_align (MAX ((COMPUTED), (SPECIFIED)), TYPE) | |
ba8ab355 JW |
437 | \f |
438 | /* Standard register usage. */ | |
439 | ||
440 | /* Number of actual hardware registers. | |
441 | The hardware registers are assigned numbers for the compiler | |
442 | from 0 to just below FIRST_PSEUDO_REGISTER. | |
443 | All registers that the compiler knows about must be given numbers, | |
444 | even those that are not normally considered general registers. | |
445 | ||
446 | Registers 0-15 are the global registers (g0-g15). | |
447 | Registers 16-31 are the local registers (r0-r15). | |
448 | Register 32-35 are the fp registers (fp0-fp3). | |
449 | Register 36 is the condition code register. | |
450 | Register 37 is unused. */ | |
451 | ||
452 | #define FIRST_PSEUDO_REGISTER 38 | |
453 | ||
454 | /* 1 for registers that have pervasive standard uses and are not available | |
455 | for the register allocator. On 80960, this includes the frame pointer | |
456 | (g15), the previous FP (r0), the stack pointer (r1), the return | |
457 | instruction pointer (r2), and the argument pointer (g14). */ | |
458 | #define FIXED_REGISTERS \ | |
459 | {0, 0, 0, 0, 0, 0, 0, 0, \ | |
460 | 0, 0, 0, 0, 0, 0, 1, 1, \ | |
461 | 1, 1, 1, 0, 0, 0, 0, 0, \ | |
462 | 0, 0, 0, 0, 0, 0, 0, 0, \ | |
463 | 0, 0, 0, 0, 1, 1} | |
464 | ||
465 | /* 1 for registers not available across function calls. | |
466 | These must include the FIXED_REGISTERS and also any | |
467 | registers that can be used without being saved. | |
468 | The latter must include the registers where values are returned | |
469 | and the register where structure-value addresses are passed. | |
470 | Aside from that, you can include as many other registers as you like. */ | |
471 | ||
472 | /* On the 80960, note that: | |
473 | g0..g3 are used for return values, | |
474 | g0..g7 may always be used for parameters, | |
475 | g8..g11 may be used for parameters, but are preserved if they aren't, | |
a45f3331 | 476 | g12 is the static chain if needed, otherwise is preserved |
ba8ab355 JW |
477 | g13 is the struct return ptr if used, or temp, but may be trashed, |
478 | g14 is the leaf return ptr or the arg block ptr otherwise zero, | |
479 | must be reset to zero before returning if it was used, | |
480 | g15 is the frame pointer, | |
481 | r0 is the previous FP, | |
482 | r1 is the stack pointer, | |
483 | r2 is the return instruction pointer, | |
484 | r3-r15 are always available, | |
1e39f528 JW |
485 | r3 is clobbered by calls in functions that use the arg pointer |
486 | r4-r11 may be clobbered by the mcount call when profiling | |
487 | r4-r15 if otherwise unused may be used for preserving global registers | |
ba8ab355 JW |
488 | fp0..fp3 are never available. */ |
489 | #define CALL_USED_REGISTERS \ | |
490 | {1, 1, 1, 1, 1, 1, 1, 1, \ | |
491 | 0, 0, 0, 0, 0, 1, 1, 1, \ | |
492 | 1, 1, 1, 0, 0, 0, 0, 0, \ | |
493 | 0, 0, 0, 0, 0, 0, 0, 0, \ | |
494 | 1, 1, 1, 1, 1, 1} | |
495 | ||
496 | /* If no fp unit, make all of the fp registers fixed so that they can't | |
497 | be used. */ | |
498 | #define CONDITIONAL_REGISTER_USAGE \ | |
499 | if (! TARGET_NUMERICS) { \ | |
500 | fixed_regs[32] = fixed_regs[33] = fixed_regs[34] = fixed_regs[35] = 1;\ | |
501 | } \ | |
502 | ||
503 | /* Return number of consecutive hard regs needed starting at reg REGNO | |
504 | to hold something of mode MODE. | |
505 | This is ordinarily the length in words of a value of mode MODE | |
506 | but can be less for certain modes in special long registers. | |
507 | ||
508 | On 80960, ordinary registers hold 32 bits worth, but can be ganged | |
509 | together to hold double or extended precision floating point numbers, | |
510 | and the floating point registers hold any size floating point number */ | |
511 | #define HARD_REGNO_NREGS(REGNO, MODE) \ | |
512 | ((REGNO) < 32 \ | |
513 | ? (((MODE) == VOIDmode) \ | |
514 | ? 1 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)) \ | |
515 | : ((REGNO) < FIRST_PSEUDO_REGISTER) ? 1 : 0) | |
516 | ||
517 | /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. | |
518 | On 80960, the cpu registers can hold any mode but the float registers | |
87cb2a87 | 519 | can only hold SFmode, DFmode, or TFmode. */ |
2129b081 | 520 | #define HARD_REGNO_MODE_OK(REGNO, MODE) hard_regno_mode_ok ((REGNO), (MODE)) |
ba8ab355 JW |
521 | |
522 | /* Value is 1 if it is a good idea to tie two pseudo registers | |
523 | when one has mode MODE1 and one has mode MODE2. | |
524 | If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, | |
525 | for any hard reg, then this must be 0 for correct output. */ | |
526 | ||
527 | #define MODES_TIEABLE_P(MODE1, MODE2) \ | |
528 | ((MODE1) == (MODE2) || GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2)) | |
529 | ||
530 | /* Specify the registers used for certain standard purposes. | |
531 | The values of these macros are register numbers. */ | |
532 | ||
533 | /* 80960 pc isn't overloaded on a register that the compiler knows about. */ | |
534 | /* #define PC_REGNUM */ | |
535 | ||
536 | /* Register to use for pushing function arguments. */ | |
537 | #define STACK_POINTER_REGNUM 17 | |
538 | ||
539 | /* Actual top-of-stack address is same as | |
540 | the contents of the stack pointer register. */ | |
541 | #define STACK_POINTER_OFFSET (-current_function_outgoing_args_size) | |
542 | ||
543 | /* Base register for access to local variables of the function. */ | |
544 | #define FRAME_POINTER_REGNUM 15 | |
545 | ||
546 | /* Value should be nonzero if functions must have frame pointers. | |
547 | Zero means the frame pointer need not be set up (and parms | |
548 | may be accessed via the stack pointer) in functions that seem suitable. | |
549 | This is computed in `reload', in reload1.c. */ | |
43a92256 JW |
550 | /* ??? It isn't clear to me why this is here. Perhaps because of a bug (since |
551 | fixed) in the definition of INITIAL_FRAME_POINTER_OFFSET which would have | |
552 | caused this to fail. */ | |
4f0a3098 DD |
553 | /* ??? Must check current_function_has_nonlocal_goto, otherwise frame pointer |
554 | elimination messes up nonlocal goto sequences. I think this works for other | |
555 | targets because they use indirect jumps for the return which disables fp | |
556 | elimination. */ | |
557 | #define FRAME_POINTER_REQUIRED \ | |
558 | (! leaf_function_p () || current_function_has_nonlocal_goto) | |
ba8ab355 | 559 | |
bcf783f4 VM |
560 | /* Definitions for register eliminations. |
561 | ||
562 | This is an array of structures. Each structure initializes one pair | |
563 | of eliminable registers. The "from" register number is given first, | |
564 | followed by "to". Eliminations of the same "from" register are listed | |
e5837c07 | 565 | in order of preference.. */ |
bcf783f4 VM |
566 | |
567 | #define ELIMINABLE_REGS {{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}} | |
568 | ||
569 | /* Given FROM and TO register numbers, say whether this elimination is allowed. | |
570 | Frame pointer elimination is automatically handled. */ | |
571 | #define CAN_ELIMINATE(FROM, TO) 1 | |
572 | ||
573 | /* Define the offset between two registers, one to be eliminated, and | |
574 | the other its replacement, at the start of a routine. | |
43a92256 JW |
575 | |
576 | Since the stack grows upward on the i960, this must be a negative number. | |
577 | This includes the 64 byte hardware register save area and the size of | |
578 | the frame. */ | |
ba8ab355 | 579 | |
bcf783f4 VM |
580 | #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ |
581 | do { (OFFSET) = - (64 + compute_frame_size (get_frame_size ())); } while (0) | |
ba8ab355 JW |
582 | |
583 | /* Base register for access to arguments of the function. */ | |
584 | #define ARG_POINTER_REGNUM 14 | |
585 | ||
586 | /* Register in which static-chain is passed to a function. | |
a45f3331 JW |
587 | On i960, we use g12. We can't use any local register, because we need |
588 | a register that can be set before a call or before a jump. */ | |
589 | #define STATIC_CHAIN_REGNUM 12 | |
ba8ab355 JW |
590 | |
591 | /* Functions which return large structures get the address | |
592 | to place the wanted value at in g13. */ | |
593 | ||
594 | #define STRUCT_VALUE_REGNUM 13 | |
595 | ||
596 | /* The order in which to allocate registers. */ | |
597 | ||
598 | #define REG_ALLOC_ORDER \ | |
599 | { 4, 5, 6, 7, 0, 1, 2, 3, 13, /* g4, g5, g6, g7, g0, g1, g2, g3, g13 */ \ | |
600 | 20, 21, 22, 23, 24, 25, 26, 27,/* r4, r5, r6, r7, r8, r9, r10, r11 */ \ | |
601 | 28, 29, 30, 31, 19, 8, 9, 10, /* r12, r13, r14, r15, r3, g8, g9, g10 */ \ | |
602 | 11, 12, /* g11, g12 */ \ | |
603 | 32, 33, 34, 35, /* fp0, fp1, fp2, fp3 */ \ | |
604 | /* We can't actually allocate these. */ \ | |
605 | 16, 17, 18, 14, 15, 36, 37} /* r0, r1, r2, g14, g15, cc */ | |
606 | \f | |
607 | /* Define the classes of registers for register constraints in the | |
608 | machine description. Also define ranges of constants. | |
609 | ||
610 | One of the classes must always be named ALL_REGS and include all hard regs. | |
611 | If there is more than one class, another class must be named NO_REGS | |
612 | and contain no registers. | |
613 | ||
614 | The name GENERAL_REGS must be the name of a class (or an alias for | |
615 | another name such as ALL_REGS). This is the class of registers | |
616 | that is allowed by "g" or "r" in a register constraint. | |
617 | Also, registers outside this class are allocated only when | |
618 | instructions express preferences for them. | |
619 | ||
620 | The classes must be numbered in nondecreasing order; that is, | |
621 | a larger-numbered class must never be contained completely | |
622 | in a smaller-numbered class. | |
623 | ||
624 | For any two classes, it is very desirable that there be another | |
625 | class that represents their union. */ | |
626 | ||
627 | /* The 80960 has four kinds of registers, global, local, floating point, | |
628 | and condition code. The cc register is never allocated, so no class | |
629 | needs to be defined for it. */ | |
630 | ||
631 | enum reg_class { NO_REGS, GLOBAL_REGS, LOCAL_REGS, LOCAL_OR_GLOBAL_REGS, | |
632 | FP_REGS, ALL_REGS, LIM_REG_CLASSES }; | |
633 | ||
634 | /* 'r' includes floating point registers if TARGET_NUMERICS. 'd' never | |
635 | does. */ | |
636 | #define GENERAL_REGS ((TARGET_NUMERICS) ? ALL_REGS : LOCAL_OR_GLOBAL_REGS) | |
637 | ||
638 | #define N_REG_CLASSES (int) LIM_REG_CLASSES | |
639 | ||
640 | /* Give names of register classes as strings for dump file. */ | |
641 | ||
642 | #define REG_CLASS_NAMES \ | |
643 | { "NO_REGS", "GLOBAL_REGS", "LOCAL_REGS", "LOCAL_OR_GLOBAL_REGS", \ | |
644 | "FP_REGS", "ALL_REGS" } | |
645 | ||
646 | /* Define which registers fit in which classes. | |
647 | This is an initializer for a vector of HARD_REG_SET | |
648 | of length N_REG_CLASSES. */ | |
649 | ||
650 | #define REG_CLASS_CONTENTS \ | |
651 | { {0, 0}, {0x0ffff, 0}, {0xffff0000, 0}, {-1,0}, {0, -1}, {-1,-1}} | |
652 | ||
653 | /* The same information, inverted: | |
654 | Return the class number of the smallest class containing | |
655 | reg number REGNO. This could be a conditional expression | |
656 | or could index an array. */ | |
657 | ||
658 | #define REGNO_REG_CLASS(REGNO) \ | |
659 | ((REGNO) < 16 ? GLOBAL_REGS \ | |
660 | : (REGNO) < 32 ? LOCAL_REGS \ | |
661 | : (REGNO) < 36 ? FP_REGS \ | |
662 | : NO_REGS) | |
663 | ||
664 | /* The class value for index registers, and the one for base regs. | |
665 | There is currently no difference between base and index registers on the | |
666 | i960, but this distinction may one day be useful. */ | |
667 | #define INDEX_REG_CLASS LOCAL_OR_GLOBAL_REGS | |
668 | #define BASE_REG_CLASS LOCAL_OR_GLOBAL_REGS | |
669 | ||
670 | /* Get reg_class from a letter such as appears in the machine description. | |
671 | 'f' is a floating point register (fp0..fp3) | |
672 | 'l' is a local register (r0-r15) | |
673 | 'b' is a global register (g0-g15) | |
674 | 'd' is any local or global register | |
675 | 'r' or 'g' are pre-defined to the class GENERAL_REGS. */ | |
676 | /* 'l' and 'b' are probably never used. Note that 'd' and 'r' are *not* | |
677 | the same thing, since 'r' may include the fp registers. */ | |
678 | #define REG_CLASS_FROM_LETTER(C) \ | |
679 | (((C) == 'f') && (TARGET_NUMERICS) ? FP_REGS : ((C) == 'l' ? LOCAL_REGS : \ | |
680 | (C) == 'b' ? GLOBAL_REGS : ((C) == 'd' ? LOCAL_OR_GLOBAL_REGS : NO_REGS))) | |
681 | ||
682 | /* The letters I, J, K, L and M in a register constraint string | |
683 | can be used to stand for particular ranges of immediate operands. | |
684 | This macro defines what the ranges are. | |
685 | C is the letter, and VALUE is a constant value. | |
686 | Return 1 if VALUE is in the range specified by C. | |
687 | ||
688 | For 80960: | |
689 | 'I' is used for literal values 0..31 | |
690 | 'J' means literal 0 | |
691 | 'K' means 0..-31. */ | |
692 | ||
693 | #define CONST_OK_FOR_LETTER_P(VALUE, C) \ | |
694 | ((C) == 'I' ? (((unsigned) (VALUE)) <= 31) \ | |
695 | : (C) == 'J' ? ((VALUE) == 0) \ | |
82eaec4a TG |
696 | : (C) == 'K' ? ((VALUE) >= -31 && (VALUE) <= 0) \ |
697 | : (C) == 'M' ? ((VALUE) >= -32 && (VALUE) <= 0) \ | |
698 | : 0) | |
ba8ab355 JW |
699 | |
700 | /* Similar, but for floating constants, and defining letters G and H. | |
701 | Here VALUE is the CONST_DOUBLE rtx itself. | |
702 | For the 80960, G is 0.0 and H is 1.0. */ | |
703 | ||
b6e78be7 TG |
704 | #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ |
705 | ((TARGET_NUMERICS) && \ | |
706 | (((C) == 'G' && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \ | |
707 | || ((C) == 'H' && ((VALUE) == CONST1_RTX (GET_MODE (VALUE)))))) | |
ba8ab355 JW |
708 | |
709 | /* Given an rtx X being reloaded into a reg required to be | |
710 | in class CLASS, return the class of reg to actually use. | |
711 | In general this is just CLASS; but on some machines | |
712 | in some cases it is preferable to use a more restrictive class. */ | |
713 | ||
714 | /* On 960, can't load constant into floating-point reg except | |
715 | 0.0 or 1.0. | |
716 | ||
717 | Any hard reg is ok as a src operand of a reload insn. */ | |
718 | ||
719 | #define PREFERRED_RELOAD_CLASS(X,CLASS) \ | |
720 | (GET_CODE (X) == REG && REGNO (X) < FIRST_PSEUDO_REGISTER \ | |
721 | ? (CLASS) \ | |
722 | : ((CLASS) == FP_REGS && CONSTANT_P (X) \ | |
723 | && (X) != CONST0_RTX (DFmode) && (X) != CONST1_RTX (DFmode)\ | |
724 | && (X) != CONST0_RTX (SFmode) && (X) != CONST1_RTX (SFmode)\ | |
725 | ? NO_REGS \ | |
726 | : (CLASS) == ALL_REGS ? LOCAL_OR_GLOBAL_REGS : (CLASS))) | |
727 | ||
728 | #define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \ | |
729 | secondary_reload_class (CLASS, MODE, IN) | |
730 | ||
731 | /* Return the maximum number of consecutive registers | |
732 | needed to represent mode MODE in a register of class CLASS. */ | |
733 | /* On 80960, this is the size of MODE in words, | |
734 | except in the FP regs, where a single reg is always enough. */ | |
735 | #define CLASS_MAX_NREGS(CLASS, MODE) \ | |
736 | ((CLASS) == FP_REGS ? 1 : HARD_REGNO_NREGS (0, (MODE))) | |
737 | \f | |
738 | /* Stack layout; function entry, exit and calling. */ | |
739 | ||
740 | /* Define this if pushing a word on the stack | |
741 | makes the stack pointer a smaller address. */ | |
742 | /* #define STACK_GROWS_DOWNWARD */ | |
743 | ||
744 | /* Define this if the nominal address of the stack frame | |
745 | is at the high-address end of the local variables; | |
746 | that is, each additional local variable allocated | |
747 | goes at a more negative offset in the frame. */ | |
748 | /* #define FRAME_GROWS_DOWNWARD */ | |
749 | ||
750 | /* Offset within stack frame to start allocating local variables at. | |
751 | If FRAME_GROWS_DOWNWARD, this is the offset to the END of the | |
752 | first local allocated. Otherwise, it is the offset to the BEGINNING | |
753 | of the first local allocated. | |
754 | ||
755 | The i960 has a 64 byte register save area, plus possibly some extra | |
756 | bytes allocated for varargs functions. */ | |
757 | #define STARTING_FRAME_OFFSET 64 | |
758 | ||
759 | /* If we generate an insn to push BYTES bytes, | |
760 | this says how many the stack pointer really advances by. | |
761 | On 80960, don't define this because there are no push insns. */ | |
762 | /* #define PUSH_ROUNDING(BYTES) BYTES */ | |
763 | ||
764 | /* Offset of first parameter from the argument pointer register value. */ | |
765 | #define FIRST_PARM_OFFSET(FNDECL) 0 | |
766 | ||
767 | /* When a parameter is passed in a register, no stack space is | |
768 | allocated for it. However, when args are passed in the | |
769 | stack, space is allocated for every register parameter. */ | |
770 | #define MAYBE_REG_PARM_STACK_SPACE 48 | |
771 | #define FINAL_REG_PARM_STACK_SPACE(CONST_SIZE, VAR_SIZE) \ | |
772 | i960_final_reg_parm_stack_space (CONST_SIZE, VAR_SIZE); | |
773 | #define REG_PARM_STACK_SPACE(DECL) i960_reg_parm_stack_space (DECL) | |
774 | #define OUTGOING_REG_PARM_STACK_SPACE | |
775 | ||
776 | /* Keep the stack pointer constant throughout the function. */ | |
f73ad30e | 777 | #define ACCUMULATE_OUTGOING_ARGS 1 |
ba8ab355 JW |
778 | |
779 | /* Value is 1 if returning from a function call automatically | |
780 | pops the arguments described by the number-of-args field in the call. | |
8b109b37 | 781 | FUNDECL is the declaration node of the function (as a tree), |
ba8ab355 JW |
782 | FUNTYPE is the data type of the function (as a tree), |
783 | or for a library call it is an identifier node for the subroutine name. */ | |
784 | ||
8b109b37 | 785 | #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 |
ba8ab355 JW |
786 | |
787 | /* Define how to find the value returned by a library function | |
788 | assuming the value has mode MODE. */ | |
789 | ||
c5c76735 | 790 | #define LIBCALL_VALUE(MODE) gen_rtx_REG ((MODE), 0) |
ba8ab355 JW |
791 | |
792 | /* 1 if N is a possible register number for a function value | |
793 | as seen by the caller. | |
794 | On 80960, returns are in g0..g3 */ | |
795 | ||
cc5ae869 | 796 | #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0) |
ba8ab355 JW |
797 | |
798 | /* 1 if N is a possible register number for function argument passing. | |
799 | On 80960, parameters are passed in g0..g11 */ | |
800 | ||
801 | #define FUNCTION_ARG_REGNO_P(N) ((N) < 12) | |
802 | ||
803 | /* Perform any needed actions needed for a function that is receiving a | |
804 | variable number of arguments. | |
805 | ||
806 | CUM is as above. | |
807 | ||
808 | MODE and TYPE are the mode and type of the current parameter. | |
809 | ||
810 | PRETEND_SIZE is a variable that should be set to the amount of stack | |
811 | that must be pushed by the prolog to pretend that our caller pushed | |
812 | it. | |
813 | ||
814 | Normally, this macro will push all remaining incoming registers on the | |
815 | stack and set PRETEND_SIZE to the length of the registers pushed. */ | |
816 | ||
817 | #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \ | |
818 | i960_setup_incoming_varargs(&CUM,MODE,TYPE,&PRETEND_SIZE,NO_RTL) | |
c2749e2d | 819 | |
c2749e2d | 820 | /* Implement `va_start' for varargs and stdarg. */ |
e5faf155 ZW |
821 | #define EXPAND_BUILTIN_VA_START(valist, nextarg) \ |
822 | i960_va_start (valist, nextarg) | |
c2749e2d RH |
823 | |
824 | /* Implement `va_arg'. */ | |
825 | #define EXPAND_BUILTIN_VA_ARG(valist, type) \ | |
826 | i960_va_arg (valist, type) | |
ba8ab355 JW |
827 | \f |
828 | /* Define a data type for recording info about an argument list | |
829 | during the scan of that argument list. This data type should | |
830 | hold all necessary information about the function itself | |
831 | and about the args processed so far, enough to enable macros | |
832 | such as FUNCTION_ARG to determine where the next arg should go. | |
833 | ||
834 | On 80960, this is two integers, which count the number of register | |
835 | parameters and the number of stack parameters seen so far. */ | |
836 | ||
837 | struct cum_args { int ca_nregparms; int ca_nstackparms; }; | |
838 | ||
839 | #define CUMULATIVE_ARGS struct cum_args | |
840 | ||
841 | /* Define the number of registers that can hold parameters. | |
842 | This macro is used only in macro definitions below and/or i960.c. */ | |
843 | #define NPARM_REGS 12 | |
844 | ||
845 | /* Define how to round to the next parameter boundary. | |
846 | This macro is used only in macro definitions below and/or i960.c. */ | |
b46db6e4 | 847 | #define ROUND_PARM(X, MULTIPLE_OF) \ |
ba8ab355 JW |
848 | ((((X) + (MULTIPLE_OF) - 1) / (MULTIPLE_OF)) * MULTIPLE_OF) |
849 | ||
850 | /* Initialize a variable CUM of type CUMULATIVE_ARGS | |
851 | for a call to a function whose data type is FNTYPE. | |
852 | For a library call, FNTYPE is 0. | |
853 | ||
854 | On 80960, the offset always starts at 0; the first parm reg is g0. */ | |
855 | ||
2c7ee1a6 | 856 | #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \ |
ba8ab355 JW |
857 | ((CUM).ca_nregparms = 0, (CUM).ca_nstackparms = 0) |
858 | ||
859 | /* Update the data in CUM to advance over an argument | |
860 | of mode MODE and data type TYPE. | |
861 | CUM should be advanced to align with the data type accessed and | |
862 | also the size of that data type in # of regs. | |
863 | (TYPE is null for libcalls where that information may not be available.) */ | |
864 | ||
865 | #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ | |
866 | i960_function_arg_advance(&CUM, MODE, TYPE, NAMED) | |
867 | ||
868 | /* Indicate the alignment boundary for an argument of the specified mode and | |
869 | type. */ | |
870 | #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \ | |
29008b51 JW |
871 | (((TYPE) != 0) \ |
872 | ? ((TYPE_ALIGN (TYPE) <= PARM_BOUNDARY) \ | |
873 | ? PARM_BOUNDARY \ | |
874 | : TYPE_ALIGN (TYPE)) \ | |
875 | : ((GET_MODE_ALIGNMENT (MODE) <= PARM_BOUNDARY) \ | |
876 | ? PARM_BOUNDARY \ | |
877 | : GET_MODE_ALIGNMENT (MODE))) | |
ba8ab355 JW |
878 | |
879 | /* Determine where to put an argument to a function. | |
880 | Value is zero to push the argument on the stack, | |
881 | or a hard register in which to store the argument. | |
882 | ||
883 | MODE is the argument's machine mode. | |
884 | TYPE is the data type of the argument (as a tree). | |
885 | This is null for libcalls where that information may | |
886 | not be available. | |
887 | CUM is a variable of type CUMULATIVE_ARGS which gives info about | |
888 | the preceding args and about the function being called. | |
889 | NAMED is nonzero if this argument is a named parameter | |
890 | (otherwise it is an extra parameter matching an ellipsis). */ | |
891 | ||
ba8ab355 JW |
892 | #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ |
893 | i960_function_arg(&CUM, MODE, TYPE, NAMED) | |
894 | ||
895 | /* Define how to find the value returned by a function. | |
896 | VALTYPE is the data type of the value (as a tree). | |
897 | If the precise function being called is known, FUNC is its FUNCTION_DECL; | |
898 | otherwise, FUNC is 0. */ | |
899 | ||
254f7d80 | 900 | #define FUNCTION_VALUE(TYPE, FUNC) \ |
c5c76735 | 901 | gen_rtx_REG (TYPE_MODE (TYPE), 0) |
ba8ab355 | 902 | |
e14fa9c4 DE |
903 | /* Force aggregates and objects larger than 16 bytes to be returned in memory, |
904 | since we only have 4 registers available for return values. */ | |
ba8ab355 | 905 | |
e14fa9c4 DE |
906 | #define RETURN_IN_MEMORY(TYPE) \ |
907 | (TYPE_MODE (TYPE) == BLKmode || int_size_in_bytes (TYPE) > 16) | |
ba8ab355 | 908 | |
40f32220 JW |
909 | /* Don't default to pcc-struct-return, because we have already specified |
910 | exactly how to return structures in the RETURN_IN_MEMORY macro. */ | |
911 | #define DEFAULT_PCC_STRUCT_RETURN 0 | |
912 | ||
ba8ab355 JW |
913 | /* For an arg passed partly in registers and partly in memory, |
914 | this is the number of registers used. | |
915 | This never happens on 80960. */ | |
916 | ||
917 | #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0 | |
918 | \f | |
919 | /* Output the label for a function definition. | |
920 | This handles leaf functions and a few other things for the i960. */ | |
921 | ||
922 | #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ | |
923 | i960_function_name_declare (FILE, NAME, DECL) | |
924 | ||
ba8ab355 JW |
925 | /* Output assembler code to FILE to increment profiler label # LABELNO |
926 | for profiling a function entry. */ | |
927 | ||
1e39f528 JW |
928 | #define FUNCTION_PROFILER(FILE, LABELNO) \ |
929 | output_function_profiler ((FILE), (LABELNO)); | |
ba8ab355 JW |
930 | |
931 | /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, | |
932 | the stack pointer does not matter. The value is tested only in | |
933 | functions that have frame pointers. | |
934 | No definition is equivalent to always zero. */ | |
935 | ||
936 | #define EXIT_IGNORE_STACK 1 | |
ba8ab355 JW |
937 | \f |
938 | /* Addressing modes, and classification of registers for them. */ | |
939 | ||
ba8ab355 JW |
940 | /* Macros to check register numbers against specific register classes. */ |
941 | ||
942 | /* These assume that REGNO is a hard or pseudo reg number. | |
943 | They give nonzero only if REGNO is a hard reg of the suitable class | |
944 | or a pseudo reg currently allocated to a suitable hard reg. | |
945 | Since they use reg_renumber, they are safe only once reg_renumber | |
946 | has been allocated, which happens in local-alloc.c. */ | |
947 | ||
948 | #define REGNO_OK_FOR_INDEX_P(REGNO) \ | |
949 | ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32) | |
950 | #define REGNO_OK_FOR_BASE_P(REGNO) \ | |
951 | ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32) | |
952 | #define REGNO_OK_FOR_FP_P(REGNO) \ | |
953 | ((REGNO) < 36 || (unsigned) reg_renumber[REGNO] < 36) | |
954 | ||
955 | /* Now macros that check whether X is a register and also, | |
956 | strictly, whether it is in a specified class. | |
957 | ||
958 | These macros are specific to the 960, and may be used only | |
959 | in code for printing assembler insns and in conditions for | |
960 | define_optimization. */ | |
961 | ||
962 | /* 1 if X is an fp register. */ | |
963 | ||
964 | #define FP_REG_P(X) (REGNO (X) >= 32 && REGNO (X) < 36) | |
965 | ||
966 | /* Maximum number of registers that can appear in a valid memory address. */ | |
967 | #define MAX_REGS_PER_ADDRESS 2 | |
968 | ||
6eff269e BK |
969 | #define CONSTANT_ADDRESS_P(X) \ |
970 | (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ | |
971 | || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \ | |
972 | || GET_CODE (X) == HIGH) | |
ba8ab355 JW |
973 | |
974 | /* LEGITIMATE_CONSTANT_P is nonzero if the constant value X | |
975 | is a legitimate general operand. | |
976 | It is given that X satisfies CONSTANT_P. | |
977 | ||
819f6d59 JW |
978 | Anything but a CONST_DOUBLE can be made to work, excepting 0.0 and 1.0. |
979 | ||
980 | ??? This probably should be defined to 1. */ | |
ba8ab355 JW |
981 | |
982 | #define LEGITIMATE_CONSTANT_P(X) \ | |
819f6d59 | 983 | ((GET_CODE (X) != CONST_DOUBLE) || fp_literal ((X), GET_MODE (X))) |
ba8ab355 JW |
984 | |
985 | /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx | |
986 | and check its validity for a certain class. | |
987 | We have two alternate definitions for each of them. | |
988 | The usual definition accepts all pseudo regs; the other rejects | |
989 | them unless they have been allocated suitable hard regs. | |
990 | The symbol REG_OK_STRICT causes the latter definition to be used. | |
991 | ||
992 | Most source files want to accept pseudo regs in the hope that | |
993 | they will get allocated to the class that the insn wants them to be in. | |
994 | Source files for reload pass need to be strict. | |
995 | After reload, it makes no difference, since pseudo regs have | |
996 | been eliminated by then. */ | |
997 | ||
998 | #ifndef REG_OK_STRICT | |
999 | ||
1000 | /* Nonzero if X is a hard reg that can be used as an index | |
1001 | or if it is a pseudo reg. */ | |
1002 | #define REG_OK_FOR_INDEX_P(X) \ | |
1003 | (REGNO (X) < 32 || REGNO (X) >= FIRST_PSEUDO_REGISTER) | |
1004 | /* Nonzero if X is a hard reg that can be used as a base reg | |
1005 | or if it is a pseudo reg. */ | |
1006 | #define REG_OK_FOR_BASE_P(X) \ | |
1007 | (REGNO (X) < 32 || REGNO (X) >= FIRST_PSEUDO_REGISTER) | |
1008 | ||
1009 | #define REG_OK_FOR_INDEX_P_STRICT(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) | |
1010 | #define REG_OK_FOR_BASE_P_STRICT(X) REGNO_OK_FOR_BASE_P (REGNO (X)) | |
1011 | ||
1012 | #else | |
1013 | ||
1014 | /* Nonzero if X is a hard reg that can be used as an index. */ | |
1015 | #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) | |
1016 | /* Nonzero if X is a hard reg that can be used as a base reg. */ | |
1017 | #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) | |
1018 | ||
1019 | #endif | |
1020 | \f | |
1021 | /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression | |
1022 | that is a valid memory address for an instruction. | |
1023 | The MODE argument is the machine mode for the MEM expression | |
1024 | that wants to use this address. | |
1025 | ||
1026 | On 80960, legitimate addresses are: | |
1027 | base ld (g0),r0 | |
1028 | disp (12 or 32 bit) ld foo,r0 | |
1029 | base + index ld (g0)[g1*1],r0 | |
1030 | base + displ ld 0xf00(g0),r0 | |
1031 | base + index*scale + displ ld 0xf00(g0)[g1*4],r0 | |
1032 | index*scale + base ld (g0)[g1*4],r0 | |
1033 | index*scale + displ ld 0xf00[g1*4],r0 | |
1034 | index*scale ld [g1*4],r0 | |
1035 | index + base + displ ld 0xf00(g0)[g1*1],r0 | |
1036 | ||
1037 | In each case, scale can be 1, 2, 4, 8, or 16. */ | |
1038 | ||
e5837c07 | 1039 | /* Returns 1 if the scale factor of an index term is valid. */ |
ba8ab355 JW |
1040 | #define SCALE_TERM_P(X) \ |
1041 | (GET_CODE (X) == CONST_INT \ | |
1042 | && (INTVAL (X) == 1 || INTVAL (X) == 2 || INTVAL (X) == 4 \ | |
1043 | || INTVAL(X) == 8 || INTVAL (X) == 16)) | |
1044 | ||
1045 | ||
1046 | #ifdef REG_OK_STRICT | |
1047 | #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ | |
1048 | { if (legitimate_address_p (MODE, X, 1)) goto ADDR; } | |
1049 | #else | |
1050 | #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ | |
1051 | { if (legitimate_address_p (MODE, X, 0)) goto ADDR; } | |
1052 | #endif | |
1053 | \f | |
1054 | /* Try machine-dependent ways of modifying an illegitimate address | |
1055 | to be legitimate. If we find one, return the new, valid address. | |
1056 | This macro is used in only one place: `memory_address' in explow.c. | |
1057 | ||
1058 | OLDX is the address as it was before break_out_memory_refs was called. | |
1059 | In some cases it is useful to look at this to decide what needs to be done. | |
1060 | ||
1061 | MODE and WIN are passed so that this macro can use | |
1062 | GO_IF_LEGITIMATE_ADDRESS. | |
1063 | ||
1064 | It is always safe for this macro to do nothing. It exists to recognize | |
1065 | opportunities to optimize the output. */ | |
1066 | ||
13d39dbc | 1067 | /* On 80960, convert non-canonical addresses to canonical form. */ |
ba8ab355 | 1068 | |
ba8ab355 JW |
1069 | #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \ |
1070 | { rtx orig_x = (X); \ | |
1071 | (X) = legitimize_address (X, OLDX, MODE); \ | |
1072 | if ((X) != orig_x && memory_address_p (MODE, X)) \ | |
1073 | goto WIN; } | |
1074 | ||
1075 | /* Go to LABEL if ADDR (a legitimate address expression) | |
1076 | has an effect that depends on the machine mode it is used for. | |
1077 | On the 960 this is never true. */ | |
1078 | ||
1079 | #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) | |
1080 | \f | |
1081 | /* Specify the machine mode that this machine uses | |
1082 | for the index in the tablejump instruction. */ | |
1083 | #define CASE_VECTOR_MODE SImode | |
1084 | ||
18543a22 ILT |
1085 | /* Define as C expression which evaluates to nonzero if the tablejump |
1086 | instruction expects the table to contain offsets from the address of the | |
1087 | table. | |
e5837c07 | 1088 | Do not define this if the table should contain absolute addresses. */ |
18543a22 | 1089 | /* #define CASE_VECTOR_PC_RELATIVE 1 */ |
ba8ab355 | 1090 | |
ba8ab355 JW |
1091 | /* Define this as 1 if `char' should by default be signed; else as 0. */ |
1092 | #define DEFAULT_SIGNED_CHAR 0 | |
1093 | ||
ba8ab355 JW |
1094 | /* Max number of bytes we can move from memory to memory |
1095 | in one reasonably fast instruction. */ | |
1096 | #define MOVE_MAX 16 | |
1097 | ||
9a63901f RK |
1098 | /* Define if operations between registers always perform the operation |
1099 | on the full register even if a narrower mode is specified. */ | |
1100 | #define WORD_REGISTER_OPERATIONS | |
1101 | ||
1102 | /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD | |
1103 | will either zero-extend or sign-extend. The value of this macro should | |
1104 | be the code that says which one of the two operations is implicitly | |
1105 | done, NIL if none. */ | |
1106 | #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND | |
ba8ab355 JW |
1107 | |
1108 | /* Nonzero if access to memory by bytes is no faster than for words. | |
43a88a8c | 1109 | Value changed to 1 after reports of poor bit-field code with g++. |
e5837c07 | 1110 | Indications are that code is usually as good, sometimes better. */ |
ba8ab355 | 1111 | |
8a21007c | 1112 | #define SLOW_BYTE_ACCESS 1 |
ba8ab355 | 1113 | |
d969caf8 | 1114 | /* Define this to be nonzero if shift instructions ignore all but the low-order |
e5837c07 | 1115 | few bits. */ |
82eaec4a | 1116 | #define SHIFT_COUNT_TRUNCATED 0 |
ba8ab355 JW |
1117 | |
1118 | /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits | |
1119 | is done just by pretending it is already truncated. */ | |
1120 | #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 | |
1121 | ||
1122 | /* Specify the machine mode that pointers have. | |
1123 | After generation of rtl, the compiler makes no further distinction | |
1124 | between pointers and any other objects of this machine mode. */ | |
1125 | #define Pmode SImode | |
1126 | ||
1127 | /* Specify the widest mode that BLKmode objects can be promoted to */ | |
1128 | #define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TImode) | |
1129 | \f | |
1130 | /* These global variables are used to pass information between | |
1131 | cc setter and cc user at insn emit time. */ | |
1132 | ||
1133 | extern struct rtx_def *i960_compare_op0, *i960_compare_op1; | |
1134 | ||
ba8ab355 JW |
1135 | /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, |
1136 | return the mode to be used for the comparison. For floating-point, CCFPmode | |
1137 | should be used. CC_NOOVmode should be used when the first operand is a | |
1138 | PLUS, MINUS, or NEG. CCmode should be used when no special processing is | |
1139 | needed. */ | |
c3eebffb | 1140 | #define SELECT_CC_MODE(OP,X,Y) select_cc_mode (OP, X) |
ba8ab355 JW |
1141 | |
1142 | /* A function address in a call instruction is a byte address | |
1143 | (for indexing purposes) so give the MEM rtx a byte's mode. */ | |
1144 | #define FUNCTION_MODE SImode | |
1145 | ||
1146 | /* Define this if addresses of constant functions | |
1147 | shouldn't be put through pseudo regs where they can be cse'd. | |
1148 | Desirable on machines where ordinary constants are expensive | |
1149 | but a CALL with constant address is cheap. */ | |
1150 | #define NO_FUNCTION_CSE | |
1151 | ||
1152 | /* Use memcpy, etc. instead of bcopy. */ | |
1153 | ||
1154 | #ifndef WIND_RIVER | |
1155 | #define TARGET_MEM_FUNCTIONS 1 | |
1156 | #endif | |
ba8ab355 JW |
1157 | \f |
1158 | /* Control the assembler format that we output. */ | |
1159 | ||
ba8ab355 JW |
1160 | /* Output to assembler file text saying following lines |
1161 | may contain character constants, extra white space, comments, etc. */ | |
1162 | ||
1163 | #define ASM_APP_ON "" | |
1164 | ||
1165 | /* Output to assembler file text saying following lines | |
1166 | no longer contain unusual constructs. */ | |
1167 | ||
1168 | #define ASM_APP_OFF "" | |
1169 | ||
1170 | /* Output before read-only data. */ | |
1171 | ||
de323aa1 | 1172 | #define TEXT_SECTION_ASM_OP "\t.text" |
ba8ab355 JW |
1173 | |
1174 | /* Output before writable data. */ | |
1175 | ||
de323aa1 | 1176 | #define DATA_SECTION_ASM_OP "\t.data" |
ba8ab355 JW |
1177 | |
1178 | /* How to refer to registers in assembler output. | |
1179 | This sequence is indexed by compiler's hard-register-number (see above). */ | |
1180 | ||
1181 | #define REGISTER_NAMES { \ | |
1182 | "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \ | |
1183 | "g8", "g9", "g10", "g11", "g12", "g13", "g14", "fp", \ | |
1184 | "pfp","sp", "rip", "r3", "r4", "r5", "r6", "r7", \ | |
1185 | "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ | |
1186 | "fp0","fp1","fp2", "fp3", "cc", "fake" } | |
1187 | ||
1188 | /* How to renumber registers for dbx and gdb. | |
1189 | In the 960 encoding, g0..g15 are registers 16..31. */ | |
1190 | ||
1191 | #define DBX_REGISTER_NUMBER(REGNO) \ | |
1192 | (((REGNO) < 16) ? (REGNO) + 16 \ | |
1193 | : (((REGNO) > 31) ? (REGNO) : (REGNO) - 16)) | |
1194 | ||
1195 | /* Don't emit dbx records longer than this. This is an arbitrary value. */ | |
1196 | #define DBX_CONTIN_LENGTH 1500 | |
1197 | ||
1198 | /* This is how to output a note to DBX telling it the line number | |
e5837c07 | 1199 | to which the following sequence of instructions corresponds. */ |
ba8ab355 | 1200 | |
a8d0467e | 1201 | #define ASM_OUTPUT_SOURCE_LINE(FILE, LINE, COUNTER) \ |
ba8ab355 JW |
1202 | { if (write_symbols == SDB_DEBUG) { \ |
1203 | fprintf ((FILE), "\t.ln %d\n", \ | |
1204 | (sdb_begin_function_line \ | |
1205 | ? (LINE) - sdb_begin_function_line : 1)); \ | |
1206 | } else if (write_symbols == DBX_DEBUG) { \ | |
1207 | fprintf((FILE),"\t.stabd 68,0,%d\n",(LINE)); \ | |
1208 | } } | |
1209 | ||
506a61b1 KG |
1210 | /* Globalizing directive for a label. */ |
1211 | #define GLOBAL_ASM_OP "\t.globl " | |
ba8ab355 | 1212 | |
e5837c07 | 1213 | /* The prefix to add to user-visible assembler symbols. */ |
ba8ab355 | 1214 | |
4e0c8ad2 | 1215 | #define USER_LABEL_PREFIX "_" |
ba8ab355 | 1216 | |
ba8ab355 JW |
1217 | /* This is how to store into the string LABEL |
1218 | the symbol_ref name of an internal numbered label where | |
1219 | PREFIX is the class of label and NUM is the number within the class. | |
1220 | This is suitable for output with `assemble_name'. */ | |
1221 | ||
1222 | #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ | |
74eda121 | 1223 | sprintf (LABEL, "*%s%lu", PREFIX, (unsigned long)(NUM)) |
ba8ab355 | 1224 | |
ba8ab355 JW |
1225 | #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ |
1226 | fprintf (FILE, "\tst\t%s,(sp)\n\taddo\t4,sp,sp\n", reg_names[REGNO]) | |
1227 | ||
1228 | /* This is how to output an insn to pop a register from the stack. | |
1229 | It need not be very fast code. */ | |
1230 | ||
1231 | #define ASM_OUTPUT_REG_POP(FILE,REGNO) \ | |
1232 | fprintf (FILE, "\tsubo\t4,sp,sp\n\tld\t(sp),%s\n", reg_names[REGNO]) | |
1233 | ||
1234 | /* This is how to output an element of a case-vector that is absolute. */ | |
1235 | ||
1236 | #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ | |
1237 | fprintf (FILE, "\t.word L%d\n", VALUE) | |
1238 | ||
1239 | /* This is how to output an element of a case-vector that is relative. */ | |
1240 | ||
33f7f353 | 1241 | #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ |
ba8ab355 JW |
1242 | fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL) |
1243 | ||
1244 | /* This is how to output an assembler line that says to advance the | |
1245 | location counter to a multiple of 2**LOG bytes. */ | |
1246 | ||
1247 | #define ASM_OUTPUT_ALIGN(FILE,LOG) \ | |
1248 | fprintf (FILE, "\t.align %d\n", (LOG)) | |
1249 | ||
1250 | #define ASM_OUTPUT_SKIP(FILE,SIZE) \ | |
58e15542 | 1251 | fprintf (FILE, "\t.space %d\n", (int)(SIZE)) |
ba8ab355 JW |
1252 | |
1253 | /* This says how to output an assembler line | |
1254 | to define a global common symbol. */ | |
1255 | ||
1256 | /* For common objects, output unpadded size... gld960 & lnk960 both | |
1257 | have code to align each common object at link time. Also, if size | |
1258 | is 0, treat this as a declaration, not a definition - i.e., | |
1259 | do nothing at all. */ | |
1260 | ||
1261 | #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ | |
1262 | { if ((SIZE) != 0) \ | |
1263 | { \ | |
1264 | fputs (".globl ", (FILE)), \ | |
1265 | assemble_name ((FILE), (NAME)), \ | |
1266 | fputs ("\n.comm ", (FILE)), \ | |
1267 | assemble_name ((FILE), (NAME)), \ | |
58e15542 | 1268 | fprintf ((FILE), ",%d\n", (int)(SIZE)); \ |
ba8ab355 JW |
1269 | } \ |
1270 | } | |
1271 | ||
1272 | /* This says how to output an assembler line to define a local common symbol. | |
1273 | Output unpadded size, with request to linker to align as requested. | |
1274 | 0 size should not be possible here. */ | |
1275 | ||
1276 | #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ | |
1277 | ( fputs (".bss\t", (FILE)), \ | |
1278 | assemble_name ((FILE), (NAME)), \ | |
58e15542 | 1279 | fprintf ((FILE), ",%d,%d\n", (int)(SIZE), \ |
0ce200e5 JM |
1280 | (floor_log2 ((ALIGN) / BITS_PER_UNIT)))) |
1281 | ||
1282 | /* A C statement (sans semicolon) to output to the stdio stream | |
1283 | FILE the assembler definition of uninitialized global DECL named | |
1284 | NAME whose size is SIZE bytes and alignment is ALIGN bytes. | |
1285 | Try to use asm_output_aligned_bss to implement this macro. */ | |
1286 | ||
1287 | #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ | |
1288 | do { \ | |
0ce200e5 JM |
1289 | ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \ |
1290 | } while (0) | |
ba8ab355 JW |
1291 | |
1292 | /* Output text for an #ident directive. */ | |
1293 | #define ASM_OUTPUT_IDENT(FILE, STR) fprintf(FILE, "\t# %s\n", STR); | |
1294 | ||
1295 | /* Align code to 8 byte boundary if TARGET_CODE_ALIGN is true. */ | |
1296 | ||
fc470718 | 1297 | #define LABEL_ALIGN_AFTER_BARRIER(LABEL) (TARGET_CODE_ALIGN ? 3 : 0) |
ba8ab355 | 1298 | |
ba8ab355 | 1299 | \f |
ba8ab355 JW |
1300 | /* Print operand X (an rtx) in assembler syntax to file FILE. |
1301 | CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. | |
1302 | For `%' followed by punctuation, CODE is the punctuation and X is null. */ | |
1303 | ||
1304 | #define PRINT_OPERAND(FILE, X, CODE) \ | |
1305 | i960_print_operand (FILE, X, CODE); | |
1306 | ||
1307 | /* Print a memory address as an operand to reference that memory location. */ | |
1308 | ||
1309 | #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ | |
1310 | i960_print_operand_addr (FILE, ADDR) | |
eb9c1bb6 RH |
1311 | |
1312 | /* Determine which codes are valid without a following integer. These must | |
1313 | not be alphabetic (the characters are chosen so that | |
1314 | PRINT_OPERAND_PUNCT_VALID_P translates into a simple range change when | |
1315 | using ASCII). */ | |
1316 | ||
1317 | #define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '+') | |
ba8ab355 JW |
1318 | \f |
1319 | /* Output assembler code for a block containing the constant parts | |
1320 | of a trampoline, leaving space for the variable parts. */ | |
1321 | ||
1322 | /* On the i960, the trampoline contains three instructions: | |
1323 | ldconst _function, r4 | |
a45f3331 | 1324 | ldconst static addr, g12 |
ba8ab355 JW |
1325 | jump (r4) */ |
1326 | ||
1327 | #define TRAMPOLINE_TEMPLATE(FILE) \ | |
1328 | { \ | |
301d03af RS |
1329 | assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x8C203000)); \ |
1330 | assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x00000000)); \ | |
1331 | assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x8CE03000)); \ | |
1332 | assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x00000000)); \ | |
1333 | assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x84212000)); \ | |
ba8ab355 JW |
1334 | } |
1335 | ||
1336 | /* Length in units of the trampoline for entering a nested function. */ | |
1337 | ||
1338 | #define TRAMPOLINE_SIZE 20 | |
1339 | ||
1340 | /* Emit RTL insns to initialize the variable parts of a trampoline. | |
1341 | FNADDR is an RTX for the address of the function's pure code. | |
1342 | CXT is an RTX for the static chain value for the function. */ | |
1343 | ||
1344 | #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ | |
1345 | { \ | |
c5c76735 JL |
1346 | emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 4)), FNADDR); \ |
1347 | emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 12)), CXT); \ | |
ba8ab355 JW |
1348 | } |
1349 | ||
0bc02db4 MS |
1350 | /* Generate RTL to flush the register windows so as to make arbitrary frames |
1351 | available. */ | |
1352 | #define SETUP_FRAME_ADDRESSES() \ | |
1353 | emit_insn (gen_flush_register_windows ()) | |
1354 | ||
1355 | #define BUILTIN_SETJMP_FRAME_VALUE hard_frame_pointer_rtx | |
1356 | ||
ba8ab355 | 1357 | #if 0 |
13d39dbc | 1358 | /* Promote char and short arguments to ints, when want compatibility with |
ba8ab355 JW |
1359 | the iC960 compilers. */ |
1360 | ||
1361 | /* ??? In order for this to work, all users would need to be changed | |
1362 | to test the value of the macro at run time. */ | |
1363 | #define PROMOTE_PROTOTYPES TARGET_CLEAN_LINKAGE | |
1364 | /* ??? This does not exist. */ | |
1365 | #define PROMOTE_RETURN TARGET_CLEAN_LINKAGE | |
1366 | #endif | |
1367 | ||
1368 | /* Instruction type definitions. Used to alternate instructions types for | |
1369 | better performance on the C series chips. */ | |
1370 | ||
1371 | enum insn_types { I_TYPE_REG, I_TYPE_MEM, I_TYPE_CTRL }; | |
1372 | ||
1373 | /* Holds the insn type of the last insn output to the assembly file. */ | |
1374 | ||
1375 | extern enum insn_types i960_last_insn_type; | |
1376 | ||
1377 | /* Parse opcodes, and set the insn last insn type based on them. */ | |
1378 | ||
1379 | #define ASM_OUTPUT_OPCODE(FILE, INSN) i960_scan_opcode (INSN) | |
1380 | ||
1381 | /* Table listing what rtl codes each predicate in i960.c will accept. */ | |
1382 | ||
1383 | #define PREDICATE_CODES \ | |
1384 | {"fpmove_src_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \ | |
1385 | LABEL_REF, SUBREG, REG, MEM}}, \ | |
1386 | {"arith_operand", {SUBREG, REG, CONST_INT}}, \ | |
82eaec4a | 1387 | {"logic_operand", {SUBREG, REG, CONST_INT}}, \ |
ba8ab355 JW |
1388 | {"fp_arith_operand", {SUBREG, REG, CONST_DOUBLE}}, \ |
1389 | {"signed_arith_operand", {SUBREG, REG, CONST_INT}}, \ | |
1390 | {"literal", {CONST_INT}}, \ | |
1391 | {"fp_literal_one", {CONST_DOUBLE}}, \ | |
1392 | {"fp_literal_double", {CONST_DOUBLE}}, \ | |
1393 | {"fp_literal", {CONST_DOUBLE}}, \ | |
1394 | {"signed_literal", {CONST_INT}}, \ | |
1395 | {"symbolic_memory_operand", {SUBREG, MEM}}, \ | |
1396 | {"eq_or_neq", {EQ, NE}}, \ | |
1397 | {"arith32_operand", {SUBREG, REG, LABEL_REF, SYMBOL_REF, CONST_INT, \ | |
1398 | CONST_DOUBLE, CONST}}, \ | |
f8634644 RK |
1399 | {"power2_operand", {CONST_INT}}, \ |
1400 | {"cmplpower2_operand", {CONST_INT}}, | |
ba8ab355 | 1401 | |
778ebe62 JW |
1402 | /* Defined in reload.c, and used in insn-recog.c. */ |
1403 | ||
1404 | extern int rtx_equal_function_value_matters; |