OSDN Git Service

Fix copyright
[pf3gnuchains/gcc-fork.git] / gcc / config / a29k / a29k.h
1 /* Definitions of target machine for GNU compiler, for AMD Am29000 CPU.
2    Copyright (C) 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3    2000 Free Software Foundation, Inc.
4    Contributed by Richard Kenner (kenner@nyu.edu)
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23
24 /* Names to predefine in the preprocessor for this target machine.  */
25
26 #define CPP_PREDEFINES "-D_AM29K -D_AM29000 -D_EPI -Acpu(a29k) -Amachine(a29k)"
27
28 /* Print subsidiary information on the compiler version in use.  */
29 #define TARGET_VERSION
30
31 /* Pass -w to assembler.  */
32 #define ASM_SPEC "-w"
33
34 /* Run-time compilation parameters selecting different hardware subsets.  */
35
36 extern int target_flags;
37
38 /* Macro to define tables used to set the flags.
39    This is a list in braces of pairs in braces,
40    each pair being { "NAME", VALUE }
41    where VALUE is the bits to set or minus the bits to clear.
42    An empty string NAME is used to identify the default VALUE.  */
43
44 /* This means that the DW bit will be enabled, to allow direct loads
45    of bytes.  */
46
47 #define TARGET_DW_ENABLE        (target_flags & 1)
48
49 /* This means that the external hardware does supports byte writes.  */
50
51 #define TARGET_BYTE_WRITES      (target_flags & 2)
52
53 /* This means that a "small memory model" has been selected where all
54    function addresses are known to be within 256K.  This allows CALL to be
55    used.  */
56
57 #define TARGET_SMALL_MEMORY     (target_flags & 4)
58
59 /* This means that we must always used on indirect call, even when
60    calling a function in the same file, since the file might be > 256KB.  */
61
62 #define TARGET_LARGE_MEMORY     (target_flags & 8)
63
64 /* This means that we are compiling for a 29050.  */
65
66 #define TARGET_29050            (target_flags & 16)
67
68 /* This means that we are compiling for the kernel which means that we use
69    gr64-gr95 instead of gr96-126.  */
70
71 #define TARGET_KERNEL_REGISTERS (target_flags & 32)
72
73 /* This means that a call to "__msp_check" should be inserted after each stack
74    adjustment to check for stack overflow.  */
75
76 #define TARGET_STACK_CHECK      (target_flags & 64)
77
78 /* This handles 29k processors which cannot handle the separation
79    of a mtsrim insns and a storem insn (most 29000 chips to date, but
80    not the 29050.  */
81
82 #define TARGET_NO_STOREM_BUG    (target_flags & 128)
83
84 /* This forces the compiler not to use incoming argument registers except
85    for copying out arguments.  It helps detect problems when a function is
86    called with fewer arguments than it is declared with.  */
87
88 #define TARGET_NO_REUSE_ARGS    (target_flags & 256)
89
90 /* This means that neither builtin nor emulated float operations are
91    available, and that GCC should generate libcalls instead. */
92
93 #define TARGET_SOFT_FLOAT       (target_flags & 512)
94
95 /* This means that we should not emit the multm or mutmu instructions
96    that some embedded systems' trap handlers don't support.  */
97
98 #define TARGET_MULTM            ((target_flags & 1024) == 0)
99
100 #define TARGET_SWITCHES                 \
101   { {"dw", 1, "Generate code assuming DW bit is set"},                  \
102     {"ndw", -1, "Generate code assuming DW bit is not set"},            \
103     {"bw", 2, "Generate code using byte writes"},                       \
104     {"nbw", - (1|2), "Do not generate byte writes"},                    \
105     {"small", 4, "Use small memory model"},                             \
106     {"normal", - (4|8), "Use normal memory model"},                     \
107     {"large", 8, "Use large memory model"},                             \
108     {"29050", 16+128, "Generate 29050 code"},                           \
109     {"29000", -16, "Generate 29000 code"},                              \
110     {"kernel-registers", 32, "Use kernel global registers"},            \
111     {"user-registers", -32, "Use user global registers"},               \
112     {"stack-check", 64, "Emit stack checking code"},                    \
113     {"no-stack-check", - 74, "Do not emit stack checking code"},        \
114     {"storem-bug", -128, "Work around storem hardware bug"},            \
115     {"no-storem-bug", 128, "Do not work around storem hardware bug"},   \
116     {"reuse-arg-regs", -256, "Store locals in argument registers"},     \
117     {"no-reuse-arg-regs", 256, "Do not store locals in arg registers"}, \
118     {"soft-float", 512, "Use software floating point"},                 \
119     {"no-multm", 1024, "Do not generate multm instructions"},           \
120     {"", TARGET_DEFAULT, NULL}}
121
122 #define TARGET_DEFAULT 3
123
124 /* Show we can debug even without a frame pointer.  */
125 #define CAN_DEBUG_WITHOUT_FP
126 \f
127 /* target machine storage layout */
128
129 /* Define the types for size_t, ptrdiff_t, and wchar_t.  These are the
130    same as those used by EPI.  The type for wchar_t does not make much
131    sense, but is what is used.  */
132
133 #define SIZE_TYPE "unsigned int"
134 #define PTRDIFF_TYPE "int"
135 #define WCHAR_TYPE "char"
136 #define WCHAR_TYPE_SIZE BITS_PER_UNIT
137
138 /* Define this macro if it is advisable to hold scalars in registers
139    in a wider mode than that declared by the program.  In such cases, 
140    the value is constrained to be within the bounds of the declared
141    type, but kept valid in the wider mode.  The signedness of the
142    extension may differ from that of the type.  */
143
144 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE)  \
145   if (GET_MODE_CLASS (MODE) == MODE_INT \
146       && GET_MODE_SIZE (MODE) < 4)      \
147     (MODE) = SImode;
148
149 /* Define this if most significant bit is lowest numbered
150    in instructions that operate on numbered bit-fields.
151    This is arbitrary on the 29k since it has no actual bit-field insns.
152    It is better to define this as TRUE because BYTES_BIG_ENDIAN is TRUE
153    and we want to be able to convert BP position to bit position with
154    just a shift.  */
155 #define BITS_BIG_ENDIAN 1
156
157 /* Define this if most significant byte of a word is the lowest numbered.
158    This is true on 29k.  */
159 #define BYTES_BIG_ENDIAN 1
160
161 /* Define this if most significant word of a multiword number is lowest
162    numbered. 
163
164    For 29k we can decide arbitrarily since there are no machine instructions
165    for them.  Might as well be consistent with bytes. */
166 #define WORDS_BIG_ENDIAN 1
167
168 /* number of bits in an addressable storage unit */
169 #define BITS_PER_UNIT 8
170
171 /* Width in bits of a "word", which is the contents of a machine register.
172    Note that this is not necessarily the width of data type `int';
173    if using 16-bit ints on a 68000, this would still be 32.
174    But on a machine with 16-bit registers, this would be 16.  */
175 #define BITS_PER_WORD 32
176
177 /* Width of a word, in units (bytes).  */
178 #define UNITS_PER_WORD 4
179
180 /* Width in bits of a pointer.
181    See also the macro `Pmode' defined below.  */
182 #define POINTER_SIZE 32
183
184 /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
185 #define PARM_BOUNDARY 32
186
187 /* Boundary (in *bits*) on which stack pointer should be aligned.  */
188 #define STACK_BOUNDARY 64
189
190 /* Allocation boundary (in *bits*) for the code of a function.  */
191 #define FUNCTION_BOUNDARY 32
192
193 /* Alignment of field after `int : 0' in a structure.  */
194 #define EMPTY_FIELD_BOUNDARY 32
195
196 /* Every structure's size must be a multiple of this.  */
197 #define STRUCTURE_SIZE_BOUNDARY 8
198
199 /* A bitfield declared as `int' forces `int' alignment for the struct.  */
200 #define PCC_BITFIELD_TYPE_MATTERS 1
201
202 /* No data type wants to be aligned rounder than this.  */
203 #define BIGGEST_ALIGNMENT 32
204
205 /* Make strings word-aligned so strcpy from constants will be faster.  */
206 #define CONSTANT_ALIGNMENT(EXP, ALIGN)  \
207   (TREE_CODE (EXP) == STRING_CST        \
208    && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
209
210 /* Make arrays of chars word-aligned for the same reasons.  */
211 #define DATA_ALIGNMENT(TYPE, ALIGN)             \
212   (TREE_CODE (TYPE) == ARRAY_TYPE               \
213    && TYPE_MODE (TREE_TYPE (TYPE)) == QImode    \
214    && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
215
216 /* Set this non-zero if move instructions will actually fail to work
217    when given unaligned data.  */
218 #define STRICT_ALIGNMENT 0
219
220 /* Set this non-zero if unaligned move instructions are extremely slow.
221
222    On the 29k, they trap.  */
223 #define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) 1
224 \f
225 /* Standard register usage.  */
226
227 /* Number of actual hardware registers.
228    The hardware registers are assigned numbers for the compiler
229    from 0 to just below FIRST_PSEUDO_REGISTER.
230    All registers that the compiler knows about must be given numbers,
231    even those that are not normally considered general registers.
232
233    29k has 256 registers, of which 62 are not defined.  gr0 and gr1 are
234    not produced in generated RTL so we can start at gr96, and call it
235    register zero.
236
237    So 0-31 are gr96-gr127, lr0-lr127 are 32-159.  To represent the input
238    arguments, whose register numbers we won't know until we are done,
239    use register 160-175.  They cannot be modified.  Similarly, 176 is used
240    for the frame pointer.  It is assigned the last local register number
241    once the number of registers used is known.
242
243    We use 177, 178, 179, and 180 for the special registers BP, FC, CR, and Q,
244    respectively.  Registers 181 through 199 are used for the other special
245    registers that may be used by the programmer, but are never used by the
246    compiler.
247
248    Registers 200-203 are the four floating-point accumulator register in
249    the 29050.
250
251    Registers 204-235 are the 32 global registers for kernel mode when
252    -mkernel-registers is not specified, and the 32 global user registers
253    when it is.
254
255    When -mkernel-registers is specified, we still use the same register
256    map but change the names so 0-31 print as gr64-gr95.  */
257
258 #define FIRST_PSEUDO_REGISTER 236
259
260 /* Because of the large number of registers on the 29k, we define macros
261    to refer to each group of registers and then define the number for some
262    registers used in the calling sequence.  */
263
264 #define R_GR(N)         ((N) - 96)      /* gr96 is register number 0 */
265 #define R_LR(N)         ((N) + 32)      /* lr0 is register number 32 */
266 #define R_FP            176             /* frame pointer is register 176 */
267 #define R_AR(N)         ((N) + 160)     /* first incoming arg reg is 160 */
268 #define R_KR(N)         ((N) + 204)     /* kernel registers (gr64 to gr95) */
269
270 /* Define the numbers of the special registers.  */
271 #define R_BP    177
272 #define R_FC    178
273 #define R_CR    179
274 #define R_Q     180
275
276 /* These special registers are not used by the compiler, but may be referenced
277    by the programmer via asm declarations.  */
278
279 #define R_VAB   181
280 #define R_OPS   182
281 #define R_CPS   183
282 #define R_CFG   184
283 #define R_CHA   185
284 #define R_CHD   186
285 #define R_CHC   187
286 #define R_RBP   188
287 #define R_TMC   189
288 #define R_TMR   190
289 #define R_PC0   191
290 #define R_PC1   192
291 #define R_PC2   193
292 #define R_MMU   194
293 #define R_LRU   195
294 #define R_FPE   196
295 #define R_INT   197
296 #define R_FPS   198
297 #define R_EXO   199
298
299 /* Define the number for floating-point accumulator N.  */
300 #define R_ACU(N)        ((N) + 200)
301
302 /* Now define the registers used in the calling sequence.  */
303 #define R_TAV   R_GR (121)
304 #define R_TPC   R_GR (122)
305 #define R_LRP   R_GR (123)
306 #define R_SLP   R_GR (124)
307 #define R_MSP   R_GR (125)
308 #define R_RAB   R_GR (126)
309 #define R_RFB   R_GR (127)
310
311 /* 1 for registers that have pervasive standard uses
312    and are not available for the register allocator.  */
313
314 #define FIXED_REGISTERS  \
315  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
316   1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, \
317   0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
318   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
319   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
320   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
321   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
322   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
323   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
324   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
325   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
326   1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
327   1, 1, 1, 1, 1, 1, 1, 1,                         \
328   0, 0, 0, 0,                                     \
329   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
330   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
331
332 /* 1 for registers not available across function calls.
333    These must include the FIXED_REGISTERS and also any
334    registers that can be used without being saved.
335    The latter must include the registers where values are returned
336    and the register where structure-value addresses are passed.
337    Aside from that, you can include as many other registers as you like.  */
338 #define CALL_USED_REGISTERS  \
339  {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
340   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
341   1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
342   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
343   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
344   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
345   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
346   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
347   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
348   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
349   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
350   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
351   1, 1, 1, 1, 1, 1, 1, 1,                         \
352   1, 1, 1, 1,                                     \
353   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
354   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
355
356 /* List the order in which to allocate registers.  Each register must be
357    listed once, even those in FIXED_REGISTERS.
358
359    We allocate in the following order:
360         gr116-gr120     (not used for anything but temps)
361         gr96-gr111      (function return values, reverse order)
362         argument registers (160-175)
363         lr0-lr127       (locals, saved)
364         acc3-0          (acc0 special)
365         everything else  */
366
367 #define REG_ALLOC_ORDER         \
368   {R_GR (116), R_GR (117), R_GR (118), R_GR (119), R_GR (120),          \
369    R_GR (111), R_GR (110), R_GR (109), R_GR (108), R_GR (107),          \
370    R_GR (106), R_GR (105), R_GR (104), R_GR (103), R_GR (102),          \
371    R_GR (101), R_GR (100), R_GR (99), R_GR (98), R_GR (97), R_GR (96),  \
372    R_AR (0), R_AR (1), R_AR (2), R_AR (3), R_AR (4), R_AR (5),          \
373    R_AR (6), R_AR (7), R_AR (8), R_AR (9), R_AR (10), R_AR (11),        \
374    R_AR (12), R_AR (13), R_AR (14), R_AR (15),                          \
375    R_LR (0), R_LR (1), R_LR (2), R_LR (3), R_LR (4), R_LR (5),          \
376    R_LR (6), R_LR (7), R_LR (8), R_LR (9), R_LR (10), R_LR (11),        \
377    R_LR (12), R_LR (13), R_LR (14), R_LR (15), R_LR (16), R_LR (17),    \
378    R_LR (18), R_LR (19), R_LR (20), R_LR (21), R_LR (22), R_LR (23),    \
379    R_LR (24), R_LR (25), R_LR (26), R_LR (27), R_LR (28), R_LR (29),    \
380    R_LR (30), R_LR (31), R_LR (32), R_LR (33), R_LR (34), R_LR (35),    \
381    R_LR (36), R_LR (37), R_LR (38), R_LR (39), R_LR (40), R_LR (41),    \
382    R_LR (42), R_LR (43), R_LR (44), R_LR (45), R_LR (46), R_LR (47),    \
383    R_LR (48), R_LR (49), R_LR (50), R_LR (51), R_LR (52), R_LR (53),    \
384    R_LR (54), R_LR (55), R_LR (56), R_LR (57), R_LR (58), R_LR (59),    \
385    R_LR (60), R_LR (61), R_LR (62), R_LR (63), R_LR (64), R_LR (65),    \
386    R_LR (66), R_LR (67), R_LR (68), R_LR (69), R_LR (70), R_LR (71),    \
387    R_LR (72), R_LR (73), R_LR (74), R_LR (75), R_LR (76), R_LR (77),    \
388    R_LR (78), R_LR (79), R_LR (80), R_LR (81), R_LR (82), R_LR (83),    \
389    R_LR (84), R_LR (85), R_LR (86), R_LR (87), R_LR (88), R_LR (89),    \
390    R_LR (90), R_LR (91), R_LR (92), R_LR (93), R_LR (94), R_LR (95),    \
391    R_LR (96), R_LR (97), R_LR (98), R_LR (99), R_LR (100), R_LR (101),  \
392    R_LR (102), R_LR (103), R_LR (104), R_LR (105), R_LR (106),          \
393    R_LR (107), R_LR (108), R_LR (109), R_LR (110), R_LR (111),          \
394    R_LR (112), R_LR (113), R_LR (114), R_LR (115), R_LR (116),          \
395    R_LR (117), R_LR (118), R_LR (119), R_LR (120), R_LR (121),          \
396    R_LR (122), R_LR (123), R_LR (124), R_LR (124), R_LR (126),          \
397    R_LR (127),                                                          \
398    R_ACU (3), R_ACU (2), R_ACU (1), R_ACU (0),                          \
399    R_GR (112), R_GR (113), R_GR (114), R_GR (115), R_GR (121),          \
400    R_GR (122), R_GR (123), R_GR (124), R_GR (125), R_GR (126),          \
401    R_GR (127),                                                          \
402    R_FP, R_BP, R_FC, R_CR, R_Q,                                         \
403    R_VAB, R_OPS, R_CPS, R_CFG, R_CHA, R_CHD, R_CHC, R_RBP, R_TMC,       \
404    R_TMR, R_PC0, R_PC1, R_PC2, R_MMU, R_LRU, R_FPE, R_INT, R_FPS,       \
405    R_EXO,                                                               \
406    R_KR (0), R_KR (1), R_KR (2), R_KR (3), R_KR (4), R_KR (5),          \
407    R_KR (6), R_KR (7), R_KR (8), R_KR (9), R_KR (10), R_KR (11),        \
408    R_KR (12), R_KR (13), R_KR (14), R_KR (15), R_KR (16), R_KR (17),    \
409    R_KR (18), R_KR (19), R_KR (20), R_KR (21), R_KR (22), R_KR (23),    \
410    R_KR (24), R_KR (25), R_KR (26), R_KR (27), R_KR (28), R_KR (29),    \
411    R_KR (30), R_KR (31) }
412
413 /* Return number of consecutive hard regs needed starting at reg REGNO
414    to hold something of mode MODE.
415    This is ordinarily the length in words of a value of mode MODE
416    but can be less for certain modes in special long registers.  */
417
418 #define HARD_REGNO_NREGS(REGNO, MODE)   \
419   ((REGNO) >= R_ACU (0) && (REGNO) <= R_ACU (3)? 1              \
420    : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
421
422 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
423    On 29k, the cpu registers can hold any mode.  But a double-precision
424    floating-point value should start at an even register.  The special
425    registers cannot hold floating-point values, BP, CR, and FC cannot
426    hold integer or floating-point values,  and the accumulators cannot
427    hold integer values.
428
429    DImode and larger values should start at an even register just like
430    DFmode values, even though the instruction set doesn't require it, in order
431    to prevent reload from aborting due to a modes_equiv_for_class_p failure.
432
433    (I'd like to use the "?:" syntax to make this more readable, but Sun's
434    compiler doesn't seem to accept it.)  */
435 #define HARD_REGNO_MODE_OK(REGNO, MODE)                                 \
436 (((REGNO) >= R_ACU (0) && (REGNO) <= R_ACU (3)                          \
437     && (GET_MODE_CLASS (MODE) == MODE_FLOAT                             \
438         || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT))                \
439    || ((REGNO) >= R_BP && (REGNO) <= R_CR                               \
440        && GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT)                    \
441    || ((REGNO) >= R_Q && (REGNO) < R_ACU (0)                            \
442        && GET_MODE_CLASS (MODE) != MODE_FLOAT                           \
443        && GET_MODE_CLASS (MODE) != MODE_COMPLEX_FLOAT)                  \
444    || (((REGNO) < R_BP || (REGNO) >= R_KR (0))                           \
445        && ((((REGNO) & 1) == 0)                                         \
446            || GET_MODE_UNIT_SIZE (MODE) <= UNITS_PER_WORD)))
447
448 /* Value is 1 if it is a good idea to tie two pseudo registers
449    when one has mode MODE1 and one has mode MODE2.
450    If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
451    for any hard reg, then this must be 0 for correct output.
452
453    On the 29k, normally we'd just have problems with DFmode because of the
454    even alignment.  However, we also have to be a bit concerned about
455    the special register's restriction to non-floating and the floating-point
456    accumulator's restriction to only floating.  This probably won't
457    cause any great inefficiencies in practice.  */
458
459 #define MODES_TIEABLE_P(MODE1, MODE2)                   \
460   ((MODE1) == (MODE2)                                   \
461    || (GET_MODE_CLASS (MODE1) == MODE_INT               \
462        && GET_MODE_CLASS (MODE2) == MODE_INT))
463
464 /* Specify the registers used for certain standard purposes.
465    The values of these macros are register numbers.  */
466
467 /* 29k pc isn't overloaded on a register that the compiler knows about.  */
468 /* #define PC_REGNUM  */
469
470 /* Register to use for pushing function arguments.  */
471 #define STACK_POINTER_REGNUM R_GR (125)
472
473 /* Base register for access to local variables of the function.  */
474 #define FRAME_POINTER_REGNUM R_FP
475
476 /* Value should be nonzero if functions must have frame pointers.
477    Zero means the frame pointer need not be set up (and parms
478    may be accessed via the stack pointer) in functions that seem suitable.
479    This is computed in `reload', in reload1.c.  */
480 #define FRAME_POINTER_REQUIRED 0
481
482 /* Base register for access to arguments of the function.  */
483 #define ARG_POINTER_REGNUM R_FP
484
485 /* Register in which static-chain is passed to a function.  */
486 #define STATIC_CHAIN_REGNUM R_SLP
487
488 /* Register in which address to store a structure value
489    is passed to a function.  */
490 #define STRUCT_VALUE_REGNUM R_LRP
491 \f
492 /* Define the classes of registers for register constraints in the
493    machine description.  Also define ranges of constants.
494
495    One of the classes must always be named ALL_REGS and include all hard regs.
496    If there is more than one class, another class must be named NO_REGS
497    and contain no registers.
498
499    The name GENERAL_REGS must be the name of a class (or an alias for
500    another name such as ALL_REGS).  This is the class of registers
501    that is allowed by "g" or "r" in a register constraint.
502    Also, registers outside this class are allocated only when
503    instructions express preferences for them.
504
505    The classes must be numbered in nondecreasing order; that is,
506    a larger-numbered class must never be contained completely
507    in a smaller-numbered class.
508
509    For any two classes, it is very desirable that there be another
510    class that represents their union.
511    
512    The 29k has nine registers classes: LR0_REGS, GENERAL_REGS, SPECIAL_REGS,
513    BP_REGS, FC_REGS, CR_REGS, Q_REGS, ACCUM_REGS, and ACCUM0_REGS.
514    LR0_REGS, BP_REGS, FC_REGS, CR_REGS, and Q_REGS contain just the single
515    register.  The latter two classes are used to represent the floating-point
516    accumulator registers in the 29050.  We also define the union class
517    FLOAT_REGS to represent any register that can be used to hold a
518    floating-point value.  The union of SPECIAL_REGS and ACCUM_REGS isn't
519    useful as the former cannot contain floating-point and the latter can only
520    contain floating-point.  */
521
522 enum reg_class { NO_REGS, LR0_REGS, GENERAL_REGS, BP_REGS, FC_REGS, CR_REGS,
523                  Q_REGS, SPECIAL_REGS, ACCUM0_REGS, ACCUM_REGS, FLOAT_REGS,
524                  ALL_REGS, LIM_REG_CLASSES };
525
526 #define N_REG_CLASSES (int) LIM_REG_CLASSES
527
528 /* Give names of register classes as strings for dump file.   */
529
530 #define REG_CLASS_NAMES                         \
531  {"NO_REGS", "LR0_REGS", "GENERAL_REGS", "BP_REGS", "FC_REGS", "CR_REGS", \
532   "Q_REGS", "SPECIAL_REGS", "ACCUM0_REGS", "ACCUM_REGS", "FLOAT_REGS",    \
533   "ALL_REGS" }
534
535 /* Define which registers fit in which classes.
536    This is an initializer for a vector of HARD_REG_SET
537    of length N_REG_CLASSES.  */
538
539 #define REG_CLASS_CONTENTS      \
540   { {0, 0, 0, 0, 0, 0, 0, 0},                              \
541     {0, 1, 0, 0, 0, 0, 0, 0},                              \
542     {~0, ~0, ~0, ~0, ~0, ~ 0xfffe0000, ~ 0xfff, 0xfff},    \
543     {0, 0, 0, 0, 0, 0x20000, 0, 0},                        \
544     {0, 0, 0, 0, 0, 0x40000, 0, 0},                        \
545     {0, 0, 0, 0, 0, 0x80000, 0, 0},                        \
546     {0, 0, 0, 0, 0, 0x100000, 0, 0},                       \
547     {0, 0, 0, 0, 0, 0xfffe0000, 0xff, 0},                  \
548     {0, 0, 0, 0, 0, 0, 0x100, 0},                          \
549     {0, 0, 0, 0, 0, 0, 0xf00, 0},                          \
550     {~0, ~0, ~0, ~0, ~0, ~ 0xfffe0000, ~ 0xff, 0xfff},     \
551     {~0, ~0, ~0, ~0, ~0, ~0, ~0, 0xfff} }
552
553 /* The same information, inverted:
554    Return the class number of the smallest class containing
555    reg number REGNO.  This could be a conditional expression
556    or could index an array.  */
557
558 #define REGNO_REG_CLASS(REGNO)          \
559   ((REGNO) == R_BP ? BP_REGS            \
560    : (REGNO) == R_FC ? FC_REGS          \
561    : (REGNO) == R_CR ? CR_REGS          \
562    : (REGNO) == R_Q ? Q_REGS            \
563    : (REGNO) > R_BP && (REGNO) <= R_EXO ? SPECIAL_REGS  \
564    : (REGNO) == R_ACU (0) ? ACCUM0_REGS \
565    : (REGNO) >= R_KR (0) ? GENERAL_REGS \
566    : (REGNO) > R_ACU (0) ? ACCUM_REGS   \
567    : (REGNO) == R_LR (0) ? LR0_REGS     \
568    : GENERAL_REGS)
569
570 /* The class value for index registers, and the one for base regs.  */
571 #define INDEX_REG_CLASS NO_REGS
572 #define BASE_REG_CLASS GENERAL_REGS
573
574 /* Get reg_class from a letter such as appears in the machine description.  */
575
576 #define REG_CLASS_FROM_LETTER(C)        \
577  ((C) == 'r' ? GENERAL_REGS             \
578   : (C) == 'l' ? LR0_REGS               \
579   : (C) == 'b' ? BP_REGS                \
580   : (C) == 'f' ? FC_REGS                \
581   : (C) == 'c' ? CR_REGS                \
582   : (C) == 'q' ? Q_REGS                 \
583   : (C) == 'h' ? SPECIAL_REGS           \
584   : (C) == 'a' ? ACCUM_REGS             \
585   : (C) == 'A' ? ACCUM0_REGS            \
586   : (C) == 'f' ? FLOAT_REGS             \
587   : NO_REGS)
588
589 /* Define this macro to change register usage conditional on target flags.
590
591    On the 29k, we use this to change the register names for kernel mapping.  */
592
593 #define CONDITIONAL_REGISTER_USAGE              \
594   {                                             \
595     const char *p;                              \
596     int i;                                      \
597                                                 \
598     if (TARGET_KERNEL_REGISTERS)                \
599       for (i = 0; i < 32; i++)                  \
600         {                                       \
601           p = reg_names[i];                     \
602           reg_names[i] = reg_names[R_KR (i)];   \
603           reg_names[R_KR (i)] = p;              \
604         }                                       \
605   }
606
607 /* The letters I, J, K, L, M, N, O, and P in a register constraint string
608    can be used to stand for particular ranges of immediate operands.
609    This macro defines what the ranges are.
610    C is the letter, and VALUE is a constant value.
611    Return 1 if VALUE is in the range specified by C.
612
613    For 29k:
614    `I' is used for the range of constants most insns can contain.
615    `J' is for the few 16-bit insns.
616    `K' is a constant whose high-order 24 bits are all one
617    `L' is a HImode constant whose high-order 8 bits are all one
618    `M' is a 32-bit constant whose high-order 16 bits are all one (for CONSTN)
619    `N' is a 32-bit constant whose negative is 8 bits
620    `O' is the 32-bit constant 0x80000000, any constant with low-order
621           16 bits zero for 29050.
622    `P' is a HImode constant whose negative is 8 bits  */
623
624 #define CONST_OK_FOR_LETTER_P(VALUE, C)                         \
625   ((C) == 'I' ? (unsigned) (VALUE) < 0x100                      \
626    : (C) == 'J' ? (unsigned) (VALUE) < 0x10000                  \
627    : (C) == 'K' ? ((VALUE) & 0xffffff00) == 0xffffff00          \
628    : (C) == 'L' ? ((VALUE) & 0xff00) == 0xff00                  \
629    : (C) == 'M' ? ((VALUE) & 0xffff0000) == 0xffff0000          \
630    : (C) == 'N' ? ((VALUE) < 0 && (VALUE) > -256)               \
631    : (C) == 'O' ? ((VALUE) == 0x80000000                        \
632                    || (TARGET_29050 && ((VALUE) & 0xffff) == 0)) \
633    : (C) == 'P' ? (((VALUE) | 0xffff0000) < 0                   \
634                    && ((VALUE) | 0xffff0000) > -256)            \
635    : 0)
636
637 /* Similar, but for floating constants, and defining letters G and H.
638    Here VALUE is the CONST_DOUBLE rtx itself.
639    All floating-point constants are valid on 29k.  */
640
641 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)  1
642
643 /* Given an rtx X being reloaded into a reg required to be
644    in class CLASS, return the class of reg to actually use.
645    In general this is just CLASS; but on some machines
646    in some cases it is preferable to use a more restrictive class.  */
647
648 #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
649
650 /* Return the register class of a scratch register needed to copy IN into
651    or out of a register in CLASS in MODE.  If it can be done directly,
652    NO_REGS is returned.  */
653
654 #define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
655   secondary_reload_class (CLASS, MODE, IN)
656
657 /* Return the maximum number of consecutive registers
658    needed to represent mode MODE in a register of class CLASS.
659
660    On 29k, this is the size of MODE in words except that the floating-point
661    accumulators only require one word for anything they can hold.  */
662
663 #define CLASS_MAX_NREGS(CLASS, MODE)                            \
664  (((CLASS) == ACCUM_REGS || (CLASS) == ACCUM0_REGS) ? 1         \
665   : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
666
667 /* Define the cost of moving between registers of various classes.  Everything
668    involving a general register is cheap, but moving between the other types
669    (even within a class) is two insns.  */
670
671 #define REGISTER_MOVE_COST(CLASS1, CLASS2)      \
672   ((CLASS1) == GENERAL_REGS || (CLASS2) == GENERAL_REGS ? 2 : 4)
673
674 /* A C expressions returning the cost of moving data of MODE from a register to
675    or from memory.
676
677    It takes extra insns on the 29k to form addresses, so we want to make
678    this higher.  In addition, we need to keep it more expensive than the
679    most expensive register-register copy.  */
680
681 #define MEMORY_MOVE_COST(MODE,CLASS,IN) 6
682
683 /* A C statement (sans semicolon) to update the integer variable COST
684    based on the relationship between INSN that is dependent on
685    DEP_INSN through the dependence LINK.  The default is to make no
686    adjustment to COST.  On the a29k, ignore the cost of anti- and
687    output-dependencies.  */
688 #define ADJUST_COST(INSN,LINK,DEP_INSN,COST)                            \
689   if (REG_NOTE_KIND (LINK) != 0)                                        \
690     (COST) = 0; /* Anti or output dependence.  */
691 \f
692 /* Stack layout; function entry, exit and calling.  */
693
694 /* Define this if pushing a word on the stack
695    makes the stack pointer a smaller address.  */
696 #define STACK_GROWS_DOWNWARD
697
698 /* Define this if the nominal address of the stack frame
699    is at the high-address end of the local variables;
700    that is, each additional local variable allocated
701    goes at a more negative offset in the frame.  */
702 #define FRAME_GROWS_DOWNWARD
703
704 /* Offset within stack frame to start allocating local variables at.
705    If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
706    first local allocated.  Otherwise, it is the offset to the BEGINNING
707    of the first local allocated.  */
708
709 #define STARTING_FRAME_OFFSET (- current_function_pretend_args_size)
710
711 /* If we generate an insn to push BYTES bytes,
712    this says how many the stack pointer really advances by.
713    On 29k, don't define this because there are no push insns.  */
714 /*  #define PUSH_ROUNDING(BYTES) */
715
716 /* Define this if the maximum size of all the outgoing args is to be
717    accumulated and pushed during the prologue.  The amount can be
718    found in the variable current_function_outgoing_args_size.  */
719 #define ACCUMULATE_OUTGOING_ARGS
720
721 /* Offset of first parameter from the argument pointer register value.  */
722
723 #define FIRST_PARM_OFFSET(FNDECL) (- current_function_pretend_args_size)
724
725 /* Define this if stack space is still allocated for a parameter passed
726    in a register.  */
727 /* #define REG_PARM_STACK_SPACE */
728
729 /* Value is the number of bytes of arguments automatically
730    popped when returning from a subroutine call.
731    FUNDECL is the declaration node of the function (as a tree),
732    FUNTYPE is the data type of the function (as a tree),
733    or for a library call it is an identifier node for the subroutine name.
734    SIZE is the number of bytes of arguments passed on the stack.  */
735
736 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
737
738 /* Define how to find the value returned by a function.
739    VALTYPE is the data type of the value (as a tree).
740    If the precise function being called is known, FUNC is its FUNCTION_DECL;
741    otherwise, FUNC is 0.
742
743    On 29k the value is found in gr96.  */
744
745 #define FUNCTION_VALUE(VALTYPE, FUNC)  \
746   gen_rtx_REG (TYPE_MODE (VALTYPE), R_GR (96))
747
748 /* Define how to find the value returned by a library function
749    assuming the value has mode MODE.  */
750
751 #define LIBCALL_VALUE(MODE)  gen_rtx_REG (MODE, R_GR (96))
752
753 /* 1 if N is a possible register number for a function value
754    as seen by the caller.
755    On 29k, gr96-gr111 are used.  */
756
757 #define FUNCTION_VALUE_REGNO_P(N) ((N) == R_GR (96))
758
759 /* 1 if N is a possible register number for function argument passing.
760    On 29k, these are lr2-lr17.  */
761
762 #define FUNCTION_ARG_REGNO_P(N) ((N) <= R_LR (17) && (N) >= R_LR (2))
763 \f
764 /* Define a data type for recording info about an argument list
765    during the scan of that argument list.  This data type should
766    hold all necessary information about the function itself
767    and about the args processed so far, enough to enable macros
768    such as FUNCTION_ARG to determine where the next arg should go.
769
770    On 29k, this is a single integer, which is a number of words
771    of arguments scanned so far.
772    Thus 16 or more means all following args should go on the stack.  */
773
774 #define CUMULATIVE_ARGS int
775
776 /* Initialize a variable CUM of type CUMULATIVE_ARGS
777    for a call to a function whose data type is FNTYPE.
778    For a library call, FNTYPE is 0.  */
779
780 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT)  (CUM) = 0
781
782 /* Same, but called for incoming args.
783
784    On the 29k, we use this to set all argument registers to fixed and
785    set the last 16 local regs, less two, (lr110-lr125) to available.  Some
786    will later be changed to call-saved by FUNCTION_INCOMING_ARG.
787    lr126,lr127 are always fixed, they are place holders for the caller's
788    lr0,lr1.  */
789
790 #define INIT_CUMULATIVE_INCOMING_ARGS(CUM,FNTYPE,IGNORE)        \
791 { int i;                                                        \
792   for (i = R_AR (0) - 2; i < R_AR (16); i++)                    \
793     {                                                           \
794       fixed_regs[i] = call_used_regs[i] = call_fixed_regs[i] = 1; \
795       SET_HARD_REG_BIT (fixed_reg_set, i);                      \
796       SET_HARD_REG_BIT (call_used_reg_set, i);                  \
797       SET_HARD_REG_BIT (call_fixed_reg_set, i);                 \
798     }                                                           \
799   for (i = R_LR (110); i < R_LR (126); i++)                                     \
800     {                                                           \
801       fixed_regs[i] = call_used_regs[i] = call_fixed_regs[i] = 0; \
802       CLEAR_HARD_REG_BIT (fixed_reg_set, i);                    \
803       CLEAR_HARD_REG_BIT (call_used_reg_set, i);                \
804       CLEAR_HARD_REG_BIT (call_fixed_reg_set, i);               \
805     }                                                           \
806   (CUM) = 0;                                                    \
807  }
808
809 /* Define intermediate macro to compute the size (in registers) of an argument
810    for the 29k.  */
811
812 #define A29K_ARG_SIZE(MODE, TYPE, NAMED)                                \
813 (! (NAMED) ? 0                                                          \
814  : (MODE) != BLKmode                                                    \
815  ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD       \
816  : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
817
818 /* Update the data in CUM to advance over an argument
819    of mode MODE and data type TYPE.
820    (TYPE is null for libcalls where that information may not be available.)  */
821
822 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)                    \
823   if (MUST_PASS_IN_STACK (MODE, TYPE))                                  \
824     (CUM) = 16;                                                         \
825   else                                                                  \
826     (CUM) += A29K_ARG_SIZE (MODE, TYPE, NAMED)
827
828 /* Determine where to put an argument to a function.
829    Value is zero to push the argument on the stack,
830    or a hard register in which to store the argument.
831
832    MODE is the argument's machine mode.
833    TYPE is the data type of the argument (as a tree).
834     This is null for libcalls where that information may
835     not be available.
836    CUM is a variable of type CUMULATIVE_ARGS which gives info about
837     the preceding args and about the function being called.
838    NAMED is nonzero if this argument is a named parameter
839     (otherwise it is an extra parameter matching an ellipsis).
840
841    On 29k the first 16 words of args are normally in registers
842    and the rest are pushed.  */
843
844 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED)                    \
845 ((CUM) < 16 && (NAMED) && ! MUST_PASS_IN_STACK (MODE, TYPE)     \
846  ? gen_rtx_REG ((MODE), R_LR (2) + (CUM)) : 0)
847
848 /* Define where a function finds its arguments.
849    This is different from FUNCTION_ARG because of register windows.
850
851    On the 29k, we hack this to call a function that sets the used registers
852    as non-fixed and not used by calls.  */
853
854 #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED)                   \
855 ((CUM) < 16 && (NAMED) && ! MUST_PASS_IN_STACK (MODE, TYPE)             \
856  ? gen_rtx_REG (MODE,                                                   \
857                 incoming_reg (CUM, A29K_ARG_SIZE (MODE, TYPE, NAMED)))  \
858  : 0)
859
860 /* This indicates that an argument is to be passed with an invisible reference
861    (i.e., a pointer to the object is passed).
862
863    On the 29k, we do this if it must be passed on the stack.  */
864
865 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED)  \
866   (MUST_PASS_IN_STACK (MODE, TYPE))
867
868 /* Specify the padding direction of arguments.
869
870    On the 29k, we must pad upwards in order to be able to pass args in
871    registers.  */
872
873 #define FUNCTION_ARG_PADDING(MODE, TYPE)        upward
874
875 /* For an arg passed partly in registers and partly in memory,
876    this is the number of registers used.
877    For args passed entirely in registers or entirely in memory, zero.  */
878
879 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED)              \
880 ((CUM) < 16 && 16 < (CUM) + A29K_ARG_SIZE (MODE, TYPE, NAMED) && (NAMED) \
881  ? 16 - (CUM) : 0)
882
883 /* Perform any needed actions needed for a function that is receiving a
884    variable number of arguments. 
885
886    CUM is as above.
887
888    MODE and TYPE are the mode and type of the current parameter.
889
890    PRETEND_SIZE is a variable that should be set to the amount of stack
891    that must be pushed by the prolog to pretend that our caller pushed
892    it.
893
894    Normally, this macro will push all remaining incoming registers on the
895    stack and set PRETEND_SIZE to the length of the registers pushed.  */
896
897 #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
898 { if ((CUM) < 16)                                                       \
899     {                                                                   \
900       int first_reg_offset = (CUM);                                     \
901                                                                         \
902       if (MUST_PASS_IN_STACK (MODE, TYPE))                              \
903         first_reg_offset += A29K_ARG_SIZE (TYPE_MODE (TYPE), TYPE, 1);  \
904                                                                         \
905       if (first_reg_offset > 16)                                        \
906         first_reg_offset = 16;                                          \
907                                                                         \
908       if (! (NO_RTL) && first_reg_offset != 16)                         \
909         move_block_from_reg                                             \
910           (R_AR (0) + first_reg_offset,                                 \
911            gen_rtx_MEM (BLKmode, virtual_incoming_args_rtx),            \
912            16 - first_reg_offset, (16 - first_reg_offset) * UNITS_PER_WORD); \
913       PRETEND_SIZE = (16 - first_reg_offset) * UNITS_PER_WORD;          \
914     }                                                                   \
915 }
916
917 /* Define the information needed to generate branch and scc insns.  This is
918    stored from the compare operation.  Note that we can't use "rtx" here
919    since it hasn't been defined!  */
920
921 extern struct rtx_def *a29k_compare_op0, *a29k_compare_op1;
922 extern int a29k_compare_fp_p;
923
924 /* This macro produces the initial definition of a function name.
925
926    For the 29k, we need the prolog to contain one or two words prior to
927    the declaration of the function name.  So just store away the name and
928    write it as part of the prolog.  This also computes the register names,
929    which can't be done until after register allocation, but must be done
930    before final_start_function is called.  */
931
932 extern const char *a29k_function_name;
933
934 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL)       \
935   a29k_function_name = NAME; \
936   a29k_compute_reg_names ();
937
938 /* This macro generates the assembly code for function entry.
939    FILE is a stdio stream to output the code to.
940    SIZE is an int: how many units of temporary storage to allocate.
941    Refer to the array `regs_ever_live' to determine which registers
942    to save; `regs_ever_live[I]' is nonzero if register number I
943    is ever used in the function.  This macro is responsible for
944    knowing which registers should not be saved even if used.  */
945
946 #define FUNCTION_PROLOGUE(FILE, SIZE)  output_prolog (FILE, SIZE)
947
948 /* Output assembler code to FILE to increment profiler label # LABELNO
949    for profiling a function entry.  */
950
951 #define FUNCTION_PROFILER(FILE, LABELNO)
952
953 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
954    the stack pointer does not matter.  The value is tested only in
955    functions that have frame pointers.
956    No definition is equivalent to always zero.  */
957
958 #define EXIT_IGNORE_STACK 1
959
960 /* This macro generates the assembly code for function exit,
961    on machines that need it.  If FUNCTION_EPILOGUE is not defined
962    then individual return instructions are generated for each
963    return statement.  Args are same as for FUNCTION_PROLOGUE.
964
965    The function epilogue should not depend on the current stack pointer!
966    It should use the frame pointer only.  This is mandatory because
967    of alloca; we also take advantage of it to omit stack adjustments
968    before returning.  */
969
970 #define FUNCTION_EPILOGUE(FILE, SIZE)   output_epilog (FILE, SIZE)
971
972 /* Define the number of delay slots needed for the function epilogue.
973
974    On the 29k, we need a slot except when we have a register stack adjustment,
975    have a memory stack adjustment, and have no frame pointer.  */
976
977 #define DELAY_SLOTS_FOR_EPILOGUE                                        \
978   (! (needs_regstack_p ()                                               \
979       && (get_frame_size () + current_function_pretend_args_size        \
980            + current_function_outgoing_args_size) != 0                  \
981       && ! frame_pointer_needed))
982
983 /* Define whether INSN can be placed in delay slot N for the epilogue.
984
985    On the 29k, we must be able to place it in a delay slot, it must
986    not use sp if the frame pointer cannot be eliminated, and it cannot
987    use local regs if we need to push the register stack.
988    If this is a SET with a memory as source, it might load from
989    a stack slot, unless the address is constant.  */
990
991 #define ELIGIBLE_FOR_EPILOGUE_DELAY(INSN,N)                             \
992   (get_attr_in_delay_slot (INSN) == IN_DELAY_SLOT_YES                   \
993    && ! (frame_pointer_needed                                           \
994          && reg_mentioned_p (stack_pointer_rtx, PATTERN (INSN)))        \
995    && ! (needs_regstack_p () && uses_local_reg_p (PATTERN (INSN)))      \
996    && (GET_CODE (PATTERN (INSN)) != SET                                 \
997        || GET_CODE (SET_SRC (PATTERN (INSN))) != MEM                    \
998        || ! rtx_varies_p (XEXP (SET_SRC (PATTERN (INSN)), 0))))
999 \f
1000 /* Output assembler code for a block containing the constant parts
1001    of a trampoline, leaving space for the variable parts.
1002
1003    The trampoline should set the static chain pointer to value placed
1004    into the trampoline and should branch to the specified routine.  We
1005    use gr121 (tav) as a temporary.  */
1006
1007 #define TRAMPOLINE_TEMPLATE(FILE)                       \
1008 {                                                       \
1009   fprintf (FILE, "\tconst %s,0\n", reg_names[R_TAV]);   \
1010   fprintf (FILE, "\tconsth %s,0\n", reg_names[R_TAV]);  \
1011   fprintf (FILE, "\tconst %s,0\n", reg_names[R_SLP]);   \
1012   fprintf (FILE, "\tjmpi %s\n", reg_names[R_TAV]);      \
1013   fprintf (FILE, "\tconsth %s,0\n", reg_names[R_SLP]);  \
1014 }
1015
1016 /* Length in units of the trampoline for entering a nested function.  */
1017
1018 #define TRAMPOLINE_SIZE    20
1019
1020 /* Emit RTL insns to initialize the variable parts of a trampoline.
1021    FNADDR is an RTX for the address of the function's pure code.
1022    CXT is an RTX for the static chain value for the function.
1023
1024    We do this on the 29k by writing the bytes of the addresses into the
1025    trampoline one byte at a time.  */
1026
1027 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT)                       \
1028 {                                                                       \
1029   INITIALIZE_TRAMPOLINE_VALUE (TRAMP, FNADDR, 0, 4);                    \
1030   INITIALIZE_TRAMPOLINE_VALUE (TRAMP, CXT, 8, 16);                      \
1031 }
1032
1033 /* Define a sub-macro to initialize one value into the trampoline.
1034    We specify the offsets of the CONST and CONSTH instructions, respectively
1035    and copy the value a byte at a time into these instructions.  */
1036
1037 #define INITIALIZE_TRAMPOLINE_VALUE(TRAMP, VALUE, CONST, CONSTH)        \
1038 {                                                                       \
1039   rtx _addr, _temp;                                                     \
1040   rtx _val = force_reg (SImode, VALUE);                                 \
1041                                                                         \
1042   _addr = memory_address (QImode, plus_constant (TRAMP, (CONST) + 3));  \
1043   emit_move_insn (gen_rtx_MEM (QImode, _addr),                          \
1044                   gen_lowpart (QImode, _val));                          \
1045                                                                         \
1046   _temp = expand_shift (RSHIFT_EXPR, SImode, _val,                      \
1047                        build_int_2 (8, 0), 0, 1);                       \
1048   _addr = memory_address (QImode, plus_constant (TRAMP, (CONST) + 1));  \
1049   emit_move_insn (gen_rtx_MEM (QImode, _addr),                          \
1050                   gen_lowpart (QImode, _temp));                         \
1051                                                                         \
1052   _temp = expand_shift (RSHIFT_EXPR, SImode, _temp,                     \
1053                        build_int_2 (8, 0), _temp, 1);                   \
1054   _addr = memory_address (QImode, plus_constant (TRAMP, (CONSTH) + 3)); \
1055   emit_move_insn (gen_rtx_MEM (QImode, _addr),                          \
1056                   gen_lowpart (QImode, _temp));                         \
1057                                                                         \
1058   _temp = expand_shift (RSHIFT_EXPR, SImode, _temp,                     \
1059                        build_int_2 (8, 0), _temp, 1);                   \
1060   _addr = memory_address (QImode, plus_constant (TRAMP, (CONSTH) + 1)); \
1061   emit_move_insn (gen_rtx_MEM (QImode, _addr),                          \
1062                   gen_lowpart (QImode, _temp));                         \
1063 }
1064 \f
1065 /* Addressing modes, and classification of registers for them.  */
1066
1067 /* #define HAVE_POST_INCREMENT 0 */
1068 /* #define HAVE_POST_DECREMENT 0 */
1069
1070 /* #define HAVE_PRE_DECREMENT 0 */
1071 /* #define HAVE_PRE_INCREMENT 0 */
1072
1073 /* Macros to check register numbers against specific register classes.  */
1074
1075 /* These assume that REGNO is a hard or pseudo reg number.
1076    They give nonzero only if REGNO is a hard reg of the suitable class
1077    or a pseudo reg currently allocated to a suitable hard reg.
1078    Since they use reg_renumber, they are safe only once reg_renumber
1079    has been allocated, which happens in local-alloc.c.  */
1080
1081 #define REGNO_OK_FOR_INDEX_P(REGNO) 0
1082 #define REGNO_OK_FOR_BASE_P(REGNO) 1
1083
1084 /* Given the value returned from get_frame_size, compute the actual size
1085    of the frame we will allocate.   We include the pretend and outgoing
1086    arg sizes and round to a doubleword.  */
1087
1088 #define ACTUAL_FRAME_SIZE(SIZE)                         \
1089   (((SIZE) + current_function_pretend_args_size         \
1090     + current_function_outgoing_args_size + 7) & ~7)
1091
1092 /* Define the initial offset between the frame and stack pointer.  */
1093
1094 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH)     \
1095   (DEPTH) = ACTUAL_FRAME_SIZE (get_frame_size ())
1096 \f
1097 /* Maximum number of registers that can appear in a valid memory address.  */
1098 #define MAX_REGS_PER_ADDRESS 1
1099
1100 /* Recognize any constant value that is a valid address.  */
1101
1102 #define CONSTANT_ADDRESS_P(X)  \
1103 (GET_CODE (X) == CONST_INT && (unsigned) INTVAL (X) < 0x100)
1104
1105 /* Include all constant integers and constant doubles */
1106 #define LEGITIMATE_CONSTANT_P(X)        1
1107
1108 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1109    and check its validity for a certain class.
1110    We have two alternate definitions for each of them.
1111    The usual definition accepts all pseudo regs; the other rejects
1112    them unless they have been allocated suitable hard regs.
1113    The symbol REG_OK_STRICT causes the latter definition to be used.
1114
1115    Most source files want to accept pseudo regs in the hope that
1116    they will get allocated to the class that the insn wants them to be in.
1117    Source files for reload pass need to be strict.
1118    After reload, it makes no difference, since pseudo regs have
1119    been eliminated by then.  */
1120
1121 #ifndef REG_OK_STRICT
1122
1123 /* Nonzero if X is a hard reg that can be used as an index
1124    or if it is a pseudo reg.  */
1125 #define REG_OK_FOR_INDEX_P(X) 0
1126 /* Nonzero if X is a hard reg that can be used as a base reg
1127    or if it is a pseudo reg.  */
1128 #define REG_OK_FOR_BASE_P(X)  1
1129
1130 #else
1131
1132 /* Nonzero if X is a hard reg that can be used as an index.  */
1133 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1134 /* Nonzero if X is a hard reg that can be used as a base reg.  */
1135 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1136
1137 #endif
1138 \f
1139 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1140    that is a valid memory address for an instruction.
1141    The MODE argument is the machine mode for the MEM expression
1142    that wants to use this address.
1143
1144    On the 29k, a legitimate address is a register and so is a
1145    constant of less than 256.  */
1146
1147 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)  \
1148 { if (REG_P (X) && REG_OK_FOR_BASE_P (X))       \
1149     goto ADDR;                                  \
1150   if (GET_CODE (X) == CONST_INT                 \
1151       && (unsigned) INTVAL (X) < 0x100)         \
1152     goto ADDR;                                  \
1153 }
1154
1155 /* Try machine-dependent ways of modifying an illegitimate address
1156    to be legitimate.  If we find one, return the new, valid address.
1157    This macro is used in only one place: `memory_address' in explow.c.
1158
1159    OLDX is the address as it was before break_out_memory_refs was called.
1160    In some cases it is useful to look at this to decide what needs to be done.
1161
1162    MODE and WIN are passed so that this macro can use
1163    GO_IF_LEGITIMATE_ADDRESS.
1164
1165    It is always safe for this macro to do nothing.  It exists to recognize
1166    opportunities to optimize the output.
1167
1168    For the 29k, we need not do anything.  However, if we don't,
1169    `memory_address' will try lots of things to get a valid address, most of
1170    which will result in dead code and extra pseudos.  So we make the address
1171    valid here.
1172
1173    This is easy:  The only valid addresses are an offset from a register
1174    and we know the address isn't valid.  So just call either `force_operand'
1175    or `force_reg' unless this is a (plus (reg ...) (const_int 0)).  */
1176
1177 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)                     \
1178 { if (GET_CODE (X) == PLUS && XEXP (X, 1) == const0_rtx)        \
1179     X = XEXP (x, 0);                                            \
1180   if (GET_CODE (X) == MULT || GET_CODE (X) == PLUS)             \
1181     X = force_operand (X, 0);                                   \
1182   else                                                          \
1183     X = force_reg (Pmode, X);                                   \
1184   goto WIN;                                                     \
1185 }
1186
1187 /* Go to LABEL if ADDR (a legitimate address expression)
1188    has an effect that depends on the machine mode it is used for.
1189    On the 29k this is never true.  */
1190
1191 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
1192
1193 /* Compute the cost of an address.  For the 29k, all valid addresses are
1194    the same cost.  */
1195
1196 #define ADDRESS_COST(X)  0
1197
1198 /* Define this if some processing needs to be done immediately before
1199    emitting code for an insn.  */
1200
1201 /* #define FINAL_PRESCAN_INSN(INSN,OPERANDS,NOPERANDS) */
1202 \f
1203 /* Specify the machine mode that this machine uses
1204    for the index in the tablejump instruction.  */
1205 #define CASE_VECTOR_MODE SImode
1206
1207 /* Define as C expression which evaluates to nonzero if the tablejump
1208    instruction expects the table to contain offsets from the address of the
1209    table.
1210    Do not define this if the table should contain absolute addresses. */
1211 /* #define CASE_VECTOR_PC_RELATIVE 1 */
1212
1213 /* Specify the tree operation to be used to convert reals to integers.  */
1214 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1215
1216 /* This is the kind of divide that is easiest to do in the general case.  */
1217 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1218
1219 /* Define this as 1 if `char' should by default be signed; else as 0.  */
1220 #define DEFAULT_SIGNED_CHAR 0
1221
1222 /* This flag, if defined, says the same insns that convert to a signed fixnum
1223    also convert validly to an unsigned one.
1224
1225    We actually lie a bit here as overflow conditions are different.  But
1226    they aren't being checked anyway.  */
1227
1228 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC
1229
1230 /* Max number of bytes we can move to of from memory
1231    in one reasonably fast instruction.
1232
1233    For the 29k, we will define movti, so put this at 4 words.  */
1234 #define MOVE_MAX 16
1235
1236 /* Largest number of bytes of an object that can be placed in a register.
1237    On the 29k we have plenty of registers, so use TImode.  */
1238 #define MAX_FIXED_MODE_SIZE     GET_MODE_BITSIZE (TImode)
1239
1240 /* Nonzero if access to memory by bytes is no faster than for words.
1241    Also non-zero if doing byte operations (specifically shifts) in registers
1242    is undesirable. 
1243
1244    On the 29k, large masks are expensive, so we want to use bytes to
1245    manipulate fields.  */
1246 #define SLOW_BYTE_ACCESS        0
1247
1248 /* Define if operations between registers always perform the operation
1249    on the full register even if a narrower mode is specified.  */
1250 #define WORD_REGISTER_OPERATIONS
1251
1252 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
1253    will either zero-extend or sign-extend.  The value of this macro should
1254    be the code that says which one of the two operations is implicitly
1255    done, NIL if none.  */
1256 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
1257
1258 /* Define if the object format being used is COFF or a superset.  */
1259 #define OBJECT_FORMAT_COFF
1260
1261 /* This uses COFF, so it wants SDB format.  */
1262 #define SDB_DEBUGGING_INFO
1263
1264 /* Define this to be the delimiter between SDB sub-sections.  The default
1265    is ";".  */
1266 #define SDB_DELIM       "\n"
1267
1268 /* Do not break .stabs pseudos into continuations.  */
1269 #define DBX_CONTIN_LENGTH 0
1270
1271 /* Don't try to use the `x' type-cross-reference character in DBX data.
1272    Also has the consequence of putting each struct, union or enum
1273    into a separate .stabs, containing only cross-refs to the others.  */
1274 #define DBX_NO_XREFS
1275
1276 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1277    is done just by pretending it is already truncated.  */
1278 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1279
1280 /* We assume that the store-condition-codes instructions store 0 for false
1281    and some other value for true.  This is the value stored for true, which
1282    is just the sign bit.  */
1283
1284 #define STORE_FLAG_VALUE (-2147483647 - 1)
1285
1286 /* Specify the machine mode that pointers have.
1287    After generation of rtl, the compiler makes no further distinction
1288    between pointers and any other objects of this machine mode.  */
1289 #define Pmode SImode
1290
1291 /* Mode of a function address in a call instruction (for indexing purposes).
1292
1293    Doesn't matter on 29k.  */
1294 #define FUNCTION_MODE SImode
1295
1296 /* Define this if addresses of constant functions
1297    shouldn't be put through pseudo regs where they can be cse'd.
1298    Desirable on machines where ordinary constants are expensive
1299    but a CALL with constant address is cheap.  */
1300 #define NO_FUNCTION_CSE
1301
1302 /* Define this to be nonzero if shift instructions ignore all but the low-order
1303    few bits. */
1304 #define SHIFT_COUNT_TRUNCATED 1
1305
1306 /* Compute the cost of computing a constant rtl expression RTX
1307    whose rtx-code is CODE.  The body of this macro is a portion
1308    of a switch statement.  If the code is computed here,
1309    return it with a return statement.  Otherwise, break from the switch.
1310
1311    We only care about the cost if it is valid in an insn.  The only
1312    constants that cause an insn to generate more than one machine
1313    instruction are those involving floating-point or address.  So 
1314    only these need be expensive.  */
1315
1316 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1317   case CONST_INT:                                               \
1318     return 0;                                                   \
1319   case CONST:                                                   \
1320   case LABEL_REF:                                               \
1321   case SYMBOL_REF:                                              \
1322     return 6;                                                   \
1323   case CONST_DOUBLE:                                            \
1324     return GET_MODE (RTX) == SFmode ? 6 : 8;
1325     
1326 /* Provide the costs of a rtl expression.  This is in the body of a
1327    switch on CODE.
1328
1329    All MEMs cost the same if they are valid.  This is used to ensure
1330    that (mem (symbol_ref ...)) is placed into a CALL when valid.
1331
1332    The multiply cost depends on whether this is a 29050 or not.  */
1333
1334 #define RTX_COSTS(X,CODE,OUTER_CODE)                    \
1335   case MULT:                                            \
1336     return TARGET_29050 ? COSTS_N_INSNS (2) : COSTS_N_INSNS (40);  \
1337   case DIV:                                             \
1338   case UDIV:                                            \
1339   case MOD:                                             \
1340   case UMOD:                                            \
1341     return COSTS_N_INSNS (50);                          \
1342   case MEM:                                             \
1343     return COSTS_N_INSNS (2);
1344 \f
1345 /* Control the assembler format that we output.  */
1346
1347 /* Output at beginning of assembler file.  */
1348
1349 #define ASM_FILE_START(FILE)                                    \
1350 { char *p, *after_dir = main_input_filename;                    \
1351   if (TARGET_29050)                                             \
1352     fprintf (FILE, "\t.cputype 29050\n");                       \
1353   for (p = main_input_filename; *p; p++)                        \
1354     if (*p == '/')                                              \
1355       after_dir = p + 1;                                        \
1356   fprintf (FILE, "\t.file ");                                   \
1357   output_quoted_string (FILE, after_dir);                       \
1358   fprintf (FILE, "\n");                                         \
1359   fprintf (FILE, "\t.sect .lit,lit\n"); }
1360
1361 /* Output to assembler file text saying following lines
1362    may contain character constants, extra white space, comments, etc.  */
1363
1364 #define ASM_APP_ON ""
1365
1366 /* Output to assembler file text saying following lines
1367    no longer contain unusual constructs.  */
1368
1369 #define ASM_APP_OFF ""
1370
1371 /* The next few macros don't have tabs on most machines, but
1372    at least one 29K assembler wants them.  */
1373
1374 /* Output before instructions.  */
1375
1376 #define TEXT_SECTION_ASM_OP "\t.text"
1377
1378 /* Output before read-only data.  */
1379
1380 #define READONLY_DATA_SECTION_ASM_OP "\t.use .lit"
1381
1382 /* Output before writable data.  */
1383
1384 #define DATA_SECTION_ASM_OP "\t.data"
1385
1386 /* Define an extra section for read-only data, a routine to enter it, and
1387    indicate that it is for read-only data.  */
1388
1389 #define EXTRA_SECTIONS  readonly_data
1390
1391 #define EXTRA_SECTION_FUNCTIONS                                 \
1392 void                                                            \
1393 literal_section ()                                              \
1394 {                                                               \
1395   if (in_section != readonly_data)                              \
1396     {                                                           \
1397       fprintf (asm_out_file, "%s\n", READONLY_DATA_SECTION_ASM_OP); \
1398       in_section = readonly_data;                               \
1399     }                                                           \
1400 }                                                               \
1401
1402 #define READONLY_DATA_SECTION   literal_section
1403
1404 /* If we are referencing a function that is static or is known to be
1405    in this file, make the SYMBOL_REF special.  We can use this to indicate
1406    that we can branch to this function without emitting a no-op after the
1407    call.  */
1408
1409 #define ENCODE_SECTION_INFO(DECL)  \
1410   if (TREE_CODE (DECL) == FUNCTION_DECL                 \
1411       && (TREE_ASM_WRITTEN (DECL) || ! TREE_PUBLIC (DECL))) \
1412     SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;
1413
1414 /* How to refer to registers in assembler output.
1415    This sequence is indexed by compiler's hard-register-number (see above).  */
1416
1417 #define REGISTER_NAMES \
1418 {"gr96", "gr97", "gr98", "gr99", "gr100", "gr101", "gr102", "gr103", "gr104", \
1419  "gr105", "gr106", "gr107", "gr108", "gr109", "gr110", "gr111", "gr112", \
1420  "gr113", "gr114", "gr115", "gr116", "gr117", "gr118", "gr119", "gr120", \
1421  "gr121", "gr122", "gr123", "gr124", "gr125", "gr126", "gr127",          \
1422  "lr0", "lr1", "lr2", "lr3", "lr4", "lr5", "lr6", "lr7", "lr8", "lr9",   \
1423  "lr10", "lr11", "lr12", "lr13", "lr14", "lr15", "lr16", "lr17", "lr18", \
1424  "lr19", "lr20", "lr21", "lr22", "lr23", "lr24", "lr25", "lr26", "lr27", \
1425  "lr28", "lr29", "lr30", "lr31", "lr32", "lr33", "lr34", "lr35", "lr36", \
1426  "lr37", "lr38", "lr39", "lr40", "lr41", "lr42", "lr43", "lr44", "lr45", \
1427  "lr46", "lr47", "lr48", "lr49", "lr50", "lr51", "lr52", "lr53", "lr54", \
1428  "lr55", "lr56", "lr57", "lr58", "lr59", "lr60", "lr61", "lr62", "lr63", \
1429  "lr64", "lr65", "lr66", "lr67", "lr68", "lr69", "lr70", "lr71", "lr72", \
1430  "lr73", "lr74", "lr75", "lr76", "lr77", "lr78", "lr79", "lr80", "lr81", \
1431  "lr82", "lr83", "lr84", "lr85", "lr86", "lr87", "lr88", "lr89", "lr90", \
1432  "lr91", "lr92", "lr93", "lr94", "lr95", "lr96", "lr97", "lr98", "lr99", \
1433  "lr100", "lr101", "lr102", "lr103", "lr104", "lr105", "lr106", "lr107", \
1434  "lr108", "lr109", "lr110", "lr111", "lr112", "lr113", "lr114", "lr115", \
1435  "lr116", "lr117", "lr118", "lr119", "lr120", "lr121", "lr122", "lr123", \
1436  "lr124", "lr125", "lr126", "lr127",                                     \
1437   "AI0", "AI1", "AI2", "AI3", "AI4", "AI5", "AI6", "AI7", "AI8", "AI9",  \
1438   "AI10", "AI11", "AI12", "AI13", "AI14", "AI15", "FP",                  \
1439   "bp", "fc", "cr", "q",                                                 \
1440   "vab", "ops", "cps", "cfg", "cha", "chd", "chc", "rbp", "tmc", "tmr",  \
1441   "pc0", "pc1", "pc2", "mmu", "lru", "fpe", "int", "fps", "exo",         \
1442   "0", "1", "2", "3",                                                    \
1443   "gr64", "gr65", "gr66", "gr67", "gr68", "gr69", "gr70", "gr71",        \
1444   "gr72", "gr73", "gr74", "gr75", "gr76", "gr77", "gr78", "gr79",        \
1445   "gr80", "gr81", "gr82", "gr83", "gr84", "gr85", "gr86", "gr87",        \
1446   "gr88", "gr89", "gr90", "gr91", "gr92", "gr93", "gr94", "gr95" }
1447
1448 /* How to renumber registers for dbx and gdb.  */
1449
1450 extern int a29k_debug_reg_map[];
1451 #define DBX_REGISTER_NUMBER(REGNO) a29k_debug_reg_map[REGNO]
1452
1453 /* This how to write an assembler directive to FILE to switch to
1454    section NAME for DECL.  */
1455
1456 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
1457   fprintf (FILE, "\t.sect %s, bss\n\t.use %s\n", NAME, NAME)
1458
1459 /* This is how to output the definition of a user-level label named NAME,
1460    such as the label on a static function or variable NAME.  */
1461
1462 #define ASM_OUTPUT_LABEL(FILE,NAME)     \
1463   do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1464
1465 /* This is how to output a command to make the user-level label named NAME
1466    defined for reference from other files.  */
1467
1468 #define ASM_GLOBALIZE_LABEL(FILE,NAME)  \
1469   do { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
1470
1471 /* The prefix to add to user-visible assembler symbols. */
1472
1473 #undef USER_LABEL_PREFIX
1474 #define USER_LABEL_PREFIX "_"
1475
1476 /* This is how to output an internal numbered label where
1477    PREFIX is the class of label and NUM is the number within the class.  */
1478
1479 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)      \
1480   fprintf (FILE, "%s%d:\n", PREFIX, NUM)
1481
1482 /* This is how to output a label for a jump table.  Arguments are the same as
1483    for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is
1484    passed. */
1485
1486 #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN)        \
1487 { ASM_OUTPUT_ALIGN (FILE, 2); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
1488
1489 /* This is how to store into the string LABEL
1490    the symbol_ref name of an internal numbered label where
1491    PREFIX is the class of label and NUM is the number within the class.
1492    This is suitable for output with `assemble_name'.  */
1493
1494 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)   \
1495   sprintf (LABEL, "*%s%d", PREFIX, NUM)
1496
1497 /* This is how to output an assembler line defining a `double' constant.  */
1498
1499 #define ASM_OUTPUT_DOUBLE(FILE,VALUE)           \
1500   fprintf (FILE, "\t.double %.20e\n", (VALUE))
1501
1502 /* This is how to output an assembler line defining a `float' constant.  */
1503
1504 #define ASM_OUTPUT_FLOAT(FILE,VALUE)            \
1505   fprintf (FILE, "\t.float %.20e\n", (VALUE))
1506
1507 /* This is how to output an assembler line defining an `int' constant.  */
1508
1509 #define ASM_OUTPUT_INT(FILE,VALUE)  \
1510 ( fprintf (FILE, "\t.word "),                   \
1511   output_addr_const (FILE, (VALUE)),            \
1512   fprintf (FILE, "\n"))
1513
1514 /* Likewise for `char' and `short' constants.  */
1515
1516 #define ASM_OUTPUT_SHORT(FILE,VALUE)  \
1517 ( fprintf (FILE, "\t.hword "),                  \
1518   output_addr_const (FILE, (VALUE)),            \
1519   fprintf (FILE, "\n"))
1520
1521 #define ASM_OUTPUT_CHAR(FILE,VALUE)  \
1522 ( fprintf (FILE, "\t.byte "),                   \
1523   output_addr_const (FILE, (VALUE)),            \
1524   fprintf (FILE, "\n"))
1525
1526 /* This is how to output an insn to push a register on the stack.
1527    It need not be very fast code.  */
1528
1529 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)                                 \
1530   fprintf (FILE, "\tsub %s,%s,4\n\tstore 0,0,%s,%s\n",                  \
1531            reg_names[R_MSP], reg_names[R_MSP], reg_names[REGNO],        \
1532            reg_names[R_MSP]);
1533
1534 /* This is how to output an insn to pop a register from the stack.
1535    It need not be very fast code.  */
1536
1537 #define ASM_OUTPUT_REG_POP(FILE,REGNO)                                  \
1538   fprintf (FILE, "\tload 0,0,%s,%s\n\tadd %s,%s,4\n",                   \
1539            reg_names[REGNO], reg_names[R_MSP], reg_names[R_MSP],        \
1540            reg_names[R_MSP]);
1541
1542 /* This is how to output an assembler line for a numeric constant byte.  */
1543
1544 #define ASM_OUTPUT_BYTE(FILE,VALUE)  \
1545   fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1546
1547 /* This is how to output an element of a case-vector that is absolute.  */
1548
1549 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
1550   fprintf (FILE, "\t.word L%d\n", VALUE)
1551
1552 /* This is how to output an element of a case-vector that is relative.
1553    Don't define this if it is not supported. */
1554
1555 /* #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) */
1556
1557 /* This is how to output an assembler line
1558    that says to advance the location counter
1559    to a multiple of 2**LOG bytes.  */
1560
1561 #define ASM_OUTPUT_ALIGN(FILE,LOG)      \
1562   if ((LOG) != 0)                       \
1563     fprintf (FILE, "\t.align %d\n", 1 << (LOG))
1564
1565 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
1566   fprintf (FILE, "\t.block %d\n", (SIZE))
1567
1568 /* This says how to output an assembler line
1569    to define a global common symbol.  */
1570
1571 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
1572 ( fputs ("\t.comm ", (FILE)),                   \
1573   assemble_name ((FILE), (NAME)),               \
1574   fprintf ((FILE), ",%d\n", (SIZE)))
1575
1576 /* This says how to output an assembler line
1577    to define a local common symbol.  */
1578
1579 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED)      \
1580 ( fputs ("\t.lcomm ", (FILE)),                          \
1581   assemble_name ((FILE), (NAME)),                       \
1582   fprintf ((FILE), ",%d\n", (SIZE)))
1583
1584 /* Store in OUTPUT a string (made with alloca) containing
1585    an assembler-name for a local static variable named NAME.
1586    LABELNO is an integer which is different for each call.  */
1587
1588 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)  \
1589 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),    \
1590   sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1591
1592 /* Define the parentheses used to group arithmetic operations
1593    in assembler code.  */
1594
1595 #define ASM_OPEN_PAREN "("
1596 #define ASM_CLOSE_PAREN ")"
1597
1598 /* Define results of standard character escape sequences.  */
1599 #define TARGET_BELL 007
1600 #define TARGET_BS 010
1601 #define TARGET_TAB 011
1602 #define TARGET_NEWLINE 012
1603 #define TARGET_VT 013
1604 #define TARGET_FF 014
1605 #define TARGET_CR 015
1606
1607 /* Print operand X (an rtx) in assembler syntax to file FILE.
1608    CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1609    For `%' followed by punctuation, CODE is the punctuation and X is null.  */
1610
1611 #define PRINT_OPERAND(FILE, X, CODE)  print_operand (FILE, X, CODE)
1612
1613 /* Determine which codes are valid without a following integer.  These must
1614    not be alphabetic.
1615
1616    We support `#' which is null if a delay slot exists, otherwise
1617    "\n\tnop" and `*' which prints the register name for TPC (gr122).  */
1618
1619 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '#' || (CODE) == '*')
1620 \f
1621 /* Print a memory address as an operand to reference that memory location.  */
1622
1623 #define PRINT_OPERAND_ADDRESS(FILE, ADDR)  \
1624 { register rtx addr = ADDR;                                     \
1625   if (!REG_P (addr)                                             \
1626       && ! (GET_CODE (addr) == CONST_INT                        \
1627             && INTVAL (addr) >= 0 && INTVAL (addr) < 256))      \
1628     abort ();                                                   \
1629   output_operand (addr, 0);                                     \
1630 }
1631 /* Define the codes that are matched by predicates in a29k.c.  */
1632
1633 #define PREDICATE_CODES \
1634   {"cint_8_operand", {CONST_INT}},                              \
1635   {"cint_16_operand", {CONST_INT}},                             \
1636   {"long_const_operand", {CONST_INT, CONST, CONST_DOUBLE,       \
1637                           LABEL_REF, SYMBOL_REF}},              \
1638   {"shift_constant_operand", {CONST_INT, ASHIFT}},              \
1639   {"const_0_operand", {CONST_INT, ASHIFT}},                     \
1640   {"const_8_operand", {CONST_INT, ASHIFT}},                     \
1641   {"const_16_operand", {CONST_INT, ASHIFT}},                    \
1642   {"const_24_operand", {CONST_INT, ASHIFT}},                    \
1643   {"float_const_operand", {CONST_DOUBLE}},                      \
1644   {"gpc_reg_operand", {SUBREG, REG}},                           \
1645   {"gpc_reg_or_float_constant_operand", {SUBREG, REG, CONST_DOUBLE}}, \
1646   {"gpc_reg_or_integer_constant_operand", {SUBREG, REG,         \
1647                                            CONST_INT, CONST_DOUBLE}}, \
1648   {"gpc_reg_or_immediate_operand", {SUBREG, REG, CONST_INT,     \
1649                                     CONST_DOUBLE, CONST,        \
1650                                     SYMBOL_REF, LABEL_REF}},    \
1651   {"spec_reg_operand", {REG}},                                  \
1652   {"accum_reg_operand", {REG}},                                 \
1653   {"srcb_operand", {SUBREG, REG, CONST_INT}},                   \
1654   {"cmplsrcb_operand", {SUBREG, REG, CONST_INT}},               \
1655   {"reg_or_immediate_operand", {SUBREG, REG, CONST_INT, CONST,  \
1656                                 CONST_DOUBLE, CONST, SYMBOL_REF, LABEL_REF}}, \
1657   {"reg_or_u_short_operand", {SUBREG, REG, CONST_INT}},         \
1658   {"and_operand", {SUBREG, REG, CONST_INT}},                    \
1659   {"add_operand", {SUBREG, REG, CONST_INT}},                    \
1660   {"call_operand", {SYMBOL_REF, CONST_INT}},                    \
1661   {"in_operand", {SUBREG, MEM, REG, CONST_INT, CONST, SYMBOL_REF, \
1662                   LABEL_REF, CONST_DOUBLE}},                    \
1663   {"out_operand", {SUBREG, REG, MEM}},                          \
1664   {"reload_memory_operand", {SUBREG, REG, MEM}},                \
1665   {"fp_comparison_operator", {EQ, GT, GE}},                     \
1666   {"branch_operator", {GE, LT}},                                \
1667   {"load_multiple_operation", {PARALLEL}},                      \
1668   {"store_multiple_operation", {PARALLEL}},                     \
1669   {"epilogue_operand", {CODE_LABEL}},