]>
Commit | Line | Data |
---|---|---|
f5a1b0d2 | 1 | /* Definitions of target machine for GNU compiler, for ARM. |
5624e564 | 2 | Copyright (C) 1991-2015 Free Software Foundation, Inc. |
35d965d5 | 3 | Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl) |
8b109b37 | 4 | and Martin Simmons (@harleqn.co.uk). |
949d79eb | 5 | More major hacks by Richard Earnshaw (rearnsha@arm.com) |
6cfc7210 NC |
6 | Minor hacks by Nick Clifton (nickc@cygnus.com) |
7 | ||
4f448245 | 8 | This file is part of GCC. |
35d965d5 | 9 | |
4f448245 NC |
10 | GCC is free software; you can redistribute it and/or modify it |
11 | under the terms of the GNU General Public License as published | |
2f83c7d6 | 12 | by the Free Software Foundation; either version 3, or (at your |
4f448245 | 13 | option) any later version. |
35d965d5 | 14 | |
4f448245 NC |
15 | GCC is distributed in the hope that it will be useful, but WITHOUT |
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
17 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | |
18 | License for more details. | |
35d965d5 | 19 | |
999db125 GJL |
20 | Under Section 7 of GPL version 3, you are granted additional |
21 | permissions described in the GCC Runtime Library Exception, version | |
22 | 3.1, as published by the Free Software Foundation. | |
23 | ||
c7eca9fe GJL |
24 | You should have received a copy of the GNU General Public License and |
25 | a copy of the GCC Runtime Library Exception along with this program; | |
26 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
2f83c7d6 | 27 | <http://www.gnu.org/licenses/>. */ |
35d965d5 | 28 | |
88657302 RH |
29 | #ifndef GCC_ARM_H |
30 | #define GCC_ARM_H | |
b355a481 | 31 | |
ef4bddc2 | 32 | /* We can't use machine_mode inside a generator file because it |
46107b99 RE |
33 | hasn't been created yet; we shouldn't be using any code that |
34 | needs the real definition though, so this ought to be safe. */ | |
35 | #ifdef GENERATOR_FILE | |
36 | #define MACHMODE int | |
37 | #else | |
38 | #include "insn-modes.h" | |
2c0122c9 | 39 | #define MACHMODE machine_mode |
46107b99 RE |
40 | #endif |
41 | ||
9403b7f7 RS |
42 | #include "config/vxworks-dummy.h" |
43 | ||
35fd3193 | 44 | /* The architecture define. */ |
78011587 PB |
45 | extern char arm_arch_name[]; |
46 | ||
e6471be6 | 47 | /* Target CPU builtins. */ |
7049e4eb | 48 | #define TARGET_CPU_CPP_BUILTINS() arm_cpu_cpp_builtins (pfile) |
e6471be6 | 49 | |
ad7be009 | 50 | #include "config/arm/arm-opts.h" |
9b66ebb1 | 51 | |
78011587 PB |
52 | enum target_cpus |
53 | { | |
c0e25e65 JG |
54 | #define ARM_CORE(NAME, INTERNAL_IDENT, IDENT, ARCH, FLAGS, COSTS) \ |
55 | TARGET_CPU_##INTERNAL_IDENT, | |
78011587 PB |
56 | #include "arm-cores.def" |
57 | #undef ARM_CORE | |
58 | TARGET_CPU_generic | |
59 | }; | |
60 | ||
9b66ebb1 PB |
61 | /* The processor for which instructions should be scheduled. */ |
62 | extern enum processor_type arm_tune; | |
63 | ||
d5b7b3ae | 64 | typedef enum arm_cond_code |
89c7ca52 RE |
65 | { |
66 | ARM_EQ = 0, ARM_NE, ARM_CS, ARM_CC, ARM_MI, ARM_PL, ARM_VS, ARM_VC, | |
67 | ARM_HI, ARM_LS, ARM_GE, ARM_LT, ARM_GT, ARM_LE, ARM_AL, ARM_NV | |
d5b7b3ae RE |
68 | } |
69 | arm_cc; | |
6cfc7210 | 70 | |
d5b7b3ae | 71 | extern arm_cc arm_current_cc; |
ff9940b0 | 72 | |
d5b7b3ae | 73 | #define ARM_INVERSE_CONDITION_CODE(X) ((arm_cc) (((int)X) ^ 1)) |
89c7ca52 | 74 | |
cd794ed4 | 75 | /* The maximum number of instructions that is beneficial to |
b24a2ce5 GY |
76 | conditionally execute. */ |
77 | #undef MAX_CONDITIONAL_EXECUTE | |
78 | #define MAX_CONDITIONAL_EXECUTE arm_max_conditional_execute () | |
79 | ||
6cfc7210 NC |
80 | extern int arm_target_label; |
81 | extern int arm_ccfsm_state; | |
e2500fed | 82 | extern GTY(()) rtx arm_target_insn; |
d5b7b3ae | 83 | /* The label of the current constant pool. */ |
e2500fed | 84 | extern rtx pool_vector_label; |
d5b7b3ae | 85 | /* Set to 1 when a return insn is output, this means that the epilogue |
d6b4baa4 | 86 | is not needed. */ |
d5b7b3ae | 87 | extern int return_used_this_function; |
b76c3c4b PB |
88 | /* Callback to output language specific object attributes. */ |
89 | extern void (*arm_lang_output_object_attributes_hook)(void); | |
35d965d5 | 90 | \f |
d6b4baa4 | 91 | /* Just in case configure has failed to define anything. */ |
7a801826 RE |
92 | #ifndef TARGET_CPU_DEFAULT |
93 | #define TARGET_CPU_DEFAULT TARGET_CPU_generic | |
94 | #endif | |
95 | ||
7a801826 | 96 | |
5742588d | 97 | #undef CPP_SPEC |
78011587 | 98 | #define CPP_SPEC "%(subtarget_cpp_spec) \ |
5e1b4d5a JM |
99 | %{mfloat-abi=soft:%{mfloat-abi=hard: \ |
100 | %e-mfloat-abi=soft and -mfloat-abi=hard may not be used together}} \ | |
e6471be6 NB |
101 | %{mbig-endian:%{mlittle-endian: \ |
102 | %e-mbig-endian and -mlittle-endian may not be used together}}" | |
7a801826 | 103 | |
be393ecf | 104 | #ifndef CC1_SPEC |
dfa08768 | 105 | #define CC1_SPEC "" |
be393ecf | 106 | #endif |
7a801826 RE |
107 | |
108 | /* This macro defines names of additional specifications to put in the specs | |
109 | that can be used in various specifications like CC1_SPEC. Its definition | |
110 | is an initializer with a subgrouping for each command option. | |
111 | ||
112 | Each subgrouping contains a string constant, that defines the | |
4f448245 | 113 | specification name, and a string constant that used by the GCC driver |
7a801826 RE |
114 | program. |
115 | ||
116 | Do not define this macro if it does not need to do anything. */ | |
117 | #define EXTRA_SPECS \ | |
38fc909b | 118 | { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \ |
54e73f88 | 119 | { "asm_cpu_spec", ASM_CPU_SPEC }, \ |
7a801826 RE |
120 | SUBTARGET_EXTRA_SPECS |
121 | ||
914a3b8c | 122 | #ifndef SUBTARGET_EXTRA_SPECS |
7a801826 | 123 | #define SUBTARGET_EXTRA_SPECS |
914a3b8c DM |
124 | #endif |
125 | ||
6cfc7210 | 126 | #ifndef SUBTARGET_CPP_SPEC |
38fc909b | 127 | #define SUBTARGET_CPP_SPEC "" |
6cfc7210 | 128 | #endif |
35d965d5 | 129 | \f |
1a7ae4ce | 130 | /* Tree Target Specification. */ |
08793a38 CB |
131 | #define TARGET_ARM_P(flags) (!TARGET_THUMB_P (flags)) |
132 | #define TARGET_THUMB1_P(flags) (TARGET_THUMB_P (flags) && !arm_arch_thumb2) | |
133 | #define TARGET_THUMB2_P(flags) (TARGET_THUMB_P (flags) && arm_arch_thumb2) | |
134 | ||
35d965d5 | 135 | /* Run-time Target Specification. */ |
9b66ebb1 | 136 | #define TARGET_SOFT_FLOAT (arm_float_abi == ARM_FLOAT_ABI_SOFT) |
72cdc543 PB |
137 | /* Use hardware floating point instructions. */ |
138 | #define TARGET_HARD_FLOAT (arm_float_abi != ARM_FLOAT_ABI_SOFT) | |
139 | /* Use hardware floating point calling convention. */ | |
140 | #define TARGET_HARD_FLOAT_ABI (arm_float_abi == ARM_FLOAT_ABI_HARD) | |
d79f3032 | 141 | #define TARGET_VFP (arm_fpu_desc->model == ARM_FP_MODEL_VFP) |
5a9335ef | 142 | #define TARGET_IWMMXT (arm_arch_iwmmxt) |
8fd03515 | 143 | #define TARGET_IWMMXT2 (arm_arch_iwmmxt2) |
5b3e6663 | 144 | #define TARGET_REALLY_IWMMXT (TARGET_IWMMXT && TARGET_32BIT) |
8fd03515 | 145 | #define TARGET_REALLY_IWMMXT2 (TARGET_IWMMXT2 && TARGET_32BIT) |
5b3e6663 | 146 | #define TARGET_IWMMXT_ABI (TARGET_32BIT && arm_abi == ARM_ABI_IWMMXT) |
d5b7b3ae RE |
147 | #define TARGET_ARM (! TARGET_THUMB) |
148 | #define TARGET_EITHER 1 /* (TARGET_ARM | TARGET_THUMB) */ | |
c54c7322 RS |
149 | #define TARGET_BACKTRACE (leaf_function_p () \ |
150 | ? TARGET_TPCS_LEAF_FRAME \ | |
151 | : TARGET_TPCS_FRAME) | |
b6685939 PB |
152 | #define TARGET_AAPCS_BASED \ |
153 | (arm_abi != ARM_ABI_APCS && arm_abi != ARM_ABI_ATPCS) | |
3ada8e17 | 154 | |
d3585b76 DJ |
155 | #define TARGET_HARD_TP (target_thread_pointer == TP_CP15) |
156 | #define TARGET_SOFT_TP (target_thread_pointer == TP_SOFT) | |
ccdc2164 | 157 | #define TARGET_GNU2_TLS (target_tls_dialect == TLS_GNU2) |
d3585b76 | 158 | |
5b3e6663 PB |
159 | /* Only 16-bit thumb code. */ |
160 | #define TARGET_THUMB1 (TARGET_THUMB && !arm_arch_thumb2) | |
161 | /* Arm or Thumb-2 32-bit code. */ | |
162 | #define TARGET_32BIT (TARGET_ARM || arm_arch_thumb2) | |
08793a38 CB |
163 | #define TARGET_32BIT_P(flags) (TARGET_ARM_P (flags) \ |
164 | || arm_arch_thumb2) | |
5b3e6663 PB |
165 | /* 32-bit Thumb-2 code. */ |
166 | #define TARGET_THUMB2 (TARGET_THUMB && arm_arch_thumb2) | |
bf98ec6c PB |
167 | /* Thumb-1 only. */ |
168 | #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm) | |
5b3e6663 | 169 | |
3383b7fa GY |
170 | #define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN \ |
171 | && !TARGET_THUMB1) | |
172 | ||
582e2e43 KT |
173 | #define TARGET_CRC32 (arm_arch_crc) |
174 | ||
88f77cba | 175 | /* The following two macros concern the ability to execute coprocessor |
302c3d8e PB |
176 | instructions for VFPv3 or NEON. TARGET_VFP3/TARGET_VFPD32 are currently |
177 | only ever tested when we know we are generating for VFP hardware; we need | |
178 | to be more careful with TARGET_NEON as noted below. */ | |
88f77cba | 179 | |
302c3d8e | 180 | /* FPU is has the full VFPv3/NEON register file of 32 D registers. */ |
d79f3032 | 181 | #define TARGET_VFPD32 (TARGET_VFP && arm_fpu_desc->regs == VFP_REG_D32) |
302c3d8e PB |
182 | |
183 | /* FPU supports VFPv3 instructions. */ | |
d79f3032 | 184 | #define TARGET_VFP3 (TARGET_VFP && arm_fpu_desc->rev >= 3) |
302c3d8e | 185 | |
2f6403f1 TG |
186 | /* FPU supports FPv5 instructions. */ |
187 | #define TARGET_VFP5 (TARGET_VFP && arm_fpu_desc->rev >= 5) | |
188 | ||
e0dc3601 PB |
189 | /* FPU only supports VFP single-precision instructions. */ |
190 | #define TARGET_VFP_SINGLE (TARGET_VFP && arm_fpu_desc->regs == VFP_REG_SINGLE) | |
191 | ||
192 | /* FPU supports VFP double-precision instructions. */ | |
193 | #define TARGET_VFP_DOUBLE (TARGET_VFP && arm_fpu_desc->regs != VFP_REG_SINGLE) | |
194 | ||
195 | /* FPU supports half-precision floating-point with NEON element load/store. */ | |
cafd2e45 MW |
196 | #define TARGET_NEON_FP16 \ |
197 | (TARGET_VFP \ | |
198 | && ARM_FPU_FSET_HAS (arm_fpu_desc->features, FPU_FL_NEON | FPU_FL_FP16)) | |
0fd8c3ad | 199 | |
e0dc3601 | 200 | /* FPU supports VFP half-precision floating-point. */ |
cafd2e45 MW |
201 | #define TARGET_FP16 \ |
202 | (TARGET_VFP && ARM_FPU_FSET_HAS (arm_fpu_desc->features, FPU_FL_FP16)) | |
e0dc3601 | 203 | |
9e94a7fc MGD |
204 | /* FPU supports fused-multiply-add operations. */ |
205 | #define TARGET_FMA (TARGET_VFP && arm_fpu_desc->rev >= 4) | |
206 | ||
1dd4fe1f KT |
207 | /* FPU is ARMv8 compatible. */ |
208 | #define TARGET_FPU_ARMV8 (TARGET_VFP && arm_fpu_desc->rev >= 8) | |
209 | ||
595fefee | 210 | /* FPU supports Crypto extensions. */ |
cafd2e45 MW |
211 | #define TARGET_CRYPTO \ |
212 | (TARGET_VFP && ARM_FPU_FSET_HAS (arm_fpu_desc->features, FPU_FL_CRYPTO)) | |
213 | ||
595fefee | 214 | |
88f77cba JB |
215 | /* FPU supports Neon instructions. The setting of this macro gets |
216 | revealed via __ARM_NEON__ so we add extra guards upon TARGET_32BIT | |
217 | and TARGET_HARD_FLOAT to ensure that NEON instructions are | |
218 | available. */ | |
cafd2e45 MW |
219 | #define TARGET_NEON \ |
220 | (TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP \ | |
221 | && ARM_FPU_FSET_HAS (arm_fpu_desc->features, FPU_FL_NEON)) | |
222 | ||
f1adb0a9 | 223 | |
9e94a7fc | 224 | /* Q-bit is present. */ |
08793a38 CB |
225 | #define TARGET_ARM_QBIT_P(flags) \ |
226 | (TARGET_32BIT_P (flags) && arm_arch5e && (arm_arch_notm || arm_arch7)) | |
227 | #define TARGET_ARM_QBIT TARGET_ARM_QBIT_P(target_flags) | |
9e94a7fc | 228 | /* Saturation operation, e.g. SSAT. */ |
08793a38 CB |
229 | #define TARGET_ARM_SAT_P(flags) \ |
230 | (TARGET_32BIT_P (flags) && arm_arch6 && (arm_arch_notm || arm_arch7)) | |
231 | #define TARGET_ARM_SAT TARGET_ARM_SAT_P(target_flags) | |
5b3e6663 | 232 | /* "DSP" multiply instructions, eg. SMULxy. */ |
08793a38 CB |
233 | #define TARGET_DSP_MULTIPLY_P(flags) \ |
234 | (TARGET_32BIT_P (flags) && arm_arch5e && (arm_arch_notm || arm_arch7em)) | |
235 | #define TARGET_DSP_MULTIPLY TARGET_DSP_MULTIPLY_P(target_flags) | |
5b3e6663 | 236 | /* Integer SIMD instructions, and extend-accumulate instructions. */ |
08793a38 CB |
237 | #define TARGET_INT_SIMD_P(flags) \ |
238 | (TARGET_32BIT_P (flags) && arm_arch6 && (arm_arch_notm || arm_arch7em)) | |
239 | #define TARGET_INT_SIMD TARGET_INT_SIMD_P(target_flags) | |
5b3e6663 | 240 | |
571191af | 241 | /* Should MOVW/MOVT be used in preference to a constant pool. */ |
7ec70105 | 242 | #define TARGET_USE_MOVT \ |
02231c13 TG |
243 | (arm_arch_thumb2 \ |
244 | && (arm_disable_literal_pool \ | |
245 | || (!optimize_size && !current_tune->prefer_constant_pool))) | |
571191af | 246 | |
5b3e6663 | 247 | /* We could use unified syntax for arm mode, but for now we just use it |
decfc6e1 TG |
248 | for thumb mode. */ |
249 | #define TARGET_UNIFIED_ASM (TARGET_THUMB) | |
5b3e6663 | 250 | |
029e79eb | 251 | /* Nonzero if this chip provides the DMB instruction. */ |
9e2a6301 | 252 | #define TARGET_HAVE_DMB (arm_arch6m || arm_arch7) |
029e79eb MS |
253 | |
254 | /* Nonzero if this chip implements a memory barrier via CP15. */ | |
80651d8e DAG |
255 | #define TARGET_HAVE_DMB_MCR (arm_arch6 && ! TARGET_HAVE_DMB \ |
256 | && ! TARGET_THUMB1) | |
029e79eb MS |
257 | |
258 | /* Nonzero if this chip implements a memory barrier instruction. */ | |
259 | #define TARGET_HAVE_MEMORY_BARRIER (TARGET_HAVE_DMB || TARGET_HAVE_DMB_MCR) | |
260 | ||
261 | /* Nonzero if this chip supports ldrex and strex */ | |
08793a38 CB |
262 | #define TARGET_HAVE_LDREX_P(flags) ((arm_arch6 && TARGET_ARM_P (flags)) \ |
263 | || arm_arch7) | |
264 | #define TARGET_HAVE_LDREX TARGET_HAVE_LDREX_P (target_flags) | |
029e79eb | 265 | |
cfe52743 | 266 | /* Nonzero if this chip supports ldrex{bh} and strex{bh}. */ |
08793a38 CB |
267 | #define TARGET_HAVE_LDREXBH_P(flags) ((arm_arch6k && TARGET_ARM_P (flags)) \ |
268 | || arm_arch7) | |
269 | #define TARGET_HAVE_LDREXBH TARGET_HAVE_LDREXBH_P (target_flags) | |
cfe52743 DAG |
270 | |
271 | /* Nonzero if this chip supports ldrexd and strexd. */ | |
08793a38 CB |
272 | #define TARGET_HAVE_LDREXD_P(flags) (((arm_arch6k && TARGET_ARM_P (flags)) \ |
273 | || arm_arch7) && arm_arch_notm) | |
274 | #define TARGET_HAVE_LDREXD TARGET_HAVE_LDREXD_P (target_flags) | |
275 | ||
5b3e6663 | 276 | |
5ad29f12 KT |
277 | /* Nonzero if this chip supports load-acquire and store-release. */ |
278 | #define TARGET_HAVE_LDACQ (TARGET_ARM_ARCH >= 8) | |
279 | ||
572070ef | 280 | /* Nonzero if integer division instructions supported. */ |
08793a38 CB |
281 | #define TARGET_IDIV_P(flags) ((TARGET_ARM_P (flags) && arm_arch_arm_hwdiv) \ |
282 | || (TARGET_THUMB2_P (flags) \ | |
283 | && arm_arch_thumb_hwdiv)) | |
284 | #define TARGET_IDIV TARGET_IDIV_P (target_flags) | |
285 | ||
572070ef | 286 | |
afe006ad TG |
287 | /* Nonzero if disallow volatile memory access in IT block. */ |
288 | #define TARGET_NO_VOLATILE_CE (arm_arch_no_volatile_ce) | |
289 | ||
65074f54 CL |
290 | /* Should NEON be used for 64-bits bitops. */ |
291 | #define TARGET_PREFER_NEON_64BITS (prefer_neon_for_64bits) | |
292 | ||
26c66656 KV |
293 | /* Should constant I be slplit for OP. */ |
294 | #define DONT_EARLY_SPLIT_CONSTANT(i, op) \ | |
295 | ((optimize >= 2) \ | |
296 | && can_create_pseudo_p () \ | |
297 | && !const_ok_for_op (i, op)) | |
298 | ||
b3f8d95d MM |
299 | /* True iff the full BPABI is being used. If TARGET_BPABI is true, |
300 | then TARGET_AAPCS_BASED must be true -- but the converse does not | |
301 | hold. TARGET_BPABI implies the use of the BPABI runtime library, | |
302 | etc., in addition to just the AAPCS calling conventions. */ | |
303 | #ifndef TARGET_BPABI | |
304 | #define TARGET_BPABI false | |
f676971a | 305 | #endif |
b3f8d95d | 306 | |
7816bea0 DJ |
307 | /* Support for a compile-time default CPU, et cetera. The rules are: |
308 | --with-arch is ignored if -march or -mcpu are specified. | |
309 | --with-cpu is ignored if -march or -mcpu are specified, and is overridden | |
310 | by --with-arch. | |
311 | --with-tune is ignored if -mtune or -mcpu are specified (but not affected | |
312 | by -march). | |
5e1b4d5a | 313 | --with-float is ignored if -mfloat-abi is specified. |
5848830f | 314 | --with-fpu is ignored if -mfpu is specified. |
ccdc2164 NS |
315 | --with-abi is ignored if -mabi is specified. |
316 | --with-tls is ignored if -mtls-dialect is specified. */ | |
7816bea0 DJ |
317 | #define OPTION_DEFAULT_SPECS \ |
318 | {"arch", "%{!march=*:%{!mcpu=*:-march=%(VALUE)}}" }, \ | |
319 | {"cpu", "%{!march=*:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ | |
320 | {"tune", "%{!mcpu=*:%{!mtune=*:-mtune=%(VALUE)}}" }, \ | |
5e1b4d5a | 321 | {"float", "%{!mfloat-abi=*:-mfloat-abi=%(VALUE)}" }, \ |
5848830f | 322 | {"fpu", "%{!mfpu=*:-mfpu=%(VALUE)}"}, \ |
3cf94279 | 323 | {"abi", "%{!mabi=*:-mabi=%(VALUE)}"}, \ |
ccdc2164 | 324 | {"mode", "%{!marm:%{!mthumb:-m%(VALUE)}}"}, \ |
7cf13d1f | 325 | {"tls", "%{!mtls-dialect=*:-mtls-dialect=%(VALUE)}"}, |
7816bea0 | 326 | |
b813c040 MW |
327 | /* FPU feature sets. */ |
328 | ||
329 | typedef unsigned long arm_fpu_feature_set; | |
330 | ||
331 | /* Test for an FPU feature. */ | |
332 | #define ARM_FPU_FSET_HAS(S,F) (((S) & (F)) == (F)) | |
333 | ||
334 | /* FPU Features. */ | |
335 | #define FPU_FL_NONE (0) | |
336 | #define FPU_FL_NEON (1 << 0) /* NEON instructions. */ | |
337 | #define FPU_FL_FP16 (1 << 1) /* Half-precision. */ | |
338 | #define FPU_FL_CRYPTO (1 << 2) /* Crypto extensions. */ | |
339 | ||
9b66ebb1 PB |
340 | /* Which floating point model to use. */ |
341 | enum arm_fp_model | |
342 | { | |
343 | ARM_FP_MODEL_UNKNOWN, | |
9b66ebb1 PB |
344 | /* VFP floating point model. */ |
345 | ARM_FP_MODEL_VFP | |
346 | }; | |
347 | ||
d79f3032 | 348 | enum vfp_reg_type |
24f0c1b4 | 349 | { |
70dd156a | 350 | VFP_NONE = 0, |
d79f3032 PB |
351 | VFP_REG_D16, |
352 | VFP_REG_D32, | |
353 | VFP_REG_SINGLE | |
24f0c1b4 RE |
354 | }; |
355 | ||
d79f3032 PB |
356 | extern const struct arm_fpu_desc |
357 | { | |
358 | const char *name; | |
359 | enum arm_fp_model model; | |
360 | int rev; | |
361 | enum vfp_reg_type regs; | |
cafd2e45 | 362 | arm_fpu_feature_set features; |
d79f3032 PB |
363 | } *arm_fpu_desc; |
364 | ||
365 | /* Which floating point hardware to schedule for. */ | |
366 | extern int arm_fpu_attr; | |
71791e16 | 367 | |
3d8532aa PB |
368 | #ifndef TARGET_DEFAULT_FLOAT_ABI |
369 | #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT | |
370 | #endif | |
371 | ||
5848830f PB |
372 | #ifndef ARM_DEFAULT_ABI |
373 | #define ARM_DEFAULT_ABI ARM_ABI_APCS | |
374 | #endif | |
375 | ||
9e94a7fc MGD |
376 | /* Map each of the micro-architecture variants to their corresponding |
377 | major architecture revision. */ | |
378 | ||
379 | enum base_architecture | |
380 | { | |
381 | BASE_ARCH_0 = 0, | |
382 | BASE_ARCH_2 = 2, | |
383 | BASE_ARCH_3 = 3, | |
384 | BASE_ARCH_3M = 3, | |
385 | BASE_ARCH_4 = 4, | |
386 | BASE_ARCH_4T = 4, | |
387 | BASE_ARCH_5 = 5, | |
388 | BASE_ARCH_5E = 5, | |
389 | BASE_ARCH_5T = 5, | |
390 | BASE_ARCH_5TE = 5, | |
391 | BASE_ARCH_5TEJ = 5, | |
392 | BASE_ARCH_6 = 6, | |
393 | BASE_ARCH_6J = 6, | |
39c12541 | 394 | BASE_ARCH_6KZ = 6, |
9e94a7fc MGD |
395 | BASE_ARCH_6K = 6, |
396 | BASE_ARCH_6T2 = 6, | |
397 | BASE_ARCH_6M = 6, | |
398 | BASE_ARCH_6Z = 6, | |
399 | BASE_ARCH_7 = 7, | |
400 | BASE_ARCH_7A = 7, | |
401 | BASE_ARCH_7R = 7, | |
402 | BASE_ARCH_7M = 7, | |
595fefee MGD |
403 | BASE_ARCH_7EM = 7, |
404 | BASE_ARCH_8A = 8 | |
9e94a7fc MGD |
405 | }; |
406 | ||
407 | /* The major revision number of the ARM Architecture implemented by the target. */ | |
408 | extern enum base_architecture arm_base_arch; | |
409 | ||
9b66ebb1 PB |
410 | /* Nonzero if this chip supports the ARM Architecture 3M extensions. */ |
411 | extern int arm_arch3m; | |
11c1a207 | 412 | |
9b66ebb1 | 413 | /* Nonzero if this chip supports the ARM Architecture 4 extensions. */ |
11c1a207 RE |
414 | extern int arm_arch4; |
415 | ||
68d560d4 RE |
416 | /* Nonzero if this chip supports the ARM Architecture 4T extensions. */ |
417 | extern int arm_arch4t; | |
418 | ||
9b66ebb1 | 419 | /* Nonzero if this chip supports the ARM Architecture 5 extensions. */ |
62b10bbc NC |
420 | extern int arm_arch5; |
421 | ||
9b66ebb1 | 422 | /* Nonzero if this chip supports the ARM Architecture 5E extensions. */ |
b15bca31 RE |
423 | extern int arm_arch5e; |
424 | ||
9b66ebb1 PB |
425 | /* Nonzero if this chip supports the ARM Architecture 6 extensions. */ |
426 | extern int arm_arch6; | |
427 | ||
029e79eb MS |
428 | /* Nonzero if this chip supports the ARM Architecture 6k extensions. */ |
429 | extern int arm_arch6k; | |
430 | ||
9e2a6301 TG |
431 | /* Nonzero if instructions present in ARMv6-M can be used. */ |
432 | extern int arm_arch6m; | |
433 | ||
029e79eb MS |
434 | /* Nonzero if this chip supports the ARM Architecture 7 extensions. */ |
435 | extern int arm_arch7; | |
436 | ||
5b3e6663 PB |
437 | /* Nonzero if instructions not present in the 'M' profile can be used. */ |
438 | extern int arm_arch_notm; | |
439 | ||
60bd3528 PB |
440 | /* Nonzero if instructions present in ARMv7E-M can be used. */ |
441 | extern int arm_arch7em; | |
442 | ||
595fefee MGD |
443 | /* Nonzero if this chip supports the ARM Architecture 8 extensions. */ |
444 | extern int arm_arch8; | |
445 | ||
f5a1b0d2 NC |
446 | /* Nonzero if this chip can benefit from load scheduling. */ |
447 | extern int arm_ld_sched; | |
448 | ||
449 | /* Nonzero if this chip is a StrongARM. */ | |
abac3b49 | 450 | extern int arm_tune_strongarm; |
f5a1b0d2 | 451 | |
5a9335ef NC |
452 | /* Nonzero if this chip supports Intel XScale with Wireless MMX technology. */ |
453 | extern int arm_arch_iwmmxt; | |
454 | ||
8fd03515 XQ |
455 | /* Nonzero if this chip supports Intel Wireless MMX2 technology. */ |
456 | extern int arm_arch_iwmmxt2; | |
457 | ||
d19fb8e3 | 458 | /* Nonzero if this chip is an XScale. */ |
4b3c2e48 PB |
459 | extern int arm_arch_xscale; |
460 | ||
abac3b49 | 461 | /* Nonzero if tuning for XScale. */ |
4b3c2e48 | 462 | extern int arm_tune_xscale; |
d19fb8e3 | 463 | |
abac3b49 RE |
464 | /* Nonzero if tuning for stores via the write buffer. */ |
465 | extern int arm_tune_wbuf; | |
f5a1b0d2 | 466 | |
7612f14d PB |
467 | /* Nonzero if tuning for Cortex-A9. */ |
468 | extern int arm_tune_cortex_a9; | |
469 | ||
2ad4dcf9 | 470 | /* Nonzero if we should define __THUMB_INTERWORK__ in the |
f676971a | 471 | preprocessor. |
2ad4dcf9 RE |
472 | XXX This is a bit of a hack, it's intended to help work around |
473 | problems in GLD which doesn't understand that armv5t code is | |
474 | interworking clean. */ | |
475 | extern int arm_cpp_interwork; | |
476 | ||
5b3e6663 PB |
477 | /* Nonzero if chip supports Thumb 2. */ |
478 | extern int arm_arch_thumb2; | |
479 | ||
572070ef PB |
480 | /* Nonzero if chip supports integer division instruction in ARM mode. */ |
481 | extern int arm_arch_arm_hwdiv; | |
482 | ||
483 | /* Nonzero if chip supports integer division instruction in Thumb mode. */ | |
484 | extern int arm_arch_thumb_hwdiv; | |
5b3e6663 | 485 | |
afe006ad TG |
486 | /* Nonzero if chip disallows volatile memory access in IT block. */ |
487 | extern int arm_arch_no_volatile_ce; | |
488 | ||
65074f54 CL |
489 | /* Nonzero if we should use Neon to handle 64-bits operations rather |
490 | than core registers. */ | |
491 | extern int prefer_neon_for_64bits; | |
492 | ||
02231c13 TG |
493 | /* Nonzero if we shouldn't use literal pools. */ |
494 | #ifndef USED_FOR_TARGET | |
495 | extern bool arm_disable_literal_pool; | |
496 | #endif | |
497 | ||
582e2e43 KT |
498 | /* Nonzero if chip supports the ARMv8 CRC instructions. */ |
499 | extern int arm_arch_crc; | |
500 | ||
2ce9c1b9 | 501 | #ifndef TARGET_DEFAULT |
c54c7322 | 502 | #define TARGET_DEFAULT (MASK_APCS_FRAME) |
2ce9c1b9 | 503 | #endif |
35d965d5 | 504 | |
86efdc8e PB |
505 | /* Nonzero if PIC code requires explicit qualifiers to generate |
506 | PLT and GOT relocs rather than the assembler doing so implicitly. | |
ed0e6530 PB |
507 | Subtargets can override these if required. */ |
508 | #ifndef NEED_GOT_RELOC | |
509 | #define NEED_GOT_RELOC 0 | |
510 | #endif | |
511 | #ifndef NEED_PLT_RELOC | |
512 | #define NEED_PLT_RELOC 0 | |
e2723c62 | 513 | #endif |
84306176 | 514 | |
32d6e6c0 JY |
515 | #ifndef TARGET_DEFAULT_PIC_DATA_IS_TEXT_RELATIVE |
516 | #define TARGET_DEFAULT_PIC_DATA_IS_TEXT_RELATIVE 1 | |
517 | #endif | |
518 | ||
84306176 PB |
519 | /* Nonzero if we need to refer to the GOT with a PC-relative |
520 | offset. In other words, generate | |
521 | ||
f676971a | 522 | .word _GLOBAL_OFFSET_TABLE_ - [. - (.Lxx + 8)] |
84306176 PB |
523 | |
524 | rather than | |
525 | ||
526 | .word _GLOBAL_OFFSET_TABLE_ - (.Lxx + 8) | |
527 | ||
f676971a | 528 | The default is true, which matches NetBSD. Subtargets can |
84306176 PB |
529 | override this if required. */ |
530 | #ifndef GOT_PCREL | |
531 | #define GOT_PCREL 1 | |
532 | #endif | |
35d965d5 RS |
533 | \f |
534 | /* Target machine storage Layout. */ | |
535 | ||
ff9940b0 RE |
536 | |
537 | /* Define this macro if it is advisable to hold scalars in registers | |
538 | in a wider mode than that declared by the program. In such cases, | |
539 | the value is constrained to be within the bounds of the declared | |
540 | type, but kept valid in the wider mode. The signedness of the | |
541 | extension may differ from that of the type. */ | |
542 | ||
543 | /* It is far faster to zero extend chars than to sign extend them */ | |
544 | ||
6cfc7210 | 545 | #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ |
2ce9c1b9 RE |
546 | if (GET_MODE_CLASS (MODE) == MODE_INT \ |
547 | && GET_MODE_SIZE (MODE) < 4) \ | |
548 | { \ | |
549 | if (MODE == QImode) \ | |
550 | UNSIGNEDP = 1; \ | |
551 | else if (MODE == HImode) \ | |
61f0ccff | 552 | UNSIGNEDP = 1; \ |
2ce9c1b9 | 553 | (MODE) = SImode; \ |
ff9940b0 RE |
554 | } |
555 | ||
35d965d5 RS |
556 | /* Define this if most significant bit is lowest numbered |
557 | in instructions that operate on numbered bit-fields. */ | |
558 | #define BITS_BIG_ENDIAN 0 | |
559 | ||
f676971a | 560 | /* Define this if most significant byte of a word is the lowest numbered. |
3ada8e17 DE |
561 | Most ARM processors are run in little endian mode, so that is the default. |
562 | If you want to have it run-time selectable, change the definition in a | |
563 | cover file to be TARGET_BIG_ENDIAN. */ | |
11c1a207 | 564 | #define BYTES_BIG_ENDIAN (TARGET_BIG_END != 0) |
35d965d5 RS |
565 | |
566 | /* Define this if most significant word of a multiword number is the lowest | |
8adb5dc7 KT |
567 | numbered. */ |
568 | #define WORDS_BIG_ENDIAN (BYTES_BIG_ENDIAN) | |
ddee6aba | 569 | |
35d965d5 RS |
570 | #define UNITS_PER_WORD 4 |
571 | ||
5848830f | 572 | /* True if natural alignment is used for doubleword types. */ |
b6685939 PB |
573 | #define ARM_DOUBLEWORD_ALIGN TARGET_AAPCS_BASED |
574 | ||
5848830f | 575 | #define DOUBLEWORD_ALIGNMENT 64 |
35d965d5 | 576 | |
5848830f | 577 | #define PARM_BOUNDARY 32 |
5a9335ef | 578 | |
5848830f | 579 | #define STACK_BOUNDARY (ARM_DOUBLEWORD_ALIGN ? DOUBLEWORD_ALIGNMENT : 32) |
35d965d5 | 580 | |
5848830f PB |
581 | #define PREFERRED_STACK_BOUNDARY \ |
582 | (arm_abi == ARM_ABI_ATPCS ? 64 : STACK_BOUNDARY) | |
0977774b | 583 | |
f711a87a | 584 | #define FUNCTION_BOUNDARY ((TARGET_THUMB && optimize_size) ? 16 : 32) |
35d965d5 | 585 | |
92928d71 AO |
586 | /* The lowest bit is used to indicate Thumb-mode functions, so the |
587 | vbit must go into the delta field of pointers to member | |
588 | functions. */ | |
589 | #define TARGET_PTRMEMFUNC_VBIT_LOCATION ptrmemfunc_vbit_in_delta | |
590 | ||
35d965d5 RS |
591 | #define EMPTY_FIELD_BOUNDARY 32 |
592 | ||
5848830f | 593 | #define BIGGEST_ALIGNMENT (ARM_DOUBLEWORD_ALIGN ? DOUBLEWORD_ALIGNMENT : 32) |
5a9335ef | 594 | |
f276d31d BE |
595 | #define MALLOC_ABI_ALIGNMENT BIGGEST_ALIGNMENT |
596 | ||
27847754 NC |
597 | /* XXX Blah -- this macro is used directly by libobjc. Since it |
598 | supports no vector modes, cut out the complexity and fall back | |
599 | on BIGGEST_FIELD_ALIGNMENT. */ | |
600 | #ifdef IN_TARGET_LIBS | |
8fca31a2 | 601 | #define BIGGEST_FIELD_ALIGNMENT 64 |
27847754 | 602 | #endif |
5a9335ef | 603 | |
ff9940b0 | 604 | /* Make strings word-aligned so strcpy from constants will be faster. */ |
591af218 | 605 | #define CONSTANT_ALIGNMENT_FACTOR (TARGET_THUMB || ! arm_tune_xscale ? 1 : 2) |
f676971a | 606 | |
d19fb8e3 | 607 | #define CONSTANT_ALIGNMENT(EXP, ALIGN) \ |
5848830f | 608 | ((TREE_CODE (EXP) == STRING_CST \ |
36b15ad0 | 609 | && !optimize_size \ |
5848830f PB |
610 | && (ALIGN) < BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR) \ |
611 | ? BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR : (ALIGN)) | |
ff9940b0 | 612 | |
96339268 RE |
613 | /* Align definitions of arrays, unions and structures so that |
614 | initializations and copies can be made more efficient. This is not | |
615 | ABI-changing, so it only affects places where we can see the | |
0c86e0dd CLT |
616 | definition. Increasing the alignment tends to introduce padding, |
617 | so don't do this when optimizing for size/conserving stack space. */ | |
618 | #define ARM_EXPAND_ALIGNMENT(COND, EXP, ALIGN) \ | |
619 | (((COND) && ((ALIGN) < BITS_PER_WORD) \ | |
96339268 RE |
620 | && (TREE_CODE (EXP) == ARRAY_TYPE \ |
621 | || TREE_CODE (EXP) == UNION_TYPE \ | |
622 | || TREE_CODE (EXP) == RECORD_TYPE)) ? BITS_PER_WORD : (ALIGN)) | |
623 | ||
0c86e0dd CLT |
624 | /* Align global data. */ |
625 | #define DATA_ALIGNMENT(EXP, ALIGN) \ | |
626 | ARM_EXPAND_ALIGNMENT(!optimize_size, EXP, ALIGN) | |
627 | ||
96339268 | 628 | /* Similarly, make sure that objects on the stack are sensibly aligned. */ |
0c86e0dd CLT |
629 | #define LOCAL_ALIGNMENT(EXP, ALIGN) \ |
630 | ARM_EXPAND_ALIGNMENT(!flag_conserve_stack, EXP, ALIGN) | |
96339268 | 631 | |
723ae7c1 NC |
632 | /* Setting STRUCTURE_SIZE_BOUNDARY to 32 produces more efficient code, but the |
633 | value set in previous versions of this toolchain was 8, which produces more | |
634 | compact structures. The command line option -mstructure_size_boundary=<n> | |
f710504c | 635 | can be used to change this value. For compatibility with the ARM SDK |
723ae7c1 | 636 | however the value should be left at 32. ARM SDT Reference Manual (ARM DUI |
5848830f PB |
637 | 0020D) page 2-20 says "Structures are aligned on word boundaries". |
638 | The AAPCS specifies a value of 8. */ | |
6ead9ba5 | 639 | #define STRUCTURE_SIZE_BOUNDARY arm_structure_size_boundary |
723ae7c1 | 640 | |
4912a07c | 641 | /* This is the value used to initialize arm_structure_size_boundary. If a |
723ae7c1 | 642 | particular arm target wants to change the default value it should change |
6bc82793 | 643 | the definition of this macro, not STRUCTURE_SIZE_BOUNDARY. See netbsd.h |
723ae7c1 NC |
644 | for an example of this. */ |
645 | #ifndef DEFAULT_STRUCTURE_SIZE_BOUNDARY | |
646 | #define DEFAULT_STRUCTURE_SIZE_BOUNDARY 32 | |
b355a481 | 647 | #endif |
2a5307b1 | 648 | |
825dda42 | 649 | /* Nonzero if move instructions will actually fail to work |
ff9940b0 | 650 | when given unaligned data. */ |
35d965d5 | 651 | #define STRICT_ALIGNMENT 1 |
b6685939 PB |
652 | |
653 | /* wchar_t is unsigned under the AAPCS. */ | |
654 | #ifndef WCHAR_TYPE | |
655 | #define WCHAR_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "int") | |
656 | ||
657 | #define WCHAR_TYPE_SIZE BITS_PER_WORD | |
658 | #endif | |
659 | ||
655b30bf JB |
660 | /* Sized for fixed-point types. */ |
661 | ||
662 | #define SHORT_FRACT_TYPE_SIZE 8 | |
663 | #define FRACT_TYPE_SIZE 16 | |
664 | #define LONG_FRACT_TYPE_SIZE 32 | |
665 | #define LONG_LONG_FRACT_TYPE_SIZE 64 | |
666 | ||
667 | #define SHORT_ACCUM_TYPE_SIZE 16 | |
668 | #define ACCUM_TYPE_SIZE 32 | |
669 | #define LONG_ACCUM_TYPE_SIZE 64 | |
670 | #define LONG_LONG_ACCUM_TYPE_SIZE 64 | |
671 | ||
672 | #define MAX_FIXED_MODE_SIZE 64 | |
673 | ||
b6685939 PB |
674 | #ifndef SIZE_TYPE |
675 | #define SIZE_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "long unsigned int") | |
676 | #endif | |
d81d0bdd | 677 | |
077fc835 KH |
678 | #ifndef PTRDIFF_TYPE |
679 | #define PTRDIFF_TYPE (TARGET_AAPCS_BASED ? "int" : "long int") | |
680 | #endif | |
681 | ||
d81d0bdd PB |
682 | /* AAPCS requires that structure alignment is affected by bitfields. */ |
683 | #ifndef PCC_BITFIELD_TYPE_MATTERS | |
684 | #define PCC_BITFIELD_TYPE_MATTERS TARGET_AAPCS_BASED | |
685 | #endif | |
686 | ||
82a19768 AT |
687 | /* The maximum size of the sync library functions supported. */ |
688 | #ifndef MAX_SYNC_LIBFUNC_SIZE | |
5357406f | 689 | #define MAX_SYNC_LIBFUNC_SIZE (2 * UNITS_PER_WORD) |
82a19768 AT |
690 | #endif |
691 | ||
35d965d5 RS |
692 | \f |
693 | /* Standard register usage. */ | |
694 | ||
0be8bd1a | 695 | /* Register allocation in ARM Procedure Call Standard |
35d965d5 RS |
696 | (S - saved over call). |
697 | ||
698 | r0 * argument word/integer result | |
699 | r1-r3 argument word | |
700 | ||
701 | r4-r8 S register variable | |
702 | r9 S (rfp) register variable (real frame pointer) | |
f676971a | 703 | |
f5a1b0d2 | 704 | r10 F S (sl) stack limit (used by -mapcs-stack-check) |
35d965d5 RS |
705 | r11 F S (fp) argument pointer |
706 | r12 (ip) temp workspace | |
707 | r13 F S (sp) lower end of current stack frame | |
708 | r14 (lr) link address/workspace | |
709 | r15 F (pc) program counter | |
710 | ||
ff9940b0 RE |
711 | cc This is NOT a real register, but is used internally |
712 | to represent things that use or set the condition | |
713 | codes. | |
714 | sfp This isn't either. It is used during rtl generation | |
715 | since the offset between the frame pointer and the | |
716 | auto's isn't known until after register allocation. | |
717 | afp Nor this, we only need this because of non-local | |
718 | goto. Without it fp appears to be used and the | |
719 | elimination code won't get rid of sfp. It tracks | |
720 | fp exactly at all times. | |
721 | ||
5efd84c5 | 722 | *: See TARGET_CONDITIONAL_REGISTER_USAGE */ |
35d965d5 | 723 | |
9b66ebb1 PB |
724 | /* s0-s15 VFP scratch (aka d0-d7). |
725 | s16-s31 S VFP variable (aka d8-d15). | |
726 | vfpcc Not a real register. Represents the VFP condition | |
727 | code flags. */ | |
728 | ||
ff9940b0 RE |
729 | /* The stack backtrace structure is as follows: |
730 | fp points to here: | save code pointer | [fp] | |
731 | | return link value | [fp, #-4] | |
732 | | return sp value | [fp, #-8] | |
733 | | return fp value | [fp, #-12] | |
734 | [| saved r10 value |] | |
735 | [| saved r9 value |] | |
736 | [| saved r8 value |] | |
737 | [| saved r7 value |] | |
738 | [| saved r6 value |] | |
739 | [| saved r5 value |] | |
740 | [| saved r4 value |] | |
741 | [| saved r3 value |] | |
742 | [| saved r2 value |] | |
743 | [| saved r1 value |] | |
744 | [| saved r0 value |] | |
ff9940b0 RE |
745 | r0-r3 are not normally saved in a C function. */ |
746 | ||
35d965d5 RS |
747 | /* 1 for registers that have pervasive standard uses |
748 | and are not available for the register allocator. */ | |
0be8bd1a RE |
749 | #define FIXED_REGISTERS \ |
750 | { \ | |
751 | /* Core regs. */ \ | |
752 | 0,0,0,0,0,0,0,0, \ | |
753 | 0,0,0,0,0,1,0,1, \ | |
754 | /* VFP regs. */ \ | |
755 | 1,1,1,1,1,1,1,1, \ | |
756 | 1,1,1,1,1,1,1,1, \ | |
757 | 1,1,1,1,1,1,1,1, \ | |
758 | 1,1,1,1,1,1,1,1, \ | |
759 | 1,1,1,1,1,1,1,1, \ | |
760 | 1,1,1,1,1,1,1,1, \ | |
761 | 1,1,1,1,1,1,1,1, \ | |
762 | 1,1,1,1,1,1,1,1, \ | |
763 | /* IWMMXT regs. */ \ | |
764 | 1,1,1,1,1,1,1,1, \ | |
765 | 1,1,1,1,1,1,1,1, \ | |
766 | 1,1,1,1, \ | |
767 | /* Specials. */ \ | |
768 | 1,1,1,1 \ | |
35d965d5 RS |
769 | } |
770 | ||
771 | /* 1 for registers not available across function calls. | |
772 | These must include the FIXED_REGISTERS and also any | |
773 | registers that can be used without being saved. | |
774 | The latter must include the registers where values are returned | |
775 | and the register where structure-value addresses are passed. | |
ff9940b0 | 776 | Aside from that, you can include as many other registers as you like. |
f676971a | 777 | The CC is not preserved over function calls on the ARM 6, so it is |
d6b4baa4 | 778 | easier to assume this for all. SFP is preserved, since FP is. */ |
0be8bd1a RE |
779 | #define CALL_USED_REGISTERS \ |
780 | { \ | |
781 | /* Core regs. */ \ | |
782 | 1,1,1,1,0,0,0,0, \ | |
783 | 0,0,0,0,1,1,1,1, \ | |
784 | /* VFP Regs. */ \ | |
785 | 1,1,1,1,1,1,1,1, \ | |
786 | 1,1,1,1,1,1,1,1, \ | |
787 | 1,1,1,1,1,1,1,1, \ | |
788 | 1,1,1,1,1,1,1,1, \ | |
789 | 1,1,1,1,1,1,1,1, \ | |
790 | 1,1,1,1,1,1,1,1, \ | |
791 | 1,1,1,1,1,1,1,1, \ | |
792 | 1,1,1,1,1,1,1,1, \ | |
793 | /* IWMMXT regs. */ \ | |
794 | 1,1,1,1,1,1,1,1, \ | |
795 | 1,1,1,1,1,1,1,1, \ | |
796 | 1,1,1,1, \ | |
797 | /* Specials. */ \ | |
798 | 1,1,1,1 \ | |
35d965d5 RS |
799 | } |
800 | ||
6cc8c0b3 NC |
801 | #ifndef SUBTARGET_CONDITIONAL_REGISTER_USAGE |
802 | #define SUBTARGET_CONDITIONAL_REGISTER_USAGE | |
803 | #endif | |
804 | ||
6bc82793 | 805 | /* These are a couple of extensions to the formats accepted |
dd18ae56 NC |
806 | by asm_fprintf: |
807 | %@ prints out ASM_COMMENT_START | |
808 | %r prints out REGISTER_PREFIX reg_names[arg] */ | |
809 | #define ASM_FPRINTF_EXTENSIONS(FILE, ARGS, P) \ | |
810 | case '@': \ | |
811 | fputs (ASM_COMMENT_START, FILE); \ | |
812 | break; \ | |
813 | \ | |
814 | case 'r': \ | |
815 | fputs (REGISTER_PREFIX, FILE); \ | |
816 | fputs (reg_names [va_arg (ARGS, int)], FILE); \ | |
817 | break; | |
818 | ||
d5b7b3ae | 819 | /* Round X up to the nearest word. */ |
0c2ca901 | 820 | #define ROUND_UP_WORD(X) (((X) + 3) & ~3) |
d5b7b3ae | 821 | |
6cfc7210 | 822 | /* Convert fron bytes to ints. */ |
e9d7b180 | 823 | #define ARM_NUM_INTS(X) (((X) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) |
6cfc7210 | 824 | |
9b66ebb1 PB |
825 | /* The number of (integer) registers required to hold a quantity of type MODE. |
826 | Also used for VFP registers. */ | |
e9d7b180 JD |
827 | #define ARM_NUM_REGS(MODE) \ |
828 | ARM_NUM_INTS (GET_MODE_SIZE (MODE)) | |
6cfc7210 NC |
829 | |
830 | /* The number of (integer) registers required to hold a quantity of TYPE MODE. */ | |
e9d7b180 JD |
831 | #define ARM_NUM_REGS2(MODE, TYPE) \ |
832 | ARM_NUM_INTS ((MODE) == BLKmode ? \ | |
d5b7b3ae | 833 | int_size_in_bytes (TYPE) : GET_MODE_SIZE (MODE)) |
6cfc7210 NC |
834 | |
835 | /* The number of (integer) argument register available. */ | |
d5b7b3ae | 836 | #define NUM_ARG_REGS 4 |
6cfc7210 | 837 | |
390b17c2 RE |
838 | /* And similarly for the VFP. */ |
839 | #define NUM_VFP_ARG_REGS 16 | |
840 | ||
093354e0 | 841 | /* Return the register number of the N'th (integer) argument. */ |
d5b7b3ae | 842 | #define ARG_REGISTER(N) (N - 1) |
6cfc7210 | 843 | |
d5b7b3ae RE |
844 | /* Specify the registers used for certain standard purposes. |
845 | The values of these macros are register numbers. */ | |
35d965d5 | 846 | |
d5b7b3ae RE |
847 | /* The number of the last argument register. */ |
848 | #define LAST_ARG_REGNUM ARG_REGISTER (NUM_ARG_REGS) | |
35d965d5 | 849 | |
c769a35d RE |
850 | /* The numbers of the Thumb register ranges. */ |
851 | #define FIRST_LO_REGNUM 0 | |
6d3d9133 | 852 | #define LAST_LO_REGNUM 7 |
c769a35d RE |
853 | #define FIRST_HI_REGNUM 8 |
854 | #define LAST_HI_REGNUM 11 | |
6d3d9133 | 855 | |
f0a0390e RH |
856 | /* Overridden by config/arm/bpabi.h. */ |
857 | #ifndef ARM_UNWIND_INFO | |
858 | #define ARM_UNWIND_INFO 0 | |
617a1b71 PB |
859 | #endif |
860 | ||
c9ca9b88 PB |
861 | /* Use r0 and r1 to pass exception handling information. */ |
862 | #define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? N : INVALID_REGNUM) | |
863 | ||
6d3d9133 | 864 | /* The register that holds the return address in exception handlers. */ |
c9ca9b88 PB |
865 | #define ARM_EH_STACKADJ_REGNUM 2 |
866 | #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, ARM_EH_STACKADJ_REGNUM) | |
35d965d5 | 867 | |
1e874273 PB |
868 | #ifndef ARM_TARGET2_DWARF_FORMAT |
869 | #define ARM_TARGET2_DWARF_FORMAT DW_EH_PE_pcrel | |
3f2f838e | 870 | #endif |
1e874273 PB |
871 | |
872 | /* ttype entries (the only interesting data references used) | |
873 | use TARGET2 relocations. */ | |
874 | #define ASM_PREFERRED_EH_DATA_FORMAT(code, data) \ | |
875 | (((code) == 0 && (data) == 1 && ARM_UNWIND_INFO) ? ARM_TARGET2_DWARF_FORMAT \ | |
876 | : DW_EH_PE_absptr) | |
1e874273 | 877 | |
d5b7b3ae RE |
878 | /* The native (Norcroft) Pascal compiler for the ARM passes the static chain |
879 | as an invisible last argument (possible since varargs don't exist in | |
880 | Pascal), so the following is not true. */ | |
5b3e6663 | 881 | #define STATIC_CHAIN_REGNUM 12 |
35d965d5 | 882 | |
d5b7b3ae RE |
883 | /* Define this to be where the real frame pointer is if it is not possible to |
884 | work out the offset between the frame pointer and the automatic variables | |
885 | until after register allocation has taken place. FRAME_POINTER_REGNUM | |
886 | should point to a special register that we will make sure is eliminated. | |
887 | ||
888 | For the Thumb we have another problem. The TPCS defines the frame pointer | |
6bc82793 | 889 | as r11, and GCC believes that it is always possible to use the frame pointer |
d5b7b3ae RE |
890 | as base register for addressing purposes. (See comments in |
891 | find_reloads_address()). But - the Thumb does not allow high registers, | |
892 | including r11, to be used as base address registers. Hence our problem. | |
893 | ||
894 | The solution used here, and in the old thumb port is to use r7 instead of | |
895 | r11 as the hard frame pointer and to have special code to generate | |
896 | backtrace structures on the stack (if required to do so via a command line | |
6bc82793 | 897 | option) using r11. This is the only 'user visible' use of r11 as a frame |
d5b7b3ae RE |
898 | pointer. */ |
899 | #define ARM_HARD_FRAME_POINTER_REGNUM 11 | |
900 | #define THUMB_HARD_FRAME_POINTER_REGNUM 7 | |
35d965d5 | 901 | |
b15bca31 RE |
902 | #define HARD_FRAME_POINTER_REGNUM \ |
903 | (TARGET_ARM \ | |
904 | ? ARM_HARD_FRAME_POINTER_REGNUM \ | |
905 | : THUMB_HARD_FRAME_POINTER_REGNUM) | |
d5b7b3ae | 906 | |
e3339d0f JM |
907 | #define HARD_FRAME_POINTER_IS_FRAME_POINTER 0 |
908 | #define HARD_FRAME_POINTER_IS_ARG_POINTER 0 | |
909 | ||
b15bca31 | 910 | #define FP_REGNUM HARD_FRAME_POINTER_REGNUM |
d5b7b3ae | 911 | |
b15bca31 RE |
912 | /* Register to use for pushing function arguments. */ |
913 | #define STACK_POINTER_REGNUM SP_REGNUM | |
d5b7b3ae | 914 | |
0be8bd1a RE |
915 | #define FIRST_IWMMXT_REGNUM (LAST_HI_VFP_REGNUM + 1) |
916 | #define LAST_IWMMXT_REGNUM (FIRST_IWMMXT_REGNUM + 15) | |
a76213b9 XQ |
917 | |
918 | /* Need to sync with WCGR in iwmmxt.md. */ | |
0be8bd1a RE |
919 | #define FIRST_IWMMXT_GR_REGNUM (LAST_IWMMXT_REGNUM + 1) |
920 | #define LAST_IWMMXT_GR_REGNUM (FIRST_IWMMXT_GR_REGNUM + 3) | |
d5b7b3ae | 921 | |
5a9335ef NC |
922 | #define IS_IWMMXT_REGNUM(REGNUM) \ |
923 | (((REGNUM) >= FIRST_IWMMXT_REGNUM) && ((REGNUM) <= LAST_IWMMXT_REGNUM)) | |
924 | #define IS_IWMMXT_GR_REGNUM(REGNUM) \ | |
925 | (((REGNUM) >= FIRST_IWMMXT_GR_REGNUM) && ((REGNUM) <= LAST_IWMMXT_GR_REGNUM)) | |
926 | ||
35d965d5 | 927 | /* Base register for access to local variables of the function. */ |
0be8bd1a | 928 | #define FRAME_POINTER_REGNUM 102 |
ff9940b0 | 929 | |
d5b7b3ae | 930 | /* Base register for access to arguments of the function. */ |
0be8bd1a | 931 | #define ARG_POINTER_REGNUM 103 |
62b10bbc | 932 | |
0be8bd1a RE |
933 | #define FIRST_VFP_REGNUM 16 |
934 | #define D7_VFP_REGNUM (FIRST_VFP_REGNUM + 15) | |
f1adb0a9 | 935 | #define LAST_VFP_REGNUM \ |
302c3d8e | 936 | (TARGET_VFPD32 ? LAST_HI_VFP_REGNUM : LAST_LO_VFP_REGNUM) |
f1adb0a9 | 937 | |
9b66ebb1 PB |
938 | #define IS_VFP_REGNUM(REGNUM) \ |
939 | (((REGNUM) >= FIRST_VFP_REGNUM) && ((REGNUM) <= LAST_VFP_REGNUM)) | |
940 | ||
f1adb0a9 JB |
941 | /* VFP registers are split into two types: those defined by VFP versions < 3 |
942 | have D registers overlaid on consecutive pairs of S registers. VFP version 3 | |
943 | defines 16 new D registers (d16-d31) which, for simplicity and correctness | |
944 | in various parts of the backend, we implement as "fake" single-precision | |
945 | registers (which would be S32-S63, but cannot be used in that way). The | |
946 | following macros define these ranges of registers. */ | |
0be8bd1a RE |
947 | #define LAST_LO_VFP_REGNUM (FIRST_VFP_REGNUM + 31) |
948 | #define FIRST_HI_VFP_REGNUM (LAST_LO_VFP_REGNUM + 1) | |
949 | #define LAST_HI_VFP_REGNUM (FIRST_HI_VFP_REGNUM + 31) | |
f1adb0a9 JB |
950 | |
951 | #define VFP_REGNO_OK_FOR_SINGLE(REGNUM) \ | |
952 | ((REGNUM) <= LAST_LO_VFP_REGNUM) | |
953 | ||
954 | /* DFmode values are only valid in even register pairs. */ | |
955 | #define VFP_REGNO_OK_FOR_DOUBLE(REGNUM) \ | |
956 | ((((REGNUM) - FIRST_VFP_REGNUM) & 1) == 0) | |
957 | ||
88f77cba JB |
958 | /* Neon Quad values must start at a multiple of four registers. */ |
959 | #define NEON_REGNO_OK_FOR_QUAD(REGNUM) \ | |
960 | ((((REGNUM) - FIRST_VFP_REGNUM) & 3) == 0) | |
961 | ||
962 | /* Neon structures of vectors must be in even register pairs and there | |
963 | must be enough registers available. Because of various patterns | |
964 | requiring quad registers, we require them to start at a multiple of | |
965 | four. */ | |
966 | #define NEON_REGNO_OK_FOR_NREGS(REGNUM, N) \ | |
967 | ((((REGNUM) - FIRST_VFP_REGNUM) & 3) == 0 \ | |
968 | && (LAST_VFP_REGNUM - (REGNUM) >= 2 * (N) - 1)) | |
969 | ||
0be8bd1a | 970 | /* The number of hard registers is 16 ARM + 1 CC + 1 SFP + 1 AFP. */ |
5a9335ef | 971 | /* Intel Wireless MMX Technology registers add 16 + 4 more. */ |
0be8bd1a RE |
972 | /* VFP (VFP3) adds 32 (64) + 1 VFPCC. */ |
973 | #define FIRST_PSEUDO_REGISTER 104 | |
62b10bbc | 974 | |
2fa330b2 PB |
975 | #define DBX_REGISTER_NUMBER(REGNO) arm_dbx_register_number (REGNO) |
976 | ||
35d965d5 RS |
977 | /* Value should be nonzero if functions must have frame pointers. |
978 | Zero means the frame pointer need not be set up (and parms may be accessed | |
f676971a | 979 | via the stack pointer) in functions that seem suitable. |
ff9940b0 RE |
980 | If we have to have a frame pointer we might as well make use of it. |
981 | APCS says that the frame pointer does not need to be pushed in leaf | |
2a5307b1 | 982 | functions, or simple tail call functions. */ |
a15900b5 DJ |
983 | |
984 | #ifndef SUBTARGET_FRAME_POINTER_REQUIRED | |
985 | #define SUBTARGET_FRAME_POINTER_REQUIRED 0 | |
986 | #endif | |
987 | ||
d5b7b3ae RE |
988 | /* Return number of consecutive hard regs needed starting at reg REGNO |
989 | to hold something of mode MODE. | |
990 | This is ordinarily the length in words of a value of mode MODE | |
991 | but can be less for certain modes in special long registers. | |
35d965d5 | 992 | |
0be8bd1a | 993 | On the ARM core regs are UNITS_PER_WORD bits wide. */ |
d5b7b3ae | 994 | #define HARD_REGNO_NREGS(REGNO, MODE) \ |
5b3e6663 | 995 | ((TARGET_32BIT \ |
0be8bd1a | 996 | && REGNO > PC_REGNUM \ |
d5b7b3ae RE |
997 | && REGNO != FRAME_POINTER_REGNUM \ |
998 | && REGNO != ARG_POINTER_REGNUM) \ | |
9b66ebb1 | 999 | && !IS_VFP_REGNUM (REGNO) \ |
e9d7b180 | 1000 | ? 1 : ARM_NUM_REGS (MODE)) |
35d965d5 | 1001 | |
4b02997f | 1002 | /* Return true if REGNO is suitable for holding a quantity of type MODE. */ |
d5b7b3ae | 1003 | #define HARD_REGNO_MODE_OK(REGNO, MODE) \ |
4b02997f | 1004 | arm_hard_regno_mode_ok ((REGNO), (MODE)) |
35d965d5 | 1005 | |
2af8e257 | 1006 | #define MODES_TIEABLE_P(MODE1, MODE2) arm_modes_tieable_p (MODE1, MODE2) |
ff9940b0 | 1007 | |
5a9335ef | 1008 | #define VALID_IWMMXT_REG_MODE(MODE) \ |
f676971a | 1009 | (arm_vector_mode_supported_p (MODE) || (MODE) == DImode) |
5a9335ef | 1010 | |
88f77cba JB |
1011 | /* Modes valid for Neon D registers. */ |
1012 | #define VALID_NEON_DREG_MODE(MODE) \ | |
1013 | ((MODE) == V2SImode || (MODE) == V4HImode || (MODE) == V8QImode \ | |
5819f96f | 1014 | || (MODE) == V4HFmode || (MODE) == V2SFmode || (MODE) == DImode) |
88f77cba JB |
1015 | |
1016 | /* Modes valid for Neon Q registers. */ | |
1017 | #define VALID_NEON_QREG_MODE(MODE) \ | |
1018 | ((MODE) == V4SImode || (MODE) == V8HImode || (MODE) == V16QImode \ | |
1019 | || (MODE) == V4SFmode || (MODE) == V2DImode) | |
1020 | ||
1021 | /* Structure modes valid for Neon registers. */ | |
1022 | #define VALID_NEON_STRUCT_MODE(MODE) \ | |
1023 | ((MODE) == TImode || (MODE) == EImode || (MODE) == OImode \ | |
1024 | || (MODE) == CImode || (MODE) == XImode) | |
1025 | ||
37119410 BS |
1026 | /* The register numbers in sequence, for passing to arm_gen_load_multiple. */ |
1027 | extern int arm_regs_in_sequence[]; | |
1028 | ||
35d965d5 | 1029 | /* The order in which register should be allocated. It is good to use ip |
ff9940b0 RE |
1030 | since no saving is required (though calls clobber it) and it never contains |
1031 | function parameters. It is quite good to use lr since other calls may | |
f676971a | 1032 | clobber it anyway. Allocate r0 through r3 in reverse order since r3 is |
ff9940b0 | 1033 | least likely to contain a function parameter; in addition results are |
f1adb0a9 JB |
1034 | returned in r0. |
1035 | For VFP/VFPv3, allocate D16-D31 first, then caller-saved registers (D0-D7), | |
1036 | then D8-D15. The reason for doing this is to attempt to reduce register | |
1037 | pressure when both single- and double-precision registers are used in a | |
1038 | function. */ | |
1039 | ||
0be8bd1a RE |
1040 | #define VREG(X) (FIRST_VFP_REGNUM + (X)) |
1041 | #define WREG(X) (FIRST_IWMMXT_REGNUM + (X)) | |
1042 | #define WGREG(X) (FIRST_IWMMXT_GR_REGNUM + (X)) | |
1043 | ||
f1adb0a9 JB |
1044 | #define REG_ALLOC_ORDER \ |
1045 | { \ | |
0be8bd1a RE |
1046 | /* General registers. */ \ |
1047 | 3, 2, 1, 0, 12, 14, 4, 5, \ | |
1048 | 6, 7, 8, 9, 10, 11, \ | |
1049 | /* High VFP registers. */ \ | |
1050 | VREG(32), VREG(33), VREG(34), VREG(35), \ | |
1051 | VREG(36), VREG(37), VREG(38), VREG(39), \ | |
1052 | VREG(40), VREG(41), VREG(42), VREG(43), \ | |
1053 | VREG(44), VREG(45), VREG(46), VREG(47), \ | |
1054 | VREG(48), VREG(49), VREG(50), VREG(51), \ | |
1055 | VREG(52), VREG(53), VREG(54), VREG(55), \ | |
1056 | VREG(56), VREG(57), VREG(58), VREG(59), \ | |
1057 | VREG(60), VREG(61), VREG(62), VREG(63), \ | |
1058 | /* VFP argument registers. */ \ | |
1059 | VREG(15), VREG(14), VREG(13), VREG(12), \ | |
1060 | VREG(11), VREG(10), VREG(9), VREG(8), \ | |
1061 | VREG(7), VREG(6), VREG(5), VREG(4), \ | |
1062 | VREG(3), VREG(2), VREG(1), VREG(0), \ | |
1063 | /* VFP call-saved registers. */ \ | |
1064 | VREG(16), VREG(17), VREG(18), VREG(19), \ | |
1065 | VREG(20), VREG(21), VREG(22), VREG(23), \ | |
1066 | VREG(24), VREG(25), VREG(26), VREG(27), \ | |
1067 | VREG(28), VREG(29), VREG(30), VREG(31), \ | |
1068 | /* IWMMX registers. */ \ | |
1069 | WREG(0), WREG(1), WREG(2), WREG(3), \ | |
1070 | WREG(4), WREG(5), WREG(6), WREG(7), \ | |
1071 | WREG(8), WREG(9), WREG(10), WREG(11), \ | |
1072 | WREG(12), WREG(13), WREG(14), WREG(15), \ | |
1073 | WGREG(0), WGREG(1), WGREG(2), WGREG(3), \ | |
1074 | /* Registers not for general use. */ \ | |
1075 | CC_REGNUM, VFPCC_REGNUM, \ | |
1076 | FRAME_POINTER_REGNUM, ARG_POINTER_REGNUM, \ | |
1077 | SP_REGNUM, PC_REGNUM \ | |
35d965d5 | 1078 | } |
9338ffe6 | 1079 | |
795dc4fc | 1080 | /* Use different register alloc ordering for Thumb. */ |
5a733826 BS |
1081 | #define ADJUST_REG_ALLOC_ORDER arm_order_regs_for_local_alloc () |
1082 | ||
1083 | /* Tell IRA to use the order we define rather than messing it up with its | |
1084 | own cost calculations. */ | |
ed15c598 | 1085 | #define HONOR_REG_ALLOC_ORDER 1 |
795dc4fc | 1086 | |
9338ffe6 PB |
1087 | /* Interrupt functions can only use registers that have already been |
1088 | saved by the prologue, even if they would normally be | |
1089 | call-clobbered. */ | |
1090 | #define HARD_REGNO_RENAME_OK(SRC, DST) \ | |
1091 | (! IS_INTERRUPT (cfun->machine->func_type) || \ | |
6fb5fa3c | 1092 | df_regs_ever_live_p (DST)) |
35d965d5 RS |
1093 | \f |
1094 | /* Register and constant classes. */ | |
1095 | ||
0be8bd1a | 1096 | /* Register classes. */ |
35d965d5 RS |
1097 | enum reg_class |
1098 | { | |
1099 | NO_REGS, | |
0be8bd1a RE |
1100 | LO_REGS, |
1101 | STACK_REG, | |
1102 | BASE_REGS, | |
1103 | HI_REGS, | |
9adcfa3c | 1104 | CALLER_SAVE_REGS, |
0be8bd1a RE |
1105 | GENERAL_REGS, |
1106 | CORE_REGS, | |
f1adb0a9 JB |
1107 | VFP_D0_D7_REGS, |
1108 | VFP_LO_REGS, | |
1109 | VFP_HI_REGS, | |
9b66ebb1 | 1110 | VFP_REGS, |
5a9335ef | 1111 | IWMMXT_REGS, |
0be8bd1a | 1112 | IWMMXT_GR_REGS, |
d5b7b3ae | 1113 | CC_REG, |
9b66ebb1 | 1114 | VFPCC_REG, |
0be8bd1a RE |
1115 | SFP_REG, |
1116 | AFP_REG, | |
35d965d5 RS |
1117 | ALL_REGS, |
1118 | LIM_REG_CLASSES | |
1119 | }; | |
1120 | ||
1121 | #define N_REG_CLASSES (int) LIM_REG_CLASSES | |
1122 | ||
d6b4baa4 | 1123 | /* Give names of register classes as strings for dump file. */ |
35d965d5 RS |
1124 | #define REG_CLASS_NAMES \ |
1125 | { \ | |
1126 | "NO_REGS", \ | |
0be8bd1a RE |
1127 | "LO_REGS", \ |
1128 | "STACK_REG", \ | |
1129 | "BASE_REGS", \ | |
1130 | "HI_REGS", \ | |
9adcfa3c | 1131 | "CALLER_SAVE_REGS", \ |
0be8bd1a RE |
1132 | "GENERAL_REGS", \ |
1133 | "CORE_REGS", \ | |
f1adb0a9 JB |
1134 | "VFP_D0_D7_REGS", \ |
1135 | "VFP_LO_REGS", \ | |
1136 | "VFP_HI_REGS", \ | |
9b66ebb1 | 1137 | "VFP_REGS", \ |
5a9335ef | 1138 | "IWMMXT_REGS", \ |
0be8bd1a | 1139 | "IWMMXT_GR_REGS", \ |
d5b7b3ae | 1140 | "CC_REG", \ |
5384443a | 1141 | "VFPCC_REG", \ |
9f4f1735 JJ |
1142 | "SFP_REG", \ |
1143 | "AFP_REG", \ | |
1144 | "ALL_REGS" \ | |
35d965d5 RS |
1145 | } |
1146 | ||
1147 | /* Define which registers fit in which classes. | |
1148 | This is an initializer for a vector of HARD_REG_SET | |
1149 | of length N_REG_CLASSES. */ | |
f1adb0a9 JB |
1150 | #define REG_CLASS_CONTENTS \ |
1151 | { \ | |
1152 | { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \ | |
f1adb0a9 JB |
1153 | { 0x000000FF, 0x00000000, 0x00000000, 0x00000000 }, /* LO_REGS */ \ |
1154 | { 0x00002000, 0x00000000, 0x00000000, 0x00000000 }, /* STACK_REG */ \ | |
1155 | { 0x000020FF, 0x00000000, 0x00000000, 0x00000000 }, /* BASE_REGS */ \ | |
0be8bd1a | 1156 | { 0x00005F00, 0x00000000, 0x00000000, 0x00000000 }, /* HI_REGS */ \ |
9adcfa3c | 1157 | { 0x0000100F, 0x00000000, 0x00000000, 0x00000000 }, /* CALLER_SAVE_REGS */ \ |
0be8bd1a RE |
1158 | { 0x00005FFF, 0x00000000, 0x00000000, 0x00000000 }, /* GENERAL_REGS */ \ |
1159 | { 0x00007FFF, 0x00000000, 0x00000000, 0x00000000 }, /* CORE_REGS */ \ | |
1160 | { 0xFFFF0000, 0x00000000, 0x00000000, 0x00000000 }, /* VFP_D0_D7_REGS */ \ | |
1161 | { 0xFFFF0000, 0x0000FFFF, 0x00000000, 0x00000000 }, /* VFP_LO_REGS */ \ | |
1162 | { 0x00000000, 0xFFFF0000, 0x0000FFFF, 0x00000000 }, /* VFP_HI_REGS */ \ | |
1163 | { 0xFFFF0000, 0xFFFFFFFF, 0x0000FFFF, 0x00000000 }, /* VFP_REGS */ \ | |
1164 | { 0x00000000, 0x00000000, 0xFFFF0000, 0x00000000 }, /* IWMMXT_REGS */ \ | |
1165 | { 0x00000000, 0x00000000, 0x00000000, 0x0000000F }, /* IWMMXT_GR_REGS */ \ | |
1166 | { 0x00000000, 0x00000000, 0x00000000, 0x00000010 }, /* CC_REG */ \ | |
1167 | { 0x00000000, 0x00000000, 0x00000000, 0x00000020 }, /* VFPCC_REG */ \ | |
1168 | { 0x00000000, 0x00000000, 0x00000000, 0x00000040 }, /* SFP_REG */ \ | |
1169 | { 0x00000000, 0x00000000, 0x00000000, 0x00000080 }, /* AFP_REG */ \ | |
d8484d41 | 1170 | { 0xFFFF7FFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000000F } /* ALL_REGS */ \ |
35d965d5 | 1171 | } |
4b02997f | 1172 | |
f1adb0a9 JB |
1173 | /* Any of the VFP register classes. */ |
1174 | #define IS_VFP_CLASS(X) \ | |
1175 | ((X) == VFP_D0_D7_REGS || (X) == VFP_LO_REGS \ | |
1176 | || (X) == VFP_HI_REGS || (X) == VFP_REGS) | |
1177 | ||
35d965d5 RS |
1178 | /* The same information, inverted: |
1179 | Return the class number of the smallest class containing | |
1180 | reg number REGNO. This could be a conditional expression | |
1181 | or could index an array. */ | |
d5b7b3ae | 1182 | #define REGNO_REG_CLASS(REGNO) arm_regno_class (REGNO) |
35d965d5 | 1183 | |
0be8bd1a RE |
1184 | /* In VFPv1, VFP registers could only be accessed in the mode they |
1185 | were set, so subregs would be invalid there. However, we don't | |
1186 | support VFPv1 at the moment, and the restriction was lifted in | |
e81bf2ce JB |
1187 | VFPv2. |
1188 | In big-endian mode, modes greater than word size (i.e. DFmode) are stored in | |
1189 | VFP registers in little-endian order. We can't describe that accurately to | |
db57bbc9 KT |
1190 | GCC, so avoid taking subregs of such values. |
1191 | The only exception is going from a 128-bit to a 64-bit type. In that case | |
1192 | the data layout happens to be consistent for big-endian, so we explicitly allow | |
1193 | that case. */ | |
1194 | #define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \ | |
1195 | (TARGET_VFP && TARGET_BIG_END \ | |
1196 | && !(GET_MODE_SIZE (FROM) == 16 && GET_MODE_SIZE (TO) == 8) \ | |
1197 | && (GET_MODE_SIZE (FROM) > UNITS_PER_WORD \ | |
1198 | || GET_MODE_SIZE (TO) > UNITS_PER_WORD) \ | |
e81bf2ce | 1199 | && reg_classes_intersect_p (VFP_REGS, (CLASS))) |
75d2580c | 1200 | |
35d965d5 | 1201 | /* The class value for index registers, and the one for base regs. */ |
5b3e6663 | 1202 | #define INDEX_REG_CLASS (TARGET_THUMB1 ? LO_REGS : GENERAL_REGS) |
f5c630c3 | 1203 | #define BASE_REG_CLASS (TARGET_THUMB1 ? LO_REGS : CORE_REGS) |
d5b7b3ae | 1204 | |
b93a0fe6 | 1205 | /* For the Thumb the high registers cannot be used as base registers |
6bc82793 | 1206 | when addressing quantities in QI or HI mode; if we don't know the |
888d2cd6 | 1207 | mode, then we must be conservative. */ |
c896d4b4 MW |
1208 | #define MODE_BASE_REG_CLASS(MODE) \ |
1209 | (TARGET_32BIT ? CORE_REGS \ | |
1210 | : GET_MODE_SIZE (MODE) >= 4 ? BASE_REGS \ | |
1211 | : LO_REGS) | |
888d2cd6 DJ |
1212 | |
1213 | /* For Thumb we can not support SP+reg addressing, so we return LO_REGS | |
1214 | instead of BASE_REGS. */ | |
1215 | #define MODE_BASE_REG_REG_CLASS(MODE) BASE_REG_CLASS | |
3dcc68a4 | 1216 | |
42db504c | 1217 | /* When this hook returns true for MODE, the compiler allows |
d5b7b3ae RE |
1218 | registers explicitly used in the rtl to be used as spill registers |
1219 | but prevents the compiler from extending the lifetime of these | |
d6b4baa4 | 1220 | registers. */ |
42db504c SB |
1221 | #define TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P \ |
1222 | arm_small_register_classes_for_mode_p | |
35d965d5 | 1223 | |
d5b7b3ae RE |
1224 | /* Must leave BASE_REGS reloads alone */ |
1225 | #define THUMB_SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \ | |
78a14aa8 YR |
1226 | (lra_in_progress ? NO_REGS \ |
1227 | : ((CLASS) != LO_REGS && (CLASS) != BASE_REGS \ | |
1228 | ? ((true_regnum (X) == -1 ? LO_REGS \ | |
1229 | : (true_regnum (X) + HARD_REGNO_NREGS (0, MODE) > 8) ? LO_REGS \ | |
1230 | : NO_REGS)) \ | |
1231 | : NO_REGS)) | |
d5b7b3ae RE |
1232 | |
1233 | #define THUMB_SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \ | |
1fc017b6 VM |
1234 | (lra_in_progress ? NO_REGS \ |
1235 | : (CLASS) != LO_REGS && (CLASS) != BASE_REGS \ | |
1236 | ? ((true_regnum (X) == -1 ? LO_REGS \ | |
1237 | : (true_regnum (X) + HARD_REGNO_NREGS (0, MODE) > 8) ? LO_REGS \ | |
1238 | : NO_REGS)) \ | |
1239 | : NO_REGS) | |
35d965d5 | 1240 | |
ff9940b0 RE |
1241 | /* Return the register class of a scratch register needed to copy IN into |
1242 | or out of a register in CLASS in MODE. If it can be done directly, | |
1243 | NO_REGS is returned. */ | |
d5b7b3ae | 1244 | #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \ |
fe2d934b | 1245 | /* Restrict which direct reloads are allowed for VFP/iWMMXt regs. */ \ |
9b66ebb1 | 1246 | ((TARGET_VFP && TARGET_HARD_FLOAT \ |
f1adb0a9 | 1247 | && IS_VFP_CLASS (CLASS)) \ |
fe2d934b PB |
1248 | ? coproc_secondary_reload_class (MODE, X, FALSE) \ |
1249 | : (TARGET_IWMMXT && (CLASS) == IWMMXT_REGS) \ | |
1250 | ? coproc_secondary_reload_class (MODE, X, TRUE) \ | |
5b3e6663 | 1251 | : TARGET_32BIT \ |
9b66ebb1 | 1252 | ? (((MODE) == HImode && ! arm_arch4 && true_regnum (X) == -1) \ |
d5b7b3ae RE |
1253 | ? GENERAL_REGS : NO_REGS) \ |
1254 | : THUMB_SECONDARY_OUTPUT_RELOAD_CLASS (CLASS, MODE, X)) | |
f676971a | 1255 | |
d6b4baa4 | 1256 | /* If we need to load shorts byte-at-a-time, then we need a scratch. */ |
d5b7b3ae | 1257 | #define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \ |
fe2d934b | 1258 | /* Restrict which direct reloads are allowed for VFP/iWMMXt regs. */ \ |
9b66ebb1 | 1259 | ((TARGET_VFP && TARGET_HARD_FLOAT \ |
f1adb0a9 | 1260 | && IS_VFP_CLASS (CLASS)) \ |
fe2d934b PB |
1261 | ? coproc_secondary_reload_class (MODE, X, FALSE) : \ |
1262 | (TARGET_IWMMXT && (CLASS) == IWMMXT_REGS) ? \ | |
1263 | coproc_secondary_reload_class (MODE, X, TRUE) : \ | |
0be8bd1a RE |
1264 | (TARGET_32BIT ? \ |
1265 | (((CLASS) == IWMMXT_REGS || (CLASS) == IWMMXT_GR_REGS) \ | |
1266 | && CONSTANT_P (X)) \ | |
9b6b54e2 | 1267 | ? GENERAL_REGS : \ |
0be8bd1a | 1268 | (((MODE) == HImode && ! arm_arch4 \ |
d435a4be KT |
1269 | && (MEM_P (X) \ |
1270 | || ((REG_P (X) || GET_CODE (X) == SUBREG) \ | |
0be8bd1a RE |
1271 | && true_regnum (X) == -1))) \ |
1272 | ? GENERAL_REGS : NO_REGS) \ | |
1273 | : THUMB_SECONDARY_INPUT_RELOAD_CLASS (CLASS, MODE, X))) | |
2ce9c1b9 | 1274 | |
35d965d5 RS |
1275 | /* Return the maximum number of consecutive registers |
1276 | needed to represent mode MODE in a register of class CLASS. | |
0be8bd1a RE |
1277 | ARM regs are UNITS_PER_WORD bits. |
1278 | FIXME: Is this true for iWMMX? */ | |
35d965d5 | 1279 | #define CLASS_MAX_NREGS(CLASS, MODE) \ |
0be8bd1a | 1280 | (ARM_NUM_REGS (MODE)) |
9b6b54e2 NC |
1281 | |
1282 | /* If defined, gives a class of registers that cannot be used as the | |
1283 | operand of a SUBREG that changes the mode of the object illegally. */ | |
35d965d5 RS |
1284 | \f |
1285 | /* Stack layout; function entry, exit and calling. */ | |
1286 | ||
1287 | /* Define this if pushing a word on the stack | |
1288 | makes the stack pointer a smaller address. */ | |
1289 | #define STACK_GROWS_DOWNWARD 1 | |
1290 | ||
a4d05547 | 1291 | /* Define this to nonzero if the nominal address of the stack frame |
35d965d5 RS |
1292 | is at the high-address end of the local variables; |
1293 | that is, each additional local variable allocated | |
1294 | goes at a more negative offset in the frame. */ | |
1295 | #define FRAME_GROWS_DOWNWARD 1 | |
1296 | ||
a2503645 RS |
1297 | /* The amount of scratch space needed by _interwork_{r7,r11}_call_via_rN(). |
1298 | When present, it is one word in size, and sits at the top of the frame, | |
1299 | between the soft frame pointer and either r7 or r11. | |
1300 | ||
1301 | We only need _interwork_rM_call_via_rN() for -mcaller-super-interworking, | |
1302 | and only then if some outgoing arguments are passed on the stack. It would | |
1303 | be tempting to also check whether the stack arguments are passed by indirect | |
1304 | calls, but there seems to be no reason in principle why a post-reload pass | |
1305 | couldn't convert a direct call into an indirect one. */ | |
1306 | #define CALLER_INTERWORKING_SLOT_SIZE \ | |
1307 | (TARGET_CALLER_INTERWORKING \ | |
38173d38 | 1308 | && crtl->outgoing_args_size != 0 \ |
a2503645 RS |
1309 | ? UNITS_PER_WORD : 0) |
1310 | ||
35d965d5 RS |
1311 | /* Offset within stack frame to start allocating local variables at. |
1312 | If FRAME_GROWS_DOWNWARD, this is the offset to the END of the | |
1313 | first local allocated. Otherwise, it is the offset to the BEGINNING | |
1314 | of the first local allocated. */ | |
1315 | #define STARTING_FRAME_OFFSET 0 | |
1316 | ||
1317 | /* If we generate an insn to push BYTES bytes, | |
1318 | this says how many the stack pointer really advances by. */ | |
d5b7b3ae | 1319 | /* The push insns do not do this rounding implicitly. |
d6b4baa4 | 1320 | So don't define this. */ |
0c2ca901 | 1321 | /* #define PUSH_ROUNDING(NPUSHED) ROUND_UP_WORD (NPUSHED) */ |
18543a22 ILT |
1322 | |
1323 | /* Define this if the maximum size of all the outgoing args is to be | |
1324 | accumulated and pushed during the prologue. The amount can be | |
38173d38 | 1325 | found in the variable crtl->outgoing_args_size. */ |
6cfc7210 | 1326 | #define ACCUMULATE_OUTGOING_ARGS 1 |
35d965d5 RS |
1327 | |
1328 | /* Offset of first parameter from the argument pointer register value. */ | |
d5b7b3ae | 1329 | #define FIRST_PARM_OFFSET(FNDECL) (TARGET_ARM ? 4 : 0) |
35d965d5 | 1330 | |
9f7bf991 RE |
1331 | /* Amount of memory needed for an untyped call to save all possible return |
1332 | registers. */ | |
1333 | #define APPLY_RESULT_SIZE arm_apply_result_size() | |
1334 | ||
11c1a207 RE |
1335 | /* Define DEFAULT_PCC_STRUCT_RETURN to 1 if all structure and union return |
1336 | values must be in memory. On the ARM, they need only do so if larger | |
d6b4baa4 | 1337 | than a word, or if they contain elements offset from zero in the struct. */ |
11c1a207 RE |
1338 | #define DEFAULT_PCC_STRUCT_RETURN 0 |
1339 | ||
6d3d9133 | 1340 | /* These bits describe the different types of function supported |
112cdef5 | 1341 | by the ARM backend. They are exclusive. i.e. a function cannot be both a |
6d3d9133 NC |
1342 | normal function and an interworked function, for example. Knowing the |
1343 | type of a function is important for determining its prologue and | |
1344 | epilogue sequences. | |
1345 | Note value 7 is currently unassigned. Also note that the interrupt | |
1346 | function types all have bit 2 set, so that they can be tested for easily. | |
1347 | Note that 0 is deliberately chosen for ARM_FT_UNKNOWN so that when the | |
4912a07c | 1348 | machine_function structure is initialized (to zero) func_type will |
6d3d9133 NC |
1349 | default to unknown. This will force the first use of arm_current_func_type |
1350 | to call arm_compute_func_type. */ | |
1351 | #define ARM_FT_UNKNOWN 0 /* Type has not yet been determined. */ | |
1352 | #define ARM_FT_NORMAL 1 /* Your normal, straightforward function. */ | |
1353 | #define ARM_FT_INTERWORKED 2 /* A function that supports interworking. */ | |
6d3d9133 NC |
1354 | #define ARM_FT_ISR 4 /* An interrupt service routine. */ |
1355 | #define ARM_FT_FIQ 5 /* A fast interrupt service routine. */ | |
1356 | #define ARM_FT_EXCEPTION 6 /* An ARM exception handler (subcase of ISR). */ | |
1357 | ||
1358 | #define ARM_FT_TYPE_MASK ((1 << 3) - 1) | |
1359 | ||
1360 | /* In addition functions can have several type modifiers, | |
1361 | outlined by these bit masks: */ | |
1362 | #define ARM_FT_INTERRUPT (1 << 2) /* Note overlap with FT_ISR and above. */ | |
1363 | #define ARM_FT_NAKED (1 << 3) /* No prologue or epilogue. */ | |
1364 | #define ARM_FT_VOLATILE (1 << 4) /* Does not return. */ | |
d6b4baa4 | 1365 | #define ARM_FT_NESTED (1 << 5) /* Embedded inside another func. */ |
5b3e6663 | 1366 | #define ARM_FT_STACKALIGN (1 << 6) /* Called with misaligned stack. */ |
6d3d9133 NC |
1367 | |
1368 | /* Some macros to test these flags. */ | |
1369 | #define ARM_FUNC_TYPE(t) (t & ARM_FT_TYPE_MASK) | |
1370 | #define IS_INTERRUPT(t) (t & ARM_FT_INTERRUPT) | |
1371 | #define IS_VOLATILE(t) (t & ARM_FT_VOLATILE) | |
1372 | #define IS_NAKED(t) (t & ARM_FT_NAKED) | |
1373 | #define IS_NESTED(t) (t & ARM_FT_NESTED) | |
5b3e6663 | 1374 | #define IS_STACKALIGN(t) (t & ARM_FT_STACKALIGN) |
6d3d9133 | 1375 | |
5848830f PB |
1376 | |
1377 | /* Structure used to hold the function stack frame layout. Offsets are | |
1378 | relative to the stack pointer on function entry. Positive offsets are | |
1379 | in the direction of stack growth. | |
1380 | Only soft_frame is used in thumb mode. */ | |
1381 | ||
d1b38208 | 1382 | typedef struct GTY(()) arm_stack_offsets |
5848830f PB |
1383 | { |
1384 | int saved_args; /* ARG_POINTER_REGNUM. */ | |
1385 | int frame; /* ARM_HARD_FRAME_POINTER_REGNUM. */ | |
1386 | int saved_regs; | |
1387 | int soft_frame; /* FRAME_POINTER_REGNUM. */ | |
2591db65 | 1388 | int locals_base; /* THUMB_HARD_FRAME_POINTER_REGNUM. */ |
5848830f | 1389 | int outgoing_args; /* STACK_POINTER_REGNUM. */ |
954954d1 | 1390 | unsigned int saved_regs_mask; |
5848830f PB |
1391 | } |
1392 | arm_stack_offsets; | |
1393 | ||
2c0122c9 | 1394 | #if !defined(GENERATOR_FILE) && !defined (USED_FOR_TARGET) |
6d3d9133 NC |
1395 | /* A C structure for machine-specific, per-function data. |
1396 | This is added to the cfun structure. */ | |
d1b38208 | 1397 | typedef struct GTY(()) machine_function |
d5b7b3ae | 1398 | { |
6bc82793 | 1399 | /* Additional stack adjustment in __builtin_eh_throw. */ |
e2500fed | 1400 | rtx eh_epilogue_sp_ofs; |
d5b7b3ae RE |
1401 | /* Records if LR has to be saved for far jumps. */ |
1402 | int far_jump_used; | |
1403 | /* Records if ARG_POINTER was ever live. */ | |
1404 | int arg_pointer_live; | |
6f7ebcbb NC |
1405 | /* Records if the save of LR has been eliminated. */ |
1406 | int lr_save_eliminated; | |
0977774b | 1407 | /* The size of the stack frame. Only valid after reload. */ |
5848830f | 1408 | arm_stack_offsets stack_offsets; |
6d3d9133 NC |
1409 | /* Records the type of the current function. */ |
1410 | unsigned long func_type; | |
3cb66fd7 NC |
1411 | /* Record if the function has a variable argument list. */ |
1412 | int uses_anonymous_args; | |
5a9335ef NC |
1413 | /* Records if sibcalls are blocked because an argument |
1414 | register is needed to preserve stack alignment. */ | |
1415 | int sibcall_blocked; | |
020a4035 RE |
1416 | /* The PIC register for this function. This might be a pseudo. */ |
1417 | rtx pic_reg; | |
b12a00f1 | 1418 | /* Labels for per-function Thumb call-via stubs. One per potential calling |
57ecec57 PB |
1419 | register. We can never call via LR or PC. We can call via SP if a |
1420 | trampoline happens to be on the top of the stack. */ | |
1421 | rtx call_via[14]; | |
934c2060 RR |
1422 | /* Set to 1 when a return insn is output, this means that the epilogue |
1423 | is not needed. */ | |
1424 | int return_used_this_function; | |
906668bb BS |
1425 | /* When outputting Thumb-1 code, record the last insn that provides |
1426 | information about condition codes, and the comparison operands. */ | |
1427 | rtx thumb1_cc_insn; | |
1428 | rtx thumb1_cc_op0; | |
1429 | rtx thumb1_cc_op1; | |
1430 | /* Also record the CC mode that is supported. */ | |
ef4bddc2 | 1431 | machine_mode thumb1_cc_mode; |
b0419491 TG |
1432 | /* Set to 1 after arm_reorg has started. */ |
1433 | int after_arm_reorg; | |
6d3d9133 NC |
1434 | } |
1435 | machine_function; | |
906668bb | 1436 | #endif |
d5b7b3ae | 1437 | |
b12a00f1 | 1438 | /* As in the machine_function, a global set of call-via labels, for code |
d6b5193b | 1439 | that is in text_section. */ |
57ecec57 | 1440 | extern GTY(()) rtx thumb_call_via_label[14]; |
b12a00f1 | 1441 | |
390b17c2 RE |
1442 | /* The number of potential ways of assigning to a co-processor. */ |
1443 | #define ARM_NUM_COPROC_SLOTS 1 | |
1444 | ||
1445 | /* Enumeration of procedure calling standard variants. We don't really | |
1446 | support all of these yet. */ | |
1447 | enum arm_pcs | |
1448 | { | |
1449 | ARM_PCS_AAPCS, /* Base standard AAPCS. */ | |
1450 | ARM_PCS_AAPCS_VFP, /* Use VFP registers for floating point values. */ | |
1451 | ARM_PCS_AAPCS_IWMMXT, /* Use iWMMXT registers for vectors. */ | |
1452 | /* This must be the last AAPCS variant. */ | |
1453 | ARM_PCS_AAPCS_LOCAL, /* Private call within this compilation unit. */ | |
1454 | ARM_PCS_ATPCS, /* ATPCS. */ | |
1455 | ARM_PCS_APCS, /* APCS (legacy Linux etc). */ | |
1456 | ARM_PCS_UNKNOWN | |
1457 | }; | |
1458 | ||
12ffc7d5 CLT |
1459 | /* Default procedure calling standard of current compilation unit. */ |
1460 | extern enum arm_pcs arm_pcs_default; | |
1461 | ||
2c0122c9 | 1462 | #if !defined (USED_FOR_TARGET) |
82e9d970 | 1463 | /* A C type for declaring a variable that is used as the first argument of |
390b17c2 | 1464 | `FUNCTION_ARG' and other related values. */ |
82e9d970 PB |
1465 | typedef struct |
1466 | { | |
d5b7b3ae | 1467 | /* This is the number of registers of arguments scanned so far. */ |
82e9d970 | 1468 | int nregs; |
5a9335ef NC |
1469 | /* This is the number of iWMMXt register arguments scanned so far. */ |
1470 | int iwmmxt_nregs; | |
1471 | int named_count; | |
1472 | int nargs; | |
390b17c2 RE |
1473 | /* Which procedure call variant to use for this call. */ |
1474 | enum arm_pcs pcs_variant; | |
1475 | ||
1476 | /* AAPCS related state tracking. */ | |
1477 | int aapcs_arg_processed; /* No need to lay out this argument again. */ | |
1478 | int aapcs_cprc_slot; /* Index of co-processor rules to handle | |
1479 | this argument, or -1 if using core | |
1480 | registers. */ | |
1481 | int aapcs_ncrn; | |
1482 | int aapcs_next_ncrn; | |
1483 | rtx aapcs_reg; /* Register assigned to this argument. */ | |
1484 | int aapcs_partial; /* How many bytes are passed in regs (if | |
1485 | split between core regs and stack. | |
1486 | Zero otherwise. */ | |
1487 | int aapcs_cprc_failed[ARM_NUM_COPROC_SLOTS]; | |
1488 | int can_split; /* Argument can be split between core regs | |
1489 | and the stack. */ | |
1490 | /* Private data for tracking VFP register allocation */ | |
1491 | unsigned aapcs_vfp_regs_free; | |
1492 | unsigned aapcs_vfp_reg_alloc; | |
1493 | int aapcs_vfp_rcount; | |
46107b99 | 1494 | MACHMODE aapcs_vfp_rmode; |
d5b7b3ae | 1495 | } CUMULATIVE_ARGS; |
2c0122c9 | 1496 | #endif |
82e9d970 | 1497 | |
866af8a9 JB |
1498 | #define FUNCTION_ARG_PADDING(MODE, TYPE) \ |
1499 | (arm_pad_arg_upward (MODE, TYPE) ? upward : downward) | |
1500 | ||
1501 | #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \ | |
1502 | (arm_pad_reg_upward (MODE, TYPE, FIRST) ? upward : downward) | |
1503 | ||
1504 | /* For AAPCS, padding should never be below the argument. For other ABIs, | |
1505 | * mimic the default. */ | |
1506 | #define PAD_VARARGS_DOWN \ | |
1507 | ((TARGET_AAPCS_BASED) ? 0 : BYTES_BIG_ENDIAN) | |
1508 | ||
35d965d5 RS |
1509 | /* Initialize a variable CUM of type CUMULATIVE_ARGS |
1510 | for a call to a function whose data type is FNTYPE. | |
1511 | For a library call, FNTYPE is 0. | |
1512 | On the ARM, the offset starts at 0. */ | |
0f6937fe | 1513 | #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \ |
563a317a | 1514 | arm_init_cumulative_args (&(CUM), (FNTYPE), (LIBNAME), (FNDECL)) |
35d965d5 | 1515 | |
35d965d5 RS |
1516 | /* 1 if N is a possible register number for function argument passing. |
1517 | On the ARM, r0-r3 are used to pass args. */ | |
390b17c2 RE |
1518 | #define FUNCTION_ARG_REGNO_P(REGNO) \ |
1519 | (IN_RANGE ((REGNO), 0, 3) \ | |
1520 | || (TARGET_AAPCS_BASED && TARGET_VFP && TARGET_HARD_FLOAT \ | |
1521 | && IN_RANGE ((REGNO), FIRST_VFP_REGNUM, FIRST_VFP_REGNUM + 15)) \ | |
1522 | || (TARGET_IWMMXT_ABI \ | |
5848830f | 1523 | && IN_RANGE ((REGNO), FIRST_IWMMXT_REGNUM, FIRST_IWMMXT_REGNUM + 9))) |
35d965d5 | 1524 | |
f99fce0c | 1525 | \f |
afef3d7a | 1526 | /* If your target environment doesn't prefix user functions with an |
96a3900d | 1527 | underscore, you may wish to re-define this to prevent any conflicts. */ |
afef3d7a NC |
1528 | #ifndef ARM_MCOUNT_NAME |
1529 | #define ARM_MCOUNT_NAME "*mcount" | |
1530 | #endif | |
1531 | ||
1532 | /* Call the function profiler with a given profile label. The Acorn | |
1533 | compiler puts this BEFORE the prolog but gcc puts it afterwards. | |
1534 | On the ARM the full profile code will look like: | |
1535 | .data | |
1536 | LP1 | |
1537 | .word 0 | |
1538 | .text | |
1539 | mov ip, lr | |
1540 | bl mcount | |
1541 | .word LP1 | |
1542 | ||
1543 | profile_function() in final.c outputs the .data section, FUNCTION_PROFILER | |
1544 | will output the .text section. | |
1545 | ||
1546 | The ``mov ip,lr'' seems like a good idea to stick with cc convention. | |
59be6073 AN |
1547 | ``prof'' doesn't seem to mind about this! |
1548 | ||
1549 | Note - this version of the code is designed to work in both ARM and | |
1550 | Thumb modes. */ | |
be393ecf | 1551 | #ifndef ARM_FUNCTION_PROFILER |
d5b7b3ae | 1552 | #define ARM_FUNCTION_PROFILER(STREAM, LABELNO) \ |
6cfc7210 NC |
1553 | { \ |
1554 | char temp[20]; \ | |
1555 | rtx sym; \ | |
1556 | \ | |
dd18ae56 | 1557 | asm_fprintf (STREAM, "\tmov\t%r, %r\n\tbl\t", \ |
d5b7b3ae | 1558 | IP_REGNUM, LR_REGNUM); \ |
6cfc7210 NC |
1559 | assemble_name (STREAM, ARM_MCOUNT_NAME); \ |
1560 | fputc ('\n', STREAM); \ | |
1561 | ASM_GENERATE_INTERNAL_LABEL (temp, "LP", LABELNO); \ | |
f1c25d3b | 1562 | sym = gen_rtx_SYMBOL_REF (Pmode, temp); \ |
301d03af | 1563 | assemble_aligned_integer (UNITS_PER_WORD, sym); \ |
35d965d5 | 1564 | } |
be393ecf | 1565 | #endif |
35d965d5 | 1566 | |
59be6073 | 1567 | #ifdef THUMB_FUNCTION_PROFILER |
d5b7b3ae RE |
1568 | #define FUNCTION_PROFILER(STREAM, LABELNO) \ |
1569 | if (TARGET_ARM) \ | |
1570 | ARM_FUNCTION_PROFILER (STREAM, LABELNO) \ | |
1571 | else \ | |
1572 | THUMB_FUNCTION_PROFILER (STREAM, LABELNO) | |
59be6073 AN |
1573 | #else |
1574 | #define FUNCTION_PROFILER(STREAM, LABELNO) \ | |
1575 | ARM_FUNCTION_PROFILER (STREAM, LABELNO) | |
1576 | #endif | |
d5b7b3ae | 1577 | |
35d965d5 RS |
1578 | /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, |
1579 | the stack pointer does not matter. The value is tested only in | |
1580 | functions that have frame pointers. | |
1581 | No definition is equivalent to always zero. | |
1582 | ||
1583 | On the ARM, the function epilogue recovers the stack pointer from the | |
1584 | frame. */ | |
1585 | #define EXIT_IGNORE_STACK 1 | |
1586 | ||
2b261262 | 1587 | #define EPILOGUE_USES(REGNO) (epilogue_completed && (REGNO) == LR_REGNUM) |
c7861455 | 1588 | |
35d965d5 RS |
1589 | /* Determine if the epilogue should be output as RTL. |
1590 | You should override this if you define FUNCTION_EXTRA_EPILOGUE. */ | |
d5b7b3ae | 1591 | #define USE_RETURN_INSN(ISCOND) \ |
7c19c715 | 1592 | (TARGET_32BIT ? use_return_insn (ISCOND, NULL) : 0) |
ff9940b0 RE |
1593 | |
1594 | /* Definitions for register eliminations. | |
1595 | ||
1596 | This is an array of structures. Each structure initializes one pair | |
1597 | of eliminable registers. The "from" register number is given first, | |
1598 | followed by "to". Eliminations of the same "from" register are listed | |
1599 | in order of preference. | |
1600 | ||
1601 | We have two registers that can be eliminated on the ARM. First, the | |
1602 | arg pointer register can often be eliminated in favor of the stack | |
1603 | pointer register. Secondly, the pseudo frame pointer register can always | |
1604 | be eliminated; it is replaced with either the stack or the real frame | |
d5b7b3ae | 1605 | pointer. Note we have to use {ARM|THUMB}_HARD_FRAME_POINTER_REGNUM |
d6a7951f | 1606 | because the definition of HARD_FRAME_POINTER_REGNUM is not a constant. */ |
ff9940b0 | 1607 | |
d5b7b3ae RE |
1608 | #define ELIMINABLE_REGS \ |
1609 | {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM },\ | |
1610 | { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM },\ | |
1611 | { ARG_POINTER_REGNUM, ARM_HARD_FRAME_POINTER_REGNUM },\ | |
1612 | { ARG_POINTER_REGNUM, THUMB_HARD_FRAME_POINTER_REGNUM },\ | |
1613 | { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM },\ | |
1614 | { FRAME_POINTER_REGNUM, ARM_HARD_FRAME_POINTER_REGNUM },\ | |
1615 | { FRAME_POINTER_REGNUM, THUMB_HARD_FRAME_POINTER_REGNUM }} | |
ff9940b0 | 1616 | |
d5b7b3ae RE |
1617 | /* Define the offset between two registers, one to be eliminated, and the |
1618 | other its replacement, at the start of a routine. */ | |
d5b7b3ae RE |
1619 | #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ |
1620 | if (TARGET_ARM) \ | |
5848830f | 1621 | (OFFSET) = arm_compute_initial_elimination_offset (FROM, TO); \ |
d5b7b3ae | 1622 | else \ |
5848830f PB |
1623 | (OFFSET) = thumb_compute_initial_elimination_offset (FROM, TO) |
1624 | ||
d5b7b3ae RE |
1625 | /* Special case handling of the location of arguments passed on the stack. */ |
1626 | #define DEBUGGER_ARG_OFFSET(value, addr) value ? value : arm_debugger_arg_offset (value, addr) | |
f676971a | 1627 | |
d5b7b3ae RE |
1628 | /* Initialize data used by insn expanders. This is called from insn_emit, |
1629 | once for every function before code is generated. */ | |
1630 | #define INIT_EXPANDERS arm_init_expanders () | |
1631 | ||
35d965d5 | 1632 | /* Length in units of the trampoline for entering a nested function. */ |
5b3e6663 | 1633 | #define TRAMPOLINE_SIZE (TARGET_32BIT ? 16 : 20) |
35d965d5 | 1634 | |
006946e4 JM |
1635 | /* Alignment required for a trampoline in bits. */ |
1636 | #define TRAMPOLINE_ALIGNMENT 32 | |
35d965d5 RS |
1637 | \f |
1638 | /* Addressing modes, and classification of registers for them. */ | |
3cd45774 | 1639 | #define HAVE_POST_INCREMENT 1 |
5b3e6663 PB |
1640 | #define HAVE_PRE_INCREMENT TARGET_32BIT |
1641 | #define HAVE_POST_DECREMENT TARGET_32BIT | |
1642 | #define HAVE_PRE_DECREMENT TARGET_32BIT | |
1643 | #define HAVE_PRE_MODIFY_DISP TARGET_32BIT | |
1644 | #define HAVE_POST_MODIFY_DISP TARGET_32BIT | |
1645 | #define HAVE_PRE_MODIFY_REG TARGET_32BIT | |
1646 | #define HAVE_POST_MODIFY_REG TARGET_32BIT | |
35d965d5 | 1647 | |
8875e939 RR |
1648 | enum arm_auto_incmodes |
1649 | { | |
1650 | ARM_POST_INC, | |
1651 | ARM_PRE_INC, | |
1652 | ARM_POST_DEC, | |
1653 | ARM_PRE_DEC | |
1654 | }; | |
1655 | ||
1656 | #define ARM_AUTOINC_VALID_FOR_MODE_P(mode, code) \ | |
1657 | (TARGET_32BIT && arm_autoinc_modes_ok_p (mode, code)) | |
1658 | #define USE_LOAD_POST_INCREMENT(mode) \ | |
1659 | ARM_AUTOINC_VALID_FOR_MODE_P(mode, ARM_POST_INC) | |
1660 | #define USE_LOAD_PRE_INCREMENT(mode) \ | |
1661 | ARM_AUTOINC_VALID_FOR_MODE_P(mode, ARM_PRE_INC) | |
1662 | #define USE_LOAD_POST_DECREMENT(mode) \ | |
1663 | ARM_AUTOINC_VALID_FOR_MODE_P(mode, ARM_POST_DEC) | |
1664 | #define USE_LOAD_PRE_DECREMENT(mode) \ | |
1665 | ARM_AUTOINC_VALID_FOR_MODE_P(mode, ARM_PRE_DEC) | |
1666 | ||
1667 | #define USE_STORE_PRE_DECREMENT(mode) USE_LOAD_PRE_DECREMENT(mode) | |
1668 | #define USE_STORE_PRE_INCREMENT(mode) USE_LOAD_PRE_INCREMENT(mode) | |
1669 | #define USE_STORE_POST_DECREMENT(mode) USE_LOAD_POST_DECREMENT(mode) | |
1670 | #define USE_STORE_POST_INCREMENT(mode) USE_LOAD_POST_INCREMENT(mode) | |
1671 | ||
35d965d5 RS |
1672 | /* Macros to check register numbers against specific register classes. */ |
1673 | ||
1674 | /* These assume that REGNO is a hard or pseudo reg number. | |
1675 | They give nonzero only if REGNO is a hard reg of the suitable class | |
1676 | or a pseudo reg currently allocated to a suitable hard reg. | |
1677 | Since they use reg_renumber, they are safe only once reg_renumber | |
aeb9f7cf SB |
1678 | has been allocated, which happens in reginfo.c during register |
1679 | allocation. */ | |
d5b7b3ae RE |
1680 | #define TEST_REGNO(R, TEST, VALUE) \ |
1681 | ((R TEST VALUE) || ((unsigned) reg_renumber[R] TEST VALUE)) | |
1682 | ||
5b3e6663 | 1683 | /* Don't allow the pc to be used. */ |
f1008e52 RE |
1684 | #define ARM_REGNO_OK_FOR_BASE_P(REGNO) \ |
1685 | (TEST_REGNO (REGNO, <, PC_REGNUM) \ | |
1686 | || TEST_REGNO (REGNO, ==, FRAME_POINTER_REGNUM) \ | |
1687 | || TEST_REGNO (REGNO, ==, ARG_POINTER_REGNUM)) | |
1688 | ||
5b3e6663 | 1689 | #define THUMB1_REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) \ |
f1008e52 RE |
1690 | (TEST_REGNO (REGNO, <=, LAST_LO_REGNUM) \ |
1691 | || (GET_MODE_SIZE (MODE) >= 4 \ | |
1692 | && TEST_REGNO (REGNO, ==, STACK_POINTER_REGNUM))) | |
1693 | ||
1694 | #define REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) \ | |
5b3e6663 PB |
1695 | (TARGET_THUMB1 \ |
1696 | ? THUMB1_REGNO_MODE_OK_FOR_BASE_P (REGNO, MODE) \ | |
f1008e52 RE |
1697 | : ARM_REGNO_OK_FOR_BASE_P (REGNO)) |
1698 | ||
888d2cd6 DJ |
1699 | /* Nonzero if X can be the base register in a reg+reg addressing mode. |
1700 | For Thumb, we can not use SP + reg, so reject SP. */ | |
1701 | #define REGNO_MODE_OK_FOR_REG_BASE_P(X, MODE) \ | |
f5c630c3 | 1702 | REGNO_MODE_OK_FOR_BASE_P (X, QImode) |
888d2cd6 | 1703 | |
f1008e52 RE |
1704 | /* For ARM code, we don't care about the mode, but for Thumb, the index |
1705 | must be suitable for use in a QImode load. */ | |
d5b7b3ae | 1706 | #define REGNO_OK_FOR_INDEX_P(REGNO) \ |
f5c630c3 PB |
1707 | (REGNO_MODE_OK_FOR_BASE_P (REGNO, QImode) \ |
1708 | && !TEST_REGNO (REGNO, ==, STACK_POINTER_REGNUM)) | |
35d965d5 RS |
1709 | |
1710 | /* Maximum number of registers that can appear in a valid memory address. | |
d6b4baa4 | 1711 | Shifts in addresses can't be by a register. */ |
ff9940b0 | 1712 | #define MAX_REGS_PER_ADDRESS 2 |
35d965d5 RS |
1713 | |
1714 | /* Recognize any constant value that is a valid address. */ | |
1715 | /* XXX We can address any constant, eventually... */ | |
5b3e6663 | 1716 | /* ??? Should the TARGET_ARM here also apply to thumb2? */ |
008cf58a RE |
1717 | #define CONSTANT_ADDRESS_P(X) \ |
1718 | (GET_CODE (X) == SYMBOL_REF \ | |
1719 | && (CONSTANT_POOL_ADDRESS_P (X) \ | |
d5b7b3ae | 1720 | || (TARGET_ARM && optimize > 0 && SYMBOL_REF_FLAG (X)))) |
35d965d5 | 1721 | |
8426b956 RS |
1722 | /* True if SYMBOL + OFFSET constants must refer to something within |
1723 | SYMBOL's section. */ | |
1724 | #define ARM_OFFSETS_MUST_BE_WITHIN_SECTIONS_P 0 | |
1725 | ||
571191af PB |
1726 | /* Nonzero if all target requires all absolute relocations be R_ARM_ABS32. */ |
1727 | #ifndef TARGET_DEFAULT_WORD_RELOCATIONS | |
1728 | #define TARGET_DEFAULT_WORD_RELOCATIONS 0 | |
1729 | #endif | |
1730 | ||
c27ba912 DM |
1731 | #ifndef SUBTARGET_NAME_ENCODING_LENGTHS |
1732 | #define SUBTARGET_NAME_ENCODING_LENGTHS | |
1733 | #endif | |
1734 | ||
6bc82793 | 1735 | /* This is a C fragment for the inside of a switch statement. |
c27ba912 DM |
1736 | Each case label should return the number of characters to |
1737 | be stripped from the start of a function's name, if that | |
1738 | name starts with the indicated character. */ | |
1739 | #define ARM_NAME_ENCODING_LENGTHS \ | |
00fdafef | 1740 | case '*': return 1; \ |
f676971a | 1741 | SUBTARGET_NAME_ENCODING_LENGTHS |
c27ba912 | 1742 | |
c27ba912 DM |
1743 | /* This is how to output a reference to a user-level label named NAME. |
1744 | `assemble_name' uses this. */ | |
e5951263 | 1745 | #undef ASM_OUTPUT_LABELREF |
c27ba912 | 1746 | #define ASM_OUTPUT_LABELREF(FILE, NAME) \ |
e1944073 | 1747 | arm_asm_output_labelref (FILE, NAME) |
c27ba912 | 1748 | |
7a085dce | 1749 | /* Output IT instructions for conditionally executed Thumb-2 instructions. */ |
5b3e6663 PB |
1750 | #define ASM_OUTPUT_OPCODE(STREAM, PTR) \ |
1751 | if (TARGET_THUMB2) \ | |
1752 | thumb2_asm_output_opcode (STREAM); | |
1753 | ||
7abc66b1 JB |
1754 | /* The EABI specifies that constructors should go in .init_array. |
1755 | Other targets use .ctors for compatibility. */ | |
88c6057f | 1756 | #ifndef ARM_EABI_CTORS_SECTION_OP |
7abc66b1 JB |
1757 | #define ARM_EABI_CTORS_SECTION_OP \ |
1758 | "\t.section\t.init_array,\"aw\",%init_array" | |
88c6057f MM |
1759 | #endif |
1760 | #ifndef ARM_EABI_DTORS_SECTION_OP | |
7abc66b1 JB |
1761 | #define ARM_EABI_DTORS_SECTION_OP \ |
1762 | "\t.section\t.fini_array,\"aw\",%fini_array" | |
88c6057f | 1763 | #endif |
7abc66b1 JB |
1764 | #define ARM_CTORS_SECTION_OP \ |
1765 | "\t.section\t.ctors,\"aw\",%progbits" | |
1766 | #define ARM_DTORS_SECTION_OP \ | |
1767 | "\t.section\t.dtors,\"aw\",%progbits" | |
1768 | ||
1769 | /* Define CTORS_SECTION_ASM_OP. */ | |
1770 | #undef CTORS_SECTION_ASM_OP | |
1771 | #undef DTORS_SECTION_ASM_OP | |
1772 | #ifndef IN_LIBGCC2 | |
1773 | # define CTORS_SECTION_ASM_OP \ | |
1774 | (TARGET_AAPCS_BASED ? ARM_EABI_CTORS_SECTION_OP : ARM_CTORS_SECTION_OP) | |
1775 | # define DTORS_SECTION_ASM_OP \ | |
1776 | (TARGET_AAPCS_BASED ? ARM_EABI_DTORS_SECTION_OP : ARM_DTORS_SECTION_OP) | |
1777 | #else /* !defined (IN_LIBGCC2) */ | |
1778 | /* In libgcc, CTORS_SECTION_ASM_OP must be a compile-time constant, | |
1779 | so we cannot use the definition above. */ | |
1780 | # ifdef __ARM_EABI__ | |
1781 | /* The .ctors section is not part of the EABI, so we do not define | |
1782 | CTORS_SECTION_ASM_OP when in libgcc; that prevents crtstuff | |
1783 | from trying to use it. We do define it when doing normal | |
1784 | compilation, as .init_array can be used instead of .ctors. */ | |
1785 | /* There is no need to emit begin or end markers when using | |
1786 | init_array; the dynamic linker will compute the size of the | |
1787 | array itself based on special symbols created by the static | |
1788 | linker. However, we do need to arrange to set up | |
1789 | exception-handling here. */ | |
1790 | # define CTOR_LIST_BEGIN asm (ARM_EABI_CTORS_SECTION_OP) | |
1791 | # define CTOR_LIST_END /* empty */ | |
1792 | # define DTOR_LIST_BEGIN asm (ARM_EABI_DTORS_SECTION_OP) | |
1793 | # define DTOR_LIST_END /* empty */ | |
1794 | # else /* !defined (__ARM_EABI__) */ | |
1795 | # define CTORS_SECTION_ASM_OP ARM_CTORS_SECTION_OP | |
1796 | # define DTORS_SECTION_ASM_OP ARM_DTORS_SECTION_OP | |
1797 | # endif /* !defined (__ARM_EABI__) */ | |
1798 | #endif /* !defined (IN_LIBCC2) */ | |
1799 | ||
1e731102 MM |
1800 | /* True if the operating system can merge entities with vague linkage |
1801 | (e.g., symbols in COMDAT group) during dynamic linking. */ | |
1802 | #ifndef TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P | |
1803 | #define TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P true | |
1804 | #endif | |
1805 | ||
617a1b71 PB |
1806 | #define ARM_OUTPUT_FN_UNWIND(F, PROLOGUE) arm_output_fn_unwind (F, PROLOGUE) |
1807 | ||
35d965d5 RS |
1808 | /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx |
1809 | and check its validity for a certain class. | |
1810 | We have two alternate definitions for each of them. | |
1811 | The usual definition accepts all pseudo regs; the other rejects | |
1812 | them unless they have been allocated suitable hard regs. | |
5b3e6663 | 1813 | The symbol REG_OK_STRICT causes the latter definition to be used. |
7a085dce | 1814 | Thumb-2 has the same restrictions as arm. */ |
35d965d5 | 1815 | #ifndef REG_OK_STRICT |
ff9940b0 | 1816 | |
f1008e52 RE |
1817 | #define ARM_REG_OK_FOR_BASE_P(X) \ |
1818 | (REGNO (X) <= LAST_ARM_REGNUM \ | |
1819 | || REGNO (X) >= FIRST_PSEUDO_REGISTER \ | |
1820 | || REGNO (X) == FRAME_POINTER_REGNUM \ | |
1821 | || REGNO (X) == ARG_POINTER_REGNUM) | |
ff9940b0 | 1822 | |
f5c630c3 PB |
1823 | #define ARM_REG_OK_FOR_INDEX_P(X) \ |
1824 | ((REGNO (X) <= LAST_ARM_REGNUM \ | |
1825 | && REGNO (X) != STACK_POINTER_REGNUM) \ | |
1826 | || REGNO (X) >= FIRST_PSEUDO_REGISTER \ | |
1827 | || REGNO (X) == FRAME_POINTER_REGNUM \ | |
1828 | || REGNO (X) == ARG_POINTER_REGNUM) | |
1829 | ||
5b3e6663 | 1830 | #define THUMB1_REG_MODE_OK_FOR_BASE_P(X, MODE) \ |
f1008e52 RE |
1831 | (REGNO (X) <= LAST_LO_REGNUM \ |
1832 | || REGNO (X) >= FIRST_PSEUDO_REGISTER \ | |
1833 | || (GET_MODE_SIZE (MODE) >= 4 \ | |
1834 | && (REGNO (X) == STACK_POINTER_REGNUM \ | |
1835 | || (X) == hard_frame_pointer_rtx \ | |
1836 | || (X) == arg_pointer_rtx))) | |
ff9940b0 | 1837 | |
76a318e9 RE |
1838 | #define REG_STRICT_P 0 |
1839 | ||
d5b7b3ae | 1840 | #else /* REG_OK_STRICT */ |
ff9940b0 | 1841 | |
f1008e52 RE |
1842 | #define ARM_REG_OK_FOR_BASE_P(X) \ |
1843 | ARM_REGNO_OK_FOR_BASE_P (REGNO (X)) | |
ff9940b0 | 1844 | |
f5c630c3 PB |
1845 | #define ARM_REG_OK_FOR_INDEX_P(X) \ |
1846 | ARM_REGNO_OK_FOR_INDEX_P (REGNO (X)) | |
1847 | ||
5b3e6663 PB |
1848 | #define THUMB1_REG_MODE_OK_FOR_BASE_P(X, MODE) \ |
1849 | THUMB1_REGNO_MODE_OK_FOR_BASE_P (REGNO (X), MODE) | |
ff9940b0 | 1850 | |
76a318e9 RE |
1851 | #define REG_STRICT_P 1 |
1852 | ||
d5b7b3ae | 1853 | #endif /* REG_OK_STRICT */ |
f1008e52 RE |
1854 | |
1855 | /* Now define some helpers in terms of the above. */ | |
1856 | ||
1857 | #define REG_MODE_OK_FOR_BASE_P(X, MODE) \ | |
5b3e6663 PB |
1858 | (TARGET_THUMB1 \ |
1859 | ? THUMB1_REG_MODE_OK_FOR_BASE_P (X, MODE) \ | |
f1008e52 RE |
1860 | : ARM_REG_OK_FOR_BASE_P (X)) |
1861 | ||
5b3e6663 | 1862 | /* For 16-bit Thumb, a valid index register is anything that can be used in |
f1008e52 | 1863 | a byte load instruction. */ |
5b3e6663 PB |
1864 | #define THUMB1_REG_OK_FOR_INDEX_P(X) \ |
1865 | THUMB1_REG_MODE_OK_FOR_BASE_P (X, QImode) | |
f1008e52 RE |
1866 | |
1867 | /* Nonzero if X is a hard reg that can be used as an index | |
1868 | or if it is a pseudo reg. On the Thumb, the stack pointer | |
1869 | is not suitable. */ | |
1870 | #define REG_OK_FOR_INDEX_P(X) \ | |
5b3e6663 PB |
1871 | (TARGET_THUMB1 \ |
1872 | ? THUMB1_REG_OK_FOR_INDEX_P (X) \ | |
f1008e52 RE |
1873 | : ARM_REG_OK_FOR_INDEX_P (X)) |
1874 | ||
888d2cd6 DJ |
1875 | /* Nonzero if X can be the base register in a reg+reg addressing mode. |
1876 | For Thumb, we can not use SP + reg, so reject SP. */ | |
1877 | #define REG_MODE_OK_FOR_REG_BASE_P(X, MODE) \ | |
1878 | REG_OK_FOR_INDEX_P (X) | |
35d965d5 | 1879 | \f |
f1008e52 | 1880 | #define ARM_BASE_REGISTER_RTX_P(X) \ |
d435a4be | 1881 | (REG_P (X) && ARM_REG_OK_FOR_BASE_P (X)) |
35d965d5 | 1882 | |
f1008e52 | 1883 | #define ARM_INDEX_REGISTER_RTX_P(X) \ |
d435a4be | 1884 | (REG_P (X) && ARM_REG_OK_FOR_INDEX_P (X)) |
35d965d5 | 1885 | \f |
35d965d5 RS |
1886 | /* Specify the machine mode that this machine uses |
1887 | for the index in the tablejump instruction. */ | |
d5b7b3ae | 1888 | #define CASE_VECTOR_MODE Pmode |
35d965d5 | 1889 | |
907dd0c7 | 1890 | #define CASE_VECTOR_PC_RELATIVE (TARGET_THUMB2 \ |
83c3a2d8 | 1891 | || (TARGET_THUMB1 \ |
907dd0c7 RE |
1892 | && (optimize_size || flag_pic))) |
1893 | ||
1894 | #define CASE_VECTOR_SHORTEN_MODE(min, max, body) \ | |
83c3a2d8 | 1895 | (TARGET_THUMB1 \ |
907dd0c7 RE |
1896 | ? (min >= 0 && max < 512 \ |
1897 | ? (ADDR_DIFF_VEC_FLAGS (body).offset_unsigned = 1, QImode) \ | |
1898 | : min >= -256 && max < 256 \ | |
1899 | ? (ADDR_DIFF_VEC_FLAGS (body).offset_unsigned = 0, QImode) \ | |
1900 | : min >= 0 && max < 8192 \ | |
1901 | ? (ADDR_DIFF_VEC_FLAGS (body).offset_unsigned = 1, HImode) \ | |
1902 | : min >= -4096 && max < 4096 \ | |
1903 | ? (ADDR_DIFF_VEC_FLAGS (body).offset_unsigned = 0, HImode) \ | |
1904 | : SImode) \ | |
10c241af | 1905 | : ((min < 0 || max >= 0x20000 || !TARGET_THUMB2) ? SImode \ |
907dd0c7 RE |
1906 | : (max >= 0x200) ? HImode \ |
1907 | : QImode)) | |
5b3e6663 | 1908 | |
ff9940b0 RE |
1909 | /* signed 'char' is most compatible, but RISC OS wants it unsigned. |
1910 | unsigned is probably best, but may break some code. */ | |
1911 | #ifndef DEFAULT_SIGNED_CHAR | |
3967692c | 1912 | #define DEFAULT_SIGNED_CHAR 0 |
35d965d5 RS |
1913 | #endif |
1914 | ||
35d965d5 | 1915 | /* Max number of bytes we can move from memory to memory |
d17ce9af TG |
1916 | in one reasonably fast instruction. */ |
1917 | #define MOVE_MAX 4 | |
35d965d5 | 1918 | |
d19fb8e3 | 1919 | #undef MOVE_RATIO |
e04ad03d | 1920 | #define MOVE_RATIO(speed) (arm_tune_xscale ? 4 : 2) |
d19fb8e3 | 1921 | |
ff9940b0 RE |
1922 | /* Define if operations between registers always perform the operation |
1923 | on the full register even if a narrower mode is specified. */ | |
9e11bfef | 1924 | #define WORD_REGISTER_OPERATIONS 1 |
ff9940b0 RE |
1925 | |
1926 | /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD | |
1927 | will either zero-extend or sign-extend. The value of this macro should | |
1928 | be the code that says which one of the two operations is implicitly | |
f822d252 | 1929 | done, UNKNOWN if none. */ |
9c872872 | 1930 | #define LOAD_EXTEND_OP(MODE) \ |
d5b7b3ae RE |
1931 | (TARGET_THUMB ? ZERO_EXTEND : \ |
1932 | ((arm_arch4 || (MODE) == QImode) ? ZERO_EXTEND \ | |
f822d252 | 1933 | : ((BYTES_BIG_ENDIAN && (MODE) == HImode) ? SIGN_EXTEND : UNKNOWN))) |
ff9940b0 | 1934 | |
35d965d5 RS |
1935 | /* Nonzero if access to memory by bytes is slow and undesirable. */ |
1936 | #define SLOW_BYTE_ACCESS 0 | |
1937 | ||
d5b7b3ae | 1938 | #define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) 1 |
f676971a | 1939 | |
35d965d5 RS |
1940 | /* Immediate shift counts are truncated by the output routines (or was it |
1941 | the assembler?). Shift counts in a register are truncated by ARM. Note | |
1942 | that the native compiler puts too large (> 32) immediate shift counts | |
1943 | into a register and shifts by the register, letting the ARM decide what | |
1944 | to do instead of doing that itself. */ | |
ff9940b0 RE |
1945 | /* This is all wrong. Defining SHIFT_COUNT_TRUNCATED tells combine that |
1946 | code like (X << (Y % 32)) for register X, Y is equivalent to (X << Y). | |
1947 | On the arm, Y in a register is used modulo 256 for the shift. Only for | |
d6b4baa4 | 1948 | rotates is modulo 32 used. */ |
ff9940b0 | 1949 | /* #define SHIFT_COUNT_TRUNCATED 1 */ |
35d965d5 | 1950 | |
35d965d5 | 1951 | /* All integers have the same format so truncation is easy. */ |
d5b7b3ae | 1952 | #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 |
35d965d5 RS |
1953 | |
1954 | /* Calling from registers is a massive pain. */ | |
1955 | #define NO_FUNCTION_CSE 1 | |
1956 | ||
35d965d5 RS |
1957 | /* The machine modes of pointers and functions */ |
1958 | #define Pmode SImode | |
1959 | #define FUNCTION_MODE Pmode | |
1960 | ||
d5b7b3ae RE |
1961 | #define ARM_FRAME_RTX(X) \ |
1962 | ( (X) == frame_pointer_rtx || (X) == stack_pointer_rtx \ | |
3967692c RE |
1963 | || (X) == arg_pointer_rtx) |
1964 | ||
ff9940b0 | 1965 | /* Try to generate sequences that don't involve branches, we can then use |
a51fb17f | 1966 | conditional instructions. */ |
3a4fd356 | 1967 | #define BRANCH_COST(speed_p, predictable_p) \ |
153668ec JB |
1968 | (current_tune->branch_cost (speed_p, predictable_p)) |
1969 | ||
a51fb17f | 1970 | /* False if short circuit operation is preferred. */ |
52c266ba RE |
1971 | #define LOGICAL_OP_NON_SHORT_CIRCUIT \ |
1972 | ((optimize_size) \ | |
1973 | ? (TARGET_THUMB ? false : true) \ | |
4cbd1e61 RR |
1974 | : TARGET_THUMB ? static_cast<bool> (current_tune->logical_op_non_short_circuit_thumb) \ |
1975 | : static_cast<bool> (current_tune->logical_op_non_short_circuit_arm)) | |
a51fb17f | 1976 | |
7a801826 RE |
1977 | \f |
1978 | /* Position Independent Code. */ | |
1979 | /* We decide which register to use based on the compilation options and | |
1980 | the assembler in use; this is more general than the APCS restriction of | |
1981 | using sb (r9) all the time. */ | |
020a4035 | 1982 | extern unsigned arm_pic_register; |
7a801826 RE |
1983 | |
1984 | /* The register number of the register used to address a table of static | |
1985 | data addresses in memory. */ | |
1986 | #define PIC_OFFSET_TABLE_REGNUM arm_pic_register | |
1987 | ||
f5a1b0d2 | 1988 | /* We can't directly access anything that contains a symbol, |
d3585b76 DJ |
1989 | nor can we indirect via the constant pool. One exception is |
1990 | UNSPEC_TLS, which is always PIC. */ | |
82e9d970 | 1991 | #define LEGITIMATE_PIC_OPERAND_P(X) \ |
1575c31e JD |
1992 | (!(symbol_mentioned_p (X) \ |
1993 | || label_mentioned_p (X) \ | |
1994 | || (GET_CODE (X) == SYMBOL_REF \ | |
1995 | && CONSTANT_POOL_ADDRESS_P (X) \ | |
1996 | && (symbol_mentioned_p (get_pool_constant (X)) \ | |
d3585b76 DJ |
1997 | || label_mentioned_p (get_pool_constant (X))))) \ |
1998 | || tls_mentioned_p (X)) | |
1575c31e | 1999 | |
13bd191d PB |
2000 | /* We need to know when we are making a constant pool; this determines |
2001 | whether data needs to be in the GOT or can be referenced via a GOT | |
2002 | offset. */ | |
2003 | extern int making_const_table; | |
82e9d970 | 2004 | \f |
c27ba912 | 2005 | /* Handle pragmas for compatibility with Intel's compilers. */ |
b76c3c4b | 2006 | /* Also abuse this to register additional C specific EABI attributes. */ |
c58b209a NB |
2007 | #define REGISTER_TARGET_PRAGMAS() do { \ |
2008 | c_register_pragma (0, "long_calls", arm_pr_long_calls); \ | |
2009 | c_register_pragma (0, "no_long_calls", arm_pr_no_long_calls); \ | |
2010 | c_register_pragma (0, "long_calls_off", arm_pr_long_calls_off); \ | |
c84f825c CB |
2011 | arm_lang_object_attributes_init(); \ |
2012 | arm_register_target_pragmas(); \ | |
8b97c5f8 ZW |
2013 | } while (0) |
2014 | ||
d6b4baa4 | 2015 | /* Condition code information. */ |
ff9940b0 | 2016 | /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, |
a5381466 | 2017 | return the mode to be used for the comparison. */ |
d5b7b3ae RE |
2018 | |
2019 | #define SELECT_CC_MODE(OP, X, Y) arm_select_cc_mode (OP, X, Y) | |
ff9940b0 | 2020 | |
880873be RE |
2021 | #define REVERSIBLE_CC_MODE(MODE) 1 |
2022 | ||
2023 | #define REVERSE_CONDITION(CODE,MODE) \ | |
2024 | (((MODE) == CCFPmode || (MODE) == CCFPEmode) \ | |
2025 | ? reverse_condition_maybe_unordered (code) \ | |
2026 | : reverse_condition (code)) | |
008cf58a | 2027 | |
9b227e35 | 2028 | #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \ |
41197ad4 | 2029 | ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2) |
9b227e35 | 2030 | #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \ |
41197ad4 | 2031 | ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2) |
35d965d5 | 2032 | \f |
906668bb BS |
2033 | #define CC_STATUS_INIT \ |
2034 | do { cfun->machine->thumb1_cc_insn = NULL_RTX; } while (0) | |
2035 | ||
decfc6e1 TG |
2036 | #undef ASM_APP_ON |
2037 | #define ASM_APP_ON (inline_asm_unified ? "\t.syntax unified\n" : \ | |
2038 | "\t.syntax divided\n") | |
2039 | ||
d5b7b3ae | 2040 | #undef ASM_APP_OFF |
decfc6e1 TG |
2041 | #define ASM_APP_OFF (TARGET_ARM ? "\t.arm\n\t.syntax divided\n" : \ |
2042 | "\t.thumb\n\t.syntax unified\n") | |
35d965d5 | 2043 | |
2ee67fbb JB |
2044 | /* Output a push or a pop instruction (only used when profiling). |
2045 | We can't push STATIC_CHAIN_REGNUM (r12) directly with Thumb-1. We know | |
2046 | that ASM_OUTPUT_REG_PUSH will be matched with ASM_OUTPUT_REG_POP, and | |
2047 | that r7 isn't used by the function profiler, so we can use it as a | |
2048 | scratch reg. WARNING: This isn't safe in the general case! It may be | |
2049 | sensitive to future changes in final.c:profile_function. */ | |
d5b7b3ae | 2050 | #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \ |
8a81cc45 RE |
2051 | do \ |
2052 | { \ | |
2053 | if (TARGET_ARM) \ | |
2054 | asm_fprintf (STREAM,"\tstmfd\t%r!,{%r}\n", \ | |
2055 | STACK_POINTER_REGNUM, REGNO); \ | |
2ee67fbb JB |
2056 | else if (TARGET_THUMB1 \ |
2057 | && (REGNO) == STATIC_CHAIN_REGNUM) \ | |
2058 | { \ | |
2059 | asm_fprintf (STREAM, "\tpush\t{r7}\n"); \ | |
2060 | asm_fprintf (STREAM, "\tmov\tr7, %r\n", REGNO);\ | |
2061 | asm_fprintf (STREAM, "\tpush\t{r7}\n"); \ | |
2062 | } \ | |
8a81cc45 RE |
2063 | else \ |
2064 | asm_fprintf (STREAM, "\tpush {%r}\n", REGNO); \ | |
2065 | } while (0) | |
d5b7b3ae RE |
2066 | |
2067 | ||
2ee67fbb | 2068 | /* See comment for ASM_OUTPUT_REG_PUSH concerning Thumb-1 issue. */ |
d5b7b3ae | 2069 | #define ASM_OUTPUT_REG_POP(STREAM, REGNO) \ |
8a81cc45 RE |
2070 | do \ |
2071 | { \ | |
2072 | if (TARGET_ARM) \ | |
2073 | asm_fprintf (STREAM, "\tldmfd\t%r!,{%r}\n", \ | |
2074 | STACK_POINTER_REGNUM, REGNO); \ | |
2ee67fbb JB |
2075 | else if (TARGET_THUMB1 \ |
2076 | && (REGNO) == STATIC_CHAIN_REGNUM) \ | |
2077 | { \ | |
2078 | asm_fprintf (STREAM, "\tpop\t{r7}\n"); \ | |
2079 | asm_fprintf (STREAM, "\tmov\t%r, r7\n", REGNO);\ | |
2080 | asm_fprintf (STREAM, "\tpop\t{r7}\n"); \ | |
2081 | } \ | |
8a81cc45 RE |
2082 | else \ |
2083 | asm_fprintf (STREAM, "\tpop {%r}\n", REGNO); \ | |
2084 | } while (0) | |
d5b7b3ae | 2085 | |
b0fe107e JM |
2086 | #define ADDR_VEC_ALIGN(JUMPTABLE) \ |
2087 | ((TARGET_THUMB && GET_MODE (PATTERN (JUMPTABLE)) == SImode) ? 2 : 0) | |
2088 | ||
2089 | /* Alignment for case labels comes from ADDR_VEC_ALIGN; avoid the | |
2090 | default alignment from elfos.h. */ | |
2091 | #undef ASM_OUTPUT_BEFORE_CASE_LABEL | |
2092 | #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) /* Empty. */ | |
5b3e6663 | 2093 | |
e75c1617 CB |
2094 | #define LABEL_ALIGN_AFTER_BARRIER(LABEL) \ |
2095 | (GET_CODE (PATTERN (prev_active_insn (LABEL))) == ADDR_DIFF_VEC \ | |
2096 | ? 1 : 0) | |
35d965d5 | 2097 | |
6cfc7210 | 2098 | #define ARM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ |
258619bb | 2099 | arm_declare_function_name ((STREAM), (NAME), (DECL)); |
35d965d5 | 2100 | |
d5b7b3ae RE |
2101 | /* For aliases of functions we use .thumb_set instead. */ |
2102 | #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL1, DECL2) \ | |
2103 | do \ | |
2104 | { \ | |
91ea4f8d KG |
2105 | const char *const LABEL1 = XSTR (XEXP (DECL_RTL (decl), 0), 0); \ |
2106 | const char *const LABEL2 = IDENTIFIER_POINTER (DECL2); \ | |
d5b7b3ae RE |
2107 | \ |
2108 | if (TARGET_THUMB && TREE_CODE (DECL1) == FUNCTION_DECL) \ | |
2109 | { \ | |
2110 | fprintf (FILE, "\t.thumb_set "); \ | |
2111 | assemble_name (FILE, LABEL1); \ | |
2112 | fprintf (FILE, ","); \ | |
2113 | assemble_name (FILE, LABEL2); \ | |
2114 | fprintf (FILE, "\n"); \ | |
2115 | } \ | |
2116 | else \ | |
2117 | ASM_OUTPUT_DEF (FILE, LABEL1, LABEL2); \ | |
2118 | } \ | |
2119 | while (0) | |
2120 | ||
fdc2d3b0 NC |
2121 | #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN |
2122 | /* To support -falign-* switches we need to use .p2align so | |
2123 | that alignment directives in code sections will be padded | |
2124 | with no-op instructions, rather than zeroes. */ | |
5a9335ef | 2125 | #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \ |
fdc2d3b0 NC |
2126 | if ((LOG) != 0) \ |
2127 | { \ | |
2128 | if ((MAX_SKIP) == 0) \ | |
5a9335ef | 2129 | fprintf ((FILE), "\t.p2align %d\n", (int) (LOG)); \ |
fdc2d3b0 NC |
2130 | else \ |
2131 | fprintf ((FILE), "\t.p2align %d,,%d\n", \ | |
5a9335ef | 2132 | (int) (LOG), (int) (MAX_SKIP)); \ |
fdc2d3b0 NC |
2133 | } |
2134 | #endif | |
35d965d5 | 2135 | \f |
5b3e6663 PB |
2136 | /* Add two bytes to the length of conditionally executed Thumb-2 |
2137 | instructions for the IT instruction. */ | |
2138 | #define ADJUST_INSN_LENGTH(insn, length) \ | |
2139 | if (TARGET_THUMB2 && GET_CODE (PATTERN (insn)) == COND_EXEC) \ | |
2140 | length += 2; | |
2141 | ||
35d965d5 | 2142 | /* Only perform branch elimination (by making instructions conditional) if |
5b3e6663 PB |
2143 | we're optimizing. For Thumb-2 check if any IT instructions need |
2144 | outputting. */ | |
d5b7b3ae RE |
2145 | #define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \ |
2146 | if (TARGET_ARM && optimize) \ | |
2147 | arm_final_prescan_insn (INSN); \ | |
5b3e6663 PB |
2148 | else if (TARGET_THUMB2) \ |
2149 | thumb2_final_prescan_insn (INSN); \ | |
2150 | else if (TARGET_THUMB1) \ | |
2151 | thumb1_final_prescan_insn (INSN) | |
35d965d5 | 2152 | |
7b8b8ade NC |
2153 | #define ARM_SIGN_EXTEND(x) ((HOST_WIDE_INT) \ |
2154 | (HOST_BITS_PER_WIDE_INT <= 32 ? (unsigned HOST_WIDE_INT) (x) \ | |
30cf4896 KG |
2155 | : ((((unsigned HOST_WIDE_INT)(x)) & (unsigned HOST_WIDE_INT) 0xffffffff) |\ |
2156 | ((((unsigned HOST_WIDE_INT)(x)) & (unsigned HOST_WIDE_INT) 0x80000000) \ | |
2157 | ? ((~ (unsigned HOST_WIDE_INT) 0) \ | |
2158 | & ~ (unsigned HOST_WIDE_INT) 0xffffffff) \ | |
7bc7696c | 2159 | : 0)))) |
35d965d5 | 2160 | |
6a5d7526 MS |
2161 | /* A C expression whose value is RTL representing the value of the return |
2162 | address for the frame COUNT steps up from the current frame. */ | |
2163 | ||
d5b7b3ae RE |
2164 | #define RETURN_ADDR_RTX(COUNT, FRAME) \ |
2165 | arm_return_addr (COUNT, FRAME) | |
2166 | ||
f676971a | 2167 | /* Mask of the bits in the PC that contain the real return address |
d5b7b3ae RE |
2168 | when running in 26-bit mode. */ |
2169 | #define RETURN_ADDR_MASK26 (0x03fffffc) | |
6a5d7526 | 2170 | |
2c849145 JM |
2171 | /* Pick up the return address upon entry to a procedure. Used for |
2172 | dwarf2 unwind information. This also enables the table driven | |
2173 | mechanism. */ | |
2c849145 JM |
2174 | #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, LR_REGNUM) |
2175 | #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (LR_REGNUM) | |
2176 | ||
39950dff MS |
2177 | /* Used to mask out junk bits from the return address, such as |
2178 | processor state, interrupt status, condition codes and the like. */ | |
2179 | #define MASK_RETURN_ADDR \ | |
2180 | /* If we are generating code for an ARM2/ARM3 machine or for an ARM6 \ | |
2181 | in 26 bit mode, the condition codes must be masked out of the \ | |
2182 | return address. This does not apply to ARM6 and later processors \ | |
2183 | when running in 32 bit mode. */ \ | |
61f0ccff RE |
2184 | ((arm_arch4 || TARGET_THUMB) \ |
2185 | ? (gen_int_mode ((unsigned long)0xffffffff, Pmode)) \ | |
fcd53748 | 2186 | : arm_gen_return_addr_mask ()) |
d5b7b3ae RE |
2187 | |
2188 | \f | |
978e411f CD |
2189 | /* Do not emit .note.GNU-stack by default. */ |
2190 | #ifndef NEED_INDICATE_EXEC_STACK | |
2191 | #define NEED_INDICATE_EXEC_STACK 0 | |
2192 | #endif | |
2193 | ||
9e94a7fc MGD |
2194 | #define TARGET_ARM_ARCH \ |
2195 | (arm_base_arch) \ | |
2196 | ||
2197 | #define TARGET_ARM_V6M (!arm_arch_notm && !arm_arch_thumb2) | |
2198 | #define TARGET_ARM_V7M (!arm_arch_notm && arm_arch_thumb2) | |
2199 | ||
2200 | /* The highest Thumb instruction set version supported by the chip. */ | |
2201 | #define TARGET_ARM_ARCH_ISA_THUMB \ | |
2202 | (arm_arch_thumb2 ? 2 \ | |
2203 | : ((TARGET_ARM_ARCH >= 5 || arm_arch4t) ? 1 : 0)) | |
2204 | ||
2205 | /* Expands to an upper-case char of the target's architectural | |
2206 | profile. */ | |
2207 | #define TARGET_ARM_ARCH_PROFILE \ | |
2208 | (!arm_arch_notm \ | |
2209 | ? 'M' \ | |
2210 | : (arm_arch7 \ | |
2211 | ? (strlen (arm_arch_name) >=3 \ | |
2212 | ? (arm_arch_name[strlen (arm_arch_name) - 3]) \ | |
2213 | : 0) \ | |
2214 | : 0)) | |
2215 | ||
2216 | /* Bit-field indicating what size LDREX/STREX loads/stores are available. | |
2217 | Bit 0 for bytes, up to bit 3 for double-words. */ | |
2218 | #define TARGET_ARM_FEATURE_LDREX \ | |
2219 | ((TARGET_HAVE_LDREX ? 4 : 0) \ | |
2220 | | (TARGET_HAVE_LDREXBH ? 3 : 0) \ | |
2221 | | (TARGET_HAVE_LDREXD ? 8 : 0)) | |
2222 | ||
08793a38 CB |
2223 | #define TARGET_ARM_FEATURE_LDREX_P(flags) \ |
2224 | ((TARGET_HAVE_LDREX_P (flags) ? 4 : 0) \ | |
2225 | | (TARGET_HAVE_LDREXBH_P (flags) ? 3 : 0) \ | |
2226 | | (TARGET_HAVE_LDREXD_P (flags) ? 8 : 0)) | |
2227 | ||
9e94a7fc MGD |
2228 | /* Set as a bit mask indicating the available widths of hardware floating |
2229 | point types. Where bit 1 indicates 16-bit support, bit 2 indicates | |
2230 | 32-bit support, bit 3 indicates 64-bit support. */ | |
2231 | #define TARGET_ARM_FP \ | |
29e1d31b MM |
2232 | (!TARGET_SOFT_FLOAT ? (TARGET_VFP_SINGLE ? 4 \ |
2233 | : (TARGET_VFP_DOUBLE ? (TARGET_FP16 ? 14 : 12) : 0)) \ | |
2234 | : 0) | |
9e94a7fc MGD |
2235 | |
2236 | ||
2237 | /* Set as a bit mask indicating the available widths of floating point | |
2238 | types for hardware NEON floating point. This is the same as | |
2239 | TARGET_ARM_FP without the 64-bit bit set. */ | |
29e1d31b MM |
2240 | #define TARGET_NEON_FP \ |
2241 | (TARGET_NEON ? (TARGET_ARM_FP & (0xff ^ 0x08)) \ | |
2242 | : 0) | |
9e94a7fc | 2243 | |
93b338c3 BS |
2244 | /* The maximum number of parallel loads or stores we support in an ldm/stm |
2245 | instruction. */ | |
2246 | #define MAX_LDM_STM_OPS 4 | |
2247 | ||
b848e289 | 2248 | #define BIG_LITTLE_SPEC \ |
84e90123 | 2249 | " %{mcpu=*:-mcpu=%:rewrite_mcpu(%{mcpu=*:%*})}" |
b848e289 JG |
2250 | |
2251 | extern const char *arm_rewrite_mcpu (int argc, const char **argv); | |
2252 | #define BIG_LITTLE_CPU_SPEC_FUNCTIONS \ | |
2253 | { "rewrite_mcpu", arm_rewrite_mcpu }, | |
2254 | ||
54e73f88 AS |
2255 | #define ASM_CPU_SPEC \ |
2256 | " %{mcpu=generic-*:-march=%*;" \ | |
b848e289 JG |
2257 | " :%{march=*:-march=%*}}" \ |
2258 | BIG_LITTLE_SPEC | |
54e73f88 | 2259 | |
33aa08b3 AS |
2260 | /* -mcpu=native handling only makes sense with compiler running on |
2261 | an ARM chip. */ | |
2262 | #if defined(__arm__) | |
2263 | extern const char *host_detect_local_cpu (int argc, const char **argv); | |
2264 | # define EXTRA_SPEC_FUNCTIONS \ | |
b848e289 JG |
2265 | { "local_cpu_detect", host_detect_local_cpu }, \ |
2266 | BIG_LITTLE_CPU_SPEC_FUNCTIONS | |
33aa08b3 AS |
2267 | |
2268 | # define MCPU_MTUNE_NATIVE_SPECS \ | |
2269 | " %{march=native:%<march=native %:local_cpu_detect(arch)}" \ | |
2270 | " %{mcpu=native:%<mcpu=native %:local_cpu_detect(cpu)}" \ | |
2271 | " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}" | |
2272 | #else | |
2273 | # define MCPU_MTUNE_NATIVE_SPECS "" | |
b848e289 | 2274 | # define EXTRA_SPEC_FUNCTIONS BIG_LITTLE_CPU_SPEC_FUNCTIONS |
33aa08b3 AS |
2275 | #endif |
2276 | ||
2277 | #define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS | |
27e83a44 | 2278 | #define TARGET_SUPPORTS_WIDE_INT 1 |
d5524d52 CB |
2279 | |
2280 | /* For switching between functions with different target attributes. */ | |
2281 | #define SWITCHABLE_TARGET 1 | |
2282 | ||
88657302 | 2283 | #endif /* ! GCC_ARM_H */ |