1 /* Definitions of target machine for GNU compiler. NEC V850 series
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 Free Software Foundation, Inc.
4 Contributed by Jeff Law (law@cygnus.com).
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
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. */
26 /* These are defiend in svr4.h but we want to override them. */
35 #define TARGET_CPU_generic 1
37 #ifndef TARGET_CPU_DEFAULT
38 #define TARGET_CPU_DEFAULT TARGET_CPU_generic
41 #define MASK_DEFAULT MASK_V850
42 #define SUBTARGET_ASM_SPEC "%{!mv*:-mv850}"
43 #define SUBTARGET_CPP_SPEC "%{!mv*:-D__v850__}"
44 #define TARGET_VERSION fprintf (stderr, " (NEC V850)");
47 #define ASM_SPEC "%{mv*:-mv%*}"
48 #define CPP_SPEC "%{mv850ea:-D__v850ea__} %{mv850e:-D__v850e__} %{mv850:-D__v850__} %(subtarget_cpp_spec)"
51 { "subtarget_asm_spec", SUBTARGET_ASM_SPEC }, \
52 { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }
54 /* Names to predefine in the preprocessor for this target machine. */
55 #define CPP_PREDEFINES "-D__v851__ -D__v850"
57 /* Run-time compilation parameters selecting different hardware subsets. */
59 extern int target_flags;
61 /* Target flags bits, see below for an explanation of the bits. */
62 #define MASK_GHS 0x00000001
63 #define MASK_LONG_CALLS 0x00000002
64 #define MASK_EP 0x00000004
65 #define MASK_PROLOG_FUNCTION 0x00000008
66 #define MASK_DEBUG 0x40000000
68 #define MASK_CPU 0x00000030
69 #define MASK_V850 0x00000010
71 #define MASK_BIG_SWITCH 0x00000100
73 /* Macros used in the machine description to test the flags. */
75 /* The GHS calling convention support doesn't really work,
76 mostly due to a lack of documentation. Outstanding issues:
78 * How do varargs & stdarg really work. How to they handle
79 passing structures (if at all).
81 * Doubles are normally 4 byte aligned, except in argument
82 lists where they are 8 byte aligned. Is the alignment
83 in the argument list based on the first parameter,
84 first stack parameter, etc etc.
86 * Passing/returning of large structures probably isn't the same
87 as GHS. We don't have enough documentation on their conventions
90 * Tests of SETUP_INCOMING_VARARGS need to be made runtime checks
91 since it depends on TARGET_GHS. */
92 #define TARGET_GHS (target_flags & MASK_GHS)
94 /* Don't do PC-relative calls, instead load the address of the target
95 function into a register and perform a register indirect call. */
96 #define TARGET_LONG_CALLS (target_flags & MASK_LONG_CALLS)
98 /* Whether to optimize space by using ep (r30) for pointers with small offsets
100 #define TARGET_EP (target_flags & MASK_EP)
102 /* Whether to call out-of-line functions to save registers or not. */
103 #define TARGET_PROLOG_FUNCTION (target_flags & MASK_PROLOG_FUNCTION)
105 #define TARGET_V850 ((target_flags & MASK_CPU) == MASK_V850)
107 /* Whether to emit 2 byte per entry or 4 byte per entry switch tables. */
108 #define TARGET_BIG_SWITCH (target_flags & MASK_BIG_SWITCH)
110 /* General debug flag */
111 #define TARGET_DEBUG (target_flags & MASK_DEBUG)
113 /* Macro to define tables used to set the flags.
114 This is a list in braces of pairs in braces,
115 each pair being { "NAME", VALUE }
116 where VALUE is the bits to set or minus the bits to clear.
117 An empty string NAME is used to identify the default VALUE. */
119 #define TARGET_SWITCHES \
120 {{ "ghs", MASK_GHS, N_("Support Green Hills ABI") }, \
121 { "no-ghs", -MASK_GHS, "" }, \
122 { "long-calls", MASK_LONG_CALLS, \
123 N_("Prohibit PC relative function calls") },\
124 { "no-long-calls", -MASK_LONG_CALLS, "" }, \
126 N_("Reuse r30 on a per function basis") }, \
127 { "no-ep", -MASK_EP, "" }, \
128 { "prolog-function", MASK_PROLOG_FUNCTION, \
129 N_("Use stubs for function prologues") }, \
130 { "no-prolog-function", -MASK_PROLOG_FUNCTION, "" }, \
131 { "space", MASK_EP | MASK_PROLOG_FUNCTION, \
132 N_("Same as: -mep -mprolog-function") }, \
133 { "debug", MASK_DEBUG, N_("Enable backend debugging") }, \
134 { "v850", MASK_V850, \
135 N_("Compile for the v850 processor") }, \
136 { "v850", -(MASK_V850 ^ MASK_CPU), "" }, \
137 { "big-switch", MASK_BIG_SWITCH, \
138 N_("Use 4 byte entries in switch tables") },\
139 { "", MASK_DEFAULT, ""}}
141 /* Information about the various small memory areas. */
142 struct small_memory_info {
149 enum small_memory_type {
150 /* tiny data area, using EP as base register */
151 SMALL_MEMORY_TDA = 0,
152 /* small data area using dp as base register */
154 /* zero data area using r0 as base register */
159 extern struct small_memory_info small_memory[(int)SMALL_MEMORY_max];
161 #define TARGET_OPTIONS \
163 { "tda=", &small_memory[ (int)SMALL_MEMORY_TDA ].value, \
164 N_("Set the max size of data eligible for the TDA area") }, \
165 { "tda-", &small_memory[ (int)SMALL_MEMORY_TDA ].value, "" }, \
166 { "sda=", &small_memory[ (int)SMALL_MEMORY_SDA ].value, \
167 N_("Set the max size of data eligible for the SDA area") }, \
168 { "sda-", &small_memory[ (int)SMALL_MEMORY_SDA ].value, "" }, \
169 { "zda=", &small_memory[ (int)SMALL_MEMORY_ZDA ].value, \
170 N_("Set the max size of data eligible for the ZDA area") }, \
171 { "zda-", &small_memory[ (int)SMALL_MEMORY_ZDA ].value, "" }, \
174 /* Sometimes certain combinations of command options do not make
175 sense on a particular target machine. You can define a macro
176 `OVERRIDE_OPTIONS' to take account of this. This macro, if
177 defined, is executed once just after all the command options have
180 Don't use this macro to turn on various extra optimizations for
181 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
182 #define OVERRIDE_OPTIONS override_options ()
185 /* Show we can debug even without a frame pointer. */
186 #define CAN_DEBUG_WITHOUT_FP
188 /* Some machines may desire to change what optimizations are
189 performed for various optimization levels. This macro, if
190 defined, is executed once just after the optimization level is
191 determined and before the remainder of the command options have
192 been parsed. Values set in this macro are used as the default
193 values for the other command line options.
195 LEVEL is the optimization level specified; 2 if `-O2' is
196 specified, 1 if `-O' is specified, and 0 if neither is specified.
198 SIZE is non-zero if `-Os' is specified, 0 otherwise.
200 You should not use this macro to change options that are not
201 machine-specific. These should uniformly selected by the same
202 optimization level on all supported machines. Use this macro to
203 enable machine-specific optimizations.
205 *Do not examine `write_symbols' in this macro!* The debugging
206 options are not supposed to alter the generated code. */
208 #define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
211 target_flags |= (MASK_EP | MASK_PROLOG_FUNCTION); \
215 /* Target machine storage layout */
217 /* Define this if most significant bit is lowest numbered
218 in instructions that operate on numbered bit-fields.
219 This is not true on the NEC V850. */
220 #define BITS_BIG_ENDIAN 0
222 /* Define this if most significant byte of a word is the lowest numbered. */
223 /* This is not true on the NEC V850. */
224 #define BYTES_BIG_ENDIAN 0
226 /* Define this if most significant word of a multiword number is lowest
228 This is not true on the NEC V850. */
229 #define WORDS_BIG_ENDIAN 0
231 /* Width in bits of a "word", which is the contents of a machine register.
232 Note that this is not necessarily the width of data type `int';
233 if using 16-bit ints on a 68000, this would still be 32.
234 But on a machine with 16-bit registers, this would be 16. */
235 #define BITS_PER_WORD 32
237 /* Width of a word, in units (bytes). */
238 #define UNITS_PER_WORD 4
240 /* Width in bits of a pointer.
241 See also the macro `Pmode' defined below. */
242 #define POINTER_SIZE 32
244 /* Define this macro if it is advisable to hold scalars in registers
245 in a wider mode than that declared by the program. In such cases,
246 the value is constrained to be within the bounds of the declared
247 type, but kept valid in the wider mode. The signedness of the
248 extension may differ from that of the type.
250 Some simple experiments have shown that leaving UNSIGNEDP alone
251 generates the best overall code. */
253 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
254 if (GET_MODE_CLASS (MODE) == MODE_INT \
255 && GET_MODE_SIZE (MODE) < 4) \
258 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
259 #define PARM_BOUNDARY 32
261 /* The stack goes in 32 bit lumps. */
262 #define STACK_BOUNDARY 32
264 /* Allocation boundary (in *bits*) for the code of a function.
265 16 is the minimum boundary; 32 would give better performance. */
266 #define FUNCTION_BOUNDARY 16
268 /* No data type wants to be aligned rounder than this. */
269 #define BIGGEST_ALIGNMENT 32
271 /* Alignment of field after `int : 0' in a structure. */
272 #define EMPTY_FIELD_BOUNDARY 32
274 /* No structure field wants to be aligned rounder than this. */
275 #define BIGGEST_FIELD_ALIGNMENT 32
277 /* Define this if move instructions will actually fail to work
278 when given unaligned data. */
279 #define STRICT_ALIGNMENT 1
281 /* Define this as 1 if `char' should by default be signed; else as 0.
283 On the NEC V850, loads do sign extension, so make this default. */
284 #define DEFAULT_SIGNED_CHAR 1
286 /* Standard register usage. */
288 /* Number of actual hardware registers.
289 The hardware registers are assigned numbers for the compiler
290 from 0 to just below FIRST_PSEUDO_REGISTER.
292 All registers that the compiler knows about must be given numbers,
293 even those that are not normally considered general registers. */
295 #define FIRST_PSEUDO_REGISTER 34
297 /* 1 for registers that have pervasive standard uses
298 and are not available for the register allocator. */
300 #define FIXED_REGISTERS \
301 { 1, 1, 0, 1, 1, 0, 0, 0, \
302 0, 0, 0, 0, 0, 0, 0, 0, \
303 0, 0, 0, 0, 0, 0, 0, 0, \
304 0, 0, 0, 0, 0, 0, 1, 0, \
307 /* 1 for registers not available across function calls.
308 These must include the FIXED_REGISTERS and also any
309 registers that can be used without being saved.
310 The latter must include the registers where values are returned
311 and the register where structure-value addresses are passed.
312 Aside from that, you can include as many other registers as you
315 #define CALL_USED_REGISTERS \
316 { 1, 1, 0, 1, 1, 1, 1, 1, \
317 1, 1, 1, 1, 1, 1, 1, 1, \
318 1, 1, 1, 1, 0, 0, 0, 0, \
319 0, 0, 0, 0, 0, 0, 1, 1, \
322 /* List the order in which to allocate registers. Each register must be
323 listed once, even those in FIXED_REGISTERS.
325 On the 850, we make the return registers first, then all of the volatile
326 registers, then the saved registers in reverse order to better save the
327 registers with an out of line function, and finally the fixed
330 #define REG_ALLOC_ORDER \
332 10, 11, /* return registers */ \
333 12, 13, 14, 15, 16, 17, 18, 19, /* scratch registers */ \
334 6, 7, 8, 9, 31, /* argument registers */ \
335 29, 28, 27, 26, 25, 24, 23, 22, /* saved registers */ \
337 0, 1, 3, 4, 5, 30, 32, 33 /* fixed registers */ \
340 /* Return number of consecutive hard regs needed starting at reg REGNO
341 to hold something of mode MODE.
343 This is ordinarily the length in words of a value of mode MODE
344 but can be less for certain modes in special long registers. */
346 #define HARD_REGNO_NREGS(REGNO, MODE) \
347 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
349 /* Value is 1 if hard register REGNO can hold a value of machine-mode
352 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
353 ((((REGNO) & 1) == 0) || (GET_MODE_SIZE (MODE) <= 4))
355 /* Value is 1 if it is a good idea to tie two pseudo registers
356 when one has mode MODE1 and one has mode MODE2.
357 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
358 for any hard reg, then this must be 0 for correct output. */
359 #define MODES_TIEABLE_P(MODE1, MODE2) \
360 (MODE1 == MODE2 || (GET_MODE_SIZE (MODE1) <= 4 && GET_MODE_SIZE (MODE2) <= 4))
363 /* Define the classes of registers for register constraints in the
364 machine description. Also define ranges of constants.
366 One of the classes must always be named ALL_REGS and include all hard regs.
367 If there is more than one class, another class must be named NO_REGS
368 and contain no registers.
370 The name GENERAL_REGS must be the name of a class (or an alias for
371 another name such as ALL_REGS). This is the class of registers
372 that is allowed by "g" or "r" in a register constraint.
373 Also, registers outside this class are allocated only when
374 instructions express preferences for them.
376 The classes must be numbered in nondecreasing order; that is,
377 a larger-numbered class must never be contained completely
378 in a smaller-numbered class.
380 For any two classes, it is very desirable that there be another
381 class that represents their union. */
385 NO_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
388 #define N_REG_CLASSES (int) LIM_REG_CLASSES
390 /* Give names of register classes as strings for dump file. */
392 #define REG_CLASS_NAMES \
393 { "NO_REGS", "GENERAL_REGS", "ALL_REGS", "LIM_REGS" }
395 /* Define which registers fit in which classes.
396 This is an initializer for a vector of HARD_REG_SET
397 of length N_REG_CLASSES. */
399 #define REG_CLASS_CONTENTS \
401 { 0x00000000 }, /* NO_REGS */ \
402 { 0xffffffff }, /* GENERAL_REGS */ \
403 { 0xffffffff }, /* ALL_REGS */ \
406 /* The same information, inverted:
407 Return the class number of the smallest class containing
408 reg number REGNO. This could be a conditional expression
409 or could index an array. */
411 #define REGNO_REG_CLASS(REGNO) GENERAL_REGS
413 /* The class value for index registers, and the one for base regs. */
415 #define INDEX_REG_CLASS NO_REGS
416 #define BASE_REG_CLASS GENERAL_REGS
418 /* Get reg_class from a letter such as appears in the machine description. */
420 #define REG_CLASS_FROM_LETTER(C) (NO_REGS)
422 /* Macros to check register numbers against specific register classes. */
424 /* These assume that REGNO is a hard or pseudo reg number.
425 They give nonzero only if REGNO is a hard reg of the suitable class
426 or a pseudo reg currently allocated to a suitable hard reg.
427 Since they use reg_renumber, they are safe only once reg_renumber
428 has been allocated, which happens in local-alloc.c. */
430 #define REGNO_OK_FOR_BASE_P(regno) \
431 ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
433 #define REGNO_OK_FOR_INDEX_P(regno) 0
435 /* Given an rtx X being reloaded into a reg required to be
436 in class CLASS, return the class of reg to actually use.
437 In general this is just CLASS; but on some machines
438 in some cases it is preferable to use a more restrictive class. */
440 #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
442 /* Return the maximum number of consecutive registers
443 needed to represent mode MODE in a register of class CLASS. */
445 #define CLASS_MAX_NREGS(CLASS, MODE) \
446 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
448 /* The letters I, J, K, L, M, N, O, P in a register constraint string
449 can be used to stand for particular ranges of immediate operands.
450 This macro defines what the ranges are.
451 C is the letter, and VALUE is a constant value.
452 Return 1 if VALUE is in the range specified by C. */
454 #define INT_7_BITS(VALUE) ((unsigned) (VALUE) + 0x40 < 0x80)
455 #define INT_8_BITS(VALUE) ((unsigned) (VALUE) + 0x80 < 0x100)
457 #define CONST_OK_FOR_I(VALUE) ((VALUE) == 0)
458 /* 5 bit signed immediate */
459 #define CONST_OK_FOR_J(VALUE) ((unsigned) (VALUE) + 0x10 < 0x20)
460 /* 16 bit signed immediate */
461 #define CONST_OK_FOR_K(VALUE) ((unsigned) (VALUE) + 0x8000 < 0x10000)
462 /* valid constant for movhi instruction. */
463 #define CONST_OK_FOR_L(VALUE) \
464 (((unsigned) ((int) (VALUE) >> 16) + 0x8000 < 0x10000) \
465 && CONST_OK_FOR_I ((VALUE & 0xffff)))
466 /* 16 bit unsigned immediate */
467 #define CONST_OK_FOR_M(VALUE) ((unsigned)(VALUE) < 0x10000)
468 /* 5 bit unsigned immediate in shift instructions */
469 #define CONST_OK_FOR_N(VALUE) ((unsigned) (VALUE) <= 31)
471 #define CONST_OK_FOR_O(VALUE) 0
472 #define CONST_OK_FOR_P(VALUE) 0
475 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
476 ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \
477 (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \
478 (C) == 'K' ? CONST_OK_FOR_K (VALUE) : \
479 (C) == 'L' ? CONST_OK_FOR_L (VALUE) : \
480 (C) == 'M' ? CONST_OK_FOR_M (VALUE) : \
481 (C) == 'N' ? CONST_OK_FOR_N (VALUE) : \
482 (C) == 'O' ? CONST_OK_FOR_O (VALUE) : \
483 (C) == 'P' ? CONST_OK_FOR_P (VALUE) : \
486 /* Similar, but for floating constants, and defining letters G and H.
487 Here VALUE is the CONST_DOUBLE rtx itself.
489 `G' is a zero of some form. */
491 #define CONST_DOUBLE_OK_FOR_G(VALUE) \
492 ((GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \
493 && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \
494 || (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_INT \
495 && CONST_DOUBLE_LOW (VALUE) == 0 \
496 && CONST_DOUBLE_HIGH (VALUE) == 0))
498 #define CONST_DOUBLE_OK_FOR_H(VALUE) 0
500 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
501 ((C) == 'G' ? CONST_DOUBLE_OK_FOR_G (VALUE) \
502 : (C) == 'H' ? CONST_DOUBLE_OK_FOR_H (VALUE) \
506 /* Stack layout; function entry, exit and calling. */
508 /* Define this if pushing a word on the stack
509 makes the stack pointer a smaller address. */
511 #define STACK_GROWS_DOWNWARD
513 /* Define this if the nominal address of the stack frame
514 is at the high-address end of the local variables;
515 that is, each additional local variable allocated
516 goes at a more negative offset in the frame. */
518 #define FRAME_GROWS_DOWNWARD
520 /* Offset within stack frame to start allocating local variables at.
521 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
522 first local allocated. Otherwise, it is the offset to the BEGINNING
523 of the first local allocated. */
525 #define STARTING_FRAME_OFFSET 0
527 /* Offset of first parameter from the argument pointer register value. */
528 /* Is equal to the size of the saved fp + pc, even if an fp isn't
529 saved since the value is used before we know. */
531 #define FIRST_PARM_OFFSET(FNDECL) 0
533 /* Specify the registers used for certain standard purposes.
534 The values of these macros are register numbers. */
536 /* Register to use for pushing function arguments. */
537 #define STACK_POINTER_REGNUM 3
539 /* Base register for access to local variables of the function. */
540 #define FRAME_POINTER_REGNUM 32
542 /* Register containing return address from latest function call. */
543 #define LINK_POINTER_REGNUM 31
545 /* On some machines the offset between the frame pointer and starting
546 offset of the automatic variables is not known until after register
547 allocation has been done (for example, because the saved registers
548 are between these two locations). On those machines, define
549 `FRAME_POINTER_REGNUM' the number of a special, fixed register to
550 be used internally until the offset is known, and define
551 `HARD_FRAME_POINTER_REGNUM' to be actual the hard register number
552 used for the frame pointer.
554 You should define this macro only in the very rare circumstances
555 when it is not possible to calculate the offset between the frame
556 pointer and the automatic variables until after register
557 allocation has been completed. When this macro is defined, you
558 must also indicate in your definition of `ELIMINABLE_REGS' how to
559 eliminate `FRAME_POINTER_REGNUM' into either
560 `HARD_FRAME_POINTER_REGNUM' or `STACK_POINTER_REGNUM'.
562 Do not define this macro if it would be the same as
563 `FRAME_POINTER_REGNUM'. */
564 #undef HARD_FRAME_POINTER_REGNUM
565 #define HARD_FRAME_POINTER_REGNUM 29
567 /* Base register for access to arguments of the function. */
568 #define ARG_POINTER_REGNUM 33
570 /* Register in which static-chain is passed to a function. */
571 #define STATIC_CHAIN_REGNUM 20
573 /* Value should be nonzero if functions must have frame pointers.
574 Zero means the frame pointer need not be set up (and parms
575 may be accessed via the stack pointer) in functions that seem suitable.
576 This is computed in `reload', in reload1.c. */
577 #define FRAME_POINTER_REQUIRED 0
579 /* If defined, this macro specifies a table of register pairs used to
580 eliminate unneeded registers that point into the stack frame. If
581 it is not defined, the only elimination attempted by the compiler
582 is to replace references to the frame pointer with references to
585 The definition of this macro is a list of structure
586 initializations, each of which specifies an original and
587 replacement register.
589 On some machines, the position of the argument pointer is not
590 known until the compilation is completed. In such a case, a
591 separate hard register must be used for the argument pointer.
592 This register can be eliminated by replacing it with either the
593 frame pointer or the argument pointer, depending on whether or not
594 the frame pointer has been eliminated.
596 In this case, you might specify:
597 #define ELIMINABLE_REGS \
598 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
599 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
600 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
602 Note that the elimination of the argument pointer with the stack
603 pointer is specified first since that is the preferred elimination. */
605 #define ELIMINABLE_REGS \
606 {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
607 { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \
608 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
609 { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }} \
611 /* A C expression that returns non-zero if the compiler is allowed to
612 try to replace register number FROM-REG with register number
613 TO-REG. This macro need only be defined if `ELIMINABLE_REGS' is
614 defined, and will usually be the constant 1, since most of the
615 cases preventing register elimination are things that the compiler
616 already knows about. */
618 #define CAN_ELIMINATE(FROM, TO) \
619 ((TO) == STACK_POINTER_REGNUM ? ! frame_pointer_needed : 1)
621 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
622 specifies the initial difference between the specified pair of
623 registers. This macro must be defined if `ELIMINABLE_REGS' is
626 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
628 if ((FROM) == FRAME_POINTER_REGNUM) \
629 (OFFSET) = get_frame_size () + current_function_outgoing_args_size; \
630 else if ((FROM) == ARG_POINTER_REGNUM) \
631 (OFFSET) = compute_frame_size (get_frame_size (), (long *)0); \
636 /* A guess for the V850. */
637 #define PROMOTE_PROTOTYPES 1
639 /* Keep the stack pointer constant throughout the function. */
640 #define ACCUMULATE_OUTGOING_ARGS 1
642 /* Value is the number of bytes of arguments automatically
643 popped when returning from a subroutine call.
644 FUNDECL is the declaration node of the function (as a tree),
645 FUNTYPE is the data type of the function (as a tree),
646 or for a library call it is an identifier node for the subroutine name.
647 SIZE is the number of bytes of arguments passed on the stack. */
649 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
651 #define RETURN_ADDR_RTX(COUNT, FP) v850_return_addr (COUNT)
653 /* Define a data type for recording info about an argument list
654 during the scan of that argument list. This data type should
655 hold all necessary information about the function itself
656 and about the args processed so far, enough to enable macros
657 such as FUNCTION_ARG to determine where the next arg should go. */
659 #define CUMULATIVE_ARGS struct cum_arg
660 struct cum_arg { int nbytes; };
662 /* Define where to put the arguments to a function.
663 Value is zero to push the argument on the stack,
664 or a hard register in which to store the argument.
666 MODE is the argument's machine mode.
667 TYPE is the data type of the argument (as a tree).
668 This is null for libcalls where that information may
670 CUM is a variable of type CUMULATIVE_ARGS which gives info about
671 the preceding args and about the function being called.
672 NAMED is nonzero if this argument is a named parameter
673 (otherwise it is an extra parameter matching an ellipsis). */
675 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
676 function_arg (&CUM, MODE, TYPE, NAMED)
678 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
679 function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
681 /* Initialize a variable CUM of type CUMULATIVE_ARGS
682 for a call to a function whose data type is FNTYPE.
683 For a library call, FNTYPE is 0. */
685 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
688 /* Update the data in CUM to advance over an argument
689 of mode MODE and data type TYPE.
690 (TYPE is null for libcalls where that information may not be available.) */
692 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
693 ((CUM).nbytes += ((MODE) != BLKmode \
694 ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD \
695 : (int_size_in_bytes (TYPE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD))
697 /* When a parameter is passed in a register, stack space is still
699 #define REG_PARM_STACK_SPACE(DECL) (!TARGET_GHS ? 16 : 0)
701 /* Define this if the above stack space is to be considered part of the
702 space allocated by the caller. */
703 #define OUTGOING_REG_PARM_STACK_SPACE
705 extern int current_function_anonymous_args;
706 /* Do any setup necessary for varargs/stdargs functions. */
707 #define SETUP_INCOMING_VARARGS(CUM, MODE, TYPE, PAS, SECOND) \
708 current_function_anonymous_args = (!TARGET_GHS ? 1 : 0);
710 /* Implement `va_arg'. */
711 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
712 v850_va_arg (valist, type)
714 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
715 ((TYPE) && int_size_in_bytes (TYPE) > 8)
717 #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
718 ((TYPE) && int_size_in_bytes (TYPE) > 8)
720 /* 1 if N is a possible register number for function argument passing. */
722 #define FUNCTION_ARG_REGNO_P(N) (N >= 6 && N <= 9)
724 /* Define how to find the value returned by a function.
725 VALTYPE is the data type of the value (as a tree).
726 If the precise function being called is known, FUNC is its FUNCTION_DECL;
727 otherwise, FUNC is 0. */
729 #define FUNCTION_VALUE(VALTYPE, FUNC) \
730 gen_rtx_REG (TYPE_MODE (VALTYPE), 10)
732 /* Define how to find the value returned by a library function
733 assuming the value has mode MODE. */
735 #define LIBCALL_VALUE(MODE) \
736 gen_rtx_REG (MODE, 10)
738 /* 1 if N is a possible register number for a function value. */
740 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 10)
742 /* Return values > 8 bytes in length in memory. */
743 #define DEFAULT_PCC_STRUCT_RETURN 0
744 #define RETURN_IN_MEMORY(TYPE) \
745 (int_size_in_bytes (TYPE) > 8 || TYPE_MODE (TYPE) == BLKmode)
747 /* Register in which address to store a structure value
748 is passed to a function. On the V850 it's passed as
749 the first parameter. */
751 #define STRUCT_VALUE 0
753 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
754 the stack pointer does not matter. The value is tested only in
755 functions that have frame pointers.
756 No definition is equivalent to always zero. */
758 #define EXIT_IGNORE_STACK 1
760 /* Output assembler code to FILE to increment profiler label # LABELNO
761 for profiling a function entry. */
763 #define FUNCTION_PROFILER(FILE, LABELNO) ;
765 #define TRAMPOLINE_TEMPLATE(FILE) \
767 fprintf (FILE, "\tjarl .+4,r12\n"); \
768 fprintf (FILE, "\tld.w 12[r12],r5\n"); \
769 fprintf (FILE, "\tld.w 16[r12],r12\n"); \
770 fprintf (FILE, "\tjmp [r12]\n"); \
771 fprintf (FILE, "\tnop\n"); \
772 fprintf (FILE, "\t.long 0\n"); \
773 fprintf (FILE, "\t.long 0\n"); \
776 /* Length in units of the trampoline for entering a nested function. */
778 #define TRAMPOLINE_SIZE 24
780 /* Emit RTL insns to initialize the variable parts of a trampoline.
781 FNADDR is an RTX for the address of the function's pure code.
782 CXT is an RTX for the static chain value for the function. */
784 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
786 emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 16)), \
788 emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 20)), \
792 /* Addressing modes, and classification of registers for them. */
795 /* 1 if X is an rtx for a constant that is a valid address. */
797 /* ??? This seems too exclusive. May get better code by accepting more
798 possibilities here, in particular, should accept ZDA_NAME SYMBOL_REFs. */
800 #define CONSTANT_ADDRESS_P(X) \
801 (GET_CODE (X) == CONST_INT \
802 && CONST_OK_FOR_K (INTVAL (X)))
804 /* Maximum number of registers that can appear in a valid memory address. */
806 #define MAX_REGS_PER_ADDRESS 1
808 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
809 and check its validity for a certain class.
810 We have two alternate definitions for each of them.
811 The usual definition accepts all pseudo regs; the other rejects
812 them unless they have been allocated suitable hard regs.
813 The symbol REG_OK_STRICT causes the latter definition to be used.
815 Most source files want to accept pseudo regs in the hope that
816 they will get allocated to the class that the insn wants them to be in.
817 Source files for reload pass need to be strict.
818 After reload, it makes no difference, since pseudo regs have
819 been eliminated by then. */
821 #ifndef REG_OK_STRICT
823 /* Nonzero if X is a hard reg that can be used as an index
824 or if it is a pseudo reg. */
825 #define REG_OK_FOR_INDEX_P(X) 0
826 /* Nonzero if X is a hard reg that can be used as a base reg
827 or if it is a pseudo reg. */
828 #define REG_OK_FOR_BASE_P(X) 1
829 #define REG_OK_FOR_INDEX_P_STRICT(X) 0
830 #define REG_OK_FOR_BASE_P_STRICT(X) REGNO_OK_FOR_BASE_P (REGNO (X))
835 /* Nonzero if X is a hard reg that can be used as an index. */
836 #define REG_OK_FOR_INDEX_P(X) 0
837 /* Nonzero if X is a hard reg that can be used as a base reg. */
838 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
843 /* A C expression that defines the optional machine-dependent
844 constraint letters that can be used to segregate specific types of
845 operands, usually memory references, for the target machine.
846 Normally this macro will not be defined. If it is required for a
847 particular target machine, it should return 1 if VALUE corresponds
848 to the operand type represented by the constraint letter C. If C
849 is not defined as an extra constraint, the value returned should
850 be 0 regardless of VALUE.
852 For example, on the ROMP, load instructions cannot have their
853 output in r0 if the memory reference contains a symbolic address.
854 Constraint letter `Q' is defined as representing a memory address
855 that does *not* contain a symbolic address. An alternative is
856 specified with a `Q' constraint on the input and `r' on the
857 output. The next alternative specifies `m' on the input and a
858 register class that does not include r0 on the output. */
860 #define EXTRA_CONSTRAINT(OP, C) \
861 ((C) == 'Q' ? ep_memory_operand (OP, GET_MODE (OP), 0) \
862 : (C) == 'R' ? special_symbolref_operand (OP, VOIDmode) \
863 : (C) == 'S' ? (GET_CODE (OP) == SYMBOL_REF && ! ZDA_NAME_P (XSTR (OP, 0))) \
865 : (C) == 'U' ? ((GET_CODE (OP) == SYMBOL_REF && ZDA_NAME_P (XSTR (OP, 0))) \
866 || (GET_CODE (OP) == CONST \
867 && GET_CODE (XEXP (OP, 0)) == PLUS \
868 && GET_CODE (XEXP (XEXP (OP, 0), 0)) == SYMBOL_REF \
869 && ZDA_NAME_P (XSTR (XEXP (XEXP (OP, 0), 0), 0)))) \
872 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
873 that is a valid memory address for an instruction.
874 The MODE argument is the machine mode for the MEM expression
875 that wants to use this address.
877 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
878 except for CONSTANT_ADDRESS_P which is actually
879 machine-independent. */
881 /* Accept either REG or SUBREG where a register is valid. */
883 #define RTX_OK_FOR_BASE_P(X) \
884 ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \
885 || (GET_CODE (X) == SUBREG && REG_P (SUBREG_REG (X)) \
886 && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
888 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
890 if (RTX_OK_FOR_BASE_P (X)) goto ADDR; \
891 if (CONSTANT_ADDRESS_P (X) \
892 && (MODE == QImode || INTVAL (X) % 2 == 0) \
893 && (GET_MODE_SIZE (MODE) <= 4 || INTVAL (X) % 4 == 0)) \
895 if (GET_CODE (X) == LO_SUM \
896 && GET_CODE (XEXP (X, 0)) == REG \
897 && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
898 && CONSTANT_P (XEXP (X, 1)) \
899 && (GET_CODE (XEXP (X, 1)) != CONST_INT \
900 || ((MODE == QImode || INTVAL (XEXP (X, 1)) % 2 == 0) \
901 && CONST_OK_FOR_K (INTVAL (XEXP (X, 1))))) \
902 && GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode)) \
904 if (special_symbolref_operand (X, MODE) \
905 && (GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode))) \
907 if (GET_CODE (X) == PLUS \
908 && CONSTANT_ADDRESS_P (XEXP (X, 1)) \
909 && (MODE == QImode || INTVAL (XEXP (X, 1)) % 2 == 0) \
910 && RTX_OK_FOR_BASE_P (XEXP (X, 0))) goto ADDR; \
914 /* Try machine-dependent ways of modifying an illegitimate address
915 to be legitimate. If we find one, return the new, valid address.
916 This macro is used in only one place: `memory_address' in explow.c.
918 OLDX is the address as it was before break_out_memory_refs was called.
919 In some cases it is useful to look at this to decide what needs to be done.
921 MODE and WIN are passed so that this macro can use
922 GO_IF_LEGITIMATE_ADDRESS.
924 It is always safe for this macro to do nothing. It exists to recognize
925 opportunities to optimize the output. */
927 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
929 /* Go to LABEL if ADDR (a legitimate address expression)
930 has an effect that depends on the machine mode it is used for. */
932 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
934 /* Nonzero if the constant value X is a legitimate general operand.
935 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
937 #define LEGITIMATE_CONSTANT_P(X) \
938 (GET_CODE (X) == CONST_DOUBLE \
939 || !(GET_CODE (X) == CONST \
940 && GET_CODE (XEXP (X, 0)) == PLUS \
941 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF \
942 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
943 && ! CONST_OK_FOR_K (INTVAL (XEXP (XEXP (X, 0), 1)))))
945 /* In rare cases, correct code generation requires extra machine
946 dependent processing between the second jump optimization pass and
947 delayed branch scheduling. On those machines, define this macro
948 as a C statement to act on the code starting at INSN. */
950 #define MACHINE_DEPENDENT_REORG(INSN) v850_reorg (INSN)
953 /* Tell final.c how to eliminate redundant test instructions. */
955 /* Here we define machine-dependent flags and fields in cc_status
956 (see `conditions.h'). No extra ones are needed for the VAX. */
958 /* Store in cc_status the expressions
959 that the condition codes will describe
960 after execution of an instruction whose pattern is EXP.
961 Do not alter them if the instruction would not alter the cc's. */
963 #define CC_OVERFLOW_UNUSABLE 0x200
964 #define CC_NO_CARRY CC_NO_OVERFLOW
965 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
967 /* A part of a C `switch' statement that describes the relative costs
968 of constant RTL expressions. It must contain `case' labels for
969 expression codes `const_int', `const', `symbol_ref', `label_ref'
970 and `const_double'. Each case must ultimately reach a `return'
971 statement to return the relative cost of the use of that kind of
972 constant value in an expression. The cost may depend on the
973 precise value of the constant, which is available for examination
974 in X, and the rtx code of the expression in which it is contained,
977 CODE is the expression code--redundant, since it can be obtained
978 with `GET_CODE (X)'. */
980 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
987 int _zxy = const_costs(RTX, CODE); \
988 return (_zxy) ? COSTS_N_INSNS (_zxy) : 0; \
991 /* A crude cut at RTX_COSTS for the V850. */
993 /* Provide the costs of a rtl expression. This is in the body of a
996 There aren't DImode MOD, DIV or MULT operations, so call them
997 very expensive. Everything else is pretty much a constant cost. */
999 #define RTX_COSTS(RTX,CODE,OUTER_CODE) \
1006 /* All addressing modes have the same cost on the V850 series. */
1007 #define ADDRESS_COST(ADDR) 1
1009 /* Nonzero if access to memory by bytes or half words is no faster
1010 than accessing full words. */
1011 #define SLOW_BYTE_ACCESS 1
1013 /* According expr.c, a value of around 6 should minimize code size, and
1014 for the V850 series, that's our primary concern. */
1015 #define MOVE_RATIO 6
1017 /* Indirect calls are expensive, never turn a direct call
1018 into an indirect call. */
1019 #define NO_FUNCTION_CSE
1021 /* The four different data regions on the v850. */
1030 /* A list of names for sections other than the standard two, which are
1031 `in_text' and `in_data'. You need not define this macro on a
1032 system with no other sections (that GCC needs to use). */
1033 #undef EXTRA_SECTIONS
1034 #define EXTRA_SECTIONS in_tdata, in_sdata, in_zdata, in_const, \
1035 in_rozdata, in_rosdata, in_sbss, in_zbss, in_zcommon, in_scommon
1037 /* One or more functions to be defined in `varasm.c'. These
1038 functions should do jobs analogous to those of `text_section' and
1039 `data_section', for your additional sections. Do not define this
1040 macro if you do not define `EXTRA_SECTIONS'. */
1041 #undef EXTRA_SECTION_FUNCTIONS
1043 /* This could be done a lot more cleanly using ANSI C ... */
1044 #define EXTRA_SECTION_FUNCTIONS \
1045 CONST_SECTION_FUNCTION \
1050 if (in_section != in_sdata) \
1052 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
1053 in_section = in_sdata; \
1058 rosdata_section () \
1060 if (in_section != in_rosdata) \
1062 fprintf (asm_out_file, "%s\n", ROSDATA_SECTION_ASM_OP); \
1063 in_section = in_sdata; \
1070 if (in_section != in_sbss) \
1072 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
1073 in_section = in_sbss; \
1080 if (in_section != in_tdata) \
1082 fprintf (asm_out_file, "%s\n", TDATA_SECTION_ASM_OP); \
1083 in_section = in_tdata; \
1090 if (in_section != in_zdata) \
1092 fprintf (asm_out_file, "%s\n", ZDATA_SECTION_ASM_OP); \
1093 in_section = in_zdata; \
1098 rozdata_section () \
1100 if (in_section != in_rozdata) \
1102 fprintf (asm_out_file, "%s\n", ROZDATA_SECTION_ASM_OP); \
1103 in_section = in_rozdata; \
1110 if (in_section != in_zbss) \
1112 fprintf (asm_out_file, "%s\n", ZBSS_SECTION_ASM_OP); \
1113 in_section = in_zbss; \
1117 #define TEXT_SECTION_ASM_OP "\t.section .text"
1118 #define DATA_SECTION_ASM_OP "\t.section .data"
1119 #define BSS_SECTION_ASM_OP "\t.section .bss"
1120 #define SDATA_SECTION_ASM_OP "\t.section .sdata,\"aw\""
1121 #define SBSS_SECTION_ASM_OP "\t.section .sbss,\"aw\""
1122 #define ZDATA_SECTION_ASM_OP "\t.section .zdata,\"aw\""
1123 #define ZBSS_SECTION_ASM_OP "\t.section .zbss,\"aw\""
1124 #define TDATA_SECTION_ASM_OP "\t.section .tdata,\"aw\""
1125 #define ROSDATA_SECTION_ASM_OP "\t.section .rosdata,\"a\""
1126 #define ROZDATA_SECTION_ASM_OP "\t.section .rozdata,\"a\""
1128 #define SCOMMON_ASM_OP "\t.scomm\t"
1129 #define ZCOMMON_ASM_OP "\t.zcomm\t"
1130 #define TCOMMON_ASM_OP "\t.tcomm\t"
1132 /* A C statement or statements to switch to the appropriate section
1133 for output of EXP. You can assume that EXP is either a `VAR_DECL'
1134 node or a constant of some sort. RELOC indicates whether the
1135 initial value of EXP requires link-time relocations. Select the
1136 section by calling `text_section' or one of the alternatives for
1139 Do not define this macro if you put all read-only variables and
1140 constants in the read-only data section (usually the text section). */
1141 #undef SELECT_SECTION
1142 #define SELECT_SECTION(EXP, RELOC, ALIGN) \
1144 if (TREE_CODE (EXP) == VAR_DECL) \
1147 if (!TREE_READONLY (EXP) \
1148 || TREE_SIDE_EFFECTS (EXP) \
1149 || !DECL_INITIAL (EXP) \
1150 || (DECL_INITIAL (EXP) != error_mark_node \
1151 && !TREE_CONSTANT (DECL_INITIAL (EXP)))) \
1156 switch (v850_get_data_area (EXP)) \
1158 case DATA_AREA_ZDA: \
1160 rozdata_section (); \
1165 case DATA_AREA_TDA: \
1169 case DATA_AREA_SDA: \
1171 rosdata_section (); \
1184 else if (TREE_CODE (EXP) == STRING_CST) \
1186 if (! flag_writable_strings) \
1197 /* A C statement or statements to switch to the appropriate section
1198 for output of RTX in mode MODE. You can assume that RTX is some
1199 kind of constant in RTL. The argument MODE is redundant except in
1200 the case of a `const_int' rtx. Select the section by calling
1201 `text_section' or one of the alternatives for other sections.
1203 Do not define this macro if you put all constants in the read-only
1205 /* #define SELECT_RTX_SECTION(MODE, RTX, ALIGN) */
1207 /* Output at beginning/end of assembler file. */
1208 #undef ASM_FILE_START
1209 #define ASM_FILE_START(FILE) asm_file_start(FILE)
1211 #define ASM_COMMENT_START "#"
1213 /* Output to assembler file text saying following lines
1214 may contain character constants, extra white space, comments, etc. */
1216 #define ASM_APP_ON "#APP\n"
1218 /* Output to assembler file text saying following lines
1219 no longer contain unusual constructs. */
1221 #define ASM_APP_OFF "#NO_APP\n"
1223 #undef USER_LABEL_PREFIX
1224 #define USER_LABEL_PREFIX "_"
1226 /* When assemble_integer is used to emit the offsets for a switch
1227 table it can encounter (TRUNCATE:HI (MINUS:SI (LABEL_REF:SI) (LABEL_REF:SI))).
1228 output_addr_const will normally barf at this, but it is OK to omit
1229 the truncate and just emit the difference of the two labels. The
1230 .hword directive will automatically handle the truncation for us. */
1232 #define OUTPUT_ADDR_CONST_EXTRA(FILE, X, FAIL) \
1233 if (GET_CODE (x) == TRUNCATE) \
1234 output_addr_const (FILE, XEXP (X, 0)); \
1238 /* This says how to output the assembler to define a global
1239 uninitialized but not common symbol. */
1241 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
1242 asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
1244 #undef ASM_OUTPUT_ALIGNED_BSS
1245 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
1246 v850_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
1248 /* This says how to output the assembler to define a global
1249 uninitialized, common symbol. */
1250 #undef ASM_OUTPUT_ALIGNED_COMMON
1251 #undef ASM_OUTPUT_COMMON
1252 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
1253 v850_output_common (FILE, DECL, NAME, SIZE, ALIGN)
1255 /* This says how to output the assembler to define a local
1256 uninitialized symbol. */
1257 #undef ASM_OUTPUT_ALIGNED_LOCAL
1258 #undef ASM_OUTPUT_LOCAL
1259 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
1260 v850_output_local (FILE, DECL, NAME, SIZE, ALIGN)
1262 /* This is how to output the definition of a user-level label named NAME,
1263 such as the label on a static function or variable NAME. */
1265 #define ASM_OUTPUT_LABEL(FILE, NAME) \
1266 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1268 /* This is how to output a command to make the user-level label named NAME
1269 defined for reference from other files. */
1271 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \
1274 fputs ("\t.global ", FILE); \
1275 assemble_name (FILE, NAME); \
1276 fputs ("\n", FILE); \
1280 /* This is how to output a reference to a user-level label named NAME.
1281 `assemble_name' uses this. */
1283 #undef ASM_OUTPUT_LABELREF
1284 #define ASM_OUTPUT_LABELREF(FILE, NAME) \
1286 const char* real_name; \
1287 STRIP_NAME_ENCODING (real_name, (NAME)); \
1288 asm_fprintf (FILE, "%U%s", real_name); \
1292 /* Store in OUTPUT a string (made with alloca) containing
1293 an assembler-name for a local static variable named NAME.
1294 LABELNO is an integer which is different for each call. */
1296 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1297 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1298 sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
1300 /* This is how we tell the assembler that two symbols have the same value. */
1302 #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
1303 do { assemble_name(FILE, NAME1); \
1304 fputs(" = ", FILE); \
1305 assemble_name(FILE, NAME2); \
1306 fputc('\n', FILE); } while (0)
1309 /* How to refer to registers in assembler output.
1310 This sequence is indexed by compiler's hard-register-number (see above). */
1312 #define REGISTER_NAMES \
1313 { "r0", "r1", "r2", "sp", "gp", "r5", "r6" , "r7", \
1314 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
1315 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
1316 "r24", "r25", "r26", "r27", "r28", "r29", "ep", "r31", \
1319 #define ADDITIONAL_REGISTER_NAMES \
1329 /* Print an instruction operand X on file FILE.
1330 look in v850.c for details */
1332 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1334 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1337 /* Print a memory operand whose address is X, on file FILE.
1338 This uses a function in output-vax.c. */
1340 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
1342 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)
1343 #define ASM_OUTPUT_REG_POP(FILE,REGNO)
1345 /* This is how to output an element of a case-vector that is absolute. */
1347 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1348 asm_fprintf (FILE, "\t%s .L%d\n", \
1349 (TARGET_BIG_SWITCH ? ".long" : ".short"), VALUE)
1351 /* This is how to output an element of a case-vector that is relative. */
1353 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1354 fprintf (FILE, "\t%s .L%d-.L%d\n", \
1355 (TARGET_BIG_SWITCH ? ".long" : ".short"), \
1358 #define ASM_OUTPUT_ALIGN(FILE, LOG) \
1360 fprintf (FILE, "\t.align %d\n", (LOG))
1362 /* We don't have to worry about dbx compatibility for the v850. */
1363 #define DEFAULT_GDB_EXTENSIONS 1
1365 /* Use stabs debugging info by default. */
1366 #undef PREFERRED_DEBUGGING_TYPE
1367 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
1369 /* Define to use software floating point emulator for REAL_ARITHMETIC and
1370 decimal <-> binary conversion. */
1371 #define REAL_ARITHMETIC
1373 /* Specify the machine mode that this machine uses
1374 for the index in the tablejump instruction. */
1375 #define CASE_VECTOR_MODE (TARGET_BIG_SWITCH ? SImode : HImode)
1377 /* Define this if the case instruction drops through after the table
1378 when the index is out of range. Don't define it if the case insn
1379 jumps to the default label instead. */
1380 /* #define CASE_DROPS_THROUGH */
1382 /* Define as C expression which evaluates to nonzero if the tablejump
1383 instruction expects the table to contain offsets from the address of the
1385 Do not define this if the table should contain absolute addresses. */
1386 #define CASE_VECTOR_PC_RELATIVE 1
1388 /* The switch instruction requires that the jump table immediately follow
1390 #define JUMP_TABLES_IN_TEXT_SECTION 1
1392 /* svr4.h defines this assuming that 4 byte alignment is required. */
1393 #undef ASM_OUTPUT_BEFORE_CASE_LABEL
1394 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
1395 ASM_OUTPUT_ALIGN ((FILE), (TARGET_BIG_SWITCH ? 2 : 1));
1397 #define WORD_REGISTER_OPERATIONS
1399 /* Byte and short loads sign extend the value to a word. */
1400 #define LOAD_EXTEND_OP(MODE) SIGN_EXTEND
1402 /* This flag, if defined, says the same insns that convert to a signed fixnum
1403 also convert validly to an unsigned one. */
1404 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC
1406 /* Max number of bytes we can move from memory to memory
1407 in one reasonably fast instruction. */
1410 /* Define if shifts truncate the shift count
1411 which implies one can omit a sign-extension or zero-extension
1412 of a shift count. */
1413 #define SHIFT_COUNT_TRUNCATED 1
1415 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1416 is done just by pretending it is already truncated. */
1417 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1419 #define STORE_FLAG_VALUE 1
1421 /* Specify the machine mode that pointers have.
1422 After generation of rtl, the compiler makes no further distinction
1423 between pointers and any other objects of this machine mode. */
1424 #define Pmode SImode
1426 /* A function address in a call instruction
1427 is a byte address (for indexing purposes)
1428 so give the MEM rtx a byte's mode. */
1429 #define FUNCTION_MODE QImode
1431 /* Tell compiler we want to support GHS pragmas */
1432 #define REGISTER_TARGET_PRAGMAS(PFILE) do { \
1433 cpp_register_pragma (PFILE, "ghs", "interrupt", ghs_pragma_interrupt); \
1434 cpp_register_pragma (PFILE, "ghs", "section", ghs_pragma_section); \
1435 cpp_register_pragma (PFILE, "ghs", "starttda", ghs_pragma_starttda); \
1436 cpp_register_pragma (PFILE, "ghs", "startsda", ghs_pragma_startsda); \
1437 cpp_register_pragma (PFILE, "ghs", "startzda", ghs_pragma_startzda); \
1438 cpp_register_pragma (PFILE, "ghs", "endtda", ghs_pragma_endtda); \
1439 cpp_register_pragma (PFILE, "ghs", "endsda", ghs_pragma_endsda); \
1440 cpp_register_pragma (PFILE, "ghs", "endzda", ghs_pragma_endzda); \
1443 /* enum GHS_SECTION_KIND is an enumeration of the kinds of sections that
1444 can appear in the "ghs section" pragma. These names are used to index
1445 into the GHS_default_section_names[] and GHS_current_section_names[]
1446 that are defined in v850.c, and so the ordering of each must remain
1449 These arrays give the default and current names for each kind of
1450 section defined by the GHS pragmas. The current names can be changed
1451 by the "ghs section" pragma. If the current names are null, use
1452 the default names. Note that the two arrays have different types.
1454 For the *normal* section kinds (like .data, .text, etc.) we do not
1455 want to explicitly force the name of these sections, but would rather
1456 let the linker (or at least the back end) choose the name of the
1457 section, UNLESS the user has force a specific name for these section
1458 kinds. To accomplish this set the name in ghs_default_section_names
1461 enum GHS_section_kind
1463 GHS_SECTION_KIND_DEFAULT,
1465 GHS_SECTION_KIND_TEXT,
1466 GHS_SECTION_KIND_DATA,
1467 GHS_SECTION_KIND_RODATA,
1468 GHS_SECTION_KIND_BSS,
1469 GHS_SECTION_KIND_SDATA,
1470 GHS_SECTION_KIND_ROSDATA,
1471 GHS_SECTION_KIND_TDATA,
1472 GHS_SECTION_KIND_ZDATA,
1473 GHS_SECTION_KIND_ROZDATA,
1475 COUNT_OF_GHS_SECTION_KINDS /* must be last */
1478 /* The following code is for handling pragmas supported by the
1479 v850 compiler produced by Green Hills Software. This is at
1480 the specific request of a customer. */
1482 typedef struct data_area_stack_element
1484 struct data_area_stack_element * prev;
1485 v850_data_area data_area; /* Current default data area. */
1486 } data_area_stack_element;
1488 /* Track the current data area set by the
1489 data area pragma (which can be nested). */
1490 extern data_area_stack_element * data_area_stack;
1492 /* Names of the various data areas used on the v850. */
1493 extern union tree_node * GHS_default_section_names [(int) COUNT_OF_GHS_SECTION_KINDS];
1494 extern union tree_node * GHS_current_section_names [(int) COUNT_OF_GHS_SECTION_KINDS];
1496 /* The assembler op to start the file. */
1498 #define FILE_ASM_OP "\t.file\n"
1500 /* Enable the register move pass to improve code. */
1501 #define ENABLE_REGMOVE_PASS
1504 /* Implement ZDA, TDA, and SDA */
1506 #define EP_REGNUM 30 /* ep register number */
1508 #define ENCODE_SECTION_INFO(DECL, FIRST) \
1511 if ((FIRST) && TREE_CODE (DECL) == VAR_DECL \
1512 && (TREE_STATIC (DECL) || DECL_EXTERNAL (DECL))) \
1513 v850_encode_data_area (DECL); \
1517 #define ZDA_NAME_FLAG_CHAR '@'
1518 #define TDA_NAME_FLAG_CHAR '%'
1519 #define SDA_NAME_FLAG_CHAR '&'
1521 #define ZDA_NAME_P(NAME) (*(NAME) == ZDA_NAME_FLAG_CHAR)
1522 #define TDA_NAME_P(NAME) (*(NAME) == TDA_NAME_FLAG_CHAR)
1523 #define SDA_NAME_P(NAME) (*(NAME) == SDA_NAME_FLAG_CHAR)
1525 #define ENCODED_NAME_P(SYMBOL_NAME) \
1526 ( ZDA_NAME_P (SYMBOL_NAME) \
1527 || TDA_NAME_P (SYMBOL_NAME) \
1528 || SDA_NAME_P (SYMBOL_NAME))
1530 #define STRIP_NAME_ENCODING(VAR, SYMBOL_NAME) \
1531 (VAR) = (SYMBOL_NAME) + (ENCODED_NAME_P (SYMBOL_NAME) || *(SYMBOL_NAME) == '*')
1533 /* Define this if you have defined special-purpose predicates in the
1534 file `MACHINE.c'. This macro is called within an initializer of an
1535 array of structures. The first field in the structure is the name
1536 of a predicate and the second field is an array of rtl codes. For
1537 each predicate, list all rtl codes that can be in expressions
1538 matched by the predicate. The list should have a trailing comma. */
1540 #define PREDICATE_CODES \
1541 { "reg_or_0_operand", { REG, SUBREG, CONST_INT, CONST_DOUBLE }}, \
1542 { "reg_or_int5_operand", { REG, SUBREG, CONST_INT }}, \
1543 { "call_address_operand", { REG, SYMBOL_REF }}, \
1544 { "movsi_source_operand", { LABEL_REF, SYMBOL_REF, CONST_INT, \
1545 CONST_DOUBLE, CONST, HIGH, MEM, \
1547 { "special_symbolref_operand", { SYMBOL_REF }}, \
1548 { "power_of_two_operand", { CONST_INT }}, \
1549 { "pattern_is_ok_for_prologue", { PARALLEL }}, \
1550 { "pattern_is_ok_for_epilogue", { PARALLEL }}, \
1551 { "register_is_ok_for_epilogue",{ REG }}, \
1552 { "not_power_of_two_operand", { CONST_INT }},
1554 #endif /* ! GCC_V850_H */