final.c (output_addr_const): Use target opening and closing parentheses.
[official-gcc.git] / gcc / config / v850 / v850.h
blob604a7686ce3ca333d29ac5c8a12a9a77c8fe7890
1 /* Definitions of target machine for GNU compiler. NEC V850 series
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
3 Contributed by Jeff Law (law@cygnus.com).
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 #ifndef GCC_V850_H
23 #define GCC_V850_H
25 #include "svr4.h" /* Automatically does #undef CPP_PREDEFINES */
27 /* These are defiend in svr4.h but we want to override them. */
28 #undef ASM_FINAL_SPEC
29 #undef LIB_SPEC
30 #undef ENDFILE_SPEC
31 #undef LINK_SPEC
32 #undef STARTFILE_SPEC
33 #undef ASM_SPEC
36 #define TARGET_CPU_generic 1
38 #ifndef TARGET_CPU_DEFAULT
39 #define TARGET_CPU_DEFAULT TARGET_CPU_generic
40 #endif
42 #define MASK_DEFAULT MASK_V850
43 #define SUBTARGET_ASM_SPEC "%{!mv*:-mv850}"
44 #define SUBTARGET_CPP_SPEC "%{!mv*:-D__v850__}"
45 #define TARGET_VERSION fprintf (stderr, " (NEC V850)");
48 #define ASM_SPEC "%{mv*:-mv%*}"
49 #define CPP_SPEC "%{mv850ea:-D__v850ea__} %{mv850e:-D__v850e__} %{mv850:-D__v850__} %(subtarget_cpp_spec)"
51 #define EXTRA_SPECS \
52 { "subtarget_asm_spec", SUBTARGET_ASM_SPEC }, \
53 { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }
55 /* Names to predefine in the preprocessor for this target machine. */
56 #define CPP_PREDEFINES "-D__v851__ -D__v850"
58 /* Run-time compilation parameters selecting different hardware subsets. */
60 extern int target_flags;
62 /* Target flags bits, see below for an explanation of the bits. */
63 #define MASK_GHS 0x00000001
64 #define MASK_LONG_CALLS 0x00000002
65 #define MASK_EP 0x00000004
66 #define MASK_PROLOG_FUNCTION 0x00000008
67 #define MASK_DEBUG 0x40000000
69 #define MASK_CPU 0x00000030
70 #define MASK_V850 0x00000010
72 #define MASK_BIG_SWITCH 0x00000100
74 /* Macros used in the machine description to test the flags. */
76 /* The GHS calling convention support doesn't really work,
77 mostly due to a lack of documentation. Outstanding issues:
79 * How do varargs & stdarg really work. How to they handle
80 passing structures (if at all).
82 * Doubles are normally 4 byte aligned, except in argument
83 lists where they are 8 byte aligned. Is the alignment
84 in the argument list based on the first parameter,
85 first stack parameter, etc etc.
87 * Passing/returning of large structures probably isn't the same
88 as GHS. We don't have enough documentation on their conventions
89 to be compatible.
91 * Tests of SETUP_INCOMING_VARARGS need to be made runtime checks
92 since it depends on TARGET_GHS. */
93 #define TARGET_GHS (target_flags & MASK_GHS)
95 /* Don't do PC-relative calls, instead load the address of the target
96 function into a register and perform a register indirect call. */
97 #define TARGET_LONG_CALLS (target_flags & MASK_LONG_CALLS)
99 /* Whether to optimize space by using ep (r30) for pointers with small offsets
100 in basic blocks. */
101 #define TARGET_EP (target_flags & MASK_EP)
103 /* Whether to call out-of-line functions to save registers or not. */
104 #define TARGET_PROLOG_FUNCTION (target_flags & MASK_PROLOG_FUNCTION)
106 #define TARGET_V850 ((target_flags & MASK_CPU) == MASK_V850)
108 /* Whether to emit 2 byte per entry or 4 byte per entry switch tables. */
109 #define TARGET_BIG_SWITCH (target_flags & MASK_BIG_SWITCH)
111 /* General debug flag */
112 #define TARGET_DEBUG (target_flags & MASK_DEBUG)
114 /* Macro to define tables used to set the flags.
115 This is a list in braces of pairs in braces,
116 each pair being { "NAME", VALUE }
117 where VALUE is the bits to set or minus the bits to clear.
118 An empty string NAME is used to identify the default VALUE. */
120 #define TARGET_SWITCHES \
121 {{ "ghs", MASK_GHS, N_("Support Green Hills ABI") }, \
122 { "no-ghs", -MASK_GHS, "" }, \
123 { "long-calls", MASK_LONG_CALLS, \
124 N_("Prohibit PC relative function calls") },\
125 { "no-long-calls", -MASK_LONG_CALLS, "" }, \
126 { "ep", MASK_EP, \
127 N_("Reuse r30 on a per function basis") }, \
128 { "no-ep", -MASK_EP, "" }, \
129 { "prolog-function", MASK_PROLOG_FUNCTION, \
130 N_("Use stubs for function prologues") }, \
131 { "no-prolog-function", -MASK_PROLOG_FUNCTION, "" }, \
132 { "space", MASK_EP | MASK_PROLOG_FUNCTION, \
133 N_("Same as: -mep -mprolog-function") }, \
134 { "debug", MASK_DEBUG, N_("Enable backend debugging") }, \
135 { "v850", MASK_V850, \
136 N_("Compile for the v850 processor") }, \
137 { "v850", -(MASK_V850 ^ MASK_CPU), "" }, \
138 { "big-switch", MASK_BIG_SWITCH, \
139 N_("Use 4 byte entries in switch tables") },\
140 { "", MASK_DEFAULT, ""}}
142 /* Information about the various small memory areas. */
143 struct small_memory_info {
144 const char *name;
145 const char *value;
146 long max;
147 long physical_max;
150 enum small_memory_type {
151 /* tiny data area, using EP as base register */
152 SMALL_MEMORY_TDA = 0,
153 /* small data area using dp as base register */
154 SMALL_MEMORY_SDA,
155 /* zero data area using r0 as base register */
156 SMALL_MEMORY_ZDA,
157 SMALL_MEMORY_max
160 extern struct small_memory_info small_memory[(int)SMALL_MEMORY_max];
162 /* This macro is similar to `TARGET_SWITCHES' but defines names of
163 command options that have values. Its definition is an
164 initializer with a subgrouping for each command option.
166 Each subgrouping contains a string constant, that defines the
167 fixed part of the option name, and the address of a variable. The
168 variable, type `char *', is set to the variable part of the given
169 option if the fixed part matches. The actual option name is made
170 by appending `-m' to the specified name.
172 Here is an example which defines `-mshort-data-NUMBER'. If the
173 given option is `-mshort-data-512', the variable `m88k_short_data'
174 will be set to the string `"512"'.
176 extern char *m88k_short_data;
177 #define TARGET_OPTIONS \
178 { { "short-data-", &m88k_short_data } } */
180 #define TARGET_OPTIONS \
182 { "tda=", &small_memory[ (int)SMALL_MEMORY_TDA ].value, \
183 N_("Set the max size of data eligible for the TDA area") }, \
184 { "tda-", &small_memory[ (int)SMALL_MEMORY_TDA ].value, "" }, \
185 { "sda=", &small_memory[ (int)SMALL_MEMORY_SDA ].value, \
186 N_("Set the max size of data eligible for the SDA area") }, \
187 { "sda-", &small_memory[ (int)SMALL_MEMORY_SDA ].value, "" }, \
188 { "zda=", &small_memory[ (int)SMALL_MEMORY_ZDA ].value, \
189 N_("Set the max size of data eligible for the ZDA area") }, \
190 { "zda-", &small_memory[ (int)SMALL_MEMORY_ZDA ].value, "" }, \
193 /* Sometimes certain combinations of command options do not make
194 sense on a particular target machine. You can define a macro
195 `OVERRIDE_OPTIONS' to take account of this. This macro, if
196 defined, is executed once just after all the command options have
197 been parsed.
199 Don't use this macro to turn on various extra optimizations for
200 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
201 #define OVERRIDE_OPTIONS override_options ()
204 /* Show we can debug even without a frame pointer. */
205 #define CAN_DEBUG_WITHOUT_FP
207 /* Some machines may desire to change what optimizations are
208 performed for various optimization levels. This macro, if
209 defined, is executed once just after the optimization level is
210 determined and before the remainder of the command options have
211 been parsed. Values set in this macro are used as the default
212 values for the other command line options.
214 LEVEL is the optimization level specified; 2 if `-O2' is
215 specified, 1 if `-O' is specified, and 0 if neither is specified.
217 SIZE is non-zero if `-Os' is specified, 0 otherwise.
219 You should not use this macro to change options that are not
220 machine-specific. These should uniformly selected by the same
221 optimization level on all supported machines. Use this macro to
222 enable machine-specific optimizations.
224 *Do not examine `write_symbols' in this macro!* The debugging
225 options are not supposed to alter the generated code. */
227 #define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
229 if (LEVEL) \
230 target_flags |= (MASK_EP | MASK_PROLOG_FUNCTION); \
234 /* Target machine storage layout */
236 /* Define this if most significant bit is lowest numbered
237 in instructions that operate on numbered bit-fields.
238 This is not true on the NEC V850. */
239 #define BITS_BIG_ENDIAN 0
241 /* Define this if most significant byte of a word is the lowest numbered. */
242 /* This is not true on the NEC V850. */
243 #define BYTES_BIG_ENDIAN 0
245 /* Define this if most significant word of a multiword number is lowest
246 numbered.
247 This is not true on the NEC V850. */
248 #define WORDS_BIG_ENDIAN 0
250 /* Number of bits in an addressable storage unit */
251 #define BITS_PER_UNIT 8
253 /* Width in bits of a "word", which is the contents of a machine register.
254 Note that this is not necessarily the width of data type `int';
255 if using 16-bit ints on a 68000, this would still be 32.
256 But on a machine with 16-bit registers, this would be 16. */
257 #define BITS_PER_WORD 32
259 /* Width of a word, in units (bytes). */
260 #define UNITS_PER_WORD 4
262 /* Width in bits of a pointer.
263 See also the macro `Pmode' defined below. */
264 #define POINTER_SIZE 32
266 /* Define this macro if it is advisable to hold scalars in registers
267 in a wider mode than that declared by the program. In such cases,
268 the value is constrained to be within the bounds of the declared
269 type, but kept valid in the wider mode. The signedness of the
270 extension may differ from that of the type.
272 Some simple experiments have shown that leaving UNSIGNEDP alone
273 generates the best overall code. */
275 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
276 if (GET_MODE_CLASS (MODE) == MODE_INT \
277 && GET_MODE_SIZE (MODE) < 4) \
278 { (MODE) = SImode; }
280 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
281 #define PARM_BOUNDARY 32
283 /* The stack goes in 32 bit lumps. */
284 #define STACK_BOUNDARY 32
286 /* Allocation boundary (in *bits*) for the code of a function.
287 16 is the minimum boundary; 32 would give better performance. */
288 #define FUNCTION_BOUNDARY 16
290 /* No data type wants to be aligned rounder than this. */
291 #define BIGGEST_ALIGNMENT 32
293 /* Alignment of field after `int : 0' in a structure. */
294 #define EMPTY_FIELD_BOUNDARY 32
296 /* No structure field wants to be aligned rounder than this. */
297 #define BIGGEST_FIELD_ALIGNMENT 32
299 /* Define this if move instructions will actually fail to work
300 when given unaligned data. */
301 #define STRICT_ALIGNMENT 1
303 /* Define this as 1 if `char' should by default be signed; else as 0.
305 On the NEC V850, loads do sign extension, so make this default. */
306 #define DEFAULT_SIGNED_CHAR 1
308 /* Standard register usage. */
310 /* Number of actual hardware registers.
311 The hardware registers are assigned numbers for the compiler
312 from 0 to just below FIRST_PSEUDO_REGISTER.
314 All registers that the compiler knows about must be given numbers,
315 even those that are not normally considered general registers. */
317 #define FIRST_PSEUDO_REGISTER 34
319 /* 1 for registers that have pervasive standard uses
320 and are not available for the register allocator. */
322 #define FIXED_REGISTERS \
323 { 1, 1, 0, 1, 1, 0, 0, 0, \
324 0, 0, 0, 0, 0, 0, 0, 0, \
325 0, 0, 0, 0, 0, 0, 0, 0, \
326 0, 0, 0, 0, 0, 0, 1, 0, \
327 1, 1}
329 /* 1 for registers not available across function calls.
330 These must include the FIXED_REGISTERS and also any
331 registers that can be used without being saved.
332 The latter must include the registers where values are returned
333 and the register where structure-value addresses are passed.
334 Aside from that, you can include as many other registers as you
335 like. */
337 #define CALL_USED_REGISTERS \
338 { 1, 1, 0, 1, 1, 1, 1, 1, \
339 1, 1, 1, 1, 1, 1, 1, 1, \
340 1, 1, 1, 1, 0, 0, 0, 0, \
341 0, 0, 0, 0, 0, 0, 1, 1, \
342 1, 1}
344 /* List the order in which to allocate registers. Each register must be
345 listed once, even those in FIXED_REGISTERS.
347 On the 850, we make the return registers first, then all of the volatile
348 registers, then the saved registers in reverse order to better save the
349 registers with an out of line function, and finally the fixed
350 registers. */
352 #define REG_ALLOC_ORDER \
354 10, 11, /* return registers */ \
355 12, 13, 14, 15, 16, 17, 18, 19, /* scratch registers */ \
356 6, 7, 8, 9, 31, /* argument registers */ \
357 29, 28, 27, 26, 25, 24, 23, 22, /* saved registers */ \
358 21, 20, 2, \
359 0, 1, 3, 4, 5, 30, 32, 33 /* fixed registers */ \
362 /* Return number of consecutive hard regs needed starting at reg REGNO
363 to hold something of mode MODE.
365 This is ordinarily the length in words of a value of mode MODE
366 but can be less for certain modes in special long registers. */
368 #define HARD_REGNO_NREGS(REGNO, MODE) \
369 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
371 /* Value is 1 if hard register REGNO can hold a value of machine-mode
372 MODE. */
374 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
375 ((((REGNO) & 1) == 0) || (GET_MODE_SIZE (MODE) <= 4))
377 /* Value is 1 if it is a good idea to tie two pseudo registers
378 when one has mode MODE1 and one has mode MODE2.
379 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
380 for any hard reg, then this must be 0 for correct output. */
381 #define MODES_TIEABLE_P(MODE1, MODE2) \
382 (MODE1 == MODE2 || (GET_MODE_SIZE (MODE1) <= 4 && GET_MODE_SIZE (MODE2) <= 4))
385 /* Define the classes of registers for register constraints in the
386 machine description. Also define ranges of constants.
388 One of the classes must always be named ALL_REGS and include all hard regs.
389 If there is more than one class, another class must be named NO_REGS
390 and contain no registers.
392 The name GENERAL_REGS must be the name of a class (or an alias for
393 another name such as ALL_REGS). This is the class of registers
394 that is allowed by "g" or "r" in a register constraint.
395 Also, registers outside this class are allocated only when
396 instructions express preferences for them.
398 The classes must be numbered in nondecreasing order; that is,
399 a larger-numbered class must never be contained completely
400 in a smaller-numbered class.
402 For any two classes, it is very desirable that there be another
403 class that represents their union. */
405 enum reg_class
407 NO_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
410 #define N_REG_CLASSES (int) LIM_REG_CLASSES
412 /* Give names of register classes as strings for dump file. */
414 #define REG_CLASS_NAMES \
415 { "NO_REGS", "GENERAL_REGS", "ALL_REGS", "LIM_REGS" }
417 /* Define which registers fit in which classes.
418 This is an initializer for a vector of HARD_REG_SET
419 of length N_REG_CLASSES. */
421 #define REG_CLASS_CONTENTS \
423 { 0x00000000 }, /* NO_REGS */ \
424 { 0xffffffff }, /* GENERAL_REGS */ \
425 { 0xffffffff }, /* ALL_REGS */ \
428 /* The same information, inverted:
429 Return the class number of the smallest class containing
430 reg number REGNO. This could be a conditional expression
431 or could index an array. */
433 #define REGNO_REG_CLASS(REGNO) GENERAL_REGS
435 /* The class value for index registers, and the one for base regs. */
437 #define INDEX_REG_CLASS NO_REGS
438 #define BASE_REG_CLASS GENERAL_REGS
440 /* Get reg_class from a letter such as appears in the machine description. */
442 #define REG_CLASS_FROM_LETTER(C) (NO_REGS)
444 /* Macros to check register numbers against specific register classes. */
446 /* These assume that REGNO is a hard or pseudo reg number.
447 They give nonzero only if REGNO is a hard reg of the suitable class
448 or a pseudo reg currently allocated to a suitable hard reg.
449 Since they use reg_renumber, they are safe only once reg_renumber
450 has been allocated, which happens in local-alloc.c. */
452 #define REGNO_OK_FOR_BASE_P(regno) \
453 ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
455 #define REGNO_OK_FOR_INDEX_P(regno) 0
457 /* Given an rtx X being reloaded into a reg required to be
458 in class CLASS, return the class of reg to actually use.
459 In general this is just CLASS; but on some machines
460 in some cases it is preferable to use a more restrictive class. */
462 #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
464 /* Return the maximum number of consecutive registers
465 needed to represent mode MODE in a register of class CLASS. */
467 #define CLASS_MAX_NREGS(CLASS, MODE) \
468 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
470 /* The letters I, J, K, L, M, N, O, P in a register constraint string
471 can be used to stand for particular ranges of immediate operands.
472 This macro defines what the ranges are.
473 C is the letter, and VALUE is a constant value.
474 Return 1 if VALUE is in the range specified by C. */
476 #define INT_7_BITS(VALUE) ((unsigned) (VALUE) + 0x40 < 0x80)
477 #define INT_8_BITS(VALUE) ((unsigned) (VALUE) + 0x80 < 0x100)
478 /* zero */
479 #define CONST_OK_FOR_I(VALUE) ((VALUE) == 0)
480 /* 5 bit signed immediate */
481 #define CONST_OK_FOR_J(VALUE) ((unsigned) (VALUE) + 0x10 < 0x20)
482 /* 16 bit signed immediate */
483 #define CONST_OK_FOR_K(VALUE) ((unsigned) (VALUE) + 0x8000 < 0x10000)
484 /* valid constant for movhi instruction. */
485 #define CONST_OK_FOR_L(VALUE) \
486 (((unsigned) ((int) (VALUE) >> 16) + 0x8000 < 0x10000) \
487 && CONST_OK_FOR_I ((VALUE & 0xffff)))
488 /* 16 bit unsigned immediate */
489 #define CONST_OK_FOR_M(VALUE) ((unsigned)(VALUE) < 0x10000)
490 /* 5 bit unsigned immediate in shift instructions */
491 #define CONST_OK_FOR_N(VALUE) ((unsigned) (VALUE) <= 31)
493 #define CONST_OK_FOR_O(VALUE) 0
494 #define CONST_OK_FOR_P(VALUE) 0
497 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
498 ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \
499 (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \
500 (C) == 'K' ? CONST_OK_FOR_K (VALUE) : \
501 (C) == 'L' ? CONST_OK_FOR_L (VALUE) : \
502 (C) == 'M' ? CONST_OK_FOR_M (VALUE) : \
503 (C) == 'N' ? CONST_OK_FOR_N (VALUE) : \
504 (C) == 'O' ? CONST_OK_FOR_O (VALUE) : \
505 (C) == 'P' ? CONST_OK_FOR_P (VALUE) : \
508 /* Similar, but for floating constants, and defining letters G and H.
509 Here VALUE is the CONST_DOUBLE rtx itself.
511 `G' is a zero of some form. */
513 #define CONST_DOUBLE_OK_FOR_G(VALUE) \
514 ((GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \
515 && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \
516 || (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_INT \
517 && CONST_DOUBLE_LOW (VALUE) == 0 \
518 && CONST_DOUBLE_HIGH (VALUE) == 0))
520 #define CONST_DOUBLE_OK_FOR_H(VALUE) 0
522 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
523 ((C) == 'G' ? CONST_DOUBLE_OK_FOR_G (VALUE) \
524 : (C) == 'H' ? CONST_DOUBLE_OK_FOR_H (VALUE) \
525 : 0)
528 /* Stack layout; function entry, exit and calling. */
530 /* Define this if pushing a word on the stack
531 makes the stack pointer a smaller address. */
533 #define STACK_GROWS_DOWNWARD
535 /* Define this if the nominal address of the stack frame
536 is at the high-address end of the local variables;
537 that is, each additional local variable allocated
538 goes at a more negative offset in the frame. */
540 #define FRAME_GROWS_DOWNWARD
542 /* Offset within stack frame to start allocating local variables at.
543 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
544 first local allocated. Otherwise, it is the offset to the BEGINNING
545 of the first local allocated. */
547 #define STARTING_FRAME_OFFSET 0
549 /* Offset of first parameter from the argument pointer register value. */
550 /* Is equal to the size of the saved fp + pc, even if an fp isn't
551 saved since the value is used before we know. */
553 #define FIRST_PARM_OFFSET(FNDECL) 0
555 /* Specify the registers used for certain standard purposes.
556 The values of these macros are register numbers. */
558 /* Register to use for pushing function arguments. */
559 #define STACK_POINTER_REGNUM 3
561 /* Base register for access to local variables of the function. */
562 #define FRAME_POINTER_REGNUM 32
564 /* Register containing return address from latest function call. */
565 #define LINK_POINTER_REGNUM 31
567 /* On some machines the offset between the frame pointer and starting
568 offset of the automatic variables is not known until after register
569 allocation has been done (for example, because the saved registers
570 are between these two locations). On those machines, define
571 `FRAME_POINTER_REGNUM' the number of a special, fixed register to
572 be used internally until the offset is known, and define
573 `HARD_FRAME_POINTER_REGNUM' to be actual the hard register number
574 used for the frame pointer.
576 You should define this macro only in the very rare circumstances
577 when it is not possible to calculate the offset between the frame
578 pointer and the automatic variables until after register
579 allocation has been completed. When this macro is defined, you
580 must also indicate in your definition of `ELIMINABLE_REGS' how to
581 eliminate `FRAME_POINTER_REGNUM' into either
582 `HARD_FRAME_POINTER_REGNUM' or `STACK_POINTER_REGNUM'.
584 Do not define this macro if it would be the same as
585 `FRAME_POINTER_REGNUM'. */
586 #undef HARD_FRAME_POINTER_REGNUM
587 #define HARD_FRAME_POINTER_REGNUM 29
589 /* Base register for access to arguments of the function. */
590 #define ARG_POINTER_REGNUM 33
592 /* Register in which static-chain is passed to a function. */
593 #define STATIC_CHAIN_REGNUM 20
595 /* Value should be nonzero if functions must have frame pointers.
596 Zero means the frame pointer need not be set up (and parms
597 may be accessed via the stack pointer) in functions that seem suitable.
598 This is computed in `reload', in reload1.c. */
599 #define FRAME_POINTER_REQUIRED 0
601 /* If defined, this macro specifies a table of register pairs used to
602 eliminate unneeded registers that point into the stack frame. If
603 it is not defined, the only elimination attempted by the compiler
604 is to replace references to the frame pointer with references to
605 the stack pointer.
607 The definition of this macro is a list of structure
608 initializations, each of which specifies an original and
609 replacement register.
611 On some machines, the position of the argument pointer is not
612 known until the compilation is completed. In such a case, a
613 separate hard register must be used for the argument pointer.
614 This register can be eliminated by replacing it with either the
615 frame pointer or the argument pointer, depending on whether or not
616 the frame pointer has been eliminated.
618 In this case, you might specify:
619 #define ELIMINABLE_REGS \
620 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
621 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
622 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
624 Note that the elimination of the argument pointer with the stack
625 pointer is specified first since that is the preferred elimination. */
627 #define ELIMINABLE_REGS \
628 {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
629 { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \
630 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
631 { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }} \
633 /* A C expression that returns non-zero if the compiler is allowed to
634 try to replace register number FROM-REG with register number
635 TO-REG. This macro need only be defined if `ELIMINABLE_REGS' is
636 defined, and will usually be the constant 1, since most of the
637 cases preventing register elimination are things that the compiler
638 already knows about. */
640 #define CAN_ELIMINATE(FROM, TO) \
641 ((TO) == STACK_POINTER_REGNUM ? ! frame_pointer_needed : 1)
643 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
644 specifies the initial difference between the specified pair of
645 registers. This macro must be defined if `ELIMINABLE_REGS' is
646 defined. */
648 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
650 if ((FROM) == FRAME_POINTER_REGNUM) \
651 (OFFSET) = get_frame_size () + current_function_outgoing_args_size; \
652 else if ((FROM) == ARG_POINTER_REGNUM) \
653 (OFFSET) = compute_frame_size (get_frame_size (), (long *)0); \
654 else \
655 abort (); \
658 /* A guess for the V850. */
659 #define PROMOTE_PROTOTYPES 1
661 /* Keep the stack pointer constant throughout the function. */
662 #define ACCUMULATE_OUTGOING_ARGS 1
664 /* Value is the number of bytes of arguments automatically
665 popped when returning from a subroutine call.
666 FUNDECL is the declaration node of the function (as a tree),
667 FUNTYPE is the data type of the function (as a tree),
668 or for a library call it is an identifier node for the subroutine name.
669 SIZE is the number of bytes of arguments passed on the stack. */
671 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
673 #define RETURN_ADDR_RTX(COUNT, FP) v850_return_addr (COUNT)
675 /* Define a data type for recording info about an argument list
676 during the scan of that argument list. This data type should
677 hold all necessary information about the function itself
678 and about the args processed so far, enough to enable macros
679 such as FUNCTION_ARG to determine where the next arg should go. */
681 #define CUMULATIVE_ARGS struct cum_arg
682 struct cum_arg { int nbytes; };
684 /* Define where to put the arguments to a function.
685 Value is zero to push the argument on the stack,
686 or a hard register in which to store the argument.
688 MODE is the argument's machine mode.
689 TYPE is the data type of the argument (as a tree).
690 This is null for libcalls where that information may
691 not be available.
692 CUM is a variable of type CUMULATIVE_ARGS which gives info about
693 the preceding args and about the function being called.
694 NAMED is nonzero if this argument is a named parameter
695 (otherwise it is an extra parameter matching an ellipsis). */
697 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
698 function_arg (&CUM, MODE, TYPE, NAMED)
700 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
701 function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
703 /* Initialize a variable CUM of type CUMULATIVE_ARGS
704 for a call to a function whose data type is FNTYPE.
705 For a library call, FNTYPE is 0. */
707 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
708 ((CUM).nbytes = 0)
710 /* Update the data in CUM to advance over an argument
711 of mode MODE and data type TYPE.
712 (TYPE is null for libcalls where that information may not be available.) */
714 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
715 ((CUM).nbytes += ((MODE) != BLKmode \
716 ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD \
717 : (int_size_in_bytes (TYPE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD))
719 /* When a parameter is passed in a register, stack space is still
720 allocated for it. */
721 #define REG_PARM_STACK_SPACE(DECL) (!TARGET_GHS ? 16 : 0)
723 /* Define this if the above stack space is to be considered part of the
724 space allocated by the caller. */
725 #define OUTGOING_REG_PARM_STACK_SPACE
727 extern int current_function_anonymous_args;
728 /* Do any setup necessary for varargs/stdargs functions. */
729 #define SETUP_INCOMING_VARARGS(CUM, MODE, TYPE, PAS, SECOND) \
730 current_function_anonymous_args = (!TARGET_GHS ? 1 : 0);
732 /* Implement `va_arg'. */
733 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
734 v850_va_arg (valist, type)
736 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
737 ((TYPE) && int_size_in_bytes (TYPE) > 8)
739 #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
740 ((TYPE) && int_size_in_bytes (TYPE) > 8)
742 /* 1 if N is a possible register number for function argument passing. */
744 #define FUNCTION_ARG_REGNO_P(N) (N >= 6 && N <= 9)
746 /* Define how to find the value returned by a function.
747 VALTYPE is the data type of the value (as a tree).
748 If the precise function being called is known, FUNC is its FUNCTION_DECL;
749 otherwise, FUNC is 0. */
751 #define FUNCTION_VALUE(VALTYPE, FUNC) \
752 gen_rtx_REG (TYPE_MODE (VALTYPE), 10)
754 /* Define how to find the value returned by a library function
755 assuming the value has mode MODE. */
757 #define LIBCALL_VALUE(MODE) \
758 gen_rtx_REG (MODE, 10)
760 /* 1 if N is a possible register number for a function value. */
762 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 10)
764 /* Return values > 8 bytes in length in memory. */
765 #define DEFAULT_PCC_STRUCT_RETURN 0
766 #define RETURN_IN_MEMORY(TYPE) \
767 (int_size_in_bytes (TYPE) > 8 || TYPE_MODE (TYPE) == BLKmode)
769 /* Register in which address to store a structure value
770 is passed to a function. On the V850 it's passed as
771 the first parameter. */
773 #define STRUCT_VALUE 0
775 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
776 the stack pointer does not matter. The value is tested only in
777 functions that have frame pointers.
778 No definition is equivalent to always zero. */
780 #define EXIT_IGNORE_STACK 1
782 /* Output assembler code to FILE to increment profiler label # LABELNO
783 for profiling a function entry. */
785 #define FUNCTION_PROFILER(FILE, LABELNO) ;
787 #define TRAMPOLINE_TEMPLATE(FILE) \
788 do { \
789 fprintf (FILE, "\tjarl .+4,r12\n"); \
790 fprintf (FILE, "\tld.w 12[r12],r5\n"); \
791 fprintf (FILE, "\tld.w 16[r12],r12\n"); \
792 fprintf (FILE, "\tjmp [r12]\n"); \
793 fprintf (FILE, "\tnop\n"); \
794 fprintf (FILE, "\t.long 0\n"); \
795 fprintf (FILE, "\t.long 0\n"); \
796 } while (0)
798 /* Length in units of the trampoline for entering a nested function. */
800 #define TRAMPOLINE_SIZE 24
802 /* Emit RTL insns to initialize the variable parts of a trampoline.
803 FNADDR is an RTX for the address of the function's pure code.
804 CXT is an RTX for the static chain value for the function. */
806 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
808 emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 16)), \
809 (CXT)); \
810 emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 20)), \
811 (FNADDR)); \
814 /* Addressing modes, and classification of registers for them. */
817 /* 1 if X is an rtx for a constant that is a valid address. */
819 /* ??? This seems too exclusive. May get better code by accepting more
820 possibilities here, in particular, should accept ZDA_NAME SYMBOL_REFs. */
822 #define CONSTANT_ADDRESS_P(X) \
823 (GET_CODE (X) == CONST_INT \
824 && CONST_OK_FOR_K (INTVAL (X)))
826 /* Maximum number of registers that can appear in a valid memory address. */
828 #define MAX_REGS_PER_ADDRESS 1
830 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
831 and check its validity for a certain class.
832 We have two alternate definitions for each of them.
833 The usual definition accepts all pseudo regs; the other rejects
834 them unless they have been allocated suitable hard regs.
835 The symbol REG_OK_STRICT causes the latter definition to be used.
837 Most source files want to accept pseudo regs in the hope that
838 they will get allocated to the class that the insn wants them to be in.
839 Source files for reload pass need to be strict.
840 After reload, it makes no difference, since pseudo regs have
841 been eliminated by then. */
843 #ifndef REG_OK_STRICT
845 /* Nonzero if X is a hard reg that can be used as an index
846 or if it is a pseudo reg. */
847 #define REG_OK_FOR_INDEX_P(X) 0
848 /* Nonzero if X is a hard reg that can be used as a base reg
849 or if it is a pseudo reg. */
850 #define REG_OK_FOR_BASE_P(X) 1
851 #define REG_OK_FOR_INDEX_P_STRICT(X) 0
852 #define REG_OK_FOR_BASE_P_STRICT(X) REGNO_OK_FOR_BASE_P (REGNO (X))
853 #define STRICT 0
855 #else
857 /* Nonzero if X is a hard reg that can be used as an index. */
858 #define REG_OK_FOR_INDEX_P(X) 0
859 /* Nonzero if X is a hard reg that can be used as a base reg. */
860 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
861 #define STRICT 1
863 #endif
865 /* A C expression that defines the optional machine-dependent
866 constraint letters that can be used to segregate specific types of
867 operands, usually memory references, for the target machine.
868 Normally this macro will not be defined. If it is required for a
869 particular target machine, it should return 1 if VALUE corresponds
870 to the operand type represented by the constraint letter C. If C
871 is not defined as an extra constraint, the value returned should
872 be 0 regardless of VALUE.
874 For example, on the ROMP, load instructions cannot have their
875 output in r0 if the memory reference contains a symbolic address.
876 Constraint letter `Q' is defined as representing a memory address
877 that does *not* contain a symbolic address. An alternative is
878 specified with a `Q' constraint on the input and `r' on the
879 output. The next alternative specifies `m' on the input and a
880 register class that does not include r0 on the output. */
882 #define EXTRA_CONSTRAINT(OP, C) \
883 ((C) == 'Q' ? ep_memory_operand (OP, GET_MODE (OP), 0) \
884 : (C) == 'R' ? special_symbolref_operand (OP, VOIDmode) \
885 : (C) == 'S' ? (GET_CODE (OP) == SYMBOL_REF && ! ZDA_NAME_P (XSTR (OP, 0))) \
886 : (C) == 'T' ? 0 \
887 : (C) == 'U' ? ((GET_CODE (OP) == SYMBOL_REF && ZDA_NAME_P (XSTR (OP, 0))) \
888 || (GET_CODE (OP) == CONST \
889 && GET_CODE (XEXP (OP, 0)) == PLUS \
890 && GET_CODE (XEXP (XEXP (OP, 0), 0)) == SYMBOL_REF \
891 && ZDA_NAME_P (XSTR (XEXP (XEXP (OP, 0), 0), 0)))) \
892 : 0)
894 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
895 that is a valid memory address for an instruction.
896 The MODE argument is the machine mode for the MEM expression
897 that wants to use this address.
899 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
900 except for CONSTANT_ADDRESS_P which is actually
901 machine-independent. */
903 /* Accept either REG or SUBREG where a register is valid. */
905 #define RTX_OK_FOR_BASE_P(X) \
906 ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \
907 || (GET_CODE (X) == SUBREG && REG_P (SUBREG_REG (X)) \
908 && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
910 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
911 do { \
912 if (RTX_OK_FOR_BASE_P (X)) goto ADDR; \
913 if (CONSTANT_ADDRESS_P (X) \
914 && (MODE == QImode || INTVAL (X) % 2 == 0) \
915 && (GET_MODE_SIZE (MODE) <= 4 || INTVAL (X) % 4 == 0)) \
916 goto ADDR; \
917 if (GET_CODE (X) == LO_SUM \
918 && GET_CODE (XEXP (X, 0)) == REG \
919 && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
920 && CONSTANT_P (XEXP (X, 1)) \
921 && (GET_CODE (XEXP (X, 1)) != CONST_INT \
922 || ((MODE == QImode || INTVAL (XEXP (X, 1)) % 2 == 0) \
923 && CONST_OK_FOR_K (INTVAL (XEXP (X, 1))))) \
924 && GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode)) \
925 goto ADDR; \
926 if (special_symbolref_operand (X, MODE) \
927 && (GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode))) \
928 goto ADDR; \
929 if (GET_CODE (X) == PLUS \
930 && CONSTANT_ADDRESS_P (XEXP (X, 1)) \
931 && (MODE == QImode || INTVAL (XEXP (X, 1)) % 2 == 0) \
932 && RTX_OK_FOR_BASE_P (XEXP (X, 0))) goto ADDR; \
933 } while (0)
936 /* Try machine-dependent ways of modifying an illegitimate address
937 to be legitimate. If we find one, return the new, valid address.
938 This macro is used in only one place: `memory_address' in explow.c.
940 OLDX is the address as it was before break_out_memory_refs was called.
941 In some cases it is useful to look at this to decide what needs to be done.
943 MODE and WIN are passed so that this macro can use
944 GO_IF_LEGITIMATE_ADDRESS.
946 It is always safe for this macro to do nothing. It exists to recognize
947 opportunities to optimize the output. */
949 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
951 /* Go to LABEL if ADDR (a legitimate address expression)
952 has an effect that depends on the machine mode it is used for. */
954 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
956 /* Nonzero if the constant value X is a legitimate general operand.
957 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
959 #define LEGITIMATE_CONSTANT_P(X) \
960 (GET_CODE (X) == CONST_DOUBLE \
961 || !(GET_CODE (X) == CONST \
962 && GET_CODE (XEXP (X, 0)) == PLUS \
963 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF \
964 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
965 && ! CONST_OK_FOR_K (INTVAL (XEXP (XEXP (X, 0), 1)))))
967 /* In rare cases, correct code generation requires extra machine
968 dependent processing between the second jump optimization pass and
969 delayed branch scheduling. On those machines, define this macro
970 as a C statement to act on the code starting at INSN. */
972 #define MACHINE_DEPENDENT_REORG(INSN) v850_reorg (INSN)
975 /* Tell final.c how to eliminate redundant test instructions. */
977 /* Here we define machine-dependent flags and fields in cc_status
978 (see `conditions.h'). No extra ones are needed for the vax. */
980 /* Store in cc_status the expressions
981 that the condition codes will describe
982 after execution of an instruction whose pattern is EXP.
983 Do not alter them if the instruction would not alter the cc's. */
985 #define CC_OVERFLOW_UNUSABLE 0x200
986 #define CC_NO_CARRY CC_NO_OVERFLOW
987 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
989 /* A part of a C `switch' statement that describes the relative costs
990 of constant RTL expressions. It must contain `case' labels for
991 expression codes `const_int', `const', `symbol_ref', `label_ref'
992 and `const_double'. Each case must ultimately reach a `return'
993 statement to return the relative cost of the use of that kind of
994 constant value in an expression. The cost may depend on the
995 precise value of the constant, which is available for examination
996 in X, and the rtx code of the expression in which it is contained,
997 found in OUTER_CODE.
999 CODE is the expression code--redundant, since it can be obtained
1000 with `GET_CODE (X)'. */
1002 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1003 case CONST_INT: \
1004 case CONST_DOUBLE: \
1005 case CONST: \
1006 case SYMBOL_REF: \
1007 case LABEL_REF: \
1009 int _zxy = const_costs(RTX, CODE); \
1010 return (_zxy) ? COSTS_N_INSNS (_zxy) : 0; \
1013 /* A crude cut at RTX_COSTS for the V850. */
1015 /* Provide the costs of a rtl expression. This is in the body of a
1016 switch on CODE.
1018 There aren't DImode MOD, DIV or MULT operations, so call them
1019 very expensive. Everything else is pretty much a constant cost. */
1021 #define RTX_COSTS(RTX,CODE,OUTER_CODE) \
1022 case MOD: \
1023 case DIV: \
1024 return 60; \
1025 case MULT: \
1026 return 20;
1028 /* All addressing modes have the same cost on the V850 series. */
1029 #define ADDRESS_COST(ADDR) 1
1031 /* Nonzero if access to memory by bytes or half words is no faster
1032 than accessing full words. */
1033 #define SLOW_BYTE_ACCESS 1
1035 /* Define this if zero-extension is slow (more than one real instruction). */
1036 #define SLOW_ZERO_EXTEND
1038 /* According expr.c, a value of around 6 should minimize code size, and
1039 for the V850 series, that's our primary concern. */
1040 #define MOVE_RATIO 6
1042 /* Indirect calls are expensive, never turn a direct call
1043 into an indirect call. */
1044 #define NO_FUNCTION_CSE
1046 /* The four different data regions on the v850. */
1047 typedef enum
1049 DATA_AREA_NORMAL,
1050 DATA_AREA_SDA,
1051 DATA_AREA_TDA,
1052 DATA_AREA_ZDA
1053 } v850_data_area;
1055 /* A list of names for sections other than the standard two, which are
1056 `in_text' and `in_data'. You need not define this macro on a
1057 system with no other sections (that GCC needs to use). */
1058 #undef EXTRA_SECTIONS
1059 #define EXTRA_SECTIONS in_tdata, in_sdata, in_zdata, in_const, in_ctors, \
1060 in_dtors, in_rozdata, in_rosdata, in_sbss, in_zbss, in_zcommon, in_scommon
1062 /* One or more functions to be defined in `varasm.c'. These
1063 functions should do jobs analogous to those of `text_section' and
1064 `data_section', for your additional sections. Do not define this
1065 macro if you do not define `EXTRA_SECTIONS'. */
1066 #undef EXTRA_SECTION_FUNCTIONS
1068 /* This could be done a lot more cleanly using ANSI C ... */
1069 #define EXTRA_SECTION_FUNCTIONS \
1070 CONST_SECTION_FUNCTION \
1071 CTORS_SECTION_FUNCTION \
1072 DTORS_SECTION_FUNCTION \
1074 void \
1075 sdata_section () \
1077 if (in_section != in_sdata) \
1079 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
1080 in_section = in_sdata; \
1084 void \
1085 rosdata_section () \
1087 if (in_section != in_rosdata) \
1089 fprintf (asm_out_file, "%s\n", ROSDATA_SECTION_ASM_OP); \
1090 in_section = in_sdata; \
1094 void \
1095 sbss_section () \
1097 if (in_section != in_sbss) \
1099 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
1100 in_section = in_sbss; \
1104 void \
1105 tdata_section () \
1107 if (in_section != in_tdata) \
1109 fprintf (asm_out_file, "%s\n", TDATA_SECTION_ASM_OP); \
1110 in_section = in_tdata; \
1114 void \
1115 zdata_section () \
1117 if (in_section != in_zdata) \
1119 fprintf (asm_out_file, "%s\n", ZDATA_SECTION_ASM_OP); \
1120 in_section = in_zdata; \
1124 void \
1125 rozdata_section () \
1127 if (in_section != in_rozdata) \
1129 fprintf (asm_out_file, "%s\n", ROZDATA_SECTION_ASM_OP); \
1130 in_section = in_rozdata; \
1134 void \
1135 zbss_section () \
1137 if (in_section != in_zbss) \
1139 fprintf (asm_out_file, "%s\n", ZBSS_SECTION_ASM_OP); \
1140 in_section = in_zbss; \
1144 #define TEXT_SECTION_ASM_OP "\t.section .text"
1145 #define DATA_SECTION_ASM_OP "\t.section .data"
1146 #define BSS_SECTION_ASM_OP "\t.section .bss"
1147 #define SDATA_SECTION_ASM_OP "\t.section .sdata,\"aw\""
1148 #define SBSS_SECTION_ASM_OP "\t.section .sbss,\"aw\""
1149 #define ZDATA_SECTION_ASM_OP "\t.section .zdata,\"aw\""
1150 #define ZBSS_SECTION_ASM_OP "\t.section .zbss,\"aw\""
1151 #define TDATA_SECTION_ASM_OP "\t.section .tdata,\"aw\""
1152 #define ROSDATA_SECTION_ASM_OP "\t.section .rosdata,\"a\""
1153 #define ROZDATA_SECTION_ASM_OP "\t.section .rozdata,\"a\""
1155 #define SCOMMON_ASM_OP "\t.scomm\t"
1156 #define ZCOMMON_ASM_OP "\t.zcomm\t"
1157 #define TCOMMON_ASM_OP "\t.tcomm\t"
1159 /* A C statement or statements to switch to the appropriate section
1160 for output of EXP. You can assume that EXP is either a `VAR_DECL'
1161 node or a constant of some sort. RELOC indicates whether the
1162 initial value of EXP requires link-time relocations. Select the
1163 section by calling `text_section' or one of the alternatives for
1164 other sections.
1166 Do not define this macro if you put all read-only variables and
1167 constants in the read-only data section (usually the text section). */
1168 #undef SELECT_SECTION
1169 #define SELECT_SECTION(EXP, RELOC) \
1170 do { \
1171 if (TREE_CODE (EXP) == VAR_DECL) \
1173 int is_const; \
1174 if (!TREE_READONLY (EXP) \
1175 || TREE_SIDE_EFFECTS (EXP) \
1176 || !DECL_INITIAL (EXP) \
1177 || (DECL_INITIAL (EXP) != error_mark_node \
1178 && !TREE_CONSTANT (DECL_INITIAL (EXP)))) \
1179 is_const = FALSE; \
1180 else \
1181 is_const = TRUE; \
1183 switch (v850_get_data_area (EXP)) \
1185 case DATA_AREA_ZDA: \
1186 if (is_const) \
1187 rozdata_section (); \
1188 else \
1189 zdata_section (); \
1190 break; \
1192 case DATA_AREA_TDA: \
1193 tdata_section (); \
1194 break; \
1196 case DATA_AREA_SDA: \
1197 if (is_const) \
1198 rosdata_section (); \
1199 else \
1200 sdata_section (); \
1201 break; \
1203 default: \
1204 if (is_const) \
1205 const_section (); \
1206 else \
1207 data_section (); \
1208 break; \
1211 else if (TREE_CODE (EXP) == STRING_CST) \
1213 if (! flag_writable_strings) \
1214 const_section (); \
1215 else \
1216 data_section (); \
1219 else \
1220 const_section (); \
1222 } while (0)
1224 /* A C statement or statements to switch to the appropriate section
1225 for output of RTX in mode MODE. You can assume that RTX is some
1226 kind of constant in RTL. The argument MODE is redundant except in
1227 the case of a `const_int' rtx. Select the section by calling
1228 `text_section' or one of the alternatives for other sections.
1230 Do not define this macro if you put all constants in the read-only
1231 data section. */
1232 /* #define SELECT_RTX_SECTION(MODE, RTX) */
1234 /* Output at beginning/end of assembler file. */
1235 #undef ASM_FILE_START
1236 #define ASM_FILE_START(FILE) asm_file_start(FILE)
1238 #define ASM_COMMENT_START "#"
1240 /* Output to assembler file text saying following lines
1241 may contain character constants, extra white space, comments, etc. */
1243 #define ASM_APP_ON "#APP\n"
1245 /* Output to assembler file text saying following lines
1246 no longer contain unusual constructs. */
1248 #define ASM_APP_OFF "#NO_APP\n"
1250 #undef USER_LABEL_PREFIX
1251 #define USER_LABEL_PREFIX "_"
1253 /* This is how to output an assembler line defining a `double' constant.
1254 It is .double or .float, depending. */
1256 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
1257 do { char dstr[30]; \
1258 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
1259 fprintf (FILE, "\t.double %s\n", dstr); \
1260 } while (0)
1263 /* This is how to output an assembler line defining a `float' constant. */
1264 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
1265 do { char dstr[30]; \
1266 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
1267 fprintf (FILE, "\t.float %s\n", dstr); \
1268 } while (0)
1270 /* This is how to output an assembler line defining an `int' constant. */
1272 #define ASM_OUTPUT_INT(FILE, VALUE) \
1273 ( fprintf (FILE, "\t.long "), \
1274 output_addr_const (FILE, (VALUE)), \
1275 fprintf (FILE, "\n"))
1277 /* Likewise for `char' and `short' constants. */
1279 #define ASM_OUTPUT_SHORT(FILE, VALUE) \
1280 ( fprintf (FILE, "\t.hword "), \
1281 output_addr_const (FILE, (VALUE)), \
1282 fprintf (FILE, "\n"))
1284 #define ASM_OUTPUT_CHAR(FILE, VALUE) \
1285 ( fprintf (FILE, "\t.byte "), \
1286 output_addr_const (FILE, (VALUE)), \
1287 fprintf (FILE, "\n"))
1289 /* This is how to output an assembler line for a numeric constant byte. */
1290 #define ASM_OUTPUT_BYTE(FILE, VALUE) \
1291 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1293 /* This says how to output the assembler to define a global
1294 uninitialized but not common symbol. */
1296 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
1297 asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
1299 #undef ASM_OUTPUT_ALIGNED_BSS
1300 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
1301 v850_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
1303 /* This says how to output the assembler to define a global
1304 uninitialized, common symbol. */
1305 #undef ASM_OUTPUT_ALIGNED_COMMON
1306 #undef ASM_OUTPUT_COMMON
1307 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
1308 v850_output_common (FILE, DECL, NAME, SIZE, ALIGN)
1310 /* This says how to output the assembler to define a local
1311 uninitialized symbol. */
1312 #undef ASM_OUTPUT_ALIGNED_LOCAL
1313 #undef ASM_OUTPUT_LOCAL
1314 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
1315 v850_output_local (FILE, DECL, NAME, SIZE, ALIGN)
1317 /* This is how to output the definition of a user-level label named NAME,
1318 such as the label on a static function or variable NAME. */
1320 #define ASM_OUTPUT_LABEL(FILE, NAME) \
1321 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1323 /* This is how to output a command to make the user-level label named NAME
1324 defined for reference from other files. */
1326 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \
1327 do \
1329 fputs ("\t.global ", FILE); \
1330 assemble_name (FILE, NAME); \
1331 fputs ("\n", FILE); \
1333 while (0)
1336 /* Store in OUTPUT a string (made with alloca) containing
1337 an assembler-name for a local static variable named NAME.
1338 LABELNO is an integer which is different for each call. */
1340 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1341 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1342 sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
1344 /* This is how we tell the assembler that two symbols have the same value. */
1346 #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
1347 do { assemble_name(FILE, NAME1); \
1348 fputs(" = ", FILE); \
1349 assemble_name(FILE, NAME2); \
1350 fputc('\n', FILE); } while (0)
1353 /* How to refer to registers in assembler output.
1354 This sequence is indexed by compiler's hard-register-number (see above). */
1356 #define REGISTER_NAMES \
1357 { "r0", "r1", "r2", "sp", "gp", "r5", "r6" , "r7", \
1358 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
1359 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
1360 "r24", "r25", "r26", "r27", "r28", "r29", "ep", "r31", \
1361 ".fp", ".ap"}
1363 #define ADDITIONAL_REGISTER_NAMES \
1364 { { "zero", 0 }, \
1365 { "hp", 2 }, \
1366 { "r3", 3 }, \
1367 { "r4", 4 }, \
1368 { "tp", 5 }, \
1369 { "fp", 29 }, \
1370 { "r30", 30 }, \
1371 { "lp", 31} }
1373 /* Print an instruction operand X on file FILE.
1374 look in v850.c for details */
1376 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1378 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1379 ((CODE) == '.')
1381 /* Print a memory operand whose address is X, on file FILE.
1382 This uses a function in output-vax.c. */
1384 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
1386 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)
1387 #define ASM_OUTPUT_REG_POP(FILE,REGNO)
1389 /* This is how to output an element of a case-vector that is absolute. */
1391 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1392 asm_fprintf (FILE, "\t%s .L%d\n", \
1393 (TARGET_BIG_SWITCH ? ".long" : ".short"), VALUE)
1395 /* This is how to output an element of a case-vector that is relative. */
1397 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1398 fprintf (FILE, "\t%s .L%d-.L%d\n", \
1399 (TARGET_BIG_SWITCH ? ".long" : ".short"), \
1400 VALUE, REL)
1402 #define ASM_OUTPUT_ALIGN(FILE, LOG) \
1403 if ((LOG) != 0) \
1404 fprintf (FILE, "\t.align %d\n", (LOG))
1406 /* We don't have to worry about dbx compatibility for the v850. */
1407 #define DEFAULT_GDB_EXTENSIONS 1
1409 /* Use stabs debugging info by default. */
1410 #undef PREFERRED_DEBUGGING_TYPE
1411 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
1413 #define DBX_REGISTER_NUMBER(REGNO) REGNO
1415 /* Define to use software floating point emulator for REAL_ARITHMETIC and
1416 decimal <-> binary conversion. */
1417 #define REAL_ARITHMETIC
1419 /* Specify the machine mode that this machine uses
1420 for the index in the tablejump instruction. */
1421 #define CASE_VECTOR_MODE (TARGET_BIG_SWITCH ? SImode : HImode)
1423 /* Define this if the case instruction drops through after the table
1424 when the index is out of range. Don't define it if the case insn
1425 jumps to the default label instead. */
1426 /* #define CASE_DROPS_THROUGH */
1428 /* Define as C expression which evaluates to nonzero if the tablejump
1429 instruction expects the table to contain offsets from the address of the
1430 table.
1431 Do not define this if the table should contain absolute addresses. */
1432 #define CASE_VECTOR_PC_RELATIVE 1
1434 /* The switch instruction requires that the jump table immediately follow
1435 it. */
1436 #define JUMP_TABLES_IN_TEXT_SECTION 1
1438 /* svr4.h defines this assuming that 4 byte alignment is required. */
1439 #undef ASM_OUTPUT_BEFORE_CASE_LABEL
1440 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
1441 ASM_OUTPUT_ALIGN ((FILE), (TARGET_BIG_SWITCH ? 2 : 1));
1443 #define WORD_REGISTER_OPERATIONS
1445 /* Byte and short loads sign extend the value to a word. */
1446 #define LOAD_EXTEND_OP(MODE) SIGN_EXTEND
1448 /* Specify the tree operation to be used to convert reals to integers. */
1449 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1451 /* This flag, if defined, says the same insns that convert to a signed fixnum
1452 also convert validly to an unsigned one. */
1453 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC
1455 /* This is the kind of divide that is easiest to do in the general case. */
1456 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1458 /* Max number of bytes we can move from memory to memory
1459 in one reasonably fast instruction. */
1460 #define MOVE_MAX 4
1462 /* Define if shifts truncate the shift count
1463 which implies one can omit a sign-extension or zero-extension
1464 of a shift count. */
1465 #define SHIFT_COUNT_TRUNCATED 1
1467 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1468 is done just by pretending it is already truncated. */
1469 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1471 #define STORE_FLAG_VALUE 1
1473 /* Specify the machine mode that pointers have.
1474 After generation of rtl, the compiler makes no further distinction
1475 between pointers and any other objects of this machine mode. */
1476 #define Pmode SImode
1478 /* A function address in a call instruction
1479 is a byte address (for indexing purposes)
1480 so give the MEM rtx a byte's mode. */
1481 #define FUNCTION_MODE QImode
1483 /* Tell compiler we want to support GHS pragmas */
1484 #define REGISTER_TARGET_PRAGMAS(PFILE) do { \
1485 cpp_register_pragma_space (PFILE, "ghs"); \
1486 cpp_register_pragma (PFILE, "ghs", "interrupt", ghs_pragma_interrupt); \
1487 cpp_register_pragma (PFILE, "ghs", "section", ghs_pragma_section); \
1488 cpp_register_pragma (PFILE, "ghs", "starttda", ghs_pragma_starttda); \
1489 cpp_register_pragma (PFILE, "ghs", "startsda", ghs_pragma_startsda); \
1490 cpp_register_pragma (PFILE, "ghs", "startzda", ghs_pragma_startzda); \
1491 cpp_register_pragma (PFILE, "ghs", "endtda", ghs_pragma_endtda); \
1492 cpp_register_pragma (PFILE, "ghs", "endsda", ghs_pragma_endsda); \
1493 cpp_register_pragma (PFILE, "ghs", "endzda", ghs_pragma_endzda); \
1494 } while (0)
1496 /* enum GHS_SECTION_KIND is an enumeration of the kinds of sections that
1497 can appear in the "ghs section" pragma. These names are used to index
1498 into the GHS_default_section_names[] and GHS_current_section_names[]
1499 that are defined in v850.c, and so the ordering of each must remain
1500 consistant.
1502 These arrays give the default and current names for each kind of
1503 section defined by the GHS pragmas. The current names can be changed
1504 by the "ghs section" pragma. If the current names are null, use
1505 the default names. Note that the two arrays have different types.
1507 For the *normal* section kinds (like .data, .text, etc.) we do not
1508 want to explicitly force the name of these sections, but would rather
1509 let the linker (or at least the back end) choose the name of the
1510 section, UNLESS the user has force a specific name for these section
1511 kinds. To accomplish this set the name in ghs_default_section_names
1512 to null. */
1514 enum GHS_section_kind
1516 GHS_SECTION_KIND_DEFAULT,
1518 GHS_SECTION_KIND_TEXT,
1519 GHS_SECTION_KIND_DATA,
1520 GHS_SECTION_KIND_RODATA,
1521 GHS_SECTION_KIND_BSS,
1522 GHS_SECTION_KIND_SDATA,
1523 GHS_SECTION_KIND_ROSDATA,
1524 GHS_SECTION_KIND_TDATA,
1525 GHS_SECTION_KIND_ZDATA,
1526 GHS_SECTION_KIND_ROZDATA,
1528 COUNT_OF_GHS_SECTION_KINDS /* must be last */
1531 /* The following code is for handling pragmas supported by the
1532 v850 compiler produced by Green Hills Software. This is at
1533 the specific request of a customer. */
1535 typedef struct data_area_stack_element
1537 struct data_area_stack_element * prev;
1538 v850_data_area data_area; /* Current default data area. */
1539 } data_area_stack_element;
1541 /* Track the current data area set by the
1542 data area pragma (which can be nested). */
1543 extern data_area_stack_element * data_area_stack;
1545 /* Names of the various data areas used on the v850. */
1546 extern union tree_node * GHS_default_section_names [(int) COUNT_OF_GHS_SECTION_KINDS];
1547 extern union tree_node * GHS_current_section_names [(int) COUNT_OF_GHS_SECTION_KINDS];
1549 /* The assembler op to start the file. */
1551 #define FILE_ASM_OP "\t.file\n"
1553 /* Enable the register move pass to improve code. */
1554 #define ENABLE_REGMOVE_PASS
1557 /* Implement ZDA, TDA, and SDA */
1559 #define EP_REGNUM 30 /* ep register number */
1561 #define ENCODE_SECTION_INFO(DECL) \
1562 do \
1564 if ((TREE_STATIC (DECL) || DECL_EXTERNAL (DECL)) \
1565 && TREE_CODE (DECL) == VAR_DECL) \
1566 v850_encode_data_area (DECL); \
1568 while (0)
1570 #define ZDA_NAME_FLAG_CHAR '@'
1571 #define TDA_NAME_FLAG_CHAR '%'
1572 #define SDA_NAME_FLAG_CHAR '&'
1574 #define ZDA_NAME_P(NAME) (*(NAME) == ZDA_NAME_FLAG_CHAR)
1575 #define TDA_NAME_P(NAME) (*(NAME) == TDA_NAME_FLAG_CHAR)
1576 #define SDA_NAME_P(NAME) (*(NAME) == SDA_NAME_FLAG_CHAR)
1578 #define ENCODED_NAME_P(SYMBOL_NAME) \
1579 ( ZDA_NAME_P (SYMBOL_NAME) \
1580 || TDA_NAME_P (SYMBOL_NAME) \
1581 || SDA_NAME_P (SYMBOL_NAME))
1583 #define STRIP_NAME_ENCODING(VAR, SYMBOL_NAME) \
1584 (VAR) = (SYMBOL_NAME) + (ENCODED_NAME_P (SYMBOL_NAME) || *(SYMBOL_NAME) == '*')
1586 /* Define this if you have defined special-purpose predicates in the
1587 file `MACHINE.c'. This macro is called within an initializer of an
1588 array of structures. The first field in the structure is the name
1589 of a predicate and the second field is an array of rtl codes. For
1590 each predicate, list all rtl codes that can be in expressions
1591 matched by the predicate. The list should have a trailing comma. */
1593 #define PREDICATE_CODES \
1594 { "reg_or_0_operand", { REG, SUBREG, CONST_INT, CONST_DOUBLE }}, \
1595 { "reg_or_int5_operand", { REG, SUBREG, CONST_INT }}, \
1596 { "call_address_operand", { REG, SYMBOL_REF }}, \
1597 { "movsi_source_operand", { LABEL_REF, SYMBOL_REF, CONST_INT, \
1598 CONST_DOUBLE, CONST, HIGH, MEM, \
1599 REG, SUBREG }}, \
1600 { "special_symbolref_operand", { SYMBOL_REF }}, \
1601 { "power_of_two_operand", { CONST_INT }}, \
1602 { "pattern_is_ok_for_prologue", { PARALLEL }}, \
1603 { "pattern_is_ok_for_epilogue", { PARALLEL }}, \
1604 { "register_is_ok_for_epilogue",{ REG }}, \
1605 { "not_power_of_two_operand", { CONST_INT }},
1607 #endif /* ! GCC_V850_H */