1 /* Definitions of target machine for GNU compiler. NEC V850 series
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
3 Free Software Foundation, Inc.
4 Contributed by Jeff Law (law@cygnus.com).
6 This file is part of GCC.
8 GCC 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 GCC 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 GCC; 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 defined in svr4.h but we want to override them. */
33 #define TARGET_CPU_generic 1
34 #define TARGET_CPU_v850e 2
36 #ifndef TARGET_CPU_DEFAULT
37 #define TARGET_CPU_DEFAULT TARGET_CPU_generic
40 #define MASK_DEFAULT MASK_V850
41 #define SUBTARGET_ASM_SPEC "%{!mv*:-mv850}"
42 #define SUBTARGET_CPP_SPEC "%{!mv*:-D__v850__}"
43 #define TARGET_VERSION fprintf (stderr, " (NEC V850)");
45 /* Choose which processor will be the default.
46 We must pass a -mv850xx option to the assembler if no explicit -mv* option
47 is given, because the assembler's processor default may not be correct. */
48 #if TARGET_CPU_DEFAULT == TARGET_CPU_v850e
50 #define MASK_DEFAULT MASK_V850E
51 #undef SUBTARGET_ASM_SPEC
52 #define SUBTARGET_ASM_SPEC "%{!mv*:-mv850e}"
53 #undef SUBTARGET_CPP_SPEC
54 #define SUBTARGET_CPP_SPEC "%{!mv*:-D__v850e__}"
56 #define TARGET_VERSION fprintf (stderr, " (NEC V850E)");
59 #define ASM_SPEC "%{mv*:-mv%*}"
60 #define CPP_SPEC "%{mv850e:-D__v850e__} %{mv850:-D__v850__} %(subtarget_cpp_spec)"
63 { "subtarget_asm_spec", SUBTARGET_ASM_SPEC }, \
64 { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }
66 /* Names to predefine in the preprocessor for this target machine. */
67 #define TARGET_CPU_CPP_BUILTINS() do { \
68 builtin_define( "__v851__" ); \
69 builtin_define( "__v850" ); \
70 builtin_assert( "machine=v850" ); \
71 builtin_assert( "cpu=v850" ); \
74 /* Run-time compilation parameters selecting different hardware subsets. */
76 extern int target_flags;
78 /* Target flags bits, see below for an explanation of the bits. */
79 #define MASK_GHS 0x00000001
80 #define MASK_LONG_CALLS 0x00000002
81 #define MASK_EP 0x00000004
82 #define MASK_PROLOG_FUNCTION 0x00000008
83 #define MASK_DEBUG 0x40000000
85 #define MASK_CPU 0x00000030
86 #define MASK_V850 0x00000010
87 #define MASK_V850E 0x00000020
88 #define MASK_SMALL_SLD 0x00000040
90 #define MASK_BIG_SWITCH 0x00000100
91 #define MASK_NO_APP_REGS 0x00000200
92 #define MASK_DISABLE_CALLT 0x00000400
93 #define MASK_STRICT_ALIGN 0x00000800
95 #define MASK_US_BIT_SET 0x00001000
96 #define MASK_US_MASK_SET 0x00002000
98 /* Macros used in the machine description to test the flags. */
100 /* The GHS calling convention support doesn't really work,
101 mostly due to a lack of documentation. Outstanding issues:
103 * How do varargs & stdarg really work. How to they handle
104 passing structures (if at all).
106 * Doubles are normally 4 byte aligned, except in argument
107 lists where they are 8 byte aligned. Is the alignment
108 in the argument list based on the first parameter,
109 first stack parameter, etc etc.
111 * Passing/returning of large structures probably isn't the same
112 as GHS. We don't have enough documentation on their conventions
115 * Tests of SETUP_INCOMING_VARARGS need to be made runtime checks
116 since it depends on TARGET_GHS. */
117 #define TARGET_GHS (target_flags & MASK_GHS)
119 /* Don't do PC-relative calls, instead load the address of the target
120 function into a register and perform a register indirect call. */
121 #define TARGET_LONG_CALLS (target_flags & MASK_LONG_CALLS)
123 /* Whether to optimize space by using ep (r30) for pointers with small offsets
125 #define TARGET_EP (target_flags & MASK_EP)
127 /* Whether to call out-of-line functions to save registers or not. */
128 #define TARGET_PROLOG_FUNCTION (target_flags & MASK_PROLOG_FUNCTION)
130 #define TARGET_V850 ((target_flags & MASK_CPU) == MASK_V850)
132 /* Whether to emit 2 byte per entry or 4 byte per entry switch tables. */
133 #define TARGET_BIG_SWITCH (target_flags & MASK_BIG_SWITCH)
135 /* General debug flag. */
136 #define TARGET_DEBUG (target_flags & MASK_DEBUG)
137 #define TARGET_V850E ((target_flags & MASK_V850E) == MASK_V850E)
139 #define TARGET_US_BIT_SET (target_flags & MASK_US_BIT_SET)
141 /* Whether to assume that the SLD.B and SLD.H instructions only have small
142 displacement fields, thus allowing the generated code to run on any of
143 the V850 range of processors. */
144 #define TARGET_SMALL_SLD (target_flags & MASK_SMALL_SLD)
146 /* True if callt will not be used for function prolog & epilog. */
147 #define TARGET_DISABLE_CALLT (target_flags & MASK_DISABLE_CALLT)
149 /* False if r2 and r5 can be used by the compiler. True if r2
150 and r5 are to be fixed registers (for compatibility with GHS). */
151 #define TARGET_NO_APP_REGS (target_flags & MASK_NO_APP_REGS)
153 #define TARGET_STRICT_ALIGN (target_flags & MASK_STRICT_ALIGN)
155 /* Macro to define tables used to set the flags.
156 This is a list in braces of pairs in braces,
157 each pair being { "NAME", VALUE }
158 where VALUE is the bits to set or minus the bits to clear.
159 An empty string NAME is used to identify the default VALUE. */
161 #define TARGET_SWITCHES \
162 {{ "ghs", MASK_GHS, N_("Support Green Hills ABI") }, \
163 { "no-ghs", -MASK_GHS, "" }, \
164 { "long-calls", MASK_LONG_CALLS, \
165 N_("Prohibit PC relative function calls") },\
166 { "no-long-calls", -MASK_LONG_CALLS, "" }, \
168 N_("Reuse r30 on a per function basis") }, \
169 { "no-ep", -MASK_EP, "" }, \
170 { "prolog-function", MASK_PROLOG_FUNCTION, \
171 N_("Use stubs for function prologues") }, \
172 { "no-prolog-function", -MASK_PROLOG_FUNCTION, "" }, \
173 { "space", MASK_EP | MASK_PROLOG_FUNCTION, \
174 N_("Same as: -mep -mprolog-function") }, \
175 { "debug", MASK_DEBUG, N_("Enable backend debugging") }, \
176 { "v850", MASK_V850, \
177 N_("Compile for the v850 processor") }, \
178 { "v850", -(MASK_V850 ^ MASK_CPU), "" }, \
179 { "v850e", MASK_V850E, N_("Compile for v850e processor") }, \
180 { "v850e", -(MASK_V850E ^ MASK_CPU), "" }, /* Make sure that the other bits are cleared. */ \
181 { "small-sld", MASK_SMALL_SLD, N_("Enable the use of the short load instructions") }, \
182 { "no-small-sld", -MASK_SMALL_SLD, "" }, \
183 { "disable-callt", MASK_DISABLE_CALLT, \
184 N_("Do not use the callt instruction") }, \
185 { "no-disable-callt", -MASK_DISABLE_CALLT, "" }, \
186 { "US-bit-set", (MASK_US_BIT_SET | MASK_US_MASK_SET), "" }, \
187 { "no-US-bit-set", -MASK_US_BIT_SET, "" }, \
188 { "no-US-bit-set", MASK_US_MASK_SET, "" }, \
189 { "app-regs", -MASK_NO_APP_REGS, "" }, \
190 { "no-app-regs", MASK_NO_APP_REGS, \
191 N_("Do not use registers r2 and r5") }, \
192 { "strict-align", MASK_STRICT_ALIGN, \
193 N_("Enforce strict alignment") }, \
194 { "no-strict-align", -MASK_STRICT_ALIGN, "" }, \
195 { "big-switch", MASK_BIG_SWITCH, \
196 N_("Use 4 byte entries in switch tables") },\
197 { "", MASK_DEFAULT, ""}}
199 /* Information about the various small memory areas. */
200 struct small_memory_info {
207 enum small_memory_type {
208 /* tiny data area, using EP as base register */
209 SMALL_MEMORY_TDA = 0,
210 /* small data area using dp as base register */
212 /* zero data area using r0 as base register */
217 extern struct small_memory_info small_memory[(int)SMALL_MEMORY_max];
219 #define TARGET_OPTIONS \
221 { "tda=", &small_memory[ (int)SMALL_MEMORY_TDA ].value, \
222 N_("Set the max size of data eligible for the TDA area"), 0}, \
223 { "tda-", &small_memory[ (int)SMALL_MEMORY_TDA ].value, "", 0}, \
224 { "sda=", &small_memory[ (int)SMALL_MEMORY_SDA ].value, \
225 N_("Set the max size of data eligible for the SDA area"), 0}, \
226 { "sda-", &small_memory[ (int)SMALL_MEMORY_SDA ].value, "", 0}, \
227 { "zda=", &small_memory[ (int)SMALL_MEMORY_ZDA ].value, \
228 N_("Set the max size of data eligible for the ZDA area"), 0}, \
229 { "zda-", &small_memory[ (int)SMALL_MEMORY_ZDA ].value, "", 0}, \
232 /* Sometimes certain combinations of command options do not make
233 sense on a particular target machine. You can define a macro
234 `OVERRIDE_OPTIONS' to take account of this. This macro, if
235 defined, is executed once just after all the command options have
238 Don't use this macro to turn on various extra optimizations for
239 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
240 #define OVERRIDE_OPTIONS override_options ()
243 /* Show we can debug even without a frame pointer. */
244 #define CAN_DEBUG_WITHOUT_FP
246 /* Some machines may desire to change what optimizations are
247 performed for various optimization levels. This macro, if
248 defined, is executed once just after the optimization level is
249 determined and before the remainder of the command options have
250 been parsed. Values set in this macro are used as the default
251 values for the other command line options.
253 LEVEL is the optimization level specified; 2 if `-O2' is
254 specified, 1 if `-O' is specified, and 0 if neither is specified.
256 SIZE is nonzero if `-Os' is specified, 0 otherwise.
258 You should not use this macro to change options that are not
259 machine-specific. These should uniformly selected by the same
260 optimization level on all supported machines. Use this macro to
261 enable machine-specific optimizations.
263 *Do not examine `write_symbols' in this macro!* The debugging
264 options are not supposed to alter the generated code. */
266 #define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
268 target_flags |= MASK_STRICT_ALIGN; \
270 target_flags |= (MASK_EP | MASK_PROLOG_FUNCTION); \
274 /* Target machine storage layout */
276 /* Define this if most significant bit is lowest numbered
277 in instructions that operate on numbered bit-fields.
278 This is not true on the NEC V850. */
279 #define BITS_BIG_ENDIAN 0
281 /* Define this if most significant byte of a word is the lowest numbered. */
282 /* This is not true on the NEC V850. */
283 #define BYTES_BIG_ENDIAN 0
285 /* Define this if most significant word of a multiword number is lowest
287 This is not true on the NEC V850. */
288 #define WORDS_BIG_ENDIAN 0
290 /* Width of a word, in units (bytes). */
291 #define UNITS_PER_WORD 4
293 /* Define this macro if it is advisable to hold scalars in registers
294 in a wider mode than that declared by the program. In such cases,
295 the value is constrained to be within the bounds of the declared
296 type, but kept valid in the wider mode. The signedness of the
297 extension may differ from that of the type.
299 Some simple experiments have shown that leaving UNSIGNEDP alone
300 generates the best overall code. */
302 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
303 if (GET_MODE_CLASS (MODE) == MODE_INT \
304 && GET_MODE_SIZE (MODE) < 4) \
307 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
308 #define PARM_BOUNDARY 32
310 /* The stack goes in 32 bit lumps. */
311 #define STACK_BOUNDARY 32
313 /* Allocation boundary (in *bits*) for the code of a function.
314 16 is the minimum boundary; 32 would give better performance. */
315 #define FUNCTION_BOUNDARY 16
317 /* No data type wants to be aligned rounder than this. */
318 #define BIGGEST_ALIGNMENT 32
320 /* Alignment of field after `int : 0' in a structure. */
321 #define EMPTY_FIELD_BOUNDARY 32
323 /* No structure field wants to be aligned rounder than this. */
324 #define BIGGEST_FIELD_ALIGNMENT 32
326 /* Define this if move instructions will actually fail to work
327 when given unaligned data. */
328 #define STRICT_ALIGNMENT TARGET_STRICT_ALIGN
330 /* Define this as 1 if `char' should by default be signed; else as 0.
332 On the NEC V850, loads do sign extension, so make this default. */
333 #define DEFAULT_SIGNED_CHAR 1
335 /* Standard register usage. */
337 /* Number of actual hardware registers.
338 The hardware registers are assigned numbers for the compiler
339 from 0 to just below FIRST_PSEUDO_REGISTER.
341 All registers that the compiler knows about must be given numbers,
342 even those that are not normally considered general registers. */
344 #define FIRST_PSEUDO_REGISTER 34
346 /* 1 for registers that have pervasive standard uses
347 and are not available for the register allocator. */
349 #define FIXED_REGISTERS \
350 { 1, 1, 0, 1, 1, 0, 0, 0, \
351 0, 0, 0, 0, 0, 0, 0, 0, \
352 0, 0, 0, 0, 0, 0, 0, 0, \
353 0, 0, 0, 0, 0, 0, 1, 0, \
356 /* 1 for registers not available across function calls.
357 These must include the FIXED_REGISTERS and also any
358 registers that can be used without being saved.
359 The latter must include the registers where values are returned
360 and the register where structure-value addresses are passed.
361 Aside from that, you can include as many other registers as you
364 #define CALL_USED_REGISTERS \
365 { 1, 1, 0, 1, 1, 1, 1, 1, \
366 1, 1, 1, 1, 1, 1, 1, 1, \
367 1, 1, 1, 1, 0, 0, 0, 0, \
368 0, 0, 0, 0, 0, 0, 1, 1, \
371 /* List the order in which to allocate registers. Each register must be
372 listed once, even those in FIXED_REGISTERS.
374 On the 850, we make the return registers first, then all of the volatile
375 registers, then the saved registers in reverse order to better save the
376 registers with an out of line function, and finally the fixed
379 #define REG_ALLOC_ORDER \
381 10, 11, /* return registers */ \
382 12, 13, 14, 15, 16, 17, 18, 19, /* scratch registers */ \
383 6, 7, 8, 9, 31, /* argument registers */ \
384 29, 28, 27, 26, 25, 24, 23, 22, /* saved registers */ \
386 0, 1, 3, 4, 5, 30, 32, 33 /* fixed registers */ \
389 /* If TARGET_NO_APP_REGS is not defined then add r2 and r5 to
390 the pool of fixed registers. See PR 14505. */
391 #define CONDITIONAL_REGISTER_USAGE \
393 if (TARGET_NO_APP_REGS) \
395 fixed_regs[2] = 1; call_used_regs[2] = 1; \
396 fixed_regs[5] = 1; call_used_regs[5] = 1; \
400 /* Return number of consecutive hard regs needed starting at reg REGNO
401 to hold something of mode MODE.
403 This is ordinarily the length in words of a value of mode MODE
404 but can be less for certain modes in special long registers. */
406 #define HARD_REGNO_NREGS(REGNO, MODE) \
407 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
409 /* Value is 1 if hard register REGNO can hold a value of machine-mode
412 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
413 ((((REGNO) & 1) == 0) || (GET_MODE_SIZE (MODE) <= 4))
415 /* Value is 1 if it is a good idea to tie two pseudo registers
416 when one has mode MODE1 and one has mode MODE2.
417 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
418 for any hard reg, then this must be 0 for correct output. */
419 #define MODES_TIEABLE_P(MODE1, MODE2) \
420 (MODE1 == MODE2 || (GET_MODE_SIZE (MODE1) <= 4 && GET_MODE_SIZE (MODE2) <= 4))
423 /* Define the classes of registers for register constraints in the
424 machine description. Also define ranges of constants.
426 One of the classes must always be named ALL_REGS and include all hard regs.
427 If there is more than one class, another class must be named NO_REGS
428 and contain no registers.
430 The name GENERAL_REGS must be the name of a class (or an alias for
431 another name such as ALL_REGS). This is the class of registers
432 that is allowed by "g" or "r" in a register constraint.
433 Also, registers outside this class are allocated only when
434 instructions express preferences for them.
436 The classes must be numbered in nondecreasing order; that is,
437 a larger-numbered class must never be contained completely
438 in a smaller-numbered class.
440 For any two classes, it is very desirable that there be another
441 class that represents their union. */
445 NO_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
448 #define N_REG_CLASSES (int) LIM_REG_CLASSES
450 /* Give names of register classes as strings for dump file. */
452 #define REG_CLASS_NAMES \
453 { "NO_REGS", "GENERAL_REGS", "ALL_REGS", "LIM_REGS" }
455 /* Define which registers fit in which classes.
456 This is an initializer for a vector of HARD_REG_SET
457 of length N_REG_CLASSES. */
459 #define REG_CLASS_CONTENTS \
461 { 0x00000000 }, /* NO_REGS */ \
462 { 0xffffffff }, /* GENERAL_REGS */ \
463 { 0xffffffff }, /* ALL_REGS */ \
466 /* The same information, inverted:
467 Return the class number of the smallest class containing
468 reg number REGNO. This could be a conditional expression
469 or could index an array. */
471 #define REGNO_REG_CLASS(REGNO) GENERAL_REGS
473 /* The class value for index registers, and the one for base regs. */
475 #define INDEX_REG_CLASS NO_REGS
476 #define BASE_REG_CLASS GENERAL_REGS
478 /* Get reg_class from a letter such as appears in the machine description. */
480 #define REG_CLASS_FROM_LETTER(C) (NO_REGS)
482 /* Macros to check register numbers against specific register classes. */
484 /* These assume that REGNO is a hard or pseudo reg number.
485 They give nonzero only if REGNO is a hard reg of the suitable class
486 or a pseudo reg currently allocated to a suitable hard reg.
487 Since they use reg_renumber, they are safe only once reg_renumber
488 has been allocated, which happens in local-alloc.c. */
490 #define REGNO_OK_FOR_BASE_P(regno) \
491 ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
493 #define REGNO_OK_FOR_INDEX_P(regno) 0
495 /* Given an rtx X being reloaded into a reg required to be
496 in class CLASS, return the class of reg to actually use.
497 In general this is just CLASS; but on some machines
498 in some cases it is preferable to use a more restrictive class. */
500 #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
502 /* Return the maximum number of consecutive registers
503 needed to represent mode MODE in a register of class CLASS. */
505 #define CLASS_MAX_NREGS(CLASS, MODE) \
506 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
508 /* The letters I, J, K, L, M, N, O, P in a register constraint string
509 can be used to stand for particular ranges of immediate operands.
510 This macro defines what the ranges are.
511 C is the letter, and VALUE is a constant value.
512 Return 1 if VALUE is in the range specified by C. */
514 #define INT_7_BITS(VALUE) ((unsigned) (VALUE) + 0x40 < 0x80)
515 #define INT_8_BITS(VALUE) ((unsigned) (VALUE) + 0x80 < 0x100)
517 #define CONST_OK_FOR_I(VALUE) ((VALUE) == 0)
518 /* 5 bit signed immediate */
519 #define CONST_OK_FOR_J(VALUE) ((unsigned) (VALUE) + 0x10 < 0x20)
520 /* 16 bit signed immediate */
521 #define CONST_OK_FOR_K(VALUE) ((unsigned) (VALUE) + 0x8000 < 0x10000)
522 /* valid constant for movhi instruction. */
523 #define CONST_OK_FOR_L(VALUE) \
524 (((unsigned) ((int) (VALUE) >> 16) + 0x8000 < 0x10000) \
525 && CONST_OK_FOR_I ((VALUE & 0xffff)))
526 /* 16 bit unsigned immediate */
527 #define CONST_OK_FOR_M(VALUE) ((unsigned)(VALUE) < 0x10000)
528 /* 5 bit unsigned immediate in shift instructions */
529 #define CONST_OK_FOR_N(VALUE) ((unsigned) (VALUE) <= 31)
530 /* 9 bit signed immediate for word multiply instruction. */
531 #define CONST_OK_FOR_O(VALUE) ((unsigned) (VALUE) + 0x100 < 0x200)
533 #define CONST_OK_FOR_P(VALUE) 0
535 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
536 ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \
537 (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \
538 (C) == 'K' ? CONST_OK_FOR_K (VALUE) : \
539 (C) == 'L' ? CONST_OK_FOR_L (VALUE) : \
540 (C) == 'M' ? CONST_OK_FOR_M (VALUE) : \
541 (C) == 'N' ? CONST_OK_FOR_N (VALUE) : \
542 (C) == 'O' ? CONST_OK_FOR_O (VALUE) : \
543 (C) == 'P' ? CONST_OK_FOR_P (VALUE) : \
546 /* Similar, but for floating constants, and defining letters G and H.
547 Here VALUE is the CONST_DOUBLE rtx itself.
549 `G' is a zero of some form. */
551 #define CONST_DOUBLE_OK_FOR_G(VALUE) \
552 ((GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \
553 && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \
554 || (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_INT \
555 && CONST_DOUBLE_LOW (VALUE) == 0 \
556 && CONST_DOUBLE_HIGH (VALUE) == 0))
558 #define CONST_DOUBLE_OK_FOR_H(VALUE) 0
560 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
561 ((C) == 'G' ? CONST_DOUBLE_OK_FOR_G (VALUE) \
562 : (C) == 'H' ? CONST_DOUBLE_OK_FOR_H (VALUE) \
566 /* Stack layout; function entry, exit and calling. */
568 /* Define this if pushing a word on the stack
569 makes the stack pointer a smaller address. */
571 #define STACK_GROWS_DOWNWARD
573 /* Define this if the nominal address of the stack frame
574 is at the high-address end of the local variables;
575 that is, each additional local variable allocated
576 goes at a more negative offset in the frame. */
578 #define FRAME_GROWS_DOWNWARD
580 /* Offset within stack frame to start allocating local variables at.
581 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
582 first local allocated. Otherwise, it is the offset to the BEGINNING
583 of the first local allocated. */
585 #define STARTING_FRAME_OFFSET 0
587 /* Offset of first parameter from the argument pointer register value. */
588 /* Is equal to the size of the saved fp + pc, even if an fp isn't
589 saved since the value is used before we know. */
591 #define FIRST_PARM_OFFSET(FNDECL) 0
593 /* Specify the registers used for certain standard purposes.
594 The values of these macros are register numbers. */
596 /* Register to use for pushing function arguments. */
597 #define STACK_POINTER_REGNUM 3
599 /* Base register for access to local variables of the function. */
600 #define FRAME_POINTER_REGNUM 32
602 /* Register containing return address from latest function call. */
603 #define LINK_POINTER_REGNUM 31
605 /* On some machines the offset between the frame pointer and starting
606 offset of the automatic variables is not known until after register
607 allocation has been done (for example, because the saved registers
608 are between these two locations). On those machines, define
609 `FRAME_POINTER_REGNUM' the number of a special, fixed register to
610 be used internally until the offset is known, and define
611 `HARD_FRAME_POINTER_REGNUM' to be actual the hard register number
612 used for the frame pointer.
614 You should define this macro only in the very rare circumstances
615 when it is not possible to calculate the offset between the frame
616 pointer and the automatic variables until after register
617 allocation has been completed. When this macro is defined, you
618 must also indicate in your definition of `ELIMINABLE_REGS' how to
619 eliminate `FRAME_POINTER_REGNUM' into either
620 `HARD_FRAME_POINTER_REGNUM' or `STACK_POINTER_REGNUM'.
622 Do not define this macro if it would be the same as
623 `FRAME_POINTER_REGNUM'. */
624 #undef HARD_FRAME_POINTER_REGNUM
625 #define HARD_FRAME_POINTER_REGNUM 29
627 /* Base register for access to arguments of the function. */
628 #define ARG_POINTER_REGNUM 33
630 /* Register in which static-chain is passed to a function. */
631 #define STATIC_CHAIN_REGNUM 20
633 /* Value should be nonzero if functions must have frame pointers.
634 Zero means the frame pointer need not be set up (and parms
635 may be accessed via the stack pointer) in functions that seem suitable.
636 This is computed in `reload', in reload1.c. */
637 #define FRAME_POINTER_REQUIRED 0
639 /* If defined, this macro specifies a table of register pairs used to
640 eliminate unneeded registers that point into the stack frame. If
641 it is not defined, the only elimination attempted by the compiler
642 is to replace references to the frame pointer with references to
645 The definition of this macro is a list of structure
646 initializations, each of which specifies an original and
647 replacement register.
649 On some machines, the position of the argument pointer is not
650 known until the compilation is completed. In such a case, a
651 separate hard register must be used for the argument pointer.
652 This register can be eliminated by replacing it with either the
653 frame pointer or the argument pointer, depending on whether or not
654 the frame pointer has been eliminated.
656 In this case, you might specify:
657 #define ELIMINABLE_REGS \
658 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
659 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
660 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
662 Note that the elimination of the argument pointer with the stack
663 pointer is specified first since that is the preferred elimination. */
665 #define ELIMINABLE_REGS \
666 {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
667 { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \
668 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
669 { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }} \
671 /* A C expression that returns nonzero if the compiler is allowed to
672 try to replace register number FROM-REG with register number
673 TO-REG. This macro need only be defined if `ELIMINABLE_REGS' is
674 defined, and will usually be the constant 1, since most of the
675 cases preventing register elimination are things that the compiler
676 already knows about. */
678 #define CAN_ELIMINATE(FROM, TO) \
679 ((TO) == STACK_POINTER_REGNUM ? ! frame_pointer_needed : 1)
681 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
682 specifies the initial difference between the specified pair of
683 registers. This macro must be defined if `ELIMINABLE_REGS' is
686 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
688 if ((FROM) == FRAME_POINTER_REGNUM) \
689 (OFFSET) = get_frame_size () + current_function_outgoing_args_size; \
690 else if ((FROM) == ARG_POINTER_REGNUM) \
691 (OFFSET) = compute_frame_size (get_frame_size (), (long *)0); \
696 /* A guess for the V850. */
697 #define PROMOTE_PROTOTYPES 1
699 /* Keep the stack pointer constant throughout the function. */
700 #define ACCUMULATE_OUTGOING_ARGS 1
702 /* Value is the number of bytes of arguments automatically
703 popped when returning from a subroutine call.
704 FUNDECL is the declaration node of the function (as a tree),
705 FUNTYPE is the data type of the function (as a tree),
706 or for a library call it is an identifier node for the subroutine name.
707 SIZE is the number of bytes of arguments passed on the stack. */
709 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
711 #define RETURN_ADDR_RTX(COUNT, FP) v850_return_addr (COUNT)
713 /* Define a data type for recording info about an argument list
714 during the scan of that argument list. This data type should
715 hold all necessary information about the function itself
716 and about the args processed so far, enough to enable macros
717 such as FUNCTION_ARG to determine where the next arg should go. */
719 #define CUMULATIVE_ARGS struct cum_arg
720 struct cum_arg { int nbytes; int anonymous_args; };
722 /* Define where to put the arguments to a function.
723 Value is zero to push the argument on the stack,
724 or a hard register in which to store the argument.
726 MODE is the argument's machine mode.
727 TYPE is the data type of the argument (as a tree).
728 This is null for libcalls where that information may
730 CUM is a variable of type CUMULATIVE_ARGS which gives info about
731 the preceding args and about the function being called.
732 NAMED is nonzero if this argument is a named parameter
733 (otherwise it is an extra parameter matching an ellipsis). */
735 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
736 function_arg (&CUM, MODE, TYPE, NAMED)
738 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
739 function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
741 /* Initialize a variable CUM of type CUMULATIVE_ARGS
742 for a call to a function whose data type is FNTYPE.
743 For a library call, FNTYPE is 0. */
745 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
746 ((CUM).nbytes = 0, (CUM).anonymous_args = 0)
748 /* Update the data in CUM to advance over an argument
749 of mode MODE and data type TYPE.
750 (TYPE is null for libcalls where that information may not be available.) */
752 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
753 ((CUM).nbytes += ((MODE) != BLKmode \
754 ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD \
755 : (int_size_in_bytes (TYPE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD))
757 /* When a parameter is passed in a register, stack space is still
759 #define REG_PARM_STACK_SPACE(DECL) (!TARGET_GHS ? 16 : 0)
761 /* Define this if the above stack space is to be considered part of the
762 space allocated by the caller. */
763 #define OUTGOING_REG_PARM_STACK_SPACE
765 /* Do any setup necessary for varargs/stdargs functions. */
766 #define SETUP_INCOMING_VARARGS(CUM, MODE, TYPE, PAS, SECOND) \
767 (CUM).anonymous_args = (!TARGET_GHS ? 1 : 0);
769 /* Implement `va_arg'. */
770 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
771 v850_va_arg (valist, type)
773 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
774 ((TYPE) && int_size_in_bytes (TYPE) > 8)
776 #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
777 ((TYPE) && int_size_in_bytes (TYPE) > 8)
779 /* 1 if N is a possible register number for function argument passing. */
781 #define FUNCTION_ARG_REGNO_P(N) (N >= 6 && N <= 9)
783 /* Define how to find the value returned by a function.
784 VALTYPE is the data type of the value (as a tree).
785 If the precise function being called is known, FUNC is its FUNCTION_DECL;
786 otherwise, FUNC is 0. */
788 #define FUNCTION_VALUE(VALTYPE, FUNC) \
789 gen_rtx_REG (TYPE_MODE (VALTYPE), 10)
791 /* Define how to find the value returned by a library function
792 assuming the value has mode MODE. */
794 #define LIBCALL_VALUE(MODE) \
795 gen_rtx_REG (MODE, 10)
797 /* 1 if N is a possible register number for a function value. */
799 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 10)
801 /* Return values > 8 bytes in length in memory. */
802 #define DEFAULT_PCC_STRUCT_RETURN 0
803 #define RETURN_IN_MEMORY(TYPE) \
804 (int_size_in_bytes (TYPE) > 8 || TYPE_MODE (TYPE) == BLKmode)
806 /* Register in which address to store a structure value
807 is passed to a function. On the V850 it's passed as
808 the first parameter. */
810 #define STRUCT_VALUE 0
812 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
813 the stack pointer does not matter. The value is tested only in
814 functions that have frame pointers.
815 No definition is equivalent to always zero. */
817 #define EXIT_IGNORE_STACK 1
819 /* Define this macro as a C expression that is nonzero for registers
820 used by the epilogue or the `return' pattern. */
822 #define EPILOGUE_USES(REGNO) \
823 (reload_completed && (REGNO) == LINK_POINTER_REGNUM)
825 /* Output assembler code to FILE to increment profiler label # LABELNO
826 for profiling a function entry. */
828 #define FUNCTION_PROFILER(FILE, LABELNO) ;
830 #define TRAMPOLINE_TEMPLATE(FILE) \
832 fprintf (FILE, "\tjarl .+4,r12\n"); \
833 fprintf (FILE, "\tld.w 12[r12],r20\n"); \
834 fprintf (FILE, "\tld.w 16[r12],r12\n"); \
835 fprintf (FILE, "\tjmp [r12]\n"); \
836 fprintf (FILE, "\tnop\n"); \
837 fprintf (FILE, "\t.long 0\n"); \
838 fprintf (FILE, "\t.long 0\n"); \
841 /* Length in units of the trampoline for entering a nested function. */
843 #define TRAMPOLINE_SIZE 24
845 /* Emit RTL insns to initialize the variable parts of a trampoline.
846 FNADDR is an RTX for the address of the function's pure code.
847 CXT is an RTX for the static chain value for the function. */
849 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
851 emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 16)), \
853 emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 20)), \
857 /* Addressing modes, and classification of registers for them. */
860 /* 1 if X is an rtx for a constant that is a valid address. */
862 /* ??? This seems too exclusive. May get better code by accepting more
863 possibilities here, in particular, should accept ZDA_NAME SYMBOL_REFs. */
865 #define CONSTANT_ADDRESS_P(X) \
866 (GET_CODE (X) == CONST_INT \
867 && CONST_OK_FOR_K (INTVAL (X)))
869 /* Maximum number of registers that can appear in a valid memory address. */
871 #define MAX_REGS_PER_ADDRESS 1
873 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
874 and check its validity for a certain class.
875 We have two alternate definitions for each of them.
876 The usual definition accepts all pseudo regs; the other rejects
877 them unless they have been allocated suitable hard regs.
878 The symbol REG_OK_STRICT causes the latter definition to be used.
880 Most source files want to accept pseudo regs in the hope that
881 they will get allocated to the class that the insn wants them to be in.
882 Source files for reload pass need to be strict.
883 After reload, it makes no difference, since pseudo regs have
884 been eliminated by then. */
886 #ifndef REG_OK_STRICT
888 /* Nonzero if X is a hard reg that can be used as an index
889 or if it is a pseudo reg. */
890 #define REG_OK_FOR_INDEX_P(X) 0
891 /* Nonzero if X is a hard reg that can be used as a base reg
892 or if it is a pseudo reg. */
893 #define REG_OK_FOR_BASE_P(X) 1
894 #define REG_OK_FOR_INDEX_P_STRICT(X) 0
895 #define REG_OK_FOR_BASE_P_STRICT(X) REGNO_OK_FOR_BASE_P (REGNO (X))
900 /* Nonzero if X is a hard reg that can be used as an index. */
901 #define REG_OK_FOR_INDEX_P(X) 0
902 /* Nonzero if X is a hard reg that can be used as a base reg. */
903 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
908 /* A C expression that defines the optional machine-dependent
909 constraint letters that can be used to segregate specific types of
910 operands, usually memory references, for the target machine.
911 Normally this macro will not be defined. If it is required for a
912 particular target machine, it should return 1 if VALUE corresponds
913 to the operand type represented by the constraint letter C. If C
914 is not defined as an extra constraint, the value returned should
915 be 0 regardless of VALUE.
917 For example, on the ROMP, load instructions cannot have their
918 output in r0 if the memory reference contains a symbolic address.
919 Constraint letter `Q' is defined as representing a memory address
920 that does *not* contain a symbolic address. An alternative is
921 specified with a `Q' constraint on the input and `r' on the
922 output. The next alternative specifies `m' on the input and a
923 register class that does not include r0 on the output. */
925 #define EXTRA_CONSTRAINT(OP, C) \
926 ((C) == 'Q' ? ep_memory_operand (OP, GET_MODE (OP), 0) \
927 : (C) == 'R' ? special_symbolref_operand (OP, VOIDmode) \
928 : (C) == 'S' ? (GET_CODE (OP) == SYMBOL_REF \
929 && !SYMBOL_REF_ZDA_P (OP)) \
930 : (C) == 'T' ? ep_memory_operand(OP,GET_MODE(OP),TRUE) \
931 : (C) == 'U' ? ((GET_CODE (OP) == SYMBOL_REF \
932 && SYMBOL_REF_ZDA_P (OP)) \
933 || (GET_CODE (OP) == CONST \
934 && GET_CODE (XEXP (OP, 0)) == PLUS \
935 && GET_CODE (XEXP (XEXP (OP, 0), 0)) == SYMBOL_REF \
936 && SYMBOL_REF_ZDA_P (XEXP (XEXP (OP, 0), 0)))) \
939 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
940 that is a valid memory address for an instruction.
941 The MODE argument is the machine mode for the MEM expression
942 that wants to use this address.
944 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
945 except for CONSTANT_ADDRESS_P which is actually
946 machine-independent. */
948 /* Accept either REG or SUBREG where a register is valid. */
950 #define RTX_OK_FOR_BASE_P(X) \
951 ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \
952 || (GET_CODE (X) == SUBREG && REG_P (SUBREG_REG (X)) \
953 && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
955 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
957 if (RTX_OK_FOR_BASE_P (X)) goto ADDR; \
958 if (CONSTANT_ADDRESS_P (X) \
959 && (MODE == QImode || INTVAL (X) % 2 == 0) \
960 && (GET_MODE_SIZE (MODE) <= 4 || INTVAL (X) % 4 == 0)) \
962 if (GET_CODE (X) == LO_SUM \
963 && GET_CODE (XEXP (X, 0)) == REG \
964 && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
965 && CONSTANT_P (XEXP (X, 1)) \
966 && (GET_CODE (XEXP (X, 1)) != CONST_INT \
967 || ((MODE == QImode || INTVAL (XEXP (X, 1)) % 2 == 0) \
968 && CONST_OK_FOR_K (INTVAL (XEXP (X, 1))))) \
969 && GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode)) \
971 if (special_symbolref_operand (X, MODE) \
972 && (GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode))) \
974 if (GET_CODE (X) == PLUS \
975 && CONSTANT_ADDRESS_P (XEXP (X, 1)) \
976 && (MODE == QImode || INTVAL (XEXP (X, 1)) % 2 == 0) \
977 && RTX_OK_FOR_BASE_P (XEXP (X, 0))) goto ADDR; \
981 /* Try machine-dependent ways of modifying an illegitimate address
982 to be legitimate. If we find one, return the new, valid address.
983 This macro is used in only one place: `memory_address' in explow.c.
985 OLDX is the address as it was before break_out_memory_refs was called.
986 In some cases it is useful to look at this to decide what needs to be done.
988 MODE and WIN are passed so that this macro can use
989 GO_IF_LEGITIMATE_ADDRESS.
991 It is always safe for this macro to do nothing. It exists to recognize
992 opportunities to optimize the output. */
994 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
996 /* Go to LABEL if ADDR (a legitimate address expression)
997 has an effect that depends on the machine mode it is used for. */
999 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
1001 /* Nonzero if the constant value X is a legitimate general operand.
1002 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1004 #define LEGITIMATE_CONSTANT_P(X) \
1005 (GET_CODE (X) == CONST_DOUBLE \
1006 || !(GET_CODE (X) == CONST \
1007 && GET_CODE (XEXP (X, 0)) == PLUS \
1008 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF \
1009 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
1010 && ! CONST_OK_FOR_K (INTVAL (XEXP (XEXP (X, 0), 1)))))
1012 /* Tell final.c how to eliminate redundant test instructions. */
1014 /* Here we define machine-dependent flags and fields in cc_status
1015 (see `conditions.h'). No extra ones are needed for the VAX. */
1017 /* Store in cc_status the expressions
1018 that the condition codes will describe
1019 after execution of an instruction whose pattern is EXP.
1020 Do not alter them if the instruction would not alter the cc's. */
1022 #define CC_OVERFLOW_UNUSABLE 0x200
1023 #define CC_NO_CARRY CC_NO_OVERFLOW
1024 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
1026 /* Nonzero if access to memory by bytes or half words is no faster
1027 than accessing full words. */
1028 #define SLOW_BYTE_ACCESS 1
1030 /* According expr.c, a value of around 6 should minimize code size, and
1031 for the V850 series, that's our primary concern. */
1032 #define MOVE_RATIO 6
1034 /* Indirect calls are expensive, never turn a direct call
1035 into an indirect call. */
1036 #define NO_FUNCTION_CSE
1038 /* The four different data regions on the v850. */
1047 /* A list of names for sections other than the standard two, which are
1048 `in_text' and `in_data'. You need not define this macro on a
1049 system with no other sections (that GCC needs to use). */
1050 #undef EXTRA_SECTIONS
1051 #define EXTRA_SECTIONS in_tdata, in_sdata, in_zdata, \
1052 in_rozdata, in_rosdata, in_sbss, in_zbss, in_zcommon, in_scommon
1054 /* One or more functions to be defined in `varasm.c'. These
1055 functions should do jobs analogous to those of `text_section' and
1056 `data_section', for your additional sections. Do not define this
1057 macro if you do not define `EXTRA_SECTIONS'. */
1058 #undef EXTRA_SECTION_FUNCTIONS
1060 /* This could be done a lot more cleanly using ANSI C ... */
1061 #define EXTRA_SECTION_FUNCTIONS \
1065 if (in_section != in_sdata) \
1067 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
1068 in_section = in_sdata; \
1073 rosdata_section () \
1075 if (in_section != in_rosdata) \
1077 fprintf (asm_out_file, "%s\n", ROSDATA_SECTION_ASM_OP); \
1078 in_section = in_sdata; \
1085 if (in_section != in_sbss) \
1087 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
1088 in_section = in_sbss; \
1095 if (in_section != in_tdata) \
1097 fprintf (asm_out_file, "%s\n", TDATA_SECTION_ASM_OP); \
1098 in_section = in_tdata; \
1105 if (in_section != in_zdata) \
1107 fprintf (asm_out_file, "%s\n", ZDATA_SECTION_ASM_OP); \
1108 in_section = in_zdata; \
1113 rozdata_section () \
1115 if (in_section != in_rozdata) \
1117 fprintf (asm_out_file, "%s\n", ROZDATA_SECTION_ASM_OP); \
1118 in_section = in_rozdata; \
1125 if (in_section != in_zbss) \
1127 fprintf (asm_out_file, "%s\n", ZBSS_SECTION_ASM_OP); \
1128 in_section = in_zbss; \
1132 #define TEXT_SECTION_ASM_OP "\t.section .text"
1133 #define DATA_SECTION_ASM_OP "\t.section .data"
1134 #define BSS_SECTION_ASM_OP "\t.section .bss"
1135 #define SDATA_SECTION_ASM_OP "\t.section .sdata,\"aw\""
1136 #define SBSS_SECTION_ASM_OP "\t.section .sbss,\"aw\""
1137 #define ZDATA_SECTION_ASM_OP "\t.section .zdata,\"aw\""
1138 #define ZBSS_SECTION_ASM_OP "\t.section .zbss,\"aw\""
1139 #define TDATA_SECTION_ASM_OP "\t.section .tdata,\"aw\""
1140 #define ROSDATA_SECTION_ASM_OP "\t.section .rosdata,\"a\""
1141 #define ROZDATA_SECTION_ASM_OP "\t.section .rozdata,\"a\""
1143 #define SCOMMON_ASM_OP "\t.scomm\t"
1144 #define ZCOMMON_ASM_OP "\t.zcomm\t"
1145 #define TCOMMON_ASM_OP "\t.tcomm\t"
1147 /* Output at beginning/end of assembler file. */
1148 #undef ASM_FILE_START
1149 #define ASM_FILE_START(FILE) asm_file_start(FILE)
1151 #define ASM_COMMENT_START "#"
1153 /* Output to assembler file text saying following lines
1154 may contain character constants, extra white space, comments, etc. */
1156 #define ASM_APP_ON "#APP\n"
1158 /* Output to assembler file text saying following lines
1159 no longer contain unusual constructs. */
1161 #define ASM_APP_OFF "#NO_APP\n"
1163 #undef USER_LABEL_PREFIX
1164 #define USER_LABEL_PREFIX "_"
1166 #define OUTPUT_ADDR_CONST_EXTRA(FILE, X, FAIL) \
1167 if (! v850_output_addr_const_extra (FILE, X)) \
1170 /* This says how to output the assembler to define a global
1171 uninitialized but not common symbol. */
1173 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
1174 asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
1176 #undef ASM_OUTPUT_ALIGNED_BSS
1177 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
1178 v850_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
1180 /* This says how to output the assembler to define a global
1181 uninitialized, common symbol. */
1182 #undef ASM_OUTPUT_ALIGNED_COMMON
1183 #undef ASM_OUTPUT_COMMON
1184 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
1185 v850_output_common (FILE, DECL, NAME, SIZE, ALIGN)
1187 /* This says how to output the assembler to define a local
1188 uninitialized symbol. */
1189 #undef ASM_OUTPUT_ALIGNED_LOCAL
1190 #undef ASM_OUTPUT_LOCAL
1191 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
1192 v850_output_local (FILE, DECL, NAME, SIZE, ALIGN)
1194 /* Globalizing directive for a label. */
1195 #define GLOBAL_ASM_OP "\t.global "
1197 #define ASM_PN_FORMAT "%s___%lu"
1199 /* This is how we tell the assembler that two symbols have the same value. */
1201 #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
1202 do { assemble_name(FILE, NAME1); \
1203 fputs(" = ", FILE); \
1204 assemble_name(FILE, NAME2); \
1205 fputc('\n', FILE); } while (0)
1208 /* How to refer to registers in assembler output.
1209 This sequence is indexed by compiler's hard-register-number (see above). */
1211 #define REGISTER_NAMES \
1212 { "r0", "r1", "r2", "sp", "gp", "r5", "r6" , "r7", \
1213 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
1214 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
1215 "r24", "r25", "r26", "r27", "r28", "r29", "ep", "r31", \
1218 #define ADDITIONAL_REGISTER_NAMES \
1228 /* Print an instruction operand X on file FILE.
1229 look in v850.c for details */
1231 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1233 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1236 /* Print a memory operand whose address is X, on file FILE.
1237 This uses a function in output-vax.c. */
1239 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
1241 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)
1242 #define ASM_OUTPUT_REG_POP(FILE,REGNO)
1244 /* This is how to output an element of a case-vector that is absolute. */
1246 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1247 fprintf (FILE, "\t%s .L%d\n", \
1248 (TARGET_BIG_SWITCH ? ".long" : ".short"), VALUE)
1250 /* This is how to output an element of a case-vector that is relative. */
1252 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1253 fprintf (FILE, "\t%s %s.L%d-.L%d%s\n", \
1254 (TARGET_BIG_SWITCH ? ".long" : ".short"), \
1255 (! TARGET_BIG_SWITCH && TARGET_V850E ? "(" : ""), \
1257 (! TARGET_BIG_SWITCH && TARGET_V850E ? ")>>1" : ""))
1259 #define ASM_OUTPUT_ALIGN(FILE, LOG) \
1261 fprintf (FILE, "\t.align %d\n", (LOG))
1263 /* We don't have to worry about dbx compatibility for the v850. */
1264 #define DEFAULT_GDB_EXTENSIONS 1
1266 /* Use stabs debugging info by default. */
1267 #undef PREFERRED_DEBUGGING_TYPE
1268 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
1270 /* Specify the machine mode that this machine uses
1271 for the index in the tablejump instruction. */
1272 #define CASE_VECTOR_MODE (TARGET_BIG_SWITCH ? SImode : HImode)
1274 /* Define this if the case instruction drops through after the table
1275 when the index is out of range. Don't define it if the case insn
1276 jumps to the default label instead. */
1277 /* #define CASE_DROPS_THROUGH */
1279 /* Define as C expression which evaluates to nonzero if the tablejump
1280 instruction expects the table to contain offsets from the address of the
1282 Do not define this if the table should contain absolute addresses. */
1283 #define CASE_VECTOR_PC_RELATIVE 1
1285 /* The switch instruction requires that the jump table immediately follow
1287 #define JUMP_TABLES_IN_TEXT_SECTION 1
1289 /* svr4.h defines this assuming that 4 byte alignment is required. */
1290 #undef ASM_OUTPUT_BEFORE_CASE_LABEL
1291 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
1292 ASM_OUTPUT_ALIGN ((FILE), (TARGET_BIG_SWITCH ? 2 : 1));
1294 #define WORD_REGISTER_OPERATIONS
1296 /* Byte and short loads sign extend the value to a word. */
1297 #define LOAD_EXTEND_OP(MODE) SIGN_EXTEND
1299 /* This flag, if defined, says the same insns that convert to a signed fixnum
1300 also convert validly to an unsigned one. */
1301 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC
1303 /* Max number of bytes we can move from memory to memory
1304 in one reasonably fast instruction. */
1307 /* Define if shifts truncate the shift count
1308 which implies one can omit a sign-extension or zero-extension
1309 of a shift count. */
1310 #define SHIFT_COUNT_TRUNCATED 1
1312 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1313 is done just by pretending it is already truncated. */
1314 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1316 #define MULDI3_LIBCALL "__muldi3"
1317 #define UCMPDI2_LIBCALL "__ucmpdi2"
1318 #define CMPDI2_LIBCALL "__cmpdi2"
1319 #define NEGDI2_LIBCALL "__negdi2"
1321 #define INIT_TARGET_OPTABS \
1324 cmp_optab->handlers[(int) DImode].libfunc \
1325 = init_one_libfunc (CMPDI2_LIBCALL); \
1326 ucmp_optab->handlers[(int) DImode].libfunc \
1327 = init_one_libfunc (UCMPDI2_LIBCALL); \
1328 neg_optab->handlers[(int) DImode].libfunc \
1329 = init_one_libfunc (NEGDI2_LIBCALL); \
1333 /* Specify the machine mode that pointers have.
1334 After generation of rtl, the compiler makes no further distinction
1335 between pointers and any other objects of this machine mode. */
1336 #define Pmode SImode
1338 /* A function address in a call instruction
1339 is a byte address (for indexing purposes)
1340 so give the MEM rtx a byte's mode. */
1341 #define FUNCTION_MODE QImode
1343 /* Tell compiler we want to support GHS pragmas */
1344 #define REGISTER_TARGET_PRAGMAS() do { \
1345 c_register_pragma ("ghs", "interrupt", ghs_pragma_interrupt); \
1346 c_register_pragma ("ghs", "section", ghs_pragma_section); \
1347 c_register_pragma ("ghs", "starttda", ghs_pragma_starttda); \
1348 c_register_pragma ("ghs", "startsda", ghs_pragma_startsda); \
1349 c_register_pragma ("ghs", "startzda", ghs_pragma_startzda); \
1350 c_register_pragma ("ghs", "endtda", ghs_pragma_endtda); \
1351 c_register_pragma ("ghs", "endsda", ghs_pragma_endsda); \
1352 c_register_pragma ("ghs", "endzda", ghs_pragma_endzda); \
1355 /* enum GHS_SECTION_KIND is an enumeration of the kinds of sections that
1356 can appear in the "ghs section" pragma. These names are used to index
1357 into the GHS_default_section_names[] and GHS_current_section_names[]
1358 that are defined in v850.c, and so the ordering of each must remain
1361 These arrays give the default and current names for each kind of
1362 section defined by the GHS pragmas. The current names can be changed
1363 by the "ghs section" pragma. If the current names are null, use
1364 the default names. Note that the two arrays have different types.
1366 For the *normal* section kinds (like .data, .text, etc.) we do not
1367 want to explicitly force the name of these sections, but would rather
1368 let the linker (or at least the back end) choose the name of the
1369 section, UNLESS the user has force a specific name for these section
1370 kinds. To accomplish this set the name in ghs_default_section_names
1373 enum GHS_section_kind
1375 GHS_SECTION_KIND_DEFAULT,
1377 GHS_SECTION_KIND_TEXT,
1378 GHS_SECTION_KIND_DATA,
1379 GHS_SECTION_KIND_RODATA,
1380 GHS_SECTION_KIND_BSS,
1381 GHS_SECTION_KIND_SDATA,
1382 GHS_SECTION_KIND_ROSDATA,
1383 GHS_SECTION_KIND_TDATA,
1384 GHS_SECTION_KIND_ZDATA,
1385 GHS_SECTION_KIND_ROZDATA,
1387 COUNT_OF_GHS_SECTION_KINDS /* must be last */
1390 /* The following code is for handling pragmas supported by the
1391 v850 compiler produced by Green Hills Software. This is at
1392 the specific request of a customer. */
1394 typedef struct data_area_stack_element
1396 struct data_area_stack_element * prev;
1397 v850_data_area data_area; /* Current default data area. */
1398 } data_area_stack_element;
1400 /* Track the current data area set by the
1401 data area pragma (which can be nested). */
1402 extern data_area_stack_element * data_area_stack;
1404 /* Names of the various data areas used on the v850. */
1405 extern union tree_node * GHS_default_section_names [(int) COUNT_OF_GHS_SECTION_KINDS];
1406 extern union tree_node * GHS_current_section_names [(int) COUNT_OF_GHS_SECTION_KINDS];
1408 /* The assembler op to start the file. */
1410 #define FILE_ASM_OP "\t.file\n"
1412 /* Enable the register move pass to improve code. */
1413 #define ENABLE_REGMOVE_PASS
1416 /* Implement ZDA, TDA, and SDA */
1418 #define EP_REGNUM 30 /* ep register number */
1420 #define SYMBOL_FLAG_ZDA (SYMBOL_FLAG_MACH_DEP << 0)
1421 #define SYMBOL_FLAG_TDA (SYMBOL_FLAG_MACH_DEP << 1)
1422 #define SYMBOL_FLAG_SDA (SYMBOL_FLAG_MACH_DEP << 2)
1423 #define SYMBOL_REF_ZDA_P(X) ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_ZDA) != 0)
1424 #define SYMBOL_REF_TDA_P(X) ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_TDA) != 0)
1425 #define SYMBOL_REF_SDA_P(X) ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_SDA) != 0)
1427 /* Define this if you have defined special-purpose predicates in the
1428 file `MACHINE.c'. This macro is called within an initializer of an
1429 array of structures. The first field in the structure is the name
1430 of a predicate and the second field is an array of rtl codes. For
1431 each predicate, list all rtl codes that can be in expressions
1432 matched by the predicate. The list should have a trailing comma. */
1434 #define PREDICATE_CODES \
1435 { "reg_or_0_operand", { REG, SUBREG, CONST_INT, CONST_DOUBLE }}, \
1436 { "reg_or_int5_operand", { REG, SUBREG, CONST_INT }}, \
1437 { "reg_or_int9_operand", { REG, SUBREG, CONST_INT }}, \
1438 { "reg_or_const_operand", { REG, CONST_INT }}, \
1439 { "call_address_operand", { REG, SYMBOL_REF }}, \
1440 { "movsi_source_operand", { LABEL_REF, SYMBOL_REF, CONST_INT, \
1441 CONST_DOUBLE, CONST, HIGH, MEM, \
1443 { "special_symbolref_operand", { SYMBOL_REF }}, \
1444 { "power_of_two_operand", { CONST_INT }}, \
1445 { "pattern_is_ok_for_prologue", { PARALLEL }}, \
1446 { "pattern_is_ok_for_epilogue", { PARALLEL }}, \
1447 { "register_is_ok_for_epilogue",{ REG }}, \
1448 { "pattern_is_ok_for_dispose", { PARALLEL }}, \
1449 { "pattern_is_ok_for_prepare", { PARALLEL }}, \
1450 { "register_is_ok_for_dispose", { REG }}, \
1451 { "not_power_of_two_operand", { CONST_INT }},
1453 #endif /* ! GCC_V850_H */