Added arg to RETURN_POPS_ARGS.
[official-gcc.git] / gcc / config / i860 / i860.h
blob0682cf9720b2187d3d9768d02c5bb0d95100a0fb
1 /* Definitions of target machine for GNU compiler, for Intel 860.
2 Copyright (C) 1989, 1991, 1993, 1995 Free Software Foundation, Inc.
3 Hacked substantially by Ron Guilmette (rfg@segfault.us.com) to cater to
4 the whims of the System V Release 4 assembler.
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, 675 Mass Ave, Cambridge, MA 02139, 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. */
27 /* Names to predefine in the preprocessor for this target machine. */
29 #define CPP_PREDEFINES "-Di860 -Dunix -Asystem(unix) -Asystem(svr4) -Acpu(i860) -Amachine(i860)"
31 /* Print subsidiary information on the compiler version in use. */
32 #define TARGET_VERSION fprintf (stderr, " (i860)");
34 /* Run-time compilation parameters selecting different hardware subsets
35 or supersets.
37 On the i860, we have one: TARGET_XP. This option allows gcc to generate
38 additional instructions available only on the newer i860 XP (but not on
39 the older i860 XR).
42 extern int target_flags;
44 /* Nonzero if we should generate code to use the fpu. */
45 #define TARGET_XP (target_flags & 1)
47 /* Macro to define tables used to set the flags.
48 This is a list in braces of pairs in braces,
49 each pair being { "NAME", VALUE }
50 where VALUE is the bits to set or minus the bits to clear.
51 An empty string NAME is used to identify the default VALUE. */
53 #define TARGET_SWITCHES \
54 { {"xp", 1}, \
55 {"noxp", -1}, \
56 {"xr", -1}, \
57 { "", TARGET_DEFAULT}}
59 #define TARGET_DEFAULT 0
61 /* target machine storage layout */
63 /* Define this if most significant bit is lowest numbered
64 in instructions that operate on numbered bit-fields.
65 This is a moot question on the i860 due to the lack of bit-field insns. */
66 #define BITS_BIG_ENDIAN 0
68 /* Define this if most significant byte of a word is the lowest numbered. */
69 /* That is not true on i860 in the mode we will use. */
70 #define BYTES_BIG_ENDIAN 0
72 /* Define this if most significant word of a multiword number is the lowest
73 numbered. */
74 /* For the i860 this goes with BYTES_BIG_ENDIAN. */
75 /* NOTE: GCC probably cannot support a big-endian i860
76 because GCC fundamentally assumes that the order of words
77 in memory as the same as the order in registers.
78 That's not true for the big-endian i860.
79 The big-endian i860 isn't important enough to
80 justify the trouble of changing this assumption. */
81 #define WORDS_BIG_ENDIAN 0
83 /* number of bits in an addressable storage unit */
84 #define BITS_PER_UNIT 8
86 /* Width in bits of a "word", which is the contents of a machine register.
87 Note that this is not necessarily the width of data type `int';
88 if using 16-bit ints on a 68000, this would still be 32.
89 But on a machine with 16-bit registers, this would be 16. */
90 #define BITS_PER_WORD 32
92 /* Width of a word, in units (bytes). */
93 #define UNITS_PER_WORD 4
95 /* Width in bits of a pointer.
96 See also the macro `Pmode' defined below. */
97 #define POINTER_SIZE 32
99 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
100 #define PARM_BOUNDARY 32
102 /* Boundary (in *bits*) on which stack pointer should be aligned. */
103 #define STACK_BOUNDARY 128
105 /* Allocation boundary (in *bits*) for the code of a function. */
106 #define FUNCTION_BOUNDARY 64
108 /* Alignment of field after `int : 0' in a structure. */
109 #define EMPTY_FIELD_BOUNDARY 32
111 /* Every structure's size must be a multiple of this. */
112 #define STRUCTURE_SIZE_BOUNDARY 8
114 /* Minimum size in bits of the largest boundary to which any
115 and all fundamental data types supported by the hardware
116 might need to be aligned. No data type wants to be aligned
117 rounder than this. The i860 supports 128-bit (long double)
118 floating point quantities, and the System V Release 4 i860
119 ABI requires these to be aligned to 16-byte (128-bit)
120 boundaries. */
121 #define BIGGEST_ALIGNMENT 128
123 /* Set this nonzero if move instructions will actually fail to work
124 when given unaligned data. */
125 #define STRICT_ALIGNMENT 1
127 /* If bit field type is int, dont let it cross an int,
128 and give entire struct the alignment of an int. */
129 #define PCC_BITFIELD_TYPE_MATTERS 1
131 /* Standard register usage. */
133 /* Number of actual hardware registers.
134 The hardware registers are assigned numbers for the compiler
135 from 0 to just below FIRST_PSEUDO_REGISTER.
136 All registers that the compiler knows about must be given numbers,
137 even those that are not normally considered general registers.
139 i860 has 32 fullword registers and 32 floating point registers. */
141 #define FIRST_PSEUDO_REGISTER 64
143 /* 1 for registers that have pervasive standard uses
144 and are not available for the register allocator.
145 On the i860, this includes the always-0 registers
146 and fp, sp, arg pointer, and the return address.
147 Also r31, used for special purposes for constant addresses. */
148 #define FIXED_REGISTERS \
149 {1, 1, 1, 1, 0, 0, 0, 0, \
150 0, 0, 0, 0, 0, 0, 0, 0, \
151 0, 0, 0, 0, 0, 0, 0, 0, \
152 0, 0, 0, 0, 0, 0, 0, 1, \
153 1, 1, 0, 0, 0, 0, 0, 0, \
154 0, 0, 0, 0, 0, 0, 0, 0, \
155 0, 0, 0, 0, 0, 0, 0, 0, \
156 0, 0, 0, 0, 0, 0, 0, 0}
158 /* 1 for registers not available across function calls.
159 These must include the FIXED_REGISTERS and also any
160 registers that can be used without being saved.
161 On the i860, these are r0-r3, r16-r31, f0, f1, and f16-f31. */
162 #define CALL_USED_REGISTERS \
163 {1, 1, 1, 1, 0, 0, 0, 0, \
164 0, 0, 0, 0, 0, 0, 0, 0, \
165 1, 1, 1, 1, 1, 1, 1, 1, \
166 1, 1, 1, 1, 1, 1, 1, 1, \
167 1, 1, 0, 0, 0, 0, 0, 0, \
168 1, 1, 1, 1, 1, 1, 1, 1, \
169 1, 1, 1, 1, 1, 1, 1, 1, \
170 1, 1, 1, 1, 1, 1, 1, 1}
172 /* Try to get a non-preserved register before trying to get one we will
173 have to preserve. Try to get an FP register only *after* trying to
174 get a general register, because it is relatively expensive to move
175 into or out of an FP register. */
177 #define REG_ALLOC_ORDER \
178 {31, 30, 29, 28, 27, 26, 25, 24, \
179 23, 22, 21, 20, 19, 18, 17, 16, \
180 15, 14, 13, 12, 11, 10, 9, 8, \
181 7, 6, 5, 4, 3, 2, 1, 0, \
182 63, 62, 61, 60, 59, 58, 57, 56, \
183 55, 54, 53, 52, 51, 50, 49, 48, \
184 47, 46, 45, 44, 43, 42, 41, 40, \
185 39, 38, 37, 36, 35, 34, 33, 32}
187 /* Return number of consecutive hard regs needed starting at reg REGNO
188 to hold something of mode MODE.
189 This is ordinarily the length in words of a value of mode MODE
190 but can be less for certain modes in special long registers.
192 On the i860, all registers hold 32 bits worth. */
193 #define HARD_REGNO_NREGS(REGNO, MODE) \
194 (((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
196 #define REGNO_MODE_ALIGNED(REGNO, MODE) \
197 (((REGNO) % ((GET_MODE_UNIT_SIZE (MODE) + 3) / 4)) == 0)
199 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
201 On the i860, we allow anything to go into any registers, but we require
202 any sort of value going into the FP registers to be properly aligned
203 (based on its size) within the FP register set.
205 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
206 (((REGNO) < 32) \
207 || (MODE) == VOIDmode || (MODE) == BLKmode \
208 || REGNO_MODE_ALIGNED (REGNO, MODE))
210 /* Value is 1 if it is a good idea to tie two pseudo registers
211 when one has mode MODE1 and one has mode MODE2.
212 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
213 for any hard reg, then this must be 0 for correct output. */
214 /* I think that is not always true; alignment restrictions for doubles
215 should not prevent tying them with singles. So try allowing that.
216 On the other hand, don't let fixed and floating be tied;
217 this restriction is not necessary, but may make better code. */
218 #define MODES_TIEABLE_P(MODE1, MODE2) \
219 ((GET_MODE_CLASS (MODE1) == MODE_FLOAT \
220 || GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \
221 == (GET_MODE_CLASS (MODE2) == MODE_FLOAT \
222 || GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT))
224 /* Specify the registers used for certain standard purposes.
225 The values of these macros are register numbers. */
227 /* i860 pc isn't overloaded on a register that the compiler knows about. */
228 /* #define PC_REGNUM */
230 /* Register to use for pushing function arguments. */
231 #define STACK_POINTER_REGNUM 2
233 /* Base register for access to local variables of the function. */
234 #define FRAME_POINTER_REGNUM 3
236 /* Value should be nonzero if functions must have frame pointers.
237 Zero means the frame pointer need not be set up (and parms
238 may be accessed via the stack pointer) in functions that seem suitable.
239 This is computed in `reload', in reload1.c. */
240 #define FRAME_POINTER_REQUIRED 1
242 /* Base register for access to arguments of the function. */
243 #define ARG_POINTER_REGNUM 28
245 /* Register in which static-chain is passed to a function. */
246 #define STATIC_CHAIN_REGNUM 29
248 /* Register in which address to store a structure value
249 is passed to a function. */
250 #define STRUCT_VALUE_REGNUM 16
252 /* Register to use when a source of a floating-point zero is needed. */
253 #define F0_REGNUM 32
255 /* Define the classes of registers for register constraints in the
256 machine description. Also define ranges of constants.
258 One of the classes must always be named ALL_REGS and include all hard regs.
259 If there is more than one class, another class must be named NO_REGS
260 and contain no registers.
262 The name GENERAL_REGS must be the name of a class (or an alias for
263 another name such as ALL_REGS). This is the class of registers
264 that is allowed by "g" or "r" in a register constraint.
265 Also, registers outside this class are allocated only when
266 instructions express preferences for them.
268 The classes must be numbered in nondecreasing order; that is,
269 a larger-numbered class must never be contained completely
270 in a smaller-numbered class.
272 For any two classes, it is very desirable that there be another
273 class that represents their union. */
275 /* The i860 has two kinds of registers, hence four classes. */
277 enum reg_class { NO_REGS, GENERAL_REGS, FP_REGS, ALL_REGS, LIM_REG_CLASSES };
279 #define N_REG_CLASSES (int) LIM_REG_CLASSES
281 /* Give names of register classes as strings for dump file. */
283 #define REG_CLASS_NAMES \
284 {"NO_REGS", "GENERAL_REGS", "FP_REGS", "ALL_REGS" }
286 /* Define which registers fit in which classes.
287 This is an initializer for a vector of HARD_REG_SET
288 of length N_REG_CLASSES. */
290 #define REG_CLASS_CONTENTS \
291 {{0, 0}, {0xffffffff, 0}, \
292 {0, 0xffffffff}, {0xffffffff, 0xffffffff}}
294 /* The same information, inverted:
295 Return the class number of the smallest class containing
296 reg number REGNO. This could be a conditional expression
297 or could index an array. */
299 #define REGNO_REG_CLASS(REGNO) \
300 ((REGNO) >= 32 ? FP_REGS : GENERAL_REGS)
302 /* The class value for index registers, and the one for base regs. */
303 #define INDEX_REG_CLASS GENERAL_REGS
304 #define BASE_REG_CLASS GENERAL_REGS
306 /* Get reg_class from a letter such as appears in the machine description. */
308 #define REG_CLASS_FROM_LETTER(C) \
309 ((C) == 'f' ? FP_REGS : NO_REGS)
311 /* The letters I, J, K, L and M in a register constraint string
312 can be used to stand for particular ranges of immediate operands.
313 This macro defines what the ranges are.
314 C is the letter, and VALUE is a constant value.
315 Return 1 if VALUE is in the range specified by C.
317 For the i860, `I' is used for the range of constants
318 an add/subtract insn can actually contain.
319 But not including -0x8000, since we need
320 to negate the constant sometimes.
321 `J' is used for the range which is just zero (since that is R0).
322 `K' is used for the range allowed in bte.
323 `L' is used for the range allowed in logical insns. */
325 #define SMALL_INT(X) ((unsigned) (INTVAL (X) + 0x7fff) < 0xffff)
327 #define LOGIC_INT(X) ((unsigned) INTVAL (X) < 0x10000)
329 #define SMALL_INTVAL(X) ((unsigned) ((X) + 0x7fff) < 0xffff)
331 #define LOGIC_INTVAL(X) ((unsigned) (X) < 0x10000)
333 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
334 ((C) == 'I' ? ((unsigned) (VALUE) + 0x7fff) < 0xffff \
335 : (C) == 'J' ? (VALUE) == 0 \
336 : (C) == 'K' ? (unsigned) (VALUE) < 0x20 \
337 : (C) == 'L' ? (unsigned) (VALUE) < 0x10000 \
338 : 0)
340 /* Return non-zero if the given VALUE is acceptable for the
341 constraint letter C. For the i860, constraint letter 'G'
342 permits only a floating-point zero value. */
343 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
344 ((C) == 'G' && CONST_DOUBLE_LOW ((VALUE)) == 0 \
345 && CONST_DOUBLE_HIGH ((VALUE)) == 0)
347 /* Given an rtx X being reloaded into a reg required to be
348 in class CLASS, return the class of reg to actually use.
349 In general this is just CLASS; but on some machines
350 in some cases it is preferable to use a more restrictive class.
352 If we are trying to put an integer constant into some register, prefer an
353 integer register to an FP register. If we are trying to put a
354 non-zero floating-point constant into some register, use an integer
355 register if the constant is SFmode and GENERAL_REGS is one of our options.
356 Otherwise, put the constant into memory.
358 When reloading something smaller than a word, use a general reg
359 rather than an FP reg. */
361 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
362 ((CLASS) == ALL_REGS && GET_CODE (X) == CONST_INT ? GENERAL_REGS \
363 : ((GET_MODE (X) == HImode || GET_MODE (X) == QImode) \
364 && (CLASS) == ALL_REGS) \
365 ? GENERAL_REGS \
366 : (GET_CODE (X) == CONST_DOUBLE \
367 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
368 && ! CONST_DOUBLE_OK_FOR_LETTER_P (X, 'G')) \
369 ? ((CLASS) == ALL_REGS && GET_MODE (X) == SFmode ? GENERAL_REGS \
370 : (CLASS) == GENERAL_REGS && GET_MODE (X) == SFmode ? (CLASS) \
371 : NO_REGS) \
372 : (CLASS))
374 /* Return the register class of a scratch register needed to copy IN into
375 a register in CLASS in MODE. If it can be done directly, NO_REGS is
376 returned. */
378 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS,MODE,IN) \
379 ((CLASS) == FP_REGS && CONSTANT_P (IN) ? GENERAL_REGS : NO_REGS)
381 /* Return the maximum number of consecutive registers
382 needed to represent mode MODE in a register of class CLASS. */
383 /* On the i860, this is the size of MODE in words. */
384 #define CLASS_MAX_NREGS(CLASS, MODE) \
385 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
387 /* Stack layout; function entry, exit and calling. */
389 /* Define this if pushing a word on the stack
390 makes the stack pointer a smaller address. */
391 #define STACK_GROWS_DOWNWARD
393 /* Define this if the nominal address of the stack frame
394 is at the high-address end of the local variables;
395 that is, each additional local variable allocated
396 goes at a more negative offset in the frame. */
397 #define FRAME_GROWS_DOWNWARD
399 /* Offset within stack frame to start allocating local variables at.
400 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
401 first local allocated. Otherwise, it is the offset to the BEGINNING
402 of the first local allocated. */
403 #define STARTING_FRAME_OFFSET 0
405 /* If we generate an insn to push BYTES bytes,
406 this says how many the stack pointer really advances by.
407 On the i860, don't define this because there are no push insns. */
408 /* #define PUSH_ROUNDING(BYTES) */
410 /* Offset of first parameter from the argument pointer register value. */
411 #define FIRST_PARM_OFFSET(FNDECL) 0
413 /* Value is the number of bytes of arguments automatically
414 popped when returning from a subroutine call.
415 FUNDECL is the declaration node of the function (as a tree),
416 FUNTYPE is the data type of the function (as a tree),
417 or for a library call it is an identifier node for the subroutine name.
418 SIZE is the number of bytes of arguments passed on the stack. */
420 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
422 /* Define how to find the value returned by a function.
423 VALTYPE is the data type of the value (as a tree).
424 If the precise function being called is known, FUNC is its FUNCTION_DECL;
425 otherwise, FUNC is 0. */
427 /* On the i860, the value register depends on the mode. */
429 #define FUNCTION_VALUE(VALTYPE, FUNC) \
430 gen_rtx (REG, TYPE_MODE (VALTYPE), \
431 (GET_MODE_CLASS (TYPE_MODE (VALTYPE)) == MODE_FLOAT \
432 ? 40 : 16))
434 /* Define how to find the value returned by a library function
435 assuming the value has mode MODE. */
437 #define LIBCALL_VALUE(MODE) \
438 gen_rtx (REG, MODE, \
439 (GET_MODE_CLASS ((MODE)) == MODE_FLOAT \
440 ? 40 : 16))
442 /* 1 if N is a possible register number for a function value
443 as seen by the caller. */
445 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 40 || (N) == 16)
447 /* 1 if N is a possible register number for function argument passing.
448 On the i860, these are r16-r27 and f8-f15. */
450 #define FUNCTION_ARG_REGNO_P(N) \
451 (((N) < 28 && (N) > 15) || ((N) < 48 && (N) >= 40))
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 i860, we must count separately the number of general registers used
460 and the number of float registers used. */
462 struct cumulative_args { int ints, floats; };
463 #define CUMULATIVE_ARGS struct cumulative_args
465 /* Initialize a variable CUM of type CUMULATIVE_ARGS
466 for a call to a function whose data type is FNTYPE.
467 For a library call, FNTYPE is 0.
469 On the i860, the general-reg offset normally starts at 0,
470 but starts at 4 bytes
471 when the function gets a structure-value-address as an
472 invisible first argument. */
474 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) \
475 ((CUM).ints = ((FNTYPE) != 0 && aggregate_value_p (TREE_TYPE ((FNTYPE))) \
476 ? 4 : 0), \
477 (CUM).floats = 0)
479 /* Machine-specific subroutines of the following macros. */
480 #define CEILING(X,Y) (((X) + (Y) - 1) / (Y))
481 #define ROUNDUP(X,Y) (CEILING ((X), (Y)) * (Y))
483 /* Update the data in CUM to advance over an argument
484 of mode MODE and data type TYPE.
485 (TYPE is null for libcalls where that information may not be available.)
486 Floats, and doubleword ints, are returned in f regs;
487 other ints, in r regs.
488 Aggregates, even short ones, are passed in memory. */
490 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
491 ((TYPE) != 0 && (TREE_CODE ((TYPE)) == RECORD_TYPE \
492 || TREE_CODE ((TYPE)) == UNION_TYPE) \
493 ? 0 \
494 : GET_MODE_CLASS ((MODE)) == MODE_FLOAT || (MODE) == DImode \
495 ? ((CUM).floats = (ROUNDUP ((CUM).floats, GET_MODE_SIZE ((MODE))) \
496 + ROUNDUP (GET_MODE_SIZE (MODE), 4))) \
497 : GET_MODE_CLASS ((MODE)) == MODE_INT \
498 ? ((CUM).ints = (ROUNDUP ((CUM).ints, GET_MODE_SIZE ((MODE))) \
499 + ROUNDUP (GET_MODE_SIZE (MODE), 4))) \
500 : 0)
502 /* Determine where to put an argument to a function.
503 Value is zero to push the argument on the stack,
504 or a hard register in which to store the argument.
506 MODE is the argument's machine mode.
507 TYPE is the data type of the argument (as a tree).
508 This is null for libcalls where that information may
509 not be available.
510 CUM is a variable of type CUMULATIVE_ARGS which gives info about
511 the preceding args and about the function being called.
512 NAMED is nonzero if this argument is a named parameter
513 (otherwise it is an extra parameter matching an ellipsis). */
515 /* On the i860, the first 12 words of integer arguments go in r16-r27,
516 and the first 8 words of floating arguments go in f8-f15.
517 DImode values are treated as floats. */
519 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
520 ((TYPE) != 0 && (TREE_CODE ((TYPE)) == RECORD_TYPE \
521 || TREE_CODE ((TYPE)) == UNION_TYPE) \
522 ? 0 \
523 : GET_MODE_CLASS ((MODE)) == MODE_FLOAT || (MODE) == DImode \
524 ? (ROUNDUP ((CUM).floats, GET_MODE_SIZE ((MODE))) < 32 \
525 ? gen_rtx (REG, (MODE), \
526 40+(ROUNDUP ((CUM).floats, \
527 GET_MODE_SIZE ((MODE))) \
528 / 4)) \
529 : 0) \
530 : GET_MODE_CLASS ((MODE)) == MODE_INT \
531 ? (ROUNDUP ((CUM).ints, GET_MODE_SIZE ((MODE))) < 48 \
532 ? gen_rtx (REG, (MODE), \
533 16+(ROUNDUP ((CUM).ints, \
534 GET_MODE_SIZE ((MODE))) \
535 / 4)) \
536 : 0) \
537 : 0)
539 /* For an arg passed partly in registers and partly in memory,
540 this is the number of registers used.
541 For args passed entirely in registers or entirely in memory, zero. */
543 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
545 /* If defined, a C expression that gives the alignment boundary, in
546 bits, of an argument with the specified mode and type. If it is
547 not defined, `PARM_BOUNDARY' is used for all arguments. */
549 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
550 (((TYPE) != 0) \
551 ? ((TYPE_ALIGN(TYPE) <= PARM_BOUNDARY) \
552 ? PARM_BOUNDARY \
553 : TYPE_ALIGN(TYPE)) \
554 : ((GET_MODE_ALIGNMENT(MODE) <= PARM_BOUNDARY) \
555 ? PARM_BOUNDARY \
556 : GET_MODE_ALIGNMENT(MODE)))
558 /* This macro generates the assembly code for function entry.
560 FILE is a stdio stream to output the code to.
561 SIZE is an int: how many units of temporary storage to allocate.
564 #define FUNCTION_PROLOGUE(FILE, SIZE) function_prologue ((FILE), (SIZE))
566 /* Output a no-op just before the beginning of the function,
567 to ensure that there does not appear to be a delayed branch there.
568 Such a thing would confuse interrupt recovery. */
569 #define ASM_OUTPUT_FUNCTION_PREFIX(FILE,NAME) \
570 fprintf (FILE, "\tnop\n")
572 /* Output assembler code to FILE to increment profiler label # LABELNO
573 for profiling a function entry. */
575 #define FUNCTION_PROFILER(FILE, LABELNO) \
576 abort ();
578 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
579 the stack pointer does not matter. The value is tested only in
580 functions that have frame pointers.
581 No definition is equivalent to always zero. */
583 #define EXIT_IGNORE_STACK 1
585 /* This macro generates the assembly code for function exit.
587 FILE is a stdio stream to output the code to.
588 SIZE is an int: how many units of temporary storage to allocate.
590 The function epilogue should not depend on the current stack pointer!
591 It should use the frame pointer only. This is mandatory because
592 of alloca; we also take advantage of it to omit stack adjustments
593 before returning.
596 #define FUNCTION_EPILOGUE(FILE, SIZE) function_epilogue ((FILE), (SIZE))
598 /* Store in the variable DEPTH the initial difference between the
599 frame pointer reg contents and the stack pointer reg contents,
600 as of the start of the function body. This depends on the layout
601 of the fixed parts of the stack frame and on how registers are saved.
603 On the i860, FRAME_POINTER_REQUIRED is always 1, so the definition of this
604 macro doesn't matter. But it must be defined. */
606 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
607 do { (DEPTH) = 0; } while (0)
609 /* Output assembler code for a block containing the constant parts
610 of a trampoline, leaving space for the variable parts. */
612 /* On the i860, the trampoline contains five instructions:
613 orh #TOP_OF_FUNCTION,r0,r31
614 or #BOTTOM_OF_FUNCTION,r31,r31
615 orh #TOP_OF_STATIC,r0,r29
616 bri r31
617 or #BOTTOM_OF_STATIC,r29,r29 */
618 #define TRAMPOLINE_TEMPLATE(FILE) \
620 ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0xec1f0000)); \
621 ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0xe7ff0000)); \
622 ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0xec1d0000)); \
623 ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x4000f800)); \
624 ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0xe7bd0000)); \
627 /* Length in units of the trampoline for entering a nested function. */
629 #define TRAMPOLINE_SIZE 20
631 /* Emit RTL insns to initialize the variable parts of a trampoline.
632 FNADDR is an RTX for the address of the function's pure code.
633 CXT is an RTX for the static chain value for the function.
635 Store hi function at +0, low function at +4,
636 hi static at +8, low static at +16 */
638 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
640 rtx cxt = force_reg (Pmode, CXT); \
641 rtx fn = force_reg (Pmode, FNADDR); \
642 rtx hi_cxt = expand_shift (RSHIFT_EXPR, SImode, cxt, \
643 size_int (16), 0, 0); \
644 rtx hi_fn = expand_shift (RSHIFT_EXPR, SImode, fn, \
645 size_int (16), 0, 0); \
646 emit_move_insn (gen_rtx (MEM, HImode, plus_constant (TRAMP, 16)), \
647 gen_lowpart (HImode, cxt)); \
648 emit_move_insn (gen_rtx (MEM, HImode, plus_constant (TRAMP, 4)), \
649 gen_lowpart (HImode, fn)); \
650 emit_move_insn (gen_rtx (MEM, HImode, plus_constant (TRAMP, 8)), \
651 gen_lowpart (HImode, hi_cxt)); \
652 emit_move_insn (gen_rtx (MEM, HImode, plus_constant (TRAMP, 0)), \
653 gen_lowpart (HImode, hi_fn)); \
656 /* Addressing modes, and classification of registers for them. */
658 /* #define HAVE_POST_INCREMENT */
659 /* #define HAVE_POST_DECREMENT */
661 /* #define HAVE_PRE_DECREMENT */
662 /* #define HAVE_PRE_INCREMENT */
664 /* Macros to check register numbers against specific register classes. */
666 /* These assume that REGNO is a hard or pseudo reg number.
667 They give nonzero only if REGNO is a hard reg of the suitable class
668 or a pseudo reg currently allocated to a suitable hard reg.
669 Since they use reg_renumber, they are safe only once reg_renumber
670 has been allocated, which happens in local-alloc.c. */
672 #define REGNO_OK_FOR_INDEX_P(REGNO) \
673 ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
674 #define REGNO_OK_FOR_BASE_P(REGNO) \
675 ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
676 #define REGNO_OK_FOR_FP_P(REGNO) \
677 (((REGNO) ^ 0x20) < 32 || (unsigned) (reg_renumber[REGNO] ^ 0x20) < 32)
679 /* Now macros that check whether X is a register and also,
680 strictly, whether it is in a specified class.
682 These macros are specific to the i860, and may be used only
683 in code for printing assembler insns and in conditions for
684 define_optimization. */
686 /* 1 if X is an fp register. */
688 #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
690 /* Maximum number of registers that can appear in a valid memory address. */
692 #define MAX_REGS_PER_ADDRESS 2
694 /* Recognize any constant value that is a valid address. */
696 #define CONSTANT_ADDRESS_P(X) \
697 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
698 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
699 || GET_CODE (X) == HIGH)
701 /* Nonzero if the constant value X is a legitimate general operand.
702 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
704 On the Sparc, this is anything but a CONST_DOUBLE.
705 Let's try permitting CONST_DOUBLEs and see what happens. */
707 #define LEGITIMATE_CONSTANT_P(X) 1
709 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
710 and check its validity for a certain class.
711 We have two alternate definitions for each of them.
712 The usual definition accepts all pseudo regs; the other rejects
713 them unless they have been allocated suitable hard regs.
714 The symbol REG_OK_STRICT causes the latter definition to be used.
716 Most source files want to accept pseudo regs in the hope that
717 they will get allocated to the class that the insn wants them to be in.
718 Source files for reload pass need to be strict.
719 After reload, it makes no difference, since pseudo regs have
720 been eliminated by then. */
722 #ifndef REG_OK_STRICT
724 /* Nonzero if X is a hard reg that can be used as an index
725 or if it is a pseudo reg. */
726 #define REG_OK_FOR_INDEX_P(X) (((unsigned) REGNO (X)) - 32 >= 14)
727 /* Nonzero if X is a hard reg that can be used as a base reg
728 or if it is a pseudo reg. */
729 #define REG_OK_FOR_BASE_P(X) (((unsigned) REGNO (X)) - 32 >= 14)
731 #else
733 /* Nonzero if X is a hard reg that can be used as an index. */
734 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
735 /* Nonzero if X is a hard reg that can be used as a base reg. */
736 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
738 #endif
740 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
741 that is a valid memory address for an instruction.
742 The MODE argument is the machine mode for the MEM expression
743 that wants to use this address.
745 On the i860, the actual addresses must be REG+REG or REG+SMALLINT.
746 But we can treat a SYMBOL_REF as legitimate if it is part of this
747 function's constant-pool, because such addresses can actually
748 be output as REG+SMALLINT.
750 The displacement in an address must be a multiple of the alignment.
752 Try making SYMBOL_REF (and other things which are CONSTANT_ADDRESS_P)
753 a legitimate address, regardless. Because the only insns which can use
754 memory are load or store insns, the added hair in the machine description
755 is not that bad. It should also speed up the compiler by halving the number
756 of insns it must manage for each (MEM (SYMBOL_REF ...)) involved. */
758 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
759 { if (GET_CODE (X) == REG) \
760 { if (REG_OK_FOR_BASE_P (X)) goto ADDR; } \
761 else if (GET_CODE (X) == PLUS) \
763 if (GET_CODE (XEXP (X, 0)) == REG \
764 && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
766 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
767 && INTVAL (XEXP (X, 1)) >= -0x8000 \
768 && INTVAL (XEXP (X, 1)) < 0x8000 \
769 && (INTVAL (XEXP (X, 1)) & (GET_MODE_SIZE (MODE) - 1)) == 0) \
770 goto ADDR; \
772 else if (GET_CODE (XEXP (X, 1)) == REG \
773 && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
775 if (GET_CODE (XEXP (X, 0)) == CONST_INT \
776 && INTVAL (XEXP (X, 0)) >= -0x8000 \
777 && INTVAL (XEXP (X, 0)) < 0x8000 \
778 && (INTVAL (XEXP (X, 0)) & (GET_MODE_SIZE (MODE) - 1)) == 0) \
779 goto ADDR; \
782 else if (CONSTANT_ADDRESS_P (X)) \
783 goto ADDR; \
786 /* Try machine-dependent ways of modifying an illegitimate address
787 to be legitimate. If we find one, return the new, valid address.
788 This macro is used in only one place: `memory_address' in explow.c.
790 OLDX is the address as it was before break_out_memory_refs was called.
791 In some cases it is useful to look at this to decide what needs to be done.
793 MODE and WIN are passed so that this macro can use
794 GO_IF_LEGITIMATE_ADDRESS.
796 It is always safe for this macro to do nothing. It exists to recognize
797 opportunities to optimize the output. */
799 /* On the i860, change COMPLICATED + CONSTANT to REG+CONSTANT.
800 Also change a symbolic constant to a REG,
801 though that may not be necessary. */
803 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
804 { if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \
805 (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
806 force_operand (XEXP (X, 0), 0)); \
807 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \
808 (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
809 force_operand (XEXP (X, 1), 0)); \
810 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == PLUS) \
811 (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
812 force_operand (XEXP (X, 0), 0)); \
813 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == PLUS) \
814 (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
815 force_operand (XEXP (X, 1), 0)); \
816 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) != REG \
817 && GET_CODE (XEXP (X, 0)) != CONST_INT) \
818 (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
819 copy_to_mode_reg (SImode, XEXP (X, 0))); \
820 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) != REG \
821 && GET_CODE (XEXP (X, 1)) != CONST_INT) \
822 (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
823 copy_to_mode_reg (SImode, XEXP (X, 1))); \
824 if (GET_CODE (x) == SYMBOL_REF) \
825 (X) = copy_to_reg (X); \
826 if (GET_CODE (x) == CONST) \
827 (X) = copy_to_reg (X); \
828 if (memory_address_p (MODE, X)) \
829 goto WIN; }
831 /* Go to LABEL if ADDR (a legitimate address expression)
832 has an effect that depends on the machine mode it is used for.
833 On the i860 this is never true.
834 There are some addresses that are invalid in wide modes
835 but valid for narrower modes, but they shouldn't affect
836 the places that use this macro. */
838 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
840 /* Specify the machine mode that this machine uses
841 for the index in the tablejump instruction. */
842 #define CASE_VECTOR_MODE SImode
844 /* Define this if the tablejump instruction expects the table
845 to contain offsets from the address of the table.
846 Do not define this if the table should contain absolute addresses. */
847 /* #define CASE_VECTOR_PC_RELATIVE */
849 /* Specify the tree operation to be used to convert reals to integers. */
850 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
852 /* This is the kind of divide that is easiest to do in the general case. */
853 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
855 /* Must pass floats to libgcc functions as doubles. */
856 #define LIBGCC_NEEDS_DOUBLE 1
858 #define DIVSI3_LIBCALL "*.div"
859 #define UDIVSI3_LIBCALL "*.udiv"
860 #define REMSI3_LIBCALL "*.rem"
861 #define UREMSI3_LIBCALL "*.urem"
863 /* Define this as 1 if `char' should by default be signed; else as 0. */
864 #define DEFAULT_SIGNED_CHAR 1
866 /* Max number of bytes we can move from memory to memory
867 in one reasonably fast instruction. */
868 #define MOVE_MAX 16
870 /* Nonzero if access to memory by bytes is slow and undesirable. */
871 #define SLOW_BYTE_ACCESS 0
873 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
874 is done just by pretending it is already truncated. */
875 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
877 /* Value is 1 if it generates better code to perform an unsigned comparison
878 on the given literal integer value in the given mode when we are only
879 looking for an equal/non-equal result. */
880 /* For the i860, if the immediate value has its high-order 27 bits zero,
881 then we want to engineer an unsigned comparison for EQ/NE because
882 such values can fit in the 5-bit immediate field of a bte or btne
883 instruction (which gets zero extended before comparing). For all
884 other immediate values on the i860, we will use signed compares
885 because that avoids the need for doing explicit xor's to zero_extend
886 the non-constant operand in cases where it was (mem:QI ...) or a
887 (mem:HI ...) which always gets automatically sign-extended by the
888 hardware upon loading. */
890 #define LITERAL_COMPARE_BETTER_UNSIGNED(intval, mode) \
891 (((unsigned) (intval) & 0x1f) == (unsigned) (intval))
893 /* Specify the machine mode that pointers have.
894 After generation of rtl, the compiler makes no further distinction
895 between pointers and any other objects of this machine mode. */
896 #define Pmode SImode
898 /* A function address in a call instruction
899 is a byte address (for indexing purposes)
900 so give the MEM rtx a byte's mode. */
901 #define FUNCTION_MODE SImode
903 /* Define this if addresses of constant functions
904 shouldn't be put through pseudo regs where they can be cse'd.
905 Desirable on machines where ordinary constants are expensive
906 but a CALL with constant address is cheap. */
907 #define NO_FUNCTION_CSE
909 /* Compute the cost of computing a constant rtl expression RTX
910 whose rtx-code is CODE. The body of this macro is a portion
911 of a switch statement. If the code is computed here,
912 return it with a return statement. Otherwise, break from the switch. */
914 #define CONST_COSTS(RTX,CODE, OUTER_CODE) \
915 case CONST_INT: \
916 if (INTVAL (RTX) == 0) \
917 return 0; \
918 if (INTVAL (RTX) < 0x2000 && INTVAL (RTX) >= -0x2000) return 1; \
919 case CONST: \
920 case LABEL_REF: \
921 case SYMBOL_REF: \
922 return 4; \
923 case CONST_DOUBLE: \
924 return 6;
926 /* Specify the cost of a branch insn; roughly the number of extra insns that
927 should be added to avoid a branch.
929 Set this to 3 on the i860 since branches may often take three cycles. */
931 #define BRANCH_COST 3
933 /* Tell final.c how to eliminate redundant test instructions. */
935 /* Here we define machine-dependent flags and fields in cc_status
936 (see `conditions.h'). */
938 /* This holds the value sourcing h%r31. We keep this info
939 around so that mem/mem ops, such as increment and decrement,
940 etc, can be performed reasonably. */
941 #define CC_STATUS_MDEP rtx
943 #define CC_STATUS_MDEP_INIT (cc_status.mdep = 0)
945 #define CC_NEGATED 01000
947 /* We use this macro in those places in the i860.md file where we would
948 normally just do a CC_STATUS_INIT (for other machines). This macro
949 differs from CC_STATUS_INIT in that it doesn't mess with the special
950 bits or fields which describe what is currently in the special r31
951 scratch register, but it does clear out everything that actually
952 relates to the condition code bit of the i860. */
954 #define CC_STATUS_PARTIAL_INIT \
955 (cc_status.flags &= (CC_KNOW_HI_R31 | CC_HI_R31_ADJ), \
956 cc_status.value1 = 0, \
957 cc_status.value2 = 0)
959 /* Nonzero if we know the value of h%r31. */
960 #define CC_KNOW_HI_R31 0100000
962 /* Nonzero if h%r31 is actually ha%something, rather than h%something. */
963 #define CC_HI_R31_ADJ 0200000
965 /* Store in cc_status the expressions
966 that the condition codes will describe
967 after execution of an instruction whose pattern is EXP.
968 Do not alter them if the instruction would not alter the cc's. */
970 /* On the i860, only compare insns set a useful condition code. */
972 #define NOTICE_UPDATE_CC(EXP, INSN) \
973 { cc_status.flags &= (CC_KNOW_HI_R31 | CC_HI_R31_ADJ); \
974 cc_status.value1 = 0; cc_status.value2 = 0; }
976 /* Control the assembler format that we output. */
978 /* Assembler pseudos to introduce constants of various size. */
980 #define ASM_BYTE_OP "\t.byte"
981 #define ASM_SHORT "\t.short"
982 #define ASM_LONG "\t.long"
983 #define ASM_DOUBLE "\t.double"
985 /* Output at beginning of assembler file. */
986 /* The .file command should always begin the output. */
988 #define ASM_FILE_START(FILE)
989 #if 0
990 #define ASM_FILE_START(FILE) \
991 do { output_file_directive ((FILE), main_input_filename); \
992 if (optimize) ASM_FILE_START_1 (FILE); \
993 } while (0)
994 #endif
996 #define ASM_FILE_START_1(FILE)
998 /* Output to assembler file text saying following lines
999 may contain character constants, extra white space, comments, etc. */
1001 #define ASM_APP_ON ""
1003 /* Output to assembler file text saying following lines
1004 no longer contain unusual constructs. */
1006 #define ASM_APP_OFF ""
1008 /* Output before read-only data. */
1010 #define TEXT_SECTION_ASM_OP ".text"
1012 /* Output before writable data. */
1014 #define DATA_SECTION_ASM_OP ".data"
1016 /* How to refer to registers in assembler output.
1017 This sequence is indexed by compiler's hard-register-number (see above). */
1019 #define REGISTER_NAMES \
1020 {"r0", "r1", "sp", "fp", "r4", "r5", "r6", "r7", "r8", "r9", \
1021 "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", \
1022 "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", \
1023 "r30", "r31", \
1024 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", \
1025 "f10", "f11", "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19", \
1026 "f20", "f21", "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", \
1027 "f30", "f31" }
1029 /* How to renumber registers for dbx and gdb. */
1031 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
1033 /* This is how to output the definition of a user-level label named NAME,
1034 such as the label on a static function or variable NAME. */
1036 #define ASM_OUTPUT_LABEL(FILE,NAME) \
1037 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1039 /* This is how to output a command to make the user-level label named NAME
1040 defined for reference from other files. */
1042 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
1043 do { fputs (".globl ", FILE); \
1044 assemble_name (FILE, NAME); \
1045 fputs ("\n", FILE); \
1046 } while (0)
1048 /* This is how to output a reference to a user-level label named NAME.
1049 `assemble_name' uses this.
1051 This definition is overridden in i860v4.h because under System V
1052 Release 4, user-level symbols are *not* prefixed with underscores in
1053 the generated assembly code. */
1055 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
1056 fprintf (FILE, "_%s", NAME)
1058 /* This is how to output an internal numbered label where
1059 PREFIX is the class of label and NUM is the number within the class. */
1061 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1062 fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
1064 /* This is how to output an internal numbered label which
1065 labels a jump table. */
1067 #undef ASM_OUTPUT_CASE_LABEL
1068 #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \
1069 do { ASM_OUTPUT_ALIGN ((FILE), 2); \
1070 ASM_OUTPUT_INTERNAL_LABEL ((FILE), PREFIX, NUM); \
1071 } while (0)
1073 /* Output at the end of a jump table. */
1075 #define ASM_OUTPUT_CASE_END(FILE,NUM,INSN) \
1076 fprintf (FILE, ".text\n")
1078 /* This is how to store into the string LABEL
1079 the symbol_ref name of an internal numbered label where
1080 PREFIX is the class of label and NUM is the number within the class.
1081 This is suitable for output with `assemble_name'. */
1083 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1084 sprintf (LABEL, "*.%s%d", PREFIX, NUM)
1086 /* This is how to output an assembler line defining a `double' constant. */
1088 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
1089 fprintf (FILE, "\t.double %.20e\n", (VALUE))
1091 /* This is how to output an assembler line defining a `float' constant. */
1093 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
1094 fprintf (FILE, "\t.float %.12e\n", (VALUE))
1096 /* This is how to output an assembler line defining an `int' constant. */
1098 #define ASM_OUTPUT_INT(FILE,VALUE) \
1099 ( fprintf (FILE, "\t.long "), \
1100 output_addr_const (FILE, (VALUE)), \
1101 fprintf (FILE, "\n"))
1103 /* Likewise for `char' and `short' constants. */
1105 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
1106 ( fprintf (FILE, "\t.short "), \
1107 output_addr_const (FILE, (VALUE)), \
1108 fprintf (FILE, "\n"))
1110 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
1111 ( fprintf (FILE, "\t.byte "), \
1112 output_addr_const (FILE, (VALUE)), \
1113 fprintf (FILE, "\n"))
1115 /* This is how to output an assembler line for a numeric constant byte. */
1117 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
1118 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1120 /* This is how to output code to push a register on the stack.
1121 It need not be very fast code. */
1123 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1124 fprintf (FILE, "\taddu -16,%ssp,%ssp\n\t%sst.l %s%s,0(%ssp)\n", \
1125 i860_reg_prefix, i860_reg_prefix, \
1126 ((REGNO) < 32 ? "" : "f"), \
1127 i860_reg_prefix, reg_names[REGNO], \
1128 i860_reg_prefix)
1130 /* This is how to output an insn to pop a register from the stack.
1131 It need not be very fast code. */
1133 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1134 fprintf (FILE, "\t%sld.l 0(%ssp),%s%s\n\taddu 16,%ssp,%ssp\n", \
1135 ((REGNO) < 32 ? "" : "f"), \
1136 i860_reg_prefix, \
1137 i860_reg_prefix, reg_names[REGNO], \
1138 i860_reg_prefix, i860_reg_prefix)
1140 /* This is how to output an element of a case-vector that is absolute. */
1142 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1143 fprintf (FILE, "\t.long .L%d\n", VALUE)
1145 /* This is how to output an element of a case-vector that is relative.
1146 (The i860 does not use such vectors,
1147 but we must define this macro anyway.) */
1149 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
1150 fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
1152 /* This is how to output an assembler line
1153 that says to advance the location counter
1154 to a multiple of 2**LOG bytes. */
1156 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1157 if ((LOG) != 0) \
1158 fprintf (FILE, "\t.align %d\n", 1 << (LOG))
1160 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1161 fprintf (FILE, "\t.blkb %u\n", (SIZE))
1163 /* This says how to output an assembler line
1164 to define a global common symbol. */
1166 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1167 ( fputs (".comm ", (FILE)), \
1168 assemble_name ((FILE), (NAME)), \
1169 fprintf ((FILE), ",%u\n", (ROUNDED)))
1171 /* This says how to output an assembler line
1172 to define a local common symbol. */
1174 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
1175 ( fputs (".lcomm ", (FILE)), \
1176 assemble_name ((FILE), (NAME)), \
1177 fprintf ((FILE), ",%u\n", (ROUNDED)))
1179 /* Store in OUTPUT a string (made with alloca) containing
1180 an assembler-name for a local static variable named NAME.
1181 LABELNO is an integer which is different for each call. */
1183 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1184 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1185 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1187 /* Define the parentheses used to group arithmetic operations
1188 in assembler code. */
1190 #define ASM_OPEN_PAREN "("
1191 #define ASM_CLOSE_PAREN ")"
1193 /* Define results of standard character escape sequences. */
1194 #define TARGET_BELL 007
1195 #define TARGET_BS 010
1196 #define TARGET_TAB 011
1197 #define TARGET_NEWLINE 012
1198 #define TARGET_VT 013
1199 #define TARGET_FF 014
1200 #define TARGET_CR 015
1202 /* Print operand X (an rtx) in assembler syntax to file FILE.
1203 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1204 For `%' followed by punctuation, CODE is the punctuation and X is null.
1206 In the following comments, the term "constant address" is used frequently.
1207 For an exact definition of what constitutes a "constant address" see the
1208 output_addr_const routine in final.c
1210 On the i860, the following target-specific special codes are recognized:
1212 `r' The operand can be anything, but if is is an immediate zero
1213 value (either integer or floating point) then it will be
1214 represented as `r0' or as `f0' (respectively).
1216 `m' The operand is a memory ref (to a constant address) but print
1217 its address as a constant.
1219 `L' The operand is a numeric constant, a constant address, or
1220 a memory ref to a constant address. Print the correct
1221 notation to yield the low part of the given value or
1222 address or the low part of the address of the referred
1223 to memory object.
1225 `H' The operand is a numeric constant, a constant address, or
1226 a memory ref to a constant address. Print the correct
1227 notation to yield the high part of the given value or
1228 address or the high part of the address of the referred
1229 to memory object.
1231 `h' The operand is a numeric constant, a constant address, or
1232 a memory ref to a constant address. Either print the
1233 correct notation to yield the plain high part of the
1234 given value or address (or the plain high part of the
1235 address of the memory object) or else print the correct
1236 notation to yield the "adjusted" high part of the given
1237 address (or of the address of the referred to memory object).
1239 The choice of what to print depends upon whether the address
1240 in question is relocatable or not. If it is relocatable,
1241 print the notation to get the adjusted high part. Otherwise
1242 just print the notation to get the plain high part. Note
1243 that "adjusted" high parts are generally used *only* when
1244 the next following instruction uses the low part of the
1245 address as an offset, as in `offset(reg)'.
1247 `R' The operand is a floating-pointer register. Print the
1248 name of the next following (32-bit) floating-point register.
1249 (This is used when moving a value into just the most
1250 significant part of a floating-point register pair.)
1252 `?' (takes no operand) Substitute the value of i860_reg_prefix
1253 at this point. The value of i860_reg_prefix is typically
1254 a null string for most i860 targets, but for System V
1255 Release 4 the i860 assembler syntax requires that all
1256 names of registers be prefixed with a percent-sign, so
1257 for SVR4, the value of i860_reg_prefix is initialized to
1258 "%" in i860.c.
1261 extern char *i860_reg_prefix;
1262 extern unsigned long sfmode_constant_to_ulong ();
1264 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '?')
1266 /* The following macro definition is overridden in i860v4.h
1267 because the svr4 i860 assembler required a different syntax
1268 for getting parts of constant/relocatable values. */
1270 #define PRINT_OPERAND_PART(FILE, X, PART_CODE) \
1271 do { fprintf (FILE, "%s%%", PART_CODE); \
1272 output_address (X); \
1273 } while (0)
1275 #define OPERAND_LOW_PART "l"
1276 #define OPERAND_HIGH_PART "h"
1277 /* NOTE: All documentation available for the i860 sez that you must
1278 use "ha" to get the relocated high part of a relocatable, but
1279 reality sez different. */
1280 #define OPERAND_HIGH_ADJ_PART "ha"
1282 #define PRINT_OPERAND(FILE, X, CODE) \
1283 { if ((CODE) == '?') \
1284 fprintf (FILE, "%s", i860_reg_prefix); \
1285 else if (CODE == 'R') \
1286 fprintf (FILE, "%s%s", i860_reg_prefix, reg_names[REGNO (X) + 1]); \
1287 else if (GET_CODE (X) == REG) \
1288 fprintf (FILE, "%s%s", i860_reg_prefix, reg_names[REGNO (X)]); \
1289 else if ((CODE) == 'm') \
1290 output_address (XEXP (X, 0)); \
1291 else if ((CODE) == 'L') \
1293 if (GET_CODE (X) == MEM) \
1294 PRINT_OPERAND_PART (FILE, XEXP (X, 0), OPERAND_LOW_PART); \
1295 else \
1296 PRINT_OPERAND_PART (FILE, X, OPERAND_LOW_PART); \
1298 else if ((CODE) == 'H') \
1300 if (GET_CODE (X) == MEM) \
1301 PRINT_OPERAND_PART (FILE, XEXP (X, 0), OPERAND_HIGH_PART); \
1302 else \
1303 PRINT_OPERAND_PART (FILE, X, OPERAND_HIGH_PART); \
1305 else if ((CODE) == 'h') \
1307 if (GET_CODE (X) == MEM) \
1308 PRINT_OPERAND_PART (FILE, XEXP (X, 0), OPERAND_HIGH_ADJ_PART); \
1309 else \
1310 PRINT_OPERAND_PART (FILE, X, OPERAND_HIGH_ADJ_PART); \
1312 else if (GET_CODE (X) == MEM) \
1313 output_address (XEXP (X, 0)); \
1314 else if ((CODE) == 'r' && (X) == const0_rtx) \
1315 fprintf (FILE, "%sr0", i860_reg_prefix); \
1316 else if ((CODE) == 'r' && (X) == CONST0_RTX (GET_MODE (X))) \
1317 fprintf (FILE, "%sf0", i860_reg_prefix); \
1318 else if (GET_CODE (X) == CONST_DOUBLE) \
1319 fprintf (FILE, "0x%x", sfmode_constant_to_ulong (X)); \
1320 else \
1321 output_addr_const (FILE, X); }
1323 /* Print a memory address as an operand to reference that memory location. */
1325 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1326 { register rtx base, index = 0; \
1327 int offset = 0; \
1328 register rtx addr = ADDR; \
1329 if (GET_CODE (addr) == REG) \
1331 fprintf (FILE, "0(%s%s)", \
1332 i860_reg_prefix, reg_names[REGNO (addr)]); \
1334 else if (GET_CODE (addr) == CONST_DOUBLE \
1335 && GET_MODE (addr) == SFmode) \
1336 fprintf (FILE, "0x%x", sfmode_constant_to_ulong (addr)); \
1337 else if (GET_CODE (addr) == PLUS) \
1339 if ((GET_CODE (XEXP (addr, 0)) == CONST_INT) \
1340 && (GET_CODE (XEXP (addr, 1)) == REG)) \
1341 fprintf (FILE, "%d(%s%s)", INTVAL (XEXP (addr, 0)), \
1342 i860_reg_prefix, reg_names[REGNO (XEXP (addr, 1))]);\
1343 else if ((GET_CODE (XEXP (addr, 1)) == CONST_INT) \
1344 && (GET_CODE (XEXP (addr, 0)) == REG)) \
1345 fprintf (FILE, "%d(%s%s)", INTVAL (XEXP (addr, 1)), \
1346 i860_reg_prefix, reg_names[REGNO (XEXP (addr, 0))]);\
1347 else if ((GET_CODE (XEXP (addr, 0)) == REG) \
1348 && (GET_CODE (XEXP (addr, 1)) == REG)) \
1349 fprintf (FILE, "%s%s(%s%s)", \
1350 i860_reg_prefix, reg_names[REGNO (XEXP (addr, 0))], \
1351 i860_reg_prefix, reg_names[REGNO (XEXP (addr, 1))]);\
1352 else \
1353 output_addr_const (FILE, addr); \
1355 else \
1357 output_addr_const (FILE, addr); \
1361 /* The following #defines are used when compiling the routines in
1362 libgcc1.c. Since the i860 calling conventions require single
1363 precision floats to be passed in the floating-point registers
1364 (rather than in the general registers) we have to build the
1365 libgcc1.c routines in such a way that they know the actual types
1366 of their formal arguments and the actual types of their return
1367 values. Otherwise, gcc will generate calls to the libgcc1.c
1368 routines, passing arguments in the floating-point registers,
1369 but the libgcc1.c routines will expect their arguments on the
1370 stack (where the i860 calling conventions require structs &
1371 unions to be passed). */
1373 #define FLOAT_TYPE_VALUE float
1374 #define INTIFY(FLOATVAL) (FLOATVAL)
1375 #define FLOATIFY(INTVAL) (INTVAL)
1376 #define FLOAT_ARG_TYPE float
1379 /* Optionally define this if you have added predicates to
1380 `MACHINE.c'. This macro is called within an initializer of an
1381 array of structures. The first field in the structure is the
1382 name of a predicate and the second field is an array of rtl
1383 codes. For each predicate, list all rtl codes that can be in
1384 expressions matched by the predicate. The list should have a
1385 trailing comma. Here is an example of two entries in the list
1386 for a typical RISC machine:
1388 #define PREDICATE_CODES \
1389 {"gen_reg_rtx_operand", {SUBREG, REG}}, \
1390 {"reg_or_short_cint_operand", {SUBREG, REG, CONST_INT}},
1392 Defining this macro does not affect the generated code (however,
1393 incorrect definitions that omit an rtl code that may be matched
1394 by the predicate can cause the compiler to malfunction).
1395 Instead, it allows the table built by `genrecog' to be more
1396 compact and efficient, thus speeding up the compiler. The most
1397 important predicates to include in the list specified by this
1398 macro are thoses used in the most insn patterns. */
1400 #define PREDICATE_CODES \
1401 {"reg_or_0_operand", {REG, SUBREG, CONST_INT}}, \
1402 {"arith_operand", {REG, SUBREG, CONST_INT}}, \
1403 {"logic_operand", {REG, SUBREG, CONST_INT}}, \
1404 {"shift_operand", {REG, SUBREG, CONST_INT}}, \
1405 {"compare_operand", {REG, SUBREG, CONST_INT}}, \
1406 {"arith_const_operand", {CONST_INT}}, \
1407 {"logic_const_operand", {CONST_INT}}, \
1408 {"bte_operand", {REG, SUBREG, CONST_INT}}, \
1409 {"indexed_operand", {MEM}}, \
1410 {"load_operand", {MEM}}, \
1411 {"small_int", {CONST_INT}}, \
1412 {"logic_int", {CONST_INT}}, \
1413 {"call_insn_operand", {MEM}},
1415 /* Define the information needed to generate branch insns. This is stored
1416 from the compare operation. Note that we can't use "rtx" here since it
1417 hasn't been defined! */
1419 extern struct rtx_def *i860_compare_op0, *i860_compare_op1;
1421 /* Declare things which are defined in i860.c but called from
1422 insn-output.c. */
1424 extern unsigned long sfmode_constant_to_ulong ();
1425 extern char *output_load ();
1426 extern char *output_store ();
1427 extern char *output_move_double ();
1428 extern char *output_fp_move_double ();
1429 extern char *output_block_move ();
1430 extern char *output_delay_insn ();
1431 extern char *output_delayed_branch ();
1432 extern void output_load_address ();