Import final gcc2 snapshot (990109)
[official-gcc.git] / gcc / config / ns32k / ns32k.h
blob5c2d8b8a0d1719daec81e85b3eebd3d926ee211e
1 /* Definitions of target machine for GNU compiler. NS32000 version.
2 Copyright (C) 1988, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
3 Contributed by Michael Tiemann (tiemann@cygnus.com)
5 This file is part of GNU CC.
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.
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.
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, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
23 /* Note that some other tm.h files include this one and then override
24 many of the definitions that relate to assembler syntax. */
26 extern enum reg_class secondary_reload_class();
28 /* Names to predefine in the preprocessor for this target machine. */
30 #define CPP_PREDEFINES "-Dns32000 -Dunix -Asystem(unix) -Acpu(ns32k) -Amachine(ns32k)"
32 /* Print subsidiary information on the compiler version in use. */
33 #define TARGET_VERSION fprintf (stderr, " (32000, GAS syntax)");
36 /* ABSOLUTE PREFIX, IMMEDIATE_PREFIX and EXTERNAL_PREFIX can be defined
37 to cover most NS32k addressing syntax variations. This way we don't
38 need to redefine long macros in all the tm.h files for just slight
39 variations in assembler syntax. */
41 #ifndef ABSOLUTE_PREFIX
42 #define ABSOLUTE_PREFIX '@'
43 #endif
45 #if defined(IMMEDIATE_PREFIX) && IMMEDIATE_PREFIX
46 #define PUT_IMMEDIATE_PREFIX(FILE) putc(IMMEDIATE_PREFIX, FILE)
47 #else
48 #define PUT_IMMEDIATE_PREFIX(FILE)
49 #endif
50 #if defined(ABSOLUTE_PREFIX) && ABSOLUTE_PREFIX
51 #define PUT_ABSOLUTE_PREFIX(FILE) putc(ABSOLUTE_PREFIX, FILE)
52 #else
53 #define PUT_ABSOLUTE_PREFIX(FILE)
54 #endif
55 #if defined(EXTERNAL_PREFIX) && EXTERNAL_PREFIX
56 #define PUT_EXTERNAL_PREFIX(FILE) putc(EXTERNAL_PREFIX, FILE)
57 #else
58 #define PUT_EXTERNAL_PREFIX(FILE)
59 #endif
61 /* Run-time compilation parameters selecting different hardware subsets. */
63 extern int target_flags;
65 /* Macros used in the machine description to test the flags. */
67 /* Compile 32081 insns for floating point (not library calls). */
68 #define TARGET_32081 (target_flags & 1)
70 /* Compile using rtd insn calling sequence.
71 This will not work unless you use prototypes at least
72 for all functions that can take varying numbers of args. */
73 #define TARGET_RTD (target_flags & 2)
75 /* Compile passing first two args in regs 0 and 1. */
76 #define TARGET_REGPARM (target_flags & 4)
78 /* Options to select type of CPU, for better optimization.
79 The output is correct for any kind of 32000 regardless of these options. */
80 #define TARGET_32532 (target_flags & 8)
81 #define TARGET_32332 (target_flags & 16)
83 /* Ok to use the static base register (and presume it's 0) */
84 #define TARGET_SB ((target_flags & 32) == 0)
85 #define TARGET_HIMEM (target_flags & 128)
87 /* Compile using bitfield insns. */
88 #define TARGET_BITFIELD ((target_flags & 64) == 0)
90 /* Macro to define tables used to set the flags.
91 This is a list in braces of pairs in braces,
92 each pair being { "NAME", VALUE }
93 where VALUE is the bits to set or minus the bits to clear.
94 An empty string NAME is used to identify the default VALUE. */
96 #define TARGET_SWITCHES \
97 { { "32081", 1}, \
98 { "soft-float", -1}, \
99 { "rtd", 2}, \
100 { "nortd", -2}, \
101 { "regparm", 4}, \
102 { "noregparm", -4}, \
103 { "32532", 24}, \
104 { "32332", -8}, \
105 { "32332", 16}, \
106 { "32032", -24}, \
107 { "sb", -32}, \
108 { "nosb", 32}, \
109 { "bitfield", -64}, \
110 { "nobitfield", 64}, \
111 { "himem", 128}, \
112 { "nohimem", -128}, \
113 { "", TARGET_DEFAULT}}
114 /* TARGET_DEFAULT is defined in encore.h, pc532.h, etc. */
116 /* When we are generating PIC, the sb is used as a pointer
117 to the GOT. */
119 #define OVERRIDE_OPTIONS \
121 if (flag_pic || TARGET_HIMEM) target_flags |= 32; \
125 /* target machine storage layout */
127 /* Define this if most significant bit is lowest numbered
128 in instructions that operate on numbered bit-fields.
129 This is not true on the ns32k. */
130 #define BITS_BIG_ENDIAN 0
132 /* Define this if most significant byte of a word is the lowest numbered. */
133 /* That is not true on the ns32k. */
134 #define BYTES_BIG_ENDIAN 0
136 /* Define this if most significant word of a multiword number is lowest
137 numbered. This is not true on the ns32k. */
138 #define WORDS_BIG_ENDIAN 0
140 /* Number of bits in an addressable storage unit */
141 #define BITS_PER_UNIT 8
143 /* Width in bits of a "word", which is the contents of a machine register.
144 Note that this is not necessarily the width of data type `int';
145 if using 16-bit ints on a 32000, this would still be 32.
146 But on a machine with 16-bit registers, this would be 16. */
147 #define BITS_PER_WORD 32
149 /* Width of a word, in units (bytes). */
150 #define UNITS_PER_WORD 4
152 /* Width in bits of a pointer.
153 See also the macro `Pmode' defined below. */
154 #define POINTER_SIZE 32
156 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
157 #define PARM_BOUNDARY 32
159 /* Boundary (in *bits*) on which stack pointer should be aligned. */
160 #define STACK_BOUNDARY 32
162 /* Allocation boundary (in *bits*) for the code of a function. */
163 #define FUNCTION_BOUNDARY 16
165 /* Alignment of field after `int : 0' in a structure. */
166 #define EMPTY_FIELD_BOUNDARY 32
168 /* Every structure's size must be a multiple of this. */
169 #define STRUCTURE_SIZE_BOUNDARY 8
171 /* No data type wants to be aligned rounder than this. */
172 #define BIGGEST_ALIGNMENT 32
174 /* Set this nonzero if move instructions will actually fail to work
175 when given unaligned data. National claims that the NS32032
176 works without strict alignment, but rumor has it that operands
177 crossing a page boundary cause unpredictable results. */
178 #define STRICT_ALIGNMENT 1
180 /* If bit field type is int, dont let it cross an int,
181 and give entire struct the alignment of an int. */
182 /* Required on the 386 since it doesn't have a full set of bitfield insns.
183 (There is no signed extv insn.) */
184 #define PCC_BITFIELD_TYPE_MATTERS 1
186 /* Standard register usage. */
188 /* Number of actual hardware registers.
189 The hardware registers are assigned numbers for the compiler
190 from 0 to just below FIRST_PSEUDO_REGISTER.
191 All registers that the compiler knows about must be given numbers,
192 even those that are not normally considered general registers. */
193 #define FIRST_PSEUDO_REGISTER 18
195 /* 1 for registers that have pervasive standard uses
196 and are not available for the register allocator.
197 On the ns32k, these are the FP, SP, (SB and PC are not included here). */
198 #define FIXED_REGISTERS {0, 0, 0, 0, 0, 0, 0, 0, \
199 0, 0, 0, 0, 0, 0, 0, 0, \
200 1, 1}
202 /* 1 for registers not available across function calls.
203 These must include the FIXED_REGISTERS and also any
204 registers that can be used without being saved.
205 The latter must include the registers where values are returned
206 and the register where structure-value addresses are passed.
207 Aside from that, you can include as many other registers as you like. */
208 #define CALL_USED_REGISTERS {1, 1, 1, 0, 0, 0, 0, 0, \
209 1, 1, 1, 1, 0, 0, 0, 0, \
210 1, 1}
212 /* Return number of consecutive hard regs needed starting at reg REGNO
213 to hold something of mode MODE.
214 This is ordinarily the length in words of a value of mode MODE
215 but can be less for certain modes in special long registers.
216 On the ns32k, all registers are 32 bits long. */
217 #define HARD_REGNO_NREGS(REGNO, MODE) \
218 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
220 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
221 #define HARD_REGNO_MODE_OK(REGNO, MODE) hard_regno_mode_ok (REGNO, MODE)
223 /* Value is 1 if it is a good idea to tie two pseudo registers
224 when one has mode MODE1 and one has mode MODE2.
225 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
226 for any hard reg, then this must be 0 for correct output. */
227 #define MODES_TIEABLE_P(MODE1, MODE2) \
228 (((MODE1) == DFmode || (MODE1) == DCmode || (MODE1) == DImode) == \
229 ((MODE2) == DFmode || (MODE2) == DCmode || (MODE2) == DImode))
231 /* Specify the registers used for certain standard purposes.
232 The values of these macros are register numbers. */
234 /* NS32000 pc is not overloaded on a register. */
235 /* #define PC_REGNUM */
237 /* Register to use for pushing function arguments. */
238 #define STACK_POINTER_REGNUM 17
240 /* Base register for access to local variables of the function. */
241 #define FRAME_POINTER_REGNUM 16
243 /* Value should be nonzero if functions must have frame pointers.
244 Zero means the frame pointer need not be set up (and parms
245 may be accessed via the stack pointer) in functions that seem suitable.
246 This is computed in `reload', in reload1.c. */
247 #define FRAME_POINTER_REQUIRED 0
249 /* Base register for access to arguments of the function. */
250 #define ARG_POINTER_REGNUM 16
252 /* Register in which static-chain is passed to a function. */
253 #define STATIC_CHAIN_REGNUM 1
255 /* Register in which address to store a structure value
256 is passed to a function. */
257 #define STRUCT_VALUE_REGNUM 2
259 /* Define the classes of registers for register constraints in the
260 machine description. Also define ranges of constants.
262 One of the classes must always be named ALL_REGS and include all hard regs.
263 If there is more than one class, another class must be named NO_REGS
264 and contain no registers.
266 The name GENERAL_REGS must be the name of a class (or an alias for
267 another name such as ALL_REGS). This is the class of registers
268 that is allowed by "g" or "r" in a register constraint.
269 Also, registers outside this class are allocated only when
270 instructions express preferences for them.
272 The classes must be numbered in nondecreasing order; that is,
273 a larger-numbered class must never be contained completely
274 in a smaller-numbered class.
276 For any two classes, it is very desirable that there be another
277 class that represents their union. */
279 enum reg_class { NO_REGS, GENERAL_REGS, FLOAT_REGS, GEN_AND_FP_REGS,
280 FRAME_POINTER_REG, STACK_POINTER_REG,
281 GEN_AND_MEM_REGS, ALL_REGS, LIM_REG_CLASSES };
283 #define N_REG_CLASSES (int) LIM_REG_CLASSES
285 /* Give names of register classes as strings for dump file. */
287 #define REG_CLASS_NAMES \
288 {"NO_REGS", "GENERAL_REGS", "FLOAT_REGS", "GEN_AND_FP_REGS", \
289 "FRAME_POINTER_REG", "STACK_POINTER_REG", "GEN_AND_MEM_REGS", "ALL_REGS" }
291 /* Define which registers fit in which classes.
292 This is an initializer for a vector of HARD_REG_SET
293 of length N_REG_CLASSES. */
295 #define REG_CLASS_CONTENTS {0, 0x00ff, 0xff00, 0xffff, \
296 0x10000, 0x20000, 0x300ff, 0x3ffff }
298 /* The same information, inverted:
299 Return the class number of the smallest class containing
300 reg number REGNO. This could be a conditional expression
301 or could index an array. */
303 #define REGNO_REG_CLASS(REGNO) \
304 ((REGNO) < 8 ? GENERAL_REGS \
305 : (REGNO) < 16 ? FLOAT_REGS \
306 : (REGNO) == 16 ? FRAME_POINTER_REG \
307 : (REGNO) == 17 ? STACK_POINTER_REG \
308 : NO_REGS)
310 /* The class value for index registers, and the one for base regs. */
312 #define INDEX_REG_CLASS GENERAL_REGS
313 #define BASE_REG_CLASS GEN_AND_MEM_REGS
315 /* Get reg_class from a letter such as appears in the machine description. */
317 #define REG_CLASS_FROM_LETTER(C) \
318 ((C) == 'f' ? FLOAT_REGS \
319 : (C) == 'x' ? FRAME_POINTER_REG \
320 : (C) == 'y' ? STACK_POINTER_REG \
321 : NO_REGS)
323 /* The letters I, J, K, L and M in a register constraint string
324 can be used to stand for particular ranges of immediate operands.
325 This macro defines what the ranges are.
326 C is the letter, and VALUE is a constant value.
327 Return 1 if VALUE is in the range specified by C.
329 On the ns32k, these letters are used as follows:
331 I : Matches integers which are valid shift amounts for scaled indexing.
332 These are 0, 1, 2, 3 for byte, word, double, and quadword.
333 Used for matching arithmetic shifts only on 32032 & 32332.
334 J : Matches integers which fit a "quick" operand.
335 K : Matches integers 0 to 7 (for inss and exts instructions).
338 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
339 ((VALUE) < 8 && (VALUE) + 8 >= 0 ? \
340 ((C) == 'I' ? (!TARGET_32532 && 0 <= (VALUE) && (VALUE) <= 3) : \
341 (C) == 'J' ? (VALUE) <= 7 : \
342 (C) == 'K' ? 0 <= (VALUE) : 0) : 0)
344 /* Similar, but for floating constants, and defining letters G and H.
345 Here VALUE is the CONST_DOUBLE rtx itself. */
347 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1
349 /* Given an rtx X being reloaded into a reg required to be
350 in class CLASS, return the class of reg to actually use.
351 In general this is just CLASS; but on some machines
352 in some cases it is preferable to use a more restrictive class. */
354 /* We return GENERAL_REGS instead of GEN_AND_MEM_REGS.
355 The latter offers no real additional possibilities
356 and can cause spurious secondary reloading. */
357 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
358 ((CLASS) == GEN_AND_MEM_REGS ? GENERAL_REGS : (CLASS))
360 /* Return the maximum number of consecutive registers
361 needed to represent mode MODE in a register of class CLASS. */
362 /* On the 32000, this is the size of MODE in words */
363 #define CLASS_MAX_NREGS(CLASS, MODE) \
364 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
366 /* Stack layout; function entry, exit and calling. */
368 /* Define this if pushing a word on the stack
369 makes the stack pointer a smaller address. */
370 #define STACK_GROWS_DOWNWARD
372 /* Define this if the nominal address of the stack frame
373 is at the high-address end of the local variables;
374 that is, each additional local variable allocated
375 goes at a more negative offset in the frame. */
376 #define FRAME_GROWS_DOWNWARD
378 /* Offset within stack frame to start allocating local variables at.
379 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
380 first local allocated. Otherwise, it is the offset to the BEGINNING
381 of the first local allocated. */
382 #define STARTING_FRAME_OFFSET 0
384 /* If we generate an insn to push BYTES bytes,
385 this says how many the stack pointer really advances by.
386 On the 32000, sp@- in a byte insn really pushes a BYTE. */
387 #define PUSH_ROUNDING(BYTES) (BYTES)
389 /* Offset of first parameter from the argument pointer register value. */
390 #define FIRST_PARM_OFFSET(FNDECL) 8
392 /* Value is the number of byte of arguments automatically
393 popped when returning from a subroutine call.
394 FUNDECL is the declaration node of the function (as a tree),
395 FUNTYPE is the data type of the function (as a tree),
396 or for a library call it is an identifier node for the subroutine name.
397 SIZE is the number of bytes of arguments passed on the stack.
399 On the 32000, the RET insn may be used to pop them if the number
400 of args is fixed, but if the number is variable then the caller
401 must pop them all. RET can't be used for library calls now
402 because the library is compiled with the Unix compiler.
403 Use of RET is a selectable option, since it is incompatible with
404 standard Unix calling sequences. If the option is not selected,
405 the caller must always pop the args. */
407 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
408 ((TARGET_RTD && (!(FUNDECL) || TREE_CODE (FUNDECL) != IDENTIFIER_NODE) \
409 && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
410 || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
411 == void_type_node))) \
412 ? (SIZE) : 0)
414 /* Define how to find the value returned by a function.
415 VALTYPE is the data type of the value (as a tree).
416 If the precise function being called is known, FUNC is its FUNCTION_DECL;
417 otherwise, FUNC is 0. */
419 /* On the 32000 the return value is in R0,
420 or perhaps in F0 is there is fp support. */
422 #define FUNCTION_VALUE(VALTYPE, FUNC) \
423 (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_32081 \
424 ? gen_rtx_REG (TYPE_MODE (VALTYPE), 8) \
425 : gen_rtx_REG (TYPE_MODE (VALTYPE), 0))
427 /* Define how to find the value returned by a library function
428 assuming the value has mode MODE. */
430 /* On the 32000 the return value is in R0,
431 or perhaps F0 is there is fp support. */
433 #define LIBCALL_VALUE(MODE) \
434 (((MODE) == DFmode || (MODE) == SFmode) && TARGET_32081 \
435 ? gen_rtx_REG (MODE, 8) \
436 : gen_rtx_REG (MODE, 0))
438 /* Define this if PCC uses the nonreentrant convention for returning
439 structure and union values. */
441 #define PCC_STATIC_STRUCT_RETURN
443 /* 1 if N is a possible register number for a function value.
444 On the 32000, R0 and F0 are the only registers thus used. */
446 #define FUNCTION_VALUE_REGNO_P(N) (((N) & ~8) == 0)
448 /* 1 if N is a possible register number for function argument passing.
449 On the 32000, no registers are used in this way. */
451 #define FUNCTION_ARG_REGNO_P(N) 0
453 /* Define a data type for recording info about an argument list
454 during the scan of that argument list. This data type should
455 hold all necessary information about the function itself
456 and about the args processed so far, enough to enable macros
457 such as FUNCTION_ARG to determine where the next arg should go.
459 On the ns32k, this is a single integer, which is a number of bytes
460 of arguments scanned so far. */
462 #define CUMULATIVE_ARGS int
464 /* Initialize a variable CUM of type CUMULATIVE_ARGS
465 for a call to a function whose data type is FNTYPE.
466 For a library call, FNTYPE is 0.
468 On the ns32k, the offset starts at 0. */
470 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
471 ((CUM) = 0)
473 /* Update the data in CUM to advance over an argument
474 of mode MODE and data type TYPE.
475 (TYPE is null for libcalls where that information may not be available.) */
477 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
478 ((CUM) += ((MODE) != BLKmode \
479 ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
480 : (int_size_in_bytes (TYPE) + 3) & ~3))
482 /* Define where to put the arguments to a function.
483 Value is zero to push the argument on the stack,
484 or a hard register in which to store the argument.
486 MODE is the argument's machine mode.
487 TYPE is the data type of the argument (as a tree).
488 This is null for libcalls where that information may
489 not be available.
490 CUM is a variable of type CUMULATIVE_ARGS which gives info about
491 the preceding args and about the function being called.
492 NAMED is nonzero if this argument is a named parameter
493 (otherwise it is an extra parameter matching an ellipsis). */
495 /* On the 32000 all args are pushed, except if -mregparm is specified
496 then the first two words of arguments are passed in r0, r1.
497 *NOTE* -mregparm does not work.
498 It exists only to test register calling conventions. */
500 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
501 ((TARGET_REGPARM && (CUM) < 8) ? gen_rtx_REG ((MODE), (CUM) / 4) : 0)
503 /* For an arg passed partly in registers and partly in memory,
504 this is the number of registers used.
505 For args passed entirely in registers or entirely in memory, zero. */
507 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
508 ((TARGET_REGPARM && (CUM) < 8 \
509 && 8 < ((CUM) + ((MODE) == BLKmode \
510 ? int_size_in_bytes (TYPE) \
511 : GET_MODE_SIZE (MODE)))) \
512 ? 2 - (CUM) / 4 : 0)
514 #ifndef MAIN_FUNCTION_PROLOGUE
515 #define MAIN_FUNCTION_PROLOGUE
516 #endif
519 * The function prologue for the ns32k is fairly simple.
520 * If a frame pointer is needed (decided in reload.c ?) then
521 * we need assembler of the form
523 * # Save the oldframe pointer, set the new frame pointer, make space
524 * # on the stack and save any general purpose registers necessary
526 * enter [<general purpose regs to save>], <local stack space>
528 * movf fn, tos # Save any floating point registers necessary
532 * If a frame pointer is not needed we need assembler of the form
534 * # Make space on the stack
536 * adjspd <local stack space + 4>
538 * # Save any general purpose registers necessary
540 * save [<general purpose regs to save>]
542 * movf fn, tos # Save any floating point registers necessary
546 #if defined(IMMEDIATE_PREFIX) && IMMEDIATE_PREFIX
547 #define ADJSP(FILE, n) \
548 fprintf (FILE, "\tadjspd %c%d\n", IMMEDIATE_PREFIX, (n))
549 #else
550 #define ADJSP(FILE, n) \
551 fprintf (FILE, "\tadjspd %d\n", (n))
552 #endif
554 #define FUNCTION_PROLOGUE(FILE, SIZE) \
555 { register int regno, g_regs_used = 0; \
556 int used_regs_buf[8], *bufp = used_regs_buf; \
557 int used_fregs_buf[8], *fbufp = used_fregs_buf; \
558 extern char call_used_regs[]; \
559 extern int current_function_uses_pic_offset_table, flag_pic; \
560 MAIN_FUNCTION_PROLOGUE; \
561 for (regno = 0; regno < 8; regno++) \
562 if (regs_ever_live[regno] \
563 && ! call_used_regs[regno]) \
565 *bufp++ = regno; g_regs_used++; \
567 *bufp = -1; \
568 for (; regno < 16; regno++) \
569 if (regs_ever_live[regno] && !call_used_regs[regno]) \
571 *fbufp++ = regno; \
573 *fbufp = -1; \
574 bufp = used_regs_buf; \
575 if (frame_pointer_needed) \
576 fprintf (FILE, "\tenter ["); \
577 else \
579 if (SIZE) \
580 ADJSP (FILE, SIZE + 4); \
581 if (g_regs_used && g_regs_used > 4) \
582 fprintf (FILE, "\tsave ["); \
583 else \
585 while (*bufp >= 0) \
586 fprintf (FILE, "\tmovd r%d,tos\n", *bufp++); \
587 g_regs_used = 0; \
590 while (*bufp >= 0) \
592 fprintf (FILE, "r%d", *bufp++); \
593 if (*bufp >= 0) \
594 fputc (',', FILE); \
596 if (frame_pointer_needed) \
597 fprintf (FILE, "],%d\n", SIZE); \
598 else if (g_regs_used) \
599 fprintf (FILE, "]\n"); \
600 fbufp = used_fregs_buf; \
601 while (*fbufp >= 0) \
603 if ((*fbufp & 1) || (fbufp[0] != fbufp[1] - 1)) \
604 fprintf (FILE, "\tmovf f%d,tos\n", *fbufp++ - 8); \
605 else \
607 fprintf (FILE, "\tmovl f%d,tos\n", fbufp[0] - 8); \
608 fbufp += 2; \
611 if (flag_pic && current_function_uses_pic_offset_table) \
613 fprintf (FILE, "\tsprd sb,tos\n"); \
614 if (TARGET_REGPARM) \
616 fprintf (FILE, "\taddr __GLOBAL_OFFSET_TABLE_(pc),tos\n"); \
617 fprintf (FILE, "\tlprd sb,tos\n"); \
619 else \
621 fprintf (FILE, "\taddr __GLOBAL_OFFSET_TABLE_(pc),r0\n"); \
622 fprintf (FILE, "\tlprd sb,r0\n"); \
627 /* Output assembler code to FILE to increment profiler label # LABELNO
628 for profiling a function entry.
630 THIS DEFINITION FOR THE 32000 IS A GUESS. IT HAS NOT BEEN TESTED. */
632 #define FUNCTION_PROFILER(FILE, LABELNO) \
633 fprintf (FILE, "\taddr LP%d,r0\n\tbsr mcount\n", (LABELNO))
635 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
636 the stack pointer does not matter. The value is tested only in
637 functions that have frame pointers.
638 No definition is equivalent to always zero.
640 We use 0, because using 1 requires hair in FUNCTION_EPILOGUE
641 that is worse than the stack adjust we could save. */
643 /* #define EXIT_IGNORE_STACK 1 */
645 /* This macro generates the assembly code for function exit,
646 on machines that need it. If FUNCTION_EPILOGUE is not defined
647 then individual return instructions are generated for each
648 return statement. Args are same as for FUNCTION_PROLOGUE.
650 The function epilogue should not depend on the current stack pointer,
651 if EXIT_IGNORE_STACK is nonzero. That doesn't apply here.
653 If a frame pointer is needed (decided in reload.c ?) then
654 we need assembler of the form
656 movf tos, fn # Restore any saved floating point registers
660 # Restore any saved general purpose registers, restore the stack
661 # pointer from the frame pointer, restore the old frame pointer.
662 exit [<general purpose regs to save>]
664 If a frame pointer is not needed we need assembler of the form
665 # Restore any general purpose registers saved
667 movf tos, fn # Restore any saved floating point registers
671 restore [<general purpose regs to save>]
673 # reclaim space allocated on stack
675 adjspd <-(local stack space + 4)> */
678 #define FUNCTION_EPILOGUE(FILE, SIZE) \
679 { register int regno, g_regs_used = 0, f_regs_used = 0; \
680 int used_regs_buf[8], *bufp = used_regs_buf; \
681 int used_fregs_buf[8], *fbufp = used_fregs_buf; \
682 extern char call_used_regs[]; \
683 extern int current_function_uses_pic_offset_table, flag_pic; \
684 if (flag_pic && current_function_uses_pic_offset_table) \
685 fprintf (FILE, "\tlprd sb,tos\n"); \
686 *fbufp++ = -2; \
687 for (regno = 8; regno < 16; regno++) \
688 if (regs_ever_live[regno] && !call_used_regs[regno]) \
690 *fbufp++ = regno; f_regs_used++; \
692 fbufp--; \
693 for (regno = 0; regno < 8; regno++) \
694 if (regs_ever_live[regno] \
695 && ! call_used_regs[regno]) \
697 *bufp++ = regno; g_regs_used++; \
699 while (fbufp > used_fregs_buf) \
701 if ((*fbufp & 1) && fbufp[0] == fbufp[-1] + 1) \
703 fprintf (FILE, "\tmovl tos,f%d\n", fbufp[-1] - 8); \
704 fbufp -= 2; \
706 else fprintf (FILE, "\tmovf tos,f%d\n", *fbufp-- - 8); \
708 if (frame_pointer_needed) \
709 fprintf (FILE, "\texit ["); \
710 else \
712 if (g_regs_used && g_regs_used > 4) \
713 fprintf (FILE, "\trestore ["); \
714 else \
716 while (bufp > used_regs_buf) \
717 fprintf (FILE, "\tmovd tos,r%d\n", *--bufp); \
718 g_regs_used = 0; \
721 while (bufp > used_regs_buf) \
723 fprintf (FILE, "r%d", *--bufp); \
724 if (bufp > used_regs_buf) \
725 fputc (',', FILE); \
727 if (g_regs_used || frame_pointer_needed) \
728 fprintf (FILE, "]\n"); \
729 if (SIZE && !frame_pointer_needed) \
730 ADJSP (FILE, -(SIZE + 4)); \
731 if (current_function_pops_args) \
732 fprintf (FILE, "\tret %d\n", current_function_pops_args); \
733 else fprintf (FILE, "\tret 0\n"); }
735 /* Store in the variable DEPTH the initial difference between the
736 frame pointer reg contents and the stack pointer reg contents,
737 as of the start of the function body. This depends on the layout
738 of the fixed parts of the stack frame and on how registers are saved. */
740 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
742 int regno; \
743 int offset = -4; \
744 extern int current_function_uses_pic_offset_table, flag_pic; \
745 for (regno = 0; regno < 16; regno++) \
746 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
747 offset += 4; \
748 if (flag_pic && current_function_uses_pic_offset_table) \
749 offset += 4; \
750 (DEPTH) = (offset + get_frame_size () \
751 + (get_frame_size () == 0 ? 0 : 4)); \
755 /* Output assembler code for a block containing the constant parts
756 of a trampoline, leaving space for the variable parts. */
758 /* On the 32k, the trampoline looks like this:
759 addr 0(pc),r2
760 jump @__trampoline
761 .int STATIC
762 .int FUNCTION
763 Doing trampolines with a library assist function is easier than figuring
764 out how to do stores to memory in reverse byte order (the way immediate
765 operands on the 32k are stored). */
767 #define TRAMPOLINE_TEMPLATE(FILE) \
769 fprintf (FILE, "\taddr 0(pc),r2\n" ); \
770 fprintf (FILE, "\tjump " ); \
771 PUT_ABSOLUTE_PREFIX (FILE); \
772 fprintf (FILE, "__trampoline\n" ); \
773 ASM_OUTPUT_INT (FILE, const0_rtx); \
774 ASM_OUTPUT_INT (FILE, const0_rtx); \
777 /* Length in units of the trampoline for entering a nested function. */
779 #define TRAMPOLINE_SIZE 20
781 /* Emit RTL insns to initialize the variable parts of a trampoline.
782 FNADDR is an RTX for the address of the function's pure code.
783 CXT is an RTX for the static chain value for the function. */
785 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
787 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 12)), CXT); \
788 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 16)), FNADDR); \
791 /* This is the library routine that is used
792 to transfer control from the trampoline
793 to the actual nested function. */
795 /* The function name __transfer_from_trampoline is not actually used.
796 The function definition just permits use of "asm with operands"
797 (though the operand list is empty). */
798 #define TRANSFER_FROM_TRAMPOLINE \
799 void \
800 __transfer_from_trampoline () \
802 asm (".globl __trampoline"); \
803 asm ("__trampoline:"); \
804 asm ("movd 16(r2),tos"); \
805 asm ("movd 12(r2),r1"); \
806 asm ("ret 0"); \
809 /* Addressing modes, and classification of registers for them. */
811 /* #define HAVE_POST_INCREMENT */
812 /* #define HAVE_POST_DECREMENT */
814 /* #define HAVE_PRE_DECREMENT */
815 /* #define HAVE_PRE_INCREMENT */
817 /* Macros to check register numbers against specific register classes. */
819 /* These assume that REGNO is a hard or pseudo reg number.
820 They give nonzero only if REGNO is a hard reg of the suitable class
821 or a pseudo reg currently allocated to a suitable hard reg.
822 Since they use reg_renumber, they are safe only once reg_renumber
823 has been allocated, which happens in local-alloc.c. */
825 /* note that FP and SP cannot be used as an index. What about PC? */
826 #define REGNO_OK_FOR_INDEX_P(REGNO) \
827 ((REGNO) < 8 || (unsigned)reg_renumber[REGNO] < 8)
828 #define REGNO_OK_FOR_BASE_P(REGNO) \
829 ((REGNO) < 8 || (unsigned)reg_renumber[REGNO] < 8 \
830 || (REGNO) == FRAME_POINTER_REGNUM || (REGNO) == STACK_POINTER_REGNUM)
832 #define FP_REG_P(X) (GET_CODE (X) == REG && REGNO (X) > 7 && REGNO (X) < 16)
834 /* Maximum number of registers that can appear in a valid memory address. */
836 #define MAX_REGS_PER_ADDRESS 2
838 /* Recognize any constant value that is a valid address.
839 This might not work on future ns32k processors as negative
840 displacements are not officially allowed but a mode reserved
841 to National. This works on processors up to 32532, though. */
843 #define CONSTANT_ADDRESS_P(X) \
844 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
845 || GET_CODE (X) == CONST \
846 || (GET_CODE (X) == CONST_INT \
847 && ((unsigned)INTVAL (X) >= 0xe0000000 \
848 || (unsigned)INTVAL (X) < 0x20000000)))
850 #define CONSTANT_ADDRESS_NO_LABEL_P(X) \
851 (GET_CODE (X) == CONST_INT \
852 && ((unsigned)INTVAL (X) >= 0xe0000000 \
853 || (unsigned)INTVAL (X) < 0x20000000))
855 /* Return the register class of a scratch register needed to copy IN into
856 or out of a register in CLASS in MODE. If it can be done directly,
857 NO_REGS is returned. */
859 #define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
860 secondary_reload_class (CLASS, MODE, IN)
862 /* Nonzero if the constant value X is a legitimate general operand.
863 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
865 #define LEGITIMATE_CONSTANT_P(X) 1
867 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
868 and check its validity for a certain class.
869 We have two alternate definitions for each of them.
870 The usual definition accepts all pseudo regs; the other rejects
871 them unless they have been allocated suitable hard regs.
872 The symbol REG_OK_STRICT causes the latter definition to be used.
874 Most source files want to accept pseudo regs in the hope that
875 they will get allocated to the class that the insn wants them to be in.
876 Source files for reload pass need to be strict.
877 After reload, it makes no difference, since pseudo regs have
878 been eliminated by then. */
880 #ifndef REG_OK_STRICT
882 /* Nonzero if X is a hard reg that can be used as an index
883 or if it is a pseudo reg. */
884 #define REG_OK_FOR_INDEX_P(X) \
885 (REGNO (X) < 8 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
886 /* Nonzero if X is a hard reg that can be used as a base reg
887 of if it is a pseudo reg. */
888 #define REG_OK_FOR_BASE_P(X) (REGNO (X) < 8 || REGNO (X) >= FRAME_POINTER_REGNUM)
889 /* Nonzero if X is a floating point reg or a pseudo reg. */
891 #else
893 /* Nonzero if X is a hard reg that can be used as an index. */
894 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
895 /* Nonzero if X is a hard reg that can be used as a base reg. */
896 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
898 #endif
900 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
901 that is a valid memory address for an instruction.
902 The MODE argument is the machine mode for the MEM expression
903 that wants to use this address.
905 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */
907 /* 1 if X is an address that we could indirect through. */
908 /***** NOTE ***** There is a bug in the Sequent assembler which fails
909 to fixup addressing information for symbols used as offsets
910 from registers which are not FP or SP (or SB or PC). This
911 makes _x(fp) valid, while _x(r0) is invalid. */
913 #define INDIRECTABLE_1_ADDRESS_P(X) \
914 (CONSTANT_ADDRESS_P (X) \
915 || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
916 || (GET_CODE (X) == PLUS \
917 && GET_CODE (XEXP (X, 0)) == REG \
918 && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
919 && ((flag_pic || TARGET_HIMEM) ? \
920 CONSTANT_ADDRESS_NO_LABEL_P (XEXP (X, 1)) \
922 CONSTANT_ADDRESS_P (XEXP (X, 1))) \
923 && (GET_CODE (X) != CONST_INT || NS32K_DISPLACEMENT_P (INTVAL (X)))))
925 /* 1 if integer I will fit in a 4 byte displacement field.
926 Strictly speaking, we can't be sure that a symbol will fit this range.
927 But, in practice, it always will. */
929 /* idall@eleceng.adelaide.edu.au says that the 32016 and 32032
930 can handle the full range of displacements--it is only the addresses
931 that have a limited range. So the following was deleted:
932 (((i) <= 16777215 && (i) >= -16777216)
933 || ((TARGET_32532 || TARGET_32332) && ...)) */
934 #define NS32K_DISPLACEMENT_P(i) \
935 ((i) < (1 << 29) && (i) >= - (1 << 29))
937 /* Check for frame pointer or stack pointer. */
938 #define MEM_REG(X) \
939 (GET_CODE (X) == REG && (REGNO (X) ^ 16) < 2)
941 /* A memory ref whose address is the FP or SP, with optional integer offset,
942 or (on certain machines) a constant address. */
943 #define INDIRECTABLE_2_ADDRESS_P(X) \
944 (GET_CODE (X) == MEM \
945 && (((xfoo0 = XEXP (X, 0), MEM_REG (xfoo0)) \
946 || (GET_CODE (xfoo0) == PLUS \
947 && MEM_REG (XEXP (xfoo0, 0)) \
948 && CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfoo0, 1)))) \
949 || (TARGET_SB && CONSTANT_ADDRESS_P (xfoo0))))
951 /* Go to ADDR if X is a valid address not using indexing.
952 (This much is the easy part.) */
953 #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
954 { register rtx xfoob = (X); \
955 if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; \
956 if (INDIRECTABLE_2_ADDRESS_P (X)) goto ADDR; \
957 if (GET_CODE (X) == PLUS) \
958 if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (X, 1))) \
959 if (INDIRECTABLE_2_ADDRESS_P (XEXP (X, 0))) \
960 goto ADDR; \
963 /* Go to ADDR if X is a valid address not using indexing.
964 (This much is the easy part.) */
965 #define GO_IF_INDEXING(X, MODE, ADDR) \
966 { register rtx xfoob = (X); \
967 if (GET_CODE (xfoob) == PLUS && INDEX_TERM_P (XEXP (xfoob, 0), MODE)) \
968 GO_IF_INDEXABLE_ADDRESS (XEXP (xfoob, 1), ADDR); \
969 if (GET_CODE (xfoob) == PLUS && INDEX_TERM_P (XEXP (xfoob, 1), MODE)) \
970 GO_IF_INDEXABLE_ADDRESS (XEXP (xfoob, 0), ADDR); } \
972 #define GO_IF_INDEXABLE_ADDRESS(X, ADDR) \
973 { if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) goto ADDR; \
974 if (INDIRECTABLE_2_ADDRESS_P (X)) goto ADDR; \
975 if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; \
978 /* 1 if PROD is either a reg times size of mode MODE
979 or just a reg, if MODE is just one byte. Actually, on the ns32k,
980 since the index mode is independent of the operand size,
981 we can match more stuff...
983 This macro's expansion uses the temporary variables xfoo0, xfoo1
984 and xfoo2 that must be declared in the surrounding context. */
985 #define INDEX_TERM_P(PROD, MODE) \
986 ((GET_CODE (PROD) == REG && REG_OK_FOR_INDEX_P (PROD)) \
987 || (GET_CODE (PROD) == MULT \
988 && (xfoo0 = XEXP (PROD, 0), xfoo1 = XEXP (PROD, 1), \
989 (GET_CODE (xfoo1) == CONST_INT \
990 && GET_CODE (xfoo0) == REG \
991 && FITS_INDEX_RANGE (INTVAL (xfoo1)) \
992 && REG_OK_FOR_INDEX_P (xfoo0)))))
994 #define FITS_INDEX_RANGE(X) \
995 ((xfoo2 = (unsigned)(X)-1), \
996 ((xfoo2 < 4 && xfoo2 != 2) || xfoo2 == 7))
998 /* Note that xfoo0, xfoo1, xfoo2 are used in some of the submacros above. */
999 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1000 { register rtx xfooy, xfoo0, xfoo1; \
1001 unsigned xfoo2; \
1002 extern int current_function_uses_pic_offset_table, flag_pic; \
1003 xfooy = X; \
1004 if (flag_pic && ! current_function_uses_pic_offset_table \
1005 && global_symbolic_reference_mentioned_p (X, 1)) \
1006 current_function_uses_pic_offset_table = 1; \
1007 GO_IF_NONINDEXED_ADDRESS (xfooy, ADDR); \
1008 if (GET_CODE (xfooy) == PLUS) \
1010 if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfooy, 1)) \
1011 && GET_CODE (XEXP (xfooy, 0)) == PLUS) \
1012 xfooy = XEXP (xfooy, 0); \
1013 else if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfooy, 0)) \
1014 && GET_CODE (XEXP (xfooy, 1)) == PLUS) \
1015 xfooy = XEXP (xfooy, 1); \
1016 GO_IF_INDEXING (xfooy, MODE, ADDR); \
1018 else if (INDEX_TERM_P (xfooy, MODE)) \
1019 goto ADDR; \
1020 else if (GET_CODE (xfooy) == PRE_DEC) \
1021 if (REGNO (XEXP (xfooy, 0)) == STACK_POINTER_REGNUM) goto ADDR; \
1022 else abort (); \
1025 /* Try machine-dependent ways of modifying an illegitimate address
1026 to be legitimate. If we find one, return the new, valid address.
1027 This macro is used in only one place: `memory_address' in explow.c.
1029 OLDX is the address as it was before break_out_memory_refs was called.
1030 In some cases it is useful to look at this to decide what needs to be done.
1032 MODE and WIN are passed so that this macro can use
1033 GO_IF_LEGITIMATE_ADDRESS.
1035 It is always safe for this macro to do nothing. It exists to recognize
1036 opportunities to optimize the output.
1038 For the ns32k, we do nothing */
1040 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
1042 /* Nonzero if the constant value X is a legitimate general operand
1043 when generating PIC code. It is given that flag_pic is on and
1044 that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1046 extern int current_function_uses_pic_offset_table, flag_pic;
1047 #define LEGITIMATE_PIC_OPERAND_P(X) \
1048 (((! current_function_uses_pic_offset_table \
1049 && global_symbolic_reference_mentioned_p (X, 1))? \
1050 (current_function_uses_pic_offset_table = 1):0 \
1051 ), 1)
1053 /* Define this macro if references to a symbol must be treated
1054 differently depending on something about the variable or
1055 function named by the symbol (such as what section it is in).
1057 On the ns32k, if using PIC, mark a SYMBOL_REF for a non-global
1058 symbol or a code symbol. These symbols are referenced via pc
1059 and not via sb. */
1061 #define ENCODE_SECTION_INFO(DECL) \
1062 do \
1064 extern int flag_pic; \
1065 if (flag_pic) \
1067 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
1068 ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
1069 SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
1070 = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
1071 || ! TREE_PUBLIC (DECL)); \
1074 while (0)
1076 /* Go to LABEL if ADDR (a legitimate address expression)
1077 has an effect that depends on the machine mode it is used for.
1078 On the ns32k, only predecrement and postincrement address depend thus
1079 (the amount of decrement or increment being the length of the operand). */
1081 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1082 { if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \
1083 goto LABEL;}
1085 /* Specify the machine mode that this machine uses
1086 for the index in the tablejump instruction.
1087 HI mode is more efficient but the range is not wide enough for
1088 all programs. */
1089 #define CASE_VECTOR_MODE SImode
1091 /* Define this if the tablejump instruction expects the table
1092 to contain offsets from the address of the table.
1093 Do not define this if the table should contain absolute addresses. */
1094 #define CASE_VECTOR_PC_RELATIVE
1096 /* Specify the tree operation to be used to convert reals to integers. */
1097 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1099 /* This is the kind of divide that is easiest to do in the general case. */
1100 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1102 /* Define this as 1 if `char' should by default be signed; else as 0. */
1103 #define DEFAULT_SIGNED_CHAR 1
1105 /* Max number of bytes we can move from memory to memory
1106 in one reasonably fast instruction. */
1107 #define MOVE_MAX 4
1109 /* Define this if zero-extension is slow (more than one real instruction). */
1110 /* #define SLOW_ZERO_EXTEND */
1112 /* Nonzero if access to memory by bytes is slow and undesirable. */
1113 #define SLOW_BYTE_ACCESS 0
1115 /* Define if shifts truncate the shift count
1116 which implies one can omit a sign-extension or zero-extension
1117 of a shift count. */
1118 /* #define SHIFT_COUNT_TRUNCATED */
1120 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1121 is done just by pretending it is already truncated. */
1122 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1124 /* We assume that the store-condition-codes instructions store 0 for false
1125 and some other value for true. This is the value stored for true. */
1127 #define STORE_FLAG_VALUE 1
1129 /* Specify the machine mode that pointers have.
1130 After generation of rtl, the compiler makes no further distinction
1131 between pointers and any other objects of this machine mode. */
1132 #define Pmode SImode
1134 /* A function address in a call instruction
1135 is a byte address (for indexing purposes)
1136 so give the MEM rtx a byte's mode. */
1137 #define FUNCTION_MODE QImode
1139 /* Compute the cost of address ADDRESS. */
1141 #define ADDRESS_COST(RTX) calc_address_cost (RTX)
1143 /* Compute the cost of computing a constant rtl expression RTX
1144 whose rtx-code is CODE. The body of this macro is a portion
1145 of a switch statement. If the code is computed here,
1146 return it with a return statement. Otherwise, break from the switch. */
1148 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1149 case CONST_INT: \
1150 if (INTVAL (RTX) <= 7 && INTVAL (RTX) >= -8) return 0; \
1151 if (INTVAL (RTX) < 0x2000 && INTVAL (RTX) >= -0x2000) \
1152 return 1; \
1153 case CONST: \
1154 case LABEL_REF: \
1155 case SYMBOL_REF: \
1156 return 3; \
1157 case CONST_DOUBLE: \
1158 return 5;
1160 /* Tell final.c how to eliminate redundant test instructions. */
1162 /* Here we define machine-dependent flags and fields in cc_status
1163 (see `conditions.h'). */
1165 /* This bit means that what ought to be in the Z bit
1166 should be tested in the F bit. */
1167 #define CC_Z_IN_F 04000
1169 /* This bit means that what ought to be in the Z bit
1170 is complemented in the F bit. */
1171 #define CC_Z_IN_NOT_F 010000
1173 /* Store in cc_status the expressions
1174 that the condition codes will describe
1175 after execution of an instruction whose pattern is EXP.
1176 Do not alter them if the instruction would not alter the cc's. */
1178 #define NOTICE_UPDATE_CC(EXP, INSN) \
1179 { if (GET_CODE (EXP) == SET) \
1180 { if (GET_CODE (SET_DEST (EXP)) == CC0) \
1181 { cc_status.flags = 0; \
1182 cc_status.value1 = SET_DEST (EXP); \
1183 cc_status.value2 = SET_SRC (EXP); \
1185 else if (GET_CODE (SET_SRC (EXP)) == CALL) \
1186 { CC_STATUS_INIT; } \
1187 else if (GET_CODE (SET_DEST (EXP)) == REG) \
1188 { if (cc_status.value1 \
1189 && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value1)) \
1190 cc_status.value1 = 0; \
1191 if (cc_status.value2 \
1192 && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value2)) \
1193 cc_status.value2 = 0; \
1195 else if (GET_CODE (SET_DEST (EXP)) == MEM) \
1196 { CC_STATUS_INIT; } \
1198 else if (GET_CODE (EXP) == PARALLEL \
1199 && GET_CODE (XVECEXP (EXP, 0, 0)) == SET) \
1200 { if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == CC0) \
1201 { cc_status.flags = 0; \
1202 cc_status.value1 = SET_DEST (XVECEXP (EXP, 0, 0)); \
1203 cc_status.value2 = SET_SRC (XVECEXP (EXP, 0, 0)); \
1205 else if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == REG) \
1206 { if (cc_status.value1 \
1207 && reg_overlap_mentioned_p (SET_DEST (XVECEXP (EXP, 0, 0)), cc_status.value1)) \
1208 cc_status.value1 = 0; \
1209 if (cc_status.value2 \
1210 && reg_overlap_mentioned_p (SET_DEST (XVECEXP (EXP, 0, 0)), cc_status.value2)) \
1211 cc_status.value2 = 0; \
1213 else if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == MEM) \
1214 { CC_STATUS_INIT; } \
1216 else if (GET_CODE (EXP) == CALL) \
1217 { /* all bets are off */ CC_STATUS_INIT; } \
1218 else { /* nothing happens? CC_STATUS_INIT; */} \
1219 if (cc_status.value1 && GET_CODE (cc_status.value1) == REG \
1220 && cc_status.value2 \
1221 && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2)) \
1222 abort (); \
1225 /* Describe the costs of the following register moves which are discouraged:
1226 1.) Moves between the Floating point registers and the frame pointer and stack pointer
1227 2.) Moves between the stack pointer and the frame pointer
1228 3.) Moves between the floating point and general registers */
1230 #define REGISTER_MOVE_COST(CLASS1, CLASS2) \
1231 ((((CLASS1) == FLOAT_REGS && ((CLASS2) == STACK_POINTER_REG || (CLASS2) == FRAME_POINTER_REG)) \
1232 || ((CLASS2) == FLOAT_REGS && ((CLASS1) == STACK_POINTER_REG || (CLASS1) == FRAME_POINTER_REG)) \
1233 || ((CLASS1) == STACK_POINTER_REG && (CLASS2) == FRAME_POINTER_REG) \
1234 || ((CLASS2) == STACK_POINTER_REG && (CLASS1) == FRAME_POINTER_REG) \
1235 || ((CLASS1) == FLOAT_REGS && (CLASS2) == GENERAL_REGS) \
1236 || ((CLASS1) == GENERAL_REGS && (CLASS2) == FLOAT_REGS)) \
1237 ? 4 : 2)
1239 #define OUTPUT_JUMP(NORMAL, NO_OV) \
1240 { if (cc_status.flags & CC_NO_OVERFLOW) \
1241 return NO_OV; \
1242 return NORMAL; }
1244 /* Dividing the output into sections */
1246 /* Output before read-only data. */
1248 #define TEXT_SECTION_ASM_OP ".text"
1250 /* Output before writable data. */
1252 #define DATA_SECTION_ASM_OP ".data"
1254 /* Define the output Assembly Language */
1256 /* Output at beginning of assembler file. */
1258 #define ASM_FILE_START(FILE) fprintf (FILE, "#NO_APP\n");
1260 /* Output to assembler file text saying following lines
1261 may contain character constants, extra white space, comments, etc. */
1263 #define ASM_APP_ON "#APP\n"
1265 /* Output to assembler file text saying following lines
1266 no longer contain unusual constructs. */
1268 #define ASM_APP_OFF "#NO_APP\n"
1270 /* Output of Data */
1272 /* This is how to output an assembler line defining a `double' constant. */
1274 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
1275 fprintf (FILE, "\t.double 0d%.20e\n", (VALUE))
1277 /* This is how to output an assembler line defining a `float' constant. */
1279 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
1280 fprintf (FILE, "\t.float 0f%.20e\n", (VALUE))
1282 /* This is how to output an assembler line defining an `int' constant. */
1284 #define ASM_OUTPUT_INT(FILE,VALUE) \
1285 ( fprintf (FILE, "\t.long "), \
1286 output_addr_const (FILE, (VALUE)), \
1287 fprintf (FILE, "\n"))
1289 /* Likewise for `char' and `short' constants. */
1291 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
1292 ( fprintf (FILE, "\t.word "), \
1293 output_addr_const (FILE, (VALUE)), \
1294 fprintf (FILE, "\n"))
1296 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
1297 ( fprintf (FILE, "\t.byte "), \
1298 output_addr_const (FILE, (VALUE)), \
1299 fprintf (FILE, "\n"))
1301 /* This is how to output an assembler line for a numeric constant byte. */
1303 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
1304 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1306 /* This is how to output an assembler line defining an external/static
1307 address which is not in tree format (for collect.c). */
1309 #define ASM_OUTPUT_LABELREF_AS_INT(STREAM, NAME) \
1310 do { \
1311 fprintf (STREAM, "\t.long\t"); \
1312 ASM_OUTPUT_LABELREF (STREAM, NAME); \
1313 fprintf (STREAM, "\n"); \
1314 } while (0)
1316 /* This is how to output an insn to push a register on the stack.
1317 It need not be very fast code. */
1319 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1320 fprintf (FILE, "\tmovd %s,tos\n", reg_names[REGNO])
1322 /* This is how to output an insn to pop a register from the stack.
1323 It need not be very fast code. */
1325 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1326 fprintf (FILE, "\tmovd tos,%s\n", reg_names[REGNO])
1328 /* How to refer to registers in assembler output.
1329 This sequence is indexed by compiler's hard-register-number (see above). */
1331 #define REGISTER_NAMES \
1332 {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
1333 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
1334 "fp", "sp"}
1336 /* How to renumber registers for dbx and gdb.
1337 NS32000 may need more change in the numeration. */
1339 #define DBX_REGISTER_NUMBER(REGNO) ((REGNO < 8) ? (REGNO)+4 : (REGNO))
1341 /* This is how to output the definition of a user-level label named NAME,
1342 such as the label on a static function or variable NAME. */
1344 #ifndef COLLECT
1345 #define ASM_OUTPUT_LABEL(FILE,NAME) \
1346 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1347 #else
1348 #define ASM_OUTPUT_LABEL(STREAM,NAME) \
1349 do { \
1350 fprintf (STREAM, "%s:\n", NAME); \
1351 } while (0)
1352 #endif
1354 /* This is how to output a command to make the user-level label named NAME
1355 defined for reference from other files. */
1357 #ifndef COLLECT
1358 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
1359 do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
1360 #else
1361 #define ASM_GLOBALIZE_LABEL(STREAM,NAME) \
1362 do { \
1363 fprintf (STREAM, "\t.globl\t%s\n", NAME); \
1364 } while (0)
1365 #endif
1367 /* The prefix to add to user-visible assembler symbols. */
1369 #define USER_LABEL_PREFIX "_"
1371 /* This is how to output an internal numbered label where
1372 PREFIX is the class of label and NUM is the number within the class. */
1374 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1375 fprintf (FILE, "%s%d:\n", PREFIX, NUM)
1377 /* This is how to store into the string LABEL
1378 the symbol_ref name of an internal numbered label where
1379 PREFIX is the class of label and NUM is the number within the class.
1380 This is suitable for output with `assemble_name'. */
1382 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1383 sprintf (LABEL, "*%s%d", PREFIX, NUM)
1385 /* This is how to align the code that follows an unconditional branch.
1386 Note that 0xa2 is a no-op. */
1388 #define ASM_OUTPUT_ALIGN_CODE(FILE) \
1389 fprintf (FILE, "\t.align 2,0xa2\n")
1391 /* This is how to output an element of a case-vector that is absolute.
1392 (The ns32k does not use such vectors,
1393 but we must define this macro anyway.) */
1395 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1396 fprintf (FILE, "\t.long L%d\n", VALUE)
1398 /* This is how to output an element of a case-vector that is relative. */
1399 /* ** Notice that the second element is LI format! */
1400 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
1401 fprintf (FILE, "\t.long L%d-LI%d\n", VALUE, REL)
1403 /* This is how to output an assembler line
1404 that says to advance the location counter
1405 to a multiple of 2**LOG bytes. */
1407 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1408 fprintf (FILE, "\t.align %d\n", (LOG))
1410 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1411 fprintf (FILE, "\t.space %u\n", (SIZE))
1413 /* This says how to output an assembler line
1414 to define a global common symbol. */
1416 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1417 ( fputs (".comm ", (FILE)), \
1418 assemble_name ((FILE), (NAME)), \
1419 fprintf ((FILE), ",%u\n", (ROUNDED)))
1421 /* This says how to output an assembler line
1422 to define a local common symbol. */
1424 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
1425 ( fputs (".lcomm ", (FILE)), \
1426 assemble_name ((FILE), (NAME)), \
1427 fprintf ((FILE), ",%u\n", (ROUNDED)))
1429 /* Store in OUTPUT a string (made with alloca) containing
1430 an assembler-name for a local static variable named NAME.
1431 LABELNO is an integer which is different for each call. */
1433 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1434 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1435 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1437 /* Define the parentheses used to group arithmetic operations
1438 in assembler code. */
1440 #define ASM_OPEN_PAREN "("
1441 #define ASM_CLOSE_PAREN ")"
1443 /* Define results of standard character escape sequences. */
1444 #define TARGET_BELL 007
1445 #define TARGET_BS 010
1446 #define TARGET_TAB 011
1447 #define TARGET_NEWLINE 012
1448 #define TARGET_VT 013
1449 #define TARGET_FF 014
1450 #define TARGET_CR 015
1452 /* Print an instruction operand X on file FILE.
1453 CODE is the code from the %-spec that requested printing this operand;
1454 if `%z3' was used to print operand 3, then CODE is 'z'. */
1456 /* %$ means print the prefix for an immediate operand. */
1458 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1459 ((CODE) == '$' || (CODE) == '?')
1461 #define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE, X, CODE)
1463 /* Print a memory operand whose address is X, on file FILE. */
1465 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address(FILE, ADDR)
1467 /* Define functions in ns32k.c and used in insn-output.c. */
1469 extern char *output_move_double ();
1470 extern char *output_shift_insn ();
1471 extern char *output_move_dconst ();
1474 Local variables:
1475 version-control: t
1476 End: