* config/alpha/alpha.md, config/arm/arm.c, config/arm/arm.h,
[official-gcc.git] / gcc / config / ns32k / ns32k.h
blob373f78f7fbc2bb02216e659eaa7dbb3e03341509
1 /* Definitions of target machine for GNU compiler. NS32000 version.
2 Copyright (C) 1988, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 2001 Free Software Foundation, Inc.
4 Contributed by Michael Tiemann (tiemann@cygnus.com)
6 This file is part of GNU CC.
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.
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.
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. */
24 /* Note that some other tm.h files include this one and then override
25 many of the definitions that relate to assembler syntax. */
27 /* Names to predefine in the preprocessor for this target machine. */
29 #define CPP_PREDEFINES "-Dns32000 -Dunix -Asystem=unix -Acpu=ns32k -Amachine=ns32k"
31 /* Print subsidiary information on the compiler version in use. */
32 #define TARGET_VERSION fprintf (stderr, " (32000, GAS syntax)");
35 /* ABSOLUTE PREFIX, IMMEDIATE_PREFIX and EXTERNAL_PREFIX can be defined
36 to cover most NS32k addressing syntax variations. This way we don't
37 need to redefine long macros in all the tm.h files for just slight
38 variations in assembler syntax. */
40 #ifndef ABSOLUTE_PREFIX
41 #define ABSOLUTE_PREFIX '@'
42 #endif
44 #if defined(IMMEDIATE_PREFIX) && IMMEDIATE_PREFIX
45 #define PUT_IMMEDIATE_PREFIX(FILE) putc(IMMEDIATE_PREFIX, FILE)
46 #else
47 #define PUT_IMMEDIATE_PREFIX(FILE)
48 #endif
49 #if defined(ABSOLUTE_PREFIX) && ABSOLUTE_PREFIX
50 #define PUT_ABSOLUTE_PREFIX(FILE) putc(ABSOLUTE_PREFIX, FILE)
51 #else
52 #define PUT_ABSOLUTE_PREFIX(FILE)
53 #endif
54 #if defined(EXTERNAL_PREFIX) && EXTERNAL_PREFIX
55 #define PUT_EXTERNAL_PREFIX(FILE) putc(EXTERNAL_PREFIX, FILE)
56 #else
57 #define PUT_EXTERNAL_PREFIX(FILE)
58 #endif
60 /* Run-time compilation parameters selecting different hardware subsets. */
62 extern int target_flags;
64 /* Macros used in the machine description to test the flags. */
66 /* Compile 32081 insns for floating point (not library calls). */
67 #define TARGET_32081 (target_flags & 1)
68 #define TARGET_32381 (target_flags & 256)
70 /* The use of multiply-add instructions is optional because there may
71 * be cases where it produces worse code.
74 #define TARGET_MULT_ADD (target_flags & 512)
76 /* Compile using rtd insn calling sequence.
77 This will not work unless you use prototypes at least
78 for all functions that can take varying numbers of args. */
79 #define TARGET_RTD (target_flags & 2)
81 /* Compile passing first two args in regs 0 and 1. */
82 #define TARGET_REGPARM (target_flags & 4)
84 /* Options to select type of CPU, for better optimization.
85 The output is correct for any kind of 32000 regardless of these options. */
86 #define TARGET_32532 (target_flags & 8)
87 #define TARGET_32332 (target_flags & 16)
89 /* Ok to use the static base register (and presume it's 0) */
90 #define TARGET_SB ((target_flags & 32) == 0)
91 #define TARGET_HIMEM (target_flags & 128)
93 /* Compile using bitfield insns. */
94 #define TARGET_BITFIELD ((target_flags & 64) == 0)
96 /* Macro to define tables used to set the flags.
97 This is a list in braces of pairs in braces,
98 each pair being { "NAME", VALUE }
99 where VALUE is the bits to set or minus the bits to clear.
100 An empty string NAME is used to identify the default VALUE. */
102 #define TARGET_SWITCHES \
103 { { "32081", 1, N_("Use hardware fp")}, \
104 { "soft-float", -257, N_("Don't use hardware fp")}, \
105 { "rtd", 2, N_("Alternative calling convention")}, \
106 { "nortd", -2, N_("Use normal calling convention")}, \
107 { "regparm", 4, N_("Pass some arguments in registers")}, \
108 { "noregparm", -4, N_("Pass all arguments on stack")}, \
109 { "32532", 24, N_("Optimize for 32532 cpu")}, \
110 { "32332", 16, N_("Optimize for 32332 cpu")}, \
111 { "32332", -8, 0}, \
112 { "32032", -24, N_("Optimize for 32032")}, \
113 { "sb", -32, \
114 N_("Register sb is zero. Use for absolute addressing")}, \
115 { "nosb", 32, N_("Do not use register sb")}, \
116 { "bitfield", -64, N_("Do not use bitfield instructions")}, \
117 { "nobitfield", 64, N_("Use bitfield instructions")}, \
118 { "himem", 128, N_("Generate code for high memory")}, \
119 { "nohimem", -128, N_("Generate code for low memory")}, \
120 { "32381", 256, N_("32381 fpu")}, \
121 { "mult-add", 512, N_("Use multiply-accumulate fp instructions")}, \
122 { "nomult-add", -512, \
123 N_("Do not use multiply-accumulate fp instructions") }, \
124 { "src", 1024, N_("\"Small register classes\" kludge")}, \
125 { "nosrc", -1024, N_("No \"Small register classes\" kludge")}, \
126 { "", TARGET_DEFAULT, 0}}
128 /* TARGET_DEFAULT is defined in encore.h, pc532.h, etc. */
130 /* When we are generating PIC, the sb is used as a pointer
131 to the GOT. 32381 is a superset of 32081 */
133 #define OVERRIDE_OPTIONS \
135 if (flag_pic || TARGET_HIMEM) target_flags |= 32; \
136 if (TARGET_32381) target_flags |= 1; \
137 else target_flags &= ~512; \
140 /* Zero or more C statements that may conditionally modify two
141 variables `fixed_regs' and `call_used_regs' (both of type `char
142 []') after they have been initialized from the two preceding
143 macros.
145 This is necessary in case the fixed or call-clobbered registers
146 depend on target flags.
148 You need not define this macro if it has no work to do.
150 If the usage of an entire class of registers depends on the target
151 flags, you may indicate this to GCC by using this macro to modify
152 `fixed_regs' and `call_used_regs' to 1 for each of the registers in
153 the classes which should not be used by GCC. Also define the macro
154 `REG_CLASS_FROM_LETTER' to return `NO_REGS' if it is called with a
155 letter for a class that shouldn't be used.
157 (However, if this class is not included in `GENERAL_REGS' and all
158 of the insn patterns whose constraints permit this class are
159 controlled by target switches, then GCC will automatically avoid
160 using these registers when the target switches are opposed to
161 them.) */
163 #define CONDITIONAL_REGISTER_USAGE \
164 do \
166 if (!TARGET_32081) \
168 int regno; \
170 for (regno = F0_REGNUM; regno <= F0_REGNUM + 8; regno++) \
171 fixed_regs[regno] = call_used_regs[regno] = 1; \
173 if (!TARGET_32381) \
175 int regno; \
177 for (regno = L1_REGNUM; regno <= L1_REGNUM + 8; regno++) \
178 fixed_regs[regno] = call_used_regs[regno] = 1; \
181 while (0)
184 /* target machine storage layout */
186 /* Define this if most significant bit is lowest numbered
187 in instructions that operate on numbered bit-fields.
188 This is not true on the ns32k. */
189 #define BITS_BIG_ENDIAN 0
191 /* Define this if most significant byte of a word is the lowest numbered. */
192 /* That is not true on the ns32k. */
193 #define BYTES_BIG_ENDIAN 0
195 /* Define this if most significant word of a multiword number is lowest
196 numbered. This is not true on the ns32k. */
197 #define WORDS_BIG_ENDIAN 0
199 /* Number of bits in an addressable storage unit */
200 #define BITS_PER_UNIT 8
202 /* Width in bits of a "word", which is the contents of a machine register.
203 Note that this is not necessarily the width of data type `int';
204 if using 16-bit ints on a 32000, this would still be 32.
205 But on a machine with 16-bit registers, this would be 16. */
206 #define BITS_PER_WORD 32
208 /* Width of a word, in units (bytes). */
209 #define UNITS_PER_WORD 4
211 /* Width in bits of a pointer.
212 See also the macro `Pmode' defined below. */
213 #define POINTER_SIZE 32
215 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
216 #define PARM_BOUNDARY 32
218 /* Boundary (in *bits*) on which stack pointer should be aligned. */
219 #define STACK_BOUNDARY 32
221 /* Allocation boundary (in *bits*) for the code of a function. */
222 #define FUNCTION_BOUNDARY 16
224 /* Alignment of field after `int : 0' in a structure. */
225 #define EMPTY_FIELD_BOUNDARY 32
227 /* Every structure's size must be a multiple of this. */
228 #define STRUCTURE_SIZE_BOUNDARY 8
230 /* No data type wants to be aligned rounder than this. */
231 #define BIGGEST_ALIGNMENT 32
233 /* Set this nonzero if move instructions will actually fail to work
234 when given unaligned data. National claims that the NS32032
235 works without strict alignment, but rumor has it that operands
236 crossing a page boundary cause unpredictable results. */
237 #define STRICT_ALIGNMENT 1
239 /* If bit field type is int, don't let it cross an int,
240 and give entire struct the alignment of an int. */
241 /* Required on the 386 since it doesn't have a full set of bitfield insns.
242 (There is no signed extv insn.) */
243 #define PCC_BITFIELD_TYPE_MATTERS 1
245 /* Standard register usage. */
247 /* Number of actual hardware registers.
248 The hardware registers are assigned numbers for the compiler
249 from 0 to just below FIRST_PSEUDO_REGISTER.
250 All registers that the compiler knows about must be given numbers,
251 even those that are not normally considered general registers. */
252 #define FIRST_PSEUDO_REGISTER 26
254 /* 1 for registers that have pervasive standard uses
255 and are not available for the register allocator.
256 On the ns32k, these are the FP, SP, (SB and PC are not included here). */
257 #define FIXED_REGISTERS {0, 0, 0, 0, 0, 0, 0, 0, \
258 0, 0, 0, 0, 0, 0, 0, 0, \
259 0, 0, 0, 0, 0, 0, 0, 0, \
260 1, 1}
262 /* 1 for registers not available across function calls.
263 These must include the FIXED_REGISTERS and also any
264 registers that can be used without being saved.
265 The latter must include the registers where values are returned
266 and the register where structure-value addresses are passed.
267 Aside from that, you can include as many other registers as you like. */
268 #define CALL_USED_REGISTERS {1, 1, 1, 0, 0, 0, 0, 0, \
269 1, 1, 1, 1, 0, 0, 0, 0, \
270 1, 1, 0, 0, 0, 0, 0, 0, \
271 1, 1}
273 /* How to refer to registers in assembler output.
274 This sequence is indexed by compiler's hard-register-number (see above). */
276 #define REGISTER_NAMES \
277 {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
278 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
279 "l1", "l1h","l3", "l3h","l5", "l5h","l7", "l7h", \
280 "fp", "sp"}
283 #define ADDITIONAL_REGISTER_NAMES \
284 {{"l0", 8}, {"l2", 10}, {"l4", 12}, {"l6", 14}}
286 /* l0-7 are not recognized by the assembler. These are the names to use,
287 * but we don't want ambiguous names in REGISTER_NAMES
289 #define OUTPUT_REGISTER_NAMES \
290 {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
291 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
292 "f1", "l1h","f3", "l3h","f5", "l5h","f7", "f7h", \
293 "fp", "sp"}
295 #define REG_ALLOC_ORDER \
296 {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 10, 11, 18, 12, 13, 20, 14, 15, 22, 24, 25, 17, 19, 23}
298 /* How to renumber registers for dbx and gdb.
299 NS32000 may need more change in the numeration. XXX */
301 #define DBX_REGISTER_NUMBER(REGNO) \
302 ((REGNO) < L1_REGNUM? (REGNO) \
303 : (REGNO) < FRAME_POINTER_REGNUM? (REGNO) - L1_REGNUM + 22 \
304 : (REGNO) == FRAME_POINTER_REGNUM? 17 \
305 : 16)
307 /* dwarf2out.c can't understand the funny DBX register numbering.
308 * We use dwarf2out.c for exception handling even though we use DBX
309 * for debugging
311 #define DWARF_FRAME_REGNUM(REGNO) (REGNO)
315 #define R0_REGNUM 0
316 #define F0_REGNUM 8
317 #define L1_REGNUM 16
319 /* Specify the registers used for certain standard purposes.
320 The values of these macros are register numbers. */
322 /* NS32000 pc is not overloaded on a register. */
323 /* #define PC_REGNUM */
325 /* Register to use for pushing function arguments. */
326 #define STACK_POINTER_REGNUM 25
328 /* Base register for access to local variables of the function. */
329 #define FRAME_POINTER_REGNUM 24
332 /* Return number of consecutive hard regs needed starting at reg REGNO
333 to hold something of mode MODE.
334 This is ordinarily the length in words of a value of mode MODE
335 but can be less for certain modes in special long registers.
336 On the ns32k, all registers are 32 bits long except for the 32381 "long"
337 registers but we treat those as pairs */
338 #define LONG_FP_REGS_P(REGNO) ((REGNO) >= L1_REGNUM && (REGNO) < L1_REGNUM + 8)
339 #define HARD_REGNO_NREGS(REGNO, MODE) \
340 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
342 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
343 #define HARD_REGNO_MODE_OK(REGNO, MODE) hard_regno_mode_ok (REGNO, MODE)
345 /* Value is 1 if it is a good idea to tie two pseudo registers
346 when one has mode MODE1 and one has mode MODE2.
347 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
348 for any hard reg, then this must be 0 for correct output.
350 Early documentation says SI and DI are not tieable if some reg can
351 be OK for SI but not for DI. However other ports (mips, i860, mvs
352 and tahoe) don't meet the above criterion. Evidently the real
353 requirement is somewhat laxer. Documentation was changed for gcc
354 2.8 but was not picked up by egcs (at least egcs 1.0). Having all
355 integer modes tieable definitely generates faster code. */
357 #define MODES_TIEABLE_P(MODE1, MODE2) \
358 ((FLOAT_MODE_P(MODE1) && FLOAT_MODE_P(MODE2) \
359 && (GET_MODE_UNIT_SIZE(MODE1) == GET_MODE_UNIT_SIZE(MODE2))) \
360 || (!FLOAT_MODE_P(MODE1) && !FLOAT_MODE_P(MODE2)))
362 /* Value should be nonzero if functions must have frame pointers.
363 Zero means the frame pointer need not be set up (and parms
364 may be accessed via the stack pointer) in functions that seem suitable.
365 This is computed in `reload', in reload1.c. */
366 #define FRAME_POINTER_REQUIRED 0
368 /* Base register for access to arguments of the function. */
369 #define ARG_POINTER_REGNUM 24
371 /* Register in which static-chain is passed to a function. */
372 #define STATIC_CHAIN_REGNUM 1
374 /* Register in which address to store a structure value
375 is passed to a function. */
376 #define STRUCT_VALUE_REGNUM 2
378 /* Define the classes of registers for register constraints in the
379 machine description. Also define ranges of constants.
381 One of the classes must always be named ALL_REGS and include all hard regs.
382 If there is more than one class, another class must be named NO_REGS
383 and contain no registers.
385 The name GENERAL_REGS must be the name of a class (or an alias for
386 another name such as ALL_REGS). This is the class of registers
387 that is allowed by "g" or "r" in a register constraint.
388 Also, registers outside this class are allocated only when
389 instructions express preferences for them.
391 The classes must be numbered in nondecreasing order; that is,
392 a larger-numbered class must never be contained completely
393 in a smaller-numbered class.
395 For any two classes, it is very desirable that there be another
396 class that represents their union. */
398 enum reg_class
399 { NO_REGS, GENERAL_REGS, FLOAT_REG0, LONG_FLOAT_REG0, FLOAT_REGS,
400 FP_REGS, GEN_AND_FP_REGS, FRAME_POINTER_REG, STACK_POINTER_REG,
401 GEN_AND_MEM_REGS, ALL_REGS, LIM_REG_CLASSES };
403 #define N_REG_CLASSES (int) LIM_REG_CLASSES
405 /* Give names of register classes as strings for dump file. */
407 #define REG_CLASS_NAMES \
408 {"NO_REGS", "GENERAL_REGS", "FLOAT_REG0", "LONG_FLOAT_REG0", "FLOAT_REGS", \
409 "FP_REGS", "GEN_AND_FP_REGS", "FRAME_POINTER_REG", "STACK_POINTER_REG", \
410 "GEN_AND_MEM_REGS", "ALL_REGS" }
412 /* Define which registers fit in which classes.
413 This is an initializer for a vector of HARD_REG_SET
414 of length N_REG_CLASSES. */
416 #define REG_CLASS_CONTENTS \
417 {{0}, /* NO_REGS */ \
418 {0x00ff}, /* GENERAL_REGS */ \
419 {0x100}, /* FLOAT_REG0 */ \
420 {0x300}, /* LONG_FLOAT_REG0 */ \
421 {0xff00}, /* FLOAT_REGS */ \
422 {0xffff00}, /* FP_REGS */ \
423 {0xffffff}, /* GEN_AND_FP_REGS */ \
424 {0x1000000}, /* FRAME_POINTER_REG */ \
425 {0x2000000}, /* STACK_POINTER_REG */ \
426 {0x30000ff}, /* GEN_AND_MEM_REGS */ \
427 {0x3ffffff} /* ALL_REGS */ \
430 #define SUBSET_P(CLASS1, CLASS2) \
431 ((ns32k_reg_class_contents[CLASS1][0] \
432 & ~ns32k_reg_class_contents[CLASS2][0]) == 0)
434 /* The same information, inverted:
435 Return the class number of the smallest class containing
436 reg number REGNO. This could be a conditional expression
437 or could index an array. */
439 #define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO])
441 /* The class value for index registers, and the one for base regs. */
443 #define INDEX_REG_CLASS GENERAL_REGS
444 #define BASE_REG_CLASS GEN_AND_MEM_REGS
446 /* Get reg_class from a letter such as appears in the machine description. */
448 #define REG_CLASS_FROM_LETTER(C) \
449 ((C) == 'u' ? FLOAT_REG0 \
450 : (C) == 'v' ? LONG_FLOAT_REG0 \
451 : (C) == 'f' ? FLOAT_REGS \
452 : (C) == 'l' ? FP_REGS \
453 : (C) == 'x' ? FRAME_POINTER_REG \
454 : (C) == 'y' ? STACK_POINTER_REG \
455 : NO_REGS)
457 /* The letters I, J, K, L and M in a register constraint string
458 can be used to stand for particular ranges of immediate operands.
459 This macro defines what the ranges are.
460 C is the letter, and VALUE is a constant value.
461 Return 1 if VALUE is in the range specified by C.
463 On the ns32k, these letters are used as follows:
465 I : Matches integers which are valid shift amounts for scaled indexing.
466 These are 0, 1, 2, 3 for byte, word, double, and quadword.
467 Used for matching arithmetic shifts only on 32032 & 32332.
468 J : Matches integers which fit a "quick" operand.
469 K : Matches integers 0 to 7 (for inss and exts instructions).
472 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
473 ((VALUE) < 8 && (VALUE) + 8 >= 0 ? \
474 ((C) == 'I' ? (!TARGET_32532 && 0 <= (VALUE) && (VALUE) <= 3) : \
475 (C) == 'J' ? (VALUE) <= 7 : \
476 (C) == 'K' ? 0 <= (VALUE) : 0) : 0)
478 /* Similar, but for floating constants, and defining letters G and H.
479 Here VALUE is the CONST_DOUBLE rtx itself. */
481 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1
483 /* Given an rtx X being reloaded into a reg required to be
484 in class CLASS, return the class of reg to actually use.
485 In general this is just CLASS; but on some machines
486 in some cases it is preferable to use a more restrictive class. */
488 /* We return GENERAL_REGS instead of GEN_AND_MEM_REGS.
489 The latter offers no real additional possibilities
490 and can cause spurious secondary reloading. */
492 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
493 ((CLASS) == GEN_AND_MEM_REGS ? GENERAL_REGS : (CLASS))
495 /* Return the maximum number of consecutive registers
496 needed to represent mode MODE in a register of class CLASS. */
497 /* On the 32000, this is the size of MODE in words */
499 #define CLASS_MAX_NREGS(CLASS, MODE) \
500 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
502 /* Stack layout; function entry, exit and calling. */
504 /* Define this if pushing a word on the stack
505 makes the stack pointer a smaller address. */
506 #define STACK_GROWS_DOWNWARD
508 /* Define this if the nominal address of the stack frame
509 is at the high-address end of the local variables;
510 that is, each additional local variable allocated
511 goes at a more negative offset in the frame. */
512 #define FRAME_GROWS_DOWNWARD
514 /* Offset within stack frame to start allocating local variables at.
515 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
516 first local allocated. Otherwise, it is the offset to the BEGINNING
517 of the first local allocated. */
518 #define STARTING_FRAME_OFFSET 0
520 /* A C expression whose value is RTL representing the location of the
521 incoming return address at the beginning of any function, before
522 the prologue. This RTL is either a `REG', indicating that the
523 return value is saved in `REG', or a `MEM' representing a location
524 in the stack.
526 You only need to define this macro if you want to support call
527 frame debugging information like that provided by DWARF 2.
529 Before the prologue, RA is at 0(sp). */
531 #define INCOMING_RETURN_ADDR_RTX \
532 gen_rtx (MEM, VOIDmode, gen_rtx (REG, VOIDmode, STACK_POINTER_REGNUM))
534 /* A C expression whose value is RTL representing the value of the
535 return address for the frame COUNT steps up from the current frame,
536 after the prologue. FRAMEADDR is the frame pointer of the COUNT
537 frame, or the frame pointer of the COUNT - 1 frame if
538 `RETURN_ADDR_IN_PREVIOUS_FRAME' is defined.
540 After the prologue, RA is at 4(fp) in the current frame. */
542 #define RETURN_ADDR_RTX(COUNT, FRAME) \
543 (gen_rtx (MEM, Pmode, gen_rtx (PLUS, Pmode, (FRAME), GEN_INT(4))))
545 /* A C expression whose value is an integer giving the offset, in
546 bytes, from the value of the stack pointer register to the top of
547 the stack frame at the beginning of any function, before the
548 prologue. The top of the frame is defined to be the value of the
549 stack pointer in the previous frame, just before the call
550 instruction.
552 You only need to define this macro if you want to support call
553 frame debugging information like that provided by DWARF 2. */
555 #define INCOMING_FRAME_SP_OFFSET 4
557 /* If we generate an insn to push BYTES bytes,
558 this says how many the stack pointer really advances by.
559 On the 32000, sp@- in a byte insn really pushes a BYTE. */
560 #define PUSH_ROUNDING(BYTES) (BYTES)
562 /* Offset of first parameter from the argument pointer register value. */
563 #define FIRST_PARM_OFFSET(FNDECL) 8
565 /* Value is the number of byte of arguments automatically
566 popped when returning from a subroutine call.
567 FUNDECL is the declaration node of the function (as a tree),
568 FUNTYPE is the data type of the function (as a tree),
569 or for a library call it is an identifier node for the subroutine name.
570 SIZE is the number of bytes of arguments passed on the stack.
572 On the 32000, the RET insn may be used to pop them if the number
573 of args is fixed, but if the number is variable then the caller
574 must pop them all. RET can't be used for library calls now
575 because the library is compiled with the Unix compiler.
576 Use of RET is a selectable option, since it is incompatible with
577 standard Unix calling sequences. If the option is not selected,
578 the caller must always pop the args.
580 The attribute stdcall is equivalent to RTD on a per module basis. */
582 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
583 (ns32k_return_pops_args (FUNDECL, FUNTYPE, SIZE))
585 /* Define how to find the value returned by a function.
586 VALTYPE is the data type of the value (as a tree).
587 If the precise function being called is known, FUNC is its FUNCTION_DECL;
588 otherwise, FUNC is 0. */
590 /* On the 32000 the return value is in R0,
591 or perhaps in F0 if there is fp support. */
593 #define FUNCTION_VALUE(VALTYPE, FUNC) LIBCALL_VALUE(TYPE_MODE (VALTYPE))
595 /* Define how to find the value returned by a library function
596 assuming the value has mode MODE. */
598 /* On the 32000 the return value is in R0,
599 or perhaps F0 is there is fp support. */
601 #define LIBCALL_VALUE(MODE) \
602 gen_rtx_REG (MODE, \
603 FLOAT_MODE_P(MODE) && TARGET_32081 ? F0_REGNUM: R0_REGNUM)
605 /* Define this if PCC uses the nonreentrant convention for returning
606 structure and union values. */
608 #define PCC_STATIC_STRUCT_RETURN
610 /* 1 if N is a possible register number for a function value.
611 On the 32000, R0 and F0 are the only registers thus used. */
613 #define FUNCTION_VALUE_REGNO_P(N) (((N) & ~8) == 0)
615 /* 1 if N is a possible register number for function argument passing.
616 On the 32000, no registers are used in this way. */
618 #define FUNCTION_ARG_REGNO_P(N) 0
620 /* Define a data type for recording info about an argument list
621 during the scan of that argument list. This data type should
622 hold all necessary information about the function itself
623 and about the args processed so far, enough to enable macros
624 such as FUNCTION_ARG to determine where the next arg should go.
626 On the ns32k, this is a single integer, which is a number of bytes
627 of arguments scanned so far. */
629 #define CUMULATIVE_ARGS int
631 /* Initialize a variable CUM of type CUMULATIVE_ARGS
632 for a call to a function whose data type is FNTYPE.
633 For a library call, FNTYPE is 0.
635 On the ns32k, the offset starts at 0. */
637 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
638 ((CUM) = 0)
640 /* Update the data in CUM to advance over an argument
641 of mode MODE and data type TYPE.
642 (TYPE is null for libcalls where that information may not be available.) */
644 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
645 ((CUM) += ((MODE) != BLKmode \
646 ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
647 : (int_size_in_bytes (TYPE) + 3) & ~3))
649 /* Define where to put the arguments to a function.
650 Value is zero to push the argument on the stack,
651 or a hard register in which to store the argument.
653 MODE is the argument's machine mode.
654 TYPE is the data type of the argument (as a tree).
655 This is null for libcalls where that information may
656 not be available.
657 CUM is a variable of type CUMULATIVE_ARGS which gives info about
658 the preceding args and about the function being called.
659 NAMED is nonzero if this argument is a named parameter
660 (otherwise it is an extra parameter matching an ellipsis). */
662 /* On the 32000 all args are pushed, except if -mregparm is specified
663 then the first two words of arguments are passed in r0, r1.
664 *NOTE* -mregparm does not work.
665 It exists only to test register calling conventions. */
667 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
668 ((TARGET_REGPARM && (CUM) < 8) ? gen_rtx_REG ((MODE), (CUM) / 4) : 0)
670 /* For an arg passed partly in registers and partly in memory,
671 this is the number of registers used.
672 For args passed entirely in registers or entirely in memory, zero. */
674 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
675 ((TARGET_REGPARM && (CUM) < 8 \
676 && 8 < ((CUM) + ((MODE) == BLKmode \
677 ? int_size_in_bytes (TYPE) \
678 : GET_MODE_SIZE (MODE)))) \
679 ? 2 - (CUM) / 4 : 0)
681 /* Output assembler code to FILE to increment profiler label # LABELNO
682 for profiling a function entry.
684 THIS DEFINITION FOR THE 32000 IS A GUESS. IT HAS NOT BEEN TESTED. */
686 #define FUNCTION_PROFILER(FILE, LABELNO) \
687 fprintf (FILE, "\taddr LP%d,r0\n\tbsr mcount\n", (LABELNO))
689 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
690 the stack pointer does not matter. The value is tested only in
691 functions that have frame pointers.
692 No definition is equivalent to always zero.
694 We use 0, because using 1 requires hair in output_function_epilogue()
695 that is worse than the stack adjust we could save. */
697 /* #define EXIT_IGNORE_STACK 1 */
699 /* Store in the variable DEPTH the initial difference between the
700 frame pointer reg contents and the stack pointer reg contents,
701 as of the start of the function body. This depends on the layout
702 of the fixed parts of the stack frame and on how registers are saved. */
704 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
706 int regno; \
707 int offset = -4; \
708 for (regno = 0; regno < L1_REGNUM; regno++) \
709 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
710 offset += 4; \
711 for (; regno < FRAME_POINTER_REGNUM; regno++) \
712 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
713 offset += 8; \
714 if (flag_pic && current_function_uses_pic_offset_table) \
715 offset += 4; \
716 (DEPTH) = (offset + get_frame_size () \
717 + (get_frame_size () == 0 ? 0 : 4)); \
721 /* Output assembler code for a block containing the constant parts
722 of a trampoline, leaving space for the variable parts. */
724 /* On the 32k, the trampoline looks like this:
725 addr 0(pc),r2
726 jump @__trampoline
727 .int STATIC
728 .int FUNCTION
729 Doing trampolines with a library assist function is easier than figuring
730 out how to do stores to memory in reverse byte order (the way immediate
731 operands on the 32k are stored). */
733 #define TRAMPOLINE_TEMPLATE(FILE) \
735 fprintf (FILE, "\taddr 0(pc),r2\n" ); \
736 fprintf (FILE, "\tjump " ); \
737 PUT_ABSOLUTE_PREFIX (FILE); \
738 fprintf (FILE, "__trampoline\n" ); \
739 ASM_OUTPUT_INT (FILE, const0_rtx); \
740 ASM_OUTPUT_INT (FILE, const0_rtx); \
743 /* Length in units of the trampoline for entering a nested function. */
745 #define TRAMPOLINE_SIZE 20
747 /* Emit RTL insns to initialize the variable parts of a trampoline.
748 FNADDR is an RTX for the address of the function's pure code.
749 CXT is an RTX for the static chain value for the function. */
751 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
753 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 12)), CXT); \
754 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 16)), FNADDR); \
757 /* This is the library routine that is used
758 to transfer control from the trampoline
759 to the actual nested function. */
761 /* The function name __transfer_from_trampoline is not actually used.
762 The function definition just permits use of "asm with operands"
763 (though the operand list is empty). */
764 #define TRANSFER_FROM_TRAMPOLINE \
765 void \
766 __transfer_from_trampoline () \
768 asm (".globl __trampoline"); \
769 asm ("__trampoline:"); \
770 asm ("movd 16(r2),tos"); \
771 asm ("movd 12(r2),r1"); \
772 asm ("ret 0"); \
775 /* Addressing modes, and classification of registers for them. */
777 /* #define HAVE_POST_INCREMENT 0 */
778 /* #define HAVE_POST_DECREMENT 0 */
780 /* #define HAVE_PRE_DECREMENT 0 */
781 /* #define HAVE_PRE_INCREMENT 0 */
783 /* Macros to check register numbers against specific register classes. */
785 /* These assume that REGNO is a hard or pseudo reg number.
786 They give nonzero only if REGNO is a hard reg of the suitable class
787 or a pseudo reg currently allocated to a suitable hard reg.
788 Since they use reg_renumber, they are safe only once reg_renumber
789 has been allocated, which happens in local-alloc.c. */
791 /* note that FP and SP cannot be used as an index. What about PC? */
792 #define REGNO_OK_FOR_INDEX_P(REGNO) \
793 ((REGNO) < F0_REGNUM || (unsigned)reg_renumber[REGNO] < F0_REGNUM)
794 #define REGNO_OK_FOR_BASE_P(REGNO) \
795 ((REGNO) < F0_REGNUM || (unsigned)reg_renumber[REGNO] < F0_REGNUM \
796 || (REGNO) == FRAME_POINTER_REGNUM || (REGNO) == STACK_POINTER_REGNUM)
798 #define FP_REG_P(X) \
799 (GET_CODE (X) == REG && REGNO (X) >= F0_REGNUM && REGNO (X) < FRAME_POINTER_REGNUM)
801 /* Maximum number of registers that can appear in a valid memory address. */
803 #define MAX_REGS_PER_ADDRESS 2
805 /* Recognize any constant value that is a valid address.
806 This might not work on future ns32k processors as negative
807 displacements are not officially allowed but a mode reserved
808 to National. This works on processors up to 32532, though,
809 and we don't expect any new ones in the series ;-( */
811 #define CONSTANT_ADDRESS_P(X) \
812 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
813 || GET_CODE (X) == CONST \
814 || (GET_CODE (X) == CONST_INT \
815 && NS32K_DISPLACEMENT_P (INTVAL (X))))
817 #define CONSTANT_ADDRESS_NO_LABEL_P(X) \
818 (GET_CODE (X) == CONST_INT \
819 && NS32K_DISPLACEMENT_P (INTVAL (X)))
821 /* Return the register class of a scratch register needed to copy IN into
822 or out of a register in CLASS in MODE. If it can be done directly,
823 NO_REGS is returned. */
825 #define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
826 secondary_reload_class (CLASS, MODE, IN)
828 /* Certain machines have the property that some registers cannot be
829 copied to some other registers without using memory. Define this
830 macro on those machines to be a C expression that is non-zero if
831 objects of mode M in registers of CLASS1 can only be copied to
832 registers of class CLASS2 by storing a register of CLASS1 into
833 memory and loading that memory location into a register of CLASS2.
835 On the ns32k, floating point regs can only be loaded through memory
837 The movdf and movsf insns in ns32k.md copy between general and
838 floating registers using the stack. In principle, we could get
839 better code not allowing that case in the constraints and defining
840 SECONDARY_MEMORY_NEEDED in practice, though the stack slots used
841 are not available for optimization. */
843 #if 0
844 #define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, M) \
845 secondary_memory_needed(CLASS1, CLASS2, M)
846 #endif
848 /* SMALL_REGISTER_CLASSES is a run time option. This should no longer
849 be necessay and should go when we have confidence that we won't run
850 out of spill registers */
851 #define SMALL_REGISTER_CLASSES (target_flags & 1024)
853 /* A C expression whose value is nonzero if pseudos that have been
854 assigned to registers of class CLASS would likely be spilled
855 because registers of CLASS are needed for spill registers.
857 The default definition won't do because class LONG_FLOAT_REG0 has two
858 registers which are always acessed as a pair */
860 #define CLASS_LIKELY_SPILLED_P(CLASS) \
861 (reg_class_size[(int) (CLASS)] == 1 || (CLASS) == LONG_FLOAT_REG0)
864 /* Nonzero if the constant value X is a legitimate general operand.
865 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
867 #define LEGITIMATE_CONSTANT_P(X) 1
869 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
870 and check its validity for a certain class.
871 We have two alternate definitions for each of them.
872 The usual definition accepts all pseudo regs; the other rejects
873 them unless they have been allocated suitable hard regs.
874 The symbol REG_OK_STRICT causes the latter definition to be used.
876 Most source files want to accept pseudo regs in the hope that
877 they will get allocated to the class that the insn wants them to be in.
878 Source files for reload pass need to be strict.
879 After reload, it makes no difference, since pseudo regs have
880 been eliminated by then. */
882 #ifndef REG_OK_STRICT
884 /* Nonzero if X is a hard reg that can be used as an index
885 or if it is a pseudo reg. */
886 #define REG_OK_FOR_INDEX_P(X) \
887 (REGNO (X) < F0_REGNUM || REGNO (X) >= FIRST_PSEUDO_REGISTER)
888 /* Nonzero if X is a hard reg that can be used as a base reg
889 of if it is a pseudo reg. */
890 #define REG_OK_FOR_BASE_P(X) (REGNO (X) < F0_REGNUM || REGNO (X) >= FRAME_POINTER_REGNUM)
891 /* Nonzero if X is a floating point reg or a pseudo reg. */
893 #else
895 /* Nonzero if X is a hard reg that can be used as an index. */
896 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
897 /* Nonzero if X is a hard reg that can be used as a base reg. */
898 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
900 #endif
902 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
903 that is a valid memory address for an instruction.
904 The MODE argument is the machine mode for the MEM expression
905 that wants to use this address.
907 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */
909 /* 1 if X is an address that we could indirect through. */
910 /***** NOTE ***** There is a bug in the Sequent assembler which fails
911 to fixup addressing information for symbols used as offsets
912 from registers which are not FP or SP (or SB or PC). This
913 makes _x(fp) valid, while _x(r0) is invalid. */
915 #define INDIRECTABLE_1_ADDRESS_P(X) \
916 (CONSTANT_ADDRESS_P (X) \
917 || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
918 || (GET_CODE (X) == PLUS \
919 && GET_CODE (XEXP (X, 0)) == REG \
920 && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
921 && ((flag_pic || TARGET_HIMEM) ? \
922 CONSTANT_ADDRESS_NO_LABEL_P (XEXP (X, 1)) \
924 CONSTANT_ADDRESS_P (XEXP (X, 1))) \
925 && (GET_CODE (X) != CONST_INT || NS32K_DISPLACEMENT_P (INTVAL (X)))))
927 /* 1 if integer I will fit in a 4 byte displacement field.
928 Strictly speaking, we can't be sure that a symbol will fit this range.
929 But, in practice, it always will. */
931 /* idall@eleceng.adelaide.edu.au says that the 32016 and 32032
932 can handle the full range of displacements--it is only the addresses
933 that have a limited range. So the following was deleted:
934 (((i) <= 16777215 && (i) >= -16777216)
935 || ((TARGET_32532 || TARGET_32332) && ...)) */
936 #define NS32K_DISPLACEMENT_P(i) \
937 ((i) < (1 << 29) && (i) >= - (1 << 29))
939 /* Check for frame pointer or stack pointer. */
940 #define MEM_REG(X) \
941 (GET_CODE (X) == REG && (REGNO (X) == FRAME_POINTER_REGNUM \
942 || REGNO(X) == STACK_POINTER_REGNUM))
944 /* A memory ref whose address is the FP or SP, with optional integer offset,
945 or (on certain machines) a constant address. */
946 #define INDIRECTABLE_2_ADDRESS_P(X) \
947 (GET_CODE (X) == MEM \
948 && (((xfoo0 = XEXP (X, 0), MEM_REG (xfoo0)) \
949 || (GET_CODE (xfoo0) == PLUS \
950 && MEM_REG (XEXP (xfoo0, 0)) \
951 && CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfoo0, 1)))) \
952 || (TARGET_SB && CONSTANT_ADDRESS_P (xfoo0))))
954 /* Go to ADDR if X is a valid address not using indexing.
955 (This much is the easy part.) */
956 #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
958 if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; \
959 if (INDIRECTABLE_2_ADDRESS_P (X)) goto ADDR; \
960 if (GET_CODE (X) == PLUS) \
961 if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (X, 1))) \
962 if (INDIRECTABLE_2_ADDRESS_P (XEXP (X, 0))) \
963 goto ADDR; \
966 /* Go to ADDR if X is a valid address not using indexing.
967 (This much is the easy part.) */
968 #define GO_IF_INDEXING(X, MODE, ADDR) \
969 { register rtx xfoob = (X); \
970 if (GET_CODE (xfoob) == PLUS && INDEX_TERM_P (XEXP (xfoob, 0), MODE)) \
971 GO_IF_INDEXABLE_ADDRESS (XEXP (xfoob, 1), ADDR); \
972 if (GET_CODE (xfoob) == PLUS && INDEX_TERM_P (XEXP (xfoob, 1), MODE)) \
973 GO_IF_INDEXABLE_ADDRESS (XEXP (xfoob, 0), ADDR); } \
975 #define GO_IF_INDEXABLE_ADDRESS(X, ADDR) \
976 { if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) goto ADDR; \
977 if (INDIRECTABLE_2_ADDRESS_P (X)) goto ADDR; \
978 if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; \
981 /* 1 if PROD is either a reg times size of mode MODE
982 or just a reg, if MODE is just one byte. Actually, on the ns32k,
983 since the index mode is independent of the operand size,
984 we can match more stuff...
986 This macro's expansion uses the temporary variables xfoo0, xfoo1
987 and xfoo2 that must be declared in the surrounding context. */
988 #define INDEX_TERM_P(PROD, MODE) \
989 ((GET_CODE (PROD) == REG && REG_OK_FOR_INDEX_P (PROD)) \
990 || (GET_CODE (PROD) == MULT \
991 && (xfoo0 = XEXP (PROD, 0), xfoo1 = XEXP (PROD, 1), \
992 (GET_CODE (xfoo1) == CONST_INT \
993 && GET_CODE (xfoo0) == REG \
994 && FITS_INDEX_RANGE (INTVAL (xfoo1)) \
995 && REG_OK_FOR_INDEX_P (xfoo0)))))
997 #define FITS_INDEX_RANGE(X) \
998 ((xfoo2 = (unsigned)(X)-1), \
999 ((xfoo2 < 4 && xfoo2 != 2) || xfoo2 == 7))
1001 /* Note that xfoo0, xfoo1, xfoo2 are used in some of the submacros above. */
1002 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1003 { register rtx xfooy, xfoo0, xfoo1; \
1004 unsigned xfoo2; \
1005 xfooy = X; \
1006 if (flag_pic && cfun && ! current_function_uses_pic_offset_table \
1007 && global_symbolic_reference_mentioned_p (X, 1)) \
1008 current_function_uses_pic_offset_table = 1; \
1009 GO_IF_NONINDEXED_ADDRESS (xfooy, ADDR); \
1010 if (GET_CODE (xfooy) == PLUS) \
1012 if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfooy, 1)) \
1013 && GET_CODE (XEXP (xfooy, 0)) == PLUS) \
1014 xfooy = XEXP (xfooy, 0); \
1015 else if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfooy, 0)) \
1016 && GET_CODE (XEXP (xfooy, 1)) == PLUS) \
1017 xfooy = XEXP (xfooy, 1); \
1018 GO_IF_INDEXING (xfooy, MODE, ADDR); \
1020 else if (INDEX_TERM_P (xfooy, MODE)) \
1021 goto ADDR; \
1022 else if (GET_CODE (xfooy) == PRE_DEC) \
1024 if (REGNO (XEXP (xfooy, 0)) == STACK_POINTER_REGNUM) goto ADDR; \
1025 else abort (); \
1029 /* Try machine-dependent ways of modifying an illegitimate address
1030 to be legitimate. If we find one, return the new, valid address.
1031 This macro is used in only one place: `memory_address' in explow.c.
1033 OLDX is the address as it was before break_out_memory_refs was called.
1034 In some cases it is useful to look at this to decide what needs to be done.
1036 MODE and WIN are passed so that this macro can use
1037 GO_IF_LEGITIMATE_ADDRESS.
1039 It is always safe for this macro to do nothing. It exists to recognize
1040 opportunities to optimize the output.
1042 For the ns32k, we do nothing */
1044 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
1046 /* Nonzero if the constant value X is a legitimate general operand
1047 when generating PIC code. It is given that flag_pic is on and
1048 that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1050 #define LEGITIMATE_PIC_OPERAND_P(X) \
1051 (((! current_function_uses_pic_offset_table \
1052 && symbolic_reference_mentioned_p (X))? \
1053 (current_function_uses_pic_offset_table = 1):0 \
1054 ), (! SYMBOLIC_CONST (X) \
1055 || GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == LABEL_REF))
1057 #define SYMBOLIC_CONST(X) \
1058 (GET_CODE (X) == SYMBOL_REF \
1059 || GET_CODE (X) == LABEL_REF \
1060 || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
1062 /* Define this macro if references to a symbol must be treated
1063 differently depending on something about the variable or
1064 function named by the symbol (such as what section it is in).
1066 On the ns32k, if using PIC, mark a SYMBOL_REF for a non-global
1067 symbol or a code symbol. These symbols are referenced via pc
1068 and not via sb. */
1070 #define ENCODE_SECTION_INFO(DECL) \
1071 do \
1073 extern int flag_pic; \
1074 if (flag_pic) \
1076 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
1077 ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
1078 SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
1079 = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
1080 || ! TREE_PUBLIC (DECL)); \
1083 while (0)
1085 /* Go to LABEL if ADDR (a legitimate address expression)
1086 has an effect that depends on the machine mode it is used for.
1087 On the ns32k, only predecrement and postincrement address depend thus
1088 (the amount of decrement or increment being the length of the operand). */
1090 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1091 { if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \
1092 goto LABEL;}
1094 /* Specify the machine mode that this machine uses
1095 for the index in the tablejump instruction.
1096 HI mode is more efficient but the range is not wide enough for
1097 all programs. */
1098 #define CASE_VECTOR_MODE SImode
1100 /* Define as C expression which evaluates to nonzero if the tablejump
1101 instruction expects the table to contain offsets from the address of the
1102 table.
1103 Do not define this if the table should contain absolute addresses. */
1104 #define CASE_VECTOR_PC_RELATIVE 1
1106 /* Specify the tree operation to be used to convert reals to integers. */
1107 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1109 /* This is the kind of divide that is easiest to do in the general case. */
1110 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1112 /* Define this as 1 if `char' should by default be signed; else as 0. */
1113 #define DEFAULT_SIGNED_CHAR 1
1115 /* Max number of bytes we can move from memory to memory
1116 in one reasonably fast instruction. */
1117 #define MOVE_MAX 4
1119 /* The number of scalar move insns which should be generated instead
1120 of a string move insn or a library call.
1122 We have a smart movstrsi insn */
1123 #define MOVE_RATIO 0
1125 /* Define this if zero-extension is slow (more than one real instruction). */
1126 /* #define SLOW_ZERO_EXTEND */
1128 /* Nonzero if access to memory by bytes is slow and undesirable. */
1129 #define SLOW_BYTE_ACCESS 0
1131 /* Define if shifts truncate the shift count
1132 which implies one can omit a sign-extension or zero-extension
1133 of a shift count. */
1134 /* #define SHIFT_COUNT_TRUNCATED */
1136 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1137 is done just by pretending it is already truncated. */
1138 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1140 /* We assume that the store-condition-codes instructions store 0 for false
1141 and some other value for true. This is the value stored for true. */
1143 #define STORE_FLAG_VALUE 1
1145 /* Specify the machine mode that pointers have.
1146 After generation of rtl, the compiler makes no further distinction
1147 between pointers and any other objects of this machine mode. */
1148 #define Pmode SImode
1150 /* A function address in a call instruction
1151 is a byte address (for indexing purposes)
1152 so give the MEM rtx a byte's mode. */
1153 #define FUNCTION_MODE QImode
1155 /* Compute the cost of address ADDRESS. */
1157 #define ADDRESS_COST(RTX) calc_address_cost (RTX)
1159 /* Compute the cost of computing a constant rtl expression RTX
1160 whose rtx-code is CODE. The body of this macro is a portion
1161 of a switch statement. If the code is computed here,
1162 return it with a return statement. Otherwise, break from the switch. */
1164 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1165 case CONST_INT: \
1166 if (INTVAL (RTX) <= 7 && INTVAL (RTX) >= -8) return 0; \
1167 if (INTVAL (RTX) < 0x2000 && INTVAL (RTX) >= -0x2000) \
1168 return 1; \
1169 case CONST: \
1170 case LABEL_REF: \
1171 case SYMBOL_REF: \
1172 return 3; \
1173 case CONST_DOUBLE: \
1174 return 5;
1176 /* Tell final.c how to eliminate redundant test instructions. */
1178 /* Here we define machine-dependent flags and fields in cc_status
1179 (see `conditions.h'). */
1181 /* This bit means that what ought to be in the Z bit
1182 should be tested in the F bit. */
1183 #define CC_Z_IN_F 04000
1185 /* This bit means that what ought to be in the Z bit
1186 is complemented in the F bit. */
1187 #define CC_Z_IN_NOT_F 010000
1189 /* Store in cc_status the expressions
1190 that the condition codes will describe
1191 after execution of an instruction whose pattern is EXP.
1192 Do not alter them if the instruction would not alter the cc's. */
1194 #define NOTICE_UPDATE_CC(EXP, INSN) \
1195 { if (GET_CODE (EXP) == SET) \
1196 { if (GET_CODE (SET_DEST (EXP)) == CC0) \
1197 { cc_status.flags = 0; \
1198 cc_status.value1 = SET_DEST (EXP); \
1199 cc_status.value2 = SET_SRC (EXP); \
1201 else if (GET_CODE (SET_SRC (EXP)) == CALL) \
1202 { CC_STATUS_INIT; } \
1203 else if (GET_CODE (SET_DEST (EXP)) == REG) \
1204 { if (cc_status.value1 \
1205 && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value1)) \
1206 cc_status.value1 = 0; \
1207 if (cc_status.value2 \
1208 && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value2)) \
1209 cc_status.value2 = 0; \
1211 else if (GET_CODE (SET_DEST (EXP)) == MEM) \
1212 { CC_STATUS_INIT; } \
1214 else if (GET_CODE (EXP) == PARALLEL \
1215 && GET_CODE (XVECEXP (EXP, 0, 0)) == SET) \
1216 { if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == CC0) \
1217 { cc_status.flags = 0; \
1218 cc_status.value1 = SET_DEST (XVECEXP (EXP, 0, 0)); \
1219 cc_status.value2 = SET_SRC (XVECEXP (EXP, 0, 0)); \
1221 else if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == REG) \
1222 { if (cc_status.value1 \
1223 && reg_overlap_mentioned_p (SET_DEST (XVECEXP (EXP, 0, 0)), cc_status.value1)) \
1224 cc_status.value1 = 0; \
1225 if (cc_status.value2 \
1226 && reg_overlap_mentioned_p (SET_DEST (XVECEXP (EXP, 0, 0)), cc_status.value2)) \
1227 cc_status.value2 = 0; \
1229 else if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == MEM) \
1230 { CC_STATUS_INIT; } \
1232 else if (GET_CODE (EXP) == CALL) \
1233 { /* all bets are off */ CC_STATUS_INIT; } \
1234 else { /* nothing happens? CC_STATUS_INIT; */} \
1235 if (cc_status.value1 && GET_CODE (cc_status.value1) == REG \
1236 && cc_status.value2 \
1237 && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2)) \
1238 abort (); \
1241 /* Describe the costs of the following register moves which are discouraged:
1242 1.) Moves between the Floating point registers and the frame pointer and stack pointer
1243 2.) Moves between the stack pointer and the frame pointer
1244 3.) Moves between the floating point and general registers
1246 These all involve two memory references. This is worse than a memory
1247 to memory move (default cost 4)
1250 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
1251 register_move_cost (CLASS1, CLASS2)
1253 #define OUTPUT_JUMP(NORMAL, NO_OV) \
1254 { if (cc_status.flags & CC_NO_OVERFLOW) \
1255 return NO_OV; \
1256 return NORMAL; }
1258 /* Dividing the output into sections */
1260 /* Output before read-only data. */
1262 #define TEXT_SECTION_ASM_OP "\t.text"
1264 /* Output before writable data. */
1266 #define DATA_SECTION_ASM_OP "\t.data"
1268 /* Define the output Assembly Language */
1270 /* Output at beginning of assembler file. */
1272 #define ASM_FILE_START(FILE) fprintf (FILE, "#NO_APP\n");
1274 /* Output to assembler file text saying following lines
1275 may contain character constants, extra white space, comments, etc. */
1277 #define ASM_APP_ON "#APP\n"
1279 /* Output to assembler file text saying following lines
1280 no longer contain unusual constructs. */
1282 #define ASM_APP_OFF "#NO_APP\n"
1284 /* Output of Data */
1286 /* This is how to output an assembler line defining a `double' constant. */
1288 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
1289 fprintf (FILE, "\t.double 0d%.20e\n", (VALUE))
1291 /* This is how to output an assembler line defining a `float' constant. */
1293 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
1294 fprintf (FILE, "\t.float 0f%.20e\n", (VALUE))
1296 /* This is how to output an assembler line defining an `int' constant. */
1298 #define ASM_OUTPUT_INT(FILE,VALUE) \
1299 ( fprintf (FILE, "\t.long "), \
1300 output_addr_const (FILE, (VALUE)), \
1301 fprintf (FILE, "\n"))
1303 /* Likewise for `char' and `short' constants. */
1305 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
1306 ( fprintf (FILE, "\t.word "), \
1307 output_addr_const (FILE, (VALUE)), \
1308 fprintf (FILE, "\n"))
1310 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
1311 ( fprintf (FILE, "\t.byte "), \
1312 output_addr_const (FILE, (VALUE)), \
1313 fprintf (FILE, "\n"))
1315 /* This is how to output an assembler line for a numeric constant byte. */
1317 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
1318 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1320 /* This is how to output an assembler line defining an external/static
1321 address which is not in tree format (for collect.c). */
1323 /* The prefix to add to user-visible assembler symbols. */
1324 #define USER_LABEL_PREFIX "_"
1326 /* This is how to output an insn to push a register on the stack.
1327 It need not be very fast code. */
1329 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1330 fprintf (FILE, "\tmovd %s,tos\n", reg_names[REGNO])
1332 /* This is how to output an insn to pop a register from the stack.
1333 It need not be very fast code. */
1335 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1336 fprintf (FILE, "\tmovd tos,%s\n", reg_names[REGNO])
1338 /* This is how to output the definition of a user-level label named NAME,
1339 such as the label on a static function or variable NAME. */
1341 #ifndef COLLECT
1342 #define ASM_OUTPUT_LABEL(FILE,NAME) \
1343 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1344 #else
1345 #define ASM_OUTPUT_LABEL(STREAM,NAME) \
1346 do { \
1347 fprintf (STREAM, "%s:\n", NAME); \
1348 } while (0)
1349 #endif
1351 /* This is how to output a command to make the user-level label named NAME
1352 defined for reference from other files. */
1354 #ifndef COLLECT
1355 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
1356 do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
1357 #else
1358 #define ASM_GLOBALIZE_LABEL(STREAM,NAME) \
1359 do { \
1360 fprintf (STREAM, "\t.globl\t%s\n", NAME); \
1361 } while (0)
1362 #endif
1364 /* This is how to output an internal numbered label where
1365 PREFIX is the class of label and NUM is the number within the class. */
1367 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1368 fprintf (FILE, "%s%d:\n", PREFIX, NUM)
1370 /* This is how to store into the string LABEL
1371 the symbol_ref name of an internal numbered label where
1372 PREFIX is the class of label and NUM is the number within the class.
1373 This is suitable for output with `assemble_name'. */
1375 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1376 sprintf (LABEL, "*%s%ld", PREFIX, (long) NUM)
1378 /* This is how to align the code that follows an unconditional branch. */
1380 #define LABEL_ALIGN_AFTER_BARRIER(LABEL) (2)
1382 /* This is how to output an element of a case-vector that is absolute.
1383 (The ns32k does not use such vectors,
1384 but we must define this macro anyway.) */
1386 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1387 fprintf (FILE, "\t.long L%d\n", VALUE)
1389 /* This is how to output an element of a case-vector that is relative. */
1390 /* ** Notice that the second element is LI format! */
1391 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1392 fprintf (FILE, "\t.long L%d-LI%d\n", VALUE, REL)
1394 /* This is how to output an assembler line
1395 that says to advance the location counter
1396 to a multiple of 2**LOG bytes. */
1398 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1399 fprintf (FILE, "\t.align %d\n", (LOG))
1401 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1402 fprintf (FILE, "\t.space %u\n", (SIZE))
1404 /* This says how to output an assembler line
1405 to define a global common symbol. */
1407 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1408 ( fputs (".comm ", (FILE)), \
1409 assemble_name ((FILE), (NAME)), \
1410 fprintf ((FILE), ",%u\n", (ROUNDED)))
1412 /* This says how to output an assembler line
1413 to define a local common symbol. */
1415 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
1416 ( fputs (".lcomm ", (FILE)), \
1417 assemble_name ((FILE), (NAME)), \
1418 fprintf ((FILE), ",%u\n", (ROUNDED)))
1420 /* Store in OUTPUT a string (made with alloca) containing
1421 an assembler-name for a local static variable named NAME.
1422 LABELNO is an integer which is different for each call. */
1424 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1425 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1426 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1428 /* Print an instruction operand X on file FILE.
1429 CODE is the code from the %-spec that requested printing this operand;
1430 if `%z3' was used to print operand 3, then CODE is 'z'. */
1432 /* %$ means print the prefix for an immediate operand. */
1434 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1435 ((CODE) == '$' || (CODE) == '?')
1437 #define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE, X, CODE)
1439 /* Print a memory operand whose address is X, on file FILE. */
1441 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address(FILE, ADDR)
1443 extern unsigned int ns32k_reg_class_contents[N_REG_CLASSES][1];
1444 extern enum reg_class regclass_map[]; /* smallest class containing REGNO */
1447 Local variables:
1448 version-control: t
1449 End: