Implement __builtin_return_address (0)
[platform/upstream/gcc.git] / gcc / config / v850 / v850.h
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).
4
5 This file is part of GNU CC.
6
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.
11
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.
16
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.  */
21
22 #ifndef GCC_V850_H
23 #define GCC_V850_H
24
25 #include "svr4.h"       /* Automatically does #undef CPP_PREDEFINES */
26
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
34
35
36 #define TARGET_CPU_generic      1
37
38 #ifndef TARGET_CPU_DEFAULT
39 #define TARGET_CPU_DEFAULT      TARGET_CPU_generic
40 #endif
41
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)");
46
47
48 #define ASM_SPEC "%{mv*:-mv%*}"
49 #define CPP_SPEC                "%{mv850ea:-D__v850ea__} %{mv850e:-D__v850e__} %{mv850:-D__v850__} %(subtarget_cpp_spec)"
50
51 #define EXTRA_SPECS \
52  { "subtarget_asm_spec", SUBTARGET_ASM_SPEC }, \
53  { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC } 
54
55 /* Names to predefine in the preprocessor for this target machine.  */
56 #define CPP_PREDEFINES "-D__v851__ -D__v850"
57
58 /* Run-time compilation parameters selecting different hardware subsets.  */
59
60 extern int target_flags;
61
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
68
69 #define MASK_CPU                0x00000030
70 #define MASK_V850               0x00000010
71
72 #define MASK_BIG_SWITCH         0x00000100
73
74 /* Macros used in the machine description to test the flags.  */
75
76 /* The GHS calling convention support doesn't really work,
77    mostly due to a lack of documentation.  Outstanding issues:
78
79      * How do varargs & stdarg really work.  How to they handle
80      passing structures (if at all).
81
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.
86
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.
90
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)
94  
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)
98
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)
102
103 /* Whether to call out-of-line functions to save registers or not.  */
104 #define TARGET_PROLOG_FUNCTION (target_flags & MASK_PROLOG_FUNCTION)
105
106 #define TARGET_V850             ((target_flags & MASK_CPU) == MASK_V850)
107
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)
110
111 /* General debug flag */
112 #define TARGET_DEBUG (target_flags & MASK_DEBUG)
113
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.  */
119
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, ""}}
141
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;
148 };
149
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
158 };
159
160 extern struct small_memory_info small_memory[(int)SMALL_MEMORY_max];
161
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.
165
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.
171
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"'.
175
176           extern char *m88k_short_data;
177           #define TARGET_OPTIONS \
178            { { "short-data-", &m88k_short_data } } */
179
180 #define TARGET_OPTIONS                                                  \
181 {                                                                       \
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, "" },     \
191 }
192
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.
198
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 ()
202
203
204 /* Show we can debug even without a frame pointer.  */
205 #define CAN_DEBUG_WITHOUT_FP
206
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.
213
214    LEVEL is the optimization level specified; 2 if `-O2' is
215    specified, 1 if `-O' is specified, and 0 if neither is specified.
216
217    SIZE is non-zero if `-Os' is specified, 0 otherwise.  
218
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.
223
224    *Do not examine `write_symbols' in this macro!* The debugging
225    options are not supposed to alter the generated code. */
226
227 #define OPTIMIZATION_OPTIONS(LEVEL,SIZE)                                \
228 {                                                                       \
229   if (LEVEL)                                                            \
230     target_flags |= (MASK_EP | MASK_PROLOG_FUNCTION);                   \
231 }
232
233 \f
234 /* Target machine storage layout */
235
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
240
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
244
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
249
250 /* Number of bits in an addressable storage unit */
251 #define BITS_PER_UNIT 8
252
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
258
259 /* Width of a word, in units (bytes).  */
260 #define UNITS_PER_WORD          4
261
262 /* Width in bits of a pointer.
263    See also the macro `Pmode' defined below.  */
264 #define POINTER_SIZE            32
265
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.
271
272    Some simple experiments have shown that leaving UNSIGNEDP alone
273    generates the best overall code.  */
274
275 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE)  \
276   if (GET_MODE_CLASS (MODE) == MODE_INT \
277       && GET_MODE_SIZE (MODE) < 4)      \
278     { (MODE) = SImode; }
279
280 /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
281 #define PARM_BOUNDARY           32
282
283 /* The stack goes in 32 bit lumps.  */
284 #define STACK_BOUNDARY          32
285
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
289
290 /* No data type wants to be aligned rounder than this.  */
291 #define BIGGEST_ALIGNMENT       32
292
293 /* Alignment of field after `int : 0' in a structure.  */
294 #define EMPTY_FIELD_BOUNDARY 32
295
296 /* No structure field wants to be aligned rounder than this.  */
297 #define BIGGEST_FIELD_ALIGNMENT 32
298
299 /* Define this if move instructions will actually fail to work
300    when given unaligned data.  */
301 #ifndef STRICT_ALIGNMENT 
302 #define STRICT_ALIGNMENT TARGET_V850
303 #endif
304
305 /* Define this as 1 if `char' should by default be signed; else as 0.
306
307    On the NEC V850, loads do sign extension, so make this default. */
308 #define DEFAULT_SIGNED_CHAR 1
309
310 /* Define results of standard character escape sequences.  */
311 #define TARGET_BELL 007
312 #define TARGET_BS 010
313 #define TARGET_TAB 011
314 #define TARGET_NEWLINE 012
315 #define TARGET_VT 013
316 #define TARGET_FF 014
317 #define TARGET_CR 015
318 \f
319 /* Standard register usage.  */
320
321 /* Number of actual hardware registers.
322    The hardware registers are assigned numbers for the compiler
323    from 0 to just below FIRST_PSEUDO_REGISTER.
324
325    All registers that the compiler knows about must be given numbers,
326    even those that are not normally considered general registers.  */
327
328 #define FIRST_PSEUDO_REGISTER 34
329
330 /* 1 for registers that have pervasive standard uses
331    and are not available for the register allocator.  */
332
333 #define FIXED_REGISTERS \
334   { 1, 1, 0, 1, 1, 0, 0, 0, \
335     0, 0, 0, 0, 0, 0, 0, 0, \
336     0, 0, 0, 0, 0, 0, 0, 0, \
337     0, 0, 0, 0, 0, 0, 1, 0, \
338     1, 1}
339
340 /* 1 for registers not available across function calls.
341    These must include the FIXED_REGISTERS and also any
342    registers that can be used without being saved.
343    The latter must include the registers where values are returned
344    and the register where structure-value addresses are passed.
345    Aside from that, you can include as many other registers as you
346    like.  */
347
348 #define CALL_USED_REGISTERS \
349   { 1, 1, 0, 1, 1, 1, 1, 1, \
350     1, 1, 1, 1, 1, 1, 1, 1, \
351     1, 1, 1, 1, 0, 0, 0, 0, \
352     0, 0, 0, 0, 0, 0, 1, 1, \
353     1, 1}
354
355 /* List the order in which to allocate registers.  Each register must be
356    listed once, even those in FIXED_REGISTERS.
357
358    On the 850, we make the return registers first, then all of the volatile
359    registers, then the saved registers in reverse order to better save the
360    registers with an out of line function, and finally the fixed
361    registers.  */
362
363 #define REG_ALLOC_ORDER                                                 \
364 {                                                                       \
365   10, 11,                               /* return registers */          \
366   12, 13, 14, 15, 16, 17, 18, 19,       /* scratch registers */         \
367    6,  7,  8,  9, 31,                   /* argument registers */        \
368   29, 28, 27, 26, 25, 24, 23, 22,       /* saved registers */           \
369   21, 20,  2,                                                           \
370    0,  1,  3,  4,  5, 30, 32, 33        /* fixed registers */           \
371 }
372
373 /* Return number of consecutive hard regs needed starting at reg REGNO
374    to hold something of mode MODE.
375
376    This is ordinarily the length in words of a value of mode MODE
377    but can be less for certain modes in special long registers.  */
378
379 #define HARD_REGNO_NREGS(REGNO, MODE)   \
380   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
381
382 /* Value is 1 if hard register REGNO can hold a value of machine-mode
383    MODE.  */
384
385 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
386  ((((REGNO) & 1) == 0) || (GET_MODE_SIZE (MODE) <= 4))
387
388 /* Value is 1 if it is a good idea to tie two pseudo registers
389    when one has mode MODE1 and one has mode MODE2.
390    If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
391    for any hard reg, then this must be 0 for correct output.  */
392 #define MODES_TIEABLE_P(MODE1, MODE2) \
393   (MODE1 == MODE2 || (GET_MODE_SIZE (MODE1) <= 4 && GET_MODE_SIZE (MODE2) <= 4))
394
395 \f
396 /* Define the classes of registers for register constraints in the
397    machine description.  Also define ranges of constants.
398
399    One of the classes must always be named ALL_REGS and include all hard regs.
400    If there is more than one class, another class must be named NO_REGS
401    and contain no registers.
402
403    The name GENERAL_REGS must be the name of a class (or an alias for
404    another name such as ALL_REGS).  This is the class of registers
405    that is allowed by "g" or "r" in a register constraint.
406    Also, registers outside this class are allocated only when
407    instructions express preferences for them.
408
409    The classes must be numbered in nondecreasing order; that is,
410    a larger-numbered class must never be contained completely
411    in a smaller-numbered class.
412
413    For any two classes, it is very desirable that there be another
414    class that represents their union.  */
415    
416 enum reg_class
417 {
418   NO_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
419 };
420
421 #define N_REG_CLASSES (int) LIM_REG_CLASSES
422
423 /* Give names of register classes as strings for dump file.   */
424
425 #define REG_CLASS_NAMES \
426 { "NO_REGS", "GENERAL_REGS", "ALL_REGS", "LIM_REGS" }
427
428 /* Define which registers fit in which classes.
429    This is an initializer for a vector of HARD_REG_SET
430    of length N_REG_CLASSES.  */
431
432 #define REG_CLASS_CONTENTS              \
433 {                                       \
434   { 0x00000000 }, /* NO_REGS      */    \
435   { 0xffffffff }, /* GENERAL_REGS */    \
436   { 0xffffffff }, /* ALL_REGS   */      \
437 }
438
439 /* The same information, inverted:
440    Return the class number of the smallest class containing
441    reg number REGNO.  This could be a conditional expression
442    or could index an array.  */
443
444 #define REGNO_REG_CLASS(REGNO)  GENERAL_REGS
445
446 /* The class value for index registers, and the one for base regs.  */
447
448 #define INDEX_REG_CLASS NO_REGS
449 #define BASE_REG_CLASS  GENERAL_REGS
450
451 /* Get reg_class from a letter such as appears in the machine description.  */
452
453 #define REG_CLASS_FROM_LETTER(C) (NO_REGS)
454
455 /* Macros to check register numbers against specific register classes.  */
456
457 /* These assume that REGNO is a hard or pseudo reg number.
458    They give nonzero only if REGNO is a hard reg of the suitable class
459    or a pseudo reg currently allocated to a suitable hard reg.
460    Since they use reg_renumber, they are safe only once reg_renumber
461    has been allocated, which happens in local-alloc.c.  */
462  
463 #define REGNO_OK_FOR_BASE_P(regno) \
464   ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
465
466 #define REGNO_OK_FOR_INDEX_P(regno) 0
467
468 /* Given an rtx X being reloaded into a reg required to be
469    in class CLASS, return the class of reg to actually use.
470    In general this is just CLASS; but on some machines
471    in some cases it is preferable to use a more restrictive class.  */
472
473 #define PREFERRED_RELOAD_CLASS(X,CLASS)  (CLASS)
474
475 /* Return the maximum number of consecutive registers
476    needed to represent mode MODE in a register of class CLASS.  */
477
478 #define CLASS_MAX_NREGS(CLASS, MODE)    \
479   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
480
481 /* The letters I, J, K, L, M, N, O, P in a register constraint string
482    can be used to stand for particular ranges of immediate operands.
483    This macro defines what the ranges are.
484    C is the letter, and VALUE is a constant value.
485    Return 1 if VALUE is in the range specified by C.  */
486
487 #define INT_7_BITS(VALUE) ((unsigned) (VALUE) + 0x40 < 0x80)
488 #define INT_8_BITS(VALUE) ((unsigned) (VALUE) + 0x80 < 0x100)
489 /* zero */
490 #define CONST_OK_FOR_I(VALUE) ((VALUE) == 0)
491 /* 5 bit signed immediate */
492 #define CONST_OK_FOR_J(VALUE) ((unsigned) (VALUE) + 0x10 < 0x20)
493 /* 16 bit signed immediate */
494 #define CONST_OK_FOR_K(VALUE) ((unsigned) (VALUE) + 0x8000 < 0x10000)
495 /* valid constant for movhi instruction.  */
496 #define CONST_OK_FOR_L(VALUE) \
497   (((unsigned) ((int) (VALUE) >> 16) + 0x8000 < 0x10000) \
498    && CONST_OK_FOR_I ((VALUE & 0xffff)))
499 /* 16 bit unsigned immediate */
500 #define CONST_OK_FOR_M(VALUE) ((unsigned)(VALUE) < 0x10000)
501 /* 5 bit unsigned immediate in shift instructions */
502 #define CONST_OK_FOR_N(VALUE) ((unsigned) (VALUE) <= 31)
503
504 #define CONST_OK_FOR_O(VALUE) 0
505 #define CONST_OK_FOR_P(VALUE) 0
506
507
508 #define CONST_OK_FOR_LETTER_P(VALUE, C)  \
509   ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \
510    (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \
511    (C) == 'K' ? CONST_OK_FOR_K (VALUE) : \
512    (C) == 'L' ? CONST_OK_FOR_L (VALUE) : \
513    (C) == 'M' ? CONST_OK_FOR_M (VALUE) : \
514    (C) == 'N' ? CONST_OK_FOR_N (VALUE) : \
515    (C) == 'O' ? CONST_OK_FOR_O (VALUE) : \
516    (C) == 'P' ? CONST_OK_FOR_P (VALUE) : \
517    0)
518
519 /* Similar, but for floating constants, and defining letters G and H.
520    Here VALUE is the CONST_DOUBLE rtx itself. 
521      
522   `G' is a zero of some form.  */
523
524 #define CONST_DOUBLE_OK_FOR_G(VALUE)                                    \
525   ((GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT                     \
526     && (VALUE) == CONST0_RTX (GET_MODE (VALUE)))                        \
527    || (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_INT                    \
528        && CONST_DOUBLE_LOW (VALUE) == 0                                 \
529        && CONST_DOUBLE_HIGH (VALUE) == 0))
530
531 #define CONST_DOUBLE_OK_FOR_H(VALUE) 0
532
533 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)                          \
534   ((C) == 'G'   ? CONST_DOUBLE_OK_FOR_G (VALUE)                         \
535    : (C) == 'H' ? CONST_DOUBLE_OK_FOR_H (VALUE)                         \
536    : 0)
537
538 \f
539 /* Stack layout; function entry, exit and calling.  */
540
541 /* Define this if pushing a word on the stack
542    makes the stack pointer a smaller address.  */
543
544 #define STACK_GROWS_DOWNWARD
545
546 /* Define this if the nominal address of the stack frame
547    is at the high-address end of the local variables;
548    that is, each additional local variable allocated
549    goes at a more negative offset in the frame.  */
550
551 #define FRAME_GROWS_DOWNWARD
552
553 /* Offset within stack frame to start allocating local variables at.
554    If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
555    first local allocated.  Otherwise, it is the offset to the BEGINNING
556    of the first local allocated.  */
557
558 #define STARTING_FRAME_OFFSET 0
559
560 /* Offset of first parameter from the argument pointer register value.  */
561 /* Is equal to the size of the saved fp + pc, even if an fp isn't
562    saved since the value is used before we know.  */
563
564 #define FIRST_PARM_OFFSET(FNDECL) 0
565
566 /* Specify the registers used for certain standard purposes.
567    The values of these macros are register numbers.  */
568
569 /* Register to use for pushing function arguments.  */
570 #define STACK_POINTER_REGNUM 3
571
572 /* Base register for access to local variables of the function.  */
573 #define FRAME_POINTER_REGNUM 32
574
575 /* Register containing return address from latest function call.  */
576 #define LINK_POINTER_REGNUM 31
577      
578 /* On some machines the offset between the frame pointer and starting
579    offset of the automatic variables is not known until after register
580    allocation has been done (for example, because the saved registers
581    are between these two locations).  On those machines, define
582    `FRAME_POINTER_REGNUM' the number of a special, fixed register to
583    be used internally until the offset is known, and define
584    `HARD_FRAME_POINTER_REGNUM' to be actual the hard register number
585    used for the frame pointer.
586
587    You should define this macro only in the very rare circumstances
588    when it is not possible to calculate the offset between the frame
589    pointer and the automatic variables until after register
590    allocation has been completed.  When this macro is defined, you
591    must also indicate in your definition of `ELIMINABLE_REGS' how to
592    eliminate `FRAME_POINTER_REGNUM' into either
593    `HARD_FRAME_POINTER_REGNUM' or `STACK_POINTER_REGNUM'.
594
595    Do not define this macro if it would be the same as
596    `FRAME_POINTER_REGNUM'. */
597 #undef  HARD_FRAME_POINTER_REGNUM 
598 #define HARD_FRAME_POINTER_REGNUM 29
599
600 /* Base register for access to arguments of the function.  */
601 #define ARG_POINTER_REGNUM 33
602
603 /* Register in which static-chain is passed to a function.  */
604 #define STATIC_CHAIN_REGNUM 20
605
606 /* Value should be nonzero if functions must have frame pointers.
607    Zero means the frame pointer need not be set up (and parms
608    may be accessed via the stack pointer) in functions that seem suitable.
609    This is computed in `reload', in reload1.c.  */
610 #define FRAME_POINTER_REQUIRED 0
611
612 /* If defined, this macro specifies a table of register pairs used to
613    eliminate unneeded registers that point into the stack frame.  If
614    it is not defined, the only elimination attempted by the compiler
615    is to replace references to the frame pointer with references to
616    the stack pointer.
617
618    The definition of this macro is a list of structure
619    initializations, each of which specifies an original and
620    replacement register.
621
622    On some machines, the position of the argument pointer is not
623    known until the compilation is completed.  In such a case, a
624    separate hard register must be used for the argument pointer.
625    This register can be eliminated by replacing it with either the
626    frame pointer or the argument pointer, depending on whether or not
627    the frame pointer has been eliminated.
628
629    In this case, you might specify:
630         #define ELIMINABLE_REGS  \
631         {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
632          {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
633          {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
634
635    Note that the elimination of the argument pointer with the stack
636    pointer is specified first since that is the preferred elimination. */
637
638 #define ELIMINABLE_REGS                                                 \
639 {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM },                        \
640  { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM },                   \
641  { ARG_POINTER_REGNUM,   STACK_POINTER_REGNUM },                        \
642  { ARG_POINTER_REGNUM,   HARD_FRAME_POINTER_REGNUM }}                   \
643
644 /* A C expression that returns non-zero if the compiler is allowed to
645    try to replace register number FROM-REG with register number
646    TO-REG.  This macro need only be defined if `ELIMINABLE_REGS' is
647    defined, and will usually be the constant 1, since most of the
648    cases preventing register elimination are things that the compiler
649    already knows about. */
650
651 #define CAN_ELIMINATE(FROM, TO) \
652  ((TO) == STACK_POINTER_REGNUM ? ! frame_pointer_needed : 1)
653
654 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'.  It
655    specifies the initial difference between the specified pair of
656    registers.  This macro must be defined if `ELIMINABLE_REGS' is
657    defined. */
658
659 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)                    \
660 {                                                                       \
661   if ((FROM) == FRAME_POINTER_REGNUM)                                   \
662     (OFFSET) = get_frame_size () + current_function_outgoing_args_size; \
663   else if ((FROM) == ARG_POINTER_REGNUM)                                \
664    (OFFSET) = compute_frame_size (get_frame_size (), (long *)0);        \
665   else                                                                  \
666     abort ();                                                           \
667 }
668
669 /* A guess for the V850.  */
670 #define PROMOTE_PROTOTYPES 1
671
672 /* Keep the stack pointer constant throughout the function.  */
673 #define ACCUMULATE_OUTGOING_ARGS 1
674
675 /* Value is the number of bytes of arguments automatically
676    popped when returning from a subroutine call.
677    FUNDECL is the declaration node of the function (as a tree),
678    FUNTYPE is the data type of the function (as a tree),
679    or for a library call it is an identifier node for the subroutine name.
680    SIZE is the number of bytes of arguments passed on the stack.  */
681
682 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
683
684 #define RETURN_ADDR_RTX(COUNT, FP) v850_return_addr (COUNT)
685 \f
686 /* Define a data type for recording info about an argument list
687    during the scan of that argument list.  This data type should
688    hold all necessary information about the function itself
689    and about the args processed so far, enough to enable macros
690    such as FUNCTION_ARG to determine where the next arg should go.  */
691
692 #define CUMULATIVE_ARGS struct cum_arg
693 struct cum_arg { int nbytes; };
694
695 /* Define where to put the arguments to a function.
696    Value is zero to push the argument on the stack,
697    or a hard register in which to store the argument.
698
699    MODE is the argument's machine mode.
700    TYPE is the data type of the argument (as a tree).
701     This is null for libcalls where that information may
702     not be available.
703    CUM is a variable of type CUMULATIVE_ARGS which gives info about
704     the preceding args and about the function being called.
705    NAMED is nonzero if this argument is a named parameter
706     (otherwise it is an extra parameter matching an ellipsis).  */
707
708 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
709   function_arg (&CUM, MODE, TYPE, NAMED)
710
711 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
712   function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
713
714 /* Initialize a variable CUM of type CUMULATIVE_ARGS
715    for a call to a function whose data type is FNTYPE.
716    For a library call, FNTYPE is 0.  */
717
718 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT)       \
719  ((CUM).nbytes = 0)
720
721 /* Update the data in CUM to advance over an argument
722    of mode MODE and data type TYPE.
723    (TYPE is null for libcalls where that information may not be available.)  */
724
725 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)    \
726  ((CUM).nbytes += ((MODE) != BLKmode                    \
727   ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD       \
728   : (int_size_in_bytes (TYPE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD))
729
730 /* When a parameter is passed in a register, stack space is still
731    allocated for it.  */
732 #define REG_PARM_STACK_SPACE(DECL) (!TARGET_GHS ? 16 : 0)
733
734 /* Define this if the above stack space is to be considered part of the
735    space allocated by the caller.  */
736 #define OUTGOING_REG_PARM_STACK_SPACE
737
738 extern int current_function_anonymous_args;
739 /* Do any setup necessary for varargs/stdargs functions.  */
740 #define SETUP_INCOMING_VARARGS(CUM, MODE, TYPE, PAS, SECOND) \
741   current_function_anonymous_args = (!TARGET_GHS ? 1 : 0);
742
743 /* Implement `va_arg'.  */
744 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
745   v850_va_arg (valist, type)
746
747 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED)          \
748   ((TYPE) && int_size_in_bytes (TYPE) > 8)
749  
750 #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
751   ((TYPE) && int_size_in_bytes (TYPE) > 8)
752
753 /* 1 if N is a possible register number for function argument passing.  */
754
755 #define FUNCTION_ARG_REGNO_P(N) (N >= 6 && N <= 9)
756
757 /* Define how to find the value returned by a function.
758    VALTYPE is the data type of the value (as a tree).
759    If the precise function being called is known, FUNC is its FUNCTION_DECL;
760    otherwise, FUNC is 0.   */
761    
762 #define FUNCTION_VALUE(VALTYPE, FUNC) \
763   gen_rtx_REG (TYPE_MODE (VALTYPE), 10)
764
765 /* Define how to find the value returned by a library function
766    assuming the value has mode MODE.  */
767
768 #define LIBCALL_VALUE(MODE) \
769   gen_rtx_REG (MODE, 10)
770
771 /* 1 if N is a possible register number for a function value.  */
772
773 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 10)
774
775 /* Return values > 8 bytes in length in memory.  */
776 #define DEFAULT_PCC_STRUCT_RETURN 0
777 #define RETURN_IN_MEMORY(TYPE)  \
778   (int_size_in_bytes (TYPE) > 8 || TYPE_MODE (TYPE) == BLKmode)
779
780 /* Register in which address to store a structure value
781    is passed to a function.  On the V850 it's passed as
782    the first parameter.  */
783
784 #define STRUCT_VALUE 0
785
786 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
787    the stack pointer does not matter.  The value is tested only in
788    functions that have frame pointers.
789    No definition is equivalent to always zero.  */
790
791 #define EXIT_IGNORE_STACK 1
792
793 /* Initialize data used by insn expanders.  This is called from insn_emit,
794    once for every function before code is generated.  */
795 #define INIT_EXPANDERS  v850_init_expanders ()
796
797 /* Output assembler code to FILE to increment profiler label # LABELNO
798    for profiling a function entry.  */
799
800 #define FUNCTION_PROFILER(FILE, LABELNO) ;
801
802 #define TRAMPOLINE_TEMPLATE(FILE)                       \
803   do {                                                  \
804     fprintf (FILE, "\tjarl .+4,r12\n");                 \
805     fprintf (FILE, "\tld.w 12[r12],r5\n");              \
806     fprintf (FILE, "\tld.w 16[r12],r12\n");             \
807     fprintf (FILE, "\tjmp [r12]\n");                    \
808     fprintf (FILE, "\tnop\n");                          \
809     fprintf (FILE, "\t.long 0\n");                      \
810     fprintf (FILE, "\t.long 0\n");                      \
811   } while (0)
812
813 /* Length in units of the trampoline for entering a nested function.  */
814
815 #define TRAMPOLINE_SIZE 24
816
817 /* Emit RTL insns to initialize the variable parts of a trampoline.
818    FNADDR is an RTX for the address of the function's pure code.
819    CXT is an RTX for the static chain value for the function.  */
820
821 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT)                       \
822 {                                                                       \
823   emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 16)),    \
824                  (CXT));                                                \
825   emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 20)),    \
826                  (FNADDR));                                             \
827 }
828
829 /* Addressing modes, and classification of registers for them.  */
830
831 \f
832 /* 1 if X is an rtx for a constant that is a valid address.  */
833
834 /* ??? This seems too exclusive.  May get better code by accepting more
835    possibilities here, in particular, should accept ZDA_NAME SYMBOL_REFs.  */
836
837 #define CONSTANT_ADDRESS_P(X)   \
838   (GET_CODE (X) == CONST_INT                            \
839    && CONST_OK_FOR_K (INTVAL (X)))
840
841 /* Maximum number of registers that can appear in a valid memory address.  */
842
843 #define MAX_REGS_PER_ADDRESS 1
844
845 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
846    and check its validity for a certain class.
847    We have two alternate definitions for each of them.
848    The usual definition accepts all pseudo regs; the other rejects
849    them unless they have been allocated suitable hard regs.
850    The symbol REG_OK_STRICT causes the latter definition to be used.
851
852    Most source files want to accept pseudo regs in the hope that
853    they will get allocated to the class that the insn wants them to be in.
854    Source files for reload pass need to be strict.
855    After reload, it makes no difference, since pseudo regs have
856    been eliminated by then.  */
857
858 #ifndef REG_OK_STRICT
859
860 /* Nonzero if X is a hard reg that can be used as an index
861    or if it is a pseudo reg.  */
862 #define REG_OK_FOR_INDEX_P(X) 0
863 /* Nonzero if X is a hard reg that can be used as a base reg
864    or if it is a pseudo reg.  */
865 #define REG_OK_FOR_BASE_P(X) 1
866 #define REG_OK_FOR_INDEX_P_STRICT(X) 0
867 #define REG_OK_FOR_BASE_P_STRICT(X) REGNO_OK_FOR_BASE_P (REGNO (X))
868 #define STRICT 0
869
870 #else
871
872 /* Nonzero if X is a hard reg that can be used as an index.  */
873 #define REG_OK_FOR_INDEX_P(X) 0
874 /* Nonzero if X is a hard reg that can be used as a base reg.  */
875 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
876 #define STRICT 1
877
878 #endif
879
880 /* A C expression that defines the optional machine-dependent
881    constraint letters that can be used to segregate specific types of
882    operands, usually memory references, for the target machine.
883    Normally this macro will not be defined.  If it is required for a
884    particular target machine, it should return 1 if VALUE corresponds
885    to the operand type represented by the constraint letter C.  If C
886    is not defined as an extra constraint, the value returned should
887    be 0 regardless of VALUE.
888
889    For example, on the ROMP, load instructions cannot have their
890    output in r0 if the memory reference contains a symbolic address.
891    Constraint letter `Q' is defined as representing a memory address
892    that does *not* contain a symbolic address.  An alternative is
893    specified with a `Q' constraint on the input and `r' on the
894    output.  The next alternative specifies `m' on the input and a
895    register class that does not include r0 on the output.  */
896
897 #define EXTRA_CONSTRAINT(OP, C)                                         \
898  ((C) == 'Q'   ? ep_memory_operand (OP, GET_MODE (OP), 0)                       \
899   : (C) == 'R' ? special_symbolref_operand (OP, VOIDmode)               \
900   : (C) == 'S' ? (GET_CODE (OP) == SYMBOL_REF && ! ZDA_NAME_P (XSTR (OP, 0))) \
901   : (C) == 'T' ? 0                                                      \
902   : (C) == 'U' ? ((GET_CODE (OP) == SYMBOL_REF && ZDA_NAME_P (XSTR (OP, 0))) \
903                   || (GET_CODE (OP) == CONST                            \
904                       && GET_CODE (XEXP (OP, 0)) == PLUS                \
905                       && GET_CODE (XEXP (XEXP (OP, 0), 0)) == SYMBOL_REF \
906                       && ZDA_NAME_P (XSTR (XEXP (XEXP (OP, 0), 0), 0)))) \
907   : 0)
908 \f
909 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
910    that is a valid memory address for an instruction.
911    The MODE argument is the machine mode for the MEM expression
912    that wants to use this address.
913
914    The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
915    except for CONSTANT_ADDRESS_P which is actually
916    machine-independent.  */
917
918 /* Accept either REG or SUBREG where a register is valid.  */
919   
920 #define RTX_OK_FOR_BASE_P(X)                                            \
921   ((REG_P (X) && REG_OK_FOR_BASE_P (X))                                 \
922    || (GET_CODE (X) == SUBREG && REG_P (SUBREG_REG (X))                 \
923        && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
924
925 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)                         \
926 do {                                                                    \
927   if (RTX_OK_FOR_BASE_P (X)) goto ADDR;                                 \
928   if (CONSTANT_ADDRESS_P (X)                                            \
929       && (MODE == QImode || INTVAL (X) % 2 == 0)                        \
930       && (GET_MODE_SIZE (MODE) <= 4 || INTVAL (X) % 4 == 0))            \
931     goto ADDR;                                                          \
932   if (GET_CODE (X) == LO_SUM                                            \
933       && GET_CODE (XEXP (X, 0)) == REG                                  \
934       && REG_OK_FOR_BASE_P (XEXP (X, 0))                                \
935       && CONSTANT_P (XEXP (X, 1))                                       \
936       && (GET_CODE (XEXP (X, 1)) != CONST_INT                           \
937           || ((MODE == QImode || INTVAL (XEXP (X, 1)) % 2 == 0)         \
938               && CONST_OK_FOR_K (INTVAL (XEXP (X, 1)))))                \
939       && GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode))             \
940     goto ADDR;                                                          \
941   if (special_symbolref_operand (X, MODE)                               \
942       && (GET_MODE_SIZE (MODE) <= GET_MODE_SIZE (word_mode)))           \
943      goto ADDR;                                                         \
944   if (GET_CODE (X) == PLUS                                              \
945       && CONSTANT_ADDRESS_P (XEXP (X, 1))                               \
946       && (MODE == QImode || INTVAL (XEXP (X, 1)) % 2 == 0)              \
947       && RTX_OK_FOR_BASE_P (XEXP (X, 0))) goto ADDR;                    \
948 } while (0)
949
950 \f
951 /* Try machine-dependent ways of modifying an illegitimate address
952    to be legitimate.  If we find one, return the new, valid address.
953    This macro is used in only one place: `memory_address' in explow.c.
954
955    OLDX is the address as it was before break_out_memory_refs was called.
956    In some cases it is useful to look at this to decide what needs to be done.
957
958    MODE and WIN are passed so that this macro can use
959    GO_IF_LEGITIMATE_ADDRESS.
960
961    It is always safe for this macro to do nothing.  It exists to recognize
962    opportunities to optimize the output.   */
963
964 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)  {}
965
966 /* Go to LABEL if ADDR (a legitimate address expression)
967    has an effect that depends on the machine mode it is used for.  */
968
969 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)  {}
970
971 /* Nonzero if the constant value X is a legitimate general operand.
972    It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
973
974 #define LEGITIMATE_CONSTANT_P(X)                                        \
975   (GET_CODE (X) == CONST_DOUBLE                                         \
976    || !(GET_CODE (X) == CONST                                           \
977         && GET_CODE (XEXP (X, 0)) == PLUS                               \
978         && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF               \
979         && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT                \
980         && ! CONST_OK_FOR_K (INTVAL (XEXP (XEXP (X, 0), 1)))))
981
982 /* In rare cases, correct code generation requires extra machine
983    dependent processing between the second jump optimization pass and
984    delayed branch scheduling.  On those machines, define this macro
985    as a C statement to act on the code starting at INSN.  */
986
987 #define MACHINE_DEPENDENT_REORG(INSN) v850_reorg (INSN)
988
989 \f
990 /* Tell final.c how to eliminate redundant test instructions.  */
991
992 /* Here we define machine-dependent flags and fields in cc_status
993    (see `conditions.h').  No extra ones are needed for the vax.  */
994
995 /* Store in cc_status the expressions
996    that the condition codes will describe
997    after execution of an instruction whose pattern is EXP.
998    Do not alter them if the instruction would not alter the cc's.  */
999
1000 #define CC_OVERFLOW_UNUSABLE 0x200
1001 #define CC_NO_CARRY CC_NO_OVERFLOW
1002 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
1003
1004 /* A part of a C `switch' statement that describes the relative costs
1005    of constant RTL expressions.  It must contain `case' labels for
1006    expression codes `const_int', `const', `symbol_ref', `label_ref'
1007    and `const_double'.  Each case must ultimately reach a `return'
1008    statement to return the relative cost of the use of that kind of
1009    constant value in an expression.  The cost may depend on the
1010    precise value of the constant, which is available for examination
1011    in X, and the rtx code of the expression in which it is contained,
1012    found in OUTER_CODE.
1013
1014    CODE is the expression code--redundant, since it can be obtained
1015    with `GET_CODE (X)'. */
1016
1017 #define CONST_COSTS(RTX,CODE,OUTER_CODE)                                \
1018   case CONST_INT:                                                       \
1019   case CONST_DOUBLE:                                                    \
1020   case CONST:                                                           \
1021   case SYMBOL_REF:                                                      \
1022   case LABEL_REF:                                                       \
1023     {                                                                   \
1024       int _zxy = const_costs(RTX, CODE);                                \
1025       return (_zxy) ? COSTS_N_INSNS (_zxy) : 0;                         \
1026     }
1027
1028 /* A crude cut at RTX_COSTS for the V850.  */
1029
1030 /* Provide the costs of a rtl expression.  This is in the body of a
1031    switch on CODE. 
1032
1033    There aren't DImode MOD, DIV or MULT operations, so call them
1034    very expensive.  Everything else is pretty much a constant cost.  */
1035
1036 #define RTX_COSTS(RTX,CODE,OUTER_CODE)                                  \
1037   case MOD:                                                             \
1038   case DIV:                                                             \
1039     return 60;                                                          \
1040   case MULT:                                                            \
1041     return 20;
1042
1043 /* All addressing modes have the same cost on the V850 series.  */
1044 #define ADDRESS_COST(ADDR) 1
1045
1046 /* Nonzero if access to memory by bytes or half words is no faster
1047    than accessing full words.  */
1048 #define SLOW_BYTE_ACCESS 1
1049
1050 /* Define this if zero-extension is slow (more than one real instruction).  */
1051 #define SLOW_ZERO_EXTEND 
1052
1053 /* According expr.c, a value of around 6 should minimize code size, and
1054    for the V850 series, that's our primary concern.  */
1055 #define MOVE_RATIO 6
1056
1057 /* Indirect calls are expensive, never turn a direct call
1058    into an indirect call.  */
1059 #define NO_FUNCTION_CSE
1060
1061 /* The four different data regions on the v850.  */
1062 typedef enum 
1063 {
1064   DATA_AREA_NORMAL,
1065   DATA_AREA_SDA,
1066   DATA_AREA_TDA,
1067   DATA_AREA_ZDA
1068 } v850_data_area;
1069
1070 /* A list of names for sections other than the standard two, which are
1071    `in_text' and `in_data'.  You need not define this macro on a
1072    system with no other sections (that GCC needs to use).  */
1073 #undef  EXTRA_SECTIONS
1074 #define EXTRA_SECTIONS in_tdata, in_sdata, in_zdata, in_const, in_ctors, \
1075 in_dtors, in_rozdata, in_rosdata, in_sbss, in_zbss, in_zcommon, in_scommon
1076
1077 /* One or more functions to be defined in `varasm.c'.  These
1078    functions should do jobs analogous to those of `text_section' and
1079    `data_section', for your additional sections.  Do not define this
1080    macro if you do not define `EXTRA_SECTIONS'. */
1081 #undef  EXTRA_SECTION_FUNCTIONS
1082
1083 /* This could be done a lot more cleanly using ANSI C ... */
1084 #define EXTRA_SECTION_FUNCTIONS                                         \
1085 CONST_SECTION_FUNCTION                                                  \
1086 CTORS_SECTION_FUNCTION                                                  \
1087 DTORS_SECTION_FUNCTION                                                  \
1088                                                                         \
1089 void                                                                    \
1090 sdata_section ()                                                        \
1091 {                                                                       \
1092   if (in_section != in_sdata)                                           \
1093     {                                                                   \
1094       fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP);             \
1095       in_section = in_sdata;                                            \
1096     }                                                                   \
1097 }                                                                       \
1098                                                                         \
1099 void                                                                    \
1100 rosdata_section ()                                                      \
1101 {                                                                       \
1102   if (in_section != in_rosdata)                                         \
1103     {                                                                   \
1104       fprintf (asm_out_file, "%s\n", ROSDATA_SECTION_ASM_OP);           \
1105       in_section = in_sdata;                                            \
1106     }                                                                   \
1107 }                                                                       \
1108                                                                         \
1109 void                                                                    \
1110 sbss_section ()                                                         \
1111 {                                                                       \
1112   if (in_section != in_sbss)                                            \
1113     {                                                                   \
1114       fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP);              \
1115       in_section = in_sbss;                                             \
1116     }                                                                   \
1117 }                                                                       \
1118                                                                         \
1119 void                                                                    \
1120 tdata_section ()                                                        \
1121 {                                                                       \
1122   if (in_section != in_tdata)                                           \
1123     {                                                                   \
1124       fprintf (asm_out_file, "%s\n", TDATA_SECTION_ASM_OP);             \
1125       in_section = in_tdata;                                            \
1126     }                                                                   \
1127 }                                                                       \
1128                                                                         \
1129 void                                                                    \
1130 zdata_section ()                                                        \
1131 {                                                                       \
1132   if (in_section != in_zdata)                                           \
1133     {                                                                   \
1134       fprintf (asm_out_file, "%s\n", ZDATA_SECTION_ASM_OP);             \
1135       in_section = in_zdata;                                            \
1136     }                                                                   \
1137 }                                                                       \
1138                                                                         \
1139 void                                                                    \
1140 rozdata_section ()                                                      \
1141 {                                                                       \
1142   if (in_section != in_rozdata)                                         \
1143     {                                                                   \
1144       fprintf (asm_out_file, "%s\n", ROZDATA_SECTION_ASM_OP);           \
1145       in_section = in_rozdata;                                          \
1146     }                                                                   \
1147 }                                                                       \
1148                                                                         \
1149 void                                                                    \
1150 zbss_section ()                                                         \
1151 {                                                                       \
1152   if (in_section != in_zbss)                                            \
1153     {                                                                   \
1154       fprintf (asm_out_file, "%s\n", ZBSS_SECTION_ASM_OP);              \
1155       in_section = in_zbss;                                             \
1156     }                                                                   \
1157 }
1158
1159 #define TEXT_SECTION_ASM_OP  "\t.section .text"
1160 #define DATA_SECTION_ASM_OP  "\t.section .data"
1161 #define BSS_SECTION_ASM_OP   "\t.section .bss"
1162 #define SDATA_SECTION_ASM_OP "\t.section .sdata,\"aw\""
1163 #define SBSS_SECTION_ASM_OP  "\t.section .sbss,\"aw\""
1164 #define ZDATA_SECTION_ASM_OP "\t.section .zdata,\"aw\""
1165 #define ZBSS_SECTION_ASM_OP  "\t.section .zbss,\"aw\""
1166 #define TDATA_SECTION_ASM_OP "\t.section .tdata,\"aw\""
1167 #define ROSDATA_SECTION_ASM_OP "\t.section .rosdata,\"a\""
1168 #define ROZDATA_SECTION_ASM_OP "\t.section .rozdata,\"a\""
1169
1170 #define SCOMMON_ASM_OP         "\t.scomm\t"
1171 #define ZCOMMON_ASM_OP         "\t.zcomm\t"
1172 #define TCOMMON_ASM_OP         "\t.tcomm\t"
1173
1174 /* A C statement or statements to switch to the appropriate section
1175    for output of EXP.  You can assume that EXP is either a `VAR_DECL'
1176    node or a constant of some sort.  RELOC indicates whether the
1177    initial value of EXP requires link-time relocations.  Select the
1178    section by calling `text_section' or one of the alternatives for
1179    other sections.
1180
1181    Do not define this macro if you put all read-only variables and
1182    constants in the read-only data section (usually the text section).  */
1183 #undef  SELECT_SECTION
1184 #define SELECT_SECTION(EXP, RELOC)                                      \
1185 do {                                                                    \
1186   if (TREE_CODE (EXP) == VAR_DECL)                                      \
1187     {                                                                   \
1188       int is_const;                                                     \
1189       if (!TREE_READONLY (EXP)                                          \
1190           || TREE_SIDE_EFFECTS (EXP)                                    \
1191           || !DECL_INITIAL (EXP)                                        \
1192           || (DECL_INITIAL (EXP) != error_mark_node                     \
1193               && !TREE_CONSTANT (DECL_INITIAL (EXP))))                  \
1194         is_const = FALSE;                                               \
1195       else                                                              \
1196         is_const = TRUE;                                                \
1197                                                                         \
1198       switch (v850_get_data_area (EXP))                                 \
1199         {                                                               \
1200         case DATA_AREA_ZDA:                                             \
1201           if (is_const)                                                 \
1202             rozdata_section ();                                         \
1203           else                                                          \
1204             zdata_section ();                                           \
1205           break;                                                        \
1206                                                                         \
1207         case DATA_AREA_TDA:                                             \
1208           tdata_section ();                                             \
1209           break;                                                        \
1210                                                                         \
1211         case DATA_AREA_SDA:                                             \
1212           if (is_const)                                                 \
1213             rosdata_section ();                                         \
1214           else                                                          \
1215             sdata_section ();                                           \
1216           break;                                                        \
1217                                                                         \
1218         default:                                                        \
1219           if (is_const)                                                 \
1220             const_section ();                                           \
1221           else                                                          \
1222             data_section ();                                            \
1223           break;                                                        \
1224         }                                                               \
1225     }                                                                   \
1226   else if (TREE_CODE (EXP) == STRING_CST)                               \
1227     {                                                                   \
1228       if (! flag_writable_strings)                                      \
1229         const_section ();                                               \
1230       else                                                              \
1231         data_section ();                                                \
1232     }                                                                   \
1233                                                                         \
1234   else                                                                  \
1235     const_section ();                                                   \
1236                                                                         \
1237 } while (0)
1238
1239 /* A C statement or statements to switch to the appropriate section
1240    for output of RTX in mode MODE.  You can assume that RTX is some
1241    kind of constant in RTL.  The argument MODE is redundant except in
1242    the case of a `const_int' rtx.  Select the section by calling
1243    `text_section' or one of the alternatives for other sections.
1244
1245    Do not define this macro if you put all constants in the read-only
1246    data section.  */
1247 /* #define SELECT_RTX_SECTION(MODE, RTX) */
1248
1249 /* Output at beginning/end of assembler file.  */
1250 #undef ASM_FILE_START
1251 #define ASM_FILE_START(FILE) asm_file_start(FILE)
1252
1253 #define ASM_COMMENT_START "#"
1254
1255 /* Output to assembler file text saying following lines
1256    may contain character constants, extra white space, comments, etc.  */
1257
1258 #define ASM_APP_ON "#APP\n"
1259
1260 /* Output to assembler file text saying following lines
1261    no longer contain unusual constructs.  */
1262
1263 #define ASM_APP_OFF "#NO_APP\n"
1264
1265 /* This is how to output an assembler line defining a `double' constant.
1266    It is .double or .float, depending.  */
1267
1268 #define ASM_OUTPUT_DOUBLE(FILE, VALUE)                  \
1269 do { char dstr[30];                                     \
1270      REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr);    \
1271      fprintf (FILE, "\t.double %s\n", dstr);            \
1272    } while (0)
1273
1274
1275 /* This is how to output an assembler line defining a `float' constant.  */
1276 #define ASM_OUTPUT_FLOAT(FILE, VALUE)                   \
1277 do { char dstr[30];                                     \
1278      REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr);    \
1279      fprintf (FILE, "\t.float %s\n", dstr);             \
1280    } while (0)
1281
1282 /* This is how to output an assembler line defining an `int' constant.  */
1283
1284 #define ASM_OUTPUT_INT(FILE, VALUE)             \
1285 ( fprintf (FILE, "\t.long "),                   \
1286   output_addr_const (FILE, (VALUE)),            \
1287   fprintf (FILE, "\n"))
1288
1289 /* Likewise for `char' and `short' constants.  */
1290
1291 #define ASM_OUTPUT_SHORT(FILE, VALUE)           \
1292 ( fprintf (FILE, "\t.hword "),                  \
1293   output_addr_const (FILE, (VALUE)),            \
1294   fprintf (FILE, "\n"))
1295
1296 #define ASM_OUTPUT_CHAR(FILE, VALUE)            \
1297 ( fprintf (FILE, "\t.byte "),                   \
1298   output_addr_const (FILE, (VALUE)),            \
1299   fprintf (FILE, "\n"))
1300
1301 /* This is how to output an assembler line for a numeric constant byte.  */
1302 #define ASM_OUTPUT_BYTE(FILE, VALUE)  \
1303   fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1304
1305 /* Define the parentheses used to group arithmetic operations
1306    in assembler code.  */
1307
1308 #define ASM_OPEN_PAREN "("
1309 #define ASM_CLOSE_PAREN ")"
1310
1311 /* This says how to output the assembler to define a global
1312    uninitialized but not common symbol.  */
1313
1314 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
1315   asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
1316
1317 #undef  ASM_OUTPUT_ALIGNED_BSS 
1318 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
1319   v850_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
1320
1321 /* This says how to output the assembler to define a global
1322    uninitialized, common symbol. */
1323 #undef  ASM_OUTPUT_ALIGNED_COMMON
1324 #undef  ASM_OUTPUT_COMMON
1325 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
1326      v850_output_common (FILE, DECL, NAME, SIZE, ALIGN)
1327
1328 /* This says how to output the assembler to define a local
1329    uninitialized symbol. */
1330 #undef  ASM_OUTPUT_ALIGNED_LOCAL
1331 #undef  ASM_OUTPUT_LOCAL
1332 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
1333      v850_output_local (FILE, DECL, NAME, SIZE, ALIGN)
1334      
1335 /* This is how to output the definition of a user-level label named NAME,
1336    such as the label on a static function or variable NAME.  */
1337
1338 #define ASM_OUTPUT_LABEL(FILE, NAME)    \
1339   do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1340
1341 /* This is how to output a command to make the user-level label named NAME
1342    defined for reference from other files.  */
1343
1344 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \
1345   do { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
1346
1347 /* This is how to output a reference to a user-level label named NAME.
1348    `assemble_name' uses this.  */
1349
1350 #undef ASM_OUTPUT_LABELREF
1351 #define ASM_OUTPUT_LABELREF(FILE, NAME)           \
1352   do {                                            \
1353   const char * real_name;                         \
1354   STRIP_NAME_ENCODING (real_name, (NAME));        \
1355   fprintf (FILE, "_%s", real_name);               \
1356   } while (0)           
1357
1358 /* Store in OUTPUT a string (made with alloca) containing
1359    an assembler-name for a local static variable named NAME.
1360    LABELNO is an integer which is different for each call.  */
1361
1362 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)  \
1363 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),    \
1364   sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
1365
1366 /* This is how we tell the assembler that two symbols have the same value.  */
1367
1368 #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
1369   do { assemble_name(FILE, NAME1);       \
1370        fputs(" = ", FILE);               \
1371        assemble_name(FILE, NAME2);       \
1372        fputc('\n', FILE); } while (0)
1373
1374
1375 /* How to refer to registers in assembler output.
1376    This sequence is indexed by compiler's hard-register-number (see above).  */
1377
1378 #define REGISTER_NAMES                                                  \
1379 {  "r0",  "r1",  "r2",  "sp",  "gp",  "r5",  "r6" , "r7",               \
1380    "r8",  "r9", "r10", "r11", "r12", "r13", "r14", "r15",               \
1381   "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",               \
1382   "r24", "r25", "r26", "r27", "r28", "r29",  "ep", "r31",               \
1383   ".fp", ".ap"}
1384
1385 #define ADDITIONAL_REGISTER_NAMES                                       \
1386 { { "zero",     0 },                                                    \
1387   { "hp",       2 },                                                    \
1388   { "r3",       3 },                                                    \
1389   { "r4",       4 },                                                    \
1390   { "tp",       5 },                                                    \
1391   { "fp",       29 },                                                   \
1392   { "r30",      30 },                                                   \
1393   { "lp",       31} }
1394
1395 /* Print an instruction operand X on file FILE.
1396    look in v850.c for details */
1397
1398 #define PRINT_OPERAND(FILE, X, CODE)  print_operand (FILE, X, CODE)
1399
1400 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1401   ((CODE) == '.')
1402
1403 /* Print a memory operand whose address is X, on file FILE.
1404    This uses a function in output-vax.c.  */
1405
1406 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
1407
1408 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)
1409 #define ASM_OUTPUT_REG_POP(FILE,REGNO)
1410
1411 /* This is how to output an element of a case-vector that is absolute.  */
1412
1413 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1414   asm_fprintf (FILE, "\t%s .L%d\n",                                     \
1415                (TARGET_BIG_SWITCH ? ".long" : ".short"), VALUE)
1416
1417 /* This is how to output an element of a case-vector that is relative.  */
1418
1419 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1420   fprintf (FILE, "\t%s .L%d-.L%d\n",                                    \
1421            (TARGET_BIG_SWITCH ? ".long" : ".short"),                    \
1422            VALUE, REL)
1423
1424 #define ASM_OUTPUT_ALIGN(FILE, LOG)     \
1425   if ((LOG) != 0)                       \
1426     fprintf (FILE, "\t.align %d\n", (LOG))
1427
1428 /* We don't have to worry about dbx compatibility for the v850.  */
1429 #define DEFAULT_GDB_EXTENSIONS 1
1430
1431 /* Use stabs debugging info by default.  */
1432 #undef PREFERRED_DEBUGGING_TYPE
1433 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
1434
1435 #define DBX_REGISTER_NUMBER(REGNO) REGNO
1436
1437 /* Define to use software floating point emulator for REAL_ARITHMETIC and
1438    decimal <-> binary conversion. */
1439 #define REAL_ARITHMETIC
1440
1441 /* Specify the machine mode that this machine uses
1442    for the index in the tablejump instruction.  */
1443 #define CASE_VECTOR_MODE (TARGET_BIG_SWITCH ? SImode : HImode)
1444
1445 /* Define this if the case instruction drops through after the table
1446    when the index is out of range.  Don't define it if the case insn
1447    jumps to the default label instead.  */
1448 /* #define CASE_DROPS_THROUGH */
1449
1450 /* Define as C expression which evaluates to nonzero if the tablejump
1451    instruction expects the table to contain offsets from the address of the
1452    table.
1453    Do not define this if the table should contain absolute addresses. */
1454 #define CASE_VECTOR_PC_RELATIVE 1
1455
1456 /* The switch instruction requires that the jump table immediately follow
1457    it. */
1458 #define JUMP_TABLES_IN_TEXT_SECTION 1
1459
1460 /* svr4.h defines this assuming that 4 byte alignment is required.  */
1461 #undef ASM_OUTPUT_BEFORE_CASE_LABEL
1462 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
1463   ASM_OUTPUT_ALIGN ((FILE), (TARGET_BIG_SWITCH ? 2 : 1));
1464
1465 #define WORD_REGISTER_OPERATIONS
1466
1467 /* Byte and short loads sign extend the value to a word.  */
1468 #define LOAD_EXTEND_OP(MODE) SIGN_EXTEND
1469
1470 /* Specify the tree operation to be used to convert reals to integers.  */
1471 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1472
1473 /* This flag, if defined, says the same insns that convert to a signed fixnum
1474    also convert validly to an unsigned one.  */
1475 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC
1476
1477 /* This is the kind of divide that is easiest to do in the general case.  */
1478 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1479
1480 /* Max number of bytes we can move from memory to memory
1481    in one reasonably fast instruction.  */
1482 #define MOVE_MAX        4
1483
1484 /* Define if shifts truncate the shift count
1485    which implies one can omit a sign-extension or zero-extension
1486    of a shift count.  */
1487 #define SHIFT_COUNT_TRUNCATED 1
1488
1489 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1490    is done just by pretending it is already truncated.  */
1491 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1492
1493 #define STORE_FLAG_VALUE 1
1494
1495 /* Specify the machine mode that pointers have.
1496    After generation of rtl, the compiler makes no further distinction
1497    between pointers and any other objects of this machine mode.  */
1498 #define Pmode SImode
1499
1500 /* A function address in a call instruction
1501    is a byte address (for indexing purposes)
1502    so give the MEM rtx a byte's mode.  */
1503 #define FUNCTION_MODE QImode
1504
1505 /* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
1506    is a valid machine specific attribute for DECL.
1507    The attributes in ATTRIBUTES have previously been assigned to DECL.  */
1508 #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
1509   v850_valid_machine_decl_attribute (DECL, IDENTIFIER, ARGS)
1510
1511 /* A C statement that assigns default attributes to a newly created DECL.  */
1512 #define SET_DEFAULT_DECL_ATTRIBUTES(decl, attr) \
1513      v850_set_default_decl_attr (decl)
1514
1515 /* Tell compiler we want to support GHS pragmas */
1516 #define REGISTER_TARGET_PRAGMAS(PFILE) do {                               \
1517   cpp_register_pragma_space (PFILE, "ghs");                               \
1518   cpp_register_pragma (PFILE, "ghs", "interrupt", ghs_pragma_interrupt);  \
1519   cpp_register_pragma (PFILE, "ghs", "section",   ghs_pragma_section);    \
1520   cpp_register_pragma (PFILE, "ghs", "starttda",  ghs_pragma_starttda);   \
1521   cpp_register_pragma (PFILE, "ghs", "startsda",  ghs_pragma_startsda);   \
1522   cpp_register_pragma (PFILE, "ghs", "startzda",  ghs_pragma_startzda);   \
1523   cpp_register_pragma (PFILE, "ghs", "endtda",    ghs_pragma_endtda);     \
1524   cpp_register_pragma (PFILE, "ghs", "endsda",    ghs_pragma_endsda);     \
1525   cpp_register_pragma (PFILE, "ghs", "endzda",    ghs_pragma_endzda);     \
1526 } while (0)
1527
1528 /* enum GHS_SECTION_KIND is an enumeration of the kinds of sections that
1529    can appear in the "ghs section" pragma.  These names are used to index
1530    into the GHS_default_section_names[] and GHS_current_section_names[]
1531    that are defined in v850.c, and so the ordering of each must remain
1532    consistant. 
1533
1534    These arrays give the default and current names for each kind of 
1535    section defined by the GHS pragmas.  The current names can be changed
1536    by the "ghs section" pragma.  If the current names are null, use 
1537    the default names.  Note that the two arrays have different types.
1538
1539    For the *normal* section kinds (like .data, .text, etc.) we do not
1540    want to explicitly force the name of these sections, but would rather
1541    let the linker (or at least the back end) choose the name of the 
1542    section, UNLESS the user has force a specific name for these section
1543    kinds.  To accomplish this set the name in ghs_default_section_names
1544    to null.  */
1545
1546 enum GHS_section_kind
1547
1548   GHS_SECTION_KIND_DEFAULT,
1549
1550   GHS_SECTION_KIND_TEXT,
1551   GHS_SECTION_KIND_DATA, 
1552   GHS_SECTION_KIND_RODATA,
1553   GHS_SECTION_KIND_BSS,
1554   GHS_SECTION_KIND_SDATA,
1555   GHS_SECTION_KIND_ROSDATA,
1556   GHS_SECTION_KIND_TDATA,
1557   GHS_SECTION_KIND_ZDATA,
1558   GHS_SECTION_KIND_ROZDATA,
1559
1560   COUNT_OF_GHS_SECTION_KINDS  /* must be last */
1561 };
1562
1563 /* The following code is for handling pragmas supported by the
1564    v850 compiler produced by Green Hills Software.  This is at
1565    the specific request of a customer.  */
1566
1567 typedef struct data_area_stack_element
1568 {
1569   struct data_area_stack_element * prev;
1570   v850_data_area                   data_area; /* Current default data area.  */
1571 } data_area_stack_element;
1572
1573 /* Track the current data area set by the
1574    data area pragma (which can be nested).  */
1575 extern data_area_stack_element * data_area_stack;
1576
1577 /* Names of the various data areas used on the v850.  */
1578 extern union tree_node * GHS_default_section_names [(int) COUNT_OF_GHS_SECTION_KINDS];
1579 extern union tree_node * GHS_current_section_names [(int) COUNT_OF_GHS_SECTION_KINDS];
1580
1581 /* The assembler op to start the file.  */
1582
1583 #define FILE_ASM_OP "\t.file\n"
1584
1585 /* Enable the register move pass to improve code.  */
1586 #define ENABLE_REGMOVE_PASS
1587
1588
1589 /* Implement ZDA, TDA, and SDA */
1590
1591 #define EP_REGNUM 30    /* ep register number */
1592
1593 #define ENCODE_SECTION_INFO(DECL)                       \
1594   do                                                    \
1595     {                                                   \
1596       if ((TREE_STATIC (DECL) || DECL_EXTERNAL (DECL))  \
1597           && TREE_CODE (DECL) == VAR_DECL)              \
1598         v850_encode_data_area (DECL);                   \
1599     }                                                   \
1600   while (0)
1601
1602 #define ZDA_NAME_FLAG_CHAR '@'
1603 #define TDA_NAME_FLAG_CHAR '%'
1604 #define SDA_NAME_FLAG_CHAR '&'
1605
1606 #define ZDA_NAME_P(NAME) (*(NAME) == ZDA_NAME_FLAG_CHAR)
1607 #define TDA_NAME_P(NAME) (*(NAME) == TDA_NAME_FLAG_CHAR)
1608 #define SDA_NAME_P(NAME) (*(NAME) == SDA_NAME_FLAG_CHAR)
1609
1610 #define ENCODED_NAME_P(SYMBOL_NAME)    \
1611   (ZDA_NAME_P (SYMBOL_NAME)            \
1612    || TDA_NAME_P (SYMBOL_NAME)         \
1613    || SDA_NAME_P (SYMBOL_NAME))
1614
1615 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
1616      (VAR) = (SYMBOL_NAME) + (ENCODED_NAME_P (SYMBOL_NAME) || *(SYMBOL_NAME) == '*')
1617
1618 /* Define this if you have defined special-purpose predicates in the
1619    file `MACHINE.c'.  This macro is called within an initializer of an
1620    array of structures.  The first field in the structure is the name
1621    of a predicate and the second field is an array of rtl codes.  For
1622    each predicate, list all rtl codes that can be in expressions
1623    matched by the predicate.  The list should have a trailing comma.  */
1624
1625 #define PREDICATE_CODES                                                 \
1626 { "reg_or_0_operand",           { REG, SUBREG, CONST_INT, CONST_DOUBLE }}, \
1627 { "reg_or_int5_operand",        { REG, SUBREG, CONST_INT }},            \
1628 { "call_address_operand",       { REG, SYMBOL_REF }},                   \
1629 { "movsi_source_operand",       { LABEL_REF, SYMBOL_REF, CONST_INT,     \
1630                                   CONST_DOUBLE, CONST, HIGH, MEM,       \
1631                                   REG, SUBREG }},                       \
1632 { "special_symbolref_operand",  { SYMBOL_REF }},                        \
1633 { "power_of_two_operand",       { CONST_INT }},                         \
1634 { "pattern_is_ok_for_prologue", { PARALLEL }},                          \
1635 { "pattern_is_ok_for_epilogue", { PARALLEL }},                          \
1636 { "register_is_ok_for_epilogue",{ REG }},                               \
1637 { "not_power_of_two_operand",   { CONST_INT }},
1638   
1639 #endif /* v850.h */