gbl-ctors.h: Lose HAVE_ATEXIT.
[gcc.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 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, \
608 plus_constant ((FRAME), \
609 UNITS_PER_WORD)))))
610 #endif
611
612 /* Register to use for pushing function arguments. */
613 #define STACK_POINTER_REGNUM 28
614
615 /* Base register for access to local variables of the function. */
616 #define FRAME_POINTER_REGNUM 27
617
618 /* Base register for access to arguments of the function. */
619 #define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM
620
621 /* Register in which static-chain is passed to a function. This must
622 not be a register used by the prologue. */
623 #define STATIC_CHAIN_REGNUM 24
624
625 /* A C expression which is nonzero if a function must have and use a
626 frame pointer. This expression is evaluated in the reload pass.
627 If its value is nonzero the function will have a frame pointer. */
628 #define FRAME_POINTER_REQUIRED \
629 (current_function_calls_alloca)
630
631 /* C statement to store the difference between the frame pointer
632 and the stack pointer values immediately after the function prologue. */
633 #define INITIAL_FRAME_POINTER_OFFSET(VAR) \
634 ((VAR) = arc_compute_frame_size (get_frame_size ()))
635 \f
636 /* Function argument passing. */
637
638 /* When a prototype says `char' or `short', really pass an `int'. */
639 #define PROMOTE_PROTOTYPES 1
640
641 /* If defined, the maximum amount of space required for outgoing
642 arguments will be computed and placed into the variable
643 `current_function_outgoing_args_size'. No space will be pushed
644 onto the stack for each call; instead, the function prologue should
645 increase the stack frame size by this amount. */
646 #define ACCUMULATE_OUTGOING_ARGS
647
648 /* Value is the number of bytes of arguments automatically
649 popped when returning from a subroutine call.
650 FUNDECL is the declaration node of the function (as a tree),
651 FUNTYPE is the data type of the function (as a tree),
652 or for a library call it is an identifier node for the subroutine name.
653 SIZE is the number of bytes of arguments passed on the stack. */
654 #define RETURN_POPS_ARGS(DECL, FUNTYPE, SIZE) 0
655
656 /* Define a data type for recording info about an argument list
657 during the scan of that argument list. This data type should
658 hold all necessary information about the function itself
659 and about the args processed so far, enough to enable macros
660 such as FUNCTION_ARG to determine where the next arg should go. */
661 #define CUMULATIVE_ARGS int
662
663 /* Initialize a variable CUM of type CUMULATIVE_ARGS
664 for a call to a function whose data type is FNTYPE.
665 For a library call, FNTYPE is 0. */
666 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
667 ((CUM) = 0)
668
669 /* The number of registers used for parameter passing. Local to this file. */
670 #define MAX_ARC_PARM_REGS 8
671
672 /* 1 if N is a possible register number for function argument passing. */
673 #define FUNCTION_ARG_REGNO_P(N) \
674 ((unsigned) (N) < MAX_ARC_PARM_REGS)
675
676 /* The ROUND_ADVANCE* macros are local to this file. */
677 /* Round SIZE up to a word boundary. */
678 #define ROUND_ADVANCE(SIZE) \
679 (((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
680
681 /* Round arg MODE/TYPE up to the next word boundary. */
682 #define ROUND_ADVANCE_ARG(MODE, TYPE) \
683 ((MODE) == BLKmode \
684 ? ROUND_ADVANCE (int_size_in_bytes (TYPE)) \
685 : ROUND_ADVANCE (GET_MODE_SIZE (MODE)))
686
687 /* Round CUM up to the necessary point for argument MODE/TYPE. */
688 #define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) \
689 ((((MODE) == BLKmode ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) \
690 > BITS_PER_WORD) \
691 ? ((CUM) + 1 & ~1) \
692 : (CUM))
693
694 /* Return boolean indicating arg of type TYPE and mode MODE will be passed in
695 a reg. This includes arguments that have to be passed by reference as the
696 pointer to them is passed in a reg if one is available (and that is what
697 we're given).
698 When passing arguments NAMED is always 1. When receiving arguments NAMED
699 is 1 for each argument except the last in a stdarg/varargs function. In
700 a stdarg function we want to treat the last named arg as named. In a
701 varargs function we want to treat the last named arg (which is
702 `__builtin_va_alist') as unnamed.
703 This macro is only used in this file. */
704 #define PASS_IN_REG_P(CUM, MODE, TYPE, NAMED) \
705 ((!current_function_varargs || (NAMED)) \
706 && (CUM) < MAX_ARC_PARM_REGS \
707 && ((ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) \
708 + ROUND_ADVANCE_ARG ((MODE), (TYPE)) \
709 <= MAX_ARC_PARM_REGS)))
710
711 /* Determine where to put an argument to a function.
712 Value is zero to push the argument on the stack,
713 or a hard register in which to store the argument.
714
715 MODE is the argument's machine mode.
716 TYPE is the data type of the argument (as a tree).
717 This is null for libcalls where that information may
718 not be available.
719 CUM is a variable of type CUMULATIVE_ARGS which gives info about
720 the preceding args and about the function being called.
721 NAMED is nonzero if this argument is a named parameter
722 (otherwise it is an extra parameter matching an ellipsis). */
723 /* On the ARC the first MAX_ARC_PARM_REGS args are normally in registers
724 and the rest are pushed. */
725 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
726 (PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED)) \
727 ? gen_rtx_REG ((MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))) \
728 : 0)
729
730 /* A C expression for the number of words, at the beginning of an
731 argument, must be put in registers. The value must be zero for
732 arguments that are passed entirely in registers or that are entirely
733 pushed on the stack.
734
735 On some machines, certain arguments must be passed partially in
736 registers and partially in memory. On these machines, typically the
737 first @var{n} words of arguments are passed in registers, and the rest
738 on the stack. If a multi-word argument (a @code{double} or a
739 structure) crosses that boundary, its first few words must be passed
740 in registers and the rest must be pushed. This macro tells the
741 compiler when this occurs, and how many of the words should go in
742 registers. */
743 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
744
745 /* A C expression that indicates when an argument must be passed by
746 reference. If nonzero for an argument, a copy of that argument is
747 made in memory and a pointer to the argument is passed instead of
748 the argument itself. The pointer is passed in whatever way is
749 appropriate for passing a pointer to that type. */
750 /* All aggregates and arguments greater than 8 bytes are passed this way. */
751 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
752 (TYPE \
753 && (AGGREGATE_TYPE_P (TYPE) \
754 || int_size_in_bytes (TYPE) > 8))
755
756 /* A C expression that indicates when it is the called function's
757 responsibility to make copies of arguments passed by reference.
758 If the callee can determine that the argument won't be modified, it can
759 avoid the copy. */
760 /* ??? We'd love to be able to use NAMED here. Unfortunately, it doesn't
761 include the last named argument so we keep track of the args ourselves. */
762
763 #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
764 FUNCTION_ARG_PASS_BY_REFERENCE ((CUM), (MODE), (TYPE), (NAMED))
765
766 /* Update the data in CUM to advance over an argument
767 of mode MODE and data type TYPE.
768 (TYPE is null for libcalls where that information may not be available.) */
769 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
770 ((CUM) = (ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) \
771 + ROUND_ADVANCE_ARG ((MODE), (TYPE))))
772
773 /* If defined, a C expression that gives the alignment boundary, in bits,
774 of an argument with the specified mode and type. If it is not defined,
775 PARM_BOUNDARY is used for all arguments. */
776 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
777 (((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) <= PARM_BOUNDARY \
778 ? PARM_BOUNDARY \
779 : 2 * PARM_BOUNDARY)
780
781 /* This macro offers an alternative
782 to using `__builtin_saveregs' and defining the macro
783 `EXPAND_BUILTIN_SAVEREGS'. Use it to store the anonymous register
784 arguments into the stack so that all the arguments appear to have
785 been passed consecutively on the stack. Once this is done, you
786 can use the standard implementation of varargs that works for
787 machines that pass all their arguments on the stack.
788
789 The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure,
790 containing the values that obtain after processing of the named
791 arguments. The arguments MODE and TYPE describe the last named
792 argument--its machine mode and its data type as a tree node.
793
794 The macro implementation should do two things: first, push onto the
795 stack all the argument registers *not* used for the named
796 arguments, and second, store the size of the data thus pushed into
797 the `int'-valued variable whose name is supplied as the argument
798 PRETEND_SIZE. The value that you store here will serve as
799 additional offset for setting up the stack frame.
800
801 If the argument NO_RTL is nonzero, it means that the
802 arguments of the function are being analyzed for the second time.
803 This happens for an inline function, which is not actually
804 compiled until the end of the source file. The macro
805 `SETUP_INCOMING_VARARGS' should not generate any instructions in
806 this case. */
807
808 #define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_SIZE, NO_RTL) \
809 arc_setup_incoming_varargs(&ARGS_SO_FAR, MODE, TYPE, &PRETEND_SIZE, NO_RTL)
810 \f
811 /* Function results. */
812
813 /* Define how to find the value returned by a function.
814 VALTYPE is the data type of the value (as a tree).
815 If the precise function being called is known, FUNC is its FUNCTION_DECL;
816 otherwise, FUNC is 0. */
817 #define FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG (TYPE_MODE (VALTYPE), 0)
818
819 /* Define how to find the value returned by a library function
820 assuming the value has mode MODE. */
821 #define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, 0)
822
823 /* 1 if N is a possible register number for a function value
824 as seen by the caller. */
825 /* ??? What about r1 in DI/DF values. */
826 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
827
828 /* A C expression which can inhibit the returning of certain function
829 values in registers, based on the type of value. A nonzero value says
830 to return the function value in memory, just as large structures are
831 always returned. Here TYPE will be a C expression of type `tree',
832 representing the data type of the value. */
833 #define RETURN_IN_MEMORY(TYPE) \
834 (AGGREGATE_TYPE_P (TYPE) \
835 || int_size_in_bytes (TYPE) > 8 \
836 || TREE_ADDRESSABLE (TYPE))
837
838 /* Tell GCC to use RETURN_IN_MEMORY. */
839 #define DEFAULT_PCC_STRUCT_RETURN 0
840
841 /* Register in which address to store a structure value
842 is passed to a function, or 0 to use `invisible' first argument. */
843 #define STRUCT_VALUE 0
844 \f
845 /* Function entry and exit. */
846
847 /* This macro generates the assembly code for function entry.
848 FILE is a stdio stream to output the code to.
849 SIZE is an int: how many units of temporary storage to allocate.
850 Refer to the array `regs_ever_live' to determine which registers
851 to save; `regs_ever_live[I]' is nonzero if register number I
852 is ever used in the function. This macro is responsible for
853 knowing which registers should not be saved even if used. */
854 #define FUNCTION_PROLOGUE(FILE, SIZE) \
855 arc_output_function_prologue (FILE, SIZE)
856
857 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
858 the stack pointer does not matter. The value is tested only in
859 functions that have frame pointers.
860 No definition is equivalent to always zero. */
861 #define EXIT_IGNORE_STACK 0
862
863 /* This macro generates the assembly code for function exit,
864 on machines that need it. If FUNCTION_EPILOGUE is not defined
865 then individual return instructions are generated for each
866 return statement. Args are same as for FUNCTION_PROLOGUE.
867
868 The function epilogue should not depend on the current stack pointer!
869 It should use the frame pointer only. This is mandatory because
870 of alloca; we also take advantage of it to omit stack adjustments
871 before returning. */
872 #define FUNCTION_EPILOGUE(FILE, SIZE) \
873 arc_output_function_epilogue (FILE, SIZE)
874
875 /* Epilogue delay slots. */
876 #define DELAY_SLOTS_FOR_EPILOGUE arc_delay_slots_for_epilogue ()
877
878 #define ELIGIBLE_FOR_EPILOGUE_DELAY(TRIAL, SLOTS_FILLED) \
879 arc_eligible_for_epilogue_delay (TRIAL, SLOTS_FILLED)
880
881 /* Output assembler code to FILE to increment profiler label # LABELNO
882 for profiling a function entry. */
883 #define FUNCTION_PROFILER(FILE, LABELNO)
884 \f
885 /* Trampolines. */
886 /* ??? This doesn't work yet because GCC will use as the address of a nested
887 function the address of the trampoline. We need to use that address
888 right shifted by 2. It looks like we'll need PSImode after all. :-( */
889
890 /* Output assembler code for a block containing the constant parts
891 of a trampoline, leaving space for the variable parts. */
892 /* On the ARC, the trampoline is quite simple as we have 32 bit immediate
893 constants.
894
895 mov r24,STATIC
896 j.nd FUNCTION
897 */
898 #define TRAMPOLINE_TEMPLATE(FILE) \
899 do { \
900 ASM_OUTPUT_INT (FILE, GEN_INT (0x631f7c00)); \
901 ASM_OUTPUT_INT (FILE, const0_rtx); \
902 ASM_OUTPUT_INT (FILE, GEN_INT (0x381f0000)); \
903 ASM_OUTPUT_INT (FILE, const0_rtx); \
904 } while (0)
905
906 /* Length in units of the trampoline for entering a nested function. */
907 #define TRAMPOLINE_SIZE 16
908
909 /* Emit RTL insns to initialize the variable parts of a trampoline.
910 FNADDR is an RTX for the address of the function's pure code.
911 CXT is an RTX for the static chain value for the function. */
912 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
913 do { \
914 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 4)), CXT); \
915 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 12)), FNADDR); \
916 emit_insn (gen_flush_icache (validize_mem (gen_rtx_MEM (SImode, TRAMP)))); \
917 } while (0)
918 \f
919 /* Library calls. */
920
921 /* Generate calls to memcpy, memcmp and memset. */
922 #define TARGET_MEM_FUNCTIONS
923 \f
924 /* Addressing modes, and classification of registers for them. */
925
926 /* Maximum number of registers that can appear in a valid memory address. */
927 /* The `ld' insn allows 2, but the `st' insn only allows 1. */
928 #define MAX_REGS_PER_ADDRESS 1
929
930 /* We have pre inc/dec (load/store with update). */
931 #define HAVE_PRE_INCREMENT 1
932 #define HAVE_PRE_DECREMENT 1
933
934 /* Recognize any constant value that is a valid address. */
935 #define CONSTANT_ADDRESS_P(X) \
936 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
937 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST)
938
939 /* Nonzero if the constant value X is a legitimate general operand.
940 We can handle any 32 or 64 bit constant. */
941 /* "1" should work since the largest constant should be a 64 bit critter. */
942 /* ??? Not sure what to do for 64x32 compiler. */
943 #define LEGITIMATE_CONSTANT_P(X) 1
944
945 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
946 and check its validity for a certain class.
947 We have two alternate definitions for each of them.
948 The usual definition accepts all pseudo regs; the other rejects
949 them unless they have been allocated suitable hard regs.
950 The symbol REG_OK_STRICT causes the latter definition to be used.
951
952 Most source files want to accept pseudo regs in the hope that
953 they will get allocated to the class that the insn wants them to be in.
954 Source files for reload pass need to be strict.
955 After reload, it makes no difference, since pseudo regs have
956 been eliminated by then. */
957
958 #ifndef REG_OK_STRICT
959
960 /* Nonzero if X is a hard reg that can be used as an index
961 or if it is a pseudo reg. */
962 #define REG_OK_FOR_INDEX_P(X) \
963 ((unsigned) REGNO (X) - 29 >= FIRST_PSEUDO_REGISTER - 29)
964 /* Nonzero if X is a hard reg that can be used as a base reg
965 or if it is a pseudo reg. */
966 #define REG_OK_FOR_BASE_P(X) \
967 ((unsigned) REGNO (X) - 29 >= FIRST_PSEUDO_REGISTER - 29)
968
969 #else
970
971 /* Nonzero if X is a hard reg that can be used as an index. */
972 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
973 /* Nonzero if X is a hard reg that can be used as a base reg. */
974 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
975
976 #endif
977
978 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
979 that is a valid memory address for an instruction.
980 The MODE argument is the machine mode for the MEM expression
981 that wants to use this address. */
982 /* The `ld' insn allows [reg],[reg+shimm],[reg+limm],[reg+reg],[limm]
983 but the `st' insn only allows [reg],[reg+shimm],[limm].
984 The only thing we can do is only allow the most strict case `st' and hope
985 other parts optimize out the restrictions for `ld'. */
986
987 /* local to this file */
988 #define RTX_OK_FOR_BASE_P(X) \
989 (REG_P (X) && REG_OK_FOR_BASE_P (X))
990
991 /* local to this file */
992 #define RTX_OK_FOR_INDEX_P(X) \
993 (0 && /*???*/ REG_P (X) && REG_OK_FOR_INDEX_P (X))
994
995 /* local to this file */
996 /* ??? Loads can handle any constant, stores can only handle small ones. */
997 #define RTX_OK_FOR_OFFSET_P(X) \
998 (GET_CODE (X) == CONST_INT && SMALL_INT (INTVAL (X)))
999
1000 #define LEGITIMATE_OFFSET_ADDRESS_P(MODE, X) \
1001 (GET_CODE (X) == PLUS \
1002 && RTX_OK_FOR_BASE_P (XEXP (X, 0)) \
1003 && (RTX_OK_FOR_INDEX_P (XEXP (X, 1)) \
1004 || RTX_OK_FOR_OFFSET_P (XEXP (X, 1))))
1005
1006 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1007 { if (RTX_OK_FOR_BASE_P (X)) \
1008 goto ADDR; \
1009 if (LEGITIMATE_OFFSET_ADDRESS_P ((MODE), (X))) \
1010 goto ADDR; \
1011 if (GET_CODE (X) == CONST_INT && LARGE_INT (INTVAL (X))) \
1012 goto ADDR; \
1013 if (GET_CODE (X) == SYMBOL_REF \
1014 || GET_CODE (X) == LABEL_REF \
1015 || GET_CODE (X) == CONST) \
1016 goto ADDR; \
1017 if ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == PRE_INC) \
1018 /* We're restricted here by the `st' insn. */ \
1019 && RTX_OK_FOR_BASE_P (XEXP ((X), 0))) \
1020 goto ADDR; \
1021 }
1022
1023 /* Try machine-dependent ways of modifying an illegitimate address
1024 to be legitimate. If we find one, return the new, valid address.
1025 This macro is used in only one place: `memory_address' in explow.c.
1026
1027 OLDX is the address as it was before break_out_memory_refs was called.
1028 In some cases it is useful to look at this to decide what needs to be done.
1029
1030 MODE and WIN are passed so that this macro can use
1031 GO_IF_LEGITIMATE_ADDRESS.
1032
1033 It is always safe for this macro to do nothing. It exists to recognize
1034 opportunities to optimize the output. */
1035
1036 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)
1037
1038 /* Go to LABEL if ADDR (a legitimate address expression)
1039 has an effect that depends on the machine mode it is used for. */
1040 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
1041 { if (GET_CODE (ADDR) == PRE_DEC) \
1042 goto LABEL; \
1043 if (GET_CODE (ADDR) == PRE_INC) \
1044 goto LABEL; \
1045 }
1046 \f
1047 /* Condition code usage. */
1048
1049 /* Some insns set all condition code flags, some only set the ZNC flags, and
1050 some only set the ZN flags. */
1051
1052 #define EXTRA_CC_MODES \
1053 CC(CCZNCmode, "CCZNC") \
1054 CC(CCZNmode, "CCZN")
1055
1056 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
1057 return the mode to be used for the comparison. */
1058 extern enum machine_mode arc_select_cc_mode ();
1059 #define SELECT_CC_MODE(OP, X, Y) \
1060 arc_select_cc_mode (OP, X, Y)
1061
1062 /* Return non-zero if SELECT_CC_MODE will never return MODE for a
1063 floating point inequality comparison. */
1064 #define REVERSIBLE_CC_MODE(MODE) 1 /*???*/
1065 \f
1066 /* Costs. */
1067
1068 /* An insn is define to cost 4 "units", and we work from there.
1069 COSTS_N_INSNS (N) is defined as (N) * 4 - 2 so that seems reasonable.
1070 Some values are supposed to be defined relative to each other and thus
1071 aren't necessarily related to COSTS_N_INSNS. */
1072
1073 /* Compute the cost of computing a constant rtl expression RTX
1074 whose rtx-code is CODE. The body of this macro is a portion
1075 of a switch statement. If the code is computed here,
1076 return it with a return statement. Otherwise, break from the switch. */
1077 /* Small integers are as cheap as registers. 4 byte values can be fetched
1078 as immediate constants - let's give that the cost of an extra insn. */
1079 #define CONST_COSTS(X, CODE, OUTER_CODE) \
1080 case CONST_INT : \
1081 if (SMALL_INT (INTVAL (X))) \
1082 return 0; \
1083 /* fall through */ \
1084 case CONST : \
1085 case LABEL_REF : \
1086 case SYMBOL_REF : \
1087 return 4; \
1088 case CONST_DOUBLE : \
1089 { \
1090 rtx high, low; \
1091 split_double (X, &high, &low); \
1092 return 4 * (!SMALL_INT (INTVAL (high)) \
1093 + !SMALL_INT (INTVAL (low))); \
1094 }
1095
1096 /* Compute the cost of an address. */
1097 #define ADDRESS_COST(ADDR) (REG_P (ADDR) ? 1 : arc_address_cost (ADDR))
1098
1099 /* Compute extra cost of moving data between one register class
1100 and another. */
1101 #define REGISTER_MOVE_COST(CLASS1, CLASS2) 2
1102
1103 /* Compute the cost of moving data between registers and memory. */
1104 /* Memory is 3 times as expensive as registers.
1105 ??? Is that the right way to look at it? */
1106 #define MEMORY_MOVE_COST(MODE,CLASS,IN) \
1107 (GET_MODE_SIZE (MODE) <= UNITS_PER_WORD ? 6 : 12)
1108
1109 /* The cost of a branch insn. */
1110 /* ??? What's the right value here? Branches are certainly more
1111 expensive than reg->reg moves. */
1112 #define BRANCH_COST 2
1113
1114 /* Provide the costs of a rtl expression. This is in the body of a
1115 switch on CODE. The purpose for the cost of MULT is to encourage
1116 `synth_mult' to find a synthetic multiply when reasonable.
1117
1118 If we need more than 12 insns to do a multiply, then go out-of-line,
1119 since the call overhead will be < 10% of the cost of the multiply. */
1120 #define RTX_COSTS(X, CODE, OUTER_CODE) \
1121 case ASHIFT : \
1122 case ASHIFTRT : \
1123 case LSHIFTRT : \
1124 if (TARGET_SHIFTER) \
1125 return COSTS_N_INSNS (1); \
1126 if (GET_CODE (XEXP ((X), 1)) != CONST_INT) \
1127 return COSTS_N_INSNS (16); \
1128 return COSTS_N_INSNS (INTVAL (XEXP ((X), 1)));
1129
1130 /* Nonzero if access to memory by bytes is slow and undesirable.
1131 For RISC chips, it means that access to memory by bytes is no
1132 better than access by words when possible, so grab a whole word
1133 and maybe make use of that. */
1134 #define SLOW_BYTE_ACCESS 1
1135
1136 /* Define this macro if it is as good or better to call a constant
1137 function address than to call an address kept in a register. */
1138 /* On the ARC, calling through registers is slow. */
1139 #define NO_FUNCTION_CSE
1140
1141 /* Define this macro if it is as good or better for a function to call
1142 itself with an explicit address than to call an address kept in a
1143 register. */
1144 /* On the ARC, calling through registers is slow. */
1145 #define NO_RECURSIVE_FUNCTION_CSE
1146 \f
1147 /* Section selection. */
1148 /* WARNING: These section names also appear in dwarfout.c. */
1149
1150 /* The names of the text, data, and readonly-data sections are runtime
1151 selectable. */
1152
1153 #define ARC_SECTION_FORMAT "\t.section %s"
1154 #define ARC_DEFAULT_TEXT_SECTION ".text"
1155 #define ARC_DEFAULT_DATA_SECTION ".data"
1156 #define ARC_DEFAULT_RODATA_SECTION ".rodata"
1157
1158 extern char *arc_text_section,*arc_data_section,*arc_rodata_section;
1159
1160 /* initfini.c uses this in an asm. */
1161 #if defined (CRT_INIT) || defined (CRT_FINI)
1162 #define TEXT_SECTION_ASM_OP "\t.section .text"
1163 #else
1164 #define TEXT_SECTION_ASM_OP arc_text_section /*"\t.section .text"*/
1165 #endif
1166 #define DATA_SECTION_ASM_OP arc_data_section /*"\t.section .data"*/
1167
1168 #undef CONST_SECTION_ASM_OP
1169 #define CONST_SECTION_ASM_OP arc_rodata_section /*"\t.section .rodata"*/
1170
1171 #define BSS_SECTION_ASM_OP "\t.section .bss"
1172
1173 /* Define this macro if jump tables (for tablejump insns) should be
1174 output in the text section, along with the assembler instructions.
1175 Otherwise, the readonly data section is used.
1176 This macro is irrelevant if there is no separate readonly data section. */
1177 /*#define JUMP_TABLES_IN_TEXT_SECTION*/
1178
1179 /* Define this macro if references to a symbol must be treated
1180 differently depending on something about the variable or
1181 function named by the symbol (such as what section it is in).
1182
1183 The macro definition, if any, is executed immediately after the
1184 rtl for DECL or other node is created.
1185 The value of the rtl will be a `mem' whose address is a
1186 `symbol_ref'.
1187
1188 The usual thing for this macro to do is to store a flag in the
1189 `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
1190 name string in the `symbol_ref' (if one bit is not enough
1191 information). */
1192
1193 /* On the ARC, function addresses are not the same as normal addresses.
1194 Branch to absolute address insns take an address that is right-shifted
1195 by 2. We encode the fact that we have a function here, and then emit a
1196 special assembler op when outputting the address. */
1197 #define ENCODE_SECTION_INFO(DECL) \
1198 do { \
1199 if (TREE_CODE (DECL) == FUNCTION_DECL) \
1200 SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
1201 } while (0)
1202
1203 /* Decode SYM_NAME and store the real name part in VAR, sans
1204 the characters that encode section info. Define this macro if
1205 ENCODE_SECTION_INFO alters the symbol's name string. */
1206 /*#define STRIP_NAME_ENCODING(VAR, SYM_NAME)*/
1207
1208 /* For DWARF. Marginally different than default so output is "prettier"
1209 (and consistent with above). */
1210 #define PUSHSECTION_FORMAT "\t%s %s\n"
1211
1212 /* Tell crtstuff.c we're using ELF. */
1213 #define OBJECT_FORMAT_ELF
1214 \f
1215 /* PIC */
1216
1217 /* The register number of the register used to address a table of static
1218 data addresses in memory. In some cases this register is defined by a
1219 processor's ``application binary interface'' (ABI). When this macro
1220 is defined, RTL is generated for this register once, as with the stack
1221 pointer and frame pointer registers. If this macro is not defined, it
1222 is up to the machine-dependent files to allocate such a register (if
1223 necessary). */
1224 #define PIC_OFFSET_TABLE_REGNUM 26
1225
1226 /* Define this macro if the register defined by PIC_OFFSET_TABLE_REGNUM is
1227 clobbered by calls. Do not define this macro if PIC_OFFSET_TABLE_REGNUM
1228 is not defined. */
1229 /* This register is call-saved on the ARC. */
1230 /*#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED*/
1231
1232 /* By generating position-independent code, when two different programs (A
1233 and B) share a common library (libC.a), the text of the library can be
1234 shared whether or not the library is linked at the same address for both
1235 programs. In some of these environments, position-independent code
1236 requires not only the use of different addressing modes, but also
1237 special code to enable the use of these addressing modes.
1238
1239 The FINALIZE_PIC macro serves as a hook to emit these special
1240 codes once the function is being compiled into assembly code, but not
1241 before. (It is not done before, because in the case of compiling an
1242 inline function, it would lead to multiple PIC prologues being
1243 included in functions which used inline functions and were compiled to
1244 assembly language.) */
1245
1246 #define FINALIZE_PIC arc_finalize_pic ()
1247
1248 /* A C expression that is nonzero if X is a legitimate immediate
1249 operand on the target machine when generating position independent code.
1250 You can assume that X satisfies CONSTANT_P, so you need not
1251 check this. You can also assume `flag_pic' is true, so you need not
1252 check it either. You need not define this macro if all constants
1253 (including SYMBOL_REF) can be immediate operands when generating
1254 position independent code. */
1255 /*#define LEGITIMATE_PIC_OPERAND_P(X)*/
1256 \f
1257 /* Control the assembler format that we output. */
1258
1259 /* Output at beginning of assembler file. */
1260 extern void arc_asm_file_start ();
1261 #undef ASM_FILE_START
1262 #define ASM_FILE_START(FILE) arc_asm_file_start (FILE)
1263
1264 /* A C statement to output assembler commands which will identify the
1265 object file as having been compiled with GNU CC (or another GNU
1266 compiler). */
1267 #undef ASM_IDENTIFY_GCC
1268 #define ASM_IDENTIFY_GCC(FILE) /* nothing */
1269
1270 /* Needed because we define ASM_IDENTIFY_GCC. */
1271 #define ASM_IDENTIFY_LANGUAGE(FILE) output_lang_identify (FILE)
1272
1273 /* A C string constant describing how to begin a comment in the target
1274 assembler language. The compiler assumes that the comment will
1275 end at the end of the line. */
1276 #define ASM_COMMENT_START ";"
1277
1278 /* Output to assembler file text saying following lines
1279 may contain character constants, extra white space, comments, etc. */
1280 #define ASM_APP_ON ""
1281
1282 /* Output to assembler file text saying following lines
1283 no longer contain unusual constructs. */
1284 #define ASM_APP_OFF ""
1285
1286 /* This is how to output an assembler line defining a `char' constant. */
1287 #define ASM_OUTPUT_CHAR(FILE, VALUE) \
1288 ( fprintf (FILE, "\t.byte\t"), \
1289 output_addr_const (FILE, (VALUE)), \
1290 fprintf (FILE, "\n"))
1291
1292 /* This is how to output an assembler line defining a `short' constant. */
1293 #define ASM_OUTPUT_SHORT(FILE, VALUE) \
1294 ( fprintf (FILE, "\t.hword\t"), \
1295 output_addr_const (FILE, (VALUE)), \
1296 fprintf (FILE, "\n"))
1297
1298 /* This is how to output an assembler line defining an `int' constant.
1299 We also handle symbol output here. Code addresses must be right shifted
1300 by 2 because that's how the jump instruction wants them. */
1301 #define ASM_OUTPUT_INT(FILE, VALUE) \
1302 do { \
1303 fprintf (FILE, "\t.word\t"); \
1304 if ((GET_CODE (VALUE) == SYMBOL_REF && SYMBOL_REF_FLAG (VALUE)) \
1305 || GET_CODE (VALUE) == LABEL_REF) \
1306 { \
1307 fprintf (FILE, "%%st("); \
1308 output_addr_const (FILE, (VALUE)); \
1309 fprintf (FILE, ")"); \
1310 } \
1311 else \
1312 output_addr_const (FILE, (VALUE)); \
1313 fprintf (FILE, "\n"); \
1314 } while (0)
1315
1316 /* This is how to output an assembler line defining a `float' constant. */
1317 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
1318 { \
1319 long t; \
1320 char str[30]; \
1321 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
1322 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
1323 fprintf (FILE, "\t.word\t0x%lx %s %s\n", \
1324 t, ASM_COMMENT_START, str); \
1325 }
1326
1327 /* This is how to output an assembler line defining a `double' constant. */
1328 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
1329 { \
1330 long t[2]; \
1331 char str[30]; \
1332 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
1333 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
1334 fprintf (FILE, "\t.word\t0x%lx %s %s\n\t.word\t0x%lx\n", \
1335 t[0], ASM_COMMENT_START, str, t[1]); \
1336 }
1337
1338 /* This is how to output an assembler line for a numeric constant byte. */
1339 #define ASM_BYTE_OP ".byte"
1340 #define ASM_OUTPUT_BYTE(FILE, VALUE) \
1341 fprintf (FILE, "\t%s\t0x%x\n", ASM_BYTE_OP, (VALUE))
1342
1343 /* The assembler's parentheses characters. */
1344 #define ASM_OPEN_PAREN "("
1345 #define ASM_CLOSE_PAREN ")"
1346
1347 /* This is how to output the definition of a user-level label named NAME,
1348 such as the label on a static function or variable NAME. */
1349 #define ASM_OUTPUT_LABEL(FILE, NAME) \
1350 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1351
1352 /* This is how to output a command to make the user-level label named NAME
1353 defined for reference from other files. */
1354 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \
1355 do { \
1356 fputs ("\t.global\t", FILE); \
1357 assemble_name (FILE, NAME); \
1358 fputs ("\n", FILE); \
1359 } while (0)
1360
1361 /* A C statement (sans semicolon) to output on FILE an assembler pseudo-op to
1362 declare a library function name external. The name of the library function
1363 is given by SYMREF, which has type RTX and is a SYMBOL_REF. */
1364 #if 0
1365 /* On the ARC we want to have libgcc's for multiple cpus in one binary.
1366 We can't use `assemble_name' here as that will call ASM_OUTPUT_LABELREF
1367 and we'll get another suffix added on if -mmangle-cpu. */
1368 extern char *arc_mangle_cpu;
1369 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, SYMREF) \
1370 do { \
1371 if (TARGET_MANGLE_CPU_LIBGCC) \
1372 { \
1373 fprintf (FILE, "\t.rename\t_%s, _%s%s\n", \
1374 XSTR (SYMREF, 0), XSTR (SYMREF, 0), \
1375 arc_mangle_suffix); \
1376 } \
1377 } while (0)
1378 #endif
1379
1380 /* This is how to output a reference to a user-level label named NAME.
1381 `assemble_name' uses this. */
1382 /* We mangle all user labels to provide protection from linking code
1383 compiled for different cpus. */
1384 /* We work around a dwarfout.c deficiency by watching for labels from it and
1385 not adding the '_' prefix nor the cpu suffix. There is a comment in
1386 dwarfout.c that says it should be using ASM_OUTPUT_INTERNAL_LABEL. */
1387 extern char *arc_mangle_cpu;
1388 #define ASM_OUTPUT_LABELREF(FILE, NAME) \
1389 do { \
1390 if ((NAME)[0] == '.' && (NAME)[1] == 'L') \
1391 fprintf (FILE, "%s", NAME); \
1392 else \
1393 { \
1394 fputc ('_', FILE); \
1395 if (TARGET_MANGLE_CPU && arc_mangle_cpu != NULL) \
1396 fprintf (FILE, "%s_", arc_mangle_cpu); \
1397 fprintf (FILE, "%s", NAME); \
1398 } \
1399 } while (0)
1400
1401 /* This is how to output a definition of an internal numbered label where
1402 PREFIX is the class of label and NUM is the number within the class. */
1403 #undef ASM_OUTPUT_INTERNAL_LABEL
1404 #define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \
1405 do { \
1406 arc_ccfsm_at_label (PREFIX, NUM); \
1407 fprintf (FILE, ".%s%d:\n", PREFIX, NUM); \
1408 } while (0)
1409
1410 /* Store in OUTPUT a string (made with alloca) containing
1411 an assembler-name for a local static variable named NAME.
1412 LABELNO is an integer which is different for each call. */
1413 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1414 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1415 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1416
1417 /* Assembler pseudo-op to equate one value with another. */
1418 /* ??? This is needed because dwarfout.c provides a default definition too
1419 late for defaults.h (which contains the default definition of ASM_OUTPUT_DEF
1420 that we use). */
1421 #define SET_ASM_OP ".set"
1422
1423 /* A C statement (sans semicolon) to output an element in the table of
1424 global constructors. */
1425 #undef ASM_OUTPUT_CONSTRUCTOR
1426 #define ASM_OUTPUT_CONSTRUCTOR(FILE, NAME) \
1427 do { \
1428 ctors_section (); \
1429 fprintf (FILE, "\t.word\t%%st("); \
1430 assemble_name (FILE, NAME); \
1431 fprintf (FILE, ")\n"); \
1432 } while (0)
1433
1434 /* A C statement (sans semicolon) to output an element in the table of
1435 global destructors. */
1436 #undef ASM_OUTPUT_DESTRUCTOR
1437 #define ASM_OUTPUT_DESTRUCTOR(FILE, NAME) \
1438 do { \
1439 dtors_section (); \
1440 fprintf (FILE, "\t.word\t%%st("); \
1441 assemble_name (FILE, NAME); \
1442 fprintf (FILE, ")\n"); \
1443 } while (0)
1444
1445 /* How to refer to registers in assembler output.
1446 This sequence is indexed by compiler's hard-register-number (see above). */
1447 #define REGISTER_NAMES \
1448 {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
1449 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
1450 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
1451 "r24", "r25", "r26", "fp", "sp", "ilink1", "ilink2", "blink", \
1452 "r32", "r33", "r34", "r35", "r36", "r37", "r38", "r39", \
1453 "r40", "r41", "r42", "r43", "r44", "r45", "r46", "r47", \
1454 "r48", "r49", "r50", "r51", "r52", "r53", "r54", "r55", \
1455 "r56", "r57", "r58", "r59", "lp_count", "cc"}
1456
1457 /* Entry to the insn conditionalizer. */
1458 #define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
1459 arc_final_prescan_insn (INSN, OPVEC, NOPERANDS)
1460
1461 /* A C expression which evaluates to true if CODE is a valid
1462 punctuation character for use in the `PRINT_OPERAND' macro. */
1463 extern char arc_punct_chars[];
1464 #define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
1465 arc_punct_chars[(unsigned char) (CHAR)]
1466
1467 /* Print operand X (an rtx) in assembler syntax to file FILE.
1468 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1469 For `%' followed by punctuation, CODE is the punctuation and X is null. */
1470 #define PRINT_OPERAND(FILE, X, CODE) \
1471 arc_print_operand (FILE, X, CODE)
1472
1473 /* A C compound statement to output to stdio stream STREAM the
1474 assembler syntax for an instruction operand that is a memory
1475 reference whose address is ADDR. ADDR is an RTL expression.
1476
1477 On some machines, the syntax for a symbolic address depends on
1478 the section that the address refers to. On these machines,
1479 define the macro `ENCODE_SECTION_INFO' to store the information
1480 into the `symbol_ref', and then check for it here. */
1481 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1482 arc_print_operand_address (FILE, ADDR)
1483
1484 /* This is how to output an element of a case-vector that is absolute. */
1485 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1486 do { \
1487 char label[30]; \
1488 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
1489 fprintf (FILE, "\t.word %%st("); \
1490 assemble_name (FILE, label); \
1491 fprintf (FILE, ")\n"); \
1492 } while (0)
1493
1494 /* This is how to output an element of a case-vector that is relative. */
1495 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1496 do { \
1497 char label[30]; \
1498 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
1499 fprintf (FILE, "\t.word %%st("); \
1500 assemble_name (FILE, label); \
1501 fprintf (FILE, "-"); \
1502 ASM_GENERATE_INTERNAL_LABEL (label, "L", REL); \
1503 assemble_name (FILE, label); \
1504 fprintf (FILE, ")\n"); \
1505 } while (0)
1506
1507 /* The desired alignment for the location counter at the beginning
1508 of a loop. */
1509 /* On the ARC, align loops to 32 byte boundaries (cache line size)
1510 if -malign-loops. */
1511 #define LOOP_ALIGN(LABEL) (TARGET_ALIGN_LOOPS ? 5 : 0)
1512
1513 /* This is how to output an assembler line
1514 that says to advance the location counter
1515 to a multiple of 2**LOG bytes. */
1516 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1517 do { if ((LOG) != 0) fprintf (FILE, "\t.align %d\n", 1 << (LOG)); } while (0)
1518 \f
1519 /* Debugging information. */
1520
1521 /* Generate DBX and DWARF debugging information. */
1522 #define DBX_DEBUGGING_INFO
1523 #define DWARF_DEBUGGING_INFO
1524
1525 /* Prefer STABS (for now). */
1526 #undef PREFERRED_DEBUGGING_TYPE
1527 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
1528
1529 /* How to renumber registers for dbx and gdb. */
1530 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
1531
1532 /* Turn off splitting of long stabs. */
1533 #define DBX_CONTIN_LENGTH 0
1534 \f
1535 /* Miscellaneous. */
1536
1537 /* Specify the machine mode that this machine uses
1538 for the index in the tablejump instruction. */
1539 #define CASE_VECTOR_MODE Pmode
1540
1541 /* Define as C expression which evaluates to nonzero if the tablejump
1542 instruction expects the table to contain offsets from the address of the
1543 table.
1544 Do not define this if the table should contain absolute addresses. */
1545 /* It's not clear what PIC will look like or whether we want to use -fpic
1546 for the embedded form currently being talked about. For now require -fpic
1547 to get pc relative switch tables. */
1548 /*#define CASE_VECTOR_PC_RELATIVE 1 */
1549
1550 /* Define if operations between registers always perform the operation
1551 on the full register even if a narrower mode is specified. */
1552 #define WORD_REGISTER_OPERATIONS
1553
1554 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
1555 will either zero-extend or sign-extend. The value of this macro should
1556 be the code that says which one of the two operations is implicitly
1557 done, NIL if none. */
1558 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
1559
1560 /* Specify the tree operation to be used to convert reals to integers. */
1561 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1562
1563 /* This is the kind of divide that is easiest to do in the general case. */
1564 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1565
1566 /* Max number of bytes we can move from memory to memory
1567 in one reasonably fast instruction. */
1568 #define MOVE_MAX 4
1569
1570 /* Define this to be nonzero if shift instructions ignore all but the low-order
1571 few bits. */
1572 #define SHIFT_COUNT_TRUNCATED 1
1573
1574 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1575 is done just by pretending it is already truncated. */
1576 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1577
1578 /* We assume that the store-condition-codes instructions store 0 for false
1579 and some other value for true. This is the value stored for true. */
1580 #define STORE_FLAG_VALUE 1
1581
1582 /* Specify the machine mode that pointers have.
1583 After generation of rtl, the compiler makes no further distinction
1584 between pointers and any other objects of this machine mode. */
1585 /* ??? The arc doesn't have full 32 bit pointers, but making this PSImode has
1586 its own problems (you have to add extendpsisi2 and trucnsipsi2 but how does
1587 one do it without getting excess code?). Try to avoid it. */
1588 #define Pmode SImode
1589
1590 /* A function address in a call instruction. */
1591 #define FUNCTION_MODE SImode
1592
1593 /* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
1594 is a valid machine specific attribute for DECL.
1595 The attributes in ATTRIBUTES have previously been assigned to TYPE. */
1596 extern int arc_valid_machine_attribute ();
1597 #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
1598 arc_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
1599
1600 /* A C expression that returns zero if the attributes on TYPE1 and TYPE2 are
1601 incompatible, one if they are compatible, and two if they are
1602 nearly compatible (which causes a warning to be generated). */
1603 extern int arc_comp_type_attributes ();
1604 #define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
1605 arc_comp_type_attributes (TYPE1, TYPE2)
1606
1607 /* Give newly defined TYPE some default attributes. */
1608 extern void arc_set_default_type_attributes ();
1609 #define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
1610 arc_set_default_type_attributes (TYPE)
1611
1612 /* alloca should avoid clobbering the old register save area. */
1613 /* ??? Not defined in tm.texi. */
1614 #define SETJMP_VIA_SAVE_AREA
1615 \f
1616 /* Define the information needed to generate branch and scc insns. This is
1617 stored from the compare operation. Note that we can't use "rtx" here
1618 since it hasn't been defined! */
1619 extern struct rtx_def *arc_compare_op0, *arc_compare_op1;
1620
1621 /* Define the function that build the compare insn for scc and bcc. */
1622 extern struct rtx_def *gen_compare_reg ();
1623
1624 /* Declarations for various fns used in the .md file. */
1625 extern char *output_shift ();
1626
1627 /* ARC function types. */
1628 enum arc_function_type {
1629 ARC_FUNCTION_UNKNOWN, ARC_FUNCTION_NORMAL,
1630 /* These are interrupt handlers. The name corresponds to the register
1631 name that contains the return address. */
1632 ARC_FUNCTION_ILINK1, ARC_FUNCTION_ILINK2
1633 };
1634 #define ARC_INTERRUPT_P(TYPE) \
1635 ((TYPE) == ARC_FUNCTION_ILINK1 || (TYPE) == ARC_FUNCTION_ILINK2)
1636 /* Compute the type of a function from its DECL. */
1637 enum arc_function_type arc_compute_function_type ();
1638
1639 \f
1640 /* Implement `va_start' for varargs and stdarg. */
1641 #define EXPAND_BUILTIN_VA_START(stdarg, valist, nextarg) \
1642 arc_va_start (stdarg, valist, nextarg)
1643
1644 /* Implement `va_arg'. */
1645 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
1646 arc_va_arg (valist, type)