OSDN Git Service

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