2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / config / i860 / i860.h
blobc600f0276ec8b5d9a3c6f6b119657232e97c686b
1 /* Definitions of target machine for GNU compiler, for Intel 860.
2 Copyright (C) 1989, 1991, 1993, 1995, 1996, 1997, 1998, 1999, 2000,
3 2001, 2002, 2003 Free Software Foundation, Inc.
4 Hacked substantially by Ron Guilmette (rfg@monkeys.com) to cater to
5 the whims of the System V Release 4 assembler.
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
14 GCC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING. If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
25 /* Note that some other tm.h files include this one and then override
26 many of the definitions that relate to assembler syntax. */
29 /* Names to predefine in the preprocessor for this target machine. */
30 #define TARGET_CPU_CPP_BUILTINS() \
31 do { \
32 builtin_define ("i860"); \
33 builtin_assert ("cpu=i860"); \
34 builtin_assert ("machine=i860"); \
35 } while (0)
37 /* Print subsidiary information on the compiler version in use. */
38 #define TARGET_VERSION fprintf (stderr, " (i860)");
40 /* Run-time compilation parameters selecting different hardware subsets
41 or supersets.
43 On the i860, we have one: TARGET_XP. This option allows gcc to generate
44 additional instructions available only on the newer i860 XP (but not on
45 the older i860 XR).
48 extern int target_flags;
50 /* Nonzero if we should generate code to use the fpu. */
51 #define TARGET_XP (target_flags & 1)
53 /* Macro to define tables used to set the flags.
54 This is a list in braces of pairs in braces,
55 each pair being { "NAME", VALUE }
56 where VALUE is the bits to set or minus the bits to clear.
57 An empty string NAME is used to identify the default VALUE. */
59 #define TARGET_SWITCHES \
60 { {"xp", 1, N_("Generate code which uses the FPU")}, \
61 {"noxp", -1, N_("Do not generate code which uses the FPU")}, \
62 {"xr", -1, N_("Do not generate code which uses the FPU")}, \
63 { "", TARGET_DEFAULT, NULL}}
65 #define TARGET_DEFAULT 0
67 /* target machine storage layout */
69 /* Define this if most significant bit is lowest numbered
70 in instructions that operate on numbered bit-fields.
71 This is a moot question on the i860 due to the lack of bit-field insns. */
72 #define BITS_BIG_ENDIAN 0
74 /* Define this if most significant byte of a word is the lowest numbered. */
75 /* That is not true on i860 in the mode we will use. */
76 #define BYTES_BIG_ENDIAN 0
78 /* Define this if most significant word of a multiword number is the lowest
79 numbered. */
80 /* For the i860 this goes with BYTES_BIG_ENDIAN. */
81 /* NOTE: GCC probably cannot support a big-endian i860
82 because GCC fundamentally assumes that the order of words
83 in memory as the same as the order in registers.
84 That's not true for the big-endian i860.
85 The big-endian i860 isn't important enough to
86 justify the trouble of changing this assumption. */
87 #define WORDS_BIG_ENDIAN 0
89 /* Width of a word, in units (bytes). */
90 #define UNITS_PER_WORD 4
92 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
93 #define PARM_BOUNDARY 32
95 /* Boundary (in *bits*) on which stack pointer should be aligned. */
96 #define STACK_BOUNDARY 128
98 /* Allocation boundary (in *bits*) for the code of a function. */
99 #define FUNCTION_BOUNDARY 64
101 /* Alignment of field after `int : 0' in a structure. */
102 #define EMPTY_FIELD_BOUNDARY 32
104 /* Every structure's size must be a multiple of this. */
105 #define STRUCTURE_SIZE_BOUNDARY 8
107 /* Minimum size in bits of the largest boundary to which any
108 and all fundamental data types supported by the hardware
109 might need to be aligned. No data type wants to be aligned
110 rounder than this. The i860 supports 128-bit (long double)
111 floating point quantities, and the System V Release 4 i860
112 ABI requires these to be aligned to 16-byte (128-bit)
113 boundaries. */
114 #define BIGGEST_ALIGNMENT 128
116 /* Set this nonzero if move instructions will actually fail to work
117 when given unaligned data. */
118 #define STRICT_ALIGNMENT 1
120 /* If bit field type is int, don't let it cross an int,
121 and give entire struct the alignment of an int. */
122 #define PCC_BITFIELD_TYPE_MATTERS 1
124 /* Standard register usage. */
126 /* Number of actual hardware registers.
127 The hardware registers are assigned numbers for the compiler
128 from 0 to just below FIRST_PSEUDO_REGISTER.
129 All registers that the compiler knows about must be given numbers,
130 even those that are not normally considered general registers.
132 i860 has 32 fullword registers and 32 floating point registers. */
134 #define FIRST_PSEUDO_REGISTER 64
136 /* 1 for registers that have pervasive standard uses
137 and are not available for the register allocator.
138 On the i860, this includes the always-0 registers
139 and fp, sp, arg pointer, and the return address.
140 Also r31, used for special purposes for constant addresses. */
141 #define FIXED_REGISTERS \
142 {1, 1, 1, 1, 0, 0, 0, 0, \
143 0, 0, 0, 0, 0, 0, 0, 0, \
144 0, 0, 0, 0, 0, 0, 0, 0, \
145 0, 0, 0, 0, 0, 0, 0, 1, \
146 1, 1, 0, 0, 0, 0, 0, 0, \
147 0, 0, 0, 0, 0, 0, 0, 0, \
148 0, 0, 0, 0, 0, 0, 0, 0, \
149 0, 0, 0, 0, 0, 0, 0, 0}
151 /* 1 for registers not available across function calls.
152 These must include the FIXED_REGISTERS and also any
153 registers that can be used without being saved.
154 On the i860, these are r0-r3, r16-r31, f0, f1, and f16-f31. */
155 #define CALL_USED_REGISTERS \
156 {1, 1, 1, 1, 0, 0, 0, 0, \
157 0, 0, 0, 0, 0, 0, 0, 0, \
158 1, 1, 1, 1, 1, 1, 1, 1, \
159 1, 1, 1, 1, 1, 1, 1, 1, \
160 1, 1, 0, 0, 0, 0, 0, 0, \
161 1, 1, 1, 1, 1, 1, 1, 1, \
162 1, 1, 1, 1, 1, 1, 1, 1, \
163 1, 1, 1, 1, 1, 1, 1, 1}
165 /* Try to get a non-preserved register before trying to get one we will
166 have to preserve. Try to get an FP register only *after* trying to
167 get a general register, because it is relatively expensive to move
168 into or out of an FP register. */
170 #define REG_ALLOC_ORDER \
171 {31, 30, 29, 28, 27, 26, 25, 24, \
172 23, 22, 21, 20, 19, 18, 17, 16, \
173 15, 14, 13, 12, 11, 10, 9, 8, \
174 7, 6, 5, 4, 3, 2, 1, 0, \
175 63, 62, 61, 60, 59, 58, 57, 56, \
176 55, 54, 53, 52, 51, 50, 49, 48, \
177 47, 46, 45, 44, 43, 42, 41, 40, \
178 39, 38, 37, 36, 35, 34, 33, 32}
180 /* Return number of consecutive hard regs needed starting at reg REGNO
181 to hold something of mode MODE.
182 This is ordinarily the length in words of a value of mode MODE
183 but can be less for certain modes in special long registers.
185 On the i860, all registers hold 32 bits worth. */
186 #define HARD_REGNO_NREGS(REGNO, MODE) \
187 (((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
189 #define REGNO_MODE_ALIGNED(REGNO, MODE) \
190 (((REGNO) % ((GET_MODE_UNIT_SIZE (MODE) + 3) / 4)) == 0)
192 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
194 On the i860, we allow anything to go into any registers, but we require
195 any sort of value going into the FP registers to be properly aligned
196 (based on its size) within the FP register set.
198 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
199 (((REGNO) < 32) \
200 || (MODE) == VOIDmode || (MODE) == BLKmode \
201 || REGNO_MODE_ALIGNED (REGNO, MODE))
203 /* Value is 1 if it is a good idea to tie two pseudo registers
204 when one has mode MODE1 and one has mode MODE2.
205 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
206 for any hard reg, then this must be 0 for correct output. */
207 /* I think that is not always true; alignment restrictions for doubles
208 should not prevent tying them with singles. So try allowing that.
209 On the other hand, don't let fixed and floating be tied;
210 this restriction is not necessary, but may make better code. */
211 #define MODES_TIEABLE_P(MODE1, MODE2) \
212 ((GET_MODE_CLASS (MODE1) == MODE_FLOAT \
213 || GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \
214 == (GET_MODE_CLASS (MODE2) == MODE_FLOAT \
215 || GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT))
217 /* Specify the registers used for certain standard purposes.
218 The values of these macros are register numbers. */
220 /* i860 pc isn't overloaded on a register that the compiler knows about. */
221 /* #define PC_REGNUM */
223 /* Register to use for pushing function arguments. */
224 #define STACK_POINTER_REGNUM 2
226 /* Base register for access to local variables of the function. */
227 #define FRAME_POINTER_REGNUM 3
229 /* Value should be nonzero if functions must have frame pointers.
230 Zero means the frame pointer need not be set up (and parms
231 may be accessed via the stack pointer) in functions that seem suitable.
232 This is computed in `reload', in reload1.c. */
233 #define FRAME_POINTER_REQUIRED 1
235 /* Base register for access to arguments of the function. */
236 #define ARG_POINTER_REGNUM 28
238 /* Register in which static-chain is passed to a function. */
239 #define STATIC_CHAIN_REGNUM 29
241 /* Register in which address to store a structure value
242 is passed to a function. */
243 #define STRUCT_VALUE_REGNUM 16
245 /* Register to use when a source of a floating-point zero is needed. */
246 #define F0_REGNUM 32
248 /* Define the classes of registers for register constraints in the
249 machine description. Also define ranges of constants.
251 One of the classes must always be named ALL_REGS and include all hard regs.
252 If there is more than one class, another class must be named NO_REGS
253 and contain no registers.
255 The name GENERAL_REGS must be the name of a class (or an alias for
256 another name such as ALL_REGS). This is the class of registers
257 that is allowed by "g" or "r" in a register constraint.
258 Also, registers outside this class are allocated only when
259 instructions express preferences for them.
261 The classes must be numbered in nondecreasing order; that is,
262 a larger-numbered class must never be contained completely
263 in a smaller-numbered class.
265 For any two classes, it is very desirable that there be another
266 class that represents their union. */
268 /* The i860 has two kinds of registers, hence four classes. */
270 enum reg_class { NO_REGS, GENERAL_REGS, FP_REGS, ALL_REGS, LIM_REG_CLASSES };
272 #define N_REG_CLASSES (int) LIM_REG_CLASSES
274 /* Give names of register classes as strings for dump file. */
276 #define REG_CLASS_NAMES \
277 {"NO_REGS", "GENERAL_REGS", "FP_REGS", "ALL_REGS" }
279 /* Define which registers fit in which classes.
280 This is an initializer for a vector of HARD_REG_SET
281 of length N_REG_CLASSES. */
283 #define REG_CLASS_CONTENTS \
284 {{0, 0}, {0xffffffff, 0}, \
285 {0, 0xffffffff}, {0xffffffff, 0xffffffff}}
287 /* The same information, inverted:
288 Return the class number of the smallest class containing
289 reg number REGNO. This could be a conditional expression
290 or could index an array. */
292 #define REGNO_REG_CLASS(REGNO) \
293 ((REGNO) >= 32 ? FP_REGS : GENERAL_REGS)
295 /* The class value for index registers, and the one for base regs. */
296 #define INDEX_REG_CLASS GENERAL_REGS
297 #define BASE_REG_CLASS GENERAL_REGS
299 /* Get reg_class from a letter such as appears in the machine description. */
301 #define REG_CLASS_FROM_LETTER(C) \
302 ((C) == 'f' ? FP_REGS : NO_REGS)
304 /* The letters I, J, K, L and M in a register constraint string
305 can be used to stand for particular ranges of immediate operands.
306 This macro defines what the ranges are.
307 C is the letter, and VALUE is a constant value.
308 Return 1 if VALUE is in the range specified by C.
310 For the i860, `I' is used for the range of constants
311 an add/subtract insn can actually contain.
312 But not including -0x8000, since we need
313 to negate the constant sometimes.
314 `J' is used for the range which is just zero (since that is R0).
315 `K' is used for the range allowed in bte.
316 `L' is used for the range allowed in logical insns. */
318 #define SMALL_INT(X) ((unsigned) (INTVAL (X) + 0x7fff) < 0xffff)
320 #define LOGIC_INT(X) ((unsigned) INTVAL (X) < 0x10000)
322 #define SMALL_INTVAL(X) ((unsigned) ((X) + 0x7fff) < 0xffff)
324 #define LOGIC_INTVAL(X) ((unsigned) (X) < 0x10000)
326 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
327 ((C) == 'I' ? ((unsigned) (VALUE) + 0x7fff) < 0xffff \
328 : (C) == 'J' ? (VALUE) == 0 \
329 : (C) == 'K' ? (unsigned) (VALUE) < 0x20 \
330 : (C) == 'L' ? (unsigned) (VALUE) < 0x10000 \
331 : 0)
333 /* Return nonzero if the given VALUE is acceptable for the
334 constraint letter C. For the i860, constraint letter 'G'
335 permits only a floating-point zero value. */
336 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
337 ((C) == 'G' && CONST_DOUBLE_LOW ((VALUE)) == 0 \
338 && CONST_DOUBLE_HIGH ((VALUE)) == 0)
340 /* Given an rtx X being reloaded into a reg required to be
341 in class CLASS, return the class of reg to actually use.
342 In general this is just CLASS; but on some machines
343 in some cases it is preferable to use a more restrictive class.
345 If we are trying to put an integer constant into some register, prefer an
346 integer register to an FP register. If we are trying to put a
347 nonzero floating-point constant into some register, use an integer
348 register if the constant is SFmode and GENERAL_REGS is one of our options.
349 Otherwise, put the constant into memory.
351 When reloading something smaller than a word, use a general reg
352 rather than an FP reg. */
354 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
355 ((CLASS) == ALL_REGS && GET_CODE (X) == CONST_INT ? GENERAL_REGS \
356 : ((GET_MODE (X) == HImode || GET_MODE (X) == QImode) \
357 && (CLASS) == ALL_REGS) \
358 ? GENERAL_REGS \
359 : (GET_CODE (X) == CONST_DOUBLE \
360 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
361 && ! CONST_DOUBLE_OK_FOR_LETTER_P (X, 'G')) \
362 ? ((CLASS) == ALL_REGS && GET_MODE (X) == SFmode ? GENERAL_REGS \
363 : (CLASS) == GENERAL_REGS && GET_MODE (X) == SFmode ? (CLASS) \
364 : NO_REGS) \
365 : (CLASS))
367 /* Return the register class of a scratch register needed to copy IN into
368 a register in CLASS in MODE. If it can be done directly, NO_REGS is
369 returned. */
371 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS,MODE,IN) \
372 ((CLASS) == FP_REGS && CONSTANT_P (IN) ? GENERAL_REGS : NO_REGS)
374 /* Return the maximum number of consecutive registers
375 needed to represent mode MODE in a register of class CLASS. */
376 /* On the i860, this is the size of MODE in words. */
377 #define CLASS_MAX_NREGS(CLASS, MODE) \
378 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
380 /* Stack layout; function entry, exit and calling. */
382 /* Define this if pushing a word on the stack
383 makes the stack pointer a smaller address. */
384 #define STACK_GROWS_DOWNWARD
386 /* Define this if the nominal address of the stack frame
387 is at the high-address end of the local variables;
388 that is, each additional local variable allocated
389 goes at a more negative offset in the frame. */
390 #define FRAME_GROWS_DOWNWARD
392 /* Offset within stack frame to start allocating local variables at.
393 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
394 first local allocated. Otherwise, it is the offset to the BEGINNING
395 of the first local allocated. */
396 #define STARTING_FRAME_OFFSET 0
398 /* If we generate an insn to push BYTES bytes,
399 this says how many the stack pointer really advances by.
400 On the i860, don't define this because there are no push insns. */
401 /* #define PUSH_ROUNDING(BYTES) */
403 /* Offset of first parameter from the argument pointer register value. */
404 #define FIRST_PARM_OFFSET(FNDECL) 0
406 /* Value is the number of bytes of arguments automatically
407 popped when returning from a subroutine call.
408 FUNDECL is the declaration node of the function (as a tree),
409 FUNTYPE is the data type of the function (as a tree),
410 or for a library call it is an identifier node for the subroutine name.
411 SIZE is the number of bytes of arguments passed on the stack. */
413 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
415 /* Define how to find the value returned by a function.
416 VALTYPE is the data type of the value (as a tree).
417 If the precise function being called is known, FUNC is its FUNCTION_DECL;
418 otherwise, FUNC is 0. */
420 /* On the i860, the value register depends on the mode. */
422 #define FUNCTION_VALUE(VALTYPE, FUNC) \
423 gen_rtx_REG (TYPE_MODE (VALTYPE), \
424 (GET_MODE_CLASS (TYPE_MODE (VALTYPE)) == MODE_FLOAT \
425 ? 40 : 16))
427 /* Define how to find the value returned by a library function
428 assuming the value has mode MODE. */
430 #define LIBCALL_VALUE(MODE) \
431 gen_rtx_REG (MODE, \
432 (GET_MODE_CLASS ((MODE)) == MODE_FLOAT \
433 ? 40 : 16))
435 /* 1 if N is a possible register number for a function value
436 as seen by the caller. */
438 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 40 || (N) == 16)
440 /* 1 if N is a possible register number for function argument passing.
441 On the i860, these are r16-r27 and f8-f15. */
443 #define FUNCTION_ARG_REGNO_P(N) \
444 (((N) < 28 && (N) > 15) || ((N) < 48 && (N) >= 40))
446 /* Define a data type for recording info about an argument list
447 during the scan of that argument list. This data type should
448 hold all necessary information about the function itself
449 and about the args processed so far, enough to enable macros
450 such as FUNCTION_ARG to determine where the next arg should go.
452 On the i860, we must count separately the number of general registers used
453 and the number of float registers used. */
455 struct cumulative_args { int ints, floats; };
456 #define CUMULATIVE_ARGS struct cumulative_args
458 /* Initialize a variable CUM of type CUMULATIVE_ARGS
459 for a call to a function whose data type is FNTYPE.
460 For a library call, FNTYPE is 0.
462 On the i860, the general-reg offset normally starts at 0,
463 but starts at 4 bytes
464 when the function gets a structure-value-address as an
465 invisible first argument. */
467 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
468 ((CUM).ints = ((FNTYPE) != 0 && aggregate_value_p (TREE_TYPE ((FNTYPE)), 0) \
469 ? 4 : 0), \
470 (CUM).floats = 0)
472 /* Machine-specific subroutines of the following macros. */
473 #define CEILING(X,Y) (((X) + (Y) - 1) / (Y))
474 #define ROUNDUP(X,Y) (CEILING ((X), (Y)) * (Y))
476 /* Update the data in CUM to advance over an argument
477 of mode MODE and data type TYPE.
478 (TYPE is null for libcalls where that information may not be available.)
479 Floats, and doubleword ints, are returned in f regs;
480 other ints, in r regs.
481 Aggregates, even short ones, are passed in memory. */
483 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
484 ((TYPE) != 0 && (TREE_CODE ((TYPE)) == RECORD_TYPE \
485 || TREE_CODE ((TYPE)) == UNION_TYPE) \
486 ? 0 \
487 : GET_MODE_CLASS ((MODE)) == MODE_FLOAT || (MODE) == DImode \
488 ? ((CUM).floats = (ROUNDUP ((CUM).floats, GET_MODE_SIZE ((MODE))) \
489 + ROUNDUP (GET_MODE_SIZE (MODE), 4))) \
490 : GET_MODE_CLASS ((MODE)) == MODE_INT \
491 ? ((CUM).ints = (ROUNDUP ((CUM).ints, GET_MODE_SIZE ((MODE))) \
492 + ROUNDUP (GET_MODE_SIZE (MODE), 4))) \
493 : 0)
495 /* Determine where to put an argument to a function.
496 Value is zero to push the argument on the stack,
497 or a hard register in which to store the argument.
499 MODE is the argument's machine mode.
500 TYPE is the data type of the argument (as a tree).
501 This is null for libcalls where that information may
502 not be available.
503 CUM is a variable of type CUMULATIVE_ARGS which gives info about
504 the preceding args and about the function being called.
505 NAMED is nonzero if this argument is a named parameter
506 (otherwise it is an extra parameter matching an ellipsis). */
508 /* On the i860, the first 12 words of integer arguments go in r16-r27,
509 and the first 8 words of floating arguments go in f8-f15.
510 DImode values are treated as floats. */
512 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
513 ((TYPE) != 0 && (TREE_CODE ((TYPE)) == RECORD_TYPE \
514 || TREE_CODE ((TYPE)) == UNION_TYPE) \
515 ? 0 \
516 : GET_MODE_CLASS ((MODE)) == MODE_FLOAT || (MODE) == DImode \
517 ? (ROUNDUP ((CUM).floats, GET_MODE_SIZE ((MODE))) < 32 \
518 ? gen_rtx_REG ((MODE), \
519 40 + (ROUNDUP ((CUM).floats, \
520 GET_MODE_SIZE ((MODE))) \
521 / 4)) \
522 : 0) \
523 : GET_MODE_CLASS ((MODE)) == MODE_INT \
524 ? (ROUNDUP ((CUM).ints, GET_MODE_SIZE ((MODE))) < 48 \
525 ? gen_rtx_REG ((MODE), \
526 16 + (ROUNDUP ((CUM).ints, \
527 GET_MODE_SIZE ((MODE))) \
528 / 4)) \
529 : 0) \
530 : 0)
532 /* For an arg passed partly in registers and partly in memory,
533 this is the number of registers used.
534 For args passed entirely in registers or entirely in memory, zero. */
536 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
538 /* If defined, a C expression that gives the alignment boundary, in
539 bits, of an argument with the specified mode and type. If it is
540 not defined, `PARM_BOUNDARY' is used for all arguments. */
542 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
543 (((TYPE) != 0) \
544 ? ((TYPE_ALIGN(TYPE) <= PARM_BOUNDARY) \
545 ? PARM_BOUNDARY \
546 : TYPE_ALIGN(TYPE)) \
547 : ((GET_MODE_ALIGNMENT(MODE) <= PARM_BOUNDARY) \
548 ? PARM_BOUNDARY \
549 : GET_MODE_ALIGNMENT(MODE)))
551 /* Output a no-op just before the beginning of the function,
552 to ensure that there does not appear to be a delayed branch there.
553 Such a thing would confuse interrupt recovery. */
554 #define ASM_OUTPUT_FUNCTION_PREFIX(FILE,NAME) \
555 fprintf (FILE, "\tnop\n")
557 /* Output assembler code to FILE to increment profiler label # LABELNO
558 for profiling a function entry. */
560 #define FUNCTION_PROFILER(FILE, LABELNO) \
561 abort ();
563 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
564 the stack pointer does not matter. The value is tested only in
565 functions that have frame pointers.
566 No definition is equivalent to always zero. */
568 #define EXIT_IGNORE_STACK 1
570 /* Generate necessary RTL for __builtin_saveregs(). */
571 #define EXPAND_BUILTIN_SAVEREGS() \
572 i860_saveregs()
574 /* Implement `va_start' for varargs and stdarg. */
575 #define EXPAND_BUILTIN_VA_START(valist, nextarg) \
576 i860_va_start (valist, nextarg)
578 /* Implement `va_arg'. */
579 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
580 i860_va_arg (valist, type)
582 /* Store in the variable DEPTH the initial difference between the
583 frame pointer reg contents and the stack pointer reg contents,
584 as of the start of the function body. This depends on the layout
585 of the fixed parts of the stack frame and on how registers are saved.
587 On the i860, FRAME_POINTER_REQUIRED is always 1, so the definition of this
588 macro doesn't matter. But it must be defined. */
590 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
591 do { (DEPTH) = 0; } while (0)
593 /* Output assembler code for a block containing the constant parts
594 of a trampoline, leaving space for the variable parts. */
596 /* On the i860, the trampoline contains five instructions:
597 orh #TOP_OF_FUNCTION,r0,r31
598 or #BOTTOM_OF_FUNCTION,r31,r31
599 orh #TOP_OF_STATIC,r0,r29
600 bri r31
601 or #BOTTOM_OF_STATIC,r29,r29 */
602 #define TRAMPOLINE_TEMPLATE(FILE) \
604 assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0xec1f0000)); \
605 assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0xe7ff0000)); \
606 assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0xec1d0000)); \
607 assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x4000f800)); \
608 assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0xe7bd0000)); \
611 /* Length in units of the trampoline for entering a nested function. */
613 #define TRAMPOLINE_SIZE 20
615 /* Emit RTL insns to initialize the variable parts of a trampoline.
616 FNADDR is an RTX for the address of the function's pure code.
617 CXT is an RTX for the static chain value for the function.
619 Store hi function at +0, low function at +4,
620 hi static at +8, low static at +16 */
622 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
624 rtx cxt = force_reg (Pmode, CXT); \
625 rtx fn = force_reg (Pmode, FNADDR); \
626 rtx hi_cxt = expand_shift (RSHIFT_EXPR, SImode, cxt, \
627 size_int (16), 0, 0); \
628 rtx hi_fn = expand_shift (RSHIFT_EXPR, SImode, fn, \
629 size_int (16), 0, 0); \
630 emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 16)), \
631 gen_lowpart (HImode, cxt)); \
632 emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 4)), \
633 gen_lowpart (HImode, fn)); \
634 emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 8)), \
635 gen_lowpart (HImode, hi_cxt)); \
636 emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 0)), \
637 gen_lowpart (HImode, hi_fn)); \
640 /* Addressing modes, and classification of registers for them. */
642 /* #define HAVE_POST_INCREMENT 0 */
643 /* #define HAVE_POST_DECREMENT 0 */
645 /* #define HAVE_PRE_DECREMENT 0 */
646 /* #define HAVE_PRE_INCREMENT 0 */
648 /* Macros to check register numbers against specific register classes. */
650 /* These assume that REGNO is a hard or pseudo reg number.
651 They give nonzero only if REGNO is a hard reg of the suitable class
652 or a pseudo reg currently allocated to a suitable hard reg.
653 Since they use reg_renumber, they are safe only once reg_renumber
654 has been allocated, which happens in local-alloc.c. */
656 #define REGNO_OK_FOR_INDEX_P(REGNO) \
657 ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
658 #define REGNO_OK_FOR_BASE_P(REGNO) \
659 ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
660 #define REGNO_OK_FOR_FP_P(REGNO) \
661 (((REGNO) ^ 0x20) < 32 || (unsigned) (reg_renumber[REGNO] ^ 0x20) < 32)
663 /* Now macros that check whether X is a register and also,
664 strictly, whether it is in a specified class.
666 These macros are specific to the i860, and may be used only
667 in code for printing assembler insns and in conditions for
668 define_optimization. */
670 /* 1 if X is an fp register. */
672 #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
674 /* Maximum number of registers that can appear in a valid memory address. */
676 #define MAX_REGS_PER_ADDRESS 2
678 /* Recognize any constant value that is a valid address. */
680 #define CONSTANT_ADDRESS_P(X) \
681 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
682 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
683 || GET_CODE (X) == HIGH)
685 /* Nonzero if the constant value X is a legitimate general operand.
686 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
688 On the Sparc, this is anything but a CONST_DOUBLE.
689 Let's try permitting CONST_DOUBLEs and see what happens. */
691 #define LEGITIMATE_CONSTANT_P(X) 1
693 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
694 and check its validity for a certain class.
695 We have two alternate definitions for each of them.
696 The usual definition accepts all pseudo regs; the other rejects
697 them unless they have been allocated suitable hard regs.
698 The symbol REG_OK_STRICT causes the latter definition to be used.
700 Most source files want to accept pseudo regs in the hope that
701 they will get allocated to the class that the insn wants them to be in.
702 Source files for reload pass need to be strict.
703 After reload, it makes no difference, since pseudo regs have
704 been eliminated by then. */
706 #ifndef REG_OK_STRICT
708 /* Nonzero if X is a hard reg that can be used as an index
709 or if it is a pseudo reg. */
710 #define REG_OK_FOR_INDEX_P(X) (((unsigned) REGNO (X)) - 32 >= 14)
711 /* Nonzero if X is a hard reg that can be used as a base reg
712 or if it is a pseudo reg. */
713 #define REG_OK_FOR_BASE_P(X) (((unsigned) REGNO (X)) - 32 >= 14)
715 #else
717 /* Nonzero if X is a hard reg that can be used as an index. */
718 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
719 /* Nonzero if X is a hard reg that can be used as a base reg. */
720 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
722 #endif
724 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
725 that is a valid memory address for an instruction.
726 The MODE argument is the machine mode for the MEM expression
727 that wants to use this address.
729 On the i860, the actual addresses must be REG+REG or REG+SMALLINT.
730 But we can treat a SYMBOL_REF as legitimate if it is part of this
731 function's constant-pool, because such addresses can actually
732 be output as REG+SMALLINT.
734 The displacement in an address must be a multiple of the alignment.
736 Try making SYMBOL_REF (and other things which are CONSTANT_ADDRESS_P)
737 a legitimate address, regardless. Because the only insns which can use
738 memory are load or store insns, the added hair in the machine description
739 is not that bad. It should also speed up the compiler by halving the number
740 of insns it must manage for each (MEM (SYMBOL_REF ...)) involved. */
742 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
743 { if (GET_CODE (X) == REG) \
744 { if (REG_OK_FOR_BASE_P (X)) goto ADDR; } \
745 else if (GET_CODE (X) == PLUS) \
747 if (GET_CODE (XEXP (X, 0)) == REG \
748 && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
750 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
751 && INTVAL (XEXP (X, 1)) >= -0x8000 \
752 && INTVAL (XEXP (X, 1)) < 0x8000 \
753 && (INTVAL (XEXP (X, 1)) & (GET_MODE_SIZE (MODE) - 1)) == 0) \
754 goto ADDR; \
756 else if (GET_CODE (XEXP (X, 1)) == REG \
757 && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
759 if (GET_CODE (XEXP (X, 0)) == CONST_INT \
760 && INTVAL (XEXP (X, 0)) >= -0x8000 \
761 && INTVAL (XEXP (X, 0)) < 0x8000 \
762 && (INTVAL (XEXP (X, 0)) & (GET_MODE_SIZE (MODE) - 1)) == 0) \
763 goto ADDR; \
766 else if (CONSTANT_ADDRESS_P (X)) \
767 goto ADDR; \
770 /* Try machine-dependent ways of modifying an illegitimate address
771 to be legitimate. If we find one, return the new, valid address.
772 This macro is used in only one place: `memory_address' in explow.c.
774 OLDX is the address as it was before break_out_memory_refs was called.
775 In some cases it is useful to look at this to decide what needs to be done.
777 MODE and WIN are passed so that this macro can use
778 GO_IF_LEGITIMATE_ADDRESS.
780 It is always safe for this macro to do nothing. It exists to recognize
781 opportunities to optimize the output. */
783 /* On the i860, change COMPLICATED + CONSTANT to REG+CONSTANT.
784 Also change a symbolic constant to a REG,
785 though that may not be necessary. */
787 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
788 { if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \
789 (X) = gen_rtx_PLUS (SImode, XEXP (X, 1), \
790 force_operand (XEXP (X, 0), 0)); \
791 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \
792 (X) = gen_rtx_PLUS (SImode, XEXP (X, 0), \
793 force_operand (XEXP (X, 1), 0)); \
794 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == PLUS) \
795 (X) = gen_rtx_PLUS (SImode, XEXP (X, 1), \
796 force_operand (XEXP (X, 0), 0)); \
797 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == PLUS) \
798 (X) = gen_rtx_PLUS (SImode, XEXP (X, 0), \
799 force_operand (XEXP (X, 1), 0)); \
800 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) != REG \
801 && GET_CODE (XEXP (X, 0)) != CONST_INT) \
802 (X) = gen_rtx_PLUS (SImode, XEXP (X, 1), \
803 copy_to_mode_reg (SImode, XEXP (X, 0))); \
804 if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) != REG \
805 && GET_CODE (XEXP (X, 1)) != CONST_INT) \
806 (X) = gen_rtx_PLUS (SImode, XEXP (X, 0), \
807 copy_to_mode_reg (SImode, XEXP (X, 1))); \
808 if (GET_CODE (x) == SYMBOL_REF) \
809 (X) = copy_to_reg (X); \
810 if (GET_CODE (x) == CONST) \
811 (X) = copy_to_reg (X); \
812 if (memory_address_p (MODE, X)) \
813 goto WIN; }
815 /* Go to LABEL if ADDR (a legitimate address expression)
816 has an effect that depends on the machine mode it is used for.
817 On the i860 this is never true.
818 There are some addresses that are invalid in wide modes
819 but valid for narrower modes, but they shouldn't affect
820 the places that use this macro. */
822 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
824 /* Specify the machine mode that this machine uses
825 for the index in the tablejump instruction. */
826 #define CASE_VECTOR_MODE SImode
828 /* Define as C expression which evaluates to nonzero if the tablejump
829 instruction expects the table to contain offsets from the address of the
830 table.
831 Do not define this if the table should contain absolute addresses. */
832 /* #define CASE_VECTOR_PC_RELATIVE 1 */
834 /* Define this as 1 if `char' should by default be signed; else as 0. */
835 #define DEFAULT_SIGNED_CHAR 1
837 /* Max number of bytes we can move from memory to memory
838 in one reasonably fast instruction. */
839 #define MOVE_MAX 16
841 /* Nonzero if access to memory by bytes is slow and undesirable. */
842 #define SLOW_BYTE_ACCESS 0
844 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
845 is done just by pretending it is already truncated. */
846 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
848 /* Value is 1 if it generates better code to perform an unsigned comparison
849 on the given literal integer value in the given mode when we are only
850 looking for an equal/non-equal result. */
851 /* For the i860, if the immediate value has its high-order 27 bits zero,
852 then we want to engineer an unsigned comparison for EQ/NE because
853 such values can fit in the 5-bit immediate field of a bte or btne
854 instruction (which gets zero extended before comparing). For all
855 other immediate values on the i860, we will use signed compares
856 because that avoids the need for doing explicit xor's to zero_extend
857 the non-constant operand in cases where it was (mem:QI ...) or a
858 (mem:HI ...) which always gets automatically sign-extended by the
859 hardware upon loading. */
861 #define LITERAL_COMPARE_BETTER_UNSIGNED(intval, mode) \
862 (((unsigned) (intval) & 0x1f) == (unsigned) (intval))
864 /* Specify the machine mode that pointers have.
865 After generation of rtl, the compiler makes no further distinction
866 between pointers and any other objects of this machine mode. */
867 #define Pmode SImode
869 /* A function address in a call instruction
870 is a byte address (for indexing purposes)
871 so give the MEM rtx a byte's mode. */
872 #define FUNCTION_MODE SImode
874 /* Define this if addresses of constant functions
875 shouldn't be put through pseudo regs where they can be cse'd.
876 Desirable on machines where ordinary constants are expensive
877 but a CALL with constant address is cheap. */
878 #define NO_FUNCTION_CSE
880 /* Specify the cost of a branch insn; roughly the number of extra insns that
881 should be added to avoid a branch.
883 Set this to 3 on the i860 since branches may often take three cycles. */
885 #define BRANCH_COST 3
887 /* Tell final.c how to eliminate redundant test instructions. */
889 /* Here we define machine-dependent flags and fields in cc_status
890 (see `conditions.h'). */
892 /* This holds the value sourcing h%r31. We keep this info
893 around so that mem/mem ops, such as increment and decrement,
894 etc, can be performed reasonably. */
895 #define CC_STATUS_MDEP rtx
897 #define CC_STATUS_MDEP_INIT (cc_status.mdep = 0)
899 #define CC_NEGATED 01000
901 /* We use this macro in those places in the i860.md file where we would
902 normally just do a CC_STATUS_INIT (for other machines). This macro
903 differs from CC_STATUS_INIT in that it doesn't mess with the special
904 bits or fields which describe what is currently in the special r31
905 scratch register, but it does clear out everything that actually
906 relates to the condition code bit of the i860. */
908 #define CC_STATUS_PARTIAL_INIT \
909 (cc_status.flags &= (CC_KNOW_HI_R31 | CC_HI_R31_ADJ), \
910 cc_status.value1 = 0, \
911 cc_status.value2 = 0)
913 /* Nonzero if we know the value of h%r31. */
914 #define CC_KNOW_HI_R31 0100000
916 /* Nonzero if h%r31 is actually ha%something, rather than h%something. */
917 #define CC_HI_R31_ADJ 0200000
919 /* Store in cc_status the expressions
920 that the condition codes will describe
921 after execution of an instruction whose pattern is EXP.
922 Do not alter them if the instruction would not alter the cc's. */
924 /* On the i860, only compare insns set a useful condition code. */
926 #define NOTICE_UPDATE_CC(EXP, INSN) \
927 { cc_status.flags &= (CC_KNOW_HI_R31 | CC_HI_R31_ADJ); \
928 cc_status.value1 = 0; cc_status.value2 = 0; }
930 /* Control the assembler format that we output. */
932 /* Assembler pseudos to introduce constants of various size. */
934 #define ASM_DOUBLE "\t.double"
936 /* Output to assembler file text saying following lines
937 may contain character constants, extra white space, comments, etc. */
939 #define ASM_APP_ON ""
941 /* Output to assembler file text saying following lines
942 no longer contain unusual constructs. */
944 #define ASM_APP_OFF ""
946 /* Output before read-only data. */
948 #define TEXT_SECTION_ASM_OP "\t.text"
950 /* Output before writable data. */
952 #define DATA_SECTION_ASM_OP "\t.data"
954 /* How to refer to registers in assembler output.
955 This sequence is indexed by compiler's hard-register-number (see above). */
957 #define REGISTER_NAMES \
958 {"r0", "r1", "sp", "fp", "r4", "r5", "r6", "r7", "r8", "r9", \
959 "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", \
960 "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", \
961 "r30", "r31", \
962 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", \
963 "f10", "f11", "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19", \
964 "f20", "f21", "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", \
965 "f30", "f31" }
967 /* This is how to output the definition of a user-level label named NAME,
968 such as the label on a static function or variable NAME. */
970 #define ASM_OUTPUT_LABEL(FILE,NAME) \
971 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
973 /* The prefix to add to user-visible assembler symbols.
975 This definition is overridden in i860/sysv4.h because under System V
976 Release 4, user-level symbols are *not* prefixed with underscores in
977 the generated assembly code. */
979 #define USER_LABEL_PREFIX "_"
981 /* This is how to output an internal numbered label which
982 labels a jump table. */
984 #undef ASM_OUTPUT_CASE_LABEL
985 #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \
986 do { ASM_OUTPUT_ALIGN ((FILE), 2); \
987 (*targetm.asm_out.internal_label) ((FILE), PREFIX, NUM); \
988 } while (0)
990 /* Output at the end of a jump table. */
992 #define ASM_OUTPUT_CASE_END(FILE,NUM,INSN) \
993 fprintf (FILE, ".text\n")
995 /* This is how to store into the string LABEL
996 the symbol_ref name of an internal numbered label where
997 PREFIX is the class of label and NUM is the number within the class.
998 This is suitable for output with `assemble_name'. */
1000 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1001 sprintf (LABEL, "*.%s%d", PREFIX, NUM)
1003 /* This is how to output code to push a register on the stack.
1004 It need not be very fast code. */
1006 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1007 fprintf (FILE, "\taddu -16,%ssp,%ssp\n\t%sst.l %s%s,0(%ssp)\n", \
1008 i860_reg_prefix, i860_reg_prefix, \
1009 ((REGNO) < 32 ? "" : "f"), \
1010 i860_reg_prefix, reg_names[REGNO], \
1011 i860_reg_prefix)
1013 /* This is how to output an insn to pop a register from the stack.
1014 It need not be very fast code. */
1016 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1017 fprintf (FILE, "\t%sld.l 0(%ssp),%s%s\n\taddu 16,%ssp,%ssp\n", \
1018 ((REGNO) < 32 ? "" : "f"), \
1019 i860_reg_prefix, \
1020 i860_reg_prefix, reg_names[REGNO], \
1021 i860_reg_prefix, i860_reg_prefix)
1023 /* This is how to output an element of a case-vector that is absolute. */
1025 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1026 fprintf (FILE, "\t.long .L%d\n", VALUE)
1028 /* This is how to output an element of a case-vector that is relative.
1029 (The i860 does not use such vectors,
1030 but we must define this macro anyway.) */
1032 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1033 fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
1035 /* This is how to output an assembler line
1036 that says to advance the location counter
1037 to a multiple of 2**LOG bytes. */
1039 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1040 if ((LOG) != 0) \
1041 fprintf (FILE, "\t.align %d\n", 1 << (LOG))
1043 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1044 fprintf (FILE, "\t.blkb %u\n", (SIZE))
1046 /* This says how to output an assembler line
1047 to define a global common symbol. */
1049 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1050 ( fputs (".comm ", (FILE)), \
1051 assemble_name ((FILE), (NAME)), \
1052 fprintf ((FILE), ",%u\n", (ROUNDED)))
1054 /* This says how to output an assembler line
1055 to define a local common symbol. */
1057 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
1058 ( fputs (".lcomm ", (FILE)), \
1059 assemble_name ((FILE), (NAME)), \
1060 fprintf ((FILE), ",%u\n", (ROUNDED)))
1062 /* Store in OUTPUT a string (made with alloca) containing
1063 an assembler-name for a local static variable named NAME.
1064 LABELNO is an integer which is different for each call. */
1066 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1067 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1068 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1070 /* Print operand X (an rtx) in assembler syntax to file FILE.
1071 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1072 For `%' followed by punctuation, CODE is the punctuation and X is null.
1074 In the following comments, the term "constant address" is used frequently.
1075 For an exact definition of what constitutes a "constant address" see the
1076 output_addr_const routine in final.c
1078 On the i860, the following target-specific special codes are recognized:
1080 `r' The operand can be anything, but if it is an immediate zero
1081 value (either integer or floating point) then it will be
1082 represented as `r0' or as `f0' (respectively).
1084 `m' The operand is a memory ref (to a constant address) but print
1085 its address as a constant.
1087 `L' The operand is a numeric constant, a constant address, or
1088 a memory ref to a constant address. Print the correct
1089 notation to yield the low part of the given value or
1090 address or the low part of the address of the referred
1091 to memory object.
1093 `H' The operand is a numeric constant, a constant address, or
1094 a memory ref to a constant address. Print the correct
1095 notation to yield the high part of the given value or
1096 address or the high part of the address of the referred
1097 to memory object.
1099 `h' The operand is a numeric constant, a constant address, or
1100 a memory ref to a constant address. Either print the
1101 correct notation to yield the plain high part of the
1102 given value or address (or the plain high part of the
1103 address of the memory object) or else print the correct
1104 notation to yield the "adjusted" high part of the given
1105 address (or of the address of the referred to memory object).
1107 The choice of what to print depends upon whether the address
1108 in question is relocatable or not. If it is relocatable,
1109 print the notation to get the adjusted high part. Otherwise
1110 just print the notation to get the plain high part. Note
1111 that "adjusted" high parts are generally used *only* when
1112 the next following instruction uses the low part of the
1113 address as an offset, as in `offset(reg)'.
1115 `R' The operand is a floating-pointer register. Print the
1116 name of the next following (32-bit) floating-point register.
1117 (This is used when moving a value into just the most
1118 significant part of a floating-point register pair.)
1120 `?' (takes no operand) Substitute the value of i860_reg_prefix
1121 at this point. The value of i860_reg_prefix is typically
1122 a null string for most i860 targets, but for System V
1123 Release 4 the i860 assembler syntax requires that all
1124 names of registers be prefixed with a percent-sign, so
1125 for SVR4, the value of i860_reg_prefix is initialized to
1126 "%" in i860.c.
1129 extern const char *i860_reg_prefix;
1131 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '?')
1133 /* The following macro definition is overridden in i860v4.h
1134 because the svr4 i860 assembler required a different syntax
1135 for getting parts of constant/relocatable values. */
1137 #define PRINT_OPERAND_PART(FILE, X, PART_CODE) \
1138 do { fprintf (FILE, "%s%%", PART_CODE); \
1139 output_address (X); \
1140 } while (0)
1142 #define OPERAND_LOW_PART "l"
1143 #define OPERAND_HIGH_PART "h"
1144 /* NOTE: All documentation available for the i860 sez that you must
1145 use "ha" to get the relocated high part of a relocatable, but
1146 reality sez different. */
1147 #define OPERAND_HIGH_ADJ_PART "ha"
1149 #define PRINT_OPERAND(FILE, X, CODE) \
1150 { if ((CODE) == '?') \
1151 fprintf (FILE, "%s", i860_reg_prefix); \
1152 else if (CODE == 'R') \
1153 fprintf (FILE, "%s%s", i860_reg_prefix, reg_names[REGNO (X) + 1]); \
1154 else if (GET_CODE (X) == REG) \
1155 fprintf (FILE, "%s%s", i860_reg_prefix, reg_names[REGNO (X)]); \
1156 else if ((CODE) == 'm') \
1157 output_address (XEXP (X, 0)); \
1158 else if ((CODE) == 'L') \
1160 if (GET_CODE (X) == MEM) \
1161 PRINT_OPERAND_PART (FILE, XEXP (X, 0), OPERAND_LOW_PART); \
1162 else \
1163 PRINT_OPERAND_PART (FILE, X, OPERAND_LOW_PART); \
1165 else if ((CODE) == 'H') \
1167 if (GET_CODE (X) == MEM) \
1168 PRINT_OPERAND_PART (FILE, XEXP (X, 0), OPERAND_HIGH_PART); \
1169 else \
1170 PRINT_OPERAND_PART (FILE, X, OPERAND_HIGH_PART); \
1172 else if ((CODE) == 'h') \
1174 if (GET_CODE (X) == MEM) \
1175 PRINT_OPERAND_PART (FILE, XEXP (X, 0), OPERAND_HIGH_ADJ_PART); \
1176 else \
1177 PRINT_OPERAND_PART (FILE, X, OPERAND_HIGH_ADJ_PART); \
1179 else if (GET_CODE (X) == MEM) \
1180 output_address (XEXP (X, 0)); \
1181 else if ((CODE) == 'r' && (X) == const0_rtx) \
1182 fprintf (FILE, "%sr0", i860_reg_prefix); \
1183 else if ((CODE) == 'r' && (X) == CONST0_RTX (GET_MODE (X))) \
1184 fprintf (FILE, "%sf0", i860_reg_prefix); \
1185 else if (GET_CODE (X) == CONST_DOUBLE) \
1186 fprintf (FILE, "0x%lx", sfmode_constant_to_ulong (X)); \
1187 else \
1188 output_addr_const (FILE, X); }
1190 /* Print a memory address as an operand to reference that memory location. */
1192 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1193 { register rtx addr = ADDR; \
1194 if (GET_CODE (addr) == REG) \
1196 fprintf (FILE, "0(%s%s)", \
1197 i860_reg_prefix, reg_names[REGNO (addr)]); \
1199 else if (GET_CODE (addr) == CONST_DOUBLE \
1200 && GET_MODE (addr) == SFmode) \
1201 fprintf (FILE, "0x%lx", sfmode_constant_to_ulong (addr)); \
1202 else if (GET_CODE (addr) == PLUS) \
1204 if ((GET_CODE (XEXP (addr, 0)) == CONST_INT) \
1205 && (GET_CODE (XEXP (addr, 1)) == REG)) \
1206 fprintf (FILE, "%d(%s%s)", INTVAL (XEXP (addr, 0)), \
1207 i860_reg_prefix, reg_names[REGNO (XEXP (addr, 1))]);\
1208 else if ((GET_CODE (XEXP (addr, 1)) == CONST_INT) \
1209 && (GET_CODE (XEXP (addr, 0)) == REG)) \
1210 fprintf (FILE, "%d(%s%s)", INTVAL (XEXP (addr, 1)), \
1211 i860_reg_prefix, reg_names[REGNO (XEXP (addr, 0))]);\
1212 else if ((GET_CODE (XEXP (addr, 0)) == REG) \
1213 && (GET_CODE (XEXP (addr, 1)) == REG)) \
1214 fprintf (FILE, "%s%s(%s%s)", \
1215 i860_reg_prefix, reg_names[REGNO (XEXP (addr, 0))], \
1216 i860_reg_prefix, reg_names[REGNO (XEXP (addr, 1))]);\
1217 else \
1218 output_addr_const (FILE, addr); \
1220 else \
1222 output_addr_const (FILE, addr); \
1226 /* Optionally define this if you have added predicates to
1227 `MACHINE.c'. This macro is called within an initializer of an
1228 array of structures. The first field in the structure is the
1229 name of a predicate and the second field is an array of rtl
1230 codes. For each predicate, list all rtl codes that can be in
1231 expressions matched by the predicate. The list should have a
1232 trailing comma. Here is an example of two entries in the list
1233 for a typical RISC machine:
1235 #define PREDICATE_CODES \
1236 {"gen_reg_rtx_operand", {SUBREG, REG}}, \
1237 {"reg_or_short_cint_operand", {SUBREG, REG, CONST_INT}},
1239 Defining this macro does not affect the generated code (however,
1240 incorrect definitions that omit an rtl code that may be matched
1241 by the predicate can cause the compiler to malfunction).
1242 Instead, it allows the table built by `genrecog' to be more
1243 compact and efficient, thus speeding up the compiler. The most
1244 important predicates to include in the list specified by this
1245 macro are thoses used in the most insn patterns. */
1247 #define PREDICATE_CODES \
1248 {"reg_or_0_operand", {REG, SUBREG, CONST_INT}}, \
1249 {"arith_operand", {REG, SUBREG, CONST_INT}}, \
1250 {"logic_operand", {REG, SUBREG, CONST_INT}}, \
1251 {"shift_operand", {REG, SUBREG, CONST_INT}}, \
1252 {"compare_operand", {REG, SUBREG, CONST_INT}}, \
1253 {"arith_const_operand", {CONST_INT}}, \
1254 {"logic_const_operand", {CONST_INT}}, \
1255 {"bte_operand", {REG, SUBREG, CONST_INT}}, \
1256 {"indexed_operand", {MEM}}, \
1257 {"load_operand", {MEM}}, \
1258 {"small_int", {CONST_INT}}, \
1259 {"logic_int", {CONST_INT}}, \
1260 {"call_insn_operand", {MEM}},
1262 /* Define the information needed to generate branch insns. This is stored
1263 from the compare operation. Note that we can't use "rtx" here since it
1264 hasn't been defined! */
1266 extern struct rtx_def *i860_compare_op0, *i860_compare_op1;