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