OSDN Git Service

* config/alpha/osf.h: Standarize copyright statement.
[pf3gnuchains/gcc-fork.git] / gcc / config / arc / arc.h
1 /* Definitions of target machine for GNU compiler, Argonaut ARC cpu.
2    Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000
3    Free Software Foundation, Inc.
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 /* ??? This is an old port, and is undoubtedly suffering from bit rot.  */
23
24 /* Things to do:
25
26    - PREDICATE_CODES
27    - incscc, decscc?
28    - print active compiler options in assembler output
29 */
30
31 /* ??? Create elf.h and have svr4.h include it.  */
32 #include "svr4.h"
33
34 #undef ASM_SPEC
35 #undef LINK_SPEC
36 #undef STARTFILE_SPEC
37 #undef ENDFILE_SPEC
38 #undef SIZE_TYPE
39 #undef PTRDIFF_TYPE
40 #undef WCHAR_TYPE
41 #undef WCHAR_TYPE_SIZE
42 #undef ASM_OUTPUT_LABELREF
43 \f
44 /* Print subsidiary information on the compiler version in use.  */
45 #define TARGET_VERSION fprintf (stderr, " (arc)")
46
47 /* Names to predefine in the preprocessor for this target machine.  */
48 #define CPP_PREDEFINES "-Acpu=arc -Amachine=arc -D__arc__"
49
50 /* Additional flags for the preprocessor.  */
51 #define CPP_SPEC "\
52 %{!mcpu=*:-D__base__} %{mcpu=base:-D__base__} \
53 %{EB:-D__big_endian__} \
54 "
55
56 /* Pass -mmangle-cpu if we get -mcpu=*.
57    Doing it this way lets one have it on as default with -mcpu=*,
58    but also lets one turn it off with -mno-mangle-cpu.  */
59 #define CC1_SPEC "\
60 %{mcpu=*:-mmangle-cpu} \
61 %{EB:%{EL:%emay not use both -EB and -EL}} \
62 %{EB:-mbig-endian} %{EL:-mlittle-endian} \
63 "
64
65 #define ASM_SPEC "%{v} %{EB} %{EL}"
66
67 #define LINK_SPEC "%{v} %{EB} %{EL}"
68
69 #define STARTFILE_SPEC "%{!shared:crt0.o%s} crtinit.o%s"
70
71 #define ENDFILE_SPEC "crtfini.o%s"
72 \f
73 /* Run-time compilation parameters selecting different hardware subsets.  */
74
75 extern int target_flags;
76
77 /* Mangle all user symbols for the specified cpu.
78    ARC's can be shipped in which a collection of cpus are coupled together.
79    Each CPU may be different in some way, and thus we may need to distinguish
80    code compiled for one to ensure it isn't linked with code compiled for
81    another.  */
82 #define TARGET_MASK_MANGLE_CPU 1
83 #define TARGET_MANGLE_CPU (target_flags & TARGET_MASK_MANGLE_CPU)
84
85 #if 0
86 /* Mangle libgcc symbols by adding a suffix for the specified cpu.  */
87 #define TARGET_MASK_MANGLE_CPU_LIBGCC 2
88 #define TARGET_MANGLE_CPU_LIBGCC (target_flags & TARGET_MASK_MANGLE_CPU_LIBGCC)
89 #endif
90
91 /* Align loops to 32 byte boundaries (cache line size).  */
92 #define TARGET_MASK_ALIGN_LOOPS 4
93 #define TARGET_ALIGN_LOOPS (target_flags & TARGET_MASK_ALIGN_LOOPS)
94
95 /* Big Endian.  */
96 #define TARGET_MASK_BIG_ENDIAN 8
97 #define TARGET_BIG_ENDIAN (target_flags & TARGET_MASK_BIG_ENDIAN)
98
99 /* Turn off conditional execution optimization,
100    so we can see how well it does, or in case it's buggy.  */
101 #define TARGET_MASK_NO_COND_EXEC 0x10
102 #define TARGET_NO_COND_EXEC (target_flags & TARGET_MASK_NO_COND_EXEC)
103
104 /* Macro to define tables used to set the flags.
105    This is a list in braces of pairs in braces,
106    each pair being { "NAME", VALUE }
107    where VALUE is the bits to set or minus the bits to clear.
108    An empty string NAME is used to identify the default VALUE.  */
109
110 #define TARGET_SWITCHES \
111 { \
112     { "mangle-cpu",             TARGET_MASK_MANGLE_CPU },               \
113     { "no-mangle-cpu",          -TARGET_MASK_MANGLE_CPU },              \
114 /*  { "mangle-cpu-libgcc",      TARGET_MASK_MANGLE_CPU_LIBGCC }, */     \
115 /*  { "no-mangle-cpu-libgcc",   -TARGET_MASK_MANGLE_CPU_LIBGCC }, */    \
116     { "align-loops",            TARGET_MASK_ALIGN_LOOPS },              \
117     { "no-align-loops",         -TARGET_MASK_ALIGN_LOOPS },             \
118     { "big-endian",             TARGET_MASK_BIG_ENDIAN },               \
119     { "little-endian",          -TARGET_MASK_BIG_ENDIAN },              \
120     { "no-cond-exec",           TARGET_MASK_NO_COND_EXEC },             \
121     SUBTARGET_SWITCHES                                                  \
122     { "", TARGET_DEFAULT }                                              \
123 }
124
125 #define TARGET_DEFAULT (0)
126
127 #define SUBTARGET_SWITCHES
128
129 /* Instruction set characteristics.
130    These are internal macros, set by the appropriate -mcpu= option.  */
131
132 /* Non-zero means the cpu has a barrel shifter.  */
133 #define TARGET_SHIFTER 0
134
135 /* This macro is similar to `TARGET_SWITCHES' but defines names of
136    command options that have values.  Its definition is an
137    initializer with a subgrouping for each command option.
138
139    Each subgrouping contains a string constant, that defines the
140    fixed part of the option name, and the address of a variable. 
141    The variable, type `char *', is set to the variable part of the
142    given option if the fixed part matches.  The actual option name
143    is made by appending `-m' to the specified name.
144
145    Here is an example which defines `-mshort-data-NUMBER'.  If the
146    given option is `-mshort-data-512', the variable `m88k_short_data'
147    will be set to the string `"512"'.
148
149         extern char *m88k_short_data;
150         #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } }  */
151
152 extern const char *arc_cpu_string;
153 extern const char *arc_text_string,*arc_data_string,*arc_rodata_string;
154
155 #define TARGET_OPTIONS \
156 {                                               \
157   { "cpu=",     &arc_cpu_string         },      \
158   { "text=",    &arc_text_string        },      \
159   { "data=",    &arc_data_string        },      \
160   { "rodata=",  &arc_rodata_string      },      \
161 }
162
163 /* Which cpu we're compiling for.  */
164 extern int arc_cpu_type;
165
166 /* Check if CPU is an extension and set `arc_cpu_type' and `arc_mangle_cpu'
167    appropriately.  The result should be non-zero if the cpu is recognized,
168    otherwise zero.  This is intended to be redefined in a cover file.
169    This is used by arc_init.  */
170 #define ARC_EXTENSION_CPU(cpu) 0
171
172 /* Sometimes certain combinations of command options do not make
173    sense on a particular target machine.  You can define a macro
174    `OVERRIDE_OPTIONS' to take account of this.  This macro, if
175    defined, is executed once just after all the command options have
176    been parsed.
177
178    Don't use this macro to turn on various extra optimizations for
179    `-O'.  That is what `OPTIMIZATION_OPTIONS' is for.  */
180
181
182 #define OVERRIDE_OPTIONS \
183 do {                            \
184   /* These need to be done at start up.  It's convenient to do them here.  */ \
185   arc_init ();                  \
186 } while (0)
187 \f
188 /* Target machine storage layout.  */
189
190 /* Define to use software floating point emulator for REAL_ARITHMETIC and
191    decimal <-> binary conversion. */
192 #define REAL_ARITHMETIC
193
194 /* Define this if most significant bit is lowest numbered
195    in instructions that operate on numbered bit-fields.  */
196 #define BITS_BIG_ENDIAN 1
197
198 /* Define this if most significant byte of a word is the lowest numbered.  */
199 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
200
201 /* Define this if most significant word of a multiword number is the lowest
202    numbered.  */
203 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
204
205 /* Define this to set the endianness to use in libgcc2.c, which can
206    not depend on target_flags.  */
207 #ifdef __big_endian__
208 #define LIBGCC2_WORDS_BIG_ENDIAN 1
209 #else
210 #define LIBGCC2_WORDS_BIG_ENDIAN 0
211 #endif
212
213 /* Number of bits in an addressable storage unit.  */
214 #define BITS_PER_UNIT 8
215
216 /* Width in bits of a "word", which is the contents of a machine register.
217    Note that this is not necessarily the width of data type `int';
218    if using 16-bit ints on a 68000, this would still be 32.
219    But on a machine with 16-bit registers, this would be 16.  */
220 #define BITS_PER_WORD 32
221
222 /* Width of a word, in units (bytes).  */
223 #define UNITS_PER_WORD 4
224
225 /* Define this macro if it is advisable to hold scalars in registers
226    in a wider mode than that declared by the program.  In such cases, 
227    the value is constrained to be within the bounds of the declared
228    type, but kept valid in the wider mode.  The signedness of the
229    extension may differ from that of the type.  */
230 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
231 if (GET_MODE_CLASS (MODE) == MODE_INT           \
232     && GET_MODE_SIZE (MODE) < UNITS_PER_WORD)   \
233 {                                               \
234   (MODE) = SImode;                              \
235 }
236
237 /* Define this macro if the promotion described by `PROMOTE_MODE'
238    should also be done for outgoing function arguments.  */
239 #define PROMOTE_FUNCTION_ARGS
240
241 /* Likewise, if the function return value is promoted.  */
242 #define PROMOTE_FUNCTION_RETURN
243
244 /* Width in bits of a pointer.
245    See also the macro `Pmode' defined below.  */
246 #define POINTER_SIZE 32
247
248 /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
249 #define PARM_BOUNDARY 32
250
251 /* Boundary (in *bits*) on which stack pointer should be aligned.  */
252 #define STACK_BOUNDARY 64
253
254 /* ALIGN FRAMES on word boundaries */
255 #define ARC_STACK_ALIGN(LOC) (((LOC)+7) & ~7)
256
257 /* Allocation boundary (in *bits*) for the code of a function.  */
258 #define FUNCTION_BOUNDARY 32
259
260 /* Alignment of field after `int : 0' in a structure.  */
261 #define EMPTY_FIELD_BOUNDARY 32
262
263 /* Every structure's size must be a multiple of this.  */
264 #define STRUCTURE_SIZE_BOUNDARY 8
265
266 /* A bitfield declared as `int' forces `int' alignment for the struct.  */
267 #define PCC_BITFIELD_TYPE_MATTERS 1
268
269 /* No data type wants to be aligned rounder than this.  */
270 /* This is bigger than currently necessary for the ARC.  If 8 byte floats are
271    ever added it's not clear whether they'll need such alignment or not.  For
272    now we assume they will.  We can always relax it if necessary but the
273    reverse isn't true.  */
274 #define BIGGEST_ALIGNMENT 64
275
276 /* The best alignment to use in cases where we have a choice.  */
277 #define FASTEST_ALIGNMENT 32
278
279 /* Make strings word-aligned so strcpy from constants will be faster.  */
280 #define CONSTANT_ALIGNMENT(EXP, ALIGN)  \
281   ((TREE_CODE (EXP) == STRING_CST       \
282     && (ALIGN) < FASTEST_ALIGNMENT)     \
283    ? FASTEST_ALIGNMENT : (ALIGN))
284
285 /* Make arrays of chars word-aligned for the same reasons.  */
286 #define DATA_ALIGNMENT(TYPE, ALIGN)             \
287   (TREE_CODE (TYPE) == ARRAY_TYPE               \
288    && TYPE_MODE (TREE_TYPE (TYPE)) == QImode    \
289    && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
290
291 /* Set this nonzero if move instructions will actually fail to work
292    when given unaligned data.  */
293 /* On the ARC the lower address bits are masked to 0 as necessary.  The chip
294    won't croak when given an unaligned address, but the insn will still fail
295    to produce the correct result.  */
296 #define STRICT_ALIGNMENT 1
297 \f
298 /* Layout of source language data types.  */
299
300 #define SHORT_TYPE_SIZE         16
301 #define INT_TYPE_SIZE           32
302 #define LONG_TYPE_SIZE          32
303 #define LONG_LONG_TYPE_SIZE     64
304 #define FLOAT_TYPE_SIZE         32
305 #define DOUBLE_TYPE_SIZE        64
306 #define LONG_DOUBLE_TYPE_SIZE   64
307
308 /* Define this as 1 if `char' should by default be signed; else as 0.  */
309 #define DEFAULT_SIGNED_CHAR 1
310
311 #define SIZE_TYPE "long unsigned int"
312 #define PTRDIFF_TYPE "long int"
313 #define WCHAR_TYPE "short unsigned int"
314 #define WCHAR_TYPE_SIZE 16
315
316 /* Define results of standard character escape sequences.  */
317 #define TARGET_BELL 007
318 #define TARGET_BS 010
319 #define TARGET_TAB 011
320 #define TARGET_NEWLINE 012
321 #define TARGET_VT 013
322 #define TARGET_FF 014
323 #define TARGET_CR 015
324 \f
325 /* Standard register usage.  */
326
327 /* Number of actual hardware registers.
328    The hardware registers are assigned numbers for the compiler
329    from 0 to just below FIRST_PSEUDO_REGISTER.
330    All registers that the compiler knows about must be given numbers,
331    even those that are not normally considered general registers.  */
332 /* Registers 61, 62, and 63 are not really registers and we needn't treat
333    them as such.  We still need a register for the condition code.  */
334 #define FIRST_PSEUDO_REGISTER 62
335
336 /* 1 for registers that have pervasive standard uses
337    and are not available for the register allocator.
338
339    0-28  - general purpose registers
340    29    - ilink1 (interrupt link register)
341    30    - ilink2 (interrupt link register)
342    31    - blink (branch link register)
343    32-59 - reserved for extensions
344    60    - LP_COUNT
345    61    - condition code
346
347    For doc purposes:
348    61    - short immediate data indicator (setting flags)
349    62    - long immediate data indicator
350    63    - short immediate data indicator (not setting flags).
351
352    The general purpose registers are further broken down into:
353    0-7   - arguments/results
354    8-15  - call used
355    16-23 - call saved
356    24    - call used, static chain pointer
357    25    - call used, gptmp
358    26    - global pointer
359    27    - frame pointer
360    28    - stack pointer
361
362    By default, the extension registers are not available.  */
363
364 #define FIXED_REGISTERS \
365 { 0, 0, 0, 0, 0, 0, 0, 0,       \
366   0, 0, 0, 0, 0, 0, 0, 0,       \
367   0, 0, 0, 0, 0, 0, 0, 0,       \
368   0, 0, 0, 1, 1, 1, 1, 0,       \
369                                 \
370   1, 1, 1, 1, 1, 1, 1, 1,       \
371   1, 1, 1, 1, 1, 1, 1, 1,       \
372   1, 1, 1, 1, 1, 1, 1, 1,       \
373   1, 1, 1, 1, 1, 1 }
374
375 /* 1 for registers not available across function calls.
376    These must include the FIXED_REGISTERS and also any
377    registers that can be used without being saved.
378    The latter must include the registers where values are returned
379    and the register where structure-value addresses are passed.
380    Aside from that, you can include as many other registers as you like.  */
381
382 #define CALL_USED_REGISTERS \
383 { 1, 1, 1, 1, 1, 1, 1, 1,       \
384   1, 1, 1, 1, 1, 1, 1, 1,       \
385   0, 0, 0, 0, 0, 0, 0, 0,       \
386   1, 1, 1, 1, 1, 1, 1, 1,       \
387                                 \
388   1, 1, 1, 1, 1, 1, 1, 1,       \
389   1, 1, 1, 1, 1, 1, 1, 1,       \
390   1, 1, 1, 1, 1, 1, 1, 1,       \
391   1, 1, 1, 1, 1, 1 }
392
393 /* If defined, an initializer for a vector of integers, containing the
394    numbers of hard registers in the order in which GNU CC should
395    prefer to use them (from most preferred to least).  */
396 #define REG_ALLOC_ORDER \
397 { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1,                 \
398   16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 31,                       \
399   32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,       \
400   48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,               \
401   27, 28, 29, 30 }
402
403 /* Return number of consecutive hard regs needed starting at reg REGNO
404    to hold something of mode MODE.
405    This is ordinarily the length in words of a value of mode MODE
406    but can be less for certain modes in special long registers.  */
407 #define HARD_REGNO_NREGS(REGNO, MODE) \
408 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
409
410 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.  */
411 extern unsigned int arc_hard_regno_mode_ok[];
412 extern unsigned int arc_mode_class[];
413 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
414 ((arc_hard_regno_mode_ok[REGNO] & arc_mode_class[MODE]) != 0)
415
416 /* A C expression that is nonzero if it is desirable to choose
417    register allocation so as to avoid move instructions between a
418    value of mode MODE1 and a value of mode MODE2.
419
420    If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
421    MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
422    MODE2)' must be zero.  */
423
424 /* Tie QI/HI/SI modes together.  */
425 #define MODES_TIEABLE_P(MODE1, MODE2) \
426 (GET_MODE_CLASS (MODE1) == MODE_INT             \
427  && GET_MODE_CLASS (MODE2) == MODE_INT          \
428  && GET_MODE_SIZE (MODE1) <= UNITS_PER_WORD     \
429  && GET_MODE_SIZE (MODE2) <= UNITS_PER_WORD)
430 \f
431 /* Register classes and constants.  */
432
433 /* Define the classes of registers for register constraints in the
434    machine description.  Also define ranges of constants.
435
436    One of the classes must always be named ALL_REGS and include all hard regs.
437    If there is more than one class, another class must be named NO_REGS
438    and contain no registers.
439
440    The name GENERAL_REGS must be the name of a class (or an alias for
441    another name such as ALL_REGS).  This is the class of registers
442    that is allowed by "g" or "r" in a register constraint.
443    Also, registers outside this class are allocated only when
444    instructions express preferences for them.
445
446    The classes must be numbered in nondecreasing order; that is,
447    a larger-numbered class must never be contained completely
448    in a smaller-numbered class.
449
450    For any two classes, it is very desirable that there be another
451    class that represents their union.
452
453    It is important that any condition codes have class NO_REGS.
454    See `register_operand'.  */
455
456 enum reg_class {
457   NO_REGS, LPCOUNT_REG, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
458 };
459
460 #define N_REG_CLASSES (int) LIM_REG_CLASSES
461
462 /* Give names of register classes as strings for dump file.   */
463 #define REG_CLASS_NAMES \
464 { "NO_REGS", "LPCOUNT_REG", "GENERAL_REGS", "ALL_REGS" }
465
466 /* Define which registers fit in which classes.
467    This is an initializer for a vector of HARD_REG_SET
468    of length N_REG_CLASSES.  */
469
470 #define REG_CLASS_CONTENTS \
471 { {0, 0}, {0, 0x10000000}, {0xffffffff, 0xfffffff}, \
472   {0xffffffff, 0x1fffffff} }
473
474 /* The same information, inverted:
475    Return the class number of the smallest class containing
476    reg number REGNO.  This could be a conditional expression
477    or could index an array.  */
478 extern enum reg_class arc_regno_reg_class[];
479 #define REGNO_REG_CLASS(REGNO) \
480 (arc_regno_reg_class[REGNO])
481
482 /* The class value for index registers, and the one for base regs.  */
483 #define INDEX_REG_CLASS GENERAL_REGS
484 #define BASE_REG_CLASS GENERAL_REGS
485
486 /* Get reg_class from a letter such as appears in the machine description.  */
487 #define REG_CLASS_FROM_LETTER(C) \
488 ((C) == 'l' ? LPCOUNT_REG /* ??? needed? */ \
489  : NO_REGS)
490
491 /* These assume that REGNO is a hard or pseudo reg number.
492    They give nonzero only if REGNO is a hard reg of the suitable class
493    or a pseudo reg currently allocated to a suitable hard reg.
494    Since they use reg_renumber, they are safe only once reg_renumber
495    has been allocated, which happens in local-alloc.c.  */
496 #define REGNO_OK_FOR_BASE_P(REGNO) \
497 ((REGNO) < 29 || (unsigned) reg_renumber[REGNO] < 29)
498 #define REGNO_OK_FOR_INDEX_P(REGNO) \
499 ((REGNO) < 29 || (unsigned) reg_renumber[REGNO] < 29)
500
501 /* Given an rtx X being reloaded into a reg required to be
502    in class CLASS, return the class of reg to actually use.
503    In general this is just CLASS; but on some machines
504    in some cases it is preferable to use a more restrictive class.  */
505 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
506 (CLASS)
507
508 /* Return the maximum number of consecutive registers
509    needed to represent mode MODE in a register of class CLASS.  */
510 #define CLASS_MAX_NREGS(CLASS, MODE) \
511 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
512
513 /* The letters I, J, K, L, M, N, O, P in a register constraint string
514    can be used to stand for particular ranges of immediate operands.
515    This macro defines what the ranges are.
516    C is the letter, and VALUE is a constant value.
517    Return 1 if VALUE is in the range specified by C.  */
518 /* 'I' is used for short immediates (always signed).
519    'J' is used for long immediates.
520    'K' is used for any constant up to 64 bits (for 64x32 situations?).  */
521
522 /* local to this file */
523 #define SMALL_INT(X) ((unsigned) ((X) + 0x100) < 0x200)
524 /* local to this file */
525 #define LARGE_INT(X) \
526 ((X) >= (-(HOST_WIDE_INT) 0x7fffffff - 1) \
527  && (X) <= (unsigned HOST_WIDE_INT) 0xffffffff)
528
529 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
530 ((C) == 'I' ? SMALL_INT (VALUE)         \
531  : (C) == 'J' ? LARGE_INT (VALUE)       \
532  : (C) == 'K' ? 1                       \
533  : 0)
534
535 /* Similar, but for floating constants, and defining letters G and H.
536    Here VALUE is the CONST_DOUBLE rtx itself.  */
537 /* 'G' is used for integer values for the multiplication insns where the
538    operands are extended from 4 bytes to 8 bytes.
539    'H' is used when any 64 bit constant is allowed.  */
540 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
541 ((C) == 'G' ? arc_double_limm_p (VALUE) \
542  : (C) == 'H' ? 1 \
543  : 0)
544
545 /* A C expression that defines the optional machine-dependent constraint
546    letters that can be used to segregate specific types of operands,
547    usually memory references, for the target machine.  It should return 1 if
548    VALUE corresponds to the operand type represented by the constraint letter
549    C.  If C is not defined as an extra constraint, the value returned should
550    be 0 regardless of VALUE.  */
551 /* ??? This currently isn't used.  Waiting for PIC.  */
552 #if 0
553 #define EXTRA_CONSTRAINT(VALUE, C) \
554 ((C) == 'R' ? (SYMBOL_REF_FLAG (VALUE) || GET_CODE (VALUE) == LABEL_REF) \
555  : 0)
556 #endif
557 \f
558 /* Stack layout and stack pointer usage.  */
559
560 /* Define this macro if pushing a word onto the stack moves the stack
561    pointer to a smaller address.  */
562 #define STACK_GROWS_DOWNWARD
563
564 /* Define this if the nominal address of the stack frame
565    is at the high-address end of the local variables;
566    that is, each additional local variable allocated
567    goes at a more negative offset in the frame.  */
568 #define FRAME_GROWS_DOWNWARD
569
570 /* Offset within stack frame to start allocating local variables at.
571    If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
572    first local allocated.  Otherwise, it is the offset to the BEGINNING
573    of the first local allocated.  */
574 #define STARTING_FRAME_OFFSET 0
575
576 /* Offset from the stack pointer register to the first location at which
577    outgoing arguments are placed.  */
578 #define STACK_POINTER_OFFSET FIRST_PARM_OFFSET (0)
579
580 /* Offset of first parameter from the argument pointer register value.  */
581 /* 4 bytes for each of previous fp, return address, and previous gp.
582    4 byte reserved area for future considerations.  */
583 #define FIRST_PARM_OFFSET(FNDECL) 16
584
585 /* A C expression whose value is RTL representing the address in a
586    stack frame where the pointer to the caller's frame is stored.
587    Assume that FRAMEADDR is an RTL expression for the address of the
588    stack frame itself.
589
590    If you don't define this macro, the default is to return the value
591    of FRAMEADDR--that is, the stack frame address is also the address
592    of the stack word that points to the previous frame.  */
593 /* ??? unfinished */
594 /*define DYNAMIC_CHAIN_ADDRESS (FRAMEADDR)*/
595
596 /* A C expression whose value is RTL representing the value of the
597    return address for the frame COUNT steps up from the current frame.
598    FRAMEADDR is the frame pointer of the COUNT frame, or the frame
599    pointer of the COUNT - 1 frame if `RETURN_ADDR_IN_PREVIOUS_FRAME'
600    is defined.  */
601 /* The current return address is in r31.  The return address of anything
602    farther back is at [%fp,4].  */
603 #if 0 /* The default value should work.  */
604 #define RETURN_ADDR_RTX(COUNT, FRAME) \
605 (((COUNT) == -1)                                                        \
606  ? gen_rtx_REG (Pmode, 31)                                              \
607  : copy_to_reg (gen_rtx_MEM (Pmode,                                     \
608                              memory_address (Pmode,                     \
609                                              plus_constant ((FRAME),    \
610                                                             UNITS_PER_WORD)))))
611 #endif
612
613 /* Register to use for pushing function arguments.  */
614 #define STACK_POINTER_REGNUM 28
615
616 /* Base register for access to local variables of the function.  */
617 #define FRAME_POINTER_REGNUM 27
618
619 /* Base register for access to arguments of the function.  */
620 #define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM
621
622 /* Register in which static-chain is passed to a function.  This must
623    not be a register used by the prologue.  */
624 #define STATIC_CHAIN_REGNUM 24
625
626 /* A C expression which is nonzero if a function must have and use a
627    frame pointer.  This expression is evaluated in the reload pass.
628    If its value is nonzero the function will have a frame pointer.  */
629 #define FRAME_POINTER_REQUIRED \
630 (current_function_calls_alloca)
631
632 /* C statement to store the difference between the frame pointer
633    and the stack pointer values immediately after the function prologue.  */
634 #define INITIAL_FRAME_POINTER_OFFSET(VAR) \
635 ((VAR) = arc_compute_frame_size (get_frame_size ()))
636 \f
637 /* Function argument passing.  */
638
639 /* When a prototype says `char' or `short', really pass an `int'.  */
640 #define PROMOTE_PROTOTYPES 1
641
642 /* If defined, the maximum amount of space required for outgoing
643    arguments will be computed and placed into the variable
644    `current_function_outgoing_args_size'.  No space will be pushed
645    onto the stack for each call; instead, the function prologue should
646    increase the stack frame size by this amount.  */
647 #define ACCUMULATE_OUTGOING_ARGS 1
648
649 /* Value is the number of bytes of arguments automatically
650    popped when returning from a subroutine call.
651    FUNDECL is the declaration node of the function (as a tree),
652    FUNTYPE is the data type of the function (as a tree),
653    or for a library call it is an identifier node for the subroutine name.
654    SIZE is the number of bytes of arguments passed on the stack.  */
655 #define RETURN_POPS_ARGS(DECL, FUNTYPE, SIZE) 0
656
657 /* Define a data type for recording info about an argument list
658    during the scan of that argument list.  This data type should
659    hold all necessary information about the function itself
660    and about the args processed so far, enough to enable macros
661    such as FUNCTION_ARG to determine where the next arg should go.  */
662 #define CUMULATIVE_ARGS int
663
664 /* Initialize a variable CUM of type CUMULATIVE_ARGS
665    for a call to a function whose data type is FNTYPE.
666    For a library call, FNTYPE is 0.  */
667 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
668 ((CUM) = 0)
669
670 /* The number of registers used for parameter passing.  Local to this file.  */
671 #define MAX_ARC_PARM_REGS 8
672
673 /* 1 if N is a possible register number for function argument passing.  */
674 #define FUNCTION_ARG_REGNO_P(N) \
675 ((unsigned) (N) < MAX_ARC_PARM_REGS)
676
677 /* The ROUND_ADVANCE* macros are local to this file.  */
678 /* Round SIZE up to a word boundary.  */
679 #define ROUND_ADVANCE(SIZE) \
680 (((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
681
682 /* Round arg MODE/TYPE up to the next word boundary.  */
683 #define ROUND_ADVANCE_ARG(MODE, TYPE) \
684 ((MODE) == BLKmode                              \
685  ? ROUND_ADVANCE (int_size_in_bytes (TYPE))     \
686  : ROUND_ADVANCE (GET_MODE_SIZE (MODE)))
687
688 /* Round CUM up to the necessary point for argument MODE/TYPE.  */
689 #define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) \
690 ((((MODE) == BLKmode ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) \
691   > BITS_PER_WORD)      \
692  ? (((CUM) + 1) & ~1)   \
693  : (CUM))
694
695 /* Return boolean indicating arg of type TYPE and mode MODE will be passed in
696    a reg.  This includes arguments that have to be passed by reference as the
697    pointer to them is passed in a reg if one is available (and that is what
698    we're given).
699    When passing arguments NAMED is always 1.  When receiving arguments NAMED
700    is 1 for each argument except the last in a stdarg/varargs function.  In
701    a stdarg function we want to treat the last named arg as named.  In a
702    varargs function we want to treat the last named arg (which is
703    `__builtin_va_alist') as unnamed.
704    This macro is only used in this file.  */
705 #define PASS_IN_REG_P(CUM, MODE, TYPE, NAMED) \
706 ((!current_function_varargs || (NAMED))                                 \
707  && (CUM) < MAX_ARC_PARM_REGS                                           \
708  && ((ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))                         \
709       + ROUND_ADVANCE_ARG ((MODE), (TYPE))                              \
710       <= MAX_ARC_PARM_REGS)))
711
712 /* Determine where to put an argument to a function.
713    Value is zero to push the argument on the stack,
714    or a hard register in which to store the argument.
715
716    MODE is the argument's machine mode.
717    TYPE is the data type of the argument (as a tree).
718     This is null for libcalls where that information may
719     not be available.
720    CUM is a variable of type CUMULATIVE_ARGS which gives info about
721     the preceding args and about the function being called.
722    NAMED is nonzero if this argument is a named parameter
723     (otherwise it is an extra parameter matching an ellipsis).  */
724 /* On the ARC the first MAX_ARC_PARM_REGS args are normally in registers
725    and the rest are pushed.  */
726 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
727 (PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED))                         \
728  ? gen_rtx_REG ((MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)))      \
729  : 0)
730
731 /* A C expression for the number of words, at the beginning of an
732    argument, must be put in registers.  The value must be zero for
733    arguments that are passed entirely in registers or that are entirely
734    pushed on the stack.
735
736    On some machines, certain arguments must be passed partially in
737    registers and partially in memory.  On these machines, typically the
738    first @var{n} words of arguments are passed in registers, and the rest
739    on the stack.  If a multi-word argument (a @code{double} or a
740    structure) crosses that boundary, its first few words must be passed
741    in registers and the rest must be pushed.  This macro tells the
742    compiler when this occurs, and how many of the words should go in
743    registers.  */
744 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
745
746 /* A C expression that indicates when an argument must be passed by
747    reference.  If nonzero for an argument, a copy of that argument is
748    made in memory and a pointer to the argument is passed instead of
749    the argument itself.  The pointer is passed in whatever way is
750    appropriate for passing a pointer to that type.  */
751 /* All aggregates and arguments greater than 8 bytes are passed this way.  */
752 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
753 (TYPE                                   \
754  && (AGGREGATE_TYPE_P (TYPE)            \
755      || int_size_in_bytes (TYPE) > 8))
756
757 /* A C expression that indicates when it is the called function's
758    responsibility to make copies of arguments passed by reference.
759    If the callee can determine that the argument won't be modified, it can
760    avoid the copy.  */
761 /* ??? We'd love to be able to use NAMED here.  Unfortunately, it doesn't
762    include the last named argument so we keep track of the args ourselves.  */
763
764 #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
765 FUNCTION_ARG_PASS_BY_REFERENCE ((CUM), (MODE), (TYPE), (NAMED))
766
767 /* Update the data in CUM to advance over an argument
768    of mode MODE and data type TYPE.
769    (TYPE is null for libcalls where that information may not be available.)  */
770 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
771 ((CUM) = (ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) \
772           + ROUND_ADVANCE_ARG ((MODE), (TYPE))))
773
774 /* If defined, a C expression that gives the alignment boundary, in bits,
775    of an argument with the specified mode and type.  If it is not defined, 
776    PARM_BOUNDARY is used for all arguments.  */
777 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
778 (((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) <= PARM_BOUNDARY \
779  ? PARM_BOUNDARY \
780  : 2 * PARM_BOUNDARY)
781
782 /* This macro offers an alternative
783    to using `__builtin_saveregs' and defining the macro
784    `EXPAND_BUILTIN_SAVEREGS'.  Use it to store the anonymous register
785    arguments into the stack so that all the arguments appear to have
786    been passed consecutively on the stack.  Once this is done, you
787    can use the standard implementation of varargs that works for
788    machines that pass all their arguments on the stack.
789
790    The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure,
791    containing the values that obtain after processing of the named
792    arguments.  The arguments MODE and TYPE describe the last named
793    argument--its machine mode and its data type as a tree node.
794
795    The macro implementation should do two things: first, push onto the
796    stack all the argument registers *not* used for the named
797    arguments, and second, store the size of the data thus pushed into
798    the `int'-valued variable whose name is supplied as the argument
799    PRETEND_SIZE.  The value that you store here will serve as
800    additional offset for setting up the stack frame.
801
802    If the argument NO_RTL is nonzero, it means that the
803    arguments of the function are being analyzed for the second time.
804    This happens for an inline function, which is not actually
805    compiled until the end of the source file.  The macro
806    `SETUP_INCOMING_VARARGS' should not generate any instructions in
807    this case.  */
808
809 #define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_SIZE, NO_RTL) \
810 arc_setup_incoming_varargs(&ARGS_SO_FAR, MODE, TYPE, &PRETEND_SIZE, NO_RTL)
811 \f
812 /* Function results.  */
813
814 /* Define how to find the value returned by a function.
815    VALTYPE is the data type of the value (as a tree).
816    If the precise function being called is known, FUNC is its FUNCTION_DECL;
817    otherwise, FUNC is 0.  */
818 #define FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG (TYPE_MODE (VALTYPE), 0)
819
820 /* Define how to find the value returned by a library function
821    assuming the value has mode MODE.  */
822 #define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, 0)
823
824 /* 1 if N is a possible register number for a function value
825    as seen by the caller.  */
826 /* ??? What about r1 in DI/DF values.  */
827 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
828
829 /* A C expression which can inhibit the returning of certain function
830    values in registers, based on the type of value.  A nonzero value says
831    to return the function value in memory, just as large structures are
832    always returned.  Here TYPE will be a C expression of type `tree',
833    representing the data type of the value.  */
834 #define RETURN_IN_MEMORY(TYPE) \
835 (AGGREGATE_TYPE_P (TYPE) \
836  || int_size_in_bytes (TYPE) > 8 \
837  || TREE_ADDRESSABLE (TYPE))
838
839 /* Tell GCC to use RETURN_IN_MEMORY.  */
840 #define DEFAULT_PCC_STRUCT_RETURN 0
841
842 /* Register in which address to store a structure value
843    is passed to a function, or 0 to use `invisible' first argument.  */
844 #define STRUCT_VALUE 0
845 \f
846 /* Function entry and exit.  */
847
848 /* This macro generates the assembly code for function entry.
849    FILE is a stdio stream to output the code to.
850    SIZE is an int: how many units of temporary storage to allocate.
851    Refer to the array `regs_ever_live' to determine which registers
852    to save; `regs_ever_live[I]' is nonzero if register number I
853    is ever used in the function.  This macro is responsible for
854    knowing which registers should not be saved even if used.  */
855 #define FUNCTION_PROLOGUE(FILE, SIZE) \
856 arc_output_function_prologue (FILE, SIZE)
857
858 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
859    the stack pointer does not matter.  The value is tested only in
860    functions that have frame pointers.
861    No definition is equivalent to always zero.  */
862 #define EXIT_IGNORE_STACK 0
863
864 /* This macro generates the assembly code for function exit,
865    on machines that need it.  If FUNCTION_EPILOGUE is not defined
866    then individual return instructions are generated for each
867    return statement.  Args are same as for FUNCTION_PROLOGUE.
868
869    The function epilogue should not depend on the current stack pointer!
870    It should use the frame pointer only.  This is mandatory because
871    of alloca; we also take advantage of it to omit stack adjustments
872    before returning.  */
873 #define FUNCTION_EPILOGUE(FILE, SIZE) \
874 arc_output_function_epilogue (FILE, SIZE)
875
876 /* Epilogue delay slots.  */
877 #define DELAY_SLOTS_FOR_EPILOGUE arc_delay_slots_for_epilogue ()
878
879 #define ELIGIBLE_FOR_EPILOGUE_DELAY(TRIAL, SLOTS_FILLED) \
880 arc_eligible_for_epilogue_delay (TRIAL, SLOTS_FILLED)
881
882 /* Output assembler code to FILE to increment profiler label # LABELNO
883    for profiling a function entry.  */
884 #define FUNCTION_PROFILER(FILE, LABELNO)
885 \f
886 /* Trampolines.  */
887 /* ??? This doesn't work yet because GCC will use as the address of a nested
888    function the address of the trampoline.  We need to use that address
889    right shifted by 2.  It looks like we'll need PSImode after all. :-(  */
890
891 /* Output assembler code for a block containing the constant parts
892    of a trampoline, leaving space for the variable parts.  */
893 /* On the ARC, the trampoline is quite simple as we have 32 bit immediate
894    constants.
895
896         mov r24,STATIC
897         j.nd FUNCTION
898 */
899 #define TRAMPOLINE_TEMPLATE(FILE) \
900 do { \
901   ASM_OUTPUT_INT (FILE, GEN_INT (0x631f7c00)); \
902   ASM_OUTPUT_INT (FILE, const0_rtx); \
903   ASM_OUTPUT_INT (FILE, GEN_INT (0x381f0000)); \
904   ASM_OUTPUT_INT (FILE, const0_rtx); \
905 } while (0)
906
907 /* Length in units of the trampoline for entering a nested function.  */
908 #define TRAMPOLINE_SIZE 16
909
910 /* Emit RTL insns to initialize the variable parts of a trampoline.
911    FNADDR is an RTX for the address of the function's pure code.
912    CXT is an RTX for the static chain value for the function.  */
913 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
914 do { \
915   emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 4)), CXT); \
916   emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 12)), FNADDR); \
917   emit_insn (gen_flush_icache (validize_mem (gen_rtx_MEM (SImode, TRAMP)))); \
918 } while (0)
919 \f
920 /* Library calls.  */
921
922 /* Generate calls to memcpy, memcmp and memset.  */
923 #define TARGET_MEM_FUNCTIONS
924 \f
925 /* Addressing modes, and classification of registers for them.  */
926
927 /* Maximum number of registers that can appear in a valid memory address.  */
928 /* The `ld' insn allows 2, but the `st' insn only allows 1.  */
929 #define MAX_REGS_PER_ADDRESS 1
930
931 /* We have pre inc/dec (load/store with update).  */
932 #define HAVE_PRE_INCREMENT 1
933 #define HAVE_PRE_DECREMENT 1
934
935 /* Recognize any constant value that is a valid address.  */
936 #define CONSTANT_ADDRESS_P(X) \
937 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF        \
938  || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST)
939
940 /* Nonzero if the constant value X is a legitimate general operand.
941    We can handle any 32 or 64 bit constant.  */
942 /* "1" should work since the largest constant should be a 64 bit critter.  */
943 /* ??? Not sure what to do for 64x32 compiler.  */
944 #define LEGITIMATE_CONSTANT_P(X) 1
945
946 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
947    and check its validity for a certain class.
948    We have two alternate definitions for each of them.
949    The usual definition accepts all pseudo regs; the other rejects
950    them unless they have been allocated suitable hard regs.
951    The symbol REG_OK_STRICT causes the latter definition to be used.
952
953    Most source files want to accept pseudo regs in the hope that
954    they will get allocated to the class that the insn wants them to be in.
955    Source files for reload pass need to be strict.
956    After reload, it makes no difference, since pseudo regs have
957    been eliminated by then.  */
958
959 #ifndef REG_OK_STRICT
960
961 /* Nonzero if X is a hard reg that can be used as an index
962    or if it is a pseudo reg.  */
963 #define REG_OK_FOR_INDEX_P(X) \
964 ((unsigned) REGNO (X) - 29 >= FIRST_PSEUDO_REGISTER - 29)
965 /* Nonzero if X is a hard reg that can be used as a base reg
966    or if it is a pseudo reg.  */
967 #define REG_OK_FOR_BASE_P(X) \
968 ((unsigned) REGNO (X) - 29 >= FIRST_PSEUDO_REGISTER - 29)
969
970 #else
971
972 /* Nonzero if X is a hard reg that can be used as an index.  */
973 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
974 /* Nonzero if X is a hard reg that can be used as a base reg.  */
975 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
976
977 #endif
978
979 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
980    that is a valid memory address for an instruction.
981    The MODE argument is the machine mode for the MEM expression
982    that wants to use this address.  */
983 /* The `ld' insn allows [reg],[reg+shimm],[reg+limm],[reg+reg],[limm]
984    but the `st' insn only allows [reg],[reg+shimm],[limm].
985    The only thing we can do is only allow the most strict case `st' and hope
986    other parts optimize out the restrictions for `ld'.  */
987
988 /* local to this file */
989 #define RTX_OK_FOR_BASE_P(X) \
990 (REG_P (X) && REG_OK_FOR_BASE_P (X))
991
992 /* local to this file */
993 #define RTX_OK_FOR_INDEX_P(X) \
994 (0 && /*???*/ REG_P (X) && REG_OK_FOR_INDEX_P (X))
995
996 /* local to this file */
997 /* ??? Loads can handle any constant, stores can only handle small ones.  */
998 #define RTX_OK_FOR_OFFSET_P(X) \
999 (GET_CODE (X) == CONST_INT && SMALL_INT (INTVAL (X)))
1000
1001 #define LEGITIMATE_OFFSET_ADDRESS_P(MODE, X) \
1002 (GET_CODE (X) == PLUS                           \
1003  && RTX_OK_FOR_BASE_P (XEXP (X, 0))             \
1004  && (RTX_OK_FOR_INDEX_P (XEXP (X, 1))           \
1005      || RTX_OK_FOR_OFFSET_P (XEXP (X, 1))))
1006
1007 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)         \
1008 { if (RTX_OK_FOR_BASE_P (X))                            \
1009     goto ADDR;                                          \
1010   if (LEGITIMATE_OFFSET_ADDRESS_P ((MODE), (X)))        \
1011     goto ADDR;                                          \
1012   if (GET_CODE (X) == CONST_INT && LARGE_INT (INTVAL (X))) \
1013     goto ADDR;                                          \
1014   if (GET_CODE (X) == SYMBOL_REF                        \
1015            || GET_CODE (X) == LABEL_REF                 \
1016            || GET_CODE (X) == CONST)                    \
1017     goto ADDR;                                          \
1018   if ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == PRE_INC) \
1019       /* We're restricted here by the `st' insn.  */    \
1020       && RTX_OK_FOR_BASE_P (XEXP ((X), 0)))             \
1021     goto ADDR;                                          \
1022 }
1023
1024 /* Try machine-dependent ways of modifying an illegitimate address
1025    to be legitimate.  If we find one, return the new, valid address.
1026    This macro is used in only one place: `memory_address' in explow.c.
1027
1028    OLDX is the address as it was before break_out_memory_refs was called.
1029    In some cases it is useful to look at this to decide what needs to be done.
1030
1031    MODE and WIN are passed so that this macro can use
1032    GO_IF_LEGITIMATE_ADDRESS.
1033
1034    It is always safe for this macro to do nothing.  It exists to recognize
1035    opportunities to optimize the output.  */
1036
1037 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)
1038
1039 /* Go to LABEL if ADDR (a legitimate address expression)
1040    has an effect that depends on the machine mode it is used for.  */
1041 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
1042 { if (GET_CODE (ADDR) == PRE_DEC)       \
1043     goto LABEL;                         \
1044   if (GET_CODE (ADDR) == PRE_INC)       \
1045     goto LABEL;                         \
1046 }
1047 \f
1048 /* Condition code usage.  */
1049
1050 /* Some insns set all condition code flags, some only set the ZNC flags, and
1051    some only set the ZN flags.  */
1052
1053 #define EXTRA_CC_MODES \
1054         CC(CCZNCmode, "CCZNC") \
1055         CC(CCZNmode, "CCZN")
1056
1057 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
1058    return the mode to be used for the comparison.  */
1059 #define SELECT_CC_MODE(OP, X, Y) \
1060 arc_select_cc_mode (OP, X, Y)
1061
1062 /* Return non-zero if SELECT_CC_MODE will never return MODE for a
1063    floating point inequality comparison.  */
1064 #define REVERSIBLE_CC_MODE(MODE) 1 /*???*/
1065 \f
1066 /* Costs.  */
1067
1068 /* An insn is define to cost 4 "units", and we work from there.
1069    COSTS_N_INSNS (N) is defined as (N) * 4 - 2 so that seems reasonable.
1070    Some values are supposed to be defined relative to each other and thus
1071    aren't necessarily related to COSTS_N_INSNS.  */
1072
1073 /* Compute the cost of computing a constant rtl expression RTX
1074    whose rtx-code is CODE.  The body of this macro is a portion
1075    of a switch statement.  If the code is computed here,
1076    return it with a return statement.  Otherwise, break from the switch.  */
1077 /* Small integers are as cheap as registers.  4 byte values can be fetched
1078    as immediate constants - let's give that the cost of an extra insn. */
1079 #define CONST_COSTS(X, CODE, OUTER_CODE) \
1080   case CONST_INT :                                              \
1081     if (SMALL_INT (INTVAL (X)))                                 \
1082       return 0;                                                 \
1083     /* fall through */                                          \
1084   case CONST :                                                  \
1085   case LABEL_REF :                                              \
1086   case SYMBOL_REF :                                             \
1087     return 4;                                                   \
1088   case CONST_DOUBLE :                                           \
1089     {                                                           \
1090       rtx high, low;                                            \
1091       split_double (X, &high, &low);                            \
1092       return 4 * (!SMALL_INT (INTVAL (high))                    \
1093                   + !SMALL_INT (INTVAL (low)));                 \
1094     }
1095
1096 /* Compute the cost of an address.  */
1097 #define ADDRESS_COST(ADDR) (REG_P (ADDR) ? 1 : arc_address_cost (ADDR))
1098
1099 /* Compute extra cost of moving data between one register class
1100    and another.  */
1101 #define REGISTER_MOVE_COST(CLASS1, CLASS2) 2
1102
1103 /* Compute the cost of moving data between registers and memory.  */
1104 /* Memory is 3 times as expensive as registers.
1105    ??? Is that the right way to look at it?  */
1106 #define MEMORY_MOVE_COST(MODE,CLASS,IN) \
1107 (GET_MODE_SIZE (MODE) <= UNITS_PER_WORD ? 6 : 12)
1108
1109 /* The cost of a branch insn.  */
1110 /* ??? What's the right value here?  Branches are certainly more
1111    expensive than reg->reg moves.  */
1112 #define BRANCH_COST 2
1113
1114 /* Provide the costs of a rtl expression.  This is in the body of a
1115    switch on CODE.  The purpose for the cost of MULT is to encourage
1116    `synth_mult' to find a synthetic multiply when reasonable.
1117
1118    If we need more than 12 insns to do a multiply, then go out-of-line,
1119    since the call overhead will be < 10% of the cost of the multiply.  */
1120 #define RTX_COSTS(X, CODE, OUTER_CODE) \
1121   case ASHIFT :                                         \
1122   case ASHIFTRT :                                       \
1123   case LSHIFTRT :                                       \
1124     if (TARGET_SHIFTER)                                 \
1125       return COSTS_N_INSNS (1);                         \
1126     if (GET_CODE (XEXP ((X), 1)) != CONST_INT)          \
1127       return COSTS_N_INSNS (16);                        \
1128     return COSTS_N_INSNS (INTVAL (XEXP ((X), 1)));
1129
1130 /* Nonzero if access to memory by bytes is slow and undesirable.
1131    For RISC chips, it means that access to memory by bytes is no
1132    better than access by words when possible, so grab a whole word
1133    and maybe make use of that.  */
1134 #define SLOW_BYTE_ACCESS 1
1135
1136 /* Define this macro if it is as good or better to call a constant
1137    function address than to call an address kept in a register.  */
1138 /* On the ARC, calling through registers is slow.  */
1139 #define NO_FUNCTION_CSE
1140
1141 /* Define this macro if it is as good or better for a function to call
1142    itself with an explicit address than to call an address kept in a
1143    register.  */
1144 /* On the ARC, calling through registers is slow.  */
1145 #define NO_RECURSIVE_FUNCTION_CSE
1146 \f
1147 /* Section selection.  */
1148 /* WARNING: These section names also appear in dwarfout.c.  */
1149
1150 /* The names of the text, data, and readonly-data sections are runtime
1151    selectable.  */
1152
1153 #define ARC_SECTION_FORMAT              "\t.section %s"
1154 #define ARC_DEFAULT_TEXT_SECTION        ".text"
1155 #define ARC_DEFAULT_DATA_SECTION        ".data"
1156 #define ARC_DEFAULT_RODATA_SECTION      ".rodata"
1157
1158 extern const char *arc_text_section, *arc_data_section, *arc_rodata_section;
1159
1160 /* initfini.c uses this in an asm.  */
1161 #if defined (CRT_INIT) || defined (CRT_FINI)
1162 #define TEXT_SECTION_ASM_OP     "\t.section .text"
1163 #else
1164 #define TEXT_SECTION_ASM_OP     arc_text_section /*"\t.section .text"*/
1165 #endif
1166 #define DATA_SECTION_ASM_OP     arc_data_section /*"\t.section .data"*/
1167
1168 #undef CONST_SECTION_ASM_OP
1169 #define CONST_SECTION_ASM_OP    arc_rodata_section /*"\t.section .rodata"*/
1170
1171 #define BSS_SECTION_ASM_OP      "\t.section .bss"
1172
1173 /* Define this macro if jump tables (for tablejump insns) should be
1174    output in the text section, along with the assembler instructions.
1175    Otherwise, the readonly data section is used.
1176    This macro is irrelevant if there is no separate readonly data section.  */
1177 /*#define JUMP_TABLES_IN_TEXT_SECTION*/
1178
1179 /* Define this macro if references to a symbol must be treated
1180    differently depending on something about the variable or
1181    function named by the symbol (such as what section it is in).
1182
1183    The macro definition, if any, is executed immediately after the
1184    rtl for DECL or other node is created.
1185    The value of the rtl will be a `mem' whose address is a
1186    `symbol_ref'.
1187
1188    The usual thing for this macro to do is to store a flag in the
1189    `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
1190    name string in the `symbol_ref' (if one bit is not enough
1191    information).  */
1192
1193 /* On the ARC, function addresses are not the same as normal addresses.
1194    Branch to absolute address insns take an address that is right-shifted
1195    by 2.  We encode the fact that we have a function here, and then emit a
1196    special assembler op when outputting the address.  */
1197 #define ENCODE_SECTION_INFO(DECL) \
1198 do {                                                    \
1199   if (TREE_CODE (DECL) == FUNCTION_DECL)                \
1200     SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;    \
1201 } while (0)
1202
1203 /* Decode SYM_NAME and store the real name part in VAR, sans
1204    the characters that encode section info.  Define this macro if
1205    ENCODE_SECTION_INFO alters the symbol's name string.  */
1206 /*#define STRIP_NAME_ENCODING(VAR, SYM_NAME)*/
1207
1208 /* For DWARF.  Marginally different than default so output is "prettier"
1209    (and consistent with above).  */
1210 #define PUSHSECTION_ASM_OP "\t.section "
1211
1212 /* Tell crtstuff.c we're using ELF.  */
1213 #define OBJECT_FORMAT_ELF
1214 \f
1215 /* PIC */
1216
1217 /* The register number of the register used to address a table of static
1218    data addresses in memory.  In some cases this register is defined by a
1219    processor's ``application binary interface'' (ABI).  When this macro
1220    is defined, RTL is generated for this register once, as with the stack
1221    pointer and frame pointer registers.  If this macro is not defined, it
1222    is up to the machine-dependent files to allocate such a register (if
1223    necessary).  */
1224 #define PIC_OFFSET_TABLE_REGNUM 26
1225
1226 /* Define this macro if the register defined by PIC_OFFSET_TABLE_REGNUM is
1227    clobbered by calls.  Do not define this macro if PIC_OFFSET_TABLE_REGNUM
1228    is not defined.  */
1229 /* This register is call-saved on the ARC.  */
1230 /*#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED*/
1231
1232 /* By generating position-independent code, when two different programs (A
1233    and B) share a common library (libC.a), the text of the library can be
1234    shared whether or not the library is linked at the same address for both
1235    programs.  In some of these environments, position-independent code
1236    requires not only the use of different addressing modes, but also
1237    special code to enable the use of these addressing modes.
1238
1239    The FINALIZE_PIC macro serves as a hook to emit these special
1240    codes once the function is being compiled into assembly code, but not
1241    before.  (It is not done before, because in the case of compiling an
1242    inline function, it would lead to multiple PIC prologues being
1243    included in functions which used inline functions and were compiled to
1244    assembly language.)  */
1245
1246 #define FINALIZE_PIC arc_finalize_pic ()
1247
1248 /* A C expression that is nonzero if X is a legitimate immediate
1249    operand on the target machine when generating position independent code.
1250    You can assume that X satisfies CONSTANT_P, so you need not
1251    check this.  You can also assume `flag_pic' is true, so you need not
1252    check it either.  You need not define this macro if all constants
1253    (including SYMBOL_REF) can be immediate operands when generating
1254    position independent code.  */
1255 /*#define LEGITIMATE_PIC_OPERAND_P(X)*/
1256 \f
1257 /* Control the assembler format that we output.  */
1258
1259 /* Output at beginning of assembler file.  */
1260 #undef ASM_FILE_START
1261 #define ASM_FILE_START(FILE) arc_asm_file_start (FILE)
1262
1263 /* A C statement to output assembler commands which will identify the
1264    object file as having been compiled with GNU CC (or another GNU
1265    compiler).  */
1266 #undef ASM_IDENTIFY_GCC
1267 #define ASM_IDENTIFY_GCC(FILE) /* nothing */
1268
1269 /* Needed because we define ASM_IDENTIFY_GCC.  */
1270 #define ASM_IDENTIFY_LANGUAGE(FILE) output_lang_identify (FILE)
1271
1272 /* A C string constant describing how to begin a comment in the target
1273    assembler language.  The compiler assumes that the comment will
1274    end at the end of the line.  */
1275 #define ASM_COMMENT_START ";"
1276
1277 /* Output to assembler file text saying following lines
1278    may contain character constants, extra white space, comments, etc.  */
1279 #define ASM_APP_ON ""
1280
1281 /* Output to assembler file text saying following lines
1282    no longer contain unusual constructs.  */
1283 #define ASM_APP_OFF ""
1284
1285 /* This is how to output an assembler line defining a `char' constant.  */
1286 #define ASM_OUTPUT_CHAR(FILE, VALUE) \
1287 ( fprintf (FILE, "\t.byte\t"),                  \
1288   output_addr_const (FILE, (VALUE)),            \
1289   fprintf (FILE, "\n"))
1290
1291 /* This is how to output an assembler line defining a `short' constant.  */
1292 #define ASM_OUTPUT_SHORT(FILE, VALUE) \
1293 ( fprintf (FILE, "\t.hword\t"),                 \
1294   output_addr_const (FILE, (VALUE)),            \
1295   fprintf (FILE, "\n"))
1296
1297 /* This is how to output an assembler line defining an `int' constant.
1298    We also handle symbol output here.  Code addresses must be right shifted
1299    by 2 because that's how the jump instruction wants them.  */
1300 #define ASM_OUTPUT_INT(FILE, VALUE) \
1301 do {                                                                    \
1302   fprintf (FILE, "\t.word\t");                                          \
1303   if ((GET_CODE (VALUE) == SYMBOL_REF && SYMBOL_REF_FLAG (VALUE))       \
1304       || GET_CODE (VALUE) == LABEL_REF)                                 \
1305     {                                                                   \
1306       fprintf (FILE, "%%st(");                                          \
1307       output_addr_const (FILE, (VALUE));                                \
1308       fprintf (FILE, ")");                                              \
1309     }                                                                   \
1310   else                                                                  \
1311     output_addr_const (FILE, (VALUE));                                  \
1312   fprintf (FILE, "\n");                                                 \
1313 } while (0)
1314
1315 /* This is how to output an assembler line defining a `float' constant.  */
1316 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
1317 {                                                       \
1318   long t;                                               \
1319   char str[30];                                         \
1320   REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t);             \
1321   REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str);        \
1322   fprintf (FILE, "\t.word\t0x%lx %s %s\n",              \
1323            t, ASM_COMMENT_START, str);                  \
1324 }
1325
1326 /* This is how to output an assembler line defining a `double' constant.  */
1327 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
1328 {                                                       \
1329   long t[2];                                            \
1330   char str[30];                                         \
1331   REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t);             \
1332   REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str);        \
1333   fprintf (FILE, "\t.word\t0x%lx %s %s\n\t.word\t0x%lx\n", \
1334            t[0], ASM_COMMENT_START, str, t[1]);         \
1335 }
1336
1337 /* This is how to output an assembler line for a numeric constant byte.  */
1338 #define ASM_BYTE_OP     "\t.byte\t"
1339 #define ASM_OUTPUT_BYTE(FILE, VALUE)  \
1340   fprintf (FILE, "%s0x%x\n", ASM_BYTE_OP, (VALUE))
1341
1342 /* The assembler's parentheses characters.  */
1343 #define ASM_OPEN_PAREN "("
1344 #define ASM_CLOSE_PAREN ")"
1345
1346 /* This is how to output the definition of a user-level label named NAME,
1347    such as the label on a static function or variable NAME.  */
1348 #define ASM_OUTPUT_LABEL(FILE, NAME) \
1349 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1350
1351 /* This is how to output a command to make the user-level label named NAME
1352    defined for reference from other files.  */
1353 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \
1354 do {                            \
1355   fputs ("\t.global\t", FILE);  \
1356   assemble_name (FILE, NAME);   \
1357   fputs ("\n", FILE);           \
1358 } while (0)
1359
1360 /* A C statement (sans semicolon) to output on FILE an assembler pseudo-op to
1361    declare a library function name external.  The name of the library function
1362    is given by SYMREF, which has type RTX and is a SYMBOL_REF.  */
1363 #if 0
1364 /* On the ARC we want to have libgcc's for multiple cpus in one binary.
1365    We can't use `assemble_name' here as that will call ASM_OUTPUT_LABELREF
1366    and we'll get another suffix added on if -mmangle-cpu.  */
1367 extern const char *arc_mangle_cpu;
1368 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, SYMREF) \
1369 do {                                                    \
1370   if (TARGET_MANGLE_CPU_LIBGCC)                         \
1371     {                                                   \
1372       fprintf (FILE, "\t.rename\t_%s, _%s%s\n",         \
1373                XSTR (SYMREF, 0), XSTR (SYMREF, 0),      \
1374                arc_mangle_suffix);                      \
1375     }                                                   \
1376 } while (0)
1377 #endif
1378
1379 /* This is how to output a reference to a user-level label named NAME.
1380    `assemble_name' uses this.  */
1381 /* We mangle all user labels to provide protection from linking code
1382    compiled for different cpus.  */
1383 /* We work around a dwarfout.c deficiency by watching for labels from it and
1384    not adding the '_' prefix nor the cpu suffix.  There is a comment in
1385    dwarfout.c that says it should be using ASM_OUTPUT_INTERNAL_LABEL.  */
1386 extern const char *arc_mangle_cpu;
1387 #define ASM_OUTPUT_LABELREF(FILE, NAME) \
1388 do {                                                    \
1389   if ((NAME)[0] == '.' && (NAME)[1] == 'L')             \
1390     fprintf (FILE, "%s", NAME);                         \
1391   else                                                  \
1392     {                                                   \
1393       fputc ('_', FILE);                                \
1394       if (TARGET_MANGLE_CPU && arc_mangle_cpu != NULL)  \
1395         fprintf (FILE, "%s_", arc_mangle_cpu);          \
1396       fprintf (FILE, "%s", NAME);                       \
1397     }                                                   \
1398 } while (0)
1399
1400 /* This is how to output a definition of an internal numbered label where
1401    PREFIX is the class of label and NUM is the number within the class.  */
1402 #undef ASM_OUTPUT_INTERNAL_LABEL
1403 #define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \
1404 do {                                            \
1405   arc_ccfsm_at_label (PREFIX, NUM);             \
1406   fprintf (FILE, ".%s%d:\n", PREFIX, NUM);      \
1407 } while (0)
1408
1409 /* Store in OUTPUT a string (made with alloca) containing
1410    an assembler-name for a local static variable named NAME.
1411    LABELNO is an integer which is different for each call.  */
1412 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1413 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),    \
1414   sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1415
1416 /* Assembler pseudo-op to equate one value with another.  */
1417 /* ??? This is needed because dwarfout.c provides a default definition too
1418    late for defaults.h (which contains the default definition of ASM_OUTPUT_DEF
1419    that we use).  */
1420 #define SET_ASM_OP "\t.set\t"
1421
1422 /* A C statement (sans semicolon) to output an element in the table of
1423    global constructors.  */
1424 #undef ASM_OUTPUT_CONSTRUCTOR
1425 #define ASM_OUTPUT_CONSTRUCTOR(FILE, NAME) \
1426 do {                                    \
1427   ctors_section ();                     \
1428   fprintf (FILE, "\t.word\t%%st(");     \
1429   assemble_name (FILE, NAME);           \
1430   fprintf (FILE, ")\n");                \
1431 } while (0)
1432
1433 /* A C statement (sans semicolon) to output an element in the table of
1434    global destructors.  */
1435 #undef ASM_OUTPUT_DESTRUCTOR
1436 #define ASM_OUTPUT_DESTRUCTOR(FILE, NAME) \
1437 do {                                    \
1438   dtors_section ();                     \
1439   fprintf (FILE, "\t.word\t%%st(");     \
1440   assemble_name (FILE, NAME);           \
1441   fprintf (FILE, ")\n");                \
1442 } while (0)
1443
1444 /* How to refer to registers in assembler output.
1445    This sequence is indexed by compiler's hard-register-number (see above).  */
1446 #define REGISTER_NAMES \
1447 {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",                \
1448  "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",          \
1449  "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",        \
1450  "r24", "r25", "r26", "fp", "sp", "ilink1", "ilink2", "blink",  \
1451  "r32", "r33", "r34", "r35", "r36", "r37", "r38", "r39",        \
1452  "r40", "r41", "r42", "r43", "r44", "r45", "r46", "r47",        \
1453  "r48", "r49", "r50", "r51", "r52", "r53", "r54", "r55",        \
1454  "r56", "r57", "r58", "r59", "lp_count", "cc"}
1455
1456 /* Entry to the insn conditionalizer.  */
1457 #define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
1458 arc_final_prescan_insn (INSN, OPVEC, NOPERANDS)
1459
1460 /* A C expression which evaluates to true if CODE is a valid
1461    punctuation character for use in the `PRINT_OPERAND' macro.  */
1462 extern char arc_punct_chars[];
1463 #define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
1464 arc_punct_chars[(unsigned char) (CHAR)]
1465
1466 /* Print operand X (an rtx) in assembler syntax to file FILE.
1467    CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1468    For `%' followed by punctuation, CODE is the punctuation and X is null.  */
1469 #define PRINT_OPERAND(FILE, X, CODE) \
1470 arc_print_operand (FILE, X, CODE)
1471
1472 /* A C compound statement to output to stdio stream STREAM the
1473    assembler syntax for an instruction operand that is a memory
1474    reference whose address is ADDR.  ADDR is an RTL expression.
1475
1476    On some machines, the syntax for a symbolic address depends on
1477    the section that the address refers to.  On these machines,
1478    define the macro `ENCODE_SECTION_INFO' to store the information
1479    into the `symbol_ref', and then check for it here.  */
1480 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1481 arc_print_operand_address (FILE, ADDR)
1482
1483 /* This is how to output an element of a case-vector that is absolute.  */
1484 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
1485 do {                                                    \
1486   char label[30];                                       \
1487   ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE);      \
1488   fprintf (FILE, "\t.word %%st(");                      \
1489   assemble_name (FILE, label);                          \
1490   fprintf (FILE, ")\n");                                \
1491 } while (0)
1492
1493 /* This is how to output an element of a case-vector that is relative.  */
1494 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1495 do {                                                    \
1496   char label[30];                                       \
1497   ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE);      \
1498   fprintf (FILE, "\t.word %%st(");                      \
1499   assemble_name (FILE, label);                          \
1500   fprintf (FILE, "-");                                  \
1501   ASM_GENERATE_INTERNAL_LABEL (label, "L", REL);        \
1502   assemble_name (FILE, label);                          \
1503   fprintf (FILE, ")\n");                                \
1504 } while (0)
1505
1506 /* The desired alignment for the location counter at the beginning
1507    of a loop.  */
1508 /* On the ARC, align loops to 32 byte boundaries (cache line size)
1509    if -malign-loops.  */
1510 #define LOOP_ALIGN(LABEL) (TARGET_ALIGN_LOOPS ? 5 : 0)
1511
1512 /* This is how to output an assembler line
1513    that says to advance the location counter
1514    to a multiple of 2**LOG bytes.  */
1515 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1516 do { if ((LOG) != 0) fprintf (FILE, "\t.align %d\n", 1 << (LOG)); } while (0)
1517 \f
1518 /* Debugging information.  */
1519
1520 /* Generate DBX and DWARF debugging information.  */
1521 #ifndef DBX_DEBUGGING_INFO
1522 #define DBX_DEBUGGING_INFO
1523 #endif
1524 #ifndef DWARF_DEBUGGING_INFO
1525 #define DWARF_DEBUGGING_INFO
1526 #endif
1527
1528 /* Prefer STABS (for now).  */
1529 #undef PREFERRED_DEBUGGING_TYPE
1530 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
1531
1532 /* How to renumber registers for dbx and gdb.  */
1533 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
1534
1535 /* Turn off splitting of long stabs.  */
1536 #define DBX_CONTIN_LENGTH 0
1537 \f
1538 /* Miscellaneous.  */
1539
1540 /* Specify the machine mode that this machine uses
1541    for the index in the tablejump instruction.  */
1542 #define CASE_VECTOR_MODE Pmode
1543
1544 /* Define as C expression which evaluates to nonzero if the tablejump
1545    instruction expects the table to contain offsets from the address of the
1546    table.
1547    Do not define this if the table should contain absolute addresses. */
1548 /* It's not clear what PIC will look like or whether we want to use -fpic
1549    for the embedded form currently being talked about.  For now require -fpic
1550    to get pc relative switch tables.  */
1551 /*#define CASE_VECTOR_PC_RELATIVE 1 */
1552
1553 /* Define if operations between registers always perform the operation
1554    on the full register even if a narrower mode is specified.  */
1555 #define WORD_REGISTER_OPERATIONS
1556
1557 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
1558    will either zero-extend or sign-extend.  The value of this macro should
1559    be the code that says which one of the two operations is implicitly
1560    done, NIL if none.  */
1561 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
1562
1563 /* Specify the tree operation to be used to convert reals to integers.  */
1564 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1565
1566 /* This is the kind of divide that is easiest to do in the general case.  */
1567 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1568
1569 /* Max number of bytes we can move from memory to memory
1570    in one reasonably fast instruction.  */
1571 #define MOVE_MAX 4
1572
1573 /* Define this to be nonzero if shift instructions ignore all but the low-order
1574    few bits. */
1575 #define SHIFT_COUNT_TRUNCATED 1
1576
1577 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1578    is done just by pretending it is already truncated.  */
1579 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1580
1581 /* We assume that the store-condition-codes instructions store 0 for false
1582    and some other value for true.  This is the value stored for true.  */
1583 #define STORE_FLAG_VALUE 1
1584
1585 /* Specify the machine mode that pointers have.
1586    After generation of rtl, the compiler makes no further distinction
1587    between pointers and any other objects of this machine mode.  */
1588 /* ??? The arc doesn't have full 32 bit pointers, but making this PSImode has
1589    its own problems (you have to add extendpsisi2 and trucnsipsi2 but how does
1590    one do it without getting excess code?).  Try to avoid it.  */
1591 #define Pmode SImode
1592
1593 /* A function address in a call instruction.  */
1594 #define FUNCTION_MODE SImode
1595
1596 /* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
1597    is a valid machine specific attribute for DECL.
1598    The attributes in ATTRIBUTES have previously been assigned to TYPE.  */
1599 #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
1600 arc_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
1601
1602 /* A C expression that returns zero if the attributes on TYPE1 and TYPE2 are
1603    incompatible, one if they are compatible, and two if they are
1604    nearly compatible (which causes a warning to be generated).  */
1605 #define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
1606 arc_comp_type_attributes (TYPE1, TYPE2)
1607
1608 /* Give newly defined TYPE some default attributes.  */
1609 #define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
1610 arc_set_default_type_attributes (TYPE)
1611
1612 /* alloca should avoid clobbering the old register save area.  */
1613 /* ??? Not defined in tm.texi.  */
1614 #define SETJMP_VIA_SAVE_AREA
1615 \f
1616 /* Define the information needed to generate branch and scc insns.  This is
1617    stored from the compare operation.  Note that we can't use "rtx" here
1618    since it hasn't been defined!  */
1619 extern struct rtx_def *arc_compare_op0, *arc_compare_op1;
1620
1621 /* ARC function types.   */
1622 enum arc_function_type {
1623   ARC_FUNCTION_UNKNOWN, ARC_FUNCTION_NORMAL,
1624   /* These are interrupt handlers.  The name corresponds to the register
1625      name that contains the return address.  */
1626   ARC_FUNCTION_ILINK1, ARC_FUNCTION_ILINK2
1627 };
1628 #define ARC_INTERRUPT_P(TYPE) \
1629 ((TYPE) == ARC_FUNCTION_ILINK1 || (TYPE) == ARC_FUNCTION_ILINK2)
1630 /* Compute the type of a function from its DECL.  */
1631
1632 \f
1633 /* Implement `va_start' for varargs and stdarg.  */
1634 #define EXPAND_BUILTIN_VA_START(stdarg, valist, nextarg) \
1635   arc_va_start (stdarg, valist, nextarg)
1636
1637 /* Implement `va_arg'.  */
1638 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
1639   arc_va_arg (valist, type)