Define SHIFT_COUNT_TRUNCATED to have a value of 1.
[gcc.git] / gcc / config / pyr / pyr.h
1 /* Definitions of target machine parameters for GNU compiler,
2 for Pyramid 90x, 9000, and MIServer Series.
3 Copyright (C) 1989 Free Software Foundation, Inc.
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20 \f
21 /*
22 * If you're going to change this, and you haven't already,
23 * you should get and read
24 * ``OSx Operating System Porting Guide'',
25 * publication number 4100-0066-A
26 * Revision A
27 * Pyramid Technology Corporation.
28 *
29 * or whatever the most recent version is. In any case, page and
30 * section number references given herein refer to this document.
31 *
32 * The instruction table for gdb lists the available insns and
33 * the valid addressing modes.
34 *
35 * Any other information on the Pyramid architecture is proprietary
36 * and hard to get. (Pyramid cc -S and adb are also useful.)
37 *
38 */
39
40 /*** Run-time compilation parameters selecting different hardware subsets. ***/
41
42 /* Names to predefine in the preprocessor for this target machine. */
43
44 #define CPP_PREDEFINES "-Dpyr -Dunix -Asystem(unix) -Acpu(pyr) -Amachine(pyr)"
45
46 /* Print subsidiary information on the compiler version in use. */
47
48 #define TARGET_VERSION fprintf (stderr, " (pyr)");
49
50 extern int target_flags;
51
52 /* Nonzero if compiling code that Unix assembler can assemble. */
53 #define TARGET_UNIX_ASM (target_flags & 1)
54
55 /* Implement stdarg in the same fashion used on all other machines. */
56 #define TARGET_GNU_STDARG (target_flags & 2)
57
58 /* Compile using RETD to pop off the args.
59 This will not work unless you use prototypes at least
60 for all functions that can take varying numbers of args.
61 This contravenes the Pyramid calling convention, so we don't
62 do it yet. */
63
64 #define TARGET_RETD (target_flags & 4)
65
66 /* Macros used in the machine description to test the flags. */
67
68 /* Macro to define tables used to set the flags.
69 This is a list in braces of pairs in braces,
70 each pair being { "NAME", VALUE }
71 where VALUE is the bits to set or minus the bits to clear.
72 An empty string NAME is used to identify the default VALUE.
73
74 -mgnu will be useful if we ever have GAS on a pyramid. */
75
76 #define TARGET_SWITCHES \
77 { {"unix", 1}, \
78 {"gnu", -1}, \
79 {"gnu-stdarg", 2}, \
80 {"nognu-stdarg", -2}, \
81 {"retd", 4}, \
82 {"no-retd", -4}, \
83 { "", TARGET_DEFAULT}}
84
85 /* Default target_flags if no switches specified.
86
87 (equivalent to "-munix -mindex -mgnu-stdarg") */
88
89 #ifndef TARGET_DEFAULT
90 #define TARGET_DEFAULT (1 + 2)
91 #endif
92
93 /* Make GCC agree with types.h. */
94 #ifdef SIZE_TYPE
95 #undef SIZE_TYPE
96 #endif
97 #define SIZE_TYPE "unsigned int"
98
99 /* Assembler does not permit $ in labels */
100
101 #define NO_DOLLAR_IN_LABEL
102
103 /* Maybe it doesn't permit dot either. */
104 #define NO_DOT_IN_LABEL
105
106 /* Never allow $ in identifiers */
107
108 #define DOLLARS_IN_IDENTIFIERS 0
109 \f
110 /*** Target machine storage layout ***/
111
112 /* Define this to non-zero if most significant bit is lowest
113 numbered in instructions that operate on numbered bit-fields.
114 This is not true on the pyramid. */
115 #define BITS_BIG_ENDIAN 0
116
117 /* Define this to non-zero if most significant byte of a word is
118 the lowest numbered. */
119 #define BYTES_BIG_ENDIAN 1
120
121 /* Define this to non-zero if most significant word of a multiword
122 number is the lowest numbered. */
123 #define WORDS_BIG_ENDIAN 1
124
125 /* Number of bits in an addressable storage unit */
126 #define BITS_PER_UNIT 8
127
128 /* Width in bits of a "word", which is the contents of a machine register.
129 Note that this is not necessarily the width of data type `int';
130 if using 16-bit ints on a 68000, this would still be 32.
131 But on a machine with 16-bit registers, this would be 16. */
132 #define BITS_PER_WORD 32
133
134 /* Width of a word, in units (bytes). */
135 #define UNITS_PER_WORD 4
136
137 /* Width in bits of a pointer.
138 See also the macro `Pmode' defined below. */
139 #define POINTER_SIZE 32
140
141 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
142 #define PARM_BOUNDARY 32
143
144 /* Boundary (in *bits*) on which stack pointer should be aligned. */
145 #define STACK_BOUNDARY 32
146
147 /* Allocation boundary (in *bits*) for the code of a function. */
148 #define FUNCTION_BOUNDARY 32
149
150 /* Alignment of field after `int : 0' in a structure. */
151 #define EMPTY_FIELD_BOUNDARY 32
152
153 /* Every structure's size must be a multiple of this. */
154 #define STRUCTURE_SIZE_BOUNDARY 32
155
156 /* No data type wants to be aligned rounder than this. */
157 #define BIGGEST_ALIGNMENT 32
158
159 /* Specified types of bitfields affect alignment of those fields
160 and of the structure as a whole. */
161 #define PCC_BITFIELD_TYPE_MATTERS 1
162
163 /* Make strings word-aligned so strcpy from constants will be faster.
164 Pyramid documentation says the best alignment is to align
165 on the size of a cache line, which is 32 bytes.
166 Newer pyrs have single insns that do strcmp() and strcpy(), so this
167 may not actually win anything. */
168 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
169 (TREE_CODE (EXP) == STRING_CST \
170 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
171
172 /* Make arrays of chars word-aligned for the same reasons. */
173 #define DATA_ALIGNMENT(TYPE, ALIGN) \
174 (TREE_CODE (TYPE) == ARRAY_TYPE \
175 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
176 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
177
178 /* Set this nonzero if move instructions will actually fail to work
179 when given unaligned data. */
180 #define STRICT_ALIGNMENT 1
181 \f
182 /*** Standard register usage. ***/
183
184 /* Number of actual hardware registers.
185 The hardware registers are assigned numbers for the compiler
186 from 0 to just below FIRST_PSEUDO_REGISTER.
187 All registers that the compiler knows about must be given numbers,
188 even those that are not normally considered general registers. */
189
190 /* Nota Bene:
191 Pyramids have 64 addressable 32-bit registers, arranged as four
192 groups of sixteen registers each. Pyramid names the groups
193 global, parameter, local, and temporary.
194
195 The sixteen global registers are fairly conventional; the last
196 four are overloaded with a PSW, frame pointer, stack pointer, and pc.
197 The non-dedicated global registers used to be reserved for Pyramid
198 operating systems, and still have cryptic and undocumented uses for
199 certain library calls. We do not use global registers gr0 through
200 gr11.
201
202 The parameter, local, and temporary registers provide register
203 windowing. Each procedure call has its own set of these 48
204 registers, which constitute its call frame. (These frames are
205 not allocated on the conventional stack, but contiguously
206 on a separate stack called the control stack.)
207 Register windowing is a facility whereby the temporary registers
208 of frame n become the parameter registers of frame n+1, viz.:
209
210 0 15 0 15 0 15
211 +------------+------------+------------+
212 frame n+1 | | | |
213 +------------+------------+------------+
214 Parameter Local Temporary
215
216 ^
217 | These 16 regs are the same.
218 v
219
220 0 15 0 15 0 15
221 +------------+------------+------------+
222 frame n | | | |
223 +------------+------------+------------+
224 Parameter Local Temporary
225
226 New frames are automatically allocated on the control stack by the
227 call instruction and de-allocated by the return insns "ret" and
228 "retd". The control-stack grows contiguously upward from a
229 well-known address in memory; programs are free to allocate
230 a variable sized, conventional frame on the data stack, which
231 grows downwards in memory from just below the control stack.
232
233 Temporary registers are used for parameter passing, and are not
234 preserved across calls. TR0 through TR11 correspond to
235 gcc's ``input'' registers; PR0 through TR11 the ``output''
236 registers. The call insn stores the PC and PSW in PR14 and PR15 of
237 the frame it creates; the return insns restore these into the PC
238 and PSW. The same is true for interrupts; TR14 and TR15 of the
239 current frame are reserved and should never be used, since an
240 interrupt may occur at any time and clobber them.
241
242 An interesting quirk is the ability to take the address of a
243 variable in a windowed register. This done by adding the memory
244 address of the base of the current window frame, to the offset
245 within the frame of the desired register. The resulting address
246 can be treated just like any other pointer; if a quantity is stored
247 into that address, the appropriate register also changes.
248 GCC does not, and according to RMS will not, support this feature,
249 even though some programs rely on this (mis)feature.
250 */
251
252 #define PYR_GREG(n) (n)
253 #define PYR_PREG(n) (16+(n))
254 #define PYR_LREG(n) (32+(n))
255 #define PYR_TREG(n) (48+(n))
256
257 /* Define this macro if the target machine has "register windows". This
258 C expression returns the register number as seen by the called function
259 corresponding to register number OUT as seen by the calling function.
260 Return OUT if register number OUT is not an outbound register. */
261
262 #define INCOMING_REGNO(OUT) \
263 (((OUT) < 48 || (OUT) > 63) ? (OUT) : (OUT) - 32)
264
265 /* Define this macro if the target machine has "register windows". This
266 C expression returns the register number as seen by the calling function
267 corresponding to register number IN as seen by the called function.
268 Return IN if register number IN is not an inbound register. */
269
270 #define OUTGOING_REGNO(IN) \
271 (((IN) < 15 || (IN) > 31) ? (IN) : (IN) + 32)
272
273 #define FIRST_PSEUDO_REGISTER 64
274
275 /* 1 for registers that have pervasive standard uses
276 and are not available for the register allocator.
277
278 On the pyramid, these are LOGPSW, SP, and PC. */
279
280 #define FIXED_REGISTERS \
281 {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
282 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, \
283 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
284 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}
285
286 /* 1 for registers not available across function calls.
287 These must include the FIXED_REGISTERS and also any
288 registers that can be used without being saved.
289 The latter must include the registers where values are returned
290 and the register where structure-value addresses are passed.
291 Aside from that, you can include as many other registers as you like. */
292 #define CALL_USED_REGISTERS \
293 {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
294 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, \
295 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
296 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
297
298 /* #define DEFAULT_CALLER_SAVES */
299
300 /* Return number of consecutive hard regs needed starting at reg REGNO
301 to hold something of mode MODE.
302 This is ordinarily the length in words of a value of mode MODE
303 but can be less for certain modes in special long registers.
304 On the pyramid, all registers are one word long. */
305 #define HARD_REGNO_NREGS(REGNO, MODE) \
306 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
307
308 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
309 On the pyramid, all registers can hold all modes. */
310
311 /* -->FIXME: this is not the case for 64-bit quantities in tr11/12 through
312 --> TR14/15. This should be fixed, but to do it correctly, we also
313 --> need to fix MODES_TIEABLE_P. Yuk. We ignore this, since GCC should
314 --> do the "right" thing due to FIXED_REGISTERS. */
315 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
316
317 /* Value is 1 if it is a good idea to tie two pseudo registers
318 when one has mode MODE1 and one has mode MODE2.
319 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
320 for any hard reg, then this must be 0 for correct output. */
321 #define MODES_TIEABLE_P(MODE1, MODE2) 1
322
323 /* Specify the registers used for certain standard purposes.
324 The values of these macros are register numbers. */
325
326 /* Pyramid pc is overloaded on global register 15. */
327 #define PC_REGNUM PYR_GREG(15)
328
329 /* Register to use for pushing function arguments.
330 --> on Pyramids, the data stack pointer. */
331 #define STACK_POINTER_REGNUM PYR_GREG(14)
332
333 /* Base register for access to local variables of the function.
334 Pyramid uses CFP (GR13) as both frame pointer and argument pointer. */
335 #define FRAME_POINTER_REGNUM 13 /* pyr cpp fails on PYR_GREG(13) */
336
337 /* Value should be nonzero if functions must have frame pointers.
338 Zero means the frame pointer need not be set up (and parms
339 may be accessed via the stack pointer) in functions that seem suitable.
340 This is computed in `reload', in reload1.c.
341
342 Setting this to 1 can't break anything. Since the Pyramid has
343 register windows, I don't know if defining this to be zero can
344 win anything. It could changed later, if it wins. */
345 #define FRAME_POINTER_REQUIRED 1
346
347 /* Base register for access to arguments of the function. */
348 #define ARG_POINTER_REGNUM 13 /* PYR_GREG(13) */
349
350 /* Register in which static-chain is passed to a function. */
351 /* If needed, Pyramid says to use temporary register 12. */
352 #define STATIC_CHAIN_REGNUM PYR_TREG(12)
353
354 /* If register windows are used, STATIC_CHAIN_INCOMING_REGNUM
355 is the register number as seen by the called function, while
356 STATIC_CHAIN_REGNUM is the register number as seen by the calling
357 function. */
358 #define STATIC_CHAIN_INCOMING_REGNUM PYR_PREG(12)
359
360 /* Register in which address to store a structure value
361 is passed to a function.
362 On a Pyramid, this is temporary register 0 (TR0). */
363
364 #define STRUCT_VALUE_REGNUM PYR_TREG(0)
365 #define STRUCT_VALUE_INCOMING_REGNUM PYR_PREG(0)
366 \f
367 /* Define the classes of registers for register constraints in the
368 machine description. Also define ranges of constants.
369
370 One of the classes must always be named ALL_REGS and include all hard regs.
371 If there is more than one class, another class must be named NO_REGS
372 and contain no registers.
373
374 The name GENERAL_REGS must be the name of a class (or an alias for
375 another name such as ALL_REGS). This is the class of registers
376 that is allowed by "g" or "r" in a register constraint.
377 Also, registers outside this class are allocated only when
378 instructions express preferences for them.
379
380 The classes must be numbered in nondecreasing order; that is,
381 a larger-numbered class must never be contained completely
382 in a smaller-numbered class.
383
384 For any two classes, it is very desirable that there be another
385 class that represents their union. */
386
387 /* The pyramid has only one kind of registers, so NO_REGS and ALL_REGS
388 are the only classes. */
389
390 enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES };
391
392 #define N_REG_CLASSES (int) LIM_REG_CLASSES
393
394 /* Since GENERAL_REGS is the same class as ALL_REGS,
395 don't give it a different class number; just make it an alias. */
396
397 #define GENERAL_REGS ALL_REGS
398
399 /* Give names of register classes as strings for dump file. */
400
401 #define REG_CLASS_NAMES \
402 {"NO_REGS", "ALL_REGS" }
403
404 /* Define which registers fit in which classes.
405 This is an initializer for a vector of HARD_REG_SET
406 of length N_REG_CLASSES. */
407
408 #define REG_CLASS_CONTENTS {{0,0}, {0xffffffff,0xffffffff}}
409
410 /* The same information, inverted:
411 Return the class number of the smallest class containing
412 reg number REGNO. This could be a conditional expression
413 or could index an array. */
414
415 #define REGNO_REG_CLASS(REGNO) ALL_REGS
416
417 /* The class value for index registers, and the one for base regs. */
418
419 #define BASE_REG_CLASS ALL_REGS
420 #define INDEX_REG_CLASS ALL_REGS
421
422 /* Get reg_class from a letter such as appears in the machine description. */
423
424 #define REG_CLASS_FROM_LETTER(C) NO_REGS
425
426 /* Given an rtx X being reloaded into a reg required to be
427 in class CLASS, return the class of reg to actually use.
428 In general this is just CLASS; but on some machines
429 in some cases it is preferable to use a more restrictive class. */
430
431 #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
432
433 /* Return the maximum number of consecutive registers
434 needed to represent mode MODE in a register of class CLASS. */
435 /* On the pyramid, this is always the size of MODE in words,
436 since all registers are the same size. */
437 #define CLASS_MAX_NREGS(CLASS, MODE) \
438 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
439
440 /* The letters I, J, K, L and M in a register constraint string
441 can be used to stand for particular ranges of immediate operands.
442 This macro defines what the ranges are.
443 C is the letter, and VALUE is a constant value.
444 Return 1 if VALUE is in the range specified by C.
445
446 --> For the Pyramid, 'I' can be used for the 6-bit signed integers
447 --> (-32 to 31) allowed as immediate short operands in many
448 --> instructions. 'J' cane be used for any value that doesn't fit
449 --> in 6 bits. */
450
451 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
452 ((C) == 'I' ? (VALUE) >= -32 && (VALUE) < 32 : \
453 (C) == 'J' ? (VALUE) < -32 || (VALUE) >= 32 : \
454 (C) == 'K' ? (VALUE) == 0xff || (VALUE) == 0xffff : 0)
455
456 /* Similar, but for floating constants, and defining letters G and H.
457 Here VALUE is the CONST_DOUBLE rtx itself. */
458
459 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
460
461 \f
462 /*** Stack layout; function entry, exit and calling. ***/
463
464 /* Define this if pushing a word on the stack
465 makes the stack pointer a smaller address. */
466 #define STACK_GROWS_DOWNWARD
467
468 /* Define this if the nominal address of the stack frame
469 is at the high-address end of the local variables;
470 that is, each additional local variable allocated
471 goes at a more negative offset in the frame. */
472 #define FRAME_GROWS_DOWNWARD
473
474 /* Offset within stack frame to start allocating local variables at.
475 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
476 first local allocated. Otherwise, it is the offset to the BEGINNING
477 of the first local allocated. */
478 /* FIXME: this used to work when defined as 0. But that makes gnu
479 stdargs clobber the first arg. What gives?? */
480 #define STARTING_FRAME_OFFSET 0
481
482 /* Offset of first parameter from the argument pointer register value. */
483 #define FIRST_PARM_OFFSET(FNDECL) 0
484
485 /* Value is the number of bytes of arguments automatically
486 popped when returning from a subroutine call.
487 FUNTYPE is the data type of the function (as a tree),
488 or for a library call it is an identifier node for the subroutine name.
489 SIZE is the number of bytes of arguments passed on the stack.
490
491 The Pyramid OSx Porting Guide says we are never to do this;
492 using RETD in this way violates the Pyramid calling convention.
493 We may nevertheless provide this as an option. */
494
495 #define RETURN_POPS_ARGS(FUNTYPE,SIZE) \
496 ((TARGET_RETD && TREE_CODE (FUNTYPE) != IDENTIFIER_NODE \
497 && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
498 || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
499 == void_type_node))) \
500 ? (SIZE) : 0)
501
502 /* Define how to find the value returned by a function.
503 VALTYPE is the data type of the value (as a tree).
504 If the precise function being called is known, FUNC is its FUNCTION_DECL;
505 otherwise, FUNC is 0. */
506
507 /* --> Pyramid has register windows.
508 --> The caller sees the return value is in TR0(/TR1) regardless of
509 --> its type. */
510
511 #define FUNCTION_VALUE(VALTYPE, FUNC) \
512 gen_rtx (REG, TYPE_MODE (VALTYPE), PYR_TREG(0))
513
514 /* --> but the callee has to leave it in PR0(/PR1) */
515
516 #define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
517 gen_rtx (REG, TYPE_MODE (VALTYPE), PYR_PREG(0))
518
519 /* Define how to find the value returned by a library function
520 assuming the value has mode MODE. */
521
522 /* --> On Pyramid the return value is in TR0/TR1 regardless. */
523
524 #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, PYR_TREG(0))
525
526 /* Define this if PCC uses the nonreentrant convention for returning
527 structure and union values. */
528
529 #define PCC_STATIC_STRUCT_RETURN
530
531 /* 1 if N is a possible register number for a function value
532 as seen by the caller.
533
534 On the Pyramid, TR0 is the only register thus used. */
535
536 #define FUNCTION_VALUE_REGNO_P(N) ((N) == PYR_TREG(0))
537
538 /* 1 if N is a possible register number for function argument passing.
539 On the Pyramid, the first twelve temporary registers are available. */
540
541 /* FIXME FIXME FIXME
542 it's not clear whether this macro should be defined from the point
543 of view of the caller or the callee. Since it's never actually used
544 in GNU CC, the point is somewhat moot :-).
545
546 This definition is consistent with register usage in the md's for
547 other register-window architectures (sparc and spur).
548 */
549 #define FUNCTION_ARG_REGNO_P(N) ((PYR_TREG(0) <= (N)) && ((N) <= PYR_TREG(11)))
550 \f
551 /*** Parameter passing: FUNCTION_ARG and FUNCTION_INCOMING_ARG ***/
552
553 /* Define a data type for recording info about an argument list
554 during the scan of that argument list. This data type should
555 hold all necessary information about the function itself
556 and about the args processed so far, enough to enable macros
557 such as FUNCTION_ARG to determine where the next arg should go.
558
559 On Pyramids, each parameter is passed either completely on the stack
560 or completely in registers. No parameter larger than a double may
561 be passed in a register. Also, no struct or union may be passed in
562 a register, even if it would fit.
563
564 So parameters are not necessarily passed "consecutively".
565 Thus we need a vector data type: one element to record how many
566 parameters have been passed in registers and on the stack,
567 respectively.
568
569 ((These constraints seem like a gross waste of registers. But if we
570 ignore the constraint about structs & unions, we won`t be able to
571 freely mix gcc-compiled code and pyr cc-compiled code. It looks
572 like better argument passing conventions, and a machine-dependent
573 flag to enable them, might be a win.)) */
574
575
576 #define CUMULATIVE_ARGS int
577
578 /* Define the number of registers that can hold parameters.
579 This macro is used only in other macro definitions below. */
580 #define NPARM_REGS 12
581
582 /* Decide whether or not a parameter can be put in a register.
583 (We may still have problems with libcalls. GCC doesn't seem
584 to know about anything more than the machine mode. I trust
585 structures are never passed to a libcall...
586
587 If compiling with -mgnu-stdarg, this definition should make
588 functions using the gcc-supplied stdarg, and calls to such
589 functions (declared with an arglist ending in"..."), work.
590 But such fns won't be able to call pyr cc-compiled
591 varargs fns (eg, printf(), _doprnt.)
592
593 If compiling with -mnognu-stdarg, this definition should make
594 calls to pyr cc-compiled functions work. Functions using
595 the gcc-supplied stdarg will be utterly broken.
596 There will be no better solution until RMS can be persuaded that
597 one is needed.
598
599 This macro is used only in other macro definitions below.
600 (well, it may be used in pyr.c, because the damn pyramid cc
601 can't handle the macro definition of PARAM_SAFE_FOR_REG_P ! */
602
603
604 #define INNER_PARAM_SAFE_HELPER(TYPE) \
605 ((TARGET_GNU_STDARG ? (! TREE_ADDRESSABLE ((tree)TYPE)): 1) \
606 && (TREE_CODE ((tree)TYPE) != RECORD_TYPE) \
607 && (TREE_CODE ((tree)TYPE) != UNION_TYPE))
608
609 #ifdef __GNUC__
610 #define PARAM_SAFE_HELPER(TYPE) \
611 INNER_PARAM_SAFE_HELPER((TYPE))
612 #else
613 extern int inner_param_safe_helper();
614 #define PARAM_SAFE_HELPER(TYPE) \
615 inner_param_safe_helper((tree)(TYPE))
616 #endif
617
618 /* Be careful with the expression (long) (TYPE) == 0.
619 Writing it in more obvious/correct forms makes the Pyr cc
620 dump core! */
621 #define PARAM_SAFE_FOR_REG_P(MODE, TYPE, NAMED) \
622 (((MODE) != BLKmode) \
623 && ((TARGET_GNU_STDARG) ? (NAMED) : 1) \
624 && ((((long)(TYPE))==0) || PARAM_SAFE_HELPER((TYPE))))
625
626 /* Initialize a variable CUM of type CUMULATIVE_ARGS
627 for a call to a function whose data type is FNTYPE.
628 For a library call, FNTYPE is 0. */
629
630 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) \
631 ((CUM) = (FNTYPE && !flag_pcc_struct_return \
632 && aggregate_value_p (TREE_TYPE (FNTYPE))))
633
634 /* Determine where to put an argument to a function.
635 Value is zero to push the argument on the stack,
636 or a hard register in which to store the argument.
637
638 MODE is the argument's machine mode.
639 TYPE is the data type of the argument (as a tree).
640 This is null for libcalls where that information may
641 not be available.
642 CUM is a variable of type CUMULATIVE_ARGS which gives info about
643 the preceding args and about the function being called.
644 NAMED is nonzero if this argument is a named parameter
645 (otherwise it is an extra parameter matching an ellipsis). */
646
647 #define FUNCTION_ARG_HELPER(CUM, MODE, TYPE, NAMED) \
648 (PARAM_SAFE_FOR_REG_P(MODE,TYPE,NAMED) \
649 ? (NPARM_REGS >= ((CUM) \
650 + ((MODE) == BLKmode \
651 ? (int_size_in_bytes (TYPE) + 3) / 4 \
652 : (GET_MODE_SIZE (MODE) + 3) / 4)) \
653 ? gen_rtx (REG, (MODE), PYR_TREG(CUM)) \
654 : 0) \
655 : 0)
656 #ifdef __GNUC__
657 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
658 FUNCTION_ARG_HELPER(CUM, MODE, TYPE, NAMED)
659 #else
660 /***************** Avoid bug in Pyramid OSx compiler... ******************/
661 #define FUNCTION_ARG (rtx) pyr_function_arg
662 extern void* pyr_function_arg ();
663 #endif
664
665 /* Define where a function finds its arguments.
666 This is different from FUNCTION_ARG because of register windows. */
667
668 #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
669 (PARAM_SAFE_FOR_REG_P(MODE,TYPE,NAMED) \
670 ? (NPARM_REGS >= ((CUM) \
671 + ((MODE) == BLKmode \
672 ? (int_size_in_bytes (TYPE) + 3) / 4 \
673 : (GET_MODE_SIZE (MODE) + 3) / 4)) \
674 ? gen_rtx (REG, (MODE), PYR_PREG(CUM)) \
675 : 0) \
676 : 0)
677
678 /* Update the data in CUM to advance over an argument
679 of mode MODE and data type TYPE.
680 (TYPE is null for libcalls where that information may not be available.) */
681
682 #define FUNCTION_ARG_ADVANCE(CUM,MODE,TYPE,NAMED) \
683 ((CUM) += (PARAM_SAFE_FOR_REG_P(MODE,TYPE,NAMED) \
684 ? ((MODE) != BLKmode \
685 ? (GET_MODE_SIZE (MODE) + 3) / 4 \
686 : (int_size_in_bytes (TYPE) + 3) / 4) \
687 : 0))
688
689 /* This macro generates the assembly code for function entry.
690 FILE is a stdio stream to output the code to.
691 SIZE is an int: how many units of temporary storage to allocate.
692 Refer to the array `regs_ever_live' to determine which registers
693 to save; `regs_ever_live[I]' is nonzero if register number I
694 is ever used in the function. This macro is responsible for
695 knowing which registers should not be saved even if used. */
696
697 #if FRAME_POINTER_REQUIRED
698
699 /* We always have frame pointers */
700
701 /* Don't set up a frame pointer if it's not referenced. */
702
703 #define FUNCTION_PROLOGUE(FILE, SIZE) \
704 { \
705 int _size = (SIZE) + current_function_pretend_args_size; \
706 if (_size + current_function_args_size != 0 \
707 || current_function_calls_alloca) \
708 { \
709 fprintf (FILE, "\tadsf $%d\n", _size); \
710 if (current_function_pretend_args_size > 0) \
711 fprintf (FILE, "\tsubw $%d,cfp\n", \
712 current_function_pretend_args_size); \
713 } \
714 }
715
716 #else /* !FRAME_POINTER_REQUIRED */
717
718 /* Don't set up a frame pointer if `frame_pointer_needed' tells us
719 there is no need. Also, don't set up a frame pointer if it's not
720 referenced. */
721
722 /* The definition used to be broken. Write a new one. */
723
724 #endif /* !FRAME_POINTER_REQUIRED */
725
726 /* the trampoline stuff was taken from convex.h - S.P. */
727
728 /* A C statement to output, on the stream FILE, assembler code for a
729 block of data that contains the constant parts of a trampoline. This
730 code should not include a label - the label is taken care of
731 automatically.
732 We use TR12/PR12 for the static chain.
733 movew $<STATIC>,pr12 # I2R
734 jump $<func> # S2R
735 */
736 #define TRAMPOLINE_TEMPLATE(FILE) \
737 { ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x2100001C)); \
738 ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); \
739 ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x40000000)); \
740 ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); }
741
742 #define TRAMPOLINE_SIZE 16
743 #define TRAMPOLINE_ALIGNMENT 32
744
745 /* Emit RTL insns to initialize the variable parts of a trampoline.
746 FNADDR is an RTX for the address of the function's pure code.
747 CXT is an RTX for the static chain value for the function. */
748
749 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
750 { emit_move_insn (gen_rtx (MEM, Pmode, plus_constant (TRAMP, 4)), CXT); \
751 emit_move_insn (gen_rtx (MEM, Pmode, plus_constant (TRAMP, 12)), FNADDR); \
752 emit_call_insn (gen_call (gen_rtx (MEM, QImode, \
753 gen_rtx (SYMBOL_REF, Pmode, \
754 "__enable_execute_stack")), \
755 const0_rtx)); \
756 }
757
758 /* Output assembler code to FILE to increment profiler label # LABELNO
759 for profiling a function entry. */
760 #define FUNCTION_PROFILER(FILE, LABELNO) \
761 fprintf (FILE, "\tmova LP%d,tr0\n\tcall mcount\n", (LABELNO));
762
763 /* Output assembler code to FILE to initialize this source file's
764 basic block profiling info, if that has not already been done.
765 Don't know if this works on Pyrs. */
766
767 #if 0 /* don't do basic_block profiling yet */
768 #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
769 fprintf (FILE, \
770 "\tmtstw LPBX0,tr0\n\tbne LPI%d\n\tmova LP%d,TR0\n\tcall __bb_init_func\nLPI%d:\n", \
771 LABELNO, LABELNO);
772
773 /* Output assembler code to increment the count associated with
774 the basic block number BLOCKNO. Not sure how to do this on pyrs. */
775 #define BLOCK_PROFILER(FILE, BLOCKNO) \
776 fprintf (FILE, "\taddw", 4 * BLOCKNO)
777 #endif /* don't do basic_block profiling yet */
778
779 /* When returning from a function, the stack pointer does not matter
780 (as long as there is a frame pointer). */
781
782 /* This should return non-zero when we really set up a frame pointer.
783 Otherwise, GCC is directed to preserve sp by returning zero. */
784 extern int current_function_pretend_args_size;
785 extern int current_function_args_size;
786 extern int current_function_calls_alloca;
787 #define EXIT_IGNORE_STACK \
788 (get_frame_size () + current_function_pretend_args_size \
789 + current_function_args_size != 0 \
790 || current_function_calls_alloca) \
791
792 /* Store in the variable DEPTH the initial difference between the
793 frame pointer reg contents and the stack pointer reg contents,
794 as of the start of the function body. This depends on the layout
795 of the fixed parts of the stack frame and on how registers are saved.
796
797 On the Pyramid, FRAME_POINTER_REQUIRED is always 1, so the definition
798 of this macro doesn't matter. But it must be defined. */
799
800 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0;
801 \f
802 /*** Addressing modes, and classification of registers for them. ***/
803
804 /* #define HAVE_POST_INCREMENT */ /* pyramid has none of these */
805 /* #define HAVE_POST_DECREMENT */
806
807 /* #define HAVE_PRE_DECREMENT */
808 /* #define HAVE_PRE_INCREMENT */
809
810 /* Macros to check register numbers against specific register classes. */
811
812 /* These assume that REGNO is a hard or pseudo reg number.
813 They give nonzero only if REGNO is a hard reg of the suitable class
814 or a pseudo reg currently allocated to a suitable hard reg.
815 Since they use reg_renumber, they are safe only once reg_renumber
816 has been allocated, which happens in local-alloc.c. */
817
818 /* All registers except gr0 OK as index or base registers. */
819
820 #define REGNO_OK_FOR_BASE_P(regno) \
821 ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
822
823 #define REGNO_OK_FOR_INDEX_P(regno) \
824 ((unsigned) (regno) - 1 < FIRST_PSEUDO_REGISTER - 1 \
825 || reg_renumber[regno] > 0)
826
827 /* Maximum number of registers that can appear in a valid memory address. */
828
829 #define MAX_REGS_PER_ADDRESS 2 /* check MAX_REGS_PER_ADDRESS */
830
831 /* 1 if X is an rtx for a constant that is a valid address. */
832
833 #define CONSTANT_ADDRESS_P(X) \
834 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
835 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
836 || GET_CODE (X) == HIGH)
837
838 /* Nonzero if the constant value X is a legitimate general operand.
839 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
840
841 #define LEGITIMATE_CONSTANT_P(X) 1
842
843 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
844 and check its validity for a certain class.
845 We have two alternate definitions for each of them.
846 The usual definition accepts all pseudo regs; the other rejects
847 them unless they have been allocated suitable hard regs.
848 The symbol REG_OK_STRICT causes the latter definition to be used.
849
850 Most source files want to accept pseudo regs in the hope that
851 they will get allocated to the class that the insn wants them to be in.
852 Source files for reload pass need to be strict.
853 After reload, it makes no difference, since pseudo regs have
854 been eliminated by then. */
855
856 #ifndef REG_OK_STRICT
857
858 /* Nonzero if X is a hard reg that can be used as an index
859 or if it is a pseudo reg. */
860 #define REG_OK_FOR_INDEX_P(X) (REGNO (X) > 0)
861 /* Nonzero if X is a hard reg that can be used as a base reg
862 or if it is a pseudo reg. */
863 #define REG_OK_FOR_BASE_P(X) 1
864
865 #else
866
867 /* Nonzero if X is a hard reg that can be used as an index. */
868 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
869 /* Nonzero if X is a hard reg that can be used as a base reg. */
870 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
871
872 #endif
873 \f
874 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
875 that is a valid memory address for an instruction.
876 The MODE argument is the machine mode for the MEM expression
877 that wants to use this address.
878
879 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
880 except for CONSTANT_ADDRESS_P which is actually machine-independent. */
881
882
883 /* Go to ADDR if X is indexable -- i.e., neither indexed nor offset. */
884 #define GO_IF_INDEXABLE_ADDRESS(X, ADDR) \
885 { register rtx xfoob = (X); \
886 if ((CONSTANT_ADDRESS_P (xfoob)) \
887 || (GET_CODE (xfoob) == REG && (REG_OK_FOR_BASE_P (xfoob)))) \
888 goto ADDR; \
889 }
890
891
892 /* Go to label ADDR if X is a valid address that doesn't use indexing.
893 This is so if X is either a simple address, or the contents of a register
894 plus an offset.
895 This macro also gets used in output-pyramid.h in the function that
896 recognizes non-indexed operands. */
897
898 #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
899 { \
900 if (GET_CODE (X) == REG) \
901 goto ADDR; \
902 GO_IF_INDEXABLE_ADDRESS (X, ADDR); \
903 if (GET_CODE (X) == PLUS) \
904 { /* Handle offset(reg) represented with offset on left */ \
905 if (CONSTANT_ADDRESS_P (XEXP (X, 0))) \
906 { if (GET_CODE (XEXP (X, 1)) == REG \
907 && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
908 goto ADDR; \
909 } \
910 /* Handle offset(reg) represented with offset on right */ \
911 if (CONSTANT_ADDRESS_P (XEXP (X, 1))) \
912 { if (GET_CODE (XEXP (X, 0)) == REG \
913 && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
914 goto ADDR; \
915 } \
916 } \
917 }
918
919 /* 1 if PROD is either a reg or a reg times a valid offset multiplier
920 (ie, 2, 4, or 8).
921 This macro's expansion uses the temporary variables xfoo0 and xfoo1
922 that must be declared in the surrounding context. */
923 #define INDEX_TERM_P(PROD, MODE) \
924 ((GET_CODE (PROD) == REG && REG_OK_FOR_BASE_P (PROD)) \
925 || (GET_CODE (PROD) == MULT \
926 && \
927 (xfoo0 = XEXP (PROD, 0), xfoo1 = XEXP (PROD, 1), \
928 ((GET_CODE (xfoo0) == CONST_INT \
929 && (INTVAL (xfoo0) == 1 \
930 || INTVAL (xfoo0) == 2 \
931 || INTVAL (xfoo0) == 4 \
932 || INTVAL (xfoo0) == 8) \
933 && GET_CODE (xfoo1) == REG \
934 && REG_OK_FOR_INDEX_P (xfoo1)) \
935 || \
936 (GET_CODE (xfoo1) == CONST_INT \
937 && (INTVAL (xfoo1) == 1 \
938 || INTVAL (xfoo1) == 2 \
939 || INTVAL (xfoo1) == 4 \
940 || INTVAL (xfoo1) == 8) \
941 && GET_CODE (xfoo0) == REG \
942 && REG_OK_FOR_INDEX_P (xfoo0))))))
943
944
945 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
946 { register rtx xone, xtwo, xfoo0, xfoo1; \
947 GO_IF_NONINDEXED_ADDRESS (X, ADDR); \
948 if (GET_CODE (X) == PLUS) \
949 { \
950 /* Handle <address>[index] represented with index-sum outermost */\
951 xone = XEXP (X, 0); \
952 xtwo = XEXP (X, 1); \
953 if (INDEX_TERM_P (xone, MODE)) \
954 { GO_IF_INDEXABLE_ADDRESS (xtwo, ADDR); } \
955 /* Handle <address>[index] represented with index-sum innermost */\
956 if (INDEX_TERM_P (xtwo, MODE)) \
957 { GO_IF_INDEXABLE_ADDRESS (xone, ADDR); } \
958 } \
959 }
960
961 /* Try machine-dependent ways of modifying an illegitimate address
962 to be legitimate. If we find one, return the new, valid address.
963 This macro is used in only one place: `memory_address' in explow.c.
964
965 OLDX is the address as it was before break_out_memory_refs was called.
966 In some cases it is useful to look at this to decide what needs to be done.
967
968 MODE and WIN are passed so that this macro can use
969 GO_IF_LEGITIMATE_ADDRESS.
970
971 It is always safe for this macro to do nothing. It exists to recognize
972 opportunities to optimize the output.
973
974 --> FIXME: We haven't yet figured out what optimizations are useful
975 --> on Pyramids. */
976
977 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
978
979 /* Go to LABEL if ADDR (a legitimate address expression)
980 has an effect that depends on the machine mode it is used for.
981 There don't seem to be any such modes on pyramids. */
982 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
983 \f
984 /*** Miscellaneous Parameters ***/
985
986 /* Specify the machine mode that this machine uses
987 for the index in the tablejump instruction. */
988 #define CASE_VECTOR_MODE SImode
989
990 /* Define this if the tablejump instruction expects the table
991 to contain offsets from the address of the table.
992 Do not define this if the table should contain absolute addresses. */
993 /*#define CASE_VECTOR_PC_RELATIVE*/
994
995 /* Specify the tree operation to be used to convert reals to integers. */
996 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
997
998 /* This is the kind of divide that is easiest to do in the general case.
999 It's just a guess. I have no idea of insn cost on pyrs. */
1000 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1001
1002 /* Define this as 1 if `char' should by default be signed; else as 0. */
1003 #define DEFAULT_SIGNED_CHAR 1
1004
1005 /* This flag, if defined, says the same insns that convert to a signed fixnum
1006 also convert validly to an unsigned one. */
1007 /* This is untrue for pyramid. The cvtdw instruction generates a trap
1008 for input operands that are out-of-range for a signed int. */
1009 /* #define FIXUNS_TRUNC_LIKE_FIX_TRUNC */
1010
1011 /* Define this macro if the preprocessor should silently ignore
1012 '#sccs' directives. */
1013 /* #define SCCS_DIRECTIVE */
1014
1015 /* Define this macro if the preprocessor should silently ignore
1016 '#ident' directives. */
1017 /* #define IDENT_DIRECTIVE */
1018
1019 /* Max number of bytes we can move from memory to memory
1020 in one reasonably fast instruction. */
1021 #define MOVE_MAX 8
1022
1023 /* Define this if zero-extension is slow (more than one real instruction). */
1024 /* #define SLOW_ZERO_EXTEND */
1025
1026 /* number of bits in an 'int' on target machine */
1027 #define INT_TYPE_SIZE 32
1028
1029 /* 1 if byte access requires more than one instruction */
1030 #define SLOW_BYTE_ACCESS 0
1031
1032 /* Define this to be nonzero if shift instructions ignore all but the low-order
1033 few bits. */
1034 #define SHIFT_COUNT_TRUNCATED 1
1035
1036 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1037 is done just by pretending it is already truncated. */
1038 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1039
1040 /* Define this macro if it is as good or better to call a constant
1041 function address than to call an address kept in a register. */
1042 /* #define NO_FUNCTION_CSE */
1043
1044 /* When a prototype says `char' or `short', really pass an `int'. */
1045 #define PROMOTE_PROTOTYPES
1046
1047 /* There are no flag store insns on a pyr. */
1048 /* #define STORE_FLAG_VALUE */
1049
1050 /* Specify the machine mode that pointers have.
1051 After generation of rtl, the compiler makes no further distinction
1052 between pointers and any other objects of this machine mode. */
1053 #define Pmode SImode
1054
1055 /* A function address in a call instruction
1056 is a byte address (for indexing purposes)
1057 so give the MEM rtx a byte's mode. */
1058 #define FUNCTION_MODE QImode
1059
1060 /* Compute the cost of computing a constant rtl expression RTX
1061 whose rtx-code is CODE. The body of this macro is a portion
1062 of a switch statement. If the code is computed here,
1063 return it with a return statement. Otherwise, break from the switch. */
1064
1065 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1066 case CONST_INT: \
1067 if (CONST_OK_FOR_LETTER_P (INTVAL (RTX),'I')) return 0; \
1068 case CONST: \
1069 case LABEL_REF: \
1070 case SYMBOL_REF: \
1071 return 4; \
1072 case CONST_DOUBLE: \
1073 return 6;
1074
1075 /* A flag which says to swap the operands of certain insns
1076 when they are output. */
1077 extern int swap_operands;
1078 \f
1079 /*** Condition Code Information ***/
1080
1081 /* Tell final.c how to eliminate redundant test instructions. */
1082
1083 /* Here we define machine-dependent flags and fields in cc_status
1084 (see `conditions.h'). No extra ones are needed for the pyr. */
1085
1086 /* Store in cc_status the expressions
1087 that the condition codes will describe
1088 after execution of an instruction whose pattern is EXP.
1089 Do not alter them if the instruction would not alter the cc's. */
1090
1091 /* This is a very simple definition of NOTICE_UPDATE_CC.
1092 Many cases can be optimized, to improve condition code usage.
1093 Maybe we should handle this entirely in the md, since it complicated
1094 to describe the way pyr sets cc. */
1095
1096 #define TRULY_UNSIGNED_COMPARE_P(X) \
1097 (X == GEU || X == GTU || X == LEU || X == LTU)
1098 #define CC_VALID_FOR_UNSIGNED 2
1099
1100 #define CC_STATUS_MDEP_INIT cc_status.mdep = 0
1101
1102 #define NOTICE_UPDATE_CC(EXP, INSN) \
1103 notice_update_cc(EXP, INSN)
1104 \f
1105 /*** Output of Assembler Code ***/
1106
1107 /* Output at beginning of assembler file. */
1108
1109 #define ASM_FILE_START(FILE) \
1110 fprintf (FILE, ((TARGET_UNIX_ASM)? "" : "#NO_APP\n"));
1111
1112 /* Output to assembler file text saying following lines
1113 may contain character constants, extra white space, comments, etc. */
1114
1115 #define ASM_APP_ON ((TARGET_UNIX_ASM) ? "" : "#APP\n")
1116
1117 /* Output to assembler file text saying following lines
1118 no longer contain unusual constructs. */
1119
1120 #define ASM_APP_OFF ((TARGET_UNIX_ASM) ? "" : "#NO_APP\n")
1121
1122 /* Output before read-only data. */
1123
1124 #define TEXT_SECTION_ASM_OP ".text"
1125
1126 /* Output before writable data. */
1127
1128 #define DATA_SECTION_ASM_OP ".data"
1129
1130 /* How to refer to registers in assembler output.
1131 This sequence is indexed by compiler's hard-register-number (see above). */
1132
1133 #define REGISTER_NAMES \
1134 {"gr0", "gr1", "gr2", "gr3", "gr4", "gr5", "gr6", "gr7", "gr8", \
1135 "gr9", "gr10", "gr11", "logpsw", "cfp", "sp", "pc", \
1136 "pr0", "pr1", "pr2", "pr3", "pr4", "pr5", "pr6", "pr7", \
1137 "pr8", "pr9", "pr10", "pr11", "pr12", "pr13", "pr14", "pr15", \
1138 "lr0", "lr1", "lr2", "lr3", "lr4", "lr5", "lr6", "lr7", \
1139 "lr8", "lr9", "lr10", "lr11", "lr12", "lr13", "lr14", "lr15", \
1140 "tr0", "tr1", "tr2", "tr3", "tr4", "tr5", "tr6", "tr7", \
1141 "tr8", "tr9", "tr10", "tr11", "tr12", "tr13", "tr14", "tr15"}
1142
1143 /* How to renumber registers for dbx and gdb. */
1144
1145 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
1146
1147 /* Our preference is for dbx rather than sdb.
1148 Yours may be different. */
1149 #define DBX_DEBUGGING_INFO
1150 /* #define SDB_DEBUGGING_INFO */
1151
1152 /* Don't use the `xsfoo;' construct in DBX output; this system
1153 doesn't support it. */
1154
1155 #define DBX_NO_XREFS 1
1156
1157 /* Do not break .stabs pseudos into continuations. */
1158
1159 #define DBX_CONTIN_LENGTH 0
1160
1161 /* This is the char to use for continuation (in case we need to turn
1162 continuation back on). */
1163
1164 #define DBX_CONTIN_CHAR '?'
1165
1166 /* This is how to output the definition of a user-level label named NAME,
1167 such as the label on a static function or variable NAME. */
1168
1169 #define ASM_OUTPUT_LABEL(FILE,NAME) \
1170 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1171
1172 /* This is how to output a command to make the user-level label named NAME
1173 defined for reference from other files. */
1174
1175 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
1176 do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
1177
1178 /* This is how to output a reference to a user-level label named NAME. */
1179
1180 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
1181 fprintf (FILE, "_%s", NAME);
1182
1183 /* This is how to output an internal numbered label where
1184 PREFIX is the class of label and NUM is the number within the class. */
1185
1186 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1187 fprintf (FILE, "%s%d:\n", PREFIX, NUM)
1188
1189 /* This is how to store into the string LABEL
1190 the symbol_ref name of an internal numbered label where
1191 PREFIX is the class of label and NUM is the number within the class.
1192 This is suitable for output with `assemble_name'. */
1193
1194 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1195 sprintf (LABEL, "*%s%d", PREFIX, NUM)
1196
1197 /* This is how to output an assembler line defining a `double' constant. */
1198
1199 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
1200 fprintf (FILE, "\t.double 0d%.20e\n", (VALUE))
1201
1202 /* This is how to output an assembler line defining a `float' constant. */
1203
1204 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
1205 fprintf (FILE, "\t.float 0f%.20e\n", (VALUE))
1206
1207 /* This is how to output an assembler line defining an `int' constant. */
1208
1209 #define ASM_OUTPUT_INT(FILE,VALUE) \
1210 ( fprintf (FILE, "\t.word "), \
1211 output_addr_const (FILE, (VALUE)), \
1212 fprintf (FILE, "\n"))
1213
1214 /* Likewise for `char' and `short' constants. */
1215
1216 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
1217 ( fprintf (FILE, "\t.half "), \
1218 output_addr_const (FILE, (VALUE)), \
1219 fprintf (FILE, "\n"))
1220
1221 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
1222 ( fprintf (FILE, "\t.byte "), \
1223 output_addr_const (FILE, (VALUE)), \
1224 fprintf (FILE, "\n"))
1225
1226 /* This is how to output an assembler line for a numeric constant byte. */
1227
1228 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
1229 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1230
1231 /* This is how to output an insn to push a register on the stack.
1232 It need not be very fast code. */
1233
1234 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1235 fprintf (FILE, "\tsubw $4,sp\n\tmovw %s,(sp)\n", reg_names[REGNO])
1236
1237 /* This is how to output an insn to pop a register from the stack.
1238 It need not be very fast code. */
1239
1240 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1241 fprintf (FILE, "\tmovw (sp),%s\n\taddw $4,sp\n", reg_names[REGNO])
1242
1243 /* Store in OUTPUT a string (made with alloca) containing
1244 an assembler-name for a local static variable named NAME.
1245 LABELNO is an integer which is different for each call. */
1246
1247 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1248 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1249 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1250
1251 /* This is how to output an element of a case-vector that is absolute. */
1252
1253 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1254 fprintf (FILE, "\t.word L%d\n", VALUE)
1255
1256 /* This is how to output an element of a case-vector that is relative. */
1257
1258
1259 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
1260 fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL)
1261
1262 /* This is how to output an assembler line
1263 that says to advance the location counter
1264 to a multiple of 2**LOG bytes.
1265
1266 On Pyramids, the text segment must always be word aligned.
1267 On Pyramids, .align takes only args between 2 and 5.
1268 */
1269
1270 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1271 fprintf (FILE, "\t.align %d\n", (LOG) < 2 ? 2 : (LOG))
1272
1273 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1274 fprintf (FILE, "\t.space %u\n", (SIZE))
1275
1276 /* This says how to output an assembler line
1277 to define a global common symbol. */
1278
1279 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1280 ( fputs (".comm ", (FILE)), \
1281 assemble_name ((FILE), (NAME)), \
1282 fprintf ((FILE), ",%u\n", (ROUNDED)))
1283
1284 /* This says how to output an assembler line
1285 to define a local common symbol. */
1286
1287 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
1288 ( fputs (".lcomm ", (FILE)), \
1289 assemble_name ((FILE), (NAME)), \
1290 fprintf ((FILE), ",%u\n", (ROUNDED)))
1291
1292 /* Define the parentheses used to group arithmetic operations
1293 in assembler code. */
1294
1295 #define ASM_OPEN_PAREN "("
1296 #define ASM_CLOSE_PAREN ")"
1297
1298 /* Define results of standard character escape sequences. */
1299 #define TARGET_BELL 007
1300 #define TARGET_BS 010
1301 #define TARGET_TAB 011
1302 #define TARGET_NEWLINE 012
1303 #define TARGET_VT 013
1304 #define TARGET_FF 014
1305 #define TARGET_CR 015
1306
1307 /* Print operand X (an rtx) in assembler syntax to file FILE.
1308 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1309 For `%' followed by punctuation, CODE is the punctuation and X is null.
1310 On the Pyr, we support the conventional CODE characters:
1311
1312 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
1313 which are never used. */
1314
1315 /* FIXME : should be more robust with CONST_DOUBLE. */
1316
1317 #define PRINT_OPERAND(FILE, X, CODE) \
1318 { if (GET_CODE (X) == REG) \
1319 fprintf (FILE, "%s", reg_names [REGNO (X)]); \
1320 \
1321 else if (GET_CODE (X) == MEM) \
1322 output_address (XEXP (X, 0)); \
1323 \
1324 else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
1325 { union { double d; int i[2]; } u; \
1326 union { float f; int i; } u1; \
1327 u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
1328 u1.f = u.d; \
1329 if (CODE == 'f') \
1330 fprintf (FILE, "$0f%.0e", u1.f); \
1331 else \
1332 fprintf (FILE, "$0x%x", u1.i); } \
1333 \
1334 else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != DImode) \
1335 { union { double d; int i[2]; } u; \
1336 u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
1337 fprintf (FILE, "$0d%.20e", u.d); } \
1338 \
1339 else if (CODE == 'N') \
1340 switch (GET_CODE (X)) \
1341 { \
1342 case EQ: fputs ("eq", FILE); break; \
1343 case NE: fputs ("ne", FILE); break; \
1344 case GT: \
1345 case GTU: fputs ("gt", FILE); break; \
1346 case LT: \
1347 case LTU: fputs ("lt", FILE); break; \
1348 case GE: \
1349 case GEU: fputs ("ge", FILE); break; \
1350 case LE: \
1351 case LEU: fputs ("le", FILE); break; \
1352 } \
1353 \
1354 else if (CODE == 'C') \
1355 switch (GET_CODE (X)) \
1356 { \
1357 case EQ: fputs ("ne", FILE); break; \
1358 case NE: fputs ("eq", FILE); break; \
1359 case GT: \
1360 case GTU: fputs ("le", FILE); break; \
1361 case LT: \
1362 case LTU: fputs ("ge", FILE); break; \
1363 case GE: \
1364 case GEU: fputs ("lt", FILE); break; \
1365 case LE: \
1366 case LEU: fputs ("gt", FILE); break; \
1367 } \
1368 \
1369 else if (CODE == 'R') \
1370 switch (GET_CODE (X)) \
1371 { \
1372 case EQ: fputs ("eq", FILE); break; \
1373 case NE: fputs ("ne", FILE); break; \
1374 case GT: \
1375 case GTU: fputs ("lt", FILE); break; \
1376 case LT: \
1377 case LTU: fputs ("gt", FILE); break; \
1378 case GE: \
1379 case GEU: fputs ("le", FILE); break; \
1380 case LE: \
1381 case LEU: fputs ("ge", FILE); break; \
1382 } \
1383 \
1384 else { putc ('$', FILE); output_addr_const (FILE, X); } \
1385 }
1386
1387 /* Print a memory operand whose address is ADDR, on file FILE. */
1388 /* This is horrendously complicated. */
1389 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1390 { \
1391 register rtx reg1, reg2, breg, ireg; \
1392 register rtx addr = ADDR; \
1393 rtx offset, scale; \
1394 retry: \
1395 switch (GET_CODE (addr)) \
1396 { \
1397 case MEM: \
1398 fprintf (stderr, "bad Mem "); debug_rtx (addr); \
1399 addr = XEXP (addr, 0); \
1400 abort (); \
1401 case REG: \
1402 fprintf (FILE, "(%s)", reg_names [REGNO (addr)]); \
1403 break; \
1404 case PLUS: \
1405 reg1 = 0; reg2 = 0; \
1406 ireg = 0; breg = 0; \
1407 offset = 0; \
1408 if (CONSTANT_ADDRESS_P (XEXP (addr, 0)) \
1409 || GET_CODE (XEXP (addr, 0)) == MEM) \
1410 { \
1411 offset = XEXP (addr, 0); \
1412 addr = XEXP (addr, 1); \
1413 } \
1414 else if (CONSTANT_ADDRESS_P (XEXP (addr, 1)) \
1415 || GET_CODE (XEXP (addr, 1)) == MEM) \
1416 { \
1417 offset = XEXP (addr, 1); \
1418 addr = XEXP (addr, 0); \
1419 } \
1420 if (GET_CODE (addr) != PLUS) ; \
1421 else if (GET_CODE (XEXP (addr, 0)) == MULT) \
1422 { \
1423 reg1 = XEXP (addr, 0); \
1424 addr = XEXP (addr, 1); \
1425 } \
1426 else if (GET_CODE (XEXP (addr, 1)) == MULT) \
1427 { \
1428 reg1 = XEXP (addr, 1); \
1429 addr = XEXP (addr, 0); \
1430 } \
1431 else if (GET_CODE (XEXP (addr, 0)) == REG) \
1432 { \
1433 reg1 = XEXP (addr, 0); \
1434 addr = XEXP (addr, 1); \
1435 } \
1436 else if (GET_CODE (XEXP (addr, 1)) == REG) \
1437 { \
1438 reg1 = XEXP (addr, 1); \
1439 addr = XEXP (addr, 0); \
1440 } \
1441 if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT) \
1442 { \
1443 if (reg1 == 0) \
1444 reg1 = addr; \
1445 else \
1446 reg2 = addr; \
1447 addr = 0; \
1448 } \
1449 if (offset != 0) \
1450 { \
1451 if (addr != 0) { \
1452 fprintf (stderr, "\nBad addr "); debug_rtx (addr); \
1453 abort ();} \
1454 addr = offset; \
1455 } \
1456 if (reg1 != 0 && GET_CODE (reg1) == MULT) \
1457 { breg = reg2; ireg = reg1; } \
1458 else if (reg2 != 0 && GET_CODE (reg2) == MULT) \
1459 { breg = reg1; ireg = reg2; } \
1460 else if (reg2 != 0 || GET_CODE (addr) == MEM) \
1461 { breg = reg2; ireg = reg1; } \
1462 else \
1463 { breg = reg1; ireg = reg2; } \
1464 if (addr != 0) \
1465 output_address (offset); \
1466 if (breg != 0) \
1467 { if (GET_CODE (breg) != REG) \
1468 { \
1469 fprintf (stderr, "bad Breg"); debug_rtx (addr); \
1470 abort (); \
1471 } \
1472 fprintf (FILE, "(%s)", reg_names[REGNO (breg)]); } \
1473 if (ireg != 0) \
1474 { \
1475 if (GET_CODE (ireg) == MULT) \
1476 { \
1477 scale = XEXP (ireg, 1); \
1478 ireg = XEXP (ireg, 0); \
1479 if (GET_CODE (ireg) != REG) \
1480 { register rtx tem; \
1481 tem = ireg; ireg = scale; scale = tem; \
1482 } \
1483 if (GET_CODE (ireg) != REG) { \
1484 fprintf (stderr, "bad idx "); debug_rtx (addr); \
1485 abort (); } \
1486 if ((GET_CODE (scale) == CONST_INT) && (INTVAL(scale) >= 1))\
1487 fprintf (FILE, "[%s*0x%x]", reg_names[REGNO (ireg)], \
1488 INTVAL(scale)); \
1489 else \
1490 fprintf (FILE, "[%s*1]", reg_names[REGNO (ireg)]); \
1491 } \
1492 else if (GET_CODE (ireg) == REG) \
1493 fprintf (FILE, "[%s*1]", reg_names[REGNO (ireg)]); \
1494 else \
1495 { \
1496 fprintf (stderr, "Not indexed at all!"); debug_rtx (addr);\
1497 abort (); \
1498 } \
1499 } \
1500 break; \
1501 default: \
1502 output_addr_const (FILE, addr); \
1503 } \
1504 }