Import final gcc2 snapshot (990109)
[official-gcc.git] / gcc / config / gmicro / gmicro.h
blob77771120e2c36b332fd8c83da683118d9e6d635c
1 /* Definitions of target machine for GNU compiler. Gmicro (TRON) version.
2 Copyright (C) 1987, 88, 89, 95, 96, 97, 1998 Free Software Foundation, Inc.
3 Contributed by Masanobu Yuhara, Fujitsu Laboratories LTD.
4 (yuhara@flab.fujitsu.co.jp)
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
24 /* Note that some other tm.h files include this one and then override
25 many of the definitions that relate to assembler syntax. */
28 /* Names to predefine in the preprocessor for this target machine. */
30 #define CPP_PREDEFINES "-Dgmicro -Acpu(tron) -Amachine(tron)"
32 /* #define CPP_SPEC ** currently not defined **/
34 /* #define CC1_SPEC ** currently not defined **/
37 /* Print subsidiary information on the compiler version in use. */
39 #define TARGET_VERSION fprintf (stderr, " (Gmicro syntax)");
42 /* Run-time compilation parameters selecting different hardware subsets. */
44 extern int target_flags;
46 /* Macros used in the machine description to test the flags. */
48 /* Compile for a Gmicro/300. */
49 #define TARGET_G300 (target_flags & 1)
50 /* Compile for a Gmicro/200. */
51 #define TARGET_G200 (target_flags & 2)
52 /* Compile for a Gmicro/100. */
53 #define TARGET_G100 (target_flags & 4)
55 /* Compile FPU insns for floating point (not library calls). */
56 #define TARGET_FPU (target_flags & 8)
58 /* Pop up arguments by called function. */
59 #define TARGET_RTD (target_flags & 0x10)
61 /* Compile passing first args in regs 0 and 1.
62 This exists only to test compiler features that will be needed for
63 RISC chips. It is not usable and is not intended to be usable on
64 this cpu ;-< */
65 #define TARGET_REGPARM (target_flags & 0x20)
67 #define TARGET_BITFIELD (target_flags & 0x40)
69 #define TARGET_NEWRETURN (target_flags & 0x80)
71 /* Do not expand __builtin_smov (strcpy) to multiple movs.
72 Use the smov instruction. */
73 #define TARGET_FORCE_SMOV (target_flags & 0x100)
75 /* default options are -m300, -mFPU,
76 with bitfield instructions added because it won't always work otherwise.
77 If there are versions of the gmicro that don't support bitfield instructions
78 then it will take some thinking to figure out how to make them work. */
79 #define TARGET_DEFAULT 0x49
81 /* Macro to define tables used to set the flags.
82 This is a list in braces of pairs in braces,
83 each pair being { "NAME", VALUE }
84 where VALUE is the bits to set or minus the bits to clear.
85 An empty string NAME is used to identify the default VALUE. */
87 #define TARGET_SWITCHES \
88 { { "g300", 1}, \
89 { "g200", 2}, \
90 { "g100", 4}, \
91 { "fpu", 8}, \
92 { "soft-float", -8}, \
93 { "rtd", 0x10}, \
94 { "no-rtd", -0x10}, \
95 { "regparm", 0x20}, \
96 { "no-regparm", -0x20}, \
97 #if 0 /* Since we don't define PCC_BITFIELD_TYPE_MATTERS or use a large
98 STRUCTURE_SIZE_BOUNDARY, we must have bitfield instructions. */
99 { "bitfield", 0x40}, \
100 { "no-bitfield", -0x40}, \
101 #endif
102 { "newreturn", 0x80}, \
103 { "no-newreturn", -0x80}, \
104 { "force-smov", 0x100}, \
105 { "no-force-smov", -0x100}, \
106 { "", TARGET_DEFAULT}}
109 /* Blow away G100 flag silently off TARGET_fpu (since we can't clear
110 any bits in TARGET_SWITCHES above) */
111 #define OVERRIDE_OPTIONS \
113 if (TARGET_G100) target_flags &= ~8; \
116 /* target machine storage layout */
118 /* Define this if most significant bit is lowest numbered
119 in instructions that operate on numbered bit-fields.
120 This is true for Gmicro insns.
121 We make it true always by avoiding using the single-bit insns
122 except in special cases with constant bit numbers. */
123 #define BITS_BIG_ENDIAN 1
125 /* Define this if most significant byte of a word is the lowest numbered. */
126 /* That is true on the Gmicro. */
127 #define BYTES_BIG_ENDIAN 1
129 /* Define this if most significant word of a multiword number is the lowest
130 numbered. */
131 /* For Gmicro we can decide arbitrarily
132 since there are no machine instructions for them. ????? */
133 #define WORDS_BIG_ENDIAN 0
135 /* number of bits in an addressable storage unit */
136 #define BITS_PER_UNIT 8
138 /* Width in bits of a "word", which is the contents of a machine register. */
139 #define BITS_PER_WORD 32
141 /* Width of a word, in units (bytes). */
142 #define UNITS_PER_WORD 4
144 /* Width in bits of a pointer.
145 See also the macro `Pmode' defined below. */
146 #define POINTER_SIZE 32
148 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
149 #define PARM_BOUNDARY 32
151 /* Boundary (in *bits*) on which stack pointer should be aligned. */
152 #define STACK_BOUNDARY 32
154 /* Allocation boundary (in *bits*) for the code of a function. */
155 /* Instructions of the Gmicro should be on half-word boundary */
156 /* But word boundary gets better performance */
157 #define FUNCTION_BOUNDARY 32
159 /* Alignment of field after `int : 0' in a structure. */
160 #define EMPTY_FIELD_BOUNDARY 32
162 /* No data type wants to be aligned rounder than this. */
163 /* This is not necessarily 32 on the Gmicro */
164 #define BIGGEST_ALIGNMENT 32
166 /* Set this non-zero if move instructions will actually fail to work
167 when given unaligned data.
168 Unaligned data is allowed on Gmicro, though the access is slow. */
170 #define STRICT_ALIGNMENT 1
171 #define SLOW_UNALIGNED_ACCESS 1
173 /* Make strings word-aligned so strcpy from constants will be faster. */
174 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
175 (TREE_CODE (EXP) == STRING_CST \
176 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
178 /* Make arrays of chars word-aligned for the same reasons. */
179 #define DATA_ALIGNMENT(TYPE, ALIGN) \
180 (TREE_CODE (TYPE) == ARRAY_TYPE \
181 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
182 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
184 /* Define number of bits in most basic integer type.
185 (If undefined, default is BITS_PER_WORD). */
186 #define INT_TYPE_SIZE 32
188 /* #define PCC_BITFIELD_TYPE_MATTERS 1 ????? */
190 /* #define CHECK_FLOAT_VALUE (MODE, VALUE) ????? */
193 /* Standard register usage. */
195 /* Number of actual hardware registers.
196 The hardware registers are assigned numbers for the compiler
197 from 0 to just below FIRST_PSEUDO_REGISTER.
198 All registers that the compiler knows about must be given numbers,
199 even those that are not normally considered general registers.
200 For the Gmicro, we give the general registers numbers 0-15,
201 and the FPU floating point registers numbers 16-31. */
202 #define FIRST_PSEUDO_REGISTER 32
204 /* 1 for registers that have pervasive standard uses
205 and are not available for the register allocator.
206 On the Gmicro, the stack pointer and the frame pointer are
207 such registers. */
208 /* frame pointer is not indicated as fixed, because fp may be used freely
209 when a frame is not built. */
210 #define FIXED_REGISTERS \
211 {0, 0, 0, 0, 0, 0, 0, 0, \
212 0, 0, 0, 0, 0, 0, 0, 1, \
213 /* FPU registers. */ \
214 0, 0, 0, 0, 0, 0, 0, 0, \
215 0, 0, 0, 0, 0, 0, 0, 0, }
217 /* 1 for registers not available across function calls.
218 These must include the FIXED_REGISTERS and also any
219 registers that can be used without being saved.
220 The latter must include the registers where values are returned
221 and the register where structure-value addresses are passed.
222 Aside from that, you can include as many other registers as you like. */
223 #define CALL_USED_REGISTERS \
224 {1, 1, 1, 1, 0, 0, 0, 0, \
225 0, 0, 0, 0, 0, 0, 0, 1, \
226 /* FPU registers. */ \
227 1, 1, 1, 1, 0, 0, 0, 0, \
228 0, 0, 0, 0, 0, 0, 0, 0, }
231 /* Make sure everything's fine if we *don't* have a given processor.
232 This assumes that putting a register in fixed_regs will keep the
233 compilers mitt's completely off it. We don't bother to zero it out
234 of register classes. If TARGET_FPU is not set,
235 the compiler won't touch since no instructions that use these
236 registers will be valid. */
237 /* This Macro is not defined now.
238 #define CONDITIONAL_REGISTER_USAGE */
240 /* The Gmicro has no overlapping register */
241 /* #define OVERLAPPING_REGNO_P(REGNO) */
243 /* #define INSN_CLOBBERS_REGNO_P(INSN,REGNO) */
244 /* #define PRESERVE_DEATH_INFO_REGNO_P(REGNO) */
246 /* Return number of consecutive hard regs needed starting at reg REGNO
247 to hold something of mode MODE.
248 This is ordinarily the length in words of a value of mode MODE
249 but can be less for certain modes in special long registers.
251 On the Gmicro, ordinary registers hold 32 bits worth;
252 for the Gmicro/FPU registers, a single register is always enough for
253 anything that can be stored in them at all. */
254 #define HARD_REGNO_NREGS(REGNO, MODE) \
255 ((REGNO) >= 16 ? 1 \
256 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
258 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
259 On the Gmicro, the cpu registers can hold any mode but the FPU registers
260 can hold only SFmode or DFmode. And the FPU registers can't hold anything
261 if FPU use is disabled. */
262 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
263 ((REGNO) < 16 \
264 || ((REGNO) < 32 \
265 ? TARGET_FPU && (GET_MODE_CLASS (MODE) == MODE_FLOAT || \
266 GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
267 : 0 ))
269 /* Value is 1 if it is a good idea to tie two pseudo registers
270 when one has mode MODE1 and one has mode MODE2.
271 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
272 for any hard reg, then this must be 0 for correct output. */
273 #define MODES_TIEABLE_P(MODE1, MODE2) \
274 (! TARGET_FPU \
275 || ((GET_MODE_CLASS (MODE1) == MODE_FLOAT || \
276 GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \
277 == ((MODE2) == SFmode || (MODE2) == DFmode)))
279 /* Specify the registers used for certain standard purposes.
280 The values of these macros are register numbers. */
282 /* Gmicro pc isn't overloaded on a register. */
283 /* #define PC_REGNUM */
285 /* Register to use for pushing function arguments. */
286 #define STACK_POINTER_REGNUM 15
288 /* Base register for access to local variables of the function. */
289 #define FRAME_POINTER_REGNUM 14
291 /* Value should be nonzero if functions must have frame pointers.
292 Zero means the frame pointer need not be set up (and parms
293 may be accessed via the stack pointer) in functions that seem suitable.
294 This is computed in `reload', in reload1.c. */
295 #define FRAME_POINTER_REQUIRED 0
297 /* Base register for access to arguments of the function. */
298 /* The Gmicro does not have hardware ap. Fp is treated as ap */
299 #define ARG_POINTER_REGNUM 14
301 /* Register in which static-chain is passed to a function. */
302 #define STATIC_CHAIN_REGNUM 0
304 /* Register in which address to store a structure value
305 is passed to a function. */
306 #define STRUCT_VALUE_REGNUM 1
308 /* Define the classes of registers for register constraints in the
309 machine description. Also define ranges of constants.
311 One of the classes must always be named ALL_REGS and include all hard regs.
312 If there is more than one class, another class must be named NO_REGS
313 and contain no registers.
315 The name GENERAL_REGS must be the name of a class (or an alias for
316 another name such as ALL_REGS). This is the class of registers
317 that is allowed by "g" or "r" in a register constraint.
318 Also, registers outside this class are allocated only when
319 instructions express preferences for them.
321 The classes must be numbered in nondecreasing order; that is,
322 a larger-numbered class must never be contained completely
323 in a smaller-numbered class.
325 For any two classes, it is very desirable that there be another
326 class that represents their union. */
328 /* The Gmicro has two kinds of registers, so four classes would be
329 a complete set. */
331 enum reg_class { NO_REGS, FPU_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES };
333 #define N_REG_CLASSES (int) LIM_REG_CLASSES
335 /* Give names of register classes as strings for dump file. */
337 #define REG_CLASS_NAMES \
338 { "NO_REGS", "FPU_REGS", "GENERAL_REGS", "ALL_REGS" }
340 /* Define which registers fit in which classes.
341 This is an initializer for a vector of HARD_REG_SET
342 of length N_REG_CLASSES. */
344 #define REG_CLASS_CONTENTS \
346 0, /* NO_REGS */ \
347 0xffff0000, /* FPU_REGS */ \
348 0x0000ffff, /* GENERAL_REGS */ \
349 0xffffffff /* ALL_REGS */ \
352 /* The same information, inverted:
353 Return the class number of the smallest class containing
354 reg number REGNO. This could be a conditional expression
355 or could index an array. */
357 extern enum reg_class regno_reg_class[];
358 #define REGNO_REG_CLASS(REGNO) ( (REGNO < 16) ? GENERAL_REGS : FPU_REGS )
360 /* The class value for index registers, and the one for base regs. */
362 #define INDEX_REG_CLASS GENERAL_REGS
363 #define BASE_REG_CLASS GENERAL_REGS
365 /* Get reg_class from a letter such as appears in the machine description.
366 We do a trick here to modify the effective constraints on the
367 machine description; we zorch the constraint letters that aren't
368 appropriate for a specific target. This allows us to guarantee
369 that a specific kind of register will not be used for a given target
370 without fiddling with the register classes above. */
372 #define REG_CLASS_FROM_LETTER(C) \
373 ((C) == 'r' ? GENERAL_REGS : \
374 ((C) == 'f' ? (TARGET_FPU ? FPU_REGS : NO_REGS) : \
375 NO_REGS))
377 /* The letters I, J, K, L and M in a register constraint string
378 can be used to stand for particular ranges of immediate operands.
379 This macro defines what the ranges are.
380 C is the letter, and VALUE is a constant value.
381 Return 1 if VALUE is in the range specified by C.
383 For the Gmicro, all immediate value optimizations are done
384 by assembler, so no machine dependent definition is necessary ??? */
386 /* #define CONST_OK_FOR_LETTER_P(VALUE, C) ((C) == 'I') */
387 #define CONST_OK_FOR_LETTER_P(VALUE, C) 0
390 * The letters G defines all of the floating constants tha are *NOT*
391 * Gmicro-FPU constant.
394 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
395 ((C) == 'F' || \
396 (C) == 'G' && !(TARGET_FPU && standard_fpu_constant_p (VALUE)))
398 /* Given an rtx X being reloaded into a reg required to be
399 in class CLASS, return the class of reg to actually use.
400 In general this is just CLASS; but on some machines
401 in some cases it is preferable to use a more restrictive class. */
402 /* On the Gmicro series, there is no restriction on GENERAL_REGS,
403 so CLASS is returned. I do not know whether I should treat FPU_REGS
404 specially or not (at least, m68k does not). */
406 #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
408 /* Return the maximum number of consecutive registers
409 needed to represent mode MODE in a register of class CLASS. */
410 /* On the Gmicro, this is the size of MODE in words,
411 except in the FPU regs, where a single reg is always enough. */
412 #define CLASS_MAX_NREGS(CLASS, MODE) \
413 ((CLASS) == FPU_REGS ? \
414 1 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
416 /* Stack layout; function entry, exit and calling. */
418 /* Define this if pushing a word on the stack
419 makes the stack pointer a smaller address. */
420 #define STACK_GROWS_DOWNWARD
422 /* Define this if the nominal address of the stack frame
423 is at the high-address end of the local variables;
424 that is, each additional local variable allocated
425 goes at a more negative offset in the frame. */
426 #define FRAME_GROWS_DOWNWARD
428 /* Offset within stack frame to start allocating local variables at.
429 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
430 first local allocated. Otherwise, it is the offset to the BEGINNING
431 of the first local allocated. */
432 /* On the Gmicro, FP points to the old FP and the first local variables are
433 at (FP - 4). */
434 #define STARTING_FRAME_OFFSET 0
436 /* If we generate an insn to push BYTES bytes,
437 this says how many the stack pointer really advances by. */
438 /* On the Gmicro, sp is decremented by the exact size of the operand */
439 #define PUSH_ROUNDING(BYTES) (BYTES)
441 /* Offset of first parameter from the argument pointer register value. */
442 /* On the Gmicro, the first argument is found at (ap + 8) where ap is fp. */
443 #define FIRST_PARM_OFFSET(FNDECL) 8
445 /* Value is the number of byte of arguments automatically
446 popped when returning from a subroutine call.
447 FUNDECL is the declaration node of the function (as a tree),
448 FUNTYPE is the data type of the function (as a tree),
449 or for a library call it is an identifier node for the subroutine name.
450 SIZE is the number of bytes of arguments passed on the stack.
452 On the Gmicro, the EXITD insn may be used to pop them if the number
453 of args is fixed, but if the number is variable then the caller must pop
454 them all. The adjsp operand of the EXITD insn can't be used for library
455 calls now because the library is compiled with the standard compiler.
456 Use of adjsp operand is a selectable option, since it is incompatible with
457 standard Unix calling sequences. If the option is not selected,
458 the caller must always pop the args.
459 On the m68k this is an RTD option, so I use the same name
460 for the Gmicro. The option name may be changed in the future. */
462 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
463 ((TARGET_RTD && (!(FUNDECL) || TREE_CODE (FUNDECL) != IDENTIFIER_NODE) \
464 && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
465 || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
466 == void_type_node))) \
467 ? (SIZE) : 0)
469 /* Define how to find the value returned by a function.
470 VALTYPE is the data type of the value (as a tree).
471 If the precise function being called is known, FUNC is its FUNCTION_DECL;
472 otherwise, FUNC is 0. */
474 /* On the Gmicro the floating return value is in fr0 not r0. */
476 #define FUNCTION_VALUE(VALTYPE, FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
478 /* Define how to find the value returned by a library function
479 assuming the value has mode MODE. */
481 #define LIBCALL_VALUE(MODE) \
482 (gen_rtx_REG ((MODE), \
483 ((TARGET_FPU && ((MODE) == SFmode || (MODE) == DFmode)) \
484 ? 16 : 0)))
487 /* 1 if N is a possible register number for a function value.
488 On the Gmicro, r0 and fp0 are the possible registers. */
490 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N) == 16)
492 /* Define this if PCC uses the nonreentrant convention for returning
493 structure and union values. */
495 #define PCC_STATIC_STRUCT_RETURN
497 /* 1 if N is a possible register number for function argument passing.
498 On the Gmicro, no registers are used in this way. */
499 /* Really? For the performance improvement, registers should be used !! */
501 #define FUNCTION_ARG_REGNO_P(N) 0
503 /* Define a data type for recording info about an argument list
504 during the scan of that argument list. This data type should
505 hold all necessary information about the function itself
506 and about the args processed so far, enough to enable macros
507 such as FUNCTION_ARG to determine where the next arg should go.
509 On the Gmicro, this is a single integer, which is a number of bytes
510 of arguments scanned so far. */
512 #define CUMULATIVE_ARGS int
514 /* Initialize a variable CUM of type CUMULATIVE_ARGS
515 for a call to a function whose data type is FNTYPE.
516 For a library call, FNTYPE is 0.
518 On the Gmicro, the offset starts at 0. */
520 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
521 ((CUM) = 0)
523 /* Update the data in CUM to advance over an argument
524 of mode MODE and data type TYPE.
525 (TYPE is null for libcalls where that information may not be available.) */
527 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
528 ((CUM) += ((MODE) != BLKmode \
529 ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
530 : (int_size_in_bytes (TYPE) + 3) & ~3))
532 /* Define where to put the arguments to a function.
533 Value is zero to push the argument on the stack,
534 or a hard register in which to store the argument.
536 MODE is the argument's machine mode.
537 TYPE is the data type of the argument (as a tree).
538 This is null for libcalls where that information may
539 not be available.
540 CUM is a variable of type CUMULATIVE_ARGS which gives info about
541 the preceding args and about the function being called.
542 NAMED is nonzero if this argument is a named parameter
543 (otherwise it is an extra parameter matching an ellipsis). */
545 /* On the Gmicro all args are pushed, except if -mregparm is specified
546 then the first two words of arguments are passed in d0, d1.
547 *NOTE* -mregparm does not work.
548 It exists only to test register calling conventions. */
550 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
551 ((TARGET_REGPARM && (CUM) < 8) ? gen_rtx_REG ((MODE), (CUM) / 4) : 0)
553 /* For an arg passed partly in registers and partly in memory,
554 this is the number of registers used.
555 For args passed entirely in registers or entirely in memory, zero. */
557 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
558 ((TARGET_REGPARM && (CUM) < 8 \
559 && 8 < ((CUM) + ((MODE) == BLKmode \
560 ? int_size_in_bytes (TYPE) \
561 : GET_MODE_SIZE (MODE)))) \
562 ? 2 - (CUM) / 4 : 0)
564 /* The following macro is defined to output register list.
565 The LSB of Mask is the lowest number register.
566 Regoff is MY_GREG_OFF or MY_FREG_OFF.
567 Do NOT use <i> in File, Mask, Regoff !!
568 Should be changed from macros to functions. M.Yuhara */
570 #define MY_GREG_OFF 0
571 #define MY_FREG_OFF 16
573 #define MY_PRINT_MASK(File, Mask, Regoff) \
575 int i, first = -1; \
576 if ((Mask) == 0) { \
577 fprintf(File, "#0"); \
578 } else { \
579 fprintf(File, "("); \
580 for (i = 0; i < 16; i++) { \
581 if ( (Mask) & (1 << i) ) { \
582 if (first < 0) { \
583 if (first == -2) { \
584 fprintf(File, ","); \
586 first = i; \
587 fprintf(File, "%s", reg_names[Regoff + i]); \
589 } else if (first >= 0) { \
590 if (i > first + 1) { \
591 fprintf(File, "-%s", reg_names[Regoff + i - 1]); \
593 first = -2; \
596 if ( (first >= 0) && (first != 15) ) \
597 fprintf(File, "-%s", reg_names[Regoff + 15]);\
598 fprintf(File, ")"); \
603 #define MY_PRINT_ONEREG_L(FILE,MASK) \
604 { register int i; \
605 for (i = 0; i < 16; i++) \
606 if ( (1 << i) & (MASK)) { \
607 fprintf(FILE, "%s", reg_names[i]); \
608 (MASK) &= ~(1 << i); \
609 break; \
614 #define MY_PRINT_ONEREG_H(FILE,MASK) \
615 { register int i; \
616 for (i = 15; i >= 0; i--) \
617 if ( (1 << i) & (MASK)) { \
618 fprintf(FILE, "%s", reg_names[i]); \
619 (MASK) &= ~(1 << i); \
620 break; \
624 /* This macro generates the assembly code for function entry.
625 FILE is a stdio stream to output the code to.
626 SIZE is an int: how many units of temporary storage to allocate.
627 Refer to the array `regs_ever_live' to determine which registers
628 to save; `regs_ever_live[I]' is nonzero if register number I
629 is ever used in the function. This macro is responsible for
630 knowing which registers should not be saved even if used. */
632 /* The next macro needs much optimization !!
633 M.Yuhara */
635 #define FUNCTION_PROLOGUE(FILE, SIZE) \
636 { register int regno; \
637 register int mask = 0; \
638 register int nregs = 0; \
639 static char *reg_names[] = REGISTER_NAMES; \
640 extern char call_used_regs[]; \
641 int fsize = ((SIZE) + 3) & -4; \
642 for (regno = 0; regno < 16; regno++) \
643 if (regs_ever_live[regno] && !call_used_regs[regno]) { \
644 mask |= (1 << regno); \
645 nregs++; \
647 if (frame_pointer_needed) { \
648 mask &= ~(1 << FRAME_POINTER_REGNUM); \
649 if (nregs > 4) { \
650 fprintf(FILE, "\tenter.w #%d,", fsize); \
651 MY_PRINT_MASK(FILE, mask, MY_GREG_OFF); \
652 fprintf(FILE,"\n"); \
653 } else { \
654 fprintf(FILE, "\tmov.w fp,@-sp\n"); \
655 fprintf(FILE, "\tmov.w sp,fp\n"); \
656 if (fsize > 0) \
657 myoutput_sp_adjust(FILE, "sub", fsize); \
658 while (nregs--) { \
659 fprintf(FILE, "\tmov.w "); \
660 MY_PRINT_ONEREG_H(FILE, mask); \
661 fprintf(FILE, ",@-sp\n"); \
664 } else { \
665 if (fsize > 0) \
666 myoutput_sp_adjust(FILE, "sub", fsize); \
667 if (mask != 0) { \
668 if (nregs > 4) { \
669 fprintf(FILE, "\tstm.w "); \
670 MY_PRINT_MASK(FILE, mask, MY_GREG_OFF); \
671 fprintf(FILE, ",@-sp\n"); \
672 } else { \
673 while (nregs--) { \
674 fprintf(FILE, "\tmov.w "); \
675 MY_PRINT_ONEREG_H(FILE, mask); \
676 fprintf(FILE, ",@-sp\n"); \
681 mask = 0; \
682 for (regno = 16; regno < 32; regno++) \
683 if (regs_ever_live[regno] && !call_used_regs[regno]) \
684 mask |= 1 << (regno - 16); \
685 if (mask != 0) { \
686 fprintf(FILE, "\tfstm.w "); \
687 MY_PRINT_MASK(FILE, mask, MY_FREG_OFF); \
688 fprintf(FILE, ",@-sp\n", mask); \
693 /* Output assembler code to FILE to increment profiler label # LABELNO
694 for profiling a function entry. */
695 /* ??? M.Yuhara */
697 #define FUNCTION_PROFILER(FILE, LABELNO) \
698 fprintf (FILE, "\tmova @LP%d,r0\n\tjsr mcount\n", (LABELNO))
700 /* Output assembler code to FILE to initialize this source file's
701 basic block profiling info, if that has not already been done. */
703 #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
704 fprintf (FILE, "\tcmp #0,@LPBX0\n\tbne LPI%d\n\tpusha @LPBX0\n\tjsr ___bb_init_func\n\tadd #4,sp\nLPI%d:\n", \
705 LABELNO, LABELNO);
707 /* Output assembler code to FILE to increment the entry-count for
708 the BLOCKNO'th basic block in this source file. */
710 #define BLOCK_PROFILER(FILE, BLOCKNO) \
711 fprintf (FILE, "\tadd #1,@(LPBX2+%d)\n", 4 * BLOCKNO)
713 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
714 the stack pointer does not matter. The value is tested only in
715 functions that have frame pointers.
716 No definition is equivalent to always zero. */
718 #define EXIT_IGNORE_STACK 1
720 /* This macro generates the assembly code for function exit,
721 on machines that need it. If FUNCTION_EPILOGUE is not defined
722 then individual return instructions are generated for each
723 return statement. Args are same as for FUNCTION_PROLOGUE.
725 The function epilogue should not depend on the current stack pointer (when
726 frame_pinter_needed) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
727 It should use the frame pointer only. This is mandatory because
728 of alloca; we also take advantage of it to omit stack adjustments
729 before returning. */
731 /* The Gmicro FPU seems to be unable to fldm/fstm double or single
732 floating. It only allows extended !! */
733 /* Optimization is not enough, especially FREGs load !! M.Yuhara */
735 #define FUNCTION_EPILOGUE(FILE, SIZE) \
736 { register int regno; \
737 register int mask, fmask; \
738 register int nregs, nfregs; \
739 int offset, foffset; \
740 extern char call_used_regs[]; \
741 static char *reg_names[] = REGISTER_NAMES; \
742 int fsize = ((SIZE) + 3) & -4; \
743 FUNCTION_EXTRA_EPILOGUE (FILE, SIZE); \
744 nfregs = 0; fmask = 0; \
745 for (regno = 16; regno < 31; regno++) \
746 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
747 { nfregs++; fmask |= 1 << (regno - 16); } \
748 foffset = nfregs * 12; \
749 nregs = 0; mask = 0; \
750 if (frame_pointer_needed) regs_ever_live[FRAME_POINTER_REGNUM] = 0; \
751 for (regno = 0; regno < 16; regno++) \
752 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
753 { nregs++; mask |= 1 << regno; } \
754 if (frame_pointer_needed) { \
755 offset = nregs * 4 + fsize; \
756 if (nfregs > 0) { \
757 fprintf(FILE, "\tfldm.x @(%d,fp),", -(foffset + offset));\
758 MY_PRINT_MASK(FILE, fmask, MY_FREG_OFF); \
759 fprintf(FILE, "\n"); \
761 if (nregs > 4 \
762 || current_function_pops_args) { \
763 fprintf(FILE, "\tmova @(%d,fp),sp\n", -offset); \
764 fprintf(FILE, "\texitd "); \
765 MY_PRINT_MASK(FILE, mask, MY_GREG_OFF); \
766 fprintf(FILE, ",#%d\n", current_function_pops_args); \
767 } else { \
768 while (nregs--) { \
769 fprintf(FILE, "\tmov:l.w @(%d,fp),", -offset); \
770 MY_PRINT_ONEREG_L(FILE, mask); \
771 fprintf(FILE, "\n"); \
772 offset -= 4; \
774 if (TARGET_NEWRETURN) { \
775 fprintf(FILE, "\tmova.w @(4,fp),sp\n"); \
776 fprintf(FILE, "\tmov:l.w @fp,fp\n"); \
777 } else { \
778 fprintf(FILE, "\tmov.w fp,sp\n"); \
779 fprintf(FILE, "\tmov.w @sp+,fp\n"); \
781 fprintf(FILE, "\trts\n"); \
783 } else { \
784 if (nfregs > 0) { \
785 fprintf(FILE, "\tfldm.w @sp+,"); \
786 MY_PRINT_MASK(FILE, fmask, MY_FREG_OFF); \
787 fprintf(FILE, "\n"); \
789 if (nregs > 4) { \
790 fprintf(FILE, "\tldm.w @sp+,"); \
791 MY_PRINT_MASK(FILE, mask, MY_GREG_OFF); \
792 fprintf(FILE, "\n"); \
793 } else { \
794 while (nregs--) { \
795 fprintf(FILE, "\tmov.w @sp+,"); \
796 MY_PRINT_ONEREG_L(FILE,mask); \
797 fprintf(FILE, "\n"); \
800 if (current_function_pops_args) { \
801 myoutput_sp_adjust(FILE, "add", \
802 (fsize + 4 + current_function_pops_args)); \
803 fprintf(FILE, "\tjmp @(%d,sp)\n", current_function_pops_args);\
804 } else { \
805 if (fsize > 0) \
806 myoutput_sp_adjust(FILE, "add", fsize); \
807 fprintf(FILE, "\trts\n"); \
812 /* This is a hook for other tm files to change. */
813 #define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE)
815 /* If the memory address ADDR is relative to the frame pointer,
816 correct it to be relative to the stack pointer instead.
817 This is for when we don't use a frame pointer.
818 ADDR should be a variable name. */
820 /* You have to change the next macro if you want to use more complex
821 addressing modes (such as double indirection and more than one
822 chain-addressing stages). */
824 #define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) \
825 { int offset = -1; \
826 rtx regs = stack_pointer_rtx; \
827 if (ADDR == frame_pointer_rtx) \
828 offset = 0; \
829 else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 0) == frame_pointer_rtx \
830 && GET_CODE (XEXP (ADDR, 1)) == CONST_INT) \
831 offset = INTVAL (XEXP (ADDR, 1)); \
832 else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 0) == frame_pointer_rtx) \
833 { rtx other_reg = XEXP (ADDR, 1); \
834 offset = 0; \
835 regs = gen_rtx_PLUS (Pmode, stack_pointer_rtx, other_reg); } \
836 else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 1) == frame_pointer_rtx) \
837 { rtx other_reg = XEXP (ADDR, 0); \
838 offset = 0; \
839 regs = gen_rtx_PLUS (Pmode, stack_pointer_rtx, other_reg); } \
840 else if (GET_CODE (ADDR) == PLUS \
841 && GET_CODE (XEXP (ADDR, 0)) == PLUS \
842 && XEXP (XEXP (ADDR, 0), 0) == frame_pointer_rtx \
843 && GET_CODE (XEXP (ADDR, 1)) == CONST_INT) \
844 { rtx other_reg = XEXP (XEXP (ADDR, 0), 1); \
845 offset = INTVAL (XEXP (ADDR, 1)); \
846 regs = gen_rtx_PLUS (Pmode, stack_pointer_rtx, other_reg); } \
847 else if (GET_CODE (ADDR) == PLUS \
848 && GET_CODE (XEXP (ADDR, 0)) == PLUS \
849 && XEXP (XEXP (ADDR, 0), 1) == frame_pointer_rtx \
850 && GET_CODE (XEXP (ADDR, 1)) == CONST_INT) \
851 { rtx other_reg = XEXP (XEXP (ADDR, 0), 0); \
852 offset = INTVAL (XEXP (ADDR, 1)); \
853 regs = gen_rtx_PLUS (Pmode, stack_pointer_rtx, other_reg); } \
854 if (offset >= 0) \
855 { int regno; \
856 extern char call_used_regs[]; \
857 for (regno = 16; regno < 32; regno++) \
858 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
859 offset += 12; \
860 for (regno = 0; regno < 16; regno++) \
861 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
862 offset += 4; \
863 offset -= 4; \
864 ADDR = plus_constant (regs, offset + (DEPTH)); } }
866 /* Addressing modes, and classification of registers for them. */
868 /* #define HAVE_POST_INCREMENT */
869 /* #define HAVE_POST_DECREMENT */
871 /* #define HAVE_PRE_DECREMENT */
872 /* #define HAVE_PRE_INCREMENT */
874 /* Macros to check register numbers against specific register classes. */
876 /* These assume that REGNO is a hard or pseudo reg number.
877 They give nonzero only if REGNO is a hard reg of the suitable class
878 or a pseudo reg currently allocated to a suitable hard reg.
879 Since they use reg_renumber, they are safe only once reg_renumber
880 has been allocated, which happens in local-alloc.c. */
882 /* Gmicro */
883 #define REGNO_OK_FOR_GREG_P(REGNO) \
884 ((REGNO) < 16 || (unsigned) reg_renumber[REGNO] < 16)
885 #define REGNO_OK_FOR_FPU_P(REGNO) \
886 (((REGNO) ^ 0x10) < 16 || (unsigned) (reg_renumber[REGNO] ^ 0x10) < 16)
888 #define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_GREG_P(REGNO)
889 #define REGNO_OK_FOR_BASE_P(REGNO) REGNO_OK_FOR_GREG_P(REGNO)
891 /* Now macros that check whether X is a register and also,
892 strictly, whether it is in a specified class.
894 These macros are specific to the Gmicro, and may be used only
895 in code for printing assembler insns and in conditions for
896 define_optimization. */
898 /* 1 if X is an fpu register. */
900 #define FPU_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FPU_P (REGNO (X)))
902 /* I used GREG_P in the gmicro.md file. */
904 #ifdef REG_OK_STRICT
905 #define GREG_P(X) (REG_P (X) && REGNO_OK_FOR_GREG_P (REGNO(X)))
906 #else
907 #define GREG_P(X) (REG_P (X) && ((REGNO (X) & ~0xf) != 0x10))
908 #endif
910 /* Maximum number of registers that can appear in a valid memory address. */
912 /* The Gmicro allows more registers in the chained addressing mode.
913 But I do not know gcc supports such an architecture. */
915 #define MAX_REGS_PER_ADDRESS 2
917 /* Recognize any constant value that is a valid address. */
919 #define CONSTANT_ADDRESS_P(X) \
920 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
921 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
922 || GET_CODE (X) == HIGH)
924 /* Nonzero if the constant value X is a legitimate general operand.
925 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
927 #define LEGITIMATE_CONSTANT_P(X) 1
929 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
930 and check its validity for a certain class.
931 We have two alternate definitions for each of them.
932 The usual definition accepts all pseudo regs; the other rejects
933 them unless they have been allocated suitable hard regs.
934 The symbol REG_OK_STRICT causes the latter definition to be used.
936 Most source files want to accept pseudo regs in the hope that
937 they will get allocated to the class that the insn wants them to be in.
938 Source files for reload pass need to be strict.
939 After reload, it makes no difference, since pseudo regs have
940 been eliminated by then. */
942 #ifndef REG_OK_STRICT
944 /* Nonzero if X is a hard reg that can be used as an index
945 or if it is a pseudo reg. */
946 #define REG_OK_FOR_INDEX_P(X) ((REGNO (X) & ~0xf) != 0x10)
947 /* Nonzero if X is a hard reg that can be used as a base reg
948 or if it is a pseudo reg. */
949 #define REG_OK_FOR_BASE_P(X) ((REGNO (X) & ~0xf) != 0x10)
951 #else
953 /* Nonzero if X is a hard reg that can be used as an index. */
954 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
955 /* Nonzero if X is a hard reg that can be used as a base reg. */
956 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
958 #endif
960 /* The gcc uses the following effective address of the Gmicro.
961 (without using PC!!).
962 {@} ( {Rbase} + {Disp} + {Rindex * [1,2,4,8]} )
963 where
964 @: memory indirection.
965 Rbase: Base Register = General Register.
966 Disp: Displacement (up to 32bits)
967 Rindex: Index Register = General Register.
968 [1,2,4,8]: Scale of Index. 1 or 2 or 4 or 8.
969 The inside of { } can be omitted.
970 This restricts the chained addressing up to 1 stage. */
974 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
975 that is a valid memory address for an instruction.
976 The MODE argument is the machine mode for the MEM expression
977 that wants to use this address.
979 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
980 except for CONSTANT_ADDRESS_P which is actually machine-independent. */
982 #define REG_CODE_BASE_P(X) \
983 (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))
985 #define REG_CODE_INDEX_P(X) \
986 (GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X))
988 /* GET_CODE(X) must be PLUS. This macro does not check for PLUS! */
989 #define BASE_PLUS_DISP_P(X) \
990 ( REG_CODE_BASE_P (XEXP (X, 0)) \
991 && CONSTANT_ADDRESS_P (XEXP (X, 1)) \
992 || \
993 REG_CODE_BASE_P (XEXP (X, 1)) \
994 && CONSTANT_ADDRESS_P (XEXP (X, 0)) )
996 /* 1 if X is {0,Rbase} + {0,disp}. */
997 #define BASED_ADDRESS_P(X) \
998 (CONSTANT_ADDRESS_P (X) \
999 || REG_CODE_BASE_P (X) \
1000 || (GET_CODE (X) == PLUS) \
1001 && BASE_PLUS_DISP_P (X))
1003 /* 1 if X is 1 or 2 or 4 or 8. GET_CODE(X) must be CONST_INT. */
1004 #define SCALE_OF_INDEX_P(X) \
1005 ( INTVAL(X) == 4 \
1006 || INTVAL(X) == 2 \
1007 || INTVAL(X) == 8 \
1008 || INTVAL(X) == 1 )
1010 /* #define INDEX_TERM_P(X,MODE) */
1011 #define INDEX_TERM_P(X) \
1012 ( REG_CODE_INDEX_P(X) \
1013 || (GET_CODE (X) == MULT \
1014 && ( (xfoo0 = XEXP (X, 0)), (xfoo1 = XEXP(X, 1)), \
1015 ( ( (GET_CODE (xfoo0) == CONST_INT) \
1016 && SCALE_OF_INDEX_P (xfoo0) \
1017 && REG_CODE_INDEX_P (xfoo1) ) \
1018 || \
1019 ( (GET_CODE (xfoo1) == CONST_INT) \
1020 && SCALE_OF_INDEX_P (xfoo1) \
1021 && REG_CODE_INDEX_P (xfoo0) ) ))))
1023 /* Assumes there are no cases such that X = (Ireg + Disp) + Disp */
1024 #define BASE_DISP_INDEX_P(X) \
1025 ( BASED_ADDRESS_P (X) \
1026 || ( (GET_CODE (X) == PLUS) \
1027 && ( ( (xboo0 = XEXP (X, 0)), (xboo1 = XEXP (X, 1)), \
1028 (REG_CODE_BASE_P (xboo0) \
1029 && (GET_CODE (xboo1) == PLUS) \
1030 && ( ( CONSTANT_ADDRESS_P (XEXP (xboo1, 0)) \
1031 && INDEX_TERM_P (XEXP (xboo1, 1)) ) \
1032 || ( CONSTANT_ADDRESS_P (XEXP (xboo1, 1)) \
1033 && INDEX_TERM_P (XEXP (xboo1, 0))) ))) \
1034 || \
1035 (CONSTANT_ADDRESS_P (xboo0) \
1036 && (GET_CODE (xboo1) == PLUS) \
1037 && ( ( REG_CODE_BASE_P (XEXP (xboo1, 0)) \
1038 && INDEX_TERM_P (XEXP (xboo1, 1)) ) \
1039 || ( REG_CODE_BASE_P (XEXP (xboo1, 1)) \
1040 && INDEX_TERM_P (XEXP (xboo1, 0))) )) \
1041 || \
1042 (INDEX_TERM_P (xboo0) \
1043 && ( ( (GET_CODE (xboo1) == PLUS) \
1044 && ( ( REG_CODE_BASE_P (XEXP (xboo1, 0)) \
1045 && CONSTANT_ADDRESS_P (XEXP (xboo1, 1)) ) \
1046 || ( REG_CODE_BASE_P (XEXP (xboo1, 1)) \
1047 && CONSTANT_ADDRESS_P (XEXP (xboo1, 0))) )) \
1048 || \
1049 (CONSTANT_ADDRESS_P (xboo1)) \
1050 || \
1051 (REG_CODE_BASE_P (xboo1)) )))))
1054 If you want to allow double-indirection,
1055 you have to change the <fp-relative> => <sp-relative> conversion
1056 routine. M.Yuhara
1058 #ifdef REG_OK_STRICT
1059 #define DOUBLE_INDIRECTION(X,ADDR) {\
1060 if (BASE_DISP_INDEX_P (XEXP (XEXP (X, 0), 0) )) goto ADDR; \
1062 #else
1063 #define DOUBLE_INDIRECTION(X,ADDR) { }
1064 #endif
1068 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) {\
1069 register rtx xboo0, xboo1, xfoo0, xfoo1; \
1070 if (GET_CODE (X) == MEM) { \
1071 /* \
1072 if (GET_CODE (XEXP (X,0)) == MEM) { \
1073 DOUBLE_INDIRECTION(X,ADDR); \
1074 } else { \
1075 if (BASE_DISP_INDEX_P (XEXP (X, 0))) goto ADDR; \
1077 */ \
1078 } else { \
1079 if (BASE_DISP_INDEX_P (X)) goto ADDR; \
1080 if ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \
1081 && REG_P (XEXP (X, 0)) \
1082 && (REGNO (XEXP (X, 0)) == STACK_POINTER_REGNUM)) \
1083 goto ADDR; \
1088 /* Try machine-dependent ways of modifying an illegitimate address
1089 to be legitimate. If we find one, return the new, valid address.
1090 This macro is used in only one place: `memory_address' in explow.c.
1092 OLDX is the address as it was before break_out_memory_refs was called.
1093 In some cases it is useful to look at this to decide what needs to be done.
1095 MODE and WIN are passed so that this macro can use
1096 GO_IF_LEGITIMATE_ADDRESS.
1098 It is always safe for this macro to do nothing. It exists to recognize
1099 opportunities to optimize the output.
1101 For the Gmicro, nothing is done now. */
1103 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
1105 /* Go to LABEL if ADDR (a legitimate address expression)
1106 has an effect that depends on the machine mode it is used for.
1107 On the VAX, the predecrement and postincrement address depend thus
1108 (the amount of decrement or increment being the length of the operand)
1109 and all indexed address depend thus (because the index scale factor
1110 is the length of the operand).
1111 The Gmicro mimics the VAX now. Since ADDE is legitimate, it cannot
1112 include auto-inc/dec. */
1114 /* Unnecessary ??? */
1115 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1116 { if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \
1117 goto LABEL; }
1120 /* Specify the machine mode that this machine uses
1121 for the index in the tablejump instruction. */
1122 /* #define CASE_VECTOR_MODE HImode */
1123 #define CASE_VECTOR_MODE SImode
1125 /* Define this if the tablejump instruction expects the table
1126 to contain offsets from the address of the table.
1127 Do not define this if the table should contain absolute addresses. */
1128 #define CASE_VECTOR_PC_RELATIVE
1130 /* Specify the tree operation to be used to convert reals to integers. */
1131 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1133 /* This is the kind of divide that is easiest to do in the general case. */
1134 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1136 /* Define this as 1 if `char' should by default be signed; else as 0. */
1137 #define DEFAULT_SIGNED_CHAR 1
1139 /* Max number of bytes we can move from memory to memory
1140 in one reasonably fast instruction. */
1141 #define MOVE_MAX 4
1143 /* Define this if zero-extension is slow (more than one real instruction). */
1144 /* #define SLOW_ZERO_EXTEND */
1146 /* Nonzero if access to memory by bytes is slow and undesirable. */
1147 #define SLOW_BYTE_ACCESS 0
1149 /* Define if shifts truncate the shift count
1150 which implies one can omit a sign-extension or zero-extension
1151 of a shift count. */
1152 /* #define SHIFT_COUNT_TRUNCATED */
1154 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1155 is done just by pretending it is already truncated. */
1156 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1158 /* We assume that the store-condition-codes instructions store 0 for false
1159 and some other value for true. This is the value stored for true. */
1161 /* #define STORE_FLAG_VALUE -1 */
1163 /* When a prototype says `char' or `short', really pass an `int'. */
1164 #define PROMOTE_PROTOTYPES
1166 /* Specify the machine mode that pointers have.
1167 After generation of rtl, the compiler makes no further distinction
1168 between pointers and any other objects of this machine mode. */
1169 #define Pmode SImode
1171 /* A function address in a call instruction
1172 is a byte address (for indexing purposes)
1173 so give the MEM rtx a byte's mode. */
1174 #define FUNCTION_MODE QImode
1176 /* Compute the cost of computing a constant rtl expression RTX
1177 whose rtx-code is CODE. The body of this macro is a portion
1178 of a switch statement. If the code is computed here,
1179 return it with a return statement. Otherwise, break from the switch. */
1181 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1182 case CONST_INT: \
1183 if ((unsigned) INTVAL (RTX) < 8) return 0; \
1184 if ((unsigned) (INTVAL (RTX) + 0x80) < 0x100) return 1; \
1185 if ((unsigned) (INTVAL (RTX) + 0x8000) < 0x10000) return 2; \
1186 case CONST: \
1187 case LABEL_REF: \
1188 case SYMBOL_REF: \
1189 return 3; \
1190 case CONST_DOUBLE: \
1191 return 5;
1193 /* Define subroutines to call to handle multiply and divide.
1194 The `*' prevents an underscore from being prepended by the compiler. */
1195 /* Use libgcc on Gmicro */
1196 /* #define UDIVSI3_LIBCALL "*udiv" */
1197 /* #define UMODSI3_LIBCALL "*urem" */
1200 /* Tell final.c how to eliminate redundant test instructions. */
1202 /* Here we define machine-dependent flags and fields in cc_status
1203 (see `conditions.h'). */
1205 /* Set if the cc value is actually in the FPU, so a floating point
1206 conditional branch must be output. */
1207 #define CC_IN_FPU 04000
1209 /* Store in cc_status the expressions
1210 that the condition codes will describe
1211 after execution of an instruction whose pattern is EXP.
1212 Do not alter them if the instruction would not alter the cc's. */
1214 /* Since Gmicro's compare instructions depend on the branch condition,
1215 all branch should be kept.
1216 More work must be done to optimize condition code !! M.Yuhara */
1218 #define NOTICE_UPDATE_CC(EXP, INSN) {CC_STATUS_INIT;}
1220 /* The skeleton of the next macro is taken from "vax.h".
1221 FPU-reg manipulation is added. M.Yuhara */
1222 /* Now comment out.
1223 #define NOTICE_UPDATE_CC(EXP, INSN) { \
1224 if (GET_CODE (EXP) == SET) { \
1225 if ( !FPU_REG_P (XEXP (EXP, 0)) \
1226 && (XEXP (EXP, 0) != cc0_rtx) \
1227 && (FPU_REG_P (XEXP (EXP, 1)) \
1228 || GET_CODE (XEXP (EXP, 1)) == FIX \
1229 || GET_CODE (XEXP (EXP, 1)) == FLOAT_TRUNCATE \
1230 || GET_CODE (XEXP (EXP, 1)) == FLOAT_EXTEND)) { \
1231 CC_STATUS_INIT; \
1232 } else if (GET_CODE (SET_SRC (EXP)) == CALL) { \
1233 CC_STATUS_INIT; \
1234 } else if (GET_CODE (SET_DEST (EXP)) != PC) { \
1235 cc_status.flags = 0; \
1236 cc_status.value1 = SET_DEST (EXP); \
1237 cc_status.value2 = SET_SRC (EXP); \
1239 } else if (GET_CODE (EXP) == PARALLEL \
1240 && GET_CODE (XVECEXP (EXP, 0, 0)) == SET \
1241 && GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) != PC) {\
1242 cc_status.flags = 0; \
1243 cc_status.value1 = SET_DEST (XVECEXP (EXP, 0, 0)); \
1244 cc_status.value2 = SET_SRC (XVECEXP (EXP, 0, 0)); \
1245 /* PARALLELs whose first element sets the PC are aob, sob VAX insns. \
1246 They do change the cc's. So drop through and forget the cc's. * / \
1247 } else CC_STATUS_INIT; \
1248 if (cc_status.value1 && GET_CODE (cc_status.value1) == REG \
1249 && cc_status.value2 \
1250 && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2)) \
1251 cc_status.value2 = 0; \
1252 if (cc_status.value1 && GET_CODE (cc_status.value1) == MEM \
1253 && cc_status.value2 \
1254 && GET_CODE (cc_status.value2) == MEM) \
1255 cc_status.value2 = 0; \
1256 if ( (cc_status.value1 && FPU_REG_P (cc_status.value1)) \
1257 || (cc_status.value2 && FPU_REG_P (cc_status.value2))) \
1258 cc_status.flags = CC_IN_FPU; \
1262 #define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \
1263 { if (cc_prev_status.flags & CC_IN_FPU) \
1264 return FLOAT; \
1265 if (cc_prev_status.flags & CC_NO_OVERFLOW) \
1266 return NO_OV; \
1267 return NORMAL; }
1269 /* Control the assembler format that we output. */
1271 /* Output before read-only data. */
1273 #define TEXT_SECTION_ASM_OP ".section text,code,align=4"
1275 /* Output before writable data. */
1277 #define DATA_SECTION_ASM_OP ".section data,data,align=4"
1279 /* Output before uninitialized data. */
1281 #define BSS_SECTION_ASM_OP ".section bss,data,align=4"
1283 /* Output at beginning of assembler file.
1284 It is not appropriate for this to print a list of the options used,
1285 since that's not the convention that we use. */
1287 #define ASM_FILE_START(FILE)
1289 /* Output at the end of assembler file. */
1291 #define ASM_FILE_END(FILE) fprintf (FILE, "\t.end\n");
1294 /* Don't try to define `gcc_compiled.' since the assembler do not
1295 accept symbols with periods and GDB doesn't run on this machine anyway. */
1296 #define ASM_IDENTIFY_GCC(FILE)
1299 /* Output to assembler file text saying following lines
1300 may contain character constants, extra white space, comments, etc. */
1302 #define ASM_APP_ON ""
1303 /* #define ASM_APP_ON "#APP\n" */
1305 /* Output to assembler file text saying following lines
1306 no longer contain unusual constructs. */
1308 #define ASM_APP_OFF ""
1309 /* #define ASM_APP_OFF ";#NO_APP\n" */
1311 /* How to refer to registers in assembler output.
1312 This sequence is indexed by compiler's hard-register-number (see above). */
1314 #define REGISTER_NAMES \
1315 {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
1316 "r8", "r9", "r10", "r11", "r12", "r13", "fp", "sp", \
1317 "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", \
1318 "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15"}
1320 /* How to renumber registers for dbx and gdb. */
1322 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
1324 /* Define this if gcc should produce debugging output for dbx in response
1325 to the -g flag. This does not work for the Gmicro now */
1327 #define DBX_DEBUGGING_INFO
1329 /* This is how to output the definition of a user-level label named NAME,
1330 such as the label on a static function or variable NAME. */
1332 #define ASM_OUTPUT_LABEL(FILE,NAME) { \
1333 assemble_name (FILE, NAME); \
1334 fputs (":\n", FILE); \
1337 /* This is how to output a command to make the user-level label named NAME
1338 defined for reference from other files. */
1340 #define ASM_GLOBALIZE_LABEL(FILE,NAME) {\
1341 fputs ("\t.global ", FILE); \
1342 assemble_name (FILE, NAME); \
1343 fputs ("\n", FILE); \
1346 /* This is how to output a command to make the external label named NAME
1347 which are not defined in the file to be referable */
1348 /* ".import" does not work ??? */
1350 #define ASM_OUTPUT_EXTERNAL(FILE,DECL,NAME) { \
1351 fputs ("\t.global ", FILE); \
1352 assemble_name (FILE, NAME); \
1353 fputs ("\n", FILE); \
1357 /* The prefix to add to user-visible assembler symbols. */
1359 #define USER_LABEL_PREFIX "_"
1361 /* This is how to output an internal numbered label where
1362 PREFIX is the class of label and NUM is the number within the class. */
1364 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1365 fprintf (FILE, "%s%d:\n", PREFIX, NUM)
1367 /* This is how to store into the string LABEL
1368 the symbol_ref name of an internal numbered label where
1369 PREFIX is the class of label and NUM is the number within the class.
1370 This is suitable for output with `assemble_name'. */
1372 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1373 sprintf (LABEL, "*%s%d", PREFIX, NUM)
1375 /* This is how to output an assembler line defining a `double' constant. */
1377 /* do {...} while(0) is necessary, because these macros are used as
1378 if (xxx) MACRO; else ....
1383 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
1384 do { union { double d; long l[2];} tem; \
1385 tem.d = (VALUE); \
1386 fprintf (FILE, "\t.fdata.d h'%x%08x.d\n", tem.l[0], tem.l[1]); \
1387 } while(0)
1390 /* This is how to output an assembler line defining a `float' constant. */
1392 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
1393 do { union { float f; long l;} tem; \
1394 tem.f = (VALUE); \
1395 fprintf (FILE, "\t.fdata.s h'%x.s\n", tem.l); \
1396 } while(0)
1398 /* This is how to output an assembler line defining an `int' constant. */
1400 #define ASM_OUTPUT_INT(FILE,VALUE) \
1401 ( fprintf (FILE, "\t.data.w "), \
1402 output_addr_const (FILE, (VALUE)), \
1403 fprintf (FILE, "\n"))
1405 /* Likewise for `char' and `short' constants. */
1407 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
1408 ( fprintf (FILE, "\t.data.h "), \
1409 output_addr_const (FILE, (VALUE)), \
1410 fprintf (FILE, "\n"))
1412 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
1413 ( fprintf (FILE, "\t.data.b "), \
1414 output_addr_const (FILE, (VALUE)), \
1415 fprintf (FILE, "\n"))
1417 /* This is how to output an assembler line for a numeric constant byte. */
1419 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
1420 fprintf (FILE, "\t.data.b h'%x\n", (VALUE))
1422 #define ASM_OUTPUT_ASCII(FILE,P,SIZE) \
1423 output_ascii ((FILE), (P), (SIZE))
1425 /* This is how to output an insn to push a register on the stack.
1426 It need not be very fast code. */
1428 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1429 fprintf (FILE, "\tmov %s,@-sp\n", reg_names[REGNO])
1431 /* This is how to output an insn to pop a register from the stack.
1432 It need not be very fast code. */
1434 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1435 fprintf (FILE, "\tmov @sp+,%s\n", reg_names[REGNO])
1437 /* This is how to output an element of a case-vector that is absolute.
1438 (The Gmicro does not use such vectors,
1439 but we must define this macro anyway.) */
1441 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1442 fprintf (FILE, "\t.data.w L%d\n", VALUE)
1445 /* This is how to output an element of a case-vector that is relative. */
1447 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
1448 fprintf (FILE, "\t.data.w L%d-L%d\n", VALUE, REL)
1451 /* This is how to output an assembler line
1452 that says to advance the location counter
1453 to a multiple of 2**LOG bytes. */
1455 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1456 fprintf (FILE, "\t.align %d\n", (1 << (LOG)));
1458 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1459 fprintf (FILE, "\t.res.b %d\n", (SIZE))
1461 /* This says how to output an assembler line
1462 to define a global common symbol. */
1464 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1465 ( bss_section (), \
1466 assemble_name ((FILE), (NAME)), \
1467 fprintf ((FILE), ":\t.res.b %d\n", (ROUNDED)),\
1468 fprintf ((FILE), "\t.export "), \
1469 assemble_name ((FILE), (NAME)), \
1470 fprintf ((FILE), "\n") )
1472 /* This says how to output an assembler line
1473 to define a local common symbol. */
1475 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
1476 ( bss_section (), \
1477 assemble_name ((FILE), (NAME)), \
1478 fprintf ((FILE), ":\t.res.b %d\n", (ROUNDED)))
1480 /* Store in OUTPUT a string (made with alloca) containing
1481 an assembler-name for a local static variable named NAME.
1482 LABELNO is an integer which is different for each call. */
1484 /* $__ is unique ????? M.Yuhara */
1485 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1486 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
1487 sprintf ((OUTPUT), "$__%s%d", (NAME), (LABELNO)))
1489 /* Define the parentheses used to group arithmetic operations
1490 in assembler code. */
1492 #define ASM_OPEN_PAREN "("
1493 #define ASM_CLOSE_PAREN ")"
1495 /* Define results of standard character escape sequences. */
1496 #define TARGET_BELL 007
1497 #define TARGET_BS 010
1498 #define TARGET_TAB 011
1499 #define TARGET_NEWLINE 012
1500 #define TARGET_VT 013
1501 #define TARGET_FF 014
1502 #define TARGET_CR 015
1504 /* Output a float value (represented as a C double) as an immediate operand.
1505 This macro is a Gmicro/68k-specific macro. */
1507 #define ASM_OUTPUT_FLOAT_OPERAND(FILE,VALUE) \
1508 do { union { float f; long l;} tem; \
1509 tem.f = (VALUE); \
1510 fprintf (FILE, "#h'%x.s", tem.l); \
1511 } while(0)
1514 /* Output a double value (represented as a C double) as an immediate operand.
1515 This macro is a 68k-specific macro. */
1516 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
1517 do { union { double d; long l[2];} tem; \
1518 tem.d = (VALUE); \
1519 fprintf (FILE, "#h'%x%08x.d", tem.l[0], tem.l[1]); \
1520 } while(0)
1522 /* Print operand X (an rtx) in assembler syntax to file FILE.
1523 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1524 For `%' followed by punctuation, CODE is the punctuation and X is null.
1526 On the Gmicro, we use several CODE characters:
1527 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
1528 'b' for branch target label.
1529 '-' for an operand pushing on the stack.
1530 '+' for an operand pushing on the stack.
1531 '#' for an immediate operand prefix
1534 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1535 ( (CODE) == '#' || (CODE) == '-' \
1536 || (CODE) == '+' || (CODE) == '@' || (CODE) == '!')
1539 #define PRINT_OPERAND(FILE, X, CODE) \
1540 { int i; \
1541 static char *reg_name[] = REGISTER_NAMES; \
1542 /* fprintf (stderr, "PRINT_OPERAND CODE=%c(0x%x), ", CODE, CODE);\
1543 myprcode(GET_CODE(X)); */ \
1544 if (CODE == '#') fprintf (FILE, "#"); \
1545 else if (CODE == '-') fprintf (FILE, "@-sp"); \
1546 else if (CODE == '+') fprintf (FILE, "@sp+"); \
1547 else if (CODE == 's') fprintf (stderr, "err: PRINT_OPERAND <s>\n"); \
1548 else if (CODE == '!') fprintf (stderr, "err: PRINT_OPERAND <!>\n"); \
1549 else if (CODE == '.') fprintf (stderr, "err: PRINT_OPERAND <.>\n"); \
1550 else if (CODE == 'b') { \
1551 if (GET_CODE (X) == MEM) \
1552 output_addr_const (FILE, XEXP (X, 0)); /* for bsr */ \
1553 else \
1554 output_addr_const (FILE, X); /* for bcc */ \
1556 else if (CODE == 'p') \
1557 print_operand_address (FILE, X); \
1558 else if (GET_CODE (X) == REG) \
1559 fprintf (FILE, "%s", reg_name[REGNO (X)]); \
1560 else if (GET_CODE (X) == MEM) \
1561 output_address (XEXP (X, 0)); \
1562 else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
1563 { union { double d; int i[2]; } u; \
1564 union { float f; int i; } u1; \
1565 u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
1566 u1.f = u.d; \
1567 if (CODE == 'f') \
1568 ASM_OUTPUT_FLOAT_OPERAND (FILE, u1.f); \
1569 else \
1570 fprintf (FILE, "#h'%x", u1.i); } \
1571 else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode) \
1572 { union { double d; int i[2]; } u; \
1573 u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
1574 ASM_OUTPUT_DOUBLE_OPERAND (FILE, u.d); } \
1575 else { putc ('#', FILE); \
1576 output_addr_const (FILE, X); }}
1578 /* Note that this contains a kludge that knows that the only reason
1579 we have an address (plus (label_ref...) (reg...))
1580 is in the insn before a tablejump, and we know that m68k.md
1581 generates a label LInnn: on such an insn. */
1582 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1583 { print_operand_address (FILE, ADDR); }
1586 Local variables:
1587 version-control: t
1588 End: