OSDN Git Service

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