OSDN Git Service

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