1 /* Definitions of target machine for GNU compiler, Synopsys DesignWare ARC cpu.
2 Copyright (C) 1994-2016 Free Software Foundation, Inc.
4 Sources derived from work done by Sankhya Technologies (www.sankhya.com) on
5 behalf of Synopsys Inc.
7 Position Independent Code support added,Code cleaned up,
8 Comments and Support For ARC700 instructions added by
9 Saurabh Verma (saurabh.verma@codito.com)
10 Ramana Radhakrishnan(ramana.radhakrishnan@codito.com)
12 This file is part of GCC.
14 GCC is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 3, or (at your option)
19 GCC is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with GCC; see the file COPYING3. If not see
26 <http://www.gnu.org/licenses/>. */
37 #define SYMBOL_FLAG_SHORT_CALL (SYMBOL_FLAG_MACH_DEP << 0)
38 #define SYMBOL_FLAG_MEDIUM_CALL (SYMBOL_FLAG_MACH_DEP << 1)
39 #define SYMBOL_FLAG_LONG_CALL (SYMBOL_FLAG_MACH_DEP << 2)
40 #define SYMBOL_FLAG_CMEM (SYMBOL_FLAG_MACH_DEP << 3)
42 /* Check if this symbol has a long_call attribute in its declaration */
43 #define SYMBOL_REF_LONG_CALL_P(X) \
44 ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_LONG_CALL) != 0)
46 /* Check if this symbol has a medium_call attribute in its declaration */
47 #define SYMBOL_REF_MEDIUM_CALL_P(X) \
48 ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_MEDIUM_CALL) != 0)
50 /* Check if this symbol has a short_call attribute in its declaration */
51 #define SYMBOL_REF_SHORT_CALL_P(X) \
52 ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_SHORT_CALL) != 0)
61 #undef WCHAR_TYPE_SIZE
66 /* Names to predefine in the preprocessor for this target machine. */
67 #define TARGET_CPU_CPP_BUILTINS() \
69 builtin_define ("__arc__"); \
72 builtin_define ("__A6__"); \
73 builtin_define ("__ARC600__"); \
75 else if (TARGET_ARC601) \
77 builtin_define ("__ARC601__"); \
79 else if (TARGET_ARC700) \
81 builtin_define ("__A7__"); \
82 builtin_define ("__ARC700__"); \
86 builtin_define ("__EM__"); \
90 builtin_define ("__HS__"); \
94 builtin_define ("__ARC_ATOMIC__"); \
98 builtin_define ("__ARC_NORM__");\
99 builtin_define ("__Xnorm"); \
103 builtin_define ("__ARC_LL64__");\
105 if (TARGET_MUL64_SET) \
106 builtin_define ("__ARC_MUL64__");\
107 if (TARGET_MULMAC_32BY16_SET) \
108 builtin_define ("__ARC_MUL32BY16__");\
109 if (TARGET_SIMD_SET) \
110 builtin_define ("__ARC_SIMD__"); \
111 if (TARGET_BARREL_SHIFTER) \
112 builtin_define ("__Xbarrel_shifter");\
113 builtin_define_with_int_value ("__ARC_TLS_REGNO__", \
115 builtin_assert ("cpu=arc"); \
116 builtin_assert ("machine=arc"); \
117 builtin_define (TARGET_BIG_ENDIAN \
118 ? "__BIG_ENDIAN__" : "__LITTLE_ENDIAN__"); \
119 if (TARGET_BIG_ENDIAN) \
120 builtin_define ("__big_endian__"); \
123 #if DEFAULT_LIBC == LIBC_UCLIBC
125 #define TARGET_OS_CPP_BUILTINS() \
128 GNU_USER_TARGET_OS_CPP_BUILTINS (); \
133 /* Match the macros used in the assembler. */
135 %{msimd:-D__Xsimd} %{mno-mpy:-D__Xno_mpy} %{mswap:-D__Xswap} \
136 %{mmin-max:-D__Xmin_max} %{mEA:-D__Xea} \
137 %{mspfp*:-D__Xspfp} %{mdpfp*:-D__Xdpfp} \
138 %{mmac-d16:-D__Xxmac_d16} %{mmac-24:-D__Xxmac_24} \
139 %{mdsp-packa:-D__Xdsp_packa} %{mcrc:-D__Xcrc} %{mdvbf:-D__Xdvbf} \
140 %{mtelephony:-D__Xtelephony} %{mxy:-D__Xxy} %{mmul64: -D__Xmult32} \
141 %{mlock:-D__Xlock} %{mswape:-D__Xswape} %{mrtsc:-D__Xrtsc} \
142 %{mcpu=NPS400:-D__NPS400__} \
143 %{mcpu=nps400:-D__NPS400__} \
147 %{EB:%{EL:%emay not use both -EB and -EL}} \
148 %{EB:-mbig-endian} %{EL:-mlittle-endian} \
151 #define ASM_DEFAULT "-mARC700 -mEA"
154 %{mbig-endian|EB:-EB} %{EL} \
155 %{mcpu=ARC600:-mARC600} \
156 %{mcpu=ARC601:-mARC601} \
157 %{mcpu=ARC700:-mARC700} \
158 %{mcpu=ARC700:-mEA} \
159 %{!mcpu=*:" ASM_DEFAULT "} \
160 %{mbarrel-shifter} %{mno-mpy} %{mmul64} %{mmul32x16:-mdsp-packa} %{mnorm} \
161 %{mswap} %{mEA} %{mmin-max} %{mspfp*} %{mdpfp*} %{mfpu=fpuda*:-mfpuda} \
163 %{mmac-d16} %{mmac-24} %{mdsp-packa} %{mcrc} %{mdvbf} %{mtelephony} %{mxy} \
164 %{mcpu=ARC700|!mcpu=*:%{mlock}} \
165 %{mcpu=ARC700|!mcpu=*:%{mswape}} \
166 %{mcpu=ARC700|!mcpu=*:%{mrtsc}} \
171 #if DEFAULT_LIBC == LIBC_UCLIBC
172 /* Note that the default is to link against dynamic libraries, if they are
173 available. Override with -static. */
174 #define LINK_SPEC "%{h*} \
176 %{symbolic:-Bsymbolic} \
177 %{rdynamic:-export-dynamic}\
178 -dynamic-linker /lib/ld-uClibc.so.0 \
179 -X %{mbig-endian:-EB} \
182 %{!marclinux*: %{pg|p|profile:-marclinux_prof;: -marclinux}} \
183 %{!z:-z max-page-size=0x2000 -z common-page-size=0x2000} \
185 /* Like the standard LINK_COMMAND_SPEC, but add %G when building
186 a shared library with -nostdlib, so that the hidden functions of libgcc
187 will be incorporated.
188 N.B., we don't want a plain -lgcc, as this would lead to re-exporting
189 non-hidden functions, so we have to consider libgcc_s.so.* first, which in
190 turn should be wrapped with --as-needed. */
191 #define LINK_COMMAND_SPEC "\
192 %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
193 %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
194 %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
195 %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
196 %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
197 %:include(libgomp.spec)%(link_gomp)}\
199 %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
200 %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
201 %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
204 #define LINK_SPEC "%{mbig-endian:-EB} %{EB} %{EL}\
205 %{pg|p:-marcelf_prof;mA7|mARC700|mcpu=arc700|mcpu=ARC700: -marcelf}"
208 #if DEFAULT_LIBC != LIBC_UCLIBC
209 #define ARC_TLS_EXTRA_START_SPEC "crttls.o%s"
211 #define EXTRA_SPECS \
212 { "arc_tls_extra_start_spec", ARC_TLS_EXTRA_START_SPEC }, \
214 #define STARTFILE_SPEC "%{!shared:crt0.o%s} crti%O%s %{pg|p:crtg.o%s} " \
215 "%(arc_tls_extra_start_spec) crtbegin.o%s"
217 #define STARTFILE_SPEC "%{!shared:%{!mkernel:crt1.o%s}} crti.o%s \
218 %{!shared:%{pg|p|profile:crtg.o%s} crtbegin.o%s} %{shared:crtbeginS.o%s}"
222 #if DEFAULT_LIBC != LIBC_UCLIBC
223 #define ENDFILE_SPEC "%{pg|p:crtgend.o%s} crtend.o%s crtn%O%s"
225 #define ENDFILE_SPEC "%{!shared:%{pg|p|profile:crtgend.o%s} crtend.o%s} \
226 %{shared:crtendS.o%s} crtn.o%s"
230 #if DEFAULT_LIBC == LIBC_UCLIBC
233 "%{pthread:-lpthread} \
235 %{!shared:%{pg|p|profile:-lgmon -u profil --defsym __profil=profil} -lc}"
236 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
239 /* -lc_p not present for arc-elf32-* : ashwin */
240 #define LIB_SPEC "%{!shared:%{g*:-lg} %{pg|p:-lgmon} -lc}"
243 #ifndef DRIVER_ENDIAN_SELF_SPECS
244 #define DRIVER_ENDIAN_SELF_SPECS ""
246 #ifndef TARGET_SDATA_DEFAULT
247 #define TARGET_SDATA_DEFAULT 1
249 #ifndef TARGET_MMEDIUM_CALLS_DEFAULT
250 #define TARGET_MMEDIUM_CALLS_DEFAULT 0
253 #define DRIVER_SELF_SPECS DRIVER_ENDIAN_SELF_SPECS \
254 "%{mARC600|mA6: -mcpu=ARC600 %<mARC600 %<mA6}" \
255 "%{mARC601: -mcpu=ARC601 %<mARC601}" \
256 "%{mARC700|mA7: -mcpu=ARC700 %<mARC700 %<mA7}" \
257 "%{mbarrel_shifte*: -mbarrel-shifte%* %<mbarrel_shifte*}" \
258 "%{mEA: -mea %<mEA}" \
259 "%{mspfp_*: -mspfp-%* %<mspfp_*}" \
260 "%{mdpfp_*: -mdpfp-%* %<mdpfp_*}" \
261 "%{mdsp_pack*: -mdsp-pack%* %<mdsp_pack*}" \
262 "%{mmac_*: -mmac-%* %<mmac_*}" \
263 "%{multcost=*: -mmultcost=%* %<multcost=*}"
265 /* Run-time compilation parameters selecting different hardware subsets. */
267 #define TARGET_MIXED_CODE (TARGET_MIXED_CODE_SET)
269 #define TARGET_SPFP (TARGET_SPFP_FAST_SET || TARGET_SPFP_COMPACT_SET)
270 #define TARGET_DPFP (TARGET_DPFP_FAST_SET || TARGET_DPFP_COMPACT_SET \
273 #define SUBTARGET_SWITCHES
275 /* Instruction set characteristics.
276 These are internal macros, set by the appropriate -m option. */
278 /* Non-zero means the cpu supports norm instruction. This flag is set by
279 default for A7, and only for pre A7 cores when -mnorm is given. */
280 #define TARGET_NORM (TARGET_ARC700 || TARGET_NORM_SET || TARGET_HS)
281 /* Indicate if an optimized floating point emulation library is available. */
282 #define TARGET_OPTFPE \
284 /* We need a barrel shifter and NORM. */ \
285 || (TARGET_ARC600 && TARGET_NORM_SET) \
287 || (TARGET_EM && TARGET_NORM_SET && TARGET_BARREL_SHIFTER))
289 /* Non-zero means the cpu supports swap instruction. This flag is set by
290 default for A7, and only for pre A7 cores when -mswap is given. */
291 #define TARGET_SWAP (TARGET_ARC700 || TARGET_SWAP_SET)
293 /* Provide some macros for size / scheduling features of the ARC700, so
294 that we can pick & choose features if we get a new cpu family member. */
296 /* Should we try to unalign likely taken branches without a delay slot. */
297 #define TARGET_UNALIGN_BRANCH (TARGET_ARC700 && !optimize_size)
299 /* Should we upsize short delayed branches with a short delay insn? */
300 #define TARGET_UPSIZE_DBR (TARGET_ARC700 && !optimize_size)
302 /* Should we add padding before a return insn to avoid mispredict? */
303 #define TARGET_PAD_RETURN (TARGET_ARC700 && !optimize_size)
305 /* For an anulled-true delay slot insn for a delayed branch, should we only
306 use conditional execution? */
307 #define TARGET_AT_DBR_CONDEXEC (!TARGET_ARC700 && !TARGET_V2)
309 #define TARGET_ARC600 (arc_cpu == PROCESSOR_ARC600)
310 #define TARGET_ARC601 (arc_cpu == PROCESSOR_ARC601)
311 #define TARGET_ARC700 (arc_cpu == PROCESSOR_ARC700 \
312 || arc_cpu == PROCESSOR_NPS400)
313 #define TARGET_EM (arc_cpu == PROCESSOR_ARCEM)
314 #define TARGET_HS (arc_cpu == PROCESSOR_ARCHS)
316 ((arc_cpu == PROCESSOR_ARCHS) || (arc_cpu == PROCESSOR_ARCEM))
318 /* Recast the cpu class to be the cpu attribute. */
319 #define arc_cpu_attr ((enum attr_cpu)arc_cpu)
321 #ifndef MULTILIB_DEFAULTS
322 #define MULTILIB_DEFAULTS { "mARC700" }
325 #ifndef UNALIGNED_ACCESS_DEFAULT
326 #define UNALIGNED_ACCESS_DEFAULT 0
329 #ifndef TARGET_NPS_CMEM_DEFAULT
330 #define TARGET_NPS_CMEM_DEFAULT 0
333 /* Target machine storage layout. */
335 /* We want zero_extract to mean the same
336 no matter what the byte endianness is. */
337 #define BITS_BIG_ENDIAN 0
339 /* Define this if most significant byte of a word is the lowest numbered. */
340 #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
342 /* Define this if most significant word of a multiword number is the lowest
344 #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
346 /* Width in bits of a "word", which is the contents of a machine register.
347 Note that this is not necessarily the width of data type `int';
348 if using 16-bit ints on a 68000, this would still be 32.
349 But on a machine with 16-bit registers, this would be 16. */
350 #define BITS_PER_WORD 32
352 /* Width of a word, in units (bytes). */
353 #define UNITS_PER_WORD 4
355 /* Define this macro if it is advisable to hold scalars in registers
356 in a wider mode than that declared by the program. In such cases,
357 the value is constrained to be within the bounds of the declared
358 type, but kept valid in the wider mode. The signedness of the
359 extension may differ from that of the type. */
360 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
361 if (GET_MODE_CLASS (MODE) == MODE_INT \
362 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
367 /* Width in bits of a pointer.
368 See also the macro `Pmode' defined below. */
369 #define POINTER_SIZE 32
371 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
372 #define PARM_BOUNDARY 32
374 /* Boundary (in *bits*) on which stack pointer should be aligned. */
375 /* TOCHECK: Changed from 64 to 32 */
376 #define STACK_BOUNDARY 32
378 /* ALIGN FRAMES on word boundaries. */
379 #define ARC_STACK_ALIGN(LOC) \
380 (((LOC) + STACK_BOUNDARY / BITS_PER_UNIT - 1) & -STACK_BOUNDARY/BITS_PER_UNIT)
382 /* Allocation boundary (in *bits*) for the code of a function. */
383 #define FUNCTION_BOUNDARY 32
385 /* Alignment of field after `int : 0' in a structure. */
386 #define EMPTY_FIELD_BOUNDARY 32
388 /* Every structure's size must be a multiple of this. */
389 #define STRUCTURE_SIZE_BOUNDARY 8
391 /* A bitfield declared as `int' forces `int' alignment for the struct. */
392 #define PCC_BITFIELD_TYPE_MATTERS 1
394 /* An expression for the alignment of a structure field FIELD if the
395 alignment computed in the usual way (including applying of
396 `BIGGEST_ALIGNMENT' and `BIGGEST_FIELD_ALIGNMENT' to the
397 alignment) is COMPUTED. It overrides alignment only if the field
398 alignment has not been set by the `__attribute__ ((aligned (N)))'
402 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
403 (TYPE_MODE (strip_array_types (TREE_TYPE (FIELD))) == DFmode \
404 ? MIN ((COMPUTED), 32) : (COMPUTED))
408 /* No data type wants to be aligned rounder than this. */
409 /* This is bigger than currently necessary for the ARC. If 8 byte floats are
410 ever added it's not clear whether they'll need such alignment or not. For
411 now we assume they will. We can always relax it if necessary but the
412 reverse isn't true. */
413 /* TOCHECK: Changed from 64 to 32 */
414 #define BIGGEST_ALIGNMENT 32
416 /* The best alignment to use in cases where we have a choice. */
417 #define FASTEST_ALIGNMENT 32
419 /* Make strings word-aligned so strcpy from constants will be faster. */
420 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
421 ((TREE_CODE (EXP) == STRING_CST \
422 && (ALIGN) < FASTEST_ALIGNMENT) \
423 ? FASTEST_ALIGNMENT : (ALIGN))
426 /* Make arrays of chars word-aligned for the same reasons. */
427 #define LOCAL_ALIGNMENT(TYPE, ALIGN) \
428 (TREE_CODE (TYPE) == ARRAY_TYPE \
429 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
430 && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
432 #define DATA_ALIGNMENT(TYPE, ALIGN) \
433 (TREE_CODE (TYPE) == ARRAY_TYPE \
434 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
435 && arc_size_opt_level < 3 \
436 && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
438 /* Set this nonzero if move instructions will actually fail to work
439 when given unaligned data. */
440 /* On the ARC the lower address bits are masked to 0 as necessary. The chip
441 won't croak when given an unaligned address, but the insn will still fail
442 to produce the correct result. */
443 #define STRICT_ALIGNMENT 1
445 /* Layout of source language data types. */
447 #define SHORT_TYPE_SIZE 16
448 #define INT_TYPE_SIZE 32
449 #define LONG_TYPE_SIZE 32
450 #define LONG_LONG_TYPE_SIZE 64
451 #define FLOAT_TYPE_SIZE 32
452 #define DOUBLE_TYPE_SIZE 64
453 #define LONG_DOUBLE_TYPE_SIZE 64
455 /* Define this as 1 if `char' should by default be signed; else as 0. */
456 #define DEFAULT_SIGNED_CHAR 0
458 #define SIZE_TYPE "long unsigned int"
459 #define PTRDIFF_TYPE "long int"
460 #define WCHAR_TYPE "int"
461 #define WCHAR_TYPE_SIZE 32
464 /* ashwin : shifted from arc.c:102 */
465 #define PROGRAM_COUNTER_REGNO 63
467 /* Standard register usage. */
469 /* Number of actual hardware registers.
470 The hardware registers are assigned numbers for the compiler
471 from 0 to just below FIRST_PSEUDO_REGISTER.
472 All registers that the compiler knows about must be given numbers,
473 even those that are not normally considered general registers.
475 Registers 61, 62, and 63 are not really registers and we needn't treat
476 them as such. We still need a register for the condition code and
479 /* r63 is pc, r64-r127 = simd vregs, r128-r143 = simd dma config regs
480 r144, r145 = lp_start, lp_end
481 and therefore the pseudo registers start from r146. */
482 #define FIRST_PSEUDO_REGISTER 146
484 /* 1 for registers that have pervasive standard uses
485 and are not available for the register allocator.
487 0-28 - general purpose registers
488 29 - ilink1 (interrupt link register)
489 30 - ilink2 (interrupt link register)
490 31 - blink (branch link register)
491 32-59 - reserved for extensions
494 62 - argument pointer
497 FWIW, this is how the 61-63 encodings are used by the hardware:
499 62 - long immediate data indicator
500 63 - PCL (program counter aligned to 32 bit, read-only)
502 The general purpose registers are further broken down into:
504 0-7 - arguments/results
505 8-12 - call used (r11 - static chain pointer)
512 31 - return address register
514 By default, the extension registers are not available. */
515 /* Present implementations only have VR0-VR23 only. */
516 /* ??? FIXME: r27 and r31 should not be fixed registers. */
517 #define FIXED_REGISTERS \
518 { 0, 0, 0, 0, 0, 0, 0, 0, \
519 0, 0, 0, 0, 0, 0, 0, 0, \
520 0, 0, 0, 0, 0, 0, 0, 0, \
521 0, 0, 1, 1, 1, 1, 1, 1, \
523 1, 1, 1, 1, 1, 1, 1, 1, \
524 0, 0, 0, 0, 1, 1, 1, 1, \
525 1, 1, 1, 1, 1, 1, 1, 1, \
526 1, 1, 1, 1, 0, 1, 1, 1, \
528 0, 0, 0, 0, 0, 0, 0, 0, \
529 0, 0, 0, 0, 0, 0, 0, 0, \
530 0, 0, 0, 0, 0, 0, 0, 0, \
531 1, 1, 1, 1, 1, 1, 1, 1, \
533 1, 1, 1, 1, 1, 1, 1, 1, \
534 1, 1, 1, 1, 1, 1, 1, 1, \
535 1, 1, 1, 1, 1, 1, 1, 1, \
536 1, 1, 1, 1, 1, 1, 1, 1, \
538 0, 0, 0, 0, 0, 0, 0, 0, \
539 0, 0, 0, 0, 0, 0, 0, 0, \
542 /* 1 for registers not available across function calls.
543 These must include the FIXED_REGISTERS and also any
544 registers that can be used without being saved.
545 The latter must include the registers where values are returned
546 and the register where structure-value addresses are passed.
547 Aside from that, you can include as many other registers as you like. */
548 #define CALL_USED_REGISTERS \
550 1, 1, 1, 1, 1, 1, 1, 1, \
551 1, 1, 1, 1, 1, 0, 0, 0, \
552 0, 0, 0, 0, 0, 0, 0, 0, \
553 0, 0, 1, 1, 1, 1, 1, 1, \
555 1, 1, 1, 1, 1, 1, 1, 1, \
556 1, 1, 1, 1, 1, 1, 1, 1, \
557 1, 1, 1, 1, 1, 1, 1, 1, \
558 1, 1, 1, 1, 1, 1, 1, 1, \
560 0, 0, 0, 0, 0, 0, 0, 0, \
561 0, 0, 0, 0, 0, 0, 0, 0, \
562 0, 0, 0, 0, 0, 0, 0, 0, \
563 1, 1, 1, 1, 1, 1, 1, 1, \
565 1, 1, 1, 1, 1, 1, 1, 1, \
566 1, 1, 1, 1, 1, 1, 1, 1, \
567 1, 1, 1, 1, 1, 1, 1, 1, \
568 1, 1, 1, 1, 1, 1, 1, 1, \
570 0, 0, 0, 0, 0, 0, 0, 0, \
571 0, 0, 0, 0, 0, 0, 0, 0, \
574 /* If defined, an initializer for a vector of integers, containing the
575 numbers of hard registers in the order in which GCC should
576 prefer to use them (from most preferred to least). */
577 #define REG_ALLOC_ORDER \
578 { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, \
579 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, \
580 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, \
581 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, \
582 27, 28, 29, 30, 31, 63}
584 /* Return number of consecutive hard regs needed starting at reg REGNO
585 to hold something of mode MODE.
586 This is ordinarily the length in words of a value of mode MODE
587 but can be less for certain modes in special long registers. */
588 #define HARD_REGNO_NREGS(REGNO, MODE) \
589 ((GET_MODE_SIZE (MODE) == 16 \
590 && REGNO >= ARC_FIRST_SIMD_VR_REG && REGNO <= ARC_LAST_SIMD_VR_REG) ? 1 \
591 : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
593 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
594 extern unsigned int arc_hard_regno_mode_ok
[];
595 extern unsigned int arc_mode_class
[];
596 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
597 ((arc_hard_regno_mode_ok[REGNO] & arc_mode_class[MODE]) != 0)
599 /* A C expression that is nonzero if it is desirable to choose
600 register allocation so as to avoid move instructions between a
601 value of mode MODE1 and a value of mode MODE2.
603 If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
604 MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
605 MODE2)' must be zero. */
607 /* Tie QI/HI/SI modes together. */
608 #define MODES_TIEABLE_P(MODE1, MODE2) \
609 (GET_MODE_CLASS (MODE1) == MODE_INT \
610 && GET_MODE_CLASS (MODE2) == MODE_INT \
611 && GET_MODE_SIZE (MODE1) <= UNITS_PER_WORD \
612 && GET_MODE_SIZE (MODE2) <= UNITS_PER_WORD)
614 /* Internal macros to classify a register number as to whether it's a
615 general purpose register for compact insns (r0-r3,r12-r15), or
616 stack pointer (r28). */
618 #define COMPACT_GP_REG_P(REGNO) \
619 (((signed)(REGNO) >= 0 && (REGNO) <= 3) || ((REGNO) >= 12 && (REGNO) <= 15))
620 #define SP_REG_P(REGNO) ((REGNO) == 28)
624 /* Register classes and constants. */
626 /* Define the classes of registers for register constraints in the
627 machine description. Also define ranges of constants.
629 One of the classes must always be named ALL_REGS and include all hard regs.
630 If there is more than one class, another class must be named NO_REGS
631 and contain no registers.
633 The name GENERAL_REGS must be the name of a class (or an alias for
634 another name such as ALL_REGS). This is the class of registers
635 that is allowed by "g" or "r" in a register constraint.
636 Also, registers outside this class are allocated only when
637 instructions express preferences for them.
639 The classes must be numbered in nondecreasing order; that is,
640 a larger-numbered class must never be contained completely
641 in a smaller-numbered class.
643 For any two classes, it is very desirable that there be another
644 class that represents their union.
646 It is important that any condition codes have class NO_REGS.
647 See `register_operand'. */
656 LPCOUNT_REG
, /* 'l' */
658 DOUBLE_REGS
, /* D0, D1 */
659 SIMD_VR_REGS
, /* VR00-VR63 */
660 SIMD_DMA_CONFIG_REGS
, /* DI0-DI7,DO0-DO7 */
661 ARCOMPACT16_REGS
, /* 'q' */
662 AC16_BASE_REGS
, /* 'e' */
663 SIBCALL_REGS
, /* "Rsc" */
664 GENERAL_REGS
, /* 'r' */
665 MPY_WRITABLE_CORE_REGS
, /* 'W' */
666 WRITABLE_CORE_REGS
, /* 'w' */
667 CHEAP_CORE_REGS
, /* 'c' */
668 ALL_CORE_REGS
, /* 'Rac' */
673 #define N_REG_CLASSES (int) LIM_REG_CLASSES
675 /* Give names of register classes as strings for dump file. */
676 #define REG_CLASS_NAMES \
687 "SIMD_DMA_CONFIG_REGS", \
688 "ARCOMPACT16_REGS", \
692 "MPY_WRITABLE_CORE_REGS", \
693 "WRITABLE_CORE_REGS", \
699 /* Define which registers fit in which classes.
700 This is an initializer for a vector of HARD_REG_SET
701 of length N_REG_CLASSES. */
703 #define REG_CLASS_CONTENTS \
705 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* No Registers */ \
706 {0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'x', r0 register , r0 */ \
707 {0x04000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'Rgp', Global Pointer, r26 */ \
708 {0x08000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'f', Frame Pointer, r27 */ \
709 {0x10000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'b', Stack Pointer, r28 */ \
710 {0x00000000, 0x10000000, 0x00000000, 0x00000000, 0x00000000}, /* 'l', LPCOUNT Register, r60 */ \
711 {0xe0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'k', LINK Registers, r29-r31 */ \
712 {0x00000000, 0x00000f00, 0x00000000, 0x00000000, 0x00000000}, /* 'D', D1, D2 Registers */ \
713 {0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000}, /* 'V', VR00-VR63 Registers */ \
714 {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000ffff}, /* 'V', DI0-7,DO0-7 Registers */ \
715 {0x0000f00f, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'q', r0-r3, r12-r15 */ \
716 {0x1000f00f, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'e', r0-r3, r12-r15, sp */ \
717 {0x1c001fff, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* "Rsc", r0-r12 */ \
718 {0x9fffffff, 0xc0000000, 0x00000000, 0x00000000, 0x00000000}, /* 'r', r0-r28, blink, ap and pcl */ \
719 {0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, /* 'W', r0-r31 */ \
720 /* Include ap / pcl in WRITABLE_CORE_REGS for sake of symmetry. As these \
721 registers are fixed, it does not affect the literal meaning of the \
722 constraints, but it makes it a superset of GENERAL_REGS, thus \
723 enabling some operations that would otherwise not be possible. */ \
724 {0xffffffff, 0xd0000000, 0x00000000, 0x00000000, 0x00000000}, /* 'w', r0-r31, r60 */ \
725 {0xffffffff, 0xdfffffff, 0x00000000, 0x00000000, 0x00000000}, /* 'c', r0-r60, ap, pcl */ \
726 {0xffffffff, 0xdfffffff, 0x00000000, 0x00000000, 0x00000000}, /* 'Rac', r0-r60, ap, pcl */ \
727 {0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x0003ffff} /* All Registers */ \
730 /* Local macros to mark the first and last regs of different classes. */
731 #define ARC_FIRST_SIMD_VR_REG 64
732 #define ARC_LAST_SIMD_VR_REG 127
734 #define ARC_FIRST_SIMD_DMA_CONFIG_REG 128
735 #define ARC_FIRST_SIMD_DMA_CONFIG_IN_REG 128
736 #define ARC_FIRST_SIMD_DMA_CONFIG_OUT_REG 136
737 #define ARC_LAST_SIMD_DMA_CONFIG_REG 143
739 /* ARCv2 double-register accumulator. */
740 #define ACC_REG_FIRST 58
741 #define ACC_REG_LAST 59
742 #define ACCL_REGNO (TARGET_BIG_ENDIAN ? ACC_REG_FIRST + 1 : ACC_REG_FIRST)
743 #define ACCH_REGNO (TARGET_BIG_ENDIAN ? ACC_REG_FIRST : ACC_REG_FIRST + 1)
745 /* The same information, inverted:
746 Return the class number of the smallest class containing
747 reg number REGNO. This could be a conditional expression
748 or could index an array. */
750 extern enum reg_class arc_regno_reg_class
[];
752 #define REGNO_REG_CLASS(REGNO) (arc_regno_reg_class[REGNO])
754 /* The class value for valid index registers. An index register is
755 one used in an address where its value is either multiplied by
756 a scale factor or added to another register (as well as added to a
759 #define INDEX_REG_CLASS (TARGET_MIXED_CODE ? ARCOMPACT16_REGS : GENERAL_REGS)
761 /* The class value for valid base registers. A base register is one used in
762 an address which is the register value plus a displacement. */
764 #define BASE_REG_CLASS (TARGET_MIXED_CODE ? AC16_BASE_REGS : GENERAL_REGS)
766 /* These assume that REGNO is a hard or pseudo reg number.
767 They give nonzero only if REGNO is a hard reg of the suitable class
768 or a pseudo reg currently allocated to a suitable hard reg.
769 Since they use reg_renumber, they are safe only once reg_renumber
770 has been allocated, which happens in local-alloc.c. */
771 #define REGNO_OK_FOR_BASE_P(REGNO) \
772 ((REGNO) < 29 || ((REGNO) == ARG_POINTER_REGNUM) || ((REGNO) == 63) \
773 || ((unsigned) reg_renumber[REGNO] < 29) \
774 || ((unsigned) (REGNO) == (unsigned) arc_tp_regno))
776 #define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_BASE_P(REGNO)
778 /* Given an rtx X being reloaded into a reg required to be
779 in class CLASS, return the class of reg to actually use.
780 In general this is just CLASS; but on some machines
781 in some cases it is preferable to use a more restrictive class. */
783 #define PREFERRED_RELOAD_CLASS(X, CLASS) \
784 arc_preferred_reload_class((X), (CLASS))
786 extern enum reg_class
arc_preferred_reload_class (rtx
, enum reg_class
);
788 /* Return the maximum number of consecutive registers
789 needed to represent mode MODE in a register of class CLASS. */
791 #define CLASS_MAX_NREGS(CLASS, MODE) \
792 (( GET_MODE_SIZE (MODE) == 16 && CLASS == SIMD_VR_REGS) ? 1: \
793 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
795 #define SMALL_INT(X) ((unsigned) ((X) + 0x100) < 0x200)
796 #define SMALL_INT_RANGE(X, OFFSET, SHIFT) \
797 ((unsigned) (((X) >> (SHIFT)) + 0x100) \
798 < 0x200 - ((unsigned) (OFFSET) >> (SHIFT)))
799 #define SIGNED_INT12(X) ((unsigned) ((X) + 0x800) < 0x1000)
800 #define SIGNED_INT16(X) ((unsigned) ((X) + 0x8000) < 0x10000)
801 #define LARGE_INT(X) \
803 ? (X) >= (-(HOST_WIDE_INT) 0x7fffffff - 1) \
804 : (unsigned HOST_WIDE_INT) (X) <= (unsigned HOST_WIDE_INT) 0xffffffff)
805 #define UNSIGNED_INT3(X) ((unsigned) (X) < 0x8)
806 #define UNSIGNED_INT5(X) ((unsigned) (X) < 0x20)
807 #define UNSIGNED_INT6(X) ((unsigned) (X) < 0x40)
808 #define UNSIGNED_INT7(X) ((unsigned) (X) < 0x80)
809 #define UNSIGNED_INT8(X) ((unsigned) (X) < 0x100)
810 #define IS_ONE(X) ((X) == 1)
811 #define IS_ZERO(X) ((X) == 0)
813 /* Stack layout and stack pointer usage. */
815 /* Define this macro if pushing a word onto the stack moves the stack
816 pointer to a smaller address. */
817 #define STACK_GROWS_DOWNWARD 1
819 /* Define this if the nominal address of the stack frame
820 is at the high-address end of the local variables;
821 that is, each additional local variable allocated
822 goes at a more negative offset in the frame. */
823 #define FRAME_GROWS_DOWNWARD 1
825 /* Offset within stack frame to start allocating local variables at.
826 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
827 first local allocated. Otherwise, it is the offset to the BEGINNING
828 of the first local allocated. */
829 #define STARTING_FRAME_OFFSET 0
831 /* Offset from the stack pointer register to the first location at which
832 outgoing arguments are placed. */
833 #define STACK_POINTER_OFFSET (0)
835 /* Offset of first parameter from the argument pointer register value. */
836 #define FIRST_PARM_OFFSET(FNDECL) (0)
838 /* A C expression whose value is RTL representing the address in a
839 stack frame where the pointer to the caller's frame is stored.
840 Assume that FRAMEADDR is an RTL expression for the address of the
843 If you don't define this macro, the default is to return the value
844 of FRAMEADDR--that is, the stack frame address is also the address
845 of the stack word that points to the previous frame. */
847 /*define DYNAMIC_CHAIN_ADDRESS (FRAMEADDR)*/
849 /* A C expression whose value is RTL representing the value of the
850 return address for the frame COUNT steps up from the current frame.
851 FRAMEADDR is the frame pointer of the COUNT frame, or the frame
852 pointer of the COUNT - 1 frame if `RETURN_ADDR_IN_PREVIOUS_FRAME'
854 /* The current return address is in r31. The return address of anything
855 farther back is at [%fp,4]. */
857 #define RETURN_ADDR_RTX(COUNT, FRAME) \
858 arc_return_addr_rtx(COUNT,FRAME)
860 /* Register to use for pushing function arguments. */
861 #define STACK_POINTER_REGNUM 28
863 /* Base register for access to local variables of the function. */
864 #define FRAME_POINTER_REGNUM 27
866 /* Base register for access to arguments of the function. This register
867 will be eliminated into either fp or sp. */
868 #define ARG_POINTER_REGNUM 62
870 #define RETURN_ADDR_REGNUM 31
872 /* TODO - check usage of STATIC_CHAIN_REGNUM with a testcase */
873 /* Register in which static-chain is passed to a function. This must
874 not be a register used by the prologue. */
875 #define STATIC_CHAIN_REGNUM 11
877 /* Function argument passing. */
879 /* If defined, the maximum amount of space required for outgoing
880 arguments will be computed and placed into the variable
881 `crtl->outgoing_args_size'. No space will be pushed
882 onto the stack for each call; instead, the function prologue should
883 increase the stack frame size by this amount. */
884 #define ACCUMULATE_OUTGOING_ARGS 1
886 /* Define a data type for recording info about an argument list
887 during the scan of that argument list. This data type should
888 hold all necessary information about the function itself
889 and about the args processed so far, enough to enable macros
890 such as FUNCTION_ARG to determine where the next arg should go. */
891 #define CUMULATIVE_ARGS int
893 /* Initialize a variable CUM of type CUMULATIVE_ARGS
894 for a call to a function whose data type is FNTYPE.
895 For a library call, FNTYPE is 0. */
896 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT,N_NAMED_ARGS) \
899 /* The number of registers used for parameter passing. Local to this file. */
900 #define MAX_ARC_PARM_REGS 8
902 /* 1 if N is a possible register number for function argument passing. */
903 #define FUNCTION_ARG_REGNO_P(N) \
904 ((unsigned) (N) < MAX_ARC_PARM_REGS)
906 /* The ROUND_ADVANCE* macros are local to this file. */
907 /* Round SIZE up to a word boundary. */
908 #define ROUND_ADVANCE(SIZE) \
909 (((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
911 /* Round arg MODE/TYPE up to the next word boundary. */
912 #define ROUND_ADVANCE_ARG(MODE, TYPE) \
914 ? ROUND_ADVANCE (int_size_in_bytes (TYPE)) \
915 : ROUND_ADVANCE (GET_MODE_SIZE (MODE)))
917 #define ARC_FUNCTION_ARG_BOUNDARY(MODE,TYPE) PARM_BOUNDARY
918 /* Round CUM up to the necessary point for argument MODE/TYPE. */
919 /* N.B. Vectors have alignment exceeding BIGGEST_ALIGNMENT.
920 ARC_FUNCTION_ARG_BOUNDARY reduces this to no more than 32 bit. */
921 #define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) \
922 ((((CUM) - 1) | (ARC_FUNCTION_ARG_BOUNDARY ((MODE), (TYPE)) - 1)/BITS_PER_WORD)\
925 /* Return boolean indicating arg of type TYPE and mode MODE will be passed in
926 a reg. This includes arguments that have to be passed by reference as the
927 pointer to them is passed in a reg if one is available (and that is what
929 When passing arguments NAMED is always 1. When receiving arguments NAMED
930 is 1 for each argument except the last in a stdarg/varargs function. In
931 a stdarg function we want to treat the last named arg as named. In a
932 varargs function we want to treat the last named arg (which is
933 `__builtin_va_alist') as unnamed.
934 This macro is only used in this file. */
935 #define PASS_IN_REG_P(CUM, MODE, TYPE) \
936 ((CUM) < MAX_ARC_PARM_REGS)
939 /* Function results. */
941 /* Define how to find the value returned by a library function
942 assuming the value has mode MODE. */
943 #define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, 0)
945 /* 1 if N is a possible register number for a function value
946 as seen by the caller. */
947 /* ??? What about r1 in DI/DF values. */
948 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
950 /* Tell GCC to use RETURN_IN_MEMORY. */
951 #define DEFAULT_PCC_STRUCT_RETURN 0
953 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
954 the stack pointer does not matter. The value is tested only in
955 functions that have frame pointers.
956 No definition is equivalent to always zero. */
957 #define EXIT_IGNORE_STACK 0
959 #define EPILOGUE_USES(REGNO) arc_epilogue_uses ((REGNO))
961 #define EH_USES(REGNO) arc_eh_uses((REGNO))
963 /* Definitions for register eliminations.
965 This is an array of structures. Each structure initializes one pair
966 of eliminable registers. The "from" register number is given first,
967 followed by "to". Eliminations of the same "from" register are listed
968 in order of preference.
970 We have two registers that can be eliminated on the ARC. First, the
971 argument pointer register can always be eliminated in favor of the stack
972 pointer register or frame pointer register. Secondly, the frame pointer
973 register can often be eliminated in favor of the stack pointer register.
976 #define ELIMINABLE_REGS \
977 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
978 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
979 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
981 /* Define the offset between two registers, one to be eliminated, and the other
982 its replacement, at the start of a routine. */
983 extern int arc_initial_elimination_offset(int from
, int to
);
984 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
985 (OFFSET) = arc_initial_elimination_offset ((FROM), (TO))
987 /* Output assembler code to FILE to increment profiler label # LABELNO
988 for profiling a function entry.
989 We actually emit the profiler code at the call site, so leave this one
991 #define FUNCTION_PROFILER(FILE, LABELNO) \
992 if (TARGET_UCB_MCOUNT) \
993 fprintf (FILE, "\t%s\n", arc_output_libcall ("__mcount"))
995 #define NO_PROFILE_COUNTERS 1
999 /* Length in units of the trampoline for entering a nested function. */
1000 #define TRAMPOLINE_SIZE 20
1002 /* Alignment required for a trampoline in bits . */
1003 /* For actual data alignment we just need 32, no more than the stack;
1004 however, to reduce cache coherency issues, we want to make sure that
1005 trampoline instructions always appear the same in any given cache line. */
1006 #define TRAMPOLINE_ALIGNMENT 256
1008 /* Library calls. */
1010 /* Addressing modes, and classification of registers for them. */
1012 /* Maximum number of registers that can appear in a valid memory address. */
1013 /* The `ld' insn allows 2, but the `st' insn only allows 1. */
1014 #define MAX_REGS_PER_ADDRESS 1
1016 /* We have pre inc/dec (load/store with update). */
1017 #define HAVE_PRE_INCREMENT 1
1018 #define HAVE_PRE_DECREMENT 1
1019 #define HAVE_POST_INCREMENT 1
1020 #define HAVE_POST_DECREMENT 1
1021 #define HAVE_PRE_MODIFY_DISP 1
1022 #define HAVE_POST_MODIFY_DISP 1
1023 #define HAVE_PRE_MODIFY_REG 1
1024 #define HAVE_POST_MODIFY_REG 1
1025 /* ??? should also do PRE_MODIFY_REG / POST_MODIFY_REG, but that requires
1026 a special predicate for the memory operand of stores, like for the SH. */
1028 /* Recognize any constant value that is a valid address. */
1029 #define CONSTANT_ADDRESS_P(X) \
1030 (flag_pic?arc_legitimate_pic_addr_p (X): \
1031 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1032 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST))
1034 /* Is the argument a const_int rtx, containing an exact power of 2 */
1035 #define IS_POWEROF2_P(X) (! ( (X) & ((X) - 1)) && (X))
1037 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1038 and check its validity for a certain class.
1039 We have two alternate definitions for each of them.
1040 The *_NONSTRICT definition accepts all pseudo regs; the other rejects
1041 them unless they have been allocated suitable hard regs.
1043 Most source files want to accept pseudo regs in the hope that
1044 they will get allocated to the class that the insn wants them to be in.
1045 Source files for reload pass need to be strict.
1046 After reload, it makes no difference, since pseudo regs have
1047 been eliminated by then. */
1049 /* Nonzero if X is a hard reg that can be used as an index
1050 or if it is a pseudo reg. */
1051 #define REG_OK_FOR_INDEX_P_NONSTRICT(X) \
1052 ((unsigned) REGNO (X) >= FIRST_PSEUDO_REGISTER || \
1053 (unsigned) REGNO (X) < 29 || \
1054 (unsigned) REGNO (X) == 63 || \
1055 (unsigned) REGNO (X) == ARG_POINTER_REGNUM)
1056 /* Nonzero if X is a hard reg that can be used as a base reg
1057 or if it is a pseudo reg. */
1058 #define REG_OK_FOR_BASE_P_NONSTRICT(X) \
1059 ((unsigned) REGNO (X) >= FIRST_PSEUDO_REGISTER || \
1060 (unsigned) REGNO (X) < 29 || \
1061 (unsigned) REGNO (X) == 63 || \
1062 (unsigned) REGNO (X) == ARG_POINTER_REGNUM)
1064 /* Nonzero if X is a hard reg that can be used as an index. */
1065 #define REG_OK_FOR_INDEX_P_STRICT(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1066 /* Nonzero if X is a hard reg that can be used as a base reg. */
1067 #define REG_OK_FOR_BASE_P_STRICT(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1069 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1070 that is a valid memory address for an instruction.
1071 The MODE argument is the machine mode for the MEM expression
1072 that wants to use this address. */
1073 /* The `ld' insn allows [reg],[reg+shimm],[reg+limm],[reg+reg],[limm]
1074 but the `st' insn only allows [reg],[reg+shimm],[limm].
1075 The only thing we can do is only allow the most strict case `st' and hope
1076 other parts optimize out the restrictions for `ld'. */
1078 #define RTX_OK_FOR_BASE_P(X, STRICT) \
1080 && ((STRICT) ? REG_OK_FOR_BASE_P_STRICT (X) : REG_OK_FOR_BASE_P_NONSTRICT (X)))
1082 #define RTX_OK_FOR_INDEX_P(X, STRICT) \
1084 && ((STRICT) ? REG_OK_FOR_INDEX_P_STRICT (X) : REG_OK_FOR_INDEX_P_NONSTRICT (X)))
1086 /* A C compound statement that attempts to replace X, which is an address
1087 that needs reloading, with a valid memory address for an operand of
1088 mode MODE. WIN is a C statement label elsewhere in the code.
1090 We try to get a normal form
1091 of the address. That will allow inheritance of the address reloads. */
1093 #define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND_LEVELS,WIN) \
1095 if (arc_legitimize_reload_address (&(X), (MODE), (OPNUM), (TYPE))) \
1099 /* Reading lp_count for anything but the lp instruction is very slow on the
1101 #define DONT_REALLOC(REGNO,MODE) \
1102 (TARGET_ARC700 && (REGNO) == 60)
1105 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
1106 return the mode to be used for the comparison. */
1107 /*extern machine_mode arc_select_cc_mode ();*/
1108 #define SELECT_CC_MODE(OP, X, Y) \
1109 arc_select_cc_mode (OP, X, Y)
1111 /* Return non-zero if SELECT_CC_MODE will never return MODE for a
1112 floating point inequality comparison. */
1113 #define REVERSIBLE_CC_MODE(MODE) 1 /*???*/
1117 /* Compute extra cost of moving data between one register class
1119 #define REGISTER_MOVE_COST(MODE, CLASS, TO_CLASS) \
1120 arc_register_move_cost ((MODE), (CLASS), (TO_CLASS))
1122 /* Compute the cost of moving data between registers and memory. */
1123 /* Memory is 3 times as expensive as registers.
1124 ??? Is that the right way to look at it? */
1125 #define MEMORY_MOVE_COST(MODE,CLASS,IN) \
1126 (GET_MODE_SIZE (MODE) <= UNITS_PER_WORD ? 6 : 12)
1128 /* The cost of a branch insn. */
1129 /* ??? What's the right value here? Branches are certainly more
1130 expensive than reg->reg moves. */
1131 #define BRANCH_COST(speed_p, predictable_p) 2
1133 /* Scc sets the destination to 1 and then conditionally zeroes it.
1134 Best case, ORed SCCs can be made into clear - condset - condset.
1135 But it could also end up as five insns. So say it costs four on
1137 These extra instructions - and the second comparison - will also be
1138 an extra cost if the first comparison would have been decisive.
1139 So get an average saving, with a probability of the first branch
1140 beging decisive of p0, we want:
1141 p0 * (branch_cost - 4) > (1 - p0) * 5
1142 ??? We don't get to see that probability to evaluate, so we can
1143 only wildly guess that it might be 50%.
1144 ??? The compiler also lacks the notion of branch predictability. */
1145 #define LOGICAL_OP_NON_SHORT_CIRCUIT \
1146 (BRANCH_COST (optimize_function_for_speed_p (cfun), \
1149 /* Nonzero if access to memory by bytes is slow and undesirable.
1150 For RISC chips, it means that access to memory by bytes is no
1151 better than access by words when possible, so grab a whole word
1152 and maybe make use of that. */
1153 #define SLOW_BYTE_ACCESS 0
1155 /* Define this macro if it is as good or better to call a constant
1156 function address than to call an address kept in a register. */
1157 /* On the ARC, calling through registers is slow. */
1158 #define NO_FUNCTION_CSE 1
1160 /* Section selection. */
1161 /* WARNING: These section names also appear in dwarfout.c. */
1163 #define TEXT_SECTION_ASM_OP "\t.section\t.text"
1164 #define DATA_SECTION_ASM_OP "\t.section\t.data"
1166 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
1167 #define SDATA_SECTION_ASM_OP "\t.section\t.sdata"
1168 #define SBSS_SECTION_ASM_OP "\t.section\t.sbss"
1170 /* Expression whose value is a string, including spacing, containing the
1171 assembler operation to identify the following data as initialization/termination
1172 code. If not defined, GCC will assume such a section does not exist. */
1173 #define INIT_SECTION_ASM_OP "\t.section\t.init"
1174 #define FINI_SECTION_ASM_OP "\t.section\t.fini"
1176 /* Define this macro if jump tables (for tablejump insns) should be
1177 output in the text section, along with the assembler instructions.
1178 Otherwise, the readonly data section is used.
1179 This macro is irrelevant if there is no separate readonly data section. */
1180 #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic || CASE_VECTOR_PC_RELATIVE)
1182 /* For DWARF. Marginally different than default so output is "prettier"
1183 (and consistent with above). */
1184 #define PUSHSECTION_FORMAT "\t%s %s\n"
1186 /* Tell crtstuff.c we're using ELF. */
1187 #define OBJECT_FORMAT_ELF
1191 /* The register number of the register used to address a table of static
1192 data addresses in memory. In some cases this register is defined by a
1193 processor's ``application binary interface'' (ABI). When this macro
1194 is defined, RTL is generated for this register once, as with the stack
1195 pointer and frame pointer registers. If this macro is not defined, it
1196 is up to the machine-dependent files to allocate such a register (if
1198 #define PIC_OFFSET_TABLE_REGNUM 26
1200 /* Define this macro if the register defined by PIC_OFFSET_TABLE_REGNUM is
1201 clobbered by calls. Do not define this macro if PIC_OFFSET_TABLE_REGNUM
1203 /* This register is call-saved on the ARC. */
1204 /*#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED*/
1206 /* A C expression that is nonzero if X is a legitimate immediate
1207 operand on the target machine when generating position independent code.
1208 You can assume that X satisfies CONSTANT_P, so you need not
1209 check this. You can also assume `flag_pic' is true, so you need not
1210 check it either. You need not define this macro if all constants
1211 (including SYMBOL_REF) can be immediate operands when generating
1212 position independent code. */
1213 #define LEGITIMATE_PIC_OPERAND_P(X) (arc_legitimate_pic_operand_p(X))
1215 /* PIC and small data don't mix on ARC because they use the same register. */
1216 #define SDATA_BASE_REGNUM 26
1218 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
1220 ? (GLOBAL ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4 \
1223 /* Control the assembler format that we output. */
1225 /* A C string constant describing how to begin a comment in the target
1226 assembler language. The compiler assumes that the comment will
1227 end at the end of the line. */
1228 /* Gas needs this to be "#" in order to recognize line directives. */
1229 #define ASM_COMMENT_START "#"
1231 /* Output to assembler file text saying following lines
1232 may contain character constants, extra white space, comments, etc. */
1233 #define ASM_APP_ON ""
1235 /* Output to assembler file text saying following lines
1236 no longer contain unusual constructs. */
1237 #define ASM_APP_OFF ""
1239 /* Globalizing directive for a label. */
1240 #define GLOBAL_ASM_OP "\t.global\t"
1242 /* This is how to output an assembler line defining a `char' constant. */
1243 #define ASM_OUTPUT_CHAR(FILE, VALUE) \
1244 ( fprintf (FILE, "\t.byte\t"), \
1245 output_addr_const (FILE, (VALUE)), \
1246 fprintf (FILE, "\n"))
1248 /* This is how to output an assembler line defining a `short' constant. */
1249 #define ASM_OUTPUT_SHORT(FILE, VALUE) \
1250 ( fprintf (FILE, "\t.hword\t"), \
1251 output_addr_const (FILE, (VALUE)), \
1252 fprintf (FILE, "\n"))
1254 /* This is how to output an assembler line defining an `int' constant.
1255 We also handle symbol output here. Code addresses must be right shifted
1256 by 2 because that's how the jump instruction wants them. */
1257 #define ASM_OUTPUT_INT(FILE, VALUE) \
1259 fprintf (FILE, "\t.word\t"); \
1260 if (GET_CODE (VALUE) == LABEL_REF) \
1262 fprintf (FILE, "%%st(@"); \
1263 output_addr_const (FILE, (VALUE)); \
1264 fprintf (FILE, ")"); \
1267 output_addr_const (FILE, (VALUE)); \
1268 fprintf (FILE, "\n"); \
1271 /* This is how to output an assembler line defining a `float' constant. */
1272 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
1276 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
1277 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
1278 fprintf (FILE, "\t.word\t0x%lx %s %s\n", \
1279 t, ASM_COMMENT_START, str); \
1282 /* This is how to output an assembler line defining a `double' constant. */
1283 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
1287 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
1288 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
1289 fprintf (FILE, "\t.word\t0x%lx %s %s\n\t.word\t0x%lx\n", \
1290 t[0], ASM_COMMENT_START, str, t[1]); \
1293 /* This is how to output the definition of a user-level label named NAME,
1294 such as the label on a static function or variable NAME. */
1295 #define ASM_OUTPUT_LABEL(FILE, NAME) \
1296 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1298 #define ASM_NAME_P(NAME) ( NAME[0]=='*')
1300 /* This is how to output a reference to a user-level label named NAME.
1301 `assemble_name' uses this. */
1302 /* We work around a dwarfout.c deficiency by watching for labels from it and
1303 not adding the '_' prefix. There is a comment in
1304 dwarfout.c that says it should be using ASM_OUTPUT_INTERNAL_LABEL. */
1305 #define ASM_OUTPUT_LABELREF(FILE, NAME1) \
1308 NAME = (*targetm.strip_name_encoding)(NAME1); \
1309 if ((NAME)[0] == '.' && (NAME)[1] == 'L') \
1310 fprintf (FILE, "%s", NAME); \
1313 if (!ASM_NAME_P (NAME1)) \
1314 fprintf (FILE, "%s", user_label_prefix); \
1315 fprintf (FILE, "%s", NAME); \
1319 /* This is how to output a reference to a symbol_ref / label_ref as
1320 (part of) an operand. To disambiguate from register names like
1321 a1 / a2 / status etc, symbols are preceded by '@'. */
1322 #define ASM_OUTPUT_SYMBOL_REF(FILE,SYM) \
1323 ASM_OUTPUT_LABEL_REF ((FILE), XSTR ((SYM), 0))
1324 #define ASM_OUTPUT_LABEL_REF(FILE,STR) \
1327 fputc ('@', file); \
1328 assemble_name ((FILE), (STR)); \
1332 /* Store in OUTPUT a string (made with alloca) containing
1333 an assembler-name for a local static variable named NAME.
1334 LABELNO is an integer which is different for each call. */
1335 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1336 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1337 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1339 /* The following macro defines the format used to output the second
1340 operand of the .type assembler directive. Different svr4 assemblers
1341 expect various different forms for this operand. The one given here
1342 is just a default. You may need to override it in your machine-
1343 specific tm.h file (depending upon the particulars of your assembler). */
1345 #undef TYPE_OPERAND_FMT
1346 #define TYPE_OPERAND_FMT "@%s"
1348 /* A C string containing the appropriate assembler directive to
1349 specify the size of a symbol, without any arguments. On systems
1350 that use ELF, the default (in `config/elfos.h') is `"\t.size\t"';
1351 on other systems, the default is not to define this macro. */
1353 #define SIZE_ASM_OP "\t.size\t"
1355 /* Assembler pseudo-op to equate one value with another. */
1356 /* ??? This is needed because dwarfout.c provides a default definition too
1357 late for defaults.h (which contains the default definition of ASM_OTPUT_DEF
1362 #define SET_ASM_OP "\t.set\t"
1364 extern char rname29
[], rname30
[];
1365 extern char rname56
[], rname57
[], rname58
[], rname59
[];
1366 /* How to refer to registers in assembler output.
1367 This sequence is indexed by compiler's hard-register-number (see above). */
1368 #define REGISTER_NAMES \
1369 { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
1370 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
1371 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
1372 "r24", "r25", "gp", "fp", "sp", rname29, rname30, "blink", \
1373 "r32", "r33", "r34", "r35", "r36", "r37", "r38", "r39", \
1374 "d1", "d1", "d2", "d2", "r44", "r45", "r46", "r47", \
1375 "r48", "r49", "r50", "r51", "r52", "r53", "r54", "r55", \
1376 rname56,rname57,rname58,rname59,"lp_count", "cc", "ap", "pcl", \
1377 "vr0", "vr1", "vr2", "vr3", "vr4", "vr5", "vr6", "vr7", \
1378 "vr8", "vr9", "vr10", "vr11", "vr12", "vr13", "vr14", "vr15", \
1379 "vr16", "vr17", "vr18", "vr19", "vr20", "vr21", "vr22", "vr23", \
1380 "vr24", "vr25", "vr26", "vr27", "vr28", "vr29", "vr30", "vr31", \
1381 "vr32", "vr33", "vr34", "vr35", "vr36", "vr37", "vr38", "vr39", \
1382 "vr40", "vr41", "vr42", "vr43", "vr44", "vr45", "vr46", "vr47", \
1383 "vr48", "vr49", "vr50", "vr51", "vr52", "vr53", "vr54", "vr55", \
1384 "vr56", "vr57", "vr58", "vr59", "vr60", "vr61", "vr62", "vr63", \
1385 "dr0", "dr1", "dr2", "dr3", "dr4", "dr5", "dr6", "dr7", \
1386 "dr0", "dr1", "dr2", "dr3", "dr4", "dr5", "dr6", "dr7", \
1387 "lp_start", "lp_end" \
1390 /* Entry to the insn conditionalizer. */
1391 #define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
1392 arc_final_prescan_insn (INSN, OPVEC, NOPERANDS)
1394 /* A C expression which evaluates to true if CODE is a valid
1395 punctuation character for use in the `PRINT_OPERAND' macro. */
1396 extern char arc_punct_chars
[];
1397 #define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
1398 arc_punct_chars[(unsigned char) (CHAR)]
1400 /* Print operand X (an rtx) in assembler syntax to file FILE.
1401 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1402 For `%' followed by punctuation, CODE is the punctuation and X is null. */
1403 #define PRINT_OPERAND(FILE, X, CODE) \
1404 arc_print_operand (FILE, X, CODE)
1406 /* A C compound statement to output to stdio stream STREAM the
1407 assembler syntax for an instruction operand that is a memory
1408 reference whose address is ADDR. ADDR is an RTL expression.
1410 On some machines, the syntax for a symbolic address depends on
1411 the section that the address refers to. On these machines,
1412 define the macro `ENCODE_SECTION_INFO' to store the information
1413 into the `symbol_ref', and then check for it here. */
1414 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1415 arc_print_operand_address (FILE, ADDR)
1417 /* This is how to output an element of a case-vector that is absolute. */
1418 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1421 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
1422 fprintf (FILE, "\t.word "); \
1423 assemble_name (FILE, label); \
1424 fprintf(FILE, "\n"); \
1427 /* This is how to output an element of a case-vector that is relative. */
1428 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1431 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
1432 switch (GET_MODE (BODY)) \
1434 case QImode: fprintf (FILE, "\t.byte "); break; \
1435 case HImode: fprintf (FILE, "\t.hword "); break; \
1436 case SImode: fprintf (FILE, "\t.word "); break; \
1437 default: gcc_unreachable (); \
1439 assemble_name (FILE, label); \
1440 fprintf (FILE, "-"); \
1441 ASM_GENERATE_INTERNAL_LABEL (label, "L", REL); \
1442 assemble_name (FILE, label); \
1443 if (TARGET_COMPACT_CASESI) \
1444 fprintf (FILE, " + %d", 4 + arc_get_unalign ()); \
1445 fprintf(FILE, "\n"); \
1448 /* ADDR_DIFF_VECs are in the text section and thus can affect the
1449 current alignment. */
1450 #define ASM_OUTPUT_CASE_END(FILE, NUM, JUMPTABLE) \
1453 if (GET_CODE (PATTERN (JUMPTABLE)) == ADDR_DIFF_VEC \
1454 && ((GET_MODE_SIZE (GET_MODE (PATTERN (JUMPTABLE))) \
1455 * XVECLEN (PATTERN (JUMPTABLE), 1) + 1) \
1457 arc_toggle_unalign (); \
1461 #define JUMP_ALIGN(LABEL) (arc_size_opt_level < 2 ? 2 : 0)
1462 #define LABEL_ALIGN_AFTER_BARRIER(LABEL) \
1463 (JUMP_ALIGN(LABEL) \
1464 ? JUMP_ALIGN(LABEL) \
1465 : GET_CODE (PATTERN (prev_active_insn (LABEL))) == ADDR_DIFF_VEC \
1467 /* The desired alignment for the location counter at the beginning
1469 /* On the ARC, align loops to 4 byte boundaries unless doing all-out size
1471 #define LOOP_ALIGN JUMP_ALIGN
1473 #define LABEL_ALIGN(LABEL) (arc_label_align (LABEL))
1475 /* This is how to output an assembler line
1476 that says to advance the location counter
1477 to a multiple of 2**LOG bytes. */
1478 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1480 if ((LOG) != 0) fprintf (FILE, "\t.align %d\n", 1 << (LOG)); \
1482 arc_clear_unalign (); \
1485 /* ASM_OUTPUT_ALIGNED_DECL_LOCAL (STREAM, DECL, NAME, SIZE, ALIGNMENT)
1486 Define this macro when you need to see the variable's decl in order to
1487 chose what to output. */
1488 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGNMENT) \
1489 arc_asm_output_aligned_decl_local (STREAM, DECL, NAME, SIZE, ALIGNMENT, 0)
1491 /* To translate the return value of arc_function_type into a register number
1492 to jump through for function return. */
1493 extern int arc_return_address_regs
[4];
1495 /* Debugging information. */
1497 /* Generate DBX and DWARF debugging information. */
1498 #ifdef DBX_DEBUGGING_INFO
1499 #undef DBX_DEBUGGING_INFO
1501 #define DBX_DEBUGGING_INFO
1503 #ifdef DWARF2_DEBUGGING_INFO
1504 #undef DWARF2_DEBUGGING_INFO
1506 #define DWARF2_DEBUGGING_INFO
1508 /* Prefer STABS (for now). */
1509 #undef PREFERRED_DEBUGGING_TYPE
1510 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
1512 /* How to renumber registers for dbx and gdb. */
1513 #define DBX_REGISTER_NUMBER(REGNO) \
1514 ((TARGET_MULMAC_32BY16_SET && (REGNO) >= 56 && (REGNO) <= 57) \
1515 ? ((REGNO) ^ !TARGET_BIG_ENDIAN) \
1516 : (TARGET_MUL64_SET && (REGNO) >= 57 && (REGNO) <= 59) \
1519 : ((REGNO) & 1) ^ TARGET_BIG_ENDIAN \
1521 : 57 + !!TARGET_MULMAC_32BY16_SET) /* MLO */ \
1524 #define DWARF_FRAME_REGNUM(REG) (REG)
1526 #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (31)
1528 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, 31)
1532 /* Define this macro to 0 if your target supports DWARF 2 frame unwind
1533 information, but it does not yet work with exception handling. */
1534 /* N.B. the below test is valid in an #if, but not in a C expression. */
1535 #if DEFAULT_LIBC == LIBC_UCLIBC
1536 #define DWARF2_UNWIND_INFO 1
1538 #define DWARF2_UNWIND_INFO 0
1541 #define EH_RETURN_DATA_REGNO(N) \
1542 ((N) < 4 ? (N) : INVALID_REGNUM)
1544 /* Turn off splitting of long stabs. */
1545 #define DBX_CONTIN_LENGTH 0
1547 /* Miscellaneous. */
1549 /* Specify the machine mode that this machine uses
1550 for the index in the tablejump instruction.
1551 If we have pc relative case vectors, we start the case vector shortening
1553 #define CASE_VECTOR_MODE \
1554 ((optimize && (CASE_VECTOR_PC_RELATIVE || flag_pic)) ? QImode : Pmode)
1556 /* Define as C expression which evaluates to nonzero if the tablejump
1557 instruction expects the table to contain offsets from the address of the
1559 Do not define this if the table should contain absolute addresses. */
1560 #define CASE_VECTOR_PC_RELATIVE TARGET_CASE_VECTOR_PC_RELATIVE
1562 #define CASE_VECTOR_SHORTEN_MODE(MIN_OFFSET, MAX_OFFSET, BODY) \
1563 CASE_VECTOR_SHORTEN_MODE_1 \
1564 (MIN_OFFSET, TARGET_COMPACT_CASESI ? MAX_OFFSET + 6 : MAX_OFFSET, BODY)
1566 #define CASE_VECTOR_SHORTEN_MODE_1(MIN_OFFSET, MAX_OFFSET, BODY) \
1567 ((MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 255 \
1568 ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 1, QImode) \
1569 : (MIN_OFFSET) >= -128 && (MAX_OFFSET) <= 127 \
1570 ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 0, QImode) \
1571 : (MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 65535 \
1572 ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 1, HImode) \
1573 : (MIN_OFFSET) >= -32768 && (MAX_OFFSET) <= 32767 \
1574 ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 0, HImode) \
1577 #define ADDR_VEC_ALIGN(VEC_INSN) \
1578 (exact_log2 (GET_MODE_SIZE (GET_MODE (PATTERN (VEC_INSN)))))
1579 #undef ASM_OUTPUT_BEFORE_CASE_LABEL
1580 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \
1581 ASM_OUTPUT_ALIGN ((FILE), ADDR_VEC_ALIGN (TABLE));
1583 #define INSN_LENGTH_ALIGNMENT(INSN) \
1585 && GET_CODE (PATTERN (INSN)) == ADDR_DIFF_VEC \
1586 && GET_MODE (PATTERN (INSN)) == QImode) \
1587 ? 0 : length_unit_log)
1589 /* Define if operations between registers always perform the operation
1590 on the full register even if a narrower mode is specified. */
1591 #define WORD_REGISTER_OPERATIONS 1
1593 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
1594 will either zero-extend or sign-extend. The value of this macro should
1595 be the code that says which one of the two operations is implicitly
1596 done, NIL if none. */
1597 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
1600 /* Max number of bytes we can move from memory to memory
1601 in one reasonably fast instruction. */
1604 /* Undo the effects of the movmem pattern presence on STORE_BY_PIECES_P . */
1605 #define MOVE_RATIO(SPEED) ((SPEED) ? 15 : 3)
1607 /* Define this to be nonzero if shift instructions ignore all but the low-order
1608 few bits. Changed from 1 to 0 for rotate pattern testcases
1609 (e.g. 20020226-1.c). This change truncates the upper 27 bits of a word
1610 while rotating a word. Came to notice through a combine phase
1611 optimization viz. a << (32-b) is equivalent to a << (-b).
1613 #define SHIFT_COUNT_TRUNCATED 0
1615 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1616 is done just by pretending it is already truncated. */
1617 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1619 /* We assume that the store-condition-codes instructions store 0 for false
1620 and some other value for true. This is the value stored for true. */
1621 #define STORE_FLAG_VALUE 1
1623 /* Specify the machine mode that pointers have.
1624 After generation of rtl, the compiler makes no further distinction
1625 between pointers and any other objects of this machine mode. */
1626 /* ARCompact has full 32-bit pointers. */
1627 #define Pmode SImode
1629 /* A function address in a call instruction. */
1630 #define FUNCTION_MODE SImode
1632 /* Define the information needed to generate branch and scc insns. This is
1633 stored from the compare operation. Note that we can't use "rtx" here
1634 since it hasn't been defined! */
1635 extern struct rtx_def
*arc_compare_op0
, *arc_compare_op1
;
1637 /* ARC function types. */
1638 enum arc_function_type
{
1639 ARC_FUNCTION_UNKNOWN
, ARC_FUNCTION_NORMAL
,
1640 /* These are interrupt handlers. The name corresponds to the register
1641 name that contains the return address. */
1642 ARC_FUNCTION_ILINK1
, ARC_FUNCTION_ILINK2
1644 #define ARC_INTERRUPT_P(TYPE) \
1645 ((TYPE) == ARC_FUNCTION_ILINK1 || (TYPE) == ARC_FUNCTION_ILINK2)
1647 /* Compute the type of a function from its DECL. Needed for EPILOGUE_USES. */
1649 extern enum arc_function_type
arc_compute_function_type (struct function
*);
1651 /* Called by crtstuff.c to make calls to function FUNCTION that are defined in
1652 SECTION_OP, and then to switch back to text section. */
1653 #undef CRT_CALL_STATIC_FUNCTION
1654 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
1655 asm (SECTION_OP "\n\t" \
1656 "bl @" USER_LABEL_PREFIX #FUNC "\n" \
1657 TEXT_SECTION_ASM_OP);
1659 /* This macro expands to the name of the scratch register r12, used for
1660 temporary calculations according to the ABI. */
1661 #define ARC_TEMP_SCRATCH_REG "r12"
1663 /* The C++ compiler must use one bit to indicate whether the function
1664 that will be called through a pointer-to-member-function is
1665 virtual. Normally, we assume that the low-order bit of a function
1666 pointer must always be zero. Then, by ensuring that the
1667 vtable_index is odd, we can distinguish which variant of the union
1668 is in use. But, on some platforms function pointers can be odd,
1669 and so this doesn't work. In that case, we use the low-order bit
1670 of the `delta' field, and shift the remainder of the `delta' field
1671 to the left. We needed to do this for A4 because the address was always
1672 shifted and thus could be odd. */
1673 #define TARGET_PTRMEMFUNC_VBIT_LOCATION \
1674 (ptrmemfunc_vbit_in_pfn)
1676 #define INSN_SETS_ARE_DELAYED(X) \
1677 (GET_CODE (X) == INSN \
1678 && GET_CODE (PATTERN (X)) != SEQUENCE \
1679 && GET_CODE (PATTERN (X)) != USE \
1680 && GET_CODE (PATTERN (X)) != CLOBBER \
1681 && (get_attr_type (X) == TYPE_CALL || get_attr_type (X) == TYPE_SFUNC))
1683 #define INSN_REFERENCES_ARE_DELAYED(insn) \
1684 (INSN_SETS_ARE_DELAYED (insn) && !insn_is_tls_gd_dispatch (insn))
1686 #define CALL_ATTR(X, NAME) \
1687 ((CALL_P (X) || NONJUMP_INSN_P (X)) \
1688 && GET_CODE (PATTERN (X)) != USE \
1689 && GET_CODE (PATTERN (X)) != CLOBBER \
1690 && get_attr_is_##NAME (X) == IS_##NAME##_YES) \
1692 #define REVERSE_CONDITION(CODE,MODE) \
1693 (((MODE) == CC_FP_GTmode || (MODE) == CC_FP_GEmode \
1694 || (MODE) == CC_FP_UNEQmode || (MODE) == CC_FP_ORDmode \
1695 || (MODE) == CC_FPXmode || (MODE) == CC_FPU_UNEQmode \
1696 || (MODE) == CC_FPUmode) \
1697 ? reverse_condition_maybe_unordered ((CODE)) \
1698 : reverse_condition ((CODE)))
1700 #define ADJUST_INSN_LENGTH(X, LENGTH) \
1702 = (GET_CODE (PATTERN (X)) == SEQUENCE \
1704 + arc_adjust_insn_length ( \
1705 as_a <rtx_sequence *> (PATTERN (X))->insn (0), \
1706 get_attr_length (as_a <rtx_sequence *> (PATTERN (X))->insn (0)), \
1708 - get_attr_length (as_a <rtx_sequence *> (PATTERN (X))->insn (0)) \
1709 + arc_adjust_insn_length ( \
1710 as_a <rtx_sequence *> (PATTERN (X))->insn (1), \
1711 get_attr_length (as_a <rtx_sequence *> (PATTERN (X))->insn (1)), \
1713 - get_attr_length (as_a <rtx_sequence *> (PATTERN (X))->insn (1))) \
1714 : arc_adjust_insn_length ((X), (LENGTH), false)))
1716 #define IS_ASM_LOGICAL_LINE_SEPARATOR(C,STR) ((C) == '`')
1718 #define INIT_EXPANDERS arc_init_expanders ()
1720 #define CFA_FRAME_BASE_OFFSET(FUNDECL) (-arc_decl_pretend_args ((FUNDECL)))
1722 #define ARG_POINTER_CFA_OFFSET(FNDECL) \
1723 (FIRST_PARM_OFFSET (FNDECL) + arc_decl_pretend_args ((FNDECL)))
1727 ARC_LRA_PRIORITY_NONE
, ARC_LRA_PRIORITY_NONCOMPACT
, ARC_LRA_PRIORITY_COMPACT
1730 /* The define_cond_exec construct is rather crude, as we can't have
1731 different ones with different conditions apply to different sets
1732 of instructions. We can't use an attribute test inside the condition,
1733 because that would lead to infinite recursion as the attribute test
1734 needs to recognize the insn. So, instead we have a clause for
1735 the pattern condition of all sfunc patterns which is only relevant for
1736 the predicated varaint. */
1737 #define SFUNC_CHECK_PREDICABLE \
1738 (GET_CODE (PATTERN (insn)) != COND_EXEC || !flag_pic || !TARGET_MEDIUM_CALLS)
1740 /* MPYW feature macro. Only valid for ARCHS and ARCEM cores. */
1741 #define TARGET_MPYW ((arc_mpy_option > 0) && TARGET_V2)
1742 /* Full ARCv2 multiplication feature macro. */
1743 #define TARGET_MULTI ((arc_mpy_option > 1) && TARGET_V2)
1744 /* General MPY feature macro. */
1745 #define TARGET_MPY ((TARGET_ARC700 && (!TARGET_NOMPY_SET)) || TARGET_MULTI)
1746 /* ARC700 MPY feature macro. */
1747 #define TARGET_ARC700_MPY (TARGET_ARC700 && (!TARGET_NOMPY_SET))
1748 /* Any multiplication feature macro. */
1749 #define TARGET_ANY_MPY \
1750 (TARGET_MPY || TARGET_MUL64_SET || TARGET_MULMAC_32BY16_SET)
1751 /* PLUS_DMPY feature macro. */
1752 #define TARGET_PLUS_DMPY ((arc_mpy_option > 6) && TARGET_HS)
1753 /* PLUS_MACD feature macro. */
1754 #define TARGET_PLUS_MACD ((arc_mpy_option > 7) && TARGET_HS)
1755 /* PLUS_QMACW feature macro. */
1756 #define TARGET_PLUS_QMACW ((arc_mpy_option > 8) && TARGET_HS)
1758 /* ARC600 and ARC601 feature macro. */
1759 #define TARGET_ARC600_FAMILY (TARGET_ARC600 || TARGET_ARC601)
1760 /* ARC600, ARC601 and ARC700 feature macro. */
1761 #define TARGET_ARCOMPACT_FAMILY \
1762 (TARGET_ARC600 || TARGET_ARC601 || TARGET_ARC700)
1763 /* Loop count register can be read in very next instruction after has
1764 been written to by an ordinary instruction. */
1765 #define TARGET_LP_WR_INTERLOCK (!TARGET_ARC600_FAMILY)
1768 /* Any FPU support. */
1769 #define TARGET_HARD_FLOAT (arc_fpu_build != 0)
1770 /* Single precision floating point support. */
1771 #define TARGET_FP_SP_BASE ((arc_fpu_build & FPU_SP) != 0)
1772 /* Double precision floating point support. */
1773 #define TARGET_FP_DP_BASE ((arc_fpu_build & FPU_DP) != 0)
1774 /* Single precision floating point support with fused operation. */
1775 #define TARGET_FP_SP_FUSED ((arc_fpu_build & FPU_SF) != 0)
1776 /* Double precision floating point support with fused operation. */
1777 #define TARGET_FP_DP_FUSED ((arc_fpu_build & FPU_DF) != 0)
1778 /* Single precision floating point conversion instruction support. */
1779 #define TARGET_FP_SP_CONV ((arc_fpu_build & FPU_SC) != 0)
1780 /* Double precision floating point conversion instruction support. */
1781 #define TARGET_FP_DP_CONV ((arc_fpu_build & FPU_DC) != 0)
1782 /* Single precision floating point SQRT/DIV instruction support. */
1783 #define TARGET_FP_SP_SQRT ((arc_fpu_build & FPU_SD) != 0)
1784 /* Double precision floating point SQRT/DIV instruction support. */
1785 #define TARGET_FP_DP_SQRT ((arc_fpu_build & FPU_DD) != 0)
1786 /* Double precision floating point assist instruction support. */
1787 #define TARGET_FP_DP_AX ((arc_fpu_build & FPX_DP) != 0)
1789 #endif /* GCC_ARC_H */