]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/arm/arm.h
re PR fortran/30940 (Fortran 2003: Scalar CHARACTER supplied to array dummy)
[thirdparty/gcc.git] / gcc / config / arm / arm.h
CommitLineData
f5a1b0d2 1/* Definitions of target machine for GNU compiler, for ARM.
cf011243 2 Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
5b3e6663 3 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
35d965d5 4 Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
8b109b37 5 and Martin Simmons (@harleqn.co.uk).
949d79eb 6 More major hacks by Richard Earnshaw (rearnsha@arm.com)
6cfc7210
NC
7 Minor hacks by Nick Clifton (nickc@cygnus.com)
8
4f448245 9 This file is part of GCC.
35d965d5 10
4f448245
NC
11 GCC is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published
13 by the Free Software Foundation; either version 2, or (at your
14 option) any later version.
35d965d5 15
4f448245
NC
16 GCC is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19 License for more details.
35d965d5 20
4f448245
NC
21 You should have received a copy of the GNU General Public License
22 along with GCC; see the file COPYING. If not, write to
39d14dda
KC
23 the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
24 MA 02110-1301, USA. */
35d965d5 25
88657302
RH
26#ifndef GCC_ARM_H
27#define GCC_ARM_H
b355a481 28
9403b7f7
RS
29#include "config/vxworks-dummy.h"
30
35fd3193 31/* The architecture define. */
78011587
PB
32extern char arm_arch_name[];
33
e6471be6
NB
34/* Target CPU builtins. */
35#define TARGET_CPU_CPP_BUILTINS() \
36 do \
37 { \
9b66ebb1
PB
38 /* Define __arm__ even when in thumb mode, for \
39 consistency with armcc. */ \
40 builtin_define ("__arm__"); \
61f0ccff 41 builtin_define ("__APCS_32__"); \
9b66ebb1 42 if (TARGET_THUMB) \
e6471be6 43 builtin_define ("__thumb__"); \
5b3e6663
PB
44 if (TARGET_THUMB2) \
45 builtin_define ("__thumb2__"); \
e6471be6
NB
46 \
47 if (TARGET_BIG_END) \
48 { \
49 builtin_define ("__ARMEB__"); \
50 if (TARGET_THUMB) \
51 builtin_define ("__THUMBEB__"); \
52 if (TARGET_LITTLE_WORDS) \
53 builtin_define ("__ARMWEL__"); \
54 } \
55 else \
56 { \
57 builtin_define ("__ARMEL__"); \
58 if (TARGET_THUMB) \
59 builtin_define ("__THUMBEL__"); \
60 } \
61 \
e6471be6
NB
62 if (TARGET_SOFT_FLOAT) \
63 builtin_define ("__SOFTFP__"); \
64 \
9b66ebb1 65 if (TARGET_VFP) \
b5b620a4
JT
66 builtin_define ("__VFP_FP__"); \
67 \
e6471be6
NB
68 /* Add a define for interworking. \
69 Needed when building libgcc.a. */ \
2ad4dcf9 70 if (arm_cpp_interwork) \
e6471be6
NB
71 builtin_define ("__THUMB_INTERWORK__"); \
72 \
73 builtin_assert ("cpu=arm"); \
74 builtin_assert ("machine=arm"); \
78011587
PB
75 \
76 builtin_define (arm_arch_name); \
77 if (arm_arch_cirrus) \
78 builtin_define ("__MAVERICK__"); \
79 if (arm_arch_xscale) \
80 builtin_define ("__XSCALE__"); \
81 if (arm_arch_iwmmxt) \
82 builtin_define ("__IWMMXT__"); \
4adf3e34
PB
83 if (TARGET_AAPCS_BASED) \
84 builtin_define ("__ARM_EABI__"); \
e6471be6
NB
85 } while (0)
86
9b66ebb1
PB
87/* The various ARM cores. */
88enum processor_type
89{
d98a72fd
RE
90#define ARM_CORE(NAME, IDENT, ARCH, FLAGS, COSTS) \
91 IDENT,
9b66ebb1
PB
92#include "arm-cores.def"
93#undef ARM_CORE
94 /* Used to indicate that no processor has been specified. */
95 arm_none
96};
97
78011587
PB
98enum target_cpus
99{
d98a72fd
RE
100#define ARM_CORE(NAME, IDENT, ARCH, FLAGS, COSTS) \
101 TARGET_CPU_##IDENT,
78011587
PB
102#include "arm-cores.def"
103#undef ARM_CORE
104 TARGET_CPU_generic
105};
106
9b66ebb1
PB
107/* The processor for which instructions should be scheduled. */
108extern enum processor_type arm_tune;
109
d5b7b3ae 110typedef enum arm_cond_code
89c7ca52
RE
111{
112 ARM_EQ = 0, ARM_NE, ARM_CS, ARM_CC, ARM_MI, ARM_PL, ARM_VS, ARM_VC,
113 ARM_HI, ARM_LS, ARM_GE, ARM_LT, ARM_GT, ARM_LE, ARM_AL, ARM_NV
d5b7b3ae
RE
114}
115arm_cc;
6cfc7210 116
d5b7b3ae 117extern arm_cc arm_current_cc;
ff9940b0 118
d5b7b3ae 119#define ARM_INVERSE_CONDITION_CODE(X) ((arm_cc) (((int)X) ^ 1))
89c7ca52 120
6cfc7210
NC
121extern int arm_target_label;
122extern int arm_ccfsm_state;
e2500fed 123extern GTY(()) rtx arm_target_insn;
d5b7b3ae 124/* Define the information needed to generate branch insns. This is
e2500fed
GK
125 stored from the compare operation. */
126extern GTY(()) rtx arm_compare_op0;
127extern GTY(()) rtx arm_compare_op1;
d5b7b3ae 128/* The label of the current constant pool. */
e2500fed 129extern rtx pool_vector_label;
d5b7b3ae 130/* Set to 1 when a return insn is output, this means that the epilogue
d6b4baa4 131 is not needed. */
d5b7b3ae 132extern int return_used_this_function;
e2500fed
GK
133/* Used to produce AOF syntax assembler. */
134extern GTY(()) rtx aof_pic_label;
35d965d5 135\f
d6b4baa4 136/* Just in case configure has failed to define anything. */
7a801826
RE
137#ifndef TARGET_CPU_DEFAULT
138#define TARGET_CPU_DEFAULT TARGET_CPU_generic
139#endif
140
7a801826 141
5742588d 142#undef CPP_SPEC
78011587 143#define CPP_SPEC "%(subtarget_cpp_spec) \
e6471be6
NB
144%{msoft-float:%{mhard-float: \
145 %e-msoft-float and -mhard_float may not be used together}} \
146%{mbig-endian:%{mlittle-endian: \
147 %e-mbig-endian and -mlittle-endian may not be used together}}"
7a801826 148
be393ecf 149#ifndef CC1_SPEC
dfa08768 150#define CC1_SPEC ""
be393ecf 151#endif
7a801826
RE
152
153/* This macro defines names of additional specifications to put in the specs
154 that can be used in various specifications like CC1_SPEC. Its definition
155 is an initializer with a subgrouping for each command option.
156
157 Each subgrouping contains a string constant, that defines the
4f448245 158 specification name, and a string constant that used by the GCC driver
7a801826
RE
159 program.
160
161 Do not define this macro if it does not need to do anything. */
162#define EXTRA_SPECS \
38fc909b 163 { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \
7a801826
RE
164 SUBTARGET_EXTRA_SPECS
165
914a3b8c 166#ifndef SUBTARGET_EXTRA_SPECS
7a801826 167#define SUBTARGET_EXTRA_SPECS
914a3b8c
DM
168#endif
169
6cfc7210 170#ifndef SUBTARGET_CPP_SPEC
38fc909b 171#define SUBTARGET_CPP_SPEC ""
6cfc7210 172#endif
35d965d5
RS
173\f
174/* Run-time Target Specification. */
ff9940b0 175#ifndef TARGET_VERSION
6cfc7210 176#define TARGET_VERSION fputs (" (ARM/generic)", stderr);
ff9940b0 177#endif
35d965d5 178
9b66ebb1 179#define TARGET_SOFT_FLOAT (arm_float_abi == ARM_FLOAT_ABI_SOFT)
72cdc543
PB
180/* Use hardware floating point instructions. */
181#define TARGET_HARD_FLOAT (arm_float_abi != ARM_FLOAT_ABI_SOFT)
182/* Use hardware floating point calling convention. */
183#define TARGET_HARD_FLOAT_ABI (arm_float_abi == ARM_FLOAT_ABI_HARD)
9b66ebb1
PB
184#define TARGET_FPA (arm_fp_model == ARM_FP_MODEL_FPA)
185#define TARGET_MAVERICK (arm_fp_model == ARM_FP_MODEL_MAVERICK)
186#define TARGET_VFP (arm_fp_model == ARM_FP_MODEL_VFP)
5a9335ef 187#define TARGET_IWMMXT (arm_arch_iwmmxt)
5b3e6663
PB
188#define TARGET_REALLY_IWMMXT (TARGET_IWMMXT && TARGET_32BIT)
189#define TARGET_IWMMXT_ABI (TARGET_32BIT && arm_abi == ARM_ABI_IWMMXT)
d5b7b3ae
RE
190#define TARGET_ARM (! TARGET_THUMB)
191#define TARGET_EITHER 1 /* (TARGET_ARM | TARGET_THUMB) */
c54c7322
RS
192#define TARGET_BACKTRACE (leaf_function_p () \
193 ? TARGET_TPCS_LEAF_FRAME \
194 : TARGET_TPCS_FRAME)
fdd695fd 195#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN)
b6685939
PB
196#define TARGET_AAPCS_BASED \
197 (arm_abi != ARM_ABI_APCS && arm_abi != ARM_ABI_ATPCS)
3ada8e17 198
d3585b76
DJ
199#define TARGET_HARD_TP (target_thread_pointer == TP_CP15)
200#define TARGET_SOFT_TP (target_thread_pointer == TP_SOFT)
201
5b3e6663
PB
202/* Only 16-bit thumb code. */
203#define TARGET_THUMB1 (TARGET_THUMB && !arm_arch_thumb2)
204/* Arm or Thumb-2 32-bit code. */
205#define TARGET_32BIT (TARGET_ARM || arm_arch_thumb2)
206/* 32-bit Thumb-2 code. */
207#define TARGET_THUMB2 (TARGET_THUMB && arm_arch_thumb2)
208
209/* "DSP" multiply instructions, eg. SMULxy. */
210#define TARGET_DSP_MULTIPLY \
211 (TARGET_32BIT && arm_arch5e && arm_arch_notm)
212/* Integer SIMD instructions, and extend-accumulate instructions. */
213#define TARGET_INT_SIMD \
214 (TARGET_32BIT && arm_arch6 && arm_arch_notm)
215
216/* We could use unified syntax for arm mode, but for now we just use it
217 for Thumb-2. */
218#define TARGET_UNIFIED_ASM TARGET_THUMB2
219
220
b3f8d95d
MM
221/* True iff the full BPABI is being used. If TARGET_BPABI is true,
222 then TARGET_AAPCS_BASED must be true -- but the converse does not
223 hold. TARGET_BPABI implies the use of the BPABI runtime library,
224 etc., in addition to just the AAPCS calling conventions. */
225#ifndef TARGET_BPABI
226#define TARGET_BPABI false
f676971a 227#endif
b3f8d95d 228
7816bea0
DJ
229/* Support for a compile-time default CPU, et cetera. The rules are:
230 --with-arch is ignored if -march or -mcpu are specified.
231 --with-cpu is ignored if -march or -mcpu are specified, and is overridden
232 by --with-arch.
233 --with-tune is ignored if -mtune or -mcpu are specified (but not affected
234 by -march).
9b66ebb1
PB
235 --with-float is ignored if -mhard-float, -msoft-float or -mfloat-abi are
236 specified.
5848830f
PB
237 --with-fpu is ignored if -mfpu is specified.
238 --with-abi is ignored is -mabi is specified. */
7816bea0
DJ
239#define OPTION_DEFAULT_SPECS \
240 {"arch", "%{!march=*:%{!mcpu=*:-march=%(VALUE)}}" }, \
241 {"cpu", "%{!march=*:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
242 {"tune", "%{!mcpu=*:%{!mtune=*:-mtune=%(VALUE)}}" }, \
9b66ebb1
PB
243 {"float", \
244 "%{!msoft-float:%{!mhard-float:%{!mfloat-abi=*:-mfloat-abi=%(VALUE)}}}" }, \
5848830f 245 {"fpu", "%{!mfpu=*:-mfpu=%(VALUE)}"}, \
3cf94279
PB
246 {"abi", "%{!mabi=*:-mabi=%(VALUE)}"}, \
247 {"mode", "%{!marm:%{!mthumb:-m%(VALUE)}}"},
7816bea0 248
9b66ebb1
PB
249/* Which floating point model to use. */
250enum arm_fp_model
251{
252 ARM_FP_MODEL_UNKNOWN,
253 /* FPA model (Hardware or software). */
254 ARM_FP_MODEL_FPA,
255 /* Cirrus Maverick floating point model. */
256 ARM_FP_MODEL_MAVERICK,
257 /* VFP floating point model. */
258 ARM_FP_MODEL_VFP
259};
260
261extern enum arm_fp_model arm_fp_model;
262
263/* Which floating point hardware is available. Also update
264 fp_model_for_fpu in arm.c when adding entries to this list. */
29ad9694 265enum fputype
24f0c1b4 266{
9b66ebb1
PB
267 /* No FP hardware. */
268 FPUTYPE_NONE,
29ad9694
RE
269 /* Full FPA support. */
270 FPUTYPE_FPA,
271 /* Emulated FPA hardware, Issue 2 emulator (no LFM/SFM). */
272 FPUTYPE_FPA_EMU2,
273 /* Emulated FPA hardware, Issue 3 emulator. */
274 FPUTYPE_FPA_EMU3,
275 /* Cirrus Maverick floating point co-processor. */
9b66ebb1
PB
276 FPUTYPE_MAVERICK,
277 /* VFP. */
278 FPUTYPE_VFP
24f0c1b4
RE
279};
280
281/* Recast the floating point class to be the floating point attribute. */
29ad9694 282#define arm_fpu_attr ((enum attr_fpu) arm_fpu_tune)
24f0c1b4 283
71791e16 284/* What type of floating point to tune for */
29ad9694 285extern enum fputype arm_fpu_tune;
24f0c1b4 286
71791e16 287/* What type of floating point instructions are available */
29ad9694 288extern enum fputype arm_fpu_arch;
71791e16 289
9b66ebb1
PB
290enum float_abi_type
291{
292 ARM_FLOAT_ABI_SOFT,
293 ARM_FLOAT_ABI_SOFTFP,
294 ARM_FLOAT_ABI_HARD
295};
296
297extern enum float_abi_type arm_float_abi;
298
3d8532aa
PB
299#ifndef TARGET_DEFAULT_FLOAT_ABI
300#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
301#endif
302
5848830f
PB
303/* Which ABI to use. */
304enum arm_abi_type
305{
306 ARM_ABI_APCS,
307 ARM_ABI_ATPCS,
308 ARM_ABI_AAPCS,
077fc835
KH
309 ARM_ABI_IWMMXT,
310 ARM_ABI_AAPCS_LINUX
5848830f
PB
311};
312
313extern enum arm_abi_type arm_abi;
314
315#ifndef ARM_DEFAULT_ABI
316#define ARM_DEFAULT_ABI ARM_ABI_APCS
317#endif
318
d3585b76
DJ
319/* Which thread pointer access sequence to use. */
320enum arm_tp_type {
321 TP_AUTO,
322 TP_SOFT,
323 TP_CP15
324};
325
326extern enum arm_tp_type target_thread_pointer;
327
9b66ebb1
PB
328/* Nonzero if this chip supports the ARM Architecture 3M extensions. */
329extern int arm_arch3m;
11c1a207 330
9b66ebb1 331/* Nonzero if this chip supports the ARM Architecture 4 extensions. */
11c1a207
RE
332extern int arm_arch4;
333
68d560d4
RE
334/* Nonzero if this chip supports the ARM Architecture 4T extensions. */
335extern int arm_arch4t;
336
9b66ebb1 337/* Nonzero if this chip supports the ARM Architecture 5 extensions. */
62b10bbc
NC
338extern int arm_arch5;
339
9b66ebb1 340/* Nonzero if this chip supports the ARM Architecture 5E extensions. */
b15bca31
RE
341extern int arm_arch5e;
342
9b66ebb1
PB
343/* Nonzero if this chip supports the ARM Architecture 6 extensions. */
344extern int arm_arch6;
345
5b3e6663
PB
346/* Nonzero if instructions not present in the 'M' profile can be used. */
347extern int arm_arch_notm;
348
f5a1b0d2
NC
349/* Nonzero if this chip can benefit from load scheduling. */
350extern int arm_ld_sched;
351
0616531f
RE
352/* Nonzero if generating thumb code. */
353extern int thumb_code;
354
f5a1b0d2 355/* Nonzero if this chip is a StrongARM. */
abac3b49 356extern int arm_tune_strongarm;
f5a1b0d2 357
9b6b54e2 358/* Nonzero if this chip is a Cirrus variant. */
78011587 359extern int arm_arch_cirrus;
9b6b54e2 360
5a9335ef
NC
361/* Nonzero if this chip supports Intel XScale with Wireless MMX technology. */
362extern int arm_arch_iwmmxt;
363
d19fb8e3 364/* Nonzero if this chip is an XScale. */
4b3c2e48
PB
365extern int arm_arch_xscale;
366
abac3b49 367/* Nonzero if tuning for XScale. */
4b3c2e48 368extern int arm_tune_xscale;
d19fb8e3 369
abac3b49
RE
370/* Nonzero if tuning for stores via the write buffer. */
371extern int arm_tune_wbuf;
f5a1b0d2 372
2ad4dcf9 373/* Nonzero if we should define __THUMB_INTERWORK__ in the
f676971a 374 preprocessor.
2ad4dcf9
RE
375 XXX This is a bit of a hack, it's intended to help work around
376 problems in GLD which doesn't understand that armv5t code is
377 interworking clean. */
378extern int arm_cpp_interwork;
379
5b3e6663
PB
380/* Nonzero if chip supports Thumb 2. */
381extern int arm_arch_thumb2;
382
383/* Nonzero if chip supports integer division instruction. */
384extern int arm_arch_hwdiv;
385
2ce9c1b9 386#ifndef TARGET_DEFAULT
c54c7322 387#define TARGET_DEFAULT (MASK_APCS_FRAME)
2ce9c1b9 388#endif
35d965d5 389
11c1a207
RE
390/* The frame pointer register used in gcc has nothing to do with debugging;
391 that is controlled by the APCS-FRAME option. */
d5b7b3ae 392#define CAN_DEBUG_WITHOUT_FP
35d965d5 393
11c1a207 394#define OVERRIDE_OPTIONS arm_override_options ()
86efdc8e
PB
395
396/* Nonzero if PIC code requires explicit qualifiers to generate
397 PLT and GOT relocs rather than the assembler doing so implicitly.
ed0e6530
PB
398 Subtargets can override these if required. */
399#ifndef NEED_GOT_RELOC
400#define NEED_GOT_RELOC 0
401#endif
402#ifndef NEED_PLT_RELOC
403#define NEED_PLT_RELOC 0
e2723c62 404#endif
84306176
PB
405
406/* Nonzero if we need to refer to the GOT with a PC-relative
407 offset. In other words, generate
408
f676971a 409 .word _GLOBAL_OFFSET_TABLE_ - [. - (.Lxx + 8)]
84306176
PB
410
411 rather than
412
413 .word _GLOBAL_OFFSET_TABLE_ - (.Lxx + 8)
414
f676971a 415 The default is true, which matches NetBSD. Subtargets can
84306176
PB
416 override this if required. */
417#ifndef GOT_PCREL
418#define GOT_PCREL 1
419#endif
35d965d5
RS
420\f
421/* Target machine storage Layout. */
422
ff9940b0
RE
423
424/* Define this macro if it is advisable to hold scalars in registers
425 in a wider mode than that declared by the program. In such cases,
426 the value is constrained to be within the bounds of the declared
427 type, but kept valid in the wider mode. The signedness of the
428 extension may differ from that of the type. */
429
430/* It is far faster to zero extend chars than to sign extend them */
431
6cfc7210 432#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
2ce9c1b9
RE
433 if (GET_MODE_CLASS (MODE) == MODE_INT \
434 && GET_MODE_SIZE (MODE) < 4) \
435 { \
436 if (MODE == QImode) \
437 UNSIGNEDP = 1; \
438 else if (MODE == HImode) \
61f0ccff 439 UNSIGNEDP = 1; \
2ce9c1b9 440 (MODE) = SImode; \
ff9940b0
RE
441 }
442
d4453b7a 443#define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \
866af8a9
JB
444 if ((GET_MODE_CLASS (MODE) == MODE_INT \
445 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT) \
446 && GET_MODE_SIZE (MODE) < 4) \
447 (MODE) = SImode; \
d4453b7a 448
35d965d5
RS
449/* Define this if most significant bit is lowest numbered
450 in instructions that operate on numbered bit-fields. */
451#define BITS_BIG_ENDIAN 0
452
f676971a 453/* Define this if most significant byte of a word is the lowest numbered.
3ada8e17
DE
454 Most ARM processors are run in little endian mode, so that is the default.
455 If you want to have it run-time selectable, change the definition in a
456 cover file to be TARGET_BIG_ENDIAN. */
11c1a207 457#define BYTES_BIG_ENDIAN (TARGET_BIG_END != 0)
35d965d5
RS
458
459/* Define this if most significant word of a multiword number is the lowest
11c1a207
RE
460 numbered.
461 This is always false, even when in big-endian mode. */
ddee6aba
RE
462#define WORDS_BIG_ENDIAN (BYTES_BIG_ENDIAN && ! TARGET_LITTLE_WORDS)
463
464/* LIBGCC2_WORDS_BIG_ENDIAN has to be a constant, so we define this based
465 on processor pre-defineds when compiling libgcc2.c. */
466#if defined(__ARMEB__) && !defined(__ARMWEL__)
467#define LIBGCC2_WORDS_BIG_ENDIAN 1
468#else
469#define LIBGCC2_WORDS_BIG_ENDIAN 0
470#endif
35d965d5 471
11c1a207 472/* Define this if most significant word of doubles is the lowest numbered.
f0375c66
NC
473 The rules are different based on whether or not we use FPA-format,
474 VFP-format or some other floating point co-processor's format doubles. */
b5b620a4 475#define FLOAT_WORDS_BIG_ENDIAN (arm_float_words_big_endian ())
7fc6c9f0 476
35d965d5
RS
477#define UNITS_PER_WORD 4
478
5848830f 479/* True if natural alignment is used for doubleword types. */
b6685939
PB
480#define ARM_DOUBLEWORD_ALIGN TARGET_AAPCS_BASED
481
5848830f 482#define DOUBLEWORD_ALIGNMENT 64
35d965d5 483
5848830f 484#define PARM_BOUNDARY 32
5a9335ef 485
5848830f 486#define STACK_BOUNDARY (ARM_DOUBLEWORD_ALIGN ? DOUBLEWORD_ALIGNMENT : 32)
35d965d5 487
5848830f
PB
488#define PREFERRED_STACK_BOUNDARY \
489 (arm_abi == ARM_ABI_ATPCS ? 64 : STACK_BOUNDARY)
0977774b 490
35d965d5
RS
491#define FUNCTION_BOUNDARY 32
492
92928d71
AO
493/* The lowest bit is used to indicate Thumb-mode functions, so the
494 vbit must go into the delta field of pointers to member
495 functions. */
496#define TARGET_PTRMEMFUNC_VBIT_LOCATION ptrmemfunc_vbit_in_delta
497
35d965d5
RS
498#define EMPTY_FIELD_BOUNDARY 32
499
5848830f 500#define BIGGEST_ALIGNMENT (ARM_DOUBLEWORD_ALIGN ? DOUBLEWORD_ALIGNMENT : 32)
5a9335ef 501
27847754
NC
502/* XXX Blah -- this macro is used directly by libobjc. Since it
503 supports no vector modes, cut out the complexity and fall back
504 on BIGGEST_FIELD_ALIGNMENT. */
505#ifdef IN_TARGET_LIBS
8fca31a2 506#define BIGGEST_FIELD_ALIGNMENT 64
27847754 507#endif
5a9335ef 508
ff9940b0 509/* Make strings word-aligned so strcpy from constants will be faster. */
591af218 510#define CONSTANT_ALIGNMENT_FACTOR (TARGET_THUMB || ! arm_tune_xscale ? 1 : 2)
f676971a 511
d19fb8e3 512#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
5848830f 513 ((TREE_CODE (EXP) == STRING_CST \
36b15ad0 514 && !optimize_size \
5848830f
PB
515 && (ALIGN) < BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR) \
516 ? BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR : (ALIGN))
ff9940b0 517
723ae7c1
NC
518/* Setting STRUCTURE_SIZE_BOUNDARY to 32 produces more efficient code, but the
519 value set in previous versions of this toolchain was 8, which produces more
520 compact structures. The command line option -mstructure_size_boundary=<n>
f710504c 521 can be used to change this value. For compatibility with the ARM SDK
723ae7c1 522 however the value should be left at 32. ARM SDT Reference Manual (ARM DUI
5848830f
PB
523 0020D) page 2-20 says "Structures are aligned on word boundaries".
524 The AAPCS specifies a value of 8. */
6ead9ba5
NC
525#define STRUCTURE_SIZE_BOUNDARY arm_structure_size_boundary
526extern int arm_structure_size_boundary;
723ae7c1 527
4912a07c 528/* This is the value used to initialize arm_structure_size_boundary. If a
723ae7c1 529 particular arm target wants to change the default value it should change
6bc82793 530 the definition of this macro, not STRUCTURE_SIZE_BOUNDARY. See netbsd.h
723ae7c1
NC
531 for an example of this. */
532#ifndef DEFAULT_STRUCTURE_SIZE_BOUNDARY
533#define DEFAULT_STRUCTURE_SIZE_BOUNDARY 32
b355a481 534#endif
2a5307b1 535
825dda42 536/* Nonzero if move instructions will actually fail to work
ff9940b0 537 when given unaligned data. */
35d965d5 538#define STRICT_ALIGNMENT 1
b6685939
PB
539
540/* wchar_t is unsigned under the AAPCS. */
541#ifndef WCHAR_TYPE
542#define WCHAR_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "int")
543
544#define WCHAR_TYPE_SIZE BITS_PER_WORD
545#endif
546
547#ifndef SIZE_TYPE
548#define SIZE_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "long unsigned int")
549#endif
d81d0bdd 550
077fc835
KH
551#ifndef PTRDIFF_TYPE
552#define PTRDIFF_TYPE (TARGET_AAPCS_BASED ? "int" : "long int")
553#endif
554
d81d0bdd
PB
555/* AAPCS requires that structure alignment is affected by bitfields. */
556#ifndef PCC_BITFIELD_TYPE_MATTERS
557#define PCC_BITFIELD_TYPE_MATTERS TARGET_AAPCS_BASED
558#endif
559
35d965d5
RS
560\f
561/* Standard register usage. */
562
563/* Register allocation in ARM Procedure Call Standard (as used on RISCiX):
564 (S - saved over call).
565
566 r0 * argument word/integer result
567 r1-r3 argument word
568
569 r4-r8 S register variable
570 r9 S (rfp) register variable (real frame pointer)
f676971a 571
f5a1b0d2 572 r10 F S (sl) stack limit (used by -mapcs-stack-check)
35d965d5
RS
573 r11 F S (fp) argument pointer
574 r12 (ip) temp workspace
575 r13 F S (sp) lower end of current stack frame
576 r14 (lr) link address/workspace
577 r15 F (pc) program counter
578
579 f0 floating point result
580 f1-f3 floating point scratch
581
582 f4-f7 S floating point variable
583
ff9940b0
RE
584 cc This is NOT a real register, but is used internally
585 to represent things that use or set the condition
586 codes.
587 sfp This isn't either. It is used during rtl generation
588 since the offset between the frame pointer and the
589 auto's isn't known until after register allocation.
590 afp Nor this, we only need this because of non-local
591 goto. Without it fp appears to be used and the
592 elimination code won't get rid of sfp. It tracks
593 fp exactly at all times.
594
35d965d5
RS
595 *: See CONDITIONAL_REGISTER_USAGE */
596
9b6b54e2
NC
597/*
598 mvf0 Cirrus floating point result
599 mvf1-mvf3 Cirrus floating point scratch
600 mvf4-mvf15 S Cirrus floating point variable. */
601
9b66ebb1
PB
602/* s0-s15 VFP scratch (aka d0-d7).
603 s16-s31 S VFP variable (aka d8-d15).
604 vfpcc Not a real register. Represents the VFP condition
605 code flags. */
606
ff9940b0
RE
607/* The stack backtrace structure is as follows:
608 fp points to here: | save code pointer | [fp]
609 | return link value | [fp, #-4]
610 | return sp value | [fp, #-8]
611 | return fp value | [fp, #-12]
612 [| saved r10 value |]
613 [| saved r9 value |]
614 [| saved r8 value |]
615 [| saved r7 value |]
616 [| saved r6 value |]
617 [| saved r5 value |]
618 [| saved r4 value |]
619 [| saved r3 value |]
620 [| saved r2 value |]
621 [| saved r1 value |]
622 [| saved r0 value |]
623 [| saved f7 value |] three words
624 [| saved f6 value |] three words
625 [| saved f5 value |] three words
626 [| saved f4 value |] three words
627 r0-r3 are not normally saved in a C function. */
628
35d965d5
RS
629/* 1 for registers that have pervasive standard uses
630 and are not available for the register allocator. */
9b66ebb1
PB
631#define FIXED_REGISTERS \
632{ \
633 0,0,0,0,0,0,0,0, \
634 0,0,0,0,0,1,0,1, \
635 0,0,0,0,0,0,0,0, \
9b6b54e2
NC
636 1,1,1, \
637 1,1,1,1,1,1,1,1, \
9b66ebb1
PB
638 1,1,1,1,1,1,1,1, \
639 1,1,1,1,1,1,1,1, \
640 1,1,1,1,1,1,1,1, \
641 1,1,1,1, \
642 1,1,1,1,1,1,1,1, \
643 1,1,1,1,1,1,1,1, \
644 1,1,1,1,1,1,1,1, \
645 1,1,1,1,1,1,1,1, \
646 1 \
35d965d5
RS
647}
648
649/* 1 for registers not available across function calls.
650 These must include the FIXED_REGISTERS and also any
651 registers that can be used without being saved.
652 The latter must include the registers where values are returned
653 and the register where structure-value addresses are passed.
ff9940b0 654 Aside from that, you can include as many other registers as you like.
f676971a 655 The CC is not preserved over function calls on the ARM 6, so it is
d6b4baa4 656 easier to assume this for all. SFP is preserved, since FP is. */
35d965d5
RS
657#define CALL_USED_REGISTERS \
658{ \
659 1,1,1,1,0,0,0,0, \
d5b7b3ae 660 0,0,0,0,1,1,1,1, \
ff9940b0 661 1,1,1,1,0,0,0,0, \
9b6b54e2
NC
662 1,1,1, \
663 1,1,1,1,1,1,1,1, \
5a9335ef
NC
664 1,1,1,1,1,1,1,1, \
665 1,1,1,1,1,1,1,1, \
666 1,1,1,1,1,1,1,1, \
9b66ebb1
PB
667 1,1,1,1, \
668 1,1,1,1,1,1,1,1, \
669 1,1,1,1,1,1,1,1, \
670 1,1,1,1,1,1,1,1, \
671 1,1,1,1,1,1,1,1, \
672 1 \
35d965d5
RS
673}
674
6cc8c0b3
NC
675#ifndef SUBTARGET_CONDITIONAL_REGISTER_USAGE
676#define SUBTARGET_CONDITIONAL_REGISTER_USAGE
677#endif
678
d5b7b3ae
RE
679#define CONDITIONAL_REGISTER_USAGE \
680{ \
4b02997f
NC
681 int regno; \
682 \
5b3e6663 683 if (TARGET_SOFT_FLOAT || TARGET_THUMB1 || !TARGET_FPA) \
d5b7b3ae 684 { \
9b66ebb1
PB
685 for (regno = FIRST_FPA_REGNUM; \
686 regno <= LAST_FPA_REGNUM; ++regno) \
d5b7b3ae
RE
687 fixed_regs[regno] = call_used_regs[regno] = 1; \
688 } \
9b6b54e2 689 \
c769a35d
RE
690 if (TARGET_THUMB && optimize_size) \
691 { \
692 /* When optimizing for size, it's better not to use \
693 the HI regs, because of the overhead of stacking \
d6b4baa4 694 them. */ \
5b3e6663 695 /* ??? Is this still true for thumb2? */ \
c769a35d
RE
696 for (regno = FIRST_HI_REGNUM; \
697 regno <= LAST_HI_REGNUM; ++regno) \
698 fixed_regs[regno] = call_used_regs[regno] = 1; \
699 } \
700 \
fb14bc89
RE
701 /* The link register can be clobbered by any branch insn, \
702 but we have no way to track that at present, so mark \
703 it as unavailable. */ \
5b3e6663 704 if (TARGET_THUMB1) \
fb14bc89
RE
705 fixed_regs[LR_REGNUM] = call_used_regs[LR_REGNUM] = 1; \
706 \
5b3e6663 707 if (TARGET_32BIT && TARGET_HARD_FLOAT) \
9b6b54e2 708 { \
9b66ebb1 709 if (TARGET_MAVERICK) \
9b6b54e2 710 { \
9b66ebb1
PB
711 for (regno = FIRST_FPA_REGNUM; \
712 regno <= LAST_FPA_REGNUM; ++ regno) \
713 fixed_regs[regno] = call_used_regs[regno] = 1; \
714 for (regno = FIRST_CIRRUS_FP_REGNUM; \
715 regno <= LAST_CIRRUS_FP_REGNUM; ++ regno) \
716 { \
717 fixed_regs[regno] = 0; \
718 call_used_regs[regno] = regno < FIRST_CIRRUS_FP_REGNUM + 4; \
719 } \
720 } \
721 if (TARGET_VFP) \
722 { \
723 for (regno = FIRST_VFP_REGNUM; \
724 regno <= LAST_VFP_REGNUM; ++ regno) \
725 { \
726 fixed_regs[regno] = 0; \
727 call_used_regs[regno] = regno < FIRST_VFP_REGNUM + 16; \
728 } \
9b6b54e2
NC
729 } \
730 } \
731 \
5a9335ef
NC
732 if (TARGET_REALLY_IWMMXT) \
733 { \
734 regno = FIRST_IWMMXT_GR_REGNUM; \
735 /* The 2002/10/09 revision of the XScale ABI has wCG0 \
736 and wCG1 as call-preserved registers. The 2002/11/21 \
737 revision changed this so that all wCG registers are \
738 scratch registers. */ \
739 for (regno = FIRST_IWMMXT_GR_REGNUM; \
740 regno <= LAST_IWMMXT_GR_REGNUM; ++ regno) \
119bb233 741 fixed_regs[regno] = 0; \
5a9335ef
NC
742 /* The XScale ABI has wR0 - wR9 as scratch registers, \
743 the rest as call-preserved registers. */ \
744 for (regno = FIRST_IWMMXT_REGNUM; \
745 regno <= LAST_IWMMXT_REGNUM; ++ regno) \
746 { \
747 fixed_regs[regno] = 0; \
748 call_used_regs[regno] = regno < FIRST_IWMMXT_REGNUM + 10; \
749 } \
750 } \
751 \
fc555370 752 if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) \
d5b7b3ae
RE
753 { \
754 fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
755 call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
756 } \
757 else if (TARGET_APCS_STACK) \
758 { \
759 fixed_regs[10] = 1; \
760 call_used_regs[10] = 1; \
761 } \
a2503645
RS
762 /* -mcaller-super-interworking reserves r11 for calls to \
763 _interwork_r11_call_via_rN(). Making the register global \
764 is an easy way of ensuring that it remains valid for all \
765 calls. */ \
685c9c11 766 if (TARGET_APCS_FRAME || TARGET_CALLER_INTERWORKING \
c54c7322 767 || TARGET_TPCS_FRAME || TARGET_TPCS_LEAF_FRAME) \
d5b7b3ae
RE
768 { \
769 fixed_regs[ARM_HARD_FRAME_POINTER_REGNUM] = 1; \
770 call_used_regs[ARM_HARD_FRAME_POINTER_REGNUM] = 1; \
a2503645
RS
771 if (TARGET_CALLER_INTERWORKING) \
772 global_regs[ARM_HARD_FRAME_POINTER_REGNUM] = 1; \
d5b7b3ae
RE
773 } \
774 SUBTARGET_CONDITIONAL_REGISTER_USAGE \
35d965d5 775}
f676971a 776
6bc82793 777/* These are a couple of extensions to the formats accepted
dd18ae56
NC
778 by asm_fprintf:
779 %@ prints out ASM_COMMENT_START
780 %r prints out REGISTER_PREFIX reg_names[arg] */
781#define ASM_FPRINTF_EXTENSIONS(FILE, ARGS, P) \
782 case '@': \
783 fputs (ASM_COMMENT_START, FILE); \
784 break; \
785 \
786 case 'r': \
787 fputs (REGISTER_PREFIX, FILE); \
788 fputs (reg_names [va_arg (ARGS, int)], FILE); \
789 break;
790
d5b7b3ae 791/* Round X up to the nearest word. */
0c2ca901 792#define ROUND_UP_WORD(X) (((X) + 3) & ~3)
d5b7b3ae 793
6cfc7210 794/* Convert fron bytes to ints. */
e9d7b180 795#define ARM_NUM_INTS(X) (((X) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
6cfc7210 796
9b66ebb1
PB
797/* The number of (integer) registers required to hold a quantity of type MODE.
798 Also used for VFP registers. */
e9d7b180
JD
799#define ARM_NUM_REGS(MODE) \
800 ARM_NUM_INTS (GET_MODE_SIZE (MODE))
6cfc7210
NC
801
802/* The number of (integer) registers required to hold a quantity of TYPE MODE. */
e9d7b180
JD
803#define ARM_NUM_REGS2(MODE, TYPE) \
804 ARM_NUM_INTS ((MODE) == BLKmode ? \
d5b7b3ae 805 int_size_in_bytes (TYPE) : GET_MODE_SIZE (MODE))
6cfc7210
NC
806
807/* The number of (integer) argument register available. */
d5b7b3ae 808#define NUM_ARG_REGS 4
6cfc7210 809
093354e0 810/* Return the register number of the N'th (integer) argument. */
d5b7b3ae 811#define ARG_REGISTER(N) (N - 1)
6cfc7210 812
d5b7b3ae
RE
813/* Specify the registers used for certain standard purposes.
814 The values of these macros are register numbers. */
35d965d5 815
d5b7b3ae
RE
816/* The number of the last argument register. */
817#define LAST_ARG_REGNUM ARG_REGISTER (NUM_ARG_REGS)
35d965d5 818
c769a35d
RE
819/* The numbers of the Thumb register ranges. */
820#define FIRST_LO_REGNUM 0
6d3d9133 821#define LAST_LO_REGNUM 7
c769a35d
RE
822#define FIRST_HI_REGNUM 8
823#define LAST_HI_REGNUM 11
6d3d9133 824
617a1b71 825#ifndef TARGET_UNWIND_INFO
c9ca9b88
PB
826/* We use sjlj exceptions for backwards compatibility. */
827#define MUST_USE_SJLJ_EXCEPTIONS 1
617a1b71
PB
828#endif
829
c9ca9b88
PB
830/* We can generate DWARF2 Unwind info, even though we don't use it. */
831#define DWARF2_UNWIND_INFO 1
f676971a 832
c9ca9b88
PB
833/* Use r0 and r1 to pass exception handling information. */
834#define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? N : INVALID_REGNUM)
835
6d3d9133 836/* The register that holds the return address in exception handlers. */
c9ca9b88
PB
837#define ARM_EH_STACKADJ_REGNUM 2
838#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, ARM_EH_STACKADJ_REGNUM)
35d965d5 839
d5b7b3ae
RE
840/* The native (Norcroft) Pascal compiler for the ARM passes the static chain
841 as an invisible last argument (possible since varargs don't exist in
842 Pascal), so the following is not true. */
5b3e6663 843#define STATIC_CHAIN_REGNUM 12
35d965d5 844
d5b7b3ae
RE
845/* Define this to be where the real frame pointer is if it is not possible to
846 work out the offset between the frame pointer and the automatic variables
847 until after register allocation has taken place. FRAME_POINTER_REGNUM
848 should point to a special register that we will make sure is eliminated.
849
850 For the Thumb we have another problem. The TPCS defines the frame pointer
6bc82793 851 as r11, and GCC believes that it is always possible to use the frame pointer
d5b7b3ae
RE
852 as base register for addressing purposes. (See comments in
853 find_reloads_address()). But - the Thumb does not allow high registers,
854 including r11, to be used as base address registers. Hence our problem.
855
856 The solution used here, and in the old thumb port is to use r7 instead of
857 r11 as the hard frame pointer and to have special code to generate
858 backtrace structures on the stack (if required to do so via a command line
6bc82793 859 option) using r11. This is the only 'user visible' use of r11 as a frame
d5b7b3ae
RE
860 pointer. */
861#define ARM_HARD_FRAME_POINTER_REGNUM 11
862#define THUMB_HARD_FRAME_POINTER_REGNUM 7
35d965d5 863
b15bca31
RE
864#define HARD_FRAME_POINTER_REGNUM \
865 (TARGET_ARM \
866 ? ARM_HARD_FRAME_POINTER_REGNUM \
867 : THUMB_HARD_FRAME_POINTER_REGNUM)
d5b7b3ae 868
b15bca31 869#define FP_REGNUM HARD_FRAME_POINTER_REGNUM
d5b7b3ae 870
b15bca31
RE
871/* Register to use for pushing function arguments. */
872#define STACK_POINTER_REGNUM SP_REGNUM
d5b7b3ae
RE
873
874/* ARM floating pointer registers. */
9b66ebb1
PB
875#define FIRST_FPA_REGNUM 16
876#define LAST_FPA_REGNUM 23
2fa330b2
PB
877#define IS_FPA_REGNUM(REGNUM) \
878 (((REGNUM) >= FIRST_FPA_REGNUM) && ((REGNUM) <= LAST_FPA_REGNUM))
d5b7b3ae 879
5a9335ef
NC
880#define FIRST_IWMMXT_GR_REGNUM 43
881#define LAST_IWMMXT_GR_REGNUM 46
882#define FIRST_IWMMXT_REGNUM 47
883#define LAST_IWMMXT_REGNUM 62
884#define IS_IWMMXT_REGNUM(REGNUM) \
885 (((REGNUM) >= FIRST_IWMMXT_REGNUM) && ((REGNUM) <= LAST_IWMMXT_REGNUM))
886#define IS_IWMMXT_GR_REGNUM(REGNUM) \
887 (((REGNUM) >= FIRST_IWMMXT_GR_REGNUM) && ((REGNUM) <= LAST_IWMMXT_GR_REGNUM))
888
35d965d5 889/* Base register for access to local variables of the function. */
ff9940b0
RE
890#define FRAME_POINTER_REGNUM 25
891
d5b7b3ae
RE
892/* Base register for access to arguments of the function. */
893#define ARG_POINTER_REGNUM 26
62b10bbc 894
9b6b54e2
NC
895#define FIRST_CIRRUS_FP_REGNUM 27
896#define LAST_CIRRUS_FP_REGNUM 42
897#define IS_CIRRUS_REGNUM(REGNUM) \
898 (((REGNUM) >= FIRST_CIRRUS_FP_REGNUM) && ((REGNUM) <= LAST_CIRRUS_FP_REGNUM))
899
9b66ebb1
PB
900#define FIRST_VFP_REGNUM 63
901#define LAST_VFP_REGNUM 94
902#define IS_VFP_REGNUM(REGNUM) \
903 (((REGNUM) >= FIRST_VFP_REGNUM) && ((REGNUM) <= LAST_VFP_REGNUM))
904
6f8c9bd1
NC
905/* The number of hard registers is 16 ARM + 8 FPA + 1 CC + 1 SFP + 1 AFP. */
906/* + 16 Cirrus registers take us up to 43. */
5a9335ef 907/* Intel Wireless MMX Technology registers add 16 + 4 more. */
9b66ebb1
PB
908/* VFP adds 32 + 1 more. */
909#define FIRST_PSEUDO_REGISTER 96
62b10bbc 910
2fa330b2
PB
911#define DBX_REGISTER_NUMBER(REGNO) arm_dbx_register_number (REGNO)
912
35d965d5
RS
913/* Value should be nonzero if functions must have frame pointers.
914 Zero means the frame pointer need not be set up (and parms may be accessed
f676971a 915 via the stack pointer) in functions that seem suitable.
ff9940b0
RE
916 If we have to have a frame pointer we might as well make use of it.
917 APCS says that the frame pointer does not need to be pushed in leaf
2a5307b1 918 functions, or simple tail call functions. */
a15900b5
DJ
919
920#ifndef SUBTARGET_FRAME_POINTER_REQUIRED
921#define SUBTARGET_FRAME_POINTER_REQUIRED 0
922#endif
923
7b8b8ade
NC
924#define FRAME_POINTER_REQUIRED \
925 (current_function_has_nonlocal_label \
a15900b5 926 || SUBTARGET_FRAME_POINTER_REQUIRED \
d5b7b3ae 927 || (TARGET_ARM && TARGET_APCS_FRAME && ! leaf_function_p ()))
35d965d5 928
d5b7b3ae
RE
929/* Return number of consecutive hard regs needed starting at reg REGNO
930 to hold something of mode MODE.
931 This is ordinarily the length in words of a value of mode MODE
932 but can be less for certain modes in special long registers.
35d965d5 933
3b684012 934 On the ARM regs are UNITS_PER_WORD bits wide; FPA regs can hold any FP
d5b7b3ae
RE
935 mode. */
936#define HARD_REGNO_NREGS(REGNO, MODE) \
5b3e6663 937 ((TARGET_32BIT \
9b66ebb1 938 && REGNO >= FIRST_FPA_REGNUM \
d5b7b3ae
RE
939 && REGNO != FRAME_POINTER_REGNUM \
940 && REGNO != ARG_POINTER_REGNUM) \
9b66ebb1 941 && !IS_VFP_REGNUM (REGNO) \
e9d7b180 942 ? 1 : ARM_NUM_REGS (MODE))
35d965d5 943
4b02997f 944/* Return true if REGNO is suitable for holding a quantity of type MODE. */
d5b7b3ae 945#define HARD_REGNO_MODE_OK(REGNO, MODE) \
4b02997f 946 arm_hard_regno_mode_ok ((REGNO), (MODE))
35d965d5 947
d5b7b3ae
RE
948/* Value is 1 if it is a good idea to tie two pseudo registers
949 when one has mode MODE1 and one has mode MODE2.
950 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
951 for any hard reg, then this must be 0 for correct output. */
952#define MODES_TIEABLE_P(MODE1, MODE2) \
953 (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
ff9940b0 954
5a9335ef 955#define VALID_IWMMXT_REG_MODE(MODE) \
f676971a 956 (arm_vector_mode_supported_p (MODE) || (MODE) == DImode)
5a9335ef 957
35d965d5 958/* The order in which register should be allocated. It is good to use ip
ff9940b0
RE
959 since no saving is required (though calls clobber it) and it never contains
960 function parameters. It is quite good to use lr since other calls may
f676971a 961 clobber it anyway. Allocate r0 through r3 in reverse order since r3 is
ff9940b0 962 least likely to contain a function parameter; in addition results are
d5b7b3ae 963 returned in r0. */
9b66ebb1 964
ff73fb53 965#define REG_ALLOC_ORDER \
35d965d5 966{ \
ff73fb53
NC
967 3, 2, 1, 0, 12, 14, 4, 5, \
968 6, 7, 8, 10, 9, 11, 13, 15, \
ff9940b0 969 16, 17, 18, 19, 20, 21, 22, 23, \
9b6b54e2
NC
970 27, 28, 29, 30, 31, 32, 33, 34, \
971 35, 36, 37, 38, 39, 40, 41, 42, \
5a9335ef
NC
972 43, 44, 45, 46, 47, 48, 49, 50, \
973 51, 52, 53, 54, 55, 56, 57, 58, \
974 59, 60, 61, 62, \
9b66ebb1
PB
975 24, 25, 26, \
976 78, 77, 76, 75, 74, 73, 72, 71, \
977 70, 69, 68, 67, 66, 65, 64, 63, \
978 79, 80, 81, 82, 83, 84, 85, 86, \
979 87, 88, 89, 90, 91, 92, 93, 94, \
980 95 \
35d965d5 981}
9338ffe6
PB
982
983/* Interrupt functions can only use registers that have already been
984 saved by the prologue, even if they would normally be
985 call-clobbered. */
986#define HARD_REGNO_RENAME_OK(SRC, DST) \
987 (! IS_INTERRUPT (cfun->machine->func_type) || \
6fb5fa3c 988 df_regs_ever_live_p (DST))
35d965d5
RS
989\f
990/* Register and constant classes. */
991
3b684012 992/* Register classes: used to be simple, just all ARM regs or all FPA regs
d6a7951f 993 Now that the Thumb is involved it has become more complicated. */
35d965d5
RS
994enum reg_class
995{
996 NO_REGS,
3b684012 997 FPA_REGS,
9b6b54e2 998 CIRRUS_REGS,
9b66ebb1 999 VFP_REGS,
5a9335ef
NC
1000 IWMMXT_GR_REGS,
1001 IWMMXT_REGS,
d5b7b3ae
RE
1002 LO_REGS,
1003 STACK_REG,
1004 BASE_REGS,
1005 HI_REGS,
1006 CC_REG,
9b66ebb1 1007 VFPCC_REG,
35d965d5
RS
1008 GENERAL_REGS,
1009 ALL_REGS,
1010 LIM_REG_CLASSES
1011};
1012
1013#define N_REG_CLASSES (int) LIM_REG_CLASSES
1014
d6b4baa4 1015/* Give names of register classes as strings for dump file. */
35d965d5
RS
1016#define REG_CLASS_NAMES \
1017{ \
1018 "NO_REGS", \
3b684012 1019 "FPA_REGS", \
9b6b54e2 1020 "CIRRUS_REGS", \
9b66ebb1 1021 "VFP_REGS", \
5a9335ef
NC
1022 "IWMMXT_GR_REGS", \
1023 "IWMMXT_REGS", \
d5b7b3ae
RE
1024 "LO_REGS", \
1025 "STACK_REG", \
1026 "BASE_REGS", \
1027 "HI_REGS", \
1028 "CC_REG", \
5384443a 1029 "VFPCC_REG", \
35d965d5
RS
1030 "GENERAL_REGS", \
1031 "ALL_REGS", \
1032}
1033
1034/* Define which registers fit in which classes.
1035 This is an initializer for a vector of HARD_REG_SET
1036 of length N_REG_CLASSES. */
9b66ebb1
PB
1037#define REG_CLASS_CONTENTS \
1038{ \
1039 { 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \
1040 { 0x00FF0000, 0x00000000, 0x00000000 }, /* FPA_REGS */ \
1041 { 0xF8000000, 0x000007FF, 0x00000000 }, /* CIRRUS_REGS */ \
1042 { 0x00000000, 0x80000000, 0x7FFFFFFF }, /* VFP_REGS */ \
1043 { 0x00000000, 0x00007800, 0x00000000 }, /* IWMMXT_GR_REGS */ \
1044 { 0x00000000, 0x7FFF8000, 0x00000000 }, /* IWMMXT_REGS */ \
1045 { 0x000000FF, 0x00000000, 0x00000000 }, /* LO_REGS */ \
1046 { 0x00002000, 0x00000000, 0x00000000 }, /* STACK_REG */ \
1047 { 0x000020FF, 0x00000000, 0x00000000 }, /* BASE_REGS */ \
1048 { 0x0000FF00, 0x00000000, 0x00000000 }, /* HI_REGS */ \
1049 { 0x01000000, 0x00000000, 0x00000000 }, /* CC_REG */ \
1050 { 0x00000000, 0x00000000, 0x80000000 }, /* VFPCC_REG */ \
1051 { 0x0200FFFF, 0x00000000, 0x00000000 }, /* GENERAL_REGS */ \
1052 { 0xFAFFFFFF, 0xFFFFFFFF, 0x7FFFFFFF } /* ALL_REGS */ \
35d965d5 1053}
4b02997f 1054
35d965d5
RS
1055/* The same information, inverted:
1056 Return the class number of the smallest class containing
1057 reg number REGNO. This could be a conditional expression
1058 or could index an array. */
d5b7b3ae 1059#define REGNO_REG_CLASS(REGNO) arm_regno_class (REGNO)
35d965d5 1060
9b66ebb1 1061/* FPA registers can't do subreg as all values are reformatted to internal
59b9a953 1062 precision. VFP registers may only be accessed in the mode they
9b66ebb1 1063 were set. */
75d2580c
RE
1064#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
1065 (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \
9b66ebb1
PB
1066 ? reg_classes_intersect_p (FPA_REGS, (CLASS)) \
1067 || reg_classes_intersect_p (VFP_REGS, (CLASS)) \
1068 : 0)
75d2580c 1069
cc81dde8
PB
1070/* We need to define this for LO_REGS on thumb. Otherwise we can end up
1071 using r0-r4 for function arguments, r7 for the stack frame and don't
1072 have enough left over to do doubleword arithmetic. */
1073#define CLASS_LIKELY_SPILLED_P(CLASS) \
1074 ((TARGET_THUMB && (CLASS) == LO_REGS) \
1075 || (CLASS) == CC_REG)
f676971a 1076
35d965d5 1077/* The class value for index registers, and the one for base regs. */
5b3e6663
PB
1078#define INDEX_REG_CLASS (TARGET_THUMB1 ? LO_REGS : GENERAL_REGS)
1079#define BASE_REG_CLASS (TARGET_THUMB1 ? LO_REGS : GENERAL_REGS)
d5b7b3ae 1080
b93a0fe6 1081/* For the Thumb the high registers cannot be used as base registers
6bc82793 1082 when addressing quantities in QI or HI mode; if we don't know the
888d2cd6 1083 mode, then we must be conservative. */
3dcc68a4 1084#define MODE_BASE_REG_CLASS(MODE) \
5b3e6663 1085 (TARGET_32BIT ? GENERAL_REGS : \
888d2cd6
DJ
1086 (((MODE) == SImode) ? BASE_REGS : LO_REGS))
1087
1088/* For Thumb we can not support SP+reg addressing, so we return LO_REGS
1089 instead of BASE_REGS. */
1090#define MODE_BASE_REG_REG_CLASS(MODE) BASE_REG_CLASS
3dcc68a4 1091
d5b7b3ae
RE
1092/* When SMALL_REGISTER_CLASSES is nonzero, the compiler allows
1093 registers explicitly used in the rtl to be used as spill registers
1094 but prevents the compiler from extending the lifetime of these
d6b4baa4 1095 registers. */
5b3e6663 1096#define SMALL_REGISTER_CLASSES TARGET_THUMB1
35d965d5 1097
35d965d5
RS
1098/* Given an rtx X being reloaded into a reg required to be
1099 in class CLASS, return the class of reg to actually use.
5b3e6663
PB
1100 In general this is just CLASS, but for the Thumb core registers and
1101 immediate constants we prefer a LO_REGS class or a subset. */
1102#define PREFERRED_RELOAD_CLASS(X, CLASS) \
1103 (TARGET_ARM ? (CLASS) : \
1104 ((CLASS) == GENERAL_REGS || (CLASS) == HI_REGS \
1105 || (CLASS) == NO_REGS ? LO_REGS : (CLASS)))
d5b7b3ae
RE
1106
1107/* Must leave BASE_REGS reloads alone */
1108#define THUMB_SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \
1109 ((CLASS) != LO_REGS && (CLASS) != BASE_REGS \
1110 ? ((true_regnum (X) == -1 ? LO_REGS \
1111 : (true_regnum (X) + HARD_REGNO_NREGS (0, MODE) > 8) ? LO_REGS \
1112 : NO_REGS)) \
1113 : NO_REGS)
1114
1115#define THUMB_SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \
97358092 1116 ((CLASS) != LO_REGS && (CLASS) != BASE_REGS \
d5b7b3ae
RE
1117 ? ((true_regnum (X) == -1 ? LO_REGS \
1118 : (true_regnum (X) + HARD_REGNO_NREGS (0, MODE) > 8) ? LO_REGS \
1119 : NO_REGS)) \
1120 : NO_REGS)
35d965d5 1121
ff9940b0
RE
1122/* Return the register class of a scratch register needed to copy IN into
1123 or out of a register in CLASS in MODE. If it can be done directly,
1124 NO_REGS is returned. */
d5b7b3ae 1125#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \
fe2d934b 1126 /* Restrict which direct reloads are allowed for VFP/iWMMXt regs. */ \
9b66ebb1
PB
1127 ((TARGET_VFP && TARGET_HARD_FLOAT \
1128 && (CLASS) == VFP_REGS) \
fe2d934b
PB
1129 ? coproc_secondary_reload_class (MODE, X, FALSE) \
1130 : (TARGET_IWMMXT && (CLASS) == IWMMXT_REGS) \
1131 ? coproc_secondary_reload_class (MODE, X, TRUE) \
5b3e6663 1132 : TARGET_32BIT \
9b66ebb1 1133 ? (((MODE) == HImode && ! arm_arch4 && true_regnum (X) == -1) \
d5b7b3ae
RE
1134 ? GENERAL_REGS : NO_REGS) \
1135 : THUMB_SECONDARY_OUTPUT_RELOAD_CLASS (CLASS, MODE, X))
f676971a 1136
d6b4baa4 1137/* If we need to load shorts byte-at-a-time, then we need a scratch. */
d5b7b3ae 1138#define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \
fe2d934b 1139 /* Restrict which direct reloads are allowed for VFP/iWMMXt regs. */ \
9b66ebb1
PB
1140 ((TARGET_VFP && TARGET_HARD_FLOAT \
1141 && (CLASS) == VFP_REGS) \
fe2d934b
PB
1142 ? coproc_secondary_reload_class (MODE, X, FALSE) : \
1143 (TARGET_IWMMXT && (CLASS) == IWMMXT_REGS) ? \
1144 coproc_secondary_reload_class (MODE, X, TRUE) : \
9b6b54e2 1145 /* Cannot load constants into Cirrus registers. */ \
9b66ebb1 1146 (TARGET_MAVERICK && TARGET_HARD_FLOAT \
9b6b54e2
NC
1147 && (CLASS) == CIRRUS_REGS \
1148 && (CONSTANT_P (X) || GET_CODE (X) == SYMBOL_REF)) \
1149 ? GENERAL_REGS : \
5b3e6663 1150 (TARGET_32BIT ? \
5a9335ef
NC
1151 (((CLASS) == IWMMXT_REGS || (CLASS) == IWMMXT_GR_REGS) \
1152 && CONSTANT_P (X)) \
1153 ? GENERAL_REGS : \
61f0ccff 1154 (((MODE) == HImode && ! arm_arch4 \
d5b7b3ae
RE
1155 && (GET_CODE (X) == MEM \
1156 || ((GET_CODE (X) == REG || GET_CODE (X) == SUBREG) \
1157 && true_regnum (X) == -1))) \
1158 ? GENERAL_REGS : NO_REGS) \
9b6b54e2 1159 : THUMB_SECONDARY_INPUT_RELOAD_CLASS (CLASS, MODE, X)))
2ce9c1b9 1160
6f734908
RE
1161/* Try a machine-dependent way of reloading an illegitimate address
1162 operand. If we find one, push the reload and jump to WIN. This
1163 macro is used in only one place: `find_reloads_address' in reload.c.
1164
1165 For the ARM, we wish to handle large displacements off a base
1166 register by splitting the addend across a MOV and the mem insn.
d5b7b3ae
RE
1167 This can cut the number of reloads needed. */
1168#define ARM_LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND, WIN) \
1169 do \
1170 { \
1171 if (GET_CODE (X) == PLUS \
1172 && GET_CODE (XEXP (X, 0)) == REG \
1173 && REGNO (XEXP (X, 0)) < FIRST_PSEUDO_REGISTER \
1174 && REG_MODE_OK_FOR_BASE_P (XEXP (X, 0), MODE) \
1175 && GET_CODE (XEXP (X, 1)) == CONST_INT) \
1176 { \
1177 HOST_WIDE_INT val = INTVAL (XEXP (X, 1)); \
1178 HOST_WIDE_INT low, high; \
1179 \
de6f27a8 1180 if (MODE == DImode || (MODE == DFmode && TARGET_SOFT_FLOAT)) \
d5b7b3ae 1181 low = ((val & 0xf) ^ 0x8) - 0x8; \
9b66ebb1 1182 else if (TARGET_MAVERICK && TARGET_HARD_FLOAT) \
9b6b54e2
NC
1183 /* Need to be careful, -256 is not a valid offset. */ \
1184 low = val >= 0 ? (val & 0xff) : -((-val) & 0xff); \
d5b7b3ae 1185 else if (MODE == SImode \
de6f27a8 1186 || (MODE == SFmode && TARGET_SOFT_FLOAT) \
d5b7b3ae
RE
1187 || ((MODE == HImode || MODE == QImode) && ! arm_arch4)) \
1188 /* Need to be careful, -4096 is not a valid offset. */ \
1189 low = val >= 0 ? (val & 0xfff) : -((-val) & 0xfff); \
1190 else if ((MODE == HImode || MODE == QImode) && arm_arch4) \
1191 /* Need to be careful, -256 is not a valid offset. */ \
1192 low = val >= 0 ? (val & 0xff) : -((-val) & 0xff); \
1193 else if (GET_MODE_CLASS (MODE) == MODE_FLOAT \
9b66ebb1 1194 && TARGET_HARD_FLOAT && TARGET_FPA) \
d5b7b3ae
RE
1195 /* Need to be careful, -1024 is not a valid offset. */ \
1196 low = val >= 0 ? (val & 0x3ff) : -((-val) & 0x3ff); \
1197 else \
1198 break; \
1199 \
30cf4896
KG
1200 high = ((((val - low) & (unsigned HOST_WIDE_INT) 0xffffffff) \
1201 ^ (unsigned HOST_WIDE_INT) 0x80000000) \
1202 - (unsigned HOST_WIDE_INT) 0x80000000); \
d5b7b3ae
RE
1203 /* Check for overflow or zero */ \
1204 if (low == 0 || high == 0 || (high + low != val)) \
1205 break; \
1206 \
1207 /* Reload the high part into a base reg; leave the low part \
1208 in the mem. */ \
1209 X = gen_rtx_PLUS (GET_MODE (X), \
1210 gen_rtx_PLUS (GET_MODE (X), XEXP (X, 0), \
1211 GEN_INT (high)), \
1212 GEN_INT (low)); \
df4ae160 1213 push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL, \
4a692617
NC
1214 MODE_BASE_REG_CLASS (MODE), GET_MODE (X), \
1215 VOIDmode, 0, 0, OPNUM, TYPE); \
d5b7b3ae
RE
1216 goto WIN; \
1217 } \
1218 } \
62b10bbc 1219 while (0)
6f734908 1220
27847754 1221/* XXX If an HImode FP+large_offset address is converted to an HImode
d5b7b3ae
RE
1222 SP+large_offset address, then reload won't know how to fix it. It sees
1223 only that SP isn't valid for HImode, and so reloads the SP into an index
1224 register, but the resulting address is still invalid because the offset
1225 is too big. We fix it here instead by reloading the entire address. */
1226/* We could probably achieve better results by defining PROMOTE_MODE to help
1227 cope with the variances between the Thumb's signed and unsigned byte and
1228 halfword load instructions. */
5b3e6663 1229/* ??? This should be safe for thumb2, but we may be able to do better. */
a132dad6
RE
1230#define THUMB_LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND_L, WIN) \
1231do { \
1232 rtx new_x = thumb_legitimize_reload_address (&X, MODE, OPNUM, TYPE, IND_L); \
1233 if (new_x) \
1234 { \
1235 X = new_x; \
1236 goto WIN; \
1237 } \
1238} while (0)
d5b7b3ae
RE
1239
1240#define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND_LEVELS, WIN) \
1241 if (TARGET_ARM) \
1242 ARM_LEGITIMIZE_RELOAD_ADDRESS (X, MODE, OPNUM, TYPE, IND_LEVELS, WIN); \
1243 else \
1244 THUMB_LEGITIMIZE_RELOAD_ADDRESS (X, MODE, OPNUM, TYPE, IND_LEVELS, WIN)
f676971a 1245
35d965d5
RS
1246/* Return the maximum number of consecutive registers
1247 needed to represent mode MODE in a register of class CLASS.
3b684012 1248 ARM regs are UNITS_PER_WORD bits while FPA regs can hold any FP mode */
35d965d5 1249#define CLASS_MAX_NREGS(CLASS, MODE) \
3b684012 1250 (((CLASS) == FPA_REGS || (CLASS) == CIRRUS_REGS) ? 1 : ARM_NUM_REGS (MODE))
9b6b54e2
NC
1251
1252/* If defined, gives a class of registers that cannot be used as the
1253 operand of a SUBREG that changes the mode of the object illegally. */
35d965d5 1254
3b684012 1255/* Moves between FPA_REGS and GENERAL_REGS are two memory insns. */
cf011243 1256#define REGISTER_MOVE_COST(MODE, FROM, TO) \
5b3e6663 1257 (TARGET_32BIT ? \
3b684012
RE
1258 ((FROM) == FPA_REGS && (TO) != FPA_REGS ? 20 : \
1259 (FROM) != FPA_REGS && (TO) == FPA_REGS ? 20 : \
9b66ebb1
PB
1260 (FROM) == VFP_REGS && (TO) != VFP_REGS ? 10 : \
1261 (FROM) != VFP_REGS && (TO) == VFP_REGS ? 10 : \
5a9335ef
NC
1262 (FROM) == IWMMXT_REGS && (TO) != IWMMXT_REGS ? 4 : \
1263 (FROM) != IWMMXT_REGS && (TO) == IWMMXT_REGS ? 4 : \
1264 (FROM) == IWMMXT_GR_REGS || (TO) == IWMMXT_GR_REGS ? 20 : \
9b6b54e2
NC
1265 (FROM) == CIRRUS_REGS && (TO) != CIRRUS_REGS ? 20 : \
1266 (FROM) != CIRRUS_REGS && (TO) == CIRRUS_REGS ? 20 : \
1267 2) \
d5b7b3ae
RE
1268 : \
1269 ((FROM) == HI_REGS || (TO) == HI_REGS) ? 4 : 2)
35d965d5
RS
1270\f
1271/* Stack layout; function entry, exit and calling. */
1272
1273/* Define this if pushing a word on the stack
1274 makes the stack pointer a smaller address. */
1275#define STACK_GROWS_DOWNWARD 1
1276
a4d05547 1277/* Define this to nonzero if the nominal address of the stack frame
35d965d5
RS
1278 is at the high-address end of the local variables;
1279 that is, each additional local variable allocated
1280 goes at a more negative offset in the frame. */
1281#define FRAME_GROWS_DOWNWARD 1
1282
a2503645
RS
1283/* The amount of scratch space needed by _interwork_{r7,r11}_call_via_rN().
1284 When present, it is one word in size, and sits at the top of the frame,
1285 between the soft frame pointer and either r7 or r11.
1286
1287 We only need _interwork_rM_call_via_rN() for -mcaller-super-interworking,
1288 and only then if some outgoing arguments are passed on the stack. It would
1289 be tempting to also check whether the stack arguments are passed by indirect
1290 calls, but there seems to be no reason in principle why a post-reload pass
1291 couldn't convert a direct call into an indirect one. */
1292#define CALLER_INTERWORKING_SLOT_SIZE \
1293 (TARGET_CALLER_INTERWORKING \
1294 && current_function_outgoing_args_size != 0 \
1295 ? UNITS_PER_WORD : 0)
1296
35d965d5
RS
1297/* Offset within stack frame to start allocating local variables at.
1298 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
1299 first local allocated. Otherwise, it is the offset to the BEGINNING
1300 of the first local allocated. */
1301#define STARTING_FRAME_OFFSET 0
1302
1303/* If we generate an insn to push BYTES bytes,
1304 this says how many the stack pointer really advances by. */
d5b7b3ae 1305/* The push insns do not do this rounding implicitly.
d6b4baa4 1306 So don't define this. */
0c2ca901 1307/* #define PUSH_ROUNDING(NPUSHED) ROUND_UP_WORD (NPUSHED) */
18543a22
ILT
1308
1309/* Define this if the maximum size of all the outgoing args is to be
1310 accumulated and pushed during the prologue. The amount can be
1311 found in the variable current_function_outgoing_args_size. */
6cfc7210 1312#define ACCUMULATE_OUTGOING_ARGS 1
35d965d5
RS
1313
1314/* Offset of first parameter from the argument pointer register value. */
d5b7b3ae 1315#define FIRST_PARM_OFFSET(FNDECL) (TARGET_ARM ? 4 : 0)
35d965d5
RS
1316
1317/* Value is the number of byte of arguments automatically
1318 popped when returning from a subroutine call.
8b109b37 1319 FUNDECL is the declaration node of the function (as a tree),
35d965d5
RS
1320 FUNTYPE is the data type of the function (as a tree),
1321 or for a library call it is an identifier node for the subroutine name.
1322 SIZE is the number of bytes of arguments passed on the stack.
1323
1324 On the ARM, the caller does not pop any of its arguments that were passed
1325 on the stack. */
6cfc7210 1326#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) 0
35d965d5
RS
1327
1328/* Define how to find the value returned by a library function
1329 assuming the value has mode MODE. */
1330#define LIBCALL_VALUE(MODE) \
5b3e6663 1331 (TARGET_32BIT && TARGET_HARD_FLOAT_ABI && TARGET_FPA \
9b66ebb1
PB
1332 && GET_MODE_CLASS (MODE) == MODE_FLOAT \
1333 ? gen_rtx_REG (MODE, FIRST_FPA_REGNUM) \
5b3e6663 1334 : TARGET_32BIT && TARGET_HARD_FLOAT_ABI && TARGET_MAVERICK \
9b66ebb1 1335 && GET_MODE_CLASS (MODE) == MODE_FLOAT \
9b6b54e2 1336 ? gen_rtx_REG (MODE, FIRST_CIRRUS_FP_REGNUM) \
f676971a 1337 : TARGET_IWMMXT_ABI && arm_vector_mode_supported_p (MODE) \
5a9335ef 1338 ? gen_rtx_REG (MODE, FIRST_IWMMXT_REGNUM) \
d5b7b3ae 1339 : gen_rtx_REG (MODE, ARG_REGISTER (1)))
35d965d5 1340
6cfc7210
NC
1341/* Define how to find the value returned by a function.
1342 VALTYPE is the data type of the value (as a tree).
1343 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1344 otherwise, FUNC is 0. */
d5b7b3ae 1345#define FUNCTION_VALUE(VALTYPE, FUNC) \
d4453b7a 1346 arm_function_value (VALTYPE, FUNC);
6cfc7210 1347
35d965d5
RS
1348/* 1 if N is a possible register number for a function value.
1349 On the ARM, only r0 and f0 can return results. */
9b6b54e2 1350/* On a Cirrus chip, mvf0 can return results. */
35d965d5 1351#define FUNCTION_VALUE_REGNO_P(REGNO) \
d5b7b3ae 1352 ((REGNO) == ARG_REGISTER (1) \
5b3e6663 1353 || (TARGET_32BIT && ((REGNO) == FIRST_CIRRUS_FP_REGNUM) \
72cdc543 1354 && TARGET_HARD_FLOAT_ABI && TARGET_MAVERICK) \
5848830f 1355 || ((REGNO) == FIRST_IWMMXT_REGNUM && TARGET_IWMMXT_ABI) \
5b3e6663 1356 || (TARGET_32BIT && ((REGNO) == FIRST_FPA_REGNUM) \
72cdc543 1357 && TARGET_HARD_FLOAT_ABI && TARGET_FPA))
35d965d5 1358
9f7bf991
RE
1359/* Amount of memory needed for an untyped call to save all possible return
1360 registers. */
1361#define APPLY_RESULT_SIZE arm_apply_result_size()
1362
11c1a207
RE
1363/* How large values are returned */
1364/* A C expression which can inhibit the returning of certain function values
d6b4baa4 1365 in registers, based on the type of value. */
f5a1b0d2 1366#define RETURN_IN_MEMORY(TYPE) arm_return_in_memory (TYPE)
11c1a207
RE
1367
1368/* Define DEFAULT_PCC_STRUCT_RETURN to 1 if all structure and union return
1369 values must be in memory. On the ARM, they need only do so if larger
d6b4baa4 1370 than a word, or if they contain elements offset from zero in the struct. */
11c1a207
RE
1371#define DEFAULT_PCC_STRUCT_RETURN 0
1372
6d3d9133 1373/* These bits describe the different types of function supported
112cdef5 1374 by the ARM backend. They are exclusive. i.e. a function cannot be both a
6d3d9133
NC
1375 normal function and an interworked function, for example. Knowing the
1376 type of a function is important for determining its prologue and
1377 epilogue sequences.
1378 Note value 7 is currently unassigned. Also note that the interrupt
1379 function types all have bit 2 set, so that they can be tested for easily.
1380 Note that 0 is deliberately chosen for ARM_FT_UNKNOWN so that when the
4912a07c 1381 machine_function structure is initialized (to zero) func_type will
6d3d9133
NC
1382 default to unknown. This will force the first use of arm_current_func_type
1383 to call arm_compute_func_type. */
1384#define ARM_FT_UNKNOWN 0 /* Type has not yet been determined. */
1385#define ARM_FT_NORMAL 1 /* Your normal, straightforward function. */
1386#define ARM_FT_INTERWORKED 2 /* A function that supports interworking. */
6d3d9133
NC
1387#define ARM_FT_ISR 4 /* An interrupt service routine. */
1388#define ARM_FT_FIQ 5 /* A fast interrupt service routine. */
1389#define ARM_FT_EXCEPTION 6 /* An ARM exception handler (subcase of ISR). */
1390
1391#define ARM_FT_TYPE_MASK ((1 << 3) - 1)
1392
1393/* In addition functions can have several type modifiers,
1394 outlined by these bit masks: */
1395#define ARM_FT_INTERRUPT (1 << 2) /* Note overlap with FT_ISR and above. */
1396#define ARM_FT_NAKED (1 << 3) /* No prologue or epilogue. */
1397#define ARM_FT_VOLATILE (1 << 4) /* Does not return. */
d6b4baa4 1398#define ARM_FT_NESTED (1 << 5) /* Embedded inside another func. */
5b3e6663 1399#define ARM_FT_STACKALIGN (1 << 6) /* Called with misaligned stack. */
6d3d9133
NC
1400
1401/* Some macros to test these flags. */
1402#define ARM_FUNC_TYPE(t) (t & ARM_FT_TYPE_MASK)
1403#define IS_INTERRUPT(t) (t & ARM_FT_INTERRUPT)
1404#define IS_VOLATILE(t) (t & ARM_FT_VOLATILE)
1405#define IS_NAKED(t) (t & ARM_FT_NAKED)
1406#define IS_NESTED(t) (t & ARM_FT_NESTED)
5b3e6663 1407#define IS_STACKALIGN(t) (t & ARM_FT_STACKALIGN)
6d3d9133 1408
5848830f
PB
1409
1410/* Structure used to hold the function stack frame layout. Offsets are
1411 relative to the stack pointer on function entry. Positive offsets are
1412 in the direction of stack growth.
1413 Only soft_frame is used in thumb mode. */
1414
1415typedef struct arm_stack_offsets GTY(())
1416{
1417 int saved_args; /* ARG_POINTER_REGNUM. */
1418 int frame; /* ARM_HARD_FRAME_POINTER_REGNUM. */
1419 int saved_regs;
1420 int soft_frame; /* FRAME_POINTER_REGNUM. */
2591db65 1421 int locals_base; /* THUMB_HARD_FRAME_POINTER_REGNUM. */
5848830f
PB
1422 int outgoing_args; /* STACK_POINTER_REGNUM. */
1423}
1424arm_stack_offsets;
1425
6d3d9133
NC
1426/* A C structure for machine-specific, per-function data.
1427 This is added to the cfun structure. */
e2500fed 1428typedef struct machine_function GTY(())
d5b7b3ae 1429{
6bc82793 1430 /* Additional stack adjustment in __builtin_eh_throw. */
e2500fed 1431 rtx eh_epilogue_sp_ofs;
d5b7b3ae
RE
1432 /* Records if LR has to be saved for far jumps. */
1433 int far_jump_used;
1434 /* Records if ARG_POINTER was ever live. */
1435 int arg_pointer_live;
6f7ebcbb
NC
1436 /* Records if the save of LR has been eliminated. */
1437 int lr_save_eliminated;
0977774b 1438 /* The size of the stack frame. Only valid after reload. */
5848830f 1439 arm_stack_offsets stack_offsets;
6d3d9133
NC
1440 /* Records the type of the current function. */
1441 unsigned long func_type;
3cb66fd7
NC
1442 /* Record if the function has a variable argument list. */
1443 int uses_anonymous_args;
5a9335ef
NC
1444 /* Records if sibcalls are blocked because an argument
1445 register is needed to preserve stack alignment. */
1446 int sibcall_blocked;
020a4035
RE
1447 /* The PIC register for this function. This might be a pseudo. */
1448 rtx pic_reg;
b12a00f1 1449 /* Labels for per-function Thumb call-via stubs. One per potential calling
57ecec57
PB
1450 register. We can never call via LR or PC. We can call via SP if a
1451 trampoline happens to be on the top of the stack. */
1452 rtx call_via[14];
6d3d9133
NC
1453}
1454machine_function;
d5b7b3ae 1455
b12a00f1 1456/* As in the machine_function, a global set of call-via labels, for code
d6b5193b 1457 that is in text_section. */
57ecec57 1458extern GTY(()) rtx thumb_call_via_label[14];
b12a00f1 1459
82e9d970
PB
1460/* A C type for declaring a variable that is used as the first argument of
1461 `FUNCTION_ARG' and other related values. For some target machines, the
1462 type `int' suffices and can hold the number of bytes of argument so far. */
1463typedef struct
1464{
d5b7b3ae 1465 /* This is the number of registers of arguments scanned so far. */
82e9d970 1466 int nregs;
5a9335ef
NC
1467 /* This is the number of iWMMXt register arguments scanned so far. */
1468 int iwmmxt_nregs;
1469 int named_count;
1470 int nargs;
5848830f 1471 int can_split;
d5b7b3ae 1472} CUMULATIVE_ARGS;
82e9d970 1473
35d965d5
RS
1474/* Define where to put the arguments to a function.
1475 Value is zero to push the argument on the stack,
1476 or a hard register in which to store the argument.
1477
1478 MODE is the argument's machine mode.
1479 TYPE is the data type of the argument (as a tree).
1480 This is null for libcalls where that information may
1481 not be available.
1482 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1483 the preceding args and about the function being called.
1484 NAMED is nonzero if this argument is a named parameter
1485 (otherwise it is an extra parameter matching an ellipsis).
1486
1487 On the ARM, normally the first 16 bytes are passed in registers r0-r3; all
1488 other arguments are passed on the stack. If (NAMED == 0) (which happens
1cc9f5f5
KH
1489 only in assign_parms, since TARGET_SETUP_INCOMING_VARARGS is
1490 defined), say it is passed in the stack (function_prologue will
1491 indeed make it pass in the stack if necessary). */
82e9d970
PB
1492#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1493 arm_function_arg (&(CUM), (MODE), (TYPE), (NAMED))
35d965d5 1494
866af8a9
JB
1495#define FUNCTION_ARG_PADDING(MODE, TYPE) \
1496 (arm_pad_arg_upward (MODE, TYPE) ? upward : downward)
1497
1498#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
1499 (arm_pad_reg_upward (MODE, TYPE, FIRST) ? upward : downward)
1500
1501/* For AAPCS, padding should never be below the argument. For other ABIs,
1502 * mimic the default. */
1503#define PAD_VARARGS_DOWN \
1504 ((TARGET_AAPCS_BASED) ? 0 : BYTES_BIG_ENDIAN)
1505
35d965d5
RS
1506/* Initialize a variable CUM of type CUMULATIVE_ARGS
1507 for a call to a function whose data type is FNTYPE.
1508 For a library call, FNTYPE is 0.
1509 On the ARM, the offset starts at 0. */
0f6937fe 1510#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
563a317a 1511 arm_init_cumulative_args (&(CUM), (FNTYPE), (LIBNAME), (FNDECL))
35d965d5
RS
1512
1513/* Update the data in CUM to advance over an argument
1514 of mode MODE and data type TYPE.
1515 (TYPE is null for libcalls where that information may not be available.) */
6cfc7210 1516#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
5a9335ef 1517 (CUM).nargs += 1; \
f0c1ebb7
JM
1518 if (arm_vector_mode_supported_p (MODE) \
1519 && (CUM).named_count > (CUM).nargs \
1520 && TARGET_IWMMXT_ABI) \
5848830f 1521 (CUM).iwmmxt_nregs += 1; \
5a9335ef 1522 else \
5848830f 1523 (CUM).nregs += ARM_NUM_REGS2 (MODE, TYPE)
35d965d5 1524
5a9335ef
NC
1525/* If defined, a C expression that gives the alignment boundary, in bits, of an
1526 argument with the specified mode and type. If it is not defined,
1527 `PARM_BOUNDARY' is used for all arguments. */
1528#define FUNCTION_ARG_BOUNDARY(MODE,TYPE) \
5848830f
PB
1529 ((ARM_DOUBLEWORD_ALIGN && arm_needs_doubleword_align (MODE, TYPE)) \
1530 ? DOUBLEWORD_ALIGNMENT \
1531 : PARM_BOUNDARY )
5a9335ef 1532
35d965d5
RS
1533/* 1 if N is a possible register number for function argument passing.
1534 On the ARM, r0-r3 are used to pass args. */
5a9335ef
NC
1535#define FUNCTION_ARG_REGNO_P(REGNO) \
1536 (IN_RANGE ((REGNO), 0, 3) \
5848830f
PB
1537 || (TARGET_IWMMXT_ABI \
1538 && IN_RANGE ((REGNO), FIRST_IWMMXT_REGNUM, FIRST_IWMMXT_REGNUM + 9)))
35d965d5 1539
f99fce0c 1540\f
afef3d7a
NC
1541/* If your target environment doesn't prefix user functions with an
1542 underscore, you may wish to re-define this to prevent any conflicts.
1543 e.g. AOF may prefix mcount with an underscore. */
1544#ifndef ARM_MCOUNT_NAME
1545#define ARM_MCOUNT_NAME "*mcount"
1546#endif
1547
1548/* Call the function profiler with a given profile label. The Acorn
1549 compiler puts this BEFORE the prolog but gcc puts it afterwards.
1550 On the ARM the full profile code will look like:
1551 .data
1552 LP1
1553 .word 0
1554 .text
1555 mov ip, lr
1556 bl mcount
1557 .word LP1
1558
1559 profile_function() in final.c outputs the .data section, FUNCTION_PROFILER
1560 will output the .text section.
1561
1562 The ``mov ip,lr'' seems like a good idea to stick with cc convention.
59be6073
AN
1563 ``prof'' doesn't seem to mind about this!
1564
1565 Note - this version of the code is designed to work in both ARM and
1566 Thumb modes. */
be393ecf 1567#ifndef ARM_FUNCTION_PROFILER
d5b7b3ae 1568#define ARM_FUNCTION_PROFILER(STREAM, LABELNO) \
6cfc7210
NC
1569{ \
1570 char temp[20]; \
1571 rtx sym; \
1572 \
dd18ae56 1573 asm_fprintf (STREAM, "\tmov\t%r, %r\n\tbl\t", \
d5b7b3ae 1574 IP_REGNUM, LR_REGNUM); \
6cfc7210
NC
1575 assemble_name (STREAM, ARM_MCOUNT_NAME); \
1576 fputc ('\n', STREAM); \
1577 ASM_GENERATE_INTERNAL_LABEL (temp, "LP", LABELNO); \
f1c25d3b 1578 sym = gen_rtx_SYMBOL_REF (Pmode, temp); \
301d03af 1579 assemble_aligned_integer (UNITS_PER_WORD, sym); \
35d965d5 1580}
be393ecf 1581#endif
35d965d5 1582
59be6073 1583#ifdef THUMB_FUNCTION_PROFILER
d5b7b3ae
RE
1584#define FUNCTION_PROFILER(STREAM, LABELNO) \
1585 if (TARGET_ARM) \
1586 ARM_FUNCTION_PROFILER (STREAM, LABELNO) \
1587 else \
1588 THUMB_FUNCTION_PROFILER (STREAM, LABELNO)
59be6073
AN
1589#else
1590#define FUNCTION_PROFILER(STREAM, LABELNO) \
1591 ARM_FUNCTION_PROFILER (STREAM, LABELNO)
1592#endif
d5b7b3ae 1593
35d965d5
RS
1594/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1595 the stack pointer does not matter. The value is tested only in
1596 functions that have frame pointers.
1597 No definition is equivalent to always zero.
1598
1599 On the ARM, the function epilogue recovers the stack pointer from the
1600 frame. */
1601#define EXIT_IGNORE_STACK 1
1602
6fb5fa3c 1603#define EPILOGUE_USES(REGNO) ((REGNO) == LR_REGNUM)
c7861455 1604
35d965d5
RS
1605/* Determine if the epilogue should be output as RTL.
1606 You should override this if you define FUNCTION_EXTRA_EPILOGUE. */
5b3e6663
PB
1607/* This is disabled for Thumb-2 because it will confuse the
1608 conditional insn counter. */
d5b7b3ae 1609#define USE_RETURN_INSN(ISCOND) \
a72d4945 1610 (TARGET_ARM ? use_return_insn (ISCOND, NULL) : 0)
ff9940b0
RE
1611
1612/* Definitions for register eliminations.
1613
1614 This is an array of structures. Each structure initializes one pair
1615 of eliminable registers. The "from" register number is given first,
1616 followed by "to". Eliminations of the same "from" register are listed
1617 in order of preference.
1618
1619 We have two registers that can be eliminated on the ARM. First, the
1620 arg pointer register can often be eliminated in favor of the stack
1621 pointer register. Secondly, the pseudo frame pointer register can always
1622 be eliminated; it is replaced with either the stack or the real frame
d5b7b3ae 1623 pointer. Note we have to use {ARM|THUMB}_HARD_FRAME_POINTER_REGNUM
d6a7951f 1624 because the definition of HARD_FRAME_POINTER_REGNUM is not a constant. */
ff9940b0 1625
d5b7b3ae
RE
1626#define ELIMINABLE_REGS \
1627{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM },\
1628 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM },\
1629 { ARG_POINTER_REGNUM, ARM_HARD_FRAME_POINTER_REGNUM },\
1630 { ARG_POINTER_REGNUM, THUMB_HARD_FRAME_POINTER_REGNUM },\
1631 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM },\
1632 { FRAME_POINTER_REGNUM, ARM_HARD_FRAME_POINTER_REGNUM },\
1633 { FRAME_POINTER_REGNUM, THUMB_HARD_FRAME_POINTER_REGNUM }}
ff9940b0 1634
d5b7b3ae
RE
1635/* Given FROM and TO register numbers, say whether this elimination is
1636 allowed. Frame pointer elimination is automatically handled.
ff9940b0
RE
1637
1638 All eliminations are permissible. Note that ARG_POINTER_REGNUM and
abc95ed3 1639 HARD_FRAME_POINTER_REGNUM are in fact the same thing. If we need a frame
ff9940b0 1640 pointer, we must eliminate FRAME_POINTER_REGNUM into
d5b7b3ae
RE
1641 HARD_FRAME_POINTER_REGNUM and not into STACK_POINTER_REGNUM or
1642 ARG_POINTER_REGNUM. */
1643#define CAN_ELIMINATE(FROM, TO) \
1644 (((TO) == FRAME_POINTER_REGNUM && (FROM) == ARG_POINTER_REGNUM) ? 0 : \
1645 ((TO) == STACK_POINTER_REGNUM && frame_pointer_needed) ? 0 : \
1646 ((TO) == ARM_HARD_FRAME_POINTER_REGNUM && TARGET_THUMB) ? 0 : \
1647 ((TO) == THUMB_HARD_FRAME_POINTER_REGNUM && TARGET_ARM) ? 0 : \
1648 1)
aeaf4d25 1649
d5b7b3ae
RE
1650/* Define the offset between two registers, one to be eliminated, and the
1651 other its replacement, at the start of a routine. */
d5b7b3ae
RE
1652#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1653 if (TARGET_ARM) \
5848830f 1654 (OFFSET) = arm_compute_initial_elimination_offset (FROM, TO); \
d5b7b3ae 1655 else \
5848830f
PB
1656 (OFFSET) = thumb_compute_initial_elimination_offset (FROM, TO)
1657
d5b7b3ae
RE
1658/* Special case handling of the location of arguments passed on the stack. */
1659#define DEBUGGER_ARG_OFFSET(value, addr) value ? value : arm_debugger_arg_offset (value, addr)
f676971a 1660
d5b7b3ae
RE
1661/* Initialize data used by insn expanders. This is called from insn_emit,
1662 once for every function before code is generated. */
1663#define INIT_EXPANDERS arm_init_expanders ()
1664
35d965d5
RS
1665/* Output assembler code for a block containing the constant parts
1666 of a trampoline, leaving space for the variable parts.
1667
1668 On the ARM, (if r8 is the static chain regnum, and remembering that
1669 referencing pc adds an offset of 8) the trampoline looks like:
1670 ldr r8, [pc, #0]
1671 ldr pc, [pc]
1672 .word static chain value
11c1a207 1673 .word function's address
27847754 1674 XXX FIXME: When the trampoline returns, r8 will be clobbered. */
301d03af
RS
1675#define ARM_TRAMPOLINE_TEMPLATE(FILE) \
1676{ \
1677 asm_fprintf (FILE, "\tldr\t%r, [%r, #0]\n", \
1678 STATIC_CHAIN_REGNUM, PC_REGNUM); \
1679 asm_fprintf (FILE, "\tldr\t%r, [%r, #0]\n", \
1680 PC_REGNUM, PC_REGNUM); \
1681 assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \
1682 assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \
d5b7b3ae
RE
1683}
1684
5b3e6663
PB
1685/* The Thumb-2 trampoline is similar to the arm implementation.
1686 Unlike 16-bit Thumb, we enter the stub in thumb mode. */
1687#define THUMB2_TRAMPOLINE_TEMPLATE(FILE) \
1688{ \
1689 asm_fprintf (FILE, "\tldr.w\t%r, [%r, #4]\n", \
1690 STATIC_CHAIN_REGNUM, PC_REGNUM); \
1691 asm_fprintf (FILE, "\tldr.w\t%r, [%r, #4]\n", \
1692 PC_REGNUM, PC_REGNUM); \
1693 assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \
1694 assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \
1695}
1696
1697#define THUMB1_TRAMPOLINE_TEMPLATE(FILE) \
d5b7b3ae 1698{ \
5b3e6663
PB
1699 ASM_OUTPUT_ALIGN(FILE, 2); \
1700 fprintf (FILE, "\t.code\t16\n"); \
d5b7b3ae 1701 fprintf (FILE, ".Ltrampoline_start:\n"); \
5b3e6663
PB
1702 asm_fprintf (FILE, "\tpush\t{r0, r1}\n"); \
1703 asm_fprintf (FILE, "\tldr\tr0, [%r, #8]\n", \
1704 PC_REGNUM); \
1705 asm_fprintf (FILE, "\tmov\t%r, r0\n", \
1706 STATIC_CHAIN_REGNUM); \
1707 asm_fprintf (FILE, "\tldr\tr0, [%r, #8]\n", \
1708 PC_REGNUM); \
1709 asm_fprintf (FILE, "\tstr\tr0, [%r, #4]\n", \
1710 SP_REGNUM); \
1711 asm_fprintf (FILE, "\tpop\t{r0, %r}\n", \
1712 PC_REGNUM); \
1713 assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \
1714 assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \
35d965d5
RS
1715}
1716
d5b7b3ae
RE
1717#define TRAMPOLINE_TEMPLATE(FILE) \
1718 if (TARGET_ARM) \
1719 ARM_TRAMPOLINE_TEMPLATE (FILE) \
5b3e6663
PB
1720 else if (TARGET_THUMB2) \
1721 THUMB2_TRAMPOLINE_TEMPLATE (FILE) \
d5b7b3ae 1722 else \
5b3e6663
PB
1723 THUMB1_TRAMPOLINE_TEMPLATE (FILE)
1724
1725/* Thumb trampolines should be entered in thumb mode, so set the bottom bit
1726 of the address. */
1727#define TRAMPOLINE_ADJUST_ADDRESS(ADDR) do \
1728{ \
1729 if (TARGET_THUMB) \
1730 (ADDR) = expand_simple_binop (Pmode, IOR, (ADDR), GEN_INT(1), \
1731 gen_reg_rtx (Pmode), 0, OPTAB_LIB_WIDEN); \
1732} while(0)
f676971a 1733
35d965d5 1734/* Length in units of the trampoline for entering a nested function. */
5b3e6663 1735#define TRAMPOLINE_SIZE (TARGET_32BIT ? 16 : 20)
35d965d5 1736
006946e4
JM
1737/* Alignment required for a trampoline in bits. */
1738#define TRAMPOLINE_ALIGNMENT 32
35d965d5 1739
2a86f515 1740
35d965d5
RS
1741/* Emit RTL insns to initialize the variable parts of a trampoline.
1742 FNADDR is an RTX for the address of the function's pure code.
1743 CXT is an RTX for the static chain value for the function. */
192c8d78
RE
1744#ifndef INITIALIZE_TRAMPOLINE
1745#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1746{ \
1747 emit_move_insn (gen_rtx_MEM (SImode, \
1748 plus_constant (TRAMP, \
5b3e6663 1749 TARGET_32BIT ? 8 : 12)), \
192c8d78
RE
1750 CXT); \
1751 emit_move_insn (gen_rtx_MEM (SImode, \
1752 plus_constant (TRAMP, \
5b3e6663 1753 TARGET_32BIT ? 12 : 16)), \
192c8d78 1754 FNADDR); \
49755603
RE
1755 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"), \
1756 0, VOIDmode, 2, TRAMP, Pmode, \
1757 plus_constant (TRAMP, TRAMPOLINE_SIZE), Pmode); \
35d965d5 1758}
192c8d78 1759#endif
35d965d5 1760
35d965d5
RS
1761\f
1762/* Addressing modes, and classification of registers for them. */
3cd45774 1763#define HAVE_POST_INCREMENT 1
5b3e6663
PB
1764#define HAVE_PRE_INCREMENT TARGET_32BIT
1765#define HAVE_POST_DECREMENT TARGET_32BIT
1766#define HAVE_PRE_DECREMENT TARGET_32BIT
1767#define HAVE_PRE_MODIFY_DISP TARGET_32BIT
1768#define HAVE_POST_MODIFY_DISP TARGET_32BIT
1769#define HAVE_PRE_MODIFY_REG TARGET_32BIT
1770#define HAVE_POST_MODIFY_REG TARGET_32BIT
35d965d5
RS
1771
1772/* Macros to check register numbers against specific register classes. */
1773
1774/* These assume that REGNO is a hard or pseudo reg number.
1775 They give nonzero only if REGNO is a hard reg of the suitable class
1776 or a pseudo reg currently allocated to a suitable hard reg.
1777 Since they use reg_renumber, they are safe only once reg_renumber
d6b4baa4 1778 has been allocated, which happens in local-alloc.c. */
d5b7b3ae
RE
1779#define TEST_REGNO(R, TEST, VALUE) \
1780 ((R TEST VALUE) || ((unsigned) reg_renumber[R] TEST VALUE))
1781
5b3e6663 1782/* Don't allow the pc to be used. */
f1008e52
RE
1783#define ARM_REGNO_OK_FOR_BASE_P(REGNO) \
1784 (TEST_REGNO (REGNO, <, PC_REGNUM) \
1785 || TEST_REGNO (REGNO, ==, FRAME_POINTER_REGNUM) \
1786 || TEST_REGNO (REGNO, ==, ARG_POINTER_REGNUM))
1787
5b3e6663 1788#define THUMB1_REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) \
f1008e52
RE
1789 (TEST_REGNO (REGNO, <=, LAST_LO_REGNUM) \
1790 || (GET_MODE_SIZE (MODE) >= 4 \
1791 && TEST_REGNO (REGNO, ==, STACK_POINTER_REGNUM)))
1792
1793#define REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) \
5b3e6663
PB
1794 (TARGET_THUMB1 \
1795 ? THUMB1_REGNO_MODE_OK_FOR_BASE_P (REGNO, MODE) \
f1008e52
RE
1796 : ARM_REGNO_OK_FOR_BASE_P (REGNO))
1797
888d2cd6
DJ
1798/* Nonzero if X can be the base register in a reg+reg addressing mode.
1799 For Thumb, we can not use SP + reg, so reject SP. */
1800#define REGNO_MODE_OK_FOR_REG_BASE_P(X, MODE) \
1801 REGNO_OK_FOR_INDEX_P (X)
1802
f1008e52
RE
1803/* For ARM code, we don't care about the mode, but for Thumb, the index
1804 must be suitable for use in a QImode load. */
d5b7b3ae
RE
1805#define REGNO_OK_FOR_INDEX_P(REGNO) \
1806 REGNO_MODE_OK_FOR_BASE_P (REGNO, QImode)
35d965d5
RS
1807
1808/* Maximum number of registers that can appear in a valid memory address.
d6b4baa4 1809 Shifts in addresses can't be by a register. */
ff9940b0 1810#define MAX_REGS_PER_ADDRESS 2
35d965d5
RS
1811
1812/* Recognize any constant value that is a valid address. */
1813/* XXX We can address any constant, eventually... */
11c1a207
RE
1814
1815#ifdef AOF_ASSEMBLER
1816
1817#define CONSTANT_ADDRESS_P(X) \
d5b7b3ae 1818 (GET_CODE (X) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (X))
11c1a207
RE
1819
1820#else
35d965d5 1821
5b3e6663 1822/* ??? Should the TARGET_ARM here also apply to thumb2? */
008cf58a
RE
1823#define CONSTANT_ADDRESS_P(X) \
1824 (GET_CODE (X) == SYMBOL_REF \
1825 && (CONSTANT_POOL_ADDRESS_P (X) \
d5b7b3ae 1826 || (TARGET_ARM && optimize > 0 && SYMBOL_REF_FLAG (X))))
35d965d5 1827
11c1a207
RE
1828#endif /* AOF_ASSEMBLER */
1829
35d965d5
RS
1830/* Nonzero if the constant value X is a legitimate general operand.
1831 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
1832
1833 On the ARM, allow any integer (invalid ones are removed later by insn
1834 patterns), nice doubles and symbol_refs which refer to the function's
d5b7b3ae 1835 constant pool XXX.
f676971a 1836
82e9d970 1837 When generating pic allow anything. */
d5b7b3ae
RE
1838#define ARM_LEGITIMATE_CONSTANT_P(X) (flag_pic || ! label_mentioned_p (X))
1839
1840#define THUMB_LEGITIMATE_CONSTANT_P(X) \
1841 ( GET_CODE (X) == CONST_INT \
1842 || GET_CODE (X) == CONST_DOUBLE \
7b8781c8
PB
1843 || CONSTANT_ADDRESS_P (X) \
1844 || flag_pic)
d5b7b3ae 1845
d3585b76
DJ
1846#define LEGITIMATE_CONSTANT_P(X) \
1847 (!arm_tls_referenced_p (X) \
5b3e6663
PB
1848 && (TARGET_32BIT ? ARM_LEGITIMATE_CONSTANT_P (X) \
1849 : THUMB_LEGITIMATE_CONSTANT_P (X)))
d5b7b3ae 1850
c27ba912
DM
1851#ifndef SUBTARGET_NAME_ENCODING_LENGTHS
1852#define SUBTARGET_NAME_ENCODING_LENGTHS
1853#endif
1854
6bc82793 1855/* This is a C fragment for the inside of a switch statement.
c27ba912
DM
1856 Each case label should return the number of characters to
1857 be stripped from the start of a function's name, if that
1858 name starts with the indicated character. */
1859#define ARM_NAME_ENCODING_LENGTHS \
00fdafef 1860 case '*': return 1; \
f676971a 1861 SUBTARGET_NAME_ENCODING_LENGTHS
c27ba912 1862
c27ba912
DM
1863/* This is how to output a reference to a user-level label named NAME.
1864 `assemble_name' uses this. */
e5951263 1865#undef ASM_OUTPUT_LABELREF
c27ba912 1866#define ASM_OUTPUT_LABELREF(FILE, NAME) \
e1944073 1867 arm_asm_output_labelref (FILE, NAME)
c27ba912 1868
7a085dce 1869/* Output IT instructions for conditionally executed Thumb-2 instructions. */
5b3e6663
PB
1870#define ASM_OUTPUT_OPCODE(STREAM, PTR) \
1871 if (TARGET_THUMB2) \
1872 thumb2_asm_output_opcode (STREAM);
1873
7abc66b1
JB
1874/* The EABI specifies that constructors should go in .init_array.
1875 Other targets use .ctors for compatibility. */
88c6057f 1876#ifndef ARM_EABI_CTORS_SECTION_OP
7abc66b1
JB
1877#define ARM_EABI_CTORS_SECTION_OP \
1878 "\t.section\t.init_array,\"aw\",%init_array"
88c6057f
MM
1879#endif
1880#ifndef ARM_EABI_DTORS_SECTION_OP
7abc66b1
JB
1881#define ARM_EABI_DTORS_SECTION_OP \
1882 "\t.section\t.fini_array,\"aw\",%fini_array"
88c6057f 1883#endif
7abc66b1
JB
1884#define ARM_CTORS_SECTION_OP \
1885 "\t.section\t.ctors,\"aw\",%progbits"
1886#define ARM_DTORS_SECTION_OP \
1887 "\t.section\t.dtors,\"aw\",%progbits"
1888
1889/* Define CTORS_SECTION_ASM_OP. */
1890#undef CTORS_SECTION_ASM_OP
1891#undef DTORS_SECTION_ASM_OP
1892#ifndef IN_LIBGCC2
1893# define CTORS_SECTION_ASM_OP \
1894 (TARGET_AAPCS_BASED ? ARM_EABI_CTORS_SECTION_OP : ARM_CTORS_SECTION_OP)
1895# define DTORS_SECTION_ASM_OP \
1896 (TARGET_AAPCS_BASED ? ARM_EABI_DTORS_SECTION_OP : ARM_DTORS_SECTION_OP)
1897#else /* !defined (IN_LIBGCC2) */
1898/* In libgcc, CTORS_SECTION_ASM_OP must be a compile-time constant,
1899 so we cannot use the definition above. */
1900# ifdef __ARM_EABI__
1901/* The .ctors section is not part of the EABI, so we do not define
1902 CTORS_SECTION_ASM_OP when in libgcc; that prevents crtstuff
1903 from trying to use it. We do define it when doing normal
1904 compilation, as .init_array can be used instead of .ctors. */
1905/* There is no need to emit begin or end markers when using
1906 init_array; the dynamic linker will compute the size of the
1907 array itself based on special symbols created by the static
1908 linker. However, we do need to arrange to set up
1909 exception-handling here. */
1910# define CTOR_LIST_BEGIN asm (ARM_EABI_CTORS_SECTION_OP)
1911# define CTOR_LIST_END /* empty */
1912# define DTOR_LIST_BEGIN asm (ARM_EABI_DTORS_SECTION_OP)
1913# define DTOR_LIST_END /* empty */
1914# else /* !defined (__ARM_EABI__) */
1915# define CTORS_SECTION_ASM_OP ARM_CTORS_SECTION_OP
1916# define DTORS_SECTION_ASM_OP ARM_DTORS_SECTION_OP
1917# endif /* !defined (__ARM_EABI__) */
1918#endif /* !defined (IN_LIBCC2) */
1919
1e731102
MM
1920/* True if the operating system can merge entities with vague linkage
1921 (e.g., symbols in COMDAT group) during dynamic linking. */
1922#ifndef TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P
1923#define TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P true
1924#endif
1925
617a1b71
PB
1926#define ARM_OUTPUT_FN_UNWIND(F, PROLOGUE) arm_output_fn_unwind (F, PROLOGUE)
1927
1928#ifdef TARGET_UNWIND_INFO
1929#define ARM_EABI_UNWIND_TABLES \
1930 ((!USING_SJLJ_EXCEPTIONS && flag_exceptions) || flag_unwind_tables)
1931#else
1932#define ARM_EABI_UNWIND_TABLES 0
1933#endif
1934
35d965d5
RS
1935/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1936 and check its validity for a certain class.
1937 We have two alternate definitions for each of them.
1938 The usual definition accepts all pseudo regs; the other rejects
1939 them unless they have been allocated suitable hard regs.
5b3e6663 1940 The symbol REG_OK_STRICT causes the latter definition to be used.
7a085dce 1941 Thumb-2 has the same restrictions as arm. */
35d965d5 1942#ifndef REG_OK_STRICT
ff9940b0 1943
f1008e52
RE
1944#define ARM_REG_OK_FOR_BASE_P(X) \
1945 (REGNO (X) <= LAST_ARM_REGNUM \
1946 || REGNO (X) >= FIRST_PSEUDO_REGISTER \
1947 || REGNO (X) == FRAME_POINTER_REGNUM \
1948 || REGNO (X) == ARG_POINTER_REGNUM)
ff9940b0 1949
5b3e6663 1950#define THUMB1_REG_MODE_OK_FOR_BASE_P(X, MODE) \
f1008e52
RE
1951 (REGNO (X) <= LAST_LO_REGNUM \
1952 || REGNO (X) >= FIRST_PSEUDO_REGISTER \
1953 || (GET_MODE_SIZE (MODE) >= 4 \
1954 && (REGNO (X) == STACK_POINTER_REGNUM \
1955 || (X) == hard_frame_pointer_rtx \
1956 || (X) == arg_pointer_rtx)))
ff9940b0 1957
76a318e9
RE
1958#define REG_STRICT_P 0
1959
d5b7b3ae 1960#else /* REG_OK_STRICT */
ff9940b0 1961
f1008e52
RE
1962#define ARM_REG_OK_FOR_BASE_P(X) \
1963 ARM_REGNO_OK_FOR_BASE_P (REGNO (X))
ff9940b0 1964
5b3e6663
PB
1965#define THUMB1_REG_MODE_OK_FOR_BASE_P(X, MODE) \
1966 THUMB1_REGNO_MODE_OK_FOR_BASE_P (REGNO (X), MODE)
ff9940b0 1967
76a318e9
RE
1968#define REG_STRICT_P 1
1969
d5b7b3ae 1970#endif /* REG_OK_STRICT */
f1008e52
RE
1971
1972/* Now define some helpers in terms of the above. */
1973
1974#define REG_MODE_OK_FOR_BASE_P(X, MODE) \
5b3e6663
PB
1975 (TARGET_THUMB1 \
1976 ? THUMB1_REG_MODE_OK_FOR_BASE_P (X, MODE) \
f1008e52
RE
1977 : ARM_REG_OK_FOR_BASE_P (X))
1978
1979#define ARM_REG_OK_FOR_INDEX_P(X) ARM_REG_OK_FOR_BASE_P (X)
1980
5b3e6663 1981/* For 16-bit Thumb, a valid index register is anything that can be used in
f1008e52 1982 a byte load instruction. */
5b3e6663
PB
1983#define THUMB1_REG_OK_FOR_INDEX_P(X) \
1984 THUMB1_REG_MODE_OK_FOR_BASE_P (X, QImode)
f1008e52
RE
1985
1986/* Nonzero if X is a hard reg that can be used as an index
1987 or if it is a pseudo reg. On the Thumb, the stack pointer
1988 is not suitable. */
1989#define REG_OK_FOR_INDEX_P(X) \
5b3e6663
PB
1990 (TARGET_THUMB1 \
1991 ? THUMB1_REG_OK_FOR_INDEX_P (X) \
f1008e52
RE
1992 : ARM_REG_OK_FOR_INDEX_P (X))
1993
888d2cd6
DJ
1994/* Nonzero if X can be the base register in a reg+reg addressing mode.
1995 For Thumb, we can not use SP + reg, so reject SP. */
1996#define REG_MODE_OK_FOR_REG_BASE_P(X, MODE) \
1997 REG_OK_FOR_INDEX_P (X)
35d965d5
RS
1998\f
1999/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
2000 that is a valid memory address for an instruction.
2001 The MODE argument is the machine mode for the MEM expression
76a318e9 2002 that wants to use this address. */
f676971a 2003
f1008e52
RE
2004#define ARM_BASE_REGISTER_RTX_P(X) \
2005 (GET_CODE (X) == REG && ARM_REG_OK_FOR_BASE_P (X))
35d965d5 2006
f1008e52
RE
2007#define ARM_INDEX_REGISTER_RTX_P(X) \
2008 (GET_CODE (X) == REG && ARM_REG_OK_FOR_INDEX_P (X))
35d965d5 2009
76a318e9
RE
2010#define ARM_GO_IF_LEGITIMATE_ADDRESS(MODE,X,WIN) \
2011 { \
1e1ab407 2012 if (arm_legitimate_address_p (MODE, X, SET, REG_STRICT_P)) \
76a318e9 2013 goto WIN; \
6b990f6b 2014 }
d5b7b3ae 2015
5b3e6663 2016#define THUMB2_GO_IF_LEGITIMATE_ADDRESS(MODE,X,WIN) \
76a318e9 2017 { \
5b3e6663
PB
2018 if (thumb2_legitimate_address_p (MODE, X, REG_STRICT_P)) \
2019 goto WIN; \
2020 }
2021
2022#define THUMB1_GO_IF_LEGITIMATE_ADDRESS(MODE,X,WIN) \
2023 { \
2024 if (thumb1_legitimate_address_p (MODE, X, REG_STRICT_P)) \
76a318e9
RE
2025 goto WIN; \
2026 }
d5b7b3ae 2027
d5b7b3ae
RE
2028#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, WIN) \
2029 if (TARGET_ARM) \
2030 ARM_GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN) \
5b3e6663
PB
2031 else if (TARGET_THUMB2) \
2032 THUMB2_GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN) \
2033 else /* if (TARGET_THUMB1) */ \
2034 THUMB1_GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN)
76a318e9 2035
35d965d5
RS
2036\f
2037/* Try machine-dependent ways of modifying an illegitimate address
ccf4d512
RE
2038 to be legitimate. If we find one, return the new, valid address. */
2039#define ARM_LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
2040do { \
2041 X = arm_legitimize_address (X, OLDX, MODE); \
ccf4d512
RE
2042} while (0)
2043
5b3e6663
PB
2044/* ??? Implement LEGITIMIZE_ADDRESS for thumb2. */
2045#define THUMB2_LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
2046do { \
2047} while (0)
2048
2049#define THUMB1_LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
6f5b4f3e
RE
2050do { \
2051 X = thumb_legitimize_address (X, OLDX, MODE); \
ccf4d512
RE
2052} while (0)
2053
2054#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
2055do { \
2056 if (TARGET_ARM) \
2057 ARM_LEGITIMIZE_ADDRESS (X, OLDX, MODE, WIN); \
5b3e6663
PB
2058 else if (TARGET_THUMB2) \
2059 THUMB2_LEGITIMIZE_ADDRESS (X, OLDX, MODE, WIN); \
ccf4d512 2060 else \
5b3e6663 2061 THUMB1_LEGITIMIZE_ADDRESS (X, OLDX, MODE, WIN); \
6f5b4f3e
RE
2062 \
2063 if (memory_address_p (MODE, X)) \
2064 goto WIN; \
ccf4d512 2065} while (0)
f676971a 2066
35d965d5
RS
2067/* Go to LABEL if ADDR (a legitimate address expression)
2068 has an effect that depends on the machine mode it is used for. */
d5b7b3ae 2069#define ARM_GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
35d965d5 2070{ \
d5b7b3ae
RE
2071 if ( GET_CODE (ADDR) == PRE_DEC || GET_CODE (ADDR) == POST_DEC \
2072 || GET_CODE (ADDR) == PRE_INC || GET_CODE (ADDR) == POST_INC) \
35d965d5
RS
2073 goto LABEL; \
2074}
d5b7b3ae
RE
2075
2076/* Nothing helpful to do for the Thumb */
2077#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
5b3e6663 2078 if (TARGET_32BIT) \
f676971a 2079 ARM_GO_IF_MODE_DEPENDENT_ADDRESS (ADDR, LABEL)
35d965d5 2080\f
d5b7b3ae 2081
35d965d5
RS
2082/* Specify the machine mode that this machine uses
2083 for the index in the tablejump instruction. */
d5b7b3ae 2084#define CASE_VECTOR_MODE Pmode
35d965d5 2085
5b3e6663
PB
2086#define CASE_VECTOR_PC_RELATIVE TARGET_THUMB2
2087
2088#define CASE_VECTOR_SHORTEN_MODE(min, max, body) \
2089 ((min < 0 || max >= 0x2000 || !TARGET_THUMB2) ? SImode \
2090 : (max >= 0x200) ? HImode \
2091 : QImode)
2092
ff9940b0
RE
2093/* signed 'char' is most compatible, but RISC OS wants it unsigned.
2094 unsigned is probably best, but may break some code. */
2095#ifndef DEFAULT_SIGNED_CHAR
3967692c 2096#define DEFAULT_SIGNED_CHAR 0
35d965d5
RS
2097#endif
2098
35d965d5 2099/* Max number of bytes we can move from memory to memory
d17ce9af
TG
2100 in one reasonably fast instruction. */
2101#define MOVE_MAX 4
35d965d5 2102
d19fb8e3 2103#undef MOVE_RATIO
591af218 2104#define MOVE_RATIO (arm_tune_xscale ? 4 : 2)
d19fb8e3 2105
ff9940b0
RE
2106/* Define if operations between registers always perform the operation
2107 on the full register even if a narrower mode is specified. */
2108#define WORD_REGISTER_OPERATIONS
2109
2110/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
2111 will either zero-extend or sign-extend. The value of this macro should
2112 be the code that says which one of the two operations is implicitly
f822d252 2113 done, UNKNOWN if none. */
9c872872 2114#define LOAD_EXTEND_OP(MODE) \
d5b7b3ae
RE
2115 (TARGET_THUMB ? ZERO_EXTEND : \
2116 ((arm_arch4 || (MODE) == QImode) ? ZERO_EXTEND \
f822d252 2117 : ((BYTES_BIG_ENDIAN && (MODE) == HImode) ? SIGN_EXTEND : UNKNOWN)))
ff9940b0 2118
35d965d5
RS
2119/* Nonzero if access to memory by bytes is slow and undesirable. */
2120#define SLOW_BYTE_ACCESS 0
2121
d5b7b3ae 2122#define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) 1
f676971a 2123
35d965d5
RS
2124/* Immediate shift counts are truncated by the output routines (or was it
2125 the assembler?). Shift counts in a register are truncated by ARM. Note
2126 that the native compiler puts too large (> 32) immediate shift counts
2127 into a register and shifts by the register, letting the ARM decide what
2128 to do instead of doing that itself. */
ff9940b0
RE
2129/* This is all wrong. Defining SHIFT_COUNT_TRUNCATED tells combine that
2130 code like (X << (Y % 32)) for register X, Y is equivalent to (X << Y).
2131 On the arm, Y in a register is used modulo 256 for the shift. Only for
d6b4baa4 2132 rotates is modulo 32 used. */
ff9940b0 2133/* #define SHIFT_COUNT_TRUNCATED 1 */
35d965d5 2134
35d965d5 2135/* All integers have the same format so truncation is easy. */
d5b7b3ae 2136#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
35d965d5
RS
2137
2138/* Calling from registers is a massive pain. */
2139#define NO_FUNCTION_CSE 1
2140
35d965d5
RS
2141/* The machine modes of pointers and functions */
2142#define Pmode SImode
2143#define FUNCTION_MODE Pmode
2144
d5b7b3ae
RE
2145#define ARM_FRAME_RTX(X) \
2146 ( (X) == frame_pointer_rtx || (X) == stack_pointer_rtx \
3967692c
RE
2147 || (X) == arg_pointer_rtx)
2148
ff9940b0 2149/* Moves to and from memory are quite expensive */
d5b7b3ae 2150#define MEMORY_MOVE_COST(M, CLASS, IN) \
5b3e6663 2151 (TARGET_32BIT ? 10 : \
d5b7b3ae
RE
2152 ((GET_MODE_SIZE (M) < 4 ? 8 : 2 * GET_MODE_SIZE (M)) \
2153 * (CLASS == LO_REGS ? 1 : 2)))
f676971a 2154
ff9940b0
RE
2155/* Try to generate sequences that don't involve branches, we can then use
2156 conditional instructions */
d5b7b3ae 2157#define BRANCH_COST \
5b3e6663 2158 (TARGET_32BIT ? 4 : (optimize > 0 ? 2 : 0))
7a801826
RE
2159\f
2160/* Position Independent Code. */
2161/* We decide which register to use based on the compilation options and
2162 the assembler in use; this is more general than the APCS restriction of
2163 using sb (r9) all the time. */
020a4035 2164extern unsigned arm_pic_register;
7a801826
RE
2165
2166/* The register number of the register used to address a table of static
2167 data addresses in memory. */
2168#define PIC_OFFSET_TABLE_REGNUM arm_pic_register
2169
f5a1b0d2 2170/* We can't directly access anything that contains a symbol,
d3585b76
DJ
2171 nor can we indirect via the constant pool. One exception is
2172 UNSPEC_TLS, which is always PIC. */
82e9d970 2173#define LEGITIMATE_PIC_OPERAND_P(X) \
1575c31e
JD
2174 (!(symbol_mentioned_p (X) \
2175 || label_mentioned_p (X) \
2176 || (GET_CODE (X) == SYMBOL_REF \
2177 && CONSTANT_POOL_ADDRESS_P (X) \
2178 && (symbol_mentioned_p (get_pool_constant (X)) \
d3585b76
DJ
2179 || label_mentioned_p (get_pool_constant (X))))) \
2180 || tls_mentioned_p (X))
1575c31e 2181
13bd191d
PB
2182/* We need to know when we are making a constant pool; this determines
2183 whether data needs to be in the GOT or can be referenced via a GOT
2184 offset. */
2185extern int making_const_table;
82e9d970 2186\f
c27ba912 2187/* Handle pragmas for compatibility with Intel's compilers. */
c58b209a
NB
2188#define REGISTER_TARGET_PRAGMAS() do { \
2189 c_register_pragma (0, "long_calls", arm_pr_long_calls); \
2190 c_register_pragma (0, "no_long_calls", arm_pr_no_long_calls); \
2191 c_register_pragma (0, "long_calls_off", arm_pr_long_calls_off); \
8b97c5f8
ZW
2192} while (0)
2193
d6b4baa4 2194/* Condition code information. */
ff9940b0 2195/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
a5381466 2196 return the mode to be used for the comparison. */
d5b7b3ae
RE
2197
2198#define SELECT_CC_MODE(OP, X, Y) arm_select_cc_mode (OP, X, Y)
ff9940b0 2199
880873be
RE
2200#define REVERSIBLE_CC_MODE(MODE) 1
2201
2202#define REVERSE_CONDITION(CODE,MODE) \
2203 (((MODE) == CCFPmode || (MODE) == CCFPEmode) \
2204 ? reverse_condition_maybe_unordered (code) \
2205 : reverse_condition (code))
008cf58a 2206
62b10bbc
NC
2207#define CANONICALIZE_COMPARISON(CODE, OP0, OP1) \
2208 do \
2209 { \
2210 if (GET_CODE (OP1) == CONST_INT \
2211 && ! (const_ok_for_arm (INTVAL (OP1)) \
2212 || (const_ok_for_arm (- INTVAL (OP1))))) \
2213 { \
2214 rtx const_op = OP1; \
a14b88bb
PB
2215 CODE = arm_canonicalize_comparison ((CODE), GET_MODE (OP0), \
2216 &const_op); \
62b10bbc
NC
2217 OP1 = const_op; \
2218 } \
2219 } \
2220 while (0)
62dd06ea 2221
7dba8395
RH
2222/* The arm5 clz instruction returns 32. */
2223#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1)
35d965d5 2224\f
d5b7b3ae 2225#undef ASM_APP_OFF
5b3e6663
PB
2226#define ASM_APP_OFF (TARGET_THUMB1 ? "\t.code\t16\n" : \
2227 TARGET_THUMB2 ? "\t.thumb\n" : "")
35d965d5 2228
35d965d5 2229/* Output a push or a pop instruction (only used when profiling). */
d5b7b3ae 2230#define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
8a81cc45
RE
2231 do \
2232 { \
2233 if (TARGET_ARM) \
2234 asm_fprintf (STREAM,"\tstmfd\t%r!,{%r}\n", \
2235 STACK_POINTER_REGNUM, REGNO); \
2236 else \
2237 asm_fprintf (STREAM, "\tpush {%r}\n", REGNO); \
2238 } while (0)
d5b7b3ae
RE
2239
2240
2241#define ASM_OUTPUT_REG_POP(STREAM, REGNO) \
8a81cc45
RE
2242 do \
2243 { \
2244 if (TARGET_ARM) \
2245 asm_fprintf (STREAM, "\tldmfd\t%r!,{%r}\n", \
2246 STACK_POINTER_REGNUM, REGNO); \
2247 else \
2248 asm_fprintf (STREAM, "\tpop {%r}\n", REGNO); \
2249 } while (0)
d5b7b3ae 2250
5b3e6663
PB
2251/* Jump table alignment is explicit in ASM_OUTPUT_CASE_LABEL. */
2252#define ADDR_VEC_ALIGN(JUMPTABLE) 0
2253
d5b7b3ae
RE
2254/* This is how to output a label which precedes a jumptable. Since
2255 Thumb instructions are 2 bytes, we may need explicit alignment here. */
be393ecf 2256#undef ASM_OUTPUT_CASE_LABEL
5b3e6663
PB
2257#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \
2258 do \
2259 { \
2260 if (TARGET_THUMB && GET_MODE (PATTERN (JUMPTABLE)) == SImode) \
2261 ASM_OUTPUT_ALIGN (FILE, 2); \
2262 (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); \
2263 } \
2264 while (0)
2265
2266/* Make sure subsequent insns are aligned after a TBB. */
2267#define ASM_OUTPUT_CASE_END(FILE, NUM, JUMPTABLE) \
2268 do \
2269 { \
2270 if (GET_MODE (PATTERN (JUMPTABLE)) == QImode) \
2271 ASM_OUTPUT_ALIGN (FILE, 1); \
2272 } \
d5b7b3ae 2273 while (0)
35d965d5 2274
6cfc7210
NC
2275#define ARM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
2276 do \
2277 { \
d5b7b3ae
RE
2278 if (TARGET_THUMB) \
2279 { \
5b3e6663
PB
2280 if (is_called_in_ARM_mode (DECL) \
2281 || (TARGET_THUMB1 && current_function_is_thunk)) \
d5b7b3ae 2282 fprintf (STREAM, "\t.code 32\n") ; \
5b3e6663
PB
2283 else if (TARGET_THUMB1) \
2284 fprintf (STREAM, "\t.code\t16\n\t.thumb_func\n") ; \
d5b7b3ae 2285 else \
5b3e6663 2286 fprintf (STREAM, "\t.thumb\n\t.thumb_func\n") ; \
d5b7b3ae 2287 } \
6cfc7210 2288 if (TARGET_POKE_FUNCTION_NAME) \
6354dc9b 2289 arm_poke_function_name (STREAM, (char *) NAME); \
6cfc7210
NC
2290 } \
2291 while (0)
35d965d5 2292
d5b7b3ae
RE
2293/* For aliases of functions we use .thumb_set instead. */
2294#define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL1, DECL2) \
2295 do \
2296 { \
91ea4f8d
KG
2297 const char *const LABEL1 = XSTR (XEXP (DECL_RTL (decl), 0), 0); \
2298 const char *const LABEL2 = IDENTIFIER_POINTER (DECL2); \
d5b7b3ae
RE
2299 \
2300 if (TARGET_THUMB && TREE_CODE (DECL1) == FUNCTION_DECL) \
2301 { \
2302 fprintf (FILE, "\t.thumb_set "); \
2303 assemble_name (FILE, LABEL1); \
2304 fprintf (FILE, ","); \
2305 assemble_name (FILE, LABEL2); \
2306 fprintf (FILE, "\n"); \
2307 } \
2308 else \
2309 ASM_OUTPUT_DEF (FILE, LABEL1, LABEL2); \
2310 } \
2311 while (0)
2312
fdc2d3b0
NC
2313#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
2314/* To support -falign-* switches we need to use .p2align so
2315 that alignment directives in code sections will be padded
2316 with no-op instructions, rather than zeroes. */
5a9335ef 2317#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \
fdc2d3b0
NC
2318 if ((LOG) != 0) \
2319 { \
2320 if ((MAX_SKIP) == 0) \
5a9335ef 2321 fprintf ((FILE), "\t.p2align %d\n", (int) (LOG)); \
fdc2d3b0
NC
2322 else \
2323 fprintf ((FILE), "\t.p2align %d,,%d\n", \
5a9335ef 2324 (int) (LOG), (int) (MAX_SKIP)); \
fdc2d3b0
NC
2325 }
2326#endif
35d965d5 2327\f
5b3e6663
PB
2328/* Add two bytes to the length of conditionally executed Thumb-2
2329 instructions for the IT instruction. */
2330#define ADJUST_INSN_LENGTH(insn, length) \
2331 if (TARGET_THUMB2 && GET_CODE (PATTERN (insn)) == COND_EXEC) \
2332 length += 2;
2333
35d965d5 2334/* Only perform branch elimination (by making instructions conditional) if
5b3e6663
PB
2335 we're optimizing. For Thumb-2 check if any IT instructions need
2336 outputting. */
d5b7b3ae
RE
2337#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
2338 if (TARGET_ARM && optimize) \
2339 arm_final_prescan_insn (INSN); \
5b3e6663
PB
2340 else if (TARGET_THUMB2) \
2341 thumb2_final_prescan_insn (INSN); \
2342 else if (TARGET_THUMB1) \
2343 thumb1_final_prescan_insn (INSN)
35d965d5 2344
7bc7696c 2345#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
5b3e6663
PB
2346 (CODE == '@' || CODE == '|' || CODE == '.' \
2347 || CODE == '(' || CODE == ')' \
2348 || (TARGET_32BIT && (CODE == '?')) \
2349 || (TARGET_THUMB2 && (CODE == '!')) \
d5b7b3ae 2350 || (TARGET_THUMB && (CODE == '_')))
6cfc7210 2351
7bc7696c 2352/* Output an operand of an instruction. */
35d965d5 2353#define PRINT_OPERAND(STREAM, X, CODE) \
7bc7696c
RE
2354 arm_print_operand (STREAM, X, CODE)
2355
7b8b8ade
NC
2356#define ARM_SIGN_EXTEND(x) ((HOST_WIDE_INT) \
2357 (HOST_BITS_PER_WIDE_INT <= 32 ? (unsigned HOST_WIDE_INT) (x) \
30cf4896
KG
2358 : ((((unsigned HOST_WIDE_INT)(x)) & (unsigned HOST_WIDE_INT) 0xffffffff) |\
2359 ((((unsigned HOST_WIDE_INT)(x)) & (unsigned HOST_WIDE_INT) 0x80000000) \
2360 ? ((~ (unsigned HOST_WIDE_INT) 0) \
2361 & ~ (unsigned HOST_WIDE_INT) 0xffffffff) \
7bc7696c 2362 : 0))))
35d965d5
RS
2363
2364/* Output the address of an operand. */
3cd45774
RE
2365#define ARM_PRINT_OPERAND_ADDRESS(STREAM, X) \
2366{ \
2367 int is_minus = GET_CODE (X) == MINUS; \
2368 \
2369 if (GET_CODE (X) == REG) \
2370 asm_fprintf (STREAM, "[%r, #0]", REGNO (X)); \
2371 else if (GET_CODE (X) == PLUS || is_minus) \
2372 { \
2373 rtx base = XEXP (X, 0); \
2374 rtx index = XEXP (X, 1); \
2375 HOST_WIDE_INT offset = 0; \
2376 if (GET_CODE (base) != REG) \
2377 { \
d6b4baa4
KH
2378 /* Ensure that BASE is a register. */ \
2379 /* (one of them must be). */ \
3cd45774
RE
2380 rtx temp = base; \
2381 base = index; \
2382 index = temp; \
2383 } \
2384 switch (GET_CODE (index)) \
2385 { \
2386 case CONST_INT: \
2387 offset = INTVAL (index); \
2388 if (is_minus) \
2389 offset = -offset; \
c53dddc2 2390 asm_fprintf (STREAM, "[%r, #%wd]", \
3cd45774
RE
2391 REGNO (base), offset); \
2392 break; \
2393 \
2394 case REG: \
2395 asm_fprintf (STREAM, "[%r, %s%r]", \
2396 REGNO (base), is_minus ? "-" : "", \
2397 REGNO (index)); \
2398 break; \
2399 \
2400 case MULT: \
2401 case ASHIFTRT: \
2402 case LSHIFTRT: \
2403 case ASHIFT: \
2404 case ROTATERT: \
2405 { \
2406 asm_fprintf (STREAM, "[%r, %s%r", \
2407 REGNO (base), is_minus ? "-" : "", \
2408 REGNO (XEXP (index, 0))); \
2409 arm_print_operand (STREAM, index, 'S'); \
2410 fputs ("]", STREAM); \
2411 break; \
2412 } \
2413 \
2414 default: \
e6d29d15 2415 gcc_unreachable (); \
3cd45774
RE
2416 } \
2417 } \
2418 else if (GET_CODE (X) == PRE_INC || GET_CODE (X) == POST_INC \
2419 || GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_DEC) \
2420 { \
2421 extern enum machine_mode output_memory_reference_mode; \
2422 \
e6d29d15 2423 gcc_assert (GET_CODE (XEXP (X, 0)) == REG); \
3cd45774
RE
2424 \
2425 if (GET_CODE (X) == PRE_DEC || GET_CODE (X) == PRE_INC) \
2426 asm_fprintf (STREAM, "[%r, #%s%d]!", \
2427 REGNO (XEXP (X, 0)), \
2428 GET_CODE (X) == PRE_DEC ? "-" : "", \
2429 GET_MODE_SIZE (output_memory_reference_mode)); \
2430 else \
2431 asm_fprintf (STREAM, "[%r], #%s%d", \
2432 REGNO (XEXP (X, 0)), \
2433 GET_CODE (X) == POST_DEC ? "-" : "", \
2434 GET_MODE_SIZE (output_memory_reference_mode)); \
2435 } \
2436 else if (GET_CODE (X) == PRE_MODIFY) \
2437 { \
2438 asm_fprintf (STREAM, "[%r, ", REGNO (XEXP (X, 0))); \
2439 if (GET_CODE (XEXP (XEXP (X, 1), 1)) == CONST_INT) \
c53dddc2 2440 asm_fprintf (STREAM, "#%wd]!", \
3cd45774
RE
2441 INTVAL (XEXP (XEXP (X, 1), 1))); \
2442 else \
2443 asm_fprintf (STREAM, "%r]!", \
2444 REGNO (XEXP (XEXP (X, 1), 1))); \
2445 } \
2446 else if (GET_CODE (X) == POST_MODIFY) \
2447 { \
2448 asm_fprintf (STREAM, "[%r], ", REGNO (XEXP (X, 0))); \
2449 if (GET_CODE (XEXP (XEXP (X, 1), 1)) == CONST_INT) \
c53dddc2 2450 asm_fprintf (STREAM, "#%wd", \
3cd45774
RE
2451 INTVAL (XEXP (XEXP (X, 1), 1))); \
2452 else \
2453 asm_fprintf (STREAM, "%r", \
2454 REGNO (XEXP (XEXP (X, 1), 1))); \
2455 } \
2456 else output_addr_const (STREAM, X); \
35d965d5 2457}
62dd06ea 2458
d5b7b3ae
RE
2459#define THUMB_PRINT_OPERAND_ADDRESS(STREAM, X) \
2460{ \
2461 if (GET_CODE (X) == REG) \
2462 asm_fprintf (STREAM, "[%r]", REGNO (X)); \
2463 else if (GET_CODE (X) == POST_INC) \
2464 asm_fprintf (STREAM, "%r!", REGNO (XEXP (X, 0))); \
2465 else if (GET_CODE (X) == PLUS) \
2466 { \
e6d29d15 2467 gcc_assert (GET_CODE (XEXP (X, 0)) == REG); \
d5b7b3ae 2468 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
659bdc68 2469 asm_fprintf (STREAM, "[%r, #%wd]", \
d5b7b3ae 2470 REGNO (XEXP (X, 0)), \
659bdc68 2471 INTVAL (XEXP (X, 1))); \
d5b7b3ae
RE
2472 else \
2473 asm_fprintf (STREAM, "[%r, %r]", \
2474 REGNO (XEXP (X, 0)), \
2475 REGNO (XEXP (X, 1))); \
2476 } \
2477 else \
2478 output_addr_const (STREAM, X); \
2479}
2480
2481#define PRINT_OPERAND_ADDRESS(STREAM, X) \
5b3e6663 2482 if (TARGET_32BIT) \
d5b7b3ae
RE
2483 ARM_PRINT_OPERAND_ADDRESS (STREAM, X) \
2484 else \
2485 THUMB_PRINT_OPERAND_ADDRESS (STREAM, X)
5a9335ef 2486
d3585b76
DJ
2487#define OUTPUT_ADDR_CONST_EXTRA(file, x, fail) \
2488 if (arm_output_addr_const_extra (file, x) == FALSE) \
2489 goto fail
5a9335ef 2490
6a5d7526
MS
2491/* A C expression whose value is RTL representing the value of the return
2492 address for the frame COUNT steps up from the current frame. */
2493
d5b7b3ae
RE
2494#define RETURN_ADDR_RTX(COUNT, FRAME) \
2495 arm_return_addr (COUNT, FRAME)
2496
f676971a 2497/* Mask of the bits in the PC that contain the real return address
d5b7b3ae
RE
2498 when running in 26-bit mode. */
2499#define RETURN_ADDR_MASK26 (0x03fffffc)
6a5d7526 2500
2c849145
JM
2501/* Pick up the return address upon entry to a procedure. Used for
2502 dwarf2 unwind information. This also enables the table driven
2503 mechanism. */
2c849145
JM
2504#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, LR_REGNUM)
2505#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (LR_REGNUM)
2506
39950dff
MS
2507/* Used to mask out junk bits from the return address, such as
2508 processor state, interrupt status, condition codes and the like. */
2509#define MASK_RETURN_ADDR \
2510 /* If we are generating code for an ARM2/ARM3 machine or for an ARM6 \
2511 in 26 bit mode, the condition codes must be masked out of the \
2512 return address. This does not apply to ARM6 and later processors \
2513 when running in 32 bit mode. */ \
61f0ccff
RE
2514 ((arm_arch4 || TARGET_THUMB) \
2515 ? (gen_int_mode ((unsigned long)0xffffffff, Pmode)) \
fcd53748 2516 : arm_gen_return_addr_mask ())
d5b7b3ae
RE
2517
2518\f
5a9335ef
NC
2519enum arm_builtins
2520{
2521 ARM_BUILTIN_GETWCX,
2522 ARM_BUILTIN_SETWCX,
2523
2524 ARM_BUILTIN_WZERO,
2525
2526 ARM_BUILTIN_WAVG2BR,
2527 ARM_BUILTIN_WAVG2HR,
2528 ARM_BUILTIN_WAVG2B,
2529 ARM_BUILTIN_WAVG2H,
2530
2531 ARM_BUILTIN_WACCB,
2532 ARM_BUILTIN_WACCH,
2533 ARM_BUILTIN_WACCW,
2534
2535 ARM_BUILTIN_WMACS,
2536 ARM_BUILTIN_WMACSZ,
2537 ARM_BUILTIN_WMACU,
2538 ARM_BUILTIN_WMACUZ,
2539
2540 ARM_BUILTIN_WSADB,
2541 ARM_BUILTIN_WSADBZ,
2542 ARM_BUILTIN_WSADH,
2543 ARM_BUILTIN_WSADHZ,
2544
2545 ARM_BUILTIN_WALIGN,
2546
2547 ARM_BUILTIN_TMIA,
2548 ARM_BUILTIN_TMIAPH,
2549 ARM_BUILTIN_TMIABB,
2550 ARM_BUILTIN_TMIABT,
2551 ARM_BUILTIN_TMIATB,
2552 ARM_BUILTIN_TMIATT,
2553
2554 ARM_BUILTIN_TMOVMSKB,
2555 ARM_BUILTIN_TMOVMSKH,
2556 ARM_BUILTIN_TMOVMSKW,
2557
2558 ARM_BUILTIN_TBCSTB,
2559 ARM_BUILTIN_TBCSTH,
2560 ARM_BUILTIN_TBCSTW,
2561
2562 ARM_BUILTIN_WMADDS,
2563 ARM_BUILTIN_WMADDU,
2564
2565 ARM_BUILTIN_WPACKHSS,
2566 ARM_BUILTIN_WPACKWSS,
2567 ARM_BUILTIN_WPACKDSS,
2568 ARM_BUILTIN_WPACKHUS,
2569 ARM_BUILTIN_WPACKWUS,
2570 ARM_BUILTIN_WPACKDUS,
2571
2572 ARM_BUILTIN_WADDB,
2573 ARM_BUILTIN_WADDH,
2574 ARM_BUILTIN_WADDW,
2575 ARM_BUILTIN_WADDSSB,
2576 ARM_BUILTIN_WADDSSH,
2577 ARM_BUILTIN_WADDSSW,
2578 ARM_BUILTIN_WADDUSB,
2579 ARM_BUILTIN_WADDUSH,
2580 ARM_BUILTIN_WADDUSW,
2581 ARM_BUILTIN_WSUBB,
2582 ARM_BUILTIN_WSUBH,
2583 ARM_BUILTIN_WSUBW,
2584 ARM_BUILTIN_WSUBSSB,
2585 ARM_BUILTIN_WSUBSSH,
2586 ARM_BUILTIN_WSUBSSW,
2587 ARM_BUILTIN_WSUBUSB,
2588 ARM_BUILTIN_WSUBUSH,
2589 ARM_BUILTIN_WSUBUSW,
2590
2591 ARM_BUILTIN_WAND,
2592 ARM_BUILTIN_WANDN,
2593 ARM_BUILTIN_WOR,
2594 ARM_BUILTIN_WXOR,
2595
2596 ARM_BUILTIN_WCMPEQB,
2597 ARM_BUILTIN_WCMPEQH,
2598 ARM_BUILTIN_WCMPEQW,
2599 ARM_BUILTIN_WCMPGTUB,
2600 ARM_BUILTIN_WCMPGTUH,
2601 ARM_BUILTIN_WCMPGTUW,
2602 ARM_BUILTIN_WCMPGTSB,
2603 ARM_BUILTIN_WCMPGTSH,
2604 ARM_BUILTIN_WCMPGTSW,
2605
2606 ARM_BUILTIN_TEXTRMSB,
2607 ARM_BUILTIN_TEXTRMSH,
2608 ARM_BUILTIN_TEXTRMSW,
2609 ARM_BUILTIN_TEXTRMUB,
2610 ARM_BUILTIN_TEXTRMUH,
2611 ARM_BUILTIN_TEXTRMUW,
2612 ARM_BUILTIN_TINSRB,
2613 ARM_BUILTIN_TINSRH,
2614 ARM_BUILTIN_TINSRW,
2615
2616 ARM_BUILTIN_WMAXSW,
2617 ARM_BUILTIN_WMAXSH,
2618 ARM_BUILTIN_WMAXSB,
2619 ARM_BUILTIN_WMAXUW,
2620 ARM_BUILTIN_WMAXUH,
2621 ARM_BUILTIN_WMAXUB,
2622 ARM_BUILTIN_WMINSW,
2623 ARM_BUILTIN_WMINSH,
2624 ARM_BUILTIN_WMINSB,
2625 ARM_BUILTIN_WMINUW,
2626 ARM_BUILTIN_WMINUH,
2627 ARM_BUILTIN_WMINUB,
2628
f07a6b21
BE
2629 ARM_BUILTIN_WMULUM,
2630 ARM_BUILTIN_WMULSM,
5a9335ef
NC
2631 ARM_BUILTIN_WMULUL,
2632
2633 ARM_BUILTIN_PSADBH,
2634 ARM_BUILTIN_WSHUFH,
2635
2636 ARM_BUILTIN_WSLLH,
2637 ARM_BUILTIN_WSLLW,
2638 ARM_BUILTIN_WSLLD,
2639 ARM_BUILTIN_WSRAH,
2640 ARM_BUILTIN_WSRAW,
2641 ARM_BUILTIN_WSRAD,
2642 ARM_BUILTIN_WSRLH,
2643 ARM_BUILTIN_WSRLW,
2644 ARM_BUILTIN_WSRLD,
2645 ARM_BUILTIN_WRORH,
2646 ARM_BUILTIN_WRORW,
2647 ARM_BUILTIN_WRORD,
2648 ARM_BUILTIN_WSLLHI,
2649 ARM_BUILTIN_WSLLWI,
2650 ARM_BUILTIN_WSLLDI,
2651 ARM_BUILTIN_WSRAHI,
2652 ARM_BUILTIN_WSRAWI,
2653 ARM_BUILTIN_WSRADI,
2654 ARM_BUILTIN_WSRLHI,
2655 ARM_BUILTIN_WSRLWI,
2656 ARM_BUILTIN_WSRLDI,
2657 ARM_BUILTIN_WRORHI,
2658 ARM_BUILTIN_WRORWI,
2659 ARM_BUILTIN_WRORDI,
2660
2661 ARM_BUILTIN_WUNPCKIHB,
2662 ARM_BUILTIN_WUNPCKIHH,
2663 ARM_BUILTIN_WUNPCKIHW,
2664 ARM_BUILTIN_WUNPCKILB,
2665 ARM_BUILTIN_WUNPCKILH,
2666 ARM_BUILTIN_WUNPCKILW,
2667
2668 ARM_BUILTIN_WUNPCKEHSB,
2669 ARM_BUILTIN_WUNPCKEHSH,
2670 ARM_BUILTIN_WUNPCKEHSW,
2671 ARM_BUILTIN_WUNPCKEHUB,
2672 ARM_BUILTIN_WUNPCKEHUH,
2673 ARM_BUILTIN_WUNPCKEHUW,
2674 ARM_BUILTIN_WUNPCKELSB,
2675 ARM_BUILTIN_WUNPCKELSH,
2676 ARM_BUILTIN_WUNPCKELSW,
2677 ARM_BUILTIN_WUNPCKELUB,
2678 ARM_BUILTIN_WUNPCKELUH,
2679 ARM_BUILTIN_WUNPCKELUW,
2680
d3585b76
DJ
2681 ARM_BUILTIN_THREAD_POINTER,
2682
5a9335ef
NC
2683 ARM_BUILTIN_MAX
2684};
978e411f
CD
2685
2686/* Do not emit .note.GNU-stack by default. */
2687#ifndef NEED_INDICATE_EXEC_STACK
2688#define NEED_INDICATE_EXEC_STACK 0
2689#endif
2690
88657302 2691#endif /* ! GCC_ARM_H */