Fri Jan 25 08:32:04 2013 UTC ()
Make GCC define __ARM_PCS and __ARM_PCS_VFP as defined by the ARM C Language
Extentions (clang already defines them):
__ARM_PCS is defined to 1 if the default procedure calling standard for
the translation unit conforms to the "base PCS" defined in [AAPCS].
__ARM_PCS_VFP is defined to 1 if the default is to pass floating-point
parameters in hardware floating-point registers using the "VFP variant PCS"
defined in [AAPCS].


(matt)
diff -r1.1.1.1 -r1.2 src/gnu/dist/gcc4/gcc/config/arm/arm.h

cvs diff -r1.1.1.1 -r1.2 src/gnu/dist/gcc4/gcc/config/arm/Attic/arm.h (switch to unified diff)

--- src/gnu/dist/gcc4/gcc/config/arm/Attic/arm.h 2006/04/20 10:19:17 1.1.1.1
+++ src/gnu/dist/gcc4/gcc/config/arm/Attic/arm.h 2013/01/25 08:32:04 1.2
@@ -1,1079 +1,1084 @@ @@ -1,1079 +1,1084 @@
1/* Definitions of target machine for GNU compiler, for ARM. 1/* Definitions of target machine for GNU compiler, for ARM.
2 Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2 Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 3 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4 Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl) 4 Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
5 and Martin Simmons (@harleqn.co.uk). 5 and Martin Simmons (@harleqn.co.uk).
6 More major hacks by Richard Earnshaw (rearnsha@arm.com) 6 More major hacks by Richard Earnshaw (rearnsha@arm.com)
7 Minor hacks by Nick Clifton (nickc@cygnus.com) 7 Minor hacks by Nick Clifton (nickc@cygnus.com)
8 8
9 This file is part of GCC. 9 This file is part of GCC.
10 10
11 GCC is free software; you can redistribute it and/or modify it 11 GCC is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published 12 under the terms of the GNU General Public License as published
13 by the Free Software Foundation; either version 2, or (at your 13 by the Free Software Foundation; either version 2, or (at your
14 option) any later version. 14 option) any later version.
15 15
16 GCC is distributed in the hope that it will be useful, but WITHOUT 16 GCC is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 18 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19 License for more details. 19 License for more details.
20 20
21 You should have received a copy of the GNU General Public License 21 You should have received a copy of the GNU General Public License
22 along with GCC; see the file COPYING. If not, write to 22 along with GCC; see the file COPYING. If not, write to
23 the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 23 the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
24 MA 02110-1301, USA. */ 24 MA 02110-1301, USA. */
25 25
26#ifndef GCC_ARM_H 26#ifndef GCC_ARM_H
27#define GCC_ARM_H 27#define GCC_ARM_H
28 28
29/* The architecture define. */ 29/* The architecture define. */
30extern char arm_arch_name[]; 30extern char arm_arch_name[];
31 31
32/* Target CPU builtins. */ 32/* Target CPU builtins. */
33#define TARGET_CPU_CPP_BUILTINS() \ 33#define TARGET_CPU_CPP_BUILTINS() \
34 do \ 34 do \
35 { \ 35 { \
36 /* Define __arm__ even when in thumb mode, for \ 36 /* Define __arm__ even when in thumb mode, for \
37 consistency with armcc. */ \ 37 consistency with armcc. */ \
38 builtin_define ("__arm__"); \ 38 builtin_define ("__arm__"); \
39 builtin_define ("__APCS_32__"); \ 39 builtin_define ("__APCS_32__"); \
40 if (TARGET_THUMB) \ 40 if (TARGET_THUMB) \
41 builtin_define ("__thumb__"); \ 41 builtin_define ("__thumb__"); \
42 \ 42 \
43 if (TARGET_BIG_END) \ 43 if (TARGET_BIG_END) \
44 { \ 44 { \
45 builtin_define ("__ARMEB__"); \ 45 builtin_define ("__ARMEB__"); \
46 if (TARGET_THUMB) \ 46 if (TARGET_THUMB) \
47 builtin_define ("__THUMBEB__"); \ 47 builtin_define ("__THUMBEB__"); \
48 if (TARGET_LITTLE_WORDS) \ 48 if (TARGET_LITTLE_WORDS) \
49 builtin_define ("__ARMWEL__"); \ 49 builtin_define ("__ARMWEL__"); \
50 } \ 50 } \
51 else \ 51 else \
52 { \ 52 { \
53 builtin_define ("__ARMEL__"); \ 53 builtin_define ("__ARMEL__"); \
54 if (TARGET_THUMB) \ 54 if (TARGET_THUMB) \
55 builtin_define ("__THUMBEL__"); \ 55 builtin_define ("__THUMBEL__"); \
56 } \ 56 } \
57 \ 57 \
58 if (TARGET_SOFT_FLOAT) \ 58 if (TARGET_SOFT_FLOAT) \
59 builtin_define ("__SOFTFP__"); \ 59 builtin_define ("__SOFTFP__"); \
60 \ 60 \
61 if (TARGET_VFP) \ 61 if (TARGET_VFP) \
62 builtin_define ("__VFP_FP__"); \ 62 builtin_define ("__VFP_FP__"); \
63 \ 63 \
64 /* Add a define for interworking. \ 64 /* Add a define for interworking. \
65 Needed when building libgcc.a. */ \ 65 Needed when building libgcc.a. */ \
66 if (arm_cpp_interwork) \ 66 if (arm_cpp_interwork) \
67 builtin_define ("__THUMB_INTERWORK__"); \ 67 builtin_define ("__THUMB_INTERWORK__"); \
68 \ 68 \
69 builtin_assert ("cpu=arm"); \ 69 builtin_assert ("cpu=arm"); \
70 builtin_assert ("machine=arm"); \ 70 builtin_assert ("machine=arm"); \
71 \ 71 \
72 builtin_define (arm_arch_name); \ 72 builtin_define (arm_arch_name); \
73 if (arm_arch_cirrus) \ 73 if (arm_arch_cirrus) \
74 builtin_define ("__MAVERICK__"); \ 74 builtin_define ("__MAVERICK__"); \
75 if (arm_arch_xscale) \ 75 if (arm_arch_xscale) \
76 builtin_define ("__XSCALE__"); \ 76 builtin_define ("__XSCALE__"); \
77 if (arm_arch_iwmmxt) \ 77 if (arm_arch_iwmmxt) \
78 builtin_define ("__IWMMXT__"); \ 78 builtin_define ("__IWMMXT__"); \
79 if (TARGET_AAPCS_BASED) \ 79 if (TARGET_AAPCS_BASED) \
80 builtin_define ("__ARM_EABI__"); \ 80 { \
 81 builtin_define ("__ARM_EABI__"); \
 82 builtin_define ("__ARM_PCS"); \
 83 if (TARGET_HARD_FLOAT && TARGET_VFP) \
 84 builtin_define ("__ARM_PCS_VFP"); \
 85 } \
81 } while (0) 86 } while (0)
82 87
83/* The various ARM cores. */ 88/* The various ARM cores. */
84enum processor_type 89enum processor_type
85{ 90{
86#define ARM_CORE(NAME, IDENT, ARCH, FLAGS, COSTS) \ 91#define ARM_CORE(NAME, IDENT, ARCH, FLAGS, COSTS) \
87 IDENT, 92 IDENT,
88#include "arm-cores.def" 93#include "arm-cores.def"
89#undef ARM_CORE 94#undef ARM_CORE
90 /* Used to indicate that no processor has been specified. */ 95 /* Used to indicate that no processor has been specified. */
91 arm_none 96 arm_none
92}; 97};
93 98
94enum target_cpus 99enum target_cpus
95{ 100{
96#define ARM_CORE(NAME, IDENT, ARCH, FLAGS, COSTS) \ 101#define ARM_CORE(NAME, IDENT, ARCH, FLAGS, COSTS) \
97 TARGET_CPU_##IDENT, 102 TARGET_CPU_##IDENT,
98#include "arm-cores.def" 103#include "arm-cores.def"
99#undef ARM_CORE 104#undef ARM_CORE
100 TARGET_CPU_generic 105 TARGET_CPU_generic
101}; 106};
102 107
103/* The processor for which instructions should be scheduled. */ 108/* The processor for which instructions should be scheduled. */
104extern enum processor_type arm_tune; 109extern enum processor_type arm_tune;
105 110
106typedef enum arm_cond_code 111typedef enum arm_cond_code
107{ 112{
108 ARM_EQ = 0, ARM_NE, ARM_CS, ARM_CC, ARM_MI, ARM_PL, ARM_VS, ARM_VC, 113 ARM_EQ = 0, ARM_NE, ARM_CS, ARM_CC, ARM_MI, ARM_PL, ARM_VS, ARM_VC,
109 ARM_HI, ARM_LS, ARM_GE, ARM_LT, ARM_GT, ARM_LE, ARM_AL, ARM_NV 114 ARM_HI, ARM_LS, ARM_GE, ARM_LT, ARM_GT, ARM_LE, ARM_AL, ARM_NV
110} 115}
111arm_cc; 116arm_cc;
112 117
113extern arm_cc arm_current_cc; 118extern arm_cc arm_current_cc;
114 119
115#define ARM_INVERSE_CONDITION_CODE(X) ((arm_cc) (((int)X) ^ 1)) 120#define ARM_INVERSE_CONDITION_CODE(X) ((arm_cc) (((int)X) ^ 1))
116 121
117extern int arm_target_label; 122extern int arm_target_label;
118extern int arm_ccfsm_state; 123extern int arm_ccfsm_state;
119extern GTY(()) rtx arm_target_insn; 124extern GTY(()) rtx arm_target_insn;
120/* Define the information needed to generate branch insns. This is 125/* Define the information needed to generate branch insns. This is
121 stored from the compare operation. */ 126 stored from the compare operation. */
122extern GTY(()) rtx arm_compare_op0; 127extern GTY(()) rtx arm_compare_op0;
123extern GTY(()) rtx arm_compare_op1; 128extern GTY(()) rtx arm_compare_op1;
124/* The label of the current constant pool. */ 129/* The label of the current constant pool. */
125extern rtx pool_vector_label; 130extern rtx pool_vector_label;
126/* Set to 1 when a return insn is output, this means that the epilogue 131/* Set to 1 when a return insn is output, this means that the epilogue
127 is not needed. */ 132 is not needed. */
128extern int return_used_this_function; 133extern int return_used_this_function;
129/* Used to produce AOF syntax assembler. */ 134/* Used to produce AOF syntax assembler. */
130extern GTY(()) rtx aof_pic_label; 135extern GTY(()) rtx aof_pic_label;
131  136
132/* Just in case configure has failed to define anything. */ 137/* Just in case configure has failed to define anything. */
133#ifndef TARGET_CPU_DEFAULT 138#ifndef TARGET_CPU_DEFAULT
134#define TARGET_CPU_DEFAULT TARGET_CPU_generic 139#define TARGET_CPU_DEFAULT TARGET_CPU_generic
135#endif 140#endif
136 141
137 142
138#undef CPP_SPEC 143#undef CPP_SPEC
139#define CPP_SPEC "%(subtarget_cpp_spec) \ 144#define CPP_SPEC "%(subtarget_cpp_spec) \
140%{msoft-float:%{mhard-float: \ 145%{msoft-float:%{mhard-float: \
141 %e-msoft-float and -mhard_float may not be used together}} \ 146 %e-msoft-float and -mhard_float may not be used together}} \
142%{mbig-endian:%{mlittle-endian: \ 147%{mbig-endian:%{mlittle-endian: \
143 %e-mbig-endian and -mlittle-endian may not be used together}}" 148 %e-mbig-endian and -mlittle-endian may not be used together}}"
144 149
145#ifndef CC1_SPEC 150#ifndef CC1_SPEC
146#define CC1_SPEC "" 151#define CC1_SPEC ""
147#endif 152#endif
148 153
149/* This macro defines names of additional specifications to put in the specs 154/* This macro defines names of additional specifications to put in the specs
150 that can be used in various specifications like CC1_SPEC. Its definition 155 that can be used in various specifications like CC1_SPEC. Its definition
151 is an initializer with a subgrouping for each command option. 156 is an initializer with a subgrouping for each command option.
152 157
153 Each subgrouping contains a string constant, that defines the 158 Each subgrouping contains a string constant, that defines the
154 specification name, and a string constant that used by the GCC driver 159 specification name, and a string constant that used by the GCC driver
155 program. 160 program.
156 161
157 Do not define this macro if it does not need to do anything. */ 162 Do not define this macro if it does not need to do anything. */
158#define EXTRA_SPECS \ 163#define EXTRA_SPECS \
159 { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \ 164 { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \
160 SUBTARGET_EXTRA_SPECS 165 SUBTARGET_EXTRA_SPECS
161 166
162#ifndef SUBTARGET_EXTRA_SPECS 167#ifndef SUBTARGET_EXTRA_SPECS
163#define SUBTARGET_EXTRA_SPECS 168#define SUBTARGET_EXTRA_SPECS
164#endif 169#endif
165 170
166#ifndef SUBTARGET_CPP_SPEC 171#ifndef SUBTARGET_CPP_SPEC
167#define SUBTARGET_CPP_SPEC "" 172#define SUBTARGET_CPP_SPEC ""
168#endif 173#endif
169  174
170/* Run-time Target Specification. */ 175/* Run-time Target Specification. */
171#ifndef TARGET_VERSION 176#ifndef TARGET_VERSION
172#define TARGET_VERSION fputs (" (ARM/generic)", stderr); 177#define TARGET_VERSION fputs (" (ARM/generic)", stderr);
173#endif 178#endif
174 179
175#define TARGET_SOFT_FLOAT (arm_float_abi == ARM_FLOAT_ABI_SOFT) 180#define TARGET_SOFT_FLOAT (arm_float_abi == ARM_FLOAT_ABI_SOFT)
176/* Use hardware floating point instructions. */ 181/* Use hardware floating point instructions. */
177#define TARGET_HARD_FLOAT (arm_float_abi != ARM_FLOAT_ABI_SOFT) 182#define TARGET_HARD_FLOAT (arm_float_abi != ARM_FLOAT_ABI_SOFT)
178/* Use hardware floating point calling convention. */ 183/* Use hardware floating point calling convention. */
179#define TARGET_HARD_FLOAT_ABI (arm_float_abi == ARM_FLOAT_ABI_HARD) 184#define TARGET_HARD_FLOAT_ABI (arm_float_abi == ARM_FLOAT_ABI_HARD)
180#define TARGET_FPA (arm_fp_model == ARM_FP_MODEL_FPA) 185#define TARGET_FPA (arm_fp_model == ARM_FP_MODEL_FPA)
181#define TARGET_MAVERICK (arm_fp_model == ARM_FP_MODEL_MAVERICK) 186#define TARGET_MAVERICK (arm_fp_model == ARM_FP_MODEL_MAVERICK)
182#define TARGET_VFP (arm_fp_model == ARM_FP_MODEL_VFP) 187#define TARGET_VFP (arm_fp_model == ARM_FP_MODEL_VFP)
183#define TARGET_IWMMXT (arm_arch_iwmmxt) 188#define TARGET_IWMMXT (arm_arch_iwmmxt)
184#define TARGET_REALLY_IWMMXT (TARGET_IWMMXT && TARGET_ARM) 189#define TARGET_REALLY_IWMMXT (TARGET_IWMMXT && TARGET_ARM)
185#define TARGET_IWMMXT_ABI (TARGET_ARM && arm_abi == ARM_ABI_IWMMXT) 190#define TARGET_IWMMXT_ABI (TARGET_ARM && arm_abi == ARM_ABI_IWMMXT)
186#define TARGET_ARM (! TARGET_THUMB) 191#define TARGET_ARM (! TARGET_THUMB)
187#define TARGET_EITHER 1 /* (TARGET_ARM | TARGET_THUMB) */ 192#define TARGET_EITHER 1 /* (TARGET_ARM | TARGET_THUMB) */
188#define TARGET_BACKTRACE (leaf_function_p () \ 193#define TARGET_BACKTRACE (leaf_function_p () \
189 ? TARGET_TPCS_LEAF_FRAME \ 194 ? TARGET_TPCS_LEAF_FRAME \
190 : TARGET_TPCS_FRAME) 195 : TARGET_TPCS_FRAME)
191#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN) 196#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN)
192#define TARGET_AAPCS_BASED \ 197#define TARGET_AAPCS_BASED \
193 (arm_abi != ARM_ABI_APCS && arm_abi != ARM_ABI_ATPCS) 198 (arm_abi != ARM_ABI_APCS && arm_abi != ARM_ABI_ATPCS)
194 199
195#define TARGET_HARD_TP (target_thread_pointer == TP_CP15) 200#define TARGET_HARD_TP (target_thread_pointer == TP_CP15)
196#define TARGET_SOFT_TP (target_thread_pointer == TP_SOFT) 201#define TARGET_SOFT_TP (target_thread_pointer == TP_SOFT)
197 202
198/* True iff the full BPABI is being used. If TARGET_BPABI is true, 203/* True iff the full BPABI is being used. If TARGET_BPABI is true,
199 then TARGET_AAPCS_BASED must be true -- but the converse does not 204 then TARGET_AAPCS_BASED must be true -- but the converse does not
200 hold. TARGET_BPABI implies the use of the BPABI runtime library, 205 hold. TARGET_BPABI implies the use of the BPABI runtime library,
201 etc., in addition to just the AAPCS calling conventions. */ 206 etc., in addition to just the AAPCS calling conventions. */
202#ifndef TARGET_BPABI 207#ifndef TARGET_BPABI
203#define TARGET_BPABI false 208#define TARGET_BPABI false
204#endif 209#endif
205 210
206/* Support for a compile-time default CPU, et cetera. The rules are: 211/* Support for a compile-time default CPU, et cetera. The rules are:
207 --with-arch is ignored if -march or -mcpu are specified. 212 --with-arch is ignored if -march or -mcpu are specified.
208 --with-cpu is ignored if -march or -mcpu are specified, and is overridden 213 --with-cpu is ignored if -march or -mcpu are specified, and is overridden
209 by --with-arch. 214 by --with-arch.
210 --with-tune is ignored if -mtune or -mcpu are specified (but not affected 215 --with-tune is ignored if -mtune or -mcpu are specified (but not affected
211 by -march). 216 by -march).
212 --with-float is ignored if -mhard-float, -msoft-float or -mfloat-abi are 217 --with-float is ignored if -mhard-float, -msoft-float or -mfloat-abi are
213 specified. 218 specified.
214 --with-fpu is ignored if -mfpu is specified. 219 --with-fpu is ignored if -mfpu is specified.
215 --with-abi is ignored is -mabi is specified. */ 220 --with-abi is ignored is -mabi is specified. */
216#define OPTION_DEFAULT_SPECS \ 221#define OPTION_DEFAULT_SPECS \
217 {"arch", "%{!march=*:%{!mcpu=*:-march=%(VALUE)}}" }, \ 222 {"arch", "%{!march=*:%{!mcpu=*:-march=%(VALUE)}}" }, \
218 {"cpu", "%{!march=*:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ 223 {"cpu", "%{!march=*:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
219 {"tune", "%{!mcpu=*:%{!mtune=*:-mtune=%(VALUE)}}" }, \ 224 {"tune", "%{!mcpu=*:%{!mtune=*:-mtune=%(VALUE)}}" }, \
220 {"float", \ 225 {"float", \
221 "%{!msoft-float:%{!mhard-float:%{!mfloat-abi=*:-mfloat-abi=%(VALUE)}}}" }, \ 226 "%{!msoft-float:%{!mhard-float:%{!mfloat-abi=*:-mfloat-abi=%(VALUE)}}}" }, \
222 {"fpu", "%{!mfpu=*:-mfpu=%(VALUE)}"}, \ 227 {"fpu", "%{!mfpu=*:-mfpu=%(VALUE)}"}, \
223 {"abi", "%{!mabi=*:-mabi=%(VALUE)}"}, 228 {"abi", "%{!mabi=*:-mabi=%(VALUE)}"},
224 229
225/* Which floating point model to use. */ 230/* Which floating point model to use. */
226enum arm_fp_model 231enum arm_fp_model
227{ 232{
228 ARM_FP_MODEL_UNKNOWN, 233 ARM_FP_MODEL_UNKNOWN,
229 /* FPA model (Hardware or software). */ 234 /* FPA model (Hardware or software). */
230 ARM_FP_MODEL_FPA, 235 ARM_FP_MODEL_FPA,
231 /* Cirrus Maverick floating point model. */ 236 /* Cirrus Maverick floating point model. */
232 ARM_FP_MODEL_MAVERICK, 237 ARM_FP_MODEL_MAVERICK,
233 /* VFP floating point model. */ 238 /* VFP floating point model. */
234 ARM_FP_MODEL_VFP 239 ARM_FP_MODEL_VFP
235}; 240};
236 241
237extern enum arm_fp_model arm_fp_model; 242extern enum arm_fp_model arm_fp_model;
238 243
239/* Which floating point hardware is available. Also update 244/* Which floating point hardware is available. Also update
240 fp_model_for_fpu in arm.c when adding entries to this list. */ 245 fp_model_for_fpu in arm.c when adding entries to this list. */
241enum fputype 246enum fputype
242{ 247{
243 /* No FP hardware. */ 248 /* No FP hardware. */
244 FPUTYPE_NONE, 249 FPUTYPE_NONE,
245 /* Full FPA support. */ 250 /* Full FPA support. */
246 FPUTYPE_FPA, 251 FPUTYPE_FPA,
247 /* Emulated FPA hardware, Issue 2 emulator (no LFM/SFM). */ 252 /* Emulated FPA hardware, Issue 2 emulator (no LFM/SFM). */
248 FPUTYPE_FPA_EMU2, 253 FPUTYPE_FPA_EMU2,
249 /* Emulated FPA hardware, Issue 3 emulator. */ 254 /* Emulated FPA hardware, Issue 3 emulator. */
250 FPUTYPE_FPA_EMU3, 255 FPUTYPE_FPA_EMU3,
251 /* Cirrus Maverick floating point co-processor. */ 256 /* Cirrus Maverick floating point co-processor. */
252 FPUTYPE_MAVERICK, 257 FPUTYPE_MAVERICK,
253 /* VFP. */ 258 /* VFP. */
254 FPUTYPE_VFP 259 FPUTYPE_VFP
255}; 260};
256 261
257/* Recast the floating point class to be the floating point attribute. */ 262/* Recast the floating point class to be the floating point attribute. */
258#define arm_fpu_attr ((enum attr_fpu) arm_fpu_tune) 263#define arm_fpu_attr ((enum attr_fpu) arm_fpu_tune)
259 264
260/* What type of floating point to tune for */ 265/* What type of floating point to tune for */
261extern enum fputype arm_fpu_tune; 266extern enum fputype arm_fpu_tune;
262 267
263/* What type of floating point instructions are available */ 268/* What type of floating point instructions are available */
264extern enum fputype arm_fpu_arch; 269extern enum fputype arm_fpu_arch;
265 270
266enum float_abi_type 271enum float_abi_type
267{ 272{
268 ARM_FLOAT_ABI_SOFT, 273 ARM_FLOAT_ABI_SOFT,
269 ARM_FLOAT_ABI_SOFTFP, 274 ARM_FLOAT_ABI_SOFTFP,
270 ARM_FLOAT_ABI_HARD 275 ARM_FLOAT_ABI_HARD
271}; 276};
272 277
273extern enum float_abi_type arm_float_abi; 278extern enum float_abi_type arm_float_abi;
274 279
275#ifndef TARGET_DEFAULT_FLOAT_ABI 280#ifndef TARGET_DEFAULT_FLOAT_ABI
276#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT 281#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
277#endif 282#endif
278 283
279/* Which ABI to use. */ 284/* Which ABI to use. */
280enum arm_abi_type 285enum arm_abi_type
281{ 286{
282 ARM_ABI_APCS, 287 ARM_ABI_APCS,
283 ARM_ABI_ATPCS, 288 ARM_ABI_ATPCS,
284 ARM_ABI_AAPCS, 289 ARM_ABI_AAPCS,
285 ARM_ABI_IWMMXT, 290 ARM_ABI_IWMMXT,
286 ARM_ABI_AAPCS_LINUX 291 ARM_ABI_AAPCS_LINUX
287}; 292};
288 293
289extern enum arm_abi_type arm_abi; 294extern enum arm_abi_type arm_abi;
290 295
291#ifndef ARM_DEFAULT_ABI 296#ifndef ARM_DEFAULT_ABI
292#define ARM_DEFAULT_ABI ARM_ABI_APCS 297#define ARM_DEFAULT_ABI ARM_ABI_APCS
293#endif 298#endif
294 299
295/* Which thread pointer access sequence to use. */ 300/* Which thread pointer access sequence to use. */
296enum arm_tp_type { 301enum arm_tp_type {
297 TP_AUTO, 302 TP_AUTO,
298 TP_SOFT, 303 TP_SOFT,
299 TP_CP15 304 TP_CP15
300}; 305};
301 306
302extern enum arm_tp_type target_thread_pointer; 307extern enum arm_tp_type target_thread_pointer;
303 308
304/* Nonzero if this chip supports the ARM Architecture 3M extensions. */ 309/* Nonzero if this chip supports the ARM Architecture 3M extensions. */
305extern int arm_arch3m; 310extern int arm_arch3m;
306 311
307/* Nonzero if this chip supports the ARM Architecture 4 extensions. */ 312/* Nonzero if this chip supports the ARM Architecture 4 extensions. */
308extern int arm_arch4; 313extern int arm_arch4;
309 314
310/* Nonzero if this chip supports the ARM Architecture 4T extensions. */ 315/* Nonzero if this chip supports the ARM Architecture 4T extensions. */
311extern int arm_arch4t; 316extern int arm_arch4t;
312 317
313/* Nonzero if this chip supports the ARM Architecture 5 extensions. */ 318/* Nonzero if this chip supports the ARM Architecture 5 extensions. */
314extern int arm_arch5; 319extern int arm_arch5;
315 320
316/* Nonzero if this chip supports the ARM Architecture 5E extensions. */ 321/* Nonzero if this chip supports the ARM Architecture 5E extensions. */
317extern int arm_arch5e; 322extern int arm_arch5e;
318 323
319/* Nonzero if this chip supports the ARM Architecture 6 extensions. */ 324/* Nonzero if this chip supports the ARM Architecture 6 extensions. */
320extern int arm_arch6; 325extern int arm_arch6;
321 326
322/* Nonzero if this chip can benefit from load scheduling. */ 327/* Nonzero if this chip can benefit from load scheduling. */
323extern int arm_ld_sched; 328extern int arm_ld_sched;
324 329
325/* Nonzero if generating thumb code. */ 330/* Nonzero if generating thumb code. */
326extern int thumb_code; 331extern int thumb_code;
327 332
328/* Nonzero if this chip is a StrongARM. */ 333/* Nonzero if this chip is a StrongARM. */
329extern int arm_tune_strongarm; 334extern int arm_tune_strongarm;
330 335
331/* Nonzero if this chip is a Cirrus variant. */ 336/* Nonzero if this chip is a Cirrus variant. */
332extern int arm_arch_cirrus; 337extern int arm_arch_cirrus;
333 338
334/* Nonzero if this chip supports Intel XScale with Wireless MMX technology. */ 339/* Nonzero if this chip supports Intel XScale with Wireless MMX technology. */
335extern int arm_arch_iwmmxt; 340extern int arm_arch_iwmmxt;
336 341
337/* Nonzero if this chip is an XScale. */ 342/* Nonzero if this chip is an XScale. */
338extern int arm_arch_xscale; 343extern int arm_arch_xscale;
339 344
340/* Nonzero if tuning for XScale. */ 345/* Nonzero if tuning for XScale. */
341extern int arm_tune_xscale; 346extern int arm_tune_xscale;
342 347
343/* Nonzero if tuning for stores via the write buffer. */ 348/* Nonzero if tuning for stores via the write buffer. */
344extern int arm_tune_wbuf; 349extern int arm_tune_wbuf;
345 350
346/* Nonzero if we should define __THUMB_INTERWORK__ in the 351/* Nonzero if we should define __THUMB_INTERWORK__ in the
347 preprocessor. 352 preprocessor.
348 XXX This is a bit of a hack, it's intended to help work around 353 XXX This is a bit of a hack, it's intended to help work around
349 problems in GLD which doesn't understand that armv5t code is 354 problems in GLD which doesn't understand that armv5t code is
350 interworking clean. */ 355 interworking clean. */
351extern int arm_cpp_interwork; 356extern int arm_cpp_interwork;
352 357
353#ifndef TARGET_DEFAULT 358#ifndef TARGET_DEFAULT
354#define TARGET_DEFAULT (MASK_APCS_FRAME) 359#define TARGET_DEFAULT (MASK_APCS_FRAME)
355#endif 360#endif
356 361
357/* The frame pointer register used in gcc has nothing to do with debugging; 362/* The frame pointer register used in gcc has nothing to do with debugging;
358 that is controlled by the APCS-FRAME option. */ 363 that is controlled by the APCS-FRAME option. */
359#define CAN_DEBUG_WITHOUT_FP 364#define CAN_DEBUG_WITHOUT_FP
360 365
361#define OVERRIDE_OPTIONS arm_override_options () 366#define OVERRIDE_OPTIONS arm_override_options ()
362 367
363/* Nonzero if PIC code requires explicit qualifiers to generate 368/* Nonzero if PIC code requires explicit qualifiers to generate
364 PLT and GOT relocs rather than the assembler doing so implicitly. 369 PLT and GOT relocs rather than the assembler doing so implicitly.
365 Subtargets can override these if required. */ 370 Subtargets can override these if required. */
366#ifndef NEED_GOT_RELOC 371#ifndef NEED_GOT_RELOC
367#define NEED_GOT_RELOC 0 372#define NEED_GOT_RELOC 0
368#endif 373#endif
369#ifndef NEED_PLT_RELOC 374#ifndef NEED_PLT_RELOC
370#define NEED_PLT_RELOC 0 375#define NEED_PLT_RELOC 0
371#endif 376#endif
372 377
373/* Nonzero if we need to refer to the GOT with a PC-relative 378/* Nonzero if we need to refer to the GOT with a PC-relative
374 offset. In other words, generate 379 offset. In other words, generate
375 380
376 .word _GLOBAL_OFFSET_TABLE_ - [. - (.Lxx + 8)] 381 .word _GLOBAL_OFFSET_TABLE_ - [. - (.Lxx + 8)]
377 382
378 rather than 383 rather than
379 384
380 .word _GLOBAL_OFFSET_TABLE_ - (.Lxx + 8) 385 .word _GLOBAL_OFFSET_TABLE_ - (.Lxx + 8)
381 386
382 The default is true, which matches NetBSD. Subtargets can 387 The default is true, which matches NetBSD. Subtargets can
383 override this if required. */ 388 override this if required. */
384#ifndef GOT_PCREL 389#ifndef GOT_PCREL
385#define GOT_PCREL 1 390#define GOT_PCREL 1
386#endif 391#endif
387  392
388/* Target machine storage Layout. */ 393/* Target machine storage Layout. */
389 394
390 395
391/* Define this macro if it is advisable to hold scalars in registers 396/* Define this macro if it is advisable to hold scalars in registers
392 in a wider mode than that declared by the program. In such cases, 397 in a wider mode than that declared by the program. In such cases,
393 the value is constrained to be within the bounds of the declared 398 the value is constrained to be within the bounds of the declared
394 type, but kept valid in the wider mode. The signedness of the 399 type, but kept valid in the wider mode. The signedness of the
395 extension may differ from that of the type. */ 400 extension may differ from that of the type. */
396 401
397/* It is far faster to zero extend chars than to sign extend them */ 402/* It is far faster to zero extend chars than to sign extend them */
398 403
399#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ 404#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
400 if (GET_MODE_CLASS (MODE) == MODE_INT \ 405 if (GET_MODE_CLASS (MODE) == MODE_INT \
401 && GET_MODE_SIZE (MODE) < 4) \ 406 && GET_MODE_SIZE (MODE) < 4) \
402 { \ 407 { \
403 if (MODE == QImode) \ 408 if (MODE == QImode) \
404 UNSIGNEDP = 1; \ 409 UNSIGNEDP = 1; \
405 else if (MODE == HImode) \ 410 else if (MODE == HImode) \
406 UNSIGNEDP = 1; \ 411 UNSIGNEDP = 1; \
407 (MODE) = SImode; \ 412 (MODE) = SImode; \
408 } 413 }
409 414
410#define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \ 415#define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \
411 if ((GET_MODE_CLASS (MODE) == MODE_INT \ 416 if ((GET_MODE_CLASS (MODE) == MODE_INT \
412 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT) \ 417 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT) \
413 && GET_MODE_SIZE (MODE) < 4) \ 418 && GET_MODE_SIZE (MODE) < 4) \
414 (MODE) = SImode; \ 419 (MODE) = SImode; \
415 420
416/* Define this if most significant bit is lowest numbered 421/* Define this if most significant bit is lowest numbered
417 in instructions that operate on numbered bit-fields. */ 422 in instructions that operate on numbered bit-fields. */
418#define BITS_BIG_ENDIAN 0 423#define BITS_BIG_ENDIAN 0
419 424
420/* Define this if most significant byte of a word is the lowest numbered. 425/* Define this if most significant byte of a word is the lowest numbered.
421 Most ARM processors are run in little endian mode, so that is the default. 426 Most ARM processors are run in little endian mode, so that is the default.
422 If you want to have it run-time selectable, change the definition in a 427 If you want to have it run-time selectable, change the definition in a
423 cover file to be TARGET_BIG_ENDIAN. */ 428 cover file to be TARGET_BIG_ENDIAN. */
424#define BYTES_BIG_ENDIAN (TARGET_BIG_END != 0) 429#define BYTES_BIG_ENDIAN (TARGET_BIG_END != 0)
425 430
426/* Define this if most significant word of a multiword number is the lowest 431/* Define this if most significant word of a multiword number is the lowest
427 numbered. 432 numbered.
428 This is always false, even when in big-endian mode. */ 433 This is always false, even when in big-endian mode. */
429#define WORDS_BIG_ENDIAN (BYTES_BIG_ENDIAN && ! TARGET_LITTLE_WORDS) 434#define WORDS_BIG_ENDIAN (BYTES_BIG_ENDIAN && ! TARGET_LITTLE_WORDS)
430 435
431/* LIBGCC2_WORDS_BIG_ENDIAN has to be a constant, so we define this based 436/* LIBGCC2_WORDS_BIG_ENDIAN has to be a constant, so we define this based
432 on processor pre-defineds when compiling libgcc2.c. */ 437 on processor pre-defineds when compiling libgcc2.c. */
433#if defined(__ARMEB__) && !defined(__ARMWEL__) 438#if defined(__ARMEB__) && !defined(__ARMWEL__)
434#define LIBGCC2_WORDS_BIG_ENDIAN 1 439#define LIBGCC2_WORDS_BIG_ENDIAN 1
435#else 440#else
436#define LIBGCC2_WORDS_BIG_ENDIAN 0 441#define LIBGCC2_WORDS_BIG_ENDIAN 0
437#endif 442#endif
438 443
439/* Define this if most significant word of doubles is the lowest numbered. 444/* Define this if most significant word of doubles is the lowest numbered.
440 The rules are different based on whether or not we use FPA-format, 445 The rules are different based on whether or not we use FPA-format,
441 VFP-format or some other floating point co-processor's format doubles. */ 446 VFP-format or some other floating point co-processor's format doubles. */
442#define FLOAT_WORDS_BIG_ENDIAN (arm_float_words_big_endian ()) 447#define FLOAT_WORDS_BIG_ENDIAN (arm_float_words_big_endian ())
443 448
444#define UNITS_PER_WORD 4 449#define UNITS_PER_WORD 4
445 450
446/* True if natural alignment is used for doubleword types. */ 451/* True if natural alignment is used for doubleword types. */
447#define ARM_DOUBLEWORD_ALIGN TARGET_AAPCS_BASED 452#define ARM_DOUBLEWORD_ALIGN TARGET_AAPCS_BASED
448 453
449#define DOUBLEWORD_ALIGNMENT 64 454#define DOUBLEWORD_ALIGNMENT 64
450 455
451#define PARM_BOUNDARY 32 456#define PARM_BOUNDARY 32
452 457
453#define STACK_BOUNDARY (ARM_DOUBLEWORD_ALIGN ? DOUBLEWORD_ALIGNMENT : 32) 458#define STACK_BOUNDARY (ARM_DOUBLEWORD_ALIGN ? DOUBLEWORD_ALIGNMENT : 32)
454 459
455#define PREFERRED_STACK_BOUNDARY \ 460#define PREFERRED_STACK_BOUNDARY \
456 (arm_abi == ARM_ABI_ATPCS ? 64 : STACK_BOUNDARY) 461 (arm_abi == ARM_ABI_ATPCS ? 64 : STACK_BOUNDARY)
457 462
458#define FUNCTION_BOUNDARY 32 463#define FUNCTION_BOUNDARY 32
459 464
460/* The lowest bit is used to indicate Thumb-mode functions, so the 465/* The lowest bit is used to indicate Thumb-mode functions, so the
461 vbit must go into the delta field of pointers to member 466 vbit must go into the delta field of pointers to member
462 functions. */ 467 functions. */
463#define TARGET_PTRMEMFUNC_VBIT_LOCATION ptrmemfunc_vbit_in_delta 468#define TARGET_PTRMEMFUNC_VBIT_LOCATION ptrmemfunc_vbit_in_delta
464 469
465#define EMPTY_FIELD_BOUNDARY 32 470#define EMPTY_FIELD_BOUNDARY 32
466 471
467#define BIGGEST_ALIGNMENT (ARM_DOUBLEWORD_ALIGN ? DOUBLEWORD_ALIGNMENT : 32) 472#define BIGGEST_ALIGNMENT (ARM_DOUBLEWORD_ALIGN ? DOUBLEWORD_ALIGNMENT : 32)
468 473
469/* XXX Blah -- this macro is used directly by libobjc. Since it 474/* XXX Blah -- this macro is used directly by libobjc. Since it
470 supports no vector modes, cut out the complexity and fall back 475 supports no vector modes, cut out the complexity and fall back
471 on BIGGEST_FIELD_ALIGNMENT. */ 476 on BIGGEST_FIELD_ALIGNMENT. */
472#ifdef IN_TARGET_LIBS 477#ifdef IN_TARGET_LIBS
473#define BIGGEST_FIELD_ALIGNMENT 64 478#define BIGGEST_FIELD_ALIGNMENT 64
474#endif 479#endif
475 480
476/* Make strings word-aligned so strcpy from constants will be faster. */ 481/* Make strings word-aligned so strcpy from constants will be faster. */
477#define CONSTANT_ALIGNMENT_FACTOR (TARGET_THUMB || ! arm_tune_xscale ? 1 : 2) 482#define CONSTANT_ALIGNMENT_FACTOR (TARGET_THUMB || ! arm_tune_xscale ? 1 : 2)
478 483
479#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ 484#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
480 ((TREE_CODE (EXP) == STRING_CST \ 485 ((TREE_CODE (EXP) == STRING_CST \
481 && (ALIGN) < BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR) \ 486 && (ALIGN) < BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR) \
482 ? BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR : (ALIGN)) 487 ? BITS_PER_WORD * CONSTANT_ALIGNMENT_FACTOR : (ALIGN))
483 488
484/* Setting STRUCTURE_SIZE_BOUNDARY to 32 produces more efficient code, but the 489/* Setting STRUCTURE_SIZE_BOUNDARY to 32 produces more efficient code, but the
485 value set in previous versions of this toolchain was 8, which produces more 490 value set in previous versions of this toolchain was 8, which produces more
486 compact structures. The command line option -mstructure_size_boundary=<n> 491 compact structures. The command line option -mstructure_size_boundary=<n>
487 can be used to change this value. For compatibility with the ARM SDK 492 can be used to change this value. For compatibility with the ARM SDK
488 however the value should be left at 32. ARM SDT Reference Manual (ARM DUI 493 however the value should be left at 32. ARM SDT Reference Manual (ARM DUI
489 0020D) page 2-20 says "Structures are aligned on word boundaries". 494 0020D) page 2-20 says "Structures are aligned on word boundaries".
490 The AAPCS specifies a value of 8. */ 495 The AAPCS specifies a value of 8. */
491#define STRUCTURE_SIZE_BOUNDARY arm_structure_size_boundary 496#define STRUCTURE_SIZE_BOUNDARY arm_structure_size_boundary
492extern int arm_structure_size_boundary; 497extern int arm_structure_size_boundary;
493 498
494/* This is the value used to initialize arm_structure_size_boundary. If a 499/* This is the value used to initialize arm_structure_size_boundary. If a
495 particular arm target wants to change the default value it should change 500 particular arm target wants to change the default value it should change
496 the definition of this macro, not STRUCTURE_SIZE_BOUNDARY. See netbsd.h 501 the definition of this macro, not STRUCTURE_SIZE_BOUNDARY. See netbsd.h
497 for an example of this. */ 502 for an example of this. */
498#ifndef DEFAULT_STRUCTURE_SIZE_BOUNDARY 503#ifndef DEFAULT_STRUCTURE_SIZE_BOUNDARY
499#define DEFAULT_STRUCTURE_SIZE_BOUNDARY 32 504#define DEFAULT_STRUCTURE_SIZE_BOUNDARY 32
500#endif 505#endif
501 506
502/* Nonzero if move instructions will actually fail to work 507/* Nonzero if move instructions will actually fail to work
503 when given unaligned data. */ 508 when given unaligned data. */
504#define STRICT_ALIGNMENT 1 509#define STRICT_ALIGNMENT 1
505 510
506/* wchar_t is unsigned under the AAPCS. */ 511/* wchar_t is unsigned under the AAPCS. */
507#ifndef WCHAR_TYPE 512#ifndef WCHAR_TYPE
508#define WCHAR_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "int") 513#define WCHAR_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "int")
509 514
510#define WCHAR_TYPE_SIZE BITS_PER_WORD 515#define WCHAR_TYPE_SIZE BITS_PER_WORD
511#endif 516#endif
512 517
513#ifndef SIZE_TYPE 518#ifndef SIZE_TYPE
514#define SIZE_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "long unsigned int") 519#define SIZE_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "long unsigned int")
515#endif 520#endif
516 521
517#ifndef PTRDIFF_TYPE 522#ifndef PTRDIFF_TYPE
518#define PTRDIFF_TYPE (TARGET_AAPCS_BASED ? "int" : "long int") 523#define PTRDIFF_TYPE (TARGET_AAPCS_BASED ? "int" : "long int")
519#endif 524#endif
520 525
521/* AAPCS requires that structure alignment is affected by bitfields. */ 526/* AAPCS requires that structure alignment is affected by bitfields. */
522#ifndef PCC_BITFIELD_TYPE_MATTERS 527#ifndef PCC_BITFIELD_TYPE_MATTERS
523#define PCC_BITFIELD_TYPE_MATTERS TARGET_AAPCS_BASED 528#define PCC_BITFIELD_TYPE_MATTERS TARGET_AAPCS_BASED
524#endif 529#endif
525 530
526  531
527/* Standard register usage. */ 532/* Standard register usage. */
528 533
529/* Register allocation in ARM Procedure Call Standard (as used on RISCiX): 534/* Register allocation in ARM Procedure Call Standard (as used on RISCiX):
530 (S - saved over call). 535 (S - saved over call).
531 536
532 r0 * argument word/integer result 537 r0 * argument word/integer result
533 r1-r3 argument word 538 r1-r3 argument word
534 539
535 r4-r8 S register variable 540 r4-r8 S register variable
536 r9 S (rfp) register variable (real frame pointer) 541 r9 S (rfp) register variable (real frame pointer)
537 542
538 r10 F S (sl) stack limit (used by -mapcs-stack-check) 543 r10 F S (sl) stack limit (used by -mapcs-stack-check)
539 r11 F S (fp) argument pointer 544 r11 F S (fp) argument pointer
540 r12 (ip) temp workspace 545 r12 (ip) temp workspace
541 r13 F S (sp) lower end of current stack frame 546 r13 F S (sp) lower end of current stack frame
542 r14 (lr) link address/workspace 547 r14 (lr) link address/workspace
543 r15 F (pc) program counter 548 r15 F (pc) program counter
544 549
545 f0 floating point result 550 f0 floating point result
546 f1-f3 floating point scratch 551 f1-f3 floating point scratch
547 552
548 f4-f7 S floating point variable 553 f4-f7 S floating point variable
549 554
550 cc This is NOT a real register, but is used internally 555 cc This is NOT a real register, but is used internally
551 to represent things that use or set the condition 556 to represent things that use or set the condition
552 codes. 557 codes.
553 sfp This isn't either. It is used during rtl generation 558 sfp This isn't either. It is used during rtl generation
554 since the offset between the frame pointer and the 559 since the offset between the frame pointer and the
555 auto's isn't known until after register allocation. 560 auto's isn't known until after register allocation.
556 afp Nor this, we only need this because of non-local 561 afp Nor this, we only need this because of non-local
557 goto. Without it fp appears to be used and the 562 goto. Without it fp appears to be used and the
558 elimination code won't get rid of sfp. It tracks 563 elimination code won't get rid of sfp. It tracks
559 fp exactly at all times. 564 fp exactly at all times.
560 565
561 *: See CONDITIONAL_REGISTER_USAGE */ 566 *: See CONDITIONAL_REGISTER_USAGE */
562 567
563/* 568/*
564 mvf0 Cirrus floating point result 569 mvf0 Cirrus floating point result
565 mvf1-mvf3 Cirrus floating point scratch 570 mvf1-mvf3 Cirrus floating point scratch
566 mvf4-mvf15 S Cirrus floating point variable. */ 571 mvf4-mvf15 S Cirrus floating point variable. */
567 572
568/* s0-s15 VFP scratch (aka d0-d7). 573/* s0-s15 VFP scratch (aka d0-d7).
569 s16-s31 S VFP variable (aka d8-d15). 574 s16-s31 S VFP variable (aka d8-d15).
570 vfpcc Not a real register. Represents the VFP condition 575 vfpcc Not a real register. Represents the VFP condition
571 code flags. */ 576 code flags. */
572 577
573/* The stack backtrace structure is as follows: 578/* The stack backtrace structure is as follows:
574 fp points to here: | save code pointer | [fp] 579 fp points to here: | save code pointer | [fp]
575 | return link value | [fp, #-4] 580 | return link value | [fp, #-4]
576 | return sp value | [fp, #-8] 581 | return sp value | [fp, #-8]
577 | return fp value | [fp, #-12] 582 | return fp value | [fp, #-12]
578 [| saved r10 value |] 583 [| saved r10 value |]
579 [| saved r9 value |] 584 [| saved r9 value |]
580 [| saved r8 value |] 585 [| saved r8 value |]
581 [| saved r7 value |] 586 [| saved r7 value |]
582 [| saved r6 value |] 587 [| saved r6 value |]
583 [| saved r5 value |] 588 [| saved r5 value |]
584 [| saved r4 value |] 589 [| saved r4 value |]
585 [| saved r3 value |] 590 [| saved r3 value |]
586 [| saved r2 value |] 591 [| saved r2 value |]
587 [| saved r1 value |] 592 [| saved r1 value |]
588 [| saved r0 value |] 593 [| saved r0 value |]
589 [| saved f7 value |] three words 594 [| saved f7 value |] three words
590 [| saved f6 value |] three words 595 [| saved f6 value |] three words
591 [| saved f5 value |] three words 596 [| saved f5 value |] three words
592 [| saved f4 value |] three words 597 [| saved f4 value |] three words
593 r0-r3 are not normally saved in a C function. */ 598 r0-r3 are not normally saved in a C function. */
594 599
595/* 1 for registers that have pervasive standard uses 600/* 1 for registers that have pervasive standard uses
596 and are not available for the register allocator. */ 601 and are not available for the register allocator. */
597#define FIXED_REGISTERS \ 602#define FIXED_REGISTERS \
598{ \ 603{ \
599 0,0,0,0,0,0,0,0, \ 604 0,0,0,0,0,0,0,0, \
600 0,0,0,0,0,1,0,1, \ 605 0,0,0,0,0,1,0,1, \
601 0,0,0,0,0,0,0,0, \ 606 0,0,0,0,0,0,0,0, \
602 1,1,1, \ 607 1,1,1, \
603 1,1,1,1,1,1,1,1, \ 608 1,1,1,1,1,1,1,1, \
604 1,1,1,1,1,1,1,1, \ 609 1,1,1,1,1,1,1,1, \
605 1,1,1,1,1,1,1,1, \ 610 1,1,1,1,1,1,1,1, \
606 1,1,1,1,1,1,1,1, \ 611 1,1,1,1,1,1,1,1, \
607 1,1,1,1, \ 612 1,1,1,1, \
608 1,1,1,1,1,1,1,1, \ 613 1,1,1,1,1,1,1,1, \
609 1,1,1,1,1,1,1,1, \ 614 1,1,1,1,1,1,1,1, \
610 1,1,1,1,1,1,1,1, \ 615 1,1,1,1,1,1,1,1, \
611 1,1,1,1,1,1,1,1, \ 616 1,1,1,1,1,1,1,1, \
612 1 \ 617 1 \
613} 618}
614 619
615/* 1 for registers not available across function calls. 620/* 1 for registers not available across function calls.
616 These must include the FIXED_REGISTERS and also any 621 These must include the FIXED_REGISTERS and also any
617 registers that can be used without being saved. 622 registers that can be used without being saved.
618 The latter must include the registers where values are returned 623 The latter must include the registers where values are returned
619 and the register where structure-value addresses are passed. 624 and the register where structure-value addresses are passed.
620 Aside from that, you can include as many other registers as you like. 625 Aside from that, you can include as many other registers as you like.
621 The CC is not preserved over function calls on the ARM 6, so it is 626 The CC is not preserved over function calls on the ARM 6, so it is
622 easier to assume this for all. SFP is preserved, since FP is. */ 627 easier to assume this for all. SFP is preserved, since FP is. */
623#define CALL_USED_REGISTERS \ 628#define CALL_USED_REGISTERS \
624{ \ 629{ \
625 1,1,1,1,0,0,0,0, \ 630 1,1,1,1,0,0,0,0, \
626 0,0,0,0,1,1,1,1, \ 631 0,0,0,0,1,1,1,1, \
627 1,1,1,1,0,0,0,0, \ 632 1,1,1,1,0,0,0,0, \
628 1,1,1, \ 633 1,1,1, \
629 1,1,1,1,1,1,1,1, \ 634 1,1,1,1,1,1,1,1, \
630 1,1,1,1,1,1,1,1, \ 635 1,1,1,1,1,1,1,1, \
631 1,1,1,1,1,1,1,1, \ 636 1,1,1,1,1,1,1,1, \
632 1,1,1,1,1,1,1,1, \ 637 1,1,1,1,1,1,1,1, \
633 1,1,1,1, \ 638 1,1,1,1, \
634 1,1,1,1,1,1,1,1, \ 639 1,1,1,1,1,1,1,1, \
635 1,1,1,1,1,1,1,1, \ 640 1,1,1,1,1,1,1,1, \
636 1,1,1,1,1,1,1,1, \ 641 1,1,1,1,1,1,1,1, \
637 1,1,1,1,1,1,1,1, \ 642 1,1,1,1,1,1,1,1, \
638 1 \ 643 1 \
639} 644}
640 645
641#ifndef SUBTARGET_CONDITIONAL_REGISTER_USAGE 646#ifndef SUBTARGET_CONDITIONAL_REGISTER_USAGE
642#define SUBTARGET_CONDITIONAL_REGISTER_USAGE 647#define SUBTARGET_CONDITIONAL_REGISTER_USAGE
643#endif 648#endif
644 649
645#define CONDITIONAL_REGISTER_USAGE \ 650#define CONDITIONAL_REGISTER_USAGE \
646{ \ 651{ \
647 int regno; \ 652 int regno; \
648 \ 653 \
649 if (TARGET_SOFT_FLOAT || TARGET_THUMB || !TARGET_FPA) \ 654 if (TARGET_SOFT_FLOAT || TARGET_THUMB || !TARGET_FPA) \
650 { \ 655 { \
651 for (regno = FIRST_FPA_REGNUM; \ 656 for (regno = FIRST_FPA_REGNUM; \
652 regno <= LAST_FPA_REGNUM; ++regno) \ 657 regno <= LAST_FPA_REGNUM; ++regno) \
653 fixed_regs[regno] = call_used_regs[regno] = 1; \ 658 fixed_regs[regno] = call_used_regs[regno] = 1; \
654 } \ 659 } \
655 \ 660 \
656 if (TARGET_THUMB && optimize_size) \ 661 if (TARGET_THUMB && optimize_size) \
657 { \ 662 { \
658 /* When optimizing for size, it's better not to use \ 663 /* When optimizing for size, it's better not to use \
659 the HI regs, because of the overhead of stacking \ 664 the HI regs, because of the overhead of stacking \
660 them. */ \ 665 them. */ \
661 for (regno = FIRST_HI_REGNUM; \ 666 for (regno = FIRST_HI_REGNUM; \
662 regno <= LAST_HI_REGNUM; ++regno) \ 667 regno <= LAST_HI_REGNUM; ++regno) \
663 fixed_regs[regno] = call_used_regs[regno] = 1; \ 668 fixed_regs[regno] = call_used_regs[regno] = 1; \
664 } \ 669 } \
665 \ 670 \
666 /* The link register can be clobbered by any branch insn, \ 671 /* The link register can be clobbered by any branch insn, \
667 but we have no way to track that at present, so mark \ 672 but we have no way to track that at present, so mark \
668 it as unavailable. */ \ 673 it as unavailable. */ \
669 if (TARGET_THUMB) \ 674 if (TARGET_THUMB) \
670 fixed_regs[LR_REGNUM] = call_used_regs[LR_REGNUM] = 1; \ 675 fixed_regs[LR_REGNUM] = call_used_regs[LR_REGNUM] = 1; \
671 \ 676 \
672 if (TARGET_ARM && TARGET_HARD_FLOAT) \ 677 if (TARGET_ARM && TARGET_HARD_FLOAT) \
673 { \ 678 { \
674 if (TARGET_MAVERICK) \ 679 if (TARGET_MAVERICK) \
675 { \ 680 { \
676 for (regno = FIRST_FPA_REGNUM; \ 681 for (regno = FIRST_FPA_REGNUM; \
677 regno <= LAST_FPA_REGNUM; ++ regno) \ 682 regno <= LAST_FPA_REGNUM; ++ regno) \
678 fixed_regs[regno] = call_used_regs[regno] = 1; \ 683 fixed_regs[regno] = call_used_regs[regno] = 1; \
679 for (regno = FIRST_CIRRUS_FP_REGNUM; \ 684 for (regno = FIRST_CIRRUS_FP_REGNUM; \
680 regno <= LAST_CIRRUS_FP_REGNUM; ++ regno) \ 685 regno <= LAST_CIRRUS_FP_REGNUM; ++ regno) \
681 { \ 686 { \
682 fixed_regs[regno] = 0; \ 687 fixed_regs[regno] = 0; \
683 call_used_regs[regno] = regno < FIRST_CIRRUS_FP_REGNUM + 4; \ 688 call_used_regs[regno] = regno < FIRST_CIRRUS_FP_REGNUM + 4; \
684 } \ 689 } \
685 } \ 690 } \
686 if (TARGET_VFP) \ 691 if (TARGET_VFP) \
687 { \ 692 { \
688 for (regno = FIRST_VFP_REGNUM; \ 693 for (regno = FIRST_VFP_REGNUM; \
689 regno <= LAST_VFP_REGNUM; ++ regno) \ 694 regno <= LAST_VFP_REGNUM; ++ regno) \
690 { \ 695 { \
691 fixed_regs[regno] = 0; \ 696 fixed_regs[regno] = 0; \
692 call_used_regs[regno] = regno < FIRST_VFP_REGNUM + 16; \ 697 call_used_regs[regno] = regno < FIRST_VFP_REGNUM + 16; \
693 } \ 698 } \
694 } \ 699 } \
695 } \ 700 } \
696 \ 701 \
697 if (TARGET_REALLY_IWMMXT) \ 702 if (TARGET_REALLY_IWMMXT) \
698 { \ 703 { \
699 regno = FIRST_IWMMXT_GR_REGNUM; \ 704 regno = FIRST_IWMMXT_GR_REGNUM; \
700 /* The 2002/10/09 revision of the XScale ABI has wCG0 \ 705 /* The 2002/10/09 revision of the XScale ABI has wCG0 \
701 and wCG1 as call-preserved registers. The 2002/11/21 \ 706 and wCG1 as call-preserved registers. The 2002/11/21 \
702 revision changed this so that all wCG registers are \ 707 revision changed this so that all wCG registers are \
703 scratch registers. */ \ 708 scratch registers. */ \
704 for (regno = FIRST_IWMMXT_GR_REGNUM; \ 709 for (regno = FIRST_IWMMXT_GR_REGNUM; \
705 regno <= LAST_IWMMXT_GR_REGNUM; ++ regno) \ 710 regno <= LAST_IWMMXT_GR_REGNUM; ++ regno) \
706 fixed_regs[regno] = 0; \ 711 fixed_regs[regno] = 0; \
707 /* The XScale ABI has wR0 - wR9 as scratch registers, \ 712 /* The XScale ABI has wR0 - wR9 as scratch registers, \
708 the rest as call-preserved registers. */ \ 713 the rest as call-preserved registers. */ \
709 for (regno = FIRST_IWMMXT_REGNUM; \ 714 for (regno = FIRST_IWMMXT_REGNUM; \
710 regno <= LAST_IWMMXT_REGNUM; ++ regno) \ 715 regno <= LAST_IWMMXT_REGNUM; ++ regno) \
711 { \ 716 { \
712 fixed_regs[regno] = 0; \ 717 fixed_regs[regno] = 0; \
713 call_used_regs[regno] = regno < FIRST_IWMMXT_REGNUM + 10; \ 718 call_used_regs[regno] = regno < FIRST_IWMMXT_REGNUM + 10; \
714 } \ 719 } \
715 } \ 720 } \
716 \ 721 \
717 if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) \ 722 if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) \
718 { \ 723 { \
719 fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ 724 fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
720 call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ 725 call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
721 } \ 726 } \
722 else if (TARGET_APCS_STACK) \ 727 else if (TARGET_APCS_STACK) \
723 { \ 728 { \
724 fixed_regs[10] = 1; \ 729 fixed_regs[10] = 1; \
725 call_used_regs[10] = 1; \ 730 call_used_regs[10] = 1; \
726 } \ 731 } \
727 /* -mcaller-super-interworking reserves r11 for calls to \ 732 /* -mcaller-super-interworking reserves r11 for calls to \
728 _interwork_r11_call_via_rN(). Making the register global \ 733 _interwork_r11_call_via_rN(). Making the register global \
729 is an easy way of ensuring that it remains valid for all \ 734 is an easy way of ensuring that it remains valid for all \
730 calls. */ \ 735 calls. */ \
731 if (TARGET_APCS_FRAME || TARGET_CALLER_INTERWORKING \ 736 if (TARGET_APCS_FRAME || TARGET_CALLER_INTERWORKING \
732 || TARGET_TPCS_FRAME || TARGET_TPCS_LEAF_FRAME) \ 737 || TARGET_TPCS_FRAME || TARGET_TPCS_LEAF_FRAME) \
733 { \ 738 { \
734 fixed_regs[ARM_HARD_FRAME_POINTER_REGNUM] = 1; \ 739 fixed_regs[ARM_HARD_FRAME_POINTER_REGNUM] = 1; \
735 call_used_regs[ARM_HARD_FRAME_POINTER_REGNUM] = 1; \ 740 call_used_regs[ARM_HARD_FRAME_POINTER_REGNUM] = 1; \
736 if (TARGET_CALLER_INTERWORKING) \ 741 if (TARGET_CALLER_INTERWORKING) \
737 global_regs[ARM_HARD_FRAME_POINTER_REGNUM] = 1; \ 742 global_regs[ARM_HARD_FRAME_POINTER_REGNUM] = 1; \
738 } \ 743 } \
739 SUBTARGET_CONDITIONAL_REGISTER_USAGE \ 744 SUBTARGET_CONDITIONAL_REGISTER_USAGE \
740} 745}
741 746
742/* These are a couple of extensions to the formats accepted 747/* These are a couple of extensions to the formats accepted
743 by asm_fprintf: 748 by asm_fprintf:
744 %@ prints out ASM_COMMENT_START 749 %@ prints out ASM_COMMENT_START
745 %r prints out REGISTER_PREFIX reg_names[arg] */ 750 %r prints out REGISTER_PREFIX reg_names[arg] */
746#define ASM_FPRINTF_EXTENSIONS(FILE, ARGS, P) \ 751#define ASM_FPRINTF_EXTENSIONS(FILE, ARGS, P) \
747 case '@': \ 752 case '@': \
748 fputs (ASM_COMMENT_START, FILE); \ 753 fputs (ASM_COMMENT_START, FILE); \
749 break; \ 754 break; \
750 \ 755 \
751 case 'r': \ 756 case 'r': \
752 fputs (REGISTER_PREFIX, FILE); \ 757 fputs (REGISTER_PREFIX, FILE); \
753 fputs (reg_names [va_arg (ARGS, int)], FILE); \ 758 fputs (reg_names [va_arg (ARGS, int)], FILE); \
754 break; 759 break;
755 760
756/* Round X up to the nearest word. */ 761/* Round X up to the nearest word. */
757#define ROUND_UP_WORD(X) (((X) + 3) & ~3) 762#define ROUND_UP_WORD(X) (((X) + 3) & ~3)
758 763
759/* Convert fron bytes to ints. */ 764/* Convert fron bytes to ints. */
760#define ARM_NUM_INTS(X) (((X) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) 765#define ARM_NUM_INTS(X) (((X) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
761 766
762/* The number of (integer) registers required to hold a quantity of type MODE. 767/* The number of (integer) registers required to hold a quantity of type MODE.
763 Also used for VFP registers. */ 768 Also used for VFP registers. */
764#define ARM_NUM_REGS(MODE) \ 769#define ARM_NUM_REGS(MODE) \
765 ARM_NUM_INTS (GET_MODE_SIZE (MODE)) 770 ARM_NUM_INTS (GET_MODE_SIZE (MODE))
766 771
767/* The number of (integer) registers required to hold a quantity of TYPE MODE. */ 772/* The number of (integer) registers required to hold a quantity of TYPE MODE. */
768#define ARM_NUM_REGS2(MODE, TYPE) \ 773#define ARM_NUM_REGS2(MODE, TYPE) \
769 ARM_NUM_INTS ((MODE) == BLKmode ? \ 774 ARM_NUM_INTS ((MODE) == BLKmode ? \
770 int_size_in_bytes (TYPE) : GET_MODE_SIZE (MODE)) 775 int_size_in_bytes (TYPE) : GET_MODE_SIZE (MODE))
771 776
772/* The number of (integer) argument register available. */ 777/* The number of (integer) argument register available. */
773#define NUM_ARG_REGS 4 778#define NUM_ARG_REGS 4
774 779
775/* Return the register number of the N'th (integer) argument. */ 780/* Return the register number of the N'th (integer) argument. */
776#define ARG_REGISTER(N) (N - 1) 781#define ARG_REGISTER(N) (N - 1)
777 782
778/* Specify the registers used for certain standard purposes. 783/* Specify the registers used for certain standard purposes.
779 The values of these macros are register numbers. */ 784 The values of these macros are register numbers. */
780 785
781/* The number of the last argument register. */ 786/* The number of the last argument register. */
782#define LAST_ARG_REGNUM ARG_REGISTER (NUM_ARG_REGS) 787#define LAST_ARG_REGNUM ARG_REGISTER (NUM_ARG_REGS)
783 788
784/* The numbers of the Thumb register ranges. */ 789/* The numbers of the Thumb register ranges. */
785#define FIRST_LO_REGNUM 0 790#define FIRST_LO_REGNUM 0
786#define LAST_LO_REGNUM 7 791#define LAST_LO_REGNUM 7
787#define FIRST_HI_REGNUM 8 792#define FIRST_HI_REGNUM 8
788#define LAST_HI_REGNUM 11 793#define LAST_HI_REGNUM 11
789 794
790#ifndef TARGET_UNWIND_INFO 795#ifndef TARGET_UNWIND_INFO
791/* We use sjlj exceptions for backwards compatibility. */ 796/* We use sjlj exceptions for backwards compatibility. */
792#define MUST_USE_SJLJ_EXCEPTIONS 1 797#define MUST_USE_SJLJ_EXCEPTIONS 1
793#endif 798#endif
794 799
795/* We can generate DWARF2 Unwind info, even though we don't use it. */ 800/* We can generate DWARF2 Unwind info, even though we don't use it. */
796#define DWARF2_UNWIND_INFO 1 801#define DWARF2_UNWIND_INFO 1
797 802
798/* Use r0 and r1 to pass exception handling information. */ 803/* Use r0 and r1 to pass exception handling information. */
799#define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? N : INVALID_REGNUM) 804#define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? N : INVALID_REGNUM)
800 805
801/* The register that holds the return address in exception handlers. */ 806/* The register that holds the return address in exception handlers. */
802#define ARM_EH_STACKADJ_REGNUM 2 807#define ARM_EH_STACKADJ_REGNUM 2
803#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, ARM_EH_STACKADJ_REGNUM) 808#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, ARM_EH_STACKADJ_REGNUM)
804 809
805/* The native (Norcroft) Pascal compiler for the ARM passes the static chain 810/* The native (Norcroft) Pascal compiler for the ARM passes the static chain
806 as an invisible last argument (possible since varargs don't exist in 811 as an invisible last argument (possible since varargs don't exist in
807 Pascal), so the following is not true. */ 812 Pascal), so the following is not true. */
808#define STATIC_CHAIN_REGNUM (TARGET_ARM ? 12 : 9) 813#define STATIC_CHAIN_REGNUM (TARGET_ARM ? 12 : 9)
809 814
810/* Define this to be where the real frame pointer is if it is not possible to 815/* Define this to be where the real frame pointer is if it is not possible to
811 work out the offset between the frame pointer and the automatic variables 816 work out the offset between the frame pointer and the automatic variables
812 until after register allocation has taken place. FRAME_POINTER_REGNUM 817 until after register allocation has taken place. FRAME_POINTER_REGNUM
813 should point to a special register that we will make sure is eliminated. 818 should point to a special register that we will make sure is eliminated.
814 819
815 For the Thumb we have another problem. The TPCS defines the frame pointer 820 For the Thumb we have another problem. The TPCS defines the frame pointer
816 as r11, and GCC believes that it is always possible to use the frame pointer 821 as r11, and GCC believes that it is always possible to use the frame pointer
817 as base register for addressing purposes. (See comments in 822 as base register for addressing purposes. (See comments in
818 find_reloads_address()). But - the Thumb does not allow high registers, 823 find_reloads_address()). But - the Thumb does not allow high registers,
819 including r11, to be used as base address registers. Hence our problem. 824 including r11, to be used as base address registers. Hence our problem.
820 825
821 The solution used here, and in the old thumb port is to use r7 instead of 826 The solution used here, and in the old thumb port is to use r7 instead of
822 r11 as the hard frame pointer and to have special code to generate 827 r11 as the hard frame pointer and to have special code to generate
823 backtrace structures on the stack (if required to do so via a command line 828 backtrace structures on the stack (if required to do so via a command line
824 option) using r11. This is the only 'user visible' use of r11 as a frame 829 option) using r11. This is the only 'user visible' use of r11 as a frame
825 pointer. */ 830 pointer. */
826#define ARM_HARD_FRAME_POINTER_REGNUM 11 831#define ARM_HARD_FRAME_POINTER_REGNUM 11
827#define THUMB_HARD_FRAME_POINTER_REGNUM 7 832#define THUMB_HARD_FRAME_POINTER_REGNUM 7
828 833
829#define HARD_FRAME_POINTER_REGNUM \ 834#define HARD_FRAME_POINTER_REGNUM \
830 (TARGET_ARM \ 835 (TARGET_ARM \
831 ? ARM_HARD_FRAME_POINTER_REGNUM \ 836 ? ARM_HARD_FRAME_POINTER_REGNUM \
832 : THUMB_HARD_FRAME_POINTER_REGNUM) 837 : THUMB_HARD_FRAME_POINTER_REGNUM)
833 838
834#define FP_REGNUM HARD_FRAME_POINTER_REGNUM 839#define FP_REGNUM HARD_FRAME_POINTER_REGNUM
835 840
836/* Register to use for pushing function arguments. */ 841/* Register to use for pushing function arguments. */
837#define STACK_POINTER_REGNUM SP_REGNUM 842#define STACK_POINTER_REGNUM SP_REGNUM
838 843
839/* ARM floating pointer registers. */ 844/* ARM floating pointer registers. */
840#define FIRST_FPA_REGNUM 16 845#define FIRST_FPA_REGNUM 16
841#define LAST_FPA_REGNUM 23 846#define LAST_FPA_REGNUM 23
842#define IS_FPA_REGNUM(REGNUM) \ 847#define IS_FPA_REGNUM(REGNUM) \
843 (((REGNUM) >= FIRST_FPA_REGNUM) && ((REGNUM) <= LAST_FPA_REGNUM)) 848 (((REGNUM) >= FIRST_FPA_REGNUM) && ((REGNUM) <= LAST_FPA_REGNUM))
844 849
845#define FIRST_IWMMXT_GR_REGNUM 43 850#define FIRST_IWMMXT_GR_REGNUM 43
846#define LAST_IWMMXT_GR_REGNUM 46 851#define LAST_IWMMXT_GR_REGNUM 46
847#define FIRST_IWMMXT_REGNUM 47 852#define FIRST_IWMMXT_REGNUM 47
848#define LAST_IWMMXT_REGNUM 62 853#define LAST_IWMMXT_REGNUM 62
849#define IS_IWMMXT_REGNUM(REGNUM) \ 854#define IS_IWMMXT_REGNUM(REGNUM) \
850 (((REGNUM) >= FIRST_IWMMXT_REGNUM) && ((REGNUM) <= LAST_IWMMXT_REGNUM)) 855 (((REGNUM) >= FIRST_IWMMXT_REGNUM) && ((REGNUM) <= LAST_IWMMXT_REGNUM))
851#define IS_IWMMXT_GR_REGNUM(REGNUM) \ 856#define IS_IWMMXT_GR_REGNUM(REGNUM) \
852 (((REGNUM) >= FIRST_IWMMXT_GR_REGNUM) && ((REGNUM) <= LAST_IWMMXT_GR_REGNUM)) 857 (((REGNUM) >= FIRST_IWMMXT_GR_REGNUM) && ((REGNUM) <= LAST_IWMMXT_GR_REGNUM))
853 858
854/* Base register for access to local variables of the function. */ 859/* Base register for access to local variables of the function. */
855#define FRAME_POINTER_REGNUM 25 860#define FRAME_POINTER_REGNUM 25
856 861
857/* Base register for access to arguments of the function. */ 862/* Base register for access to arguments of the function. */
858#define ARG_POINTER_REGNUM 26 863#define ARG_POINTER_REGNUM 26
859 864
860#define FIRST_CIRRUS_FP_REGNUM 27 865#define FIRST_CIRRUS_FP_REGNUM 27
861#define LAST_CIRRUS_FP_REGNUM 42 866#define LAST_CIRRUS_FP_REGNUM 42
862#define IS_CIRRUS_REGNUM(REGNUM) \ 867#define IS_CIRRUS_REGNUM(REGNUM) \
863 (((REGNUM) >= FIRST_CIRRUS_FP_REGNUM) && ((REGNUM) <= LAST_CIRRUS_FP_REGNUM)) 868 (((REGNUM) >= FIRST_CIRRUS_FP_REGNUM) && ((REGNUM) <= LAST_CIRRUS_FP_REGNUM))
864 869
865#define FIRST_VFP_REGNUM 63 870#define FIRST_VFP_REGNUM 63
866#define LAST_VFP_REGNUM 94 871#define LAST_VFP_REGNUM 94
867#define IS_VFP_REGNUM(REGNUM) \ 872#define IS_VFP_REGNUM(REGNUM) \
868 (((REGNUM) >= FIRST_VFP_REGNUM) && ((REGNUM) <= LAST_VFP_REGNUM)) 873 (((REGNUM) >= FIRST_VFP_REGNUM) && ((REGNUM) <= LAST_VFP_REGNUM))
869 874
870/* The number of hard registers is 16 ARM + 8 FPA + 1 CC + 1 SFP + 1 AFP. */ 875/* The number of hard registers is 16 ARM + 8 FPA + 1 CC + 1 SFP + 1 AFP. */
871/* + 16 Cirrus registers take us up to 43. */ 876/* + 16 Cirrus registers take us up to 43. */
872/* Intel Wireless MMX Technology registers add 16 + 4 more. */ 877/* Intel Wireless MMX Technology registers add 16 + 4 more. */
873/* VFP adds 32 + 1 more. */ 878/* VFP adds 32 + 1 more. */
874#define FIRST_PSEUDO_REGISTER 96 879#define FIRST_PSEUDO_REGISTER 96
875 880
876#define DBX_REGISTER_NUMBER(REGNO) arm_dbx_register_number (REGNO) 881#define DBX_REGISTER_NUMBER(REGNO) arm_dbx_register_number (REGNO)
877 882
878/* Value should be nonzero if functions must have frame pointers. 883/* Value should be nonzero if functions must have frame pointers.
879 Zero means the frame pointer need not be set up (and parms may be accessed 884 Zero means the frame pointer need not be set up (and parms may be accessed
880 via the stack pointer) in functions that seem suitable. 885 via the stack pointer) in functions that seem suitable.
881 If we have to have a frame pointer we might as well make use of it. 886 If we have to have a frame pointer we might as well make use of it.
882 APCS says that the frame pointer does not need to be pushed in leaf 887 APCS says that the frame pointer does not need to be pushed in leaf
883 functions, or simple tail call functions. */ 888 functions, or simple tail call functions. */
884 889
885#ifndef SUBTARGET_FRAME_POINTER_REQUIRED 890#ifndef SUBTARGET_FRAME_POINTER_REQUIRED
886#define SUBTARGET_FRAME_POINTER_REQUIRED 0 891#define SUBTARGET_FRAME_POINTER_REQUIRED 0
887#endif 892#endif
888 893
889#define FRAME_POINTER_REQUIRED \ 894#define FRAME_POINTER_REQUIRED \
890 (current_function_has_nonlocal_label \ 895 (current_function_has_nonlocal_label \
891 || SUBTARGET_FRAME_POINTER_REQUIRED \ 896 || SUBTARGET_FRAME_POINTER_REQUIRED \
892 || (TARGET_ARM && TARGET_APCS_FRAME && ! leaf_function_p ())) 897 || (TARGET_ARM && TARGET_APCS_FRAME && ! leaf_function_p ()))
893 898
894/* Return number of consecutive hard regs needed starting at reg REGNO 899/* Return number of consecutive hard regs needed starting at reg REGNO
895 to hold something of mode MODE. 900 to hold something of mode MODE.
896 This is ordinarily the length in words of a value of mode MODE 901 This is ordinarily the length in words of a value of mode MODE
897 but can be less for certain modes in special long registers. 902 but can be less for certain modes in special long registers.
898 903
899 On the ARM regs are UNITS_PER_WORD bits wide; FPA regs can hold any FP 904 On the ARM regs are UNITS_PER_WORD bits wide; FPA regs can hold any FP
900 mode. */ 905 mode. */
901#define HARD_REGNO_NREGS(REGNO, MODE) \ 906#define HARD_REGNO_NREGS(REGNO, MODE) \
902 ((TARGET_ARM \ 907 ((TARGET_ARM \
903 && REGNO >= FIRST_FPA_REGNUM \ 908 && REGNO >= FIRST_FPA_REGNUM \
904 && REGNO != FRAME_POINTER_REGNUM \ 909 && REGNO != FRAME_POINTER_REGNUM \
905 && REGNO != ARG_POINTER_REGNUM) \ 910 && REGNO != ARG_POINTER_REGNUM) \
906 && !IS_VFP_REGNUM (REGNO) \ 911 && !IS_VFP_REGNUM (REGNO) \
907 ? 1 : ARM_NUM_REGS (MODE)) 912 ? 1 : ARM_NUM_REGS (MODE))
908 913
909/* Return true if REGNO is suitable for holding a quantity of type MODE. */ 914/* Return true if REGNO is suitable for holding a quantity of type MODE. */
910#define HARD_REGNO_MODE_OK(REGNO, MODE) \ 915#define HARD_REGNO_MODE_OK(REGNO, MODE) \
911 arm_hard_regno_mode_ok ((REGNO), (MODE)) 916 arm_hard_regno_mode_ok ((REGNO), (MODE))
912 917
913/* Value is 1 if it is a good idea to tie two pseudo registers 918/* Value is 1 if it is a good idea to tie two pseudo registers
914 when one has mode MODE1 and one has mode MODE2. 919 when one has mode MODE1 and one has mode MODE2.
915 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, 920 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
916 for any hard reg, then this must be 0 for correct output. */ 921 for any hard reg, then this must be 0 for correct output. */
917#define MODES_TIEABLE_P(MODE1, MODE2) \ 922#define MODES_TIEABLE_P(MODE1, MODE2) \
918 (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2)) 923 (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
919 924
920#define VALID_IWMMXT_REG_MODE(MODE) \ 925#define VALID_IWMMXT_REG_MODE(MODE) \
921 (arm_vector_mode_supported_p (MODE) || (MODE) == DImode) 926 (arm_vector_mode_supported_p (MODE) || (MODE) == DImode)
922 927
923/* The order in which register should be allocated. It is good to use ip 928/* The order in which register should be allocated. It is good to use ip
924 since no saving is required (though calls clobber it) and it never contains 929 since no saving is required (though calls clobber it) and it never contains
925 function parameters. It is quite good to use lr since other calls may 930 function parameters. It is quite good to use lr since other calls may
926 clobber it anyway. Allocate r0 through r3 in reverse order since r3 is 931 clobber it anyway. Allocate r0 through r3 in reverse order since r3 is
927 least likely to contain a function parameter; in addition results are 932 least likely to contain a function parameter; in addition results are
928 returned in r0. */ 933 returned in r0. */
929 934
930#define REG_ALLOC_ORDER \ 935#define REG_ALLOC_ORDER \
931{ \ 936{ \
932 3, 2, 1, 0, 12, 14, 4, 5, \ 937 3, 2, 1, 0, 12, 14, 4, 5, \
933 6, 7, 8, 10, 9, 11, 13, 15, \ 938 6, 7, 8, 10, 9, 11, 13, 15, \
934 16, 17, 18, 19, 20, 21, 22, 23, \ 939 16, 17, 18, 19, 20, 21, 22, 23, \
935 27, 28, 29, 30, 31, 32, 33, 34, \ 940 27, 28, 29, 30, 31, 32, 33, 34, \
936 35, 36, 37, 38, 39, 40, 41, 42, \ 941 35, 36, 37, 38, 39, 40, 41, 42, \
937 43, 44, 45, 46, 47, 48, 49, 50, \ 942 43, 44, 45, 46, 47, 48, 49, 50, \
938 51, 52, 53, 54, 55, 56, 57, 58, \ 943 51, 52, 53, 54, 55, 56, 57, 58, \
939 59, 60, 61, 62, \ 944 59, 60, 61, 62, \
940 24, 25, 26, \ 945 24, 25, 26, \
941 78, 77, 76, 75, 74, 73, 72, 71, \ 946 78, 77, 76, 75, 74, 73, 72, 71, \
942 70, 69, 68, 67, 66, 65, 64, 63, \ 947 70, 69, 68, 67, 66, 65, 64, 63, \
943 79, 80, 81, 82, 83, 84, 85, 86, \ 948 79, 80, 81, 82, 83, 84, 85, 86, \
944 87, 88, 89, 90, 91, 92, 93, 94, \ 949 87, 88, 89, 90, 91, 92, 93, 94, \
945 95 \ 950 95 \
946} 951}
947 952
948/* Interrupt functions can only use registers that have already been 953/* Interrupt functions can only use registers that have already been
949 saved by the prologue, even if they would normally be 954 saved by the prologue, even if they would normally be
950 call-clobbered. */ 955 call-clobbered. */
951#define HARD_REGNO_RENAME_OK(SRC, DST) \ 956#define HARD_REGNO_RENAME_OK(SRC, DST) \
952 (! IS_INTERRUPT (cfun->machine->func_type) || \ 957 (! IS_INTERRUPT (cfun->machine->func_type) || \
953 regs_ever_live[DST]) 958 regs_ever_live[DST])
954  959
955/* Register and constant classes. */ 960/* Register and constant classes. */
956 961
957/* Register classes: used to be simple, just all ARM regs or all FPA regs 962/* Register classes: used to be simple, just all ARM regs or all FPA regs
958 Now that the Thumb is involved it has become more complicated. */ 963 Now that the Thumb is involved it has become more complicated. */
959enum reg_class 964enum reg_class
960{ 965{
961 NO_REGS, 966 NO_REGS,
962 FPA_REGS, 967 FPA_REGS,
963 CIRRUS_REGS, 968 CIRRUS_REGS,
964 VFP_REGS, 969 VFP_REGS,
965 IWMMXT_GR_REGS, 970 IWMMXT_GR_REGS,
966 IWMMXT_REGS, 971 IWMMXT_REGS,
967 LO_REGS, 972 LO_REGS,
968 STACK_REG, 973 STACK_REG,
969 BASE_REGS, 974 BASE_REGS,
970 HI_REGS, 975 HI_REGS,
971 CC_REG, 976 CC_REG,
972 VFPCC_REG, 977 VFPCC_REG,
973 GENERAL_REGS, 978 GENERAL_REGS,
974 ALL_REGS, 979 ALL_REGS,
975 LIM_REG_CLASSES 980 LIM_REG_CLASSES
976}; 981};
977 982
978#define N_REG_CLASSES (int) LIM_REG_CLASSES 983#define N_REG_CLASSES (int) LIM_REG_CLASSES
979 984
980/* Give names of register classes as strings for dump file. */ 985/* Give names of register classes as strings for dump file. */
981#define REG_CLASS_NAMES \ 986#define REG_CLASS_NAMES \
982{ \ 987{ \
983 "NO_REGS", \ 988 "NO_REGS", \
984 "FPA_REGS", \ 989 "FPA_REGS", \
985 "CIRRUS_REGS", \ 990 "CIRRUS_REGS", \
986 "VFP_REGS", \ 991 "VFP_REGS", \
987 "IWMMXT_GR_REGS", \ 992 "IWMMXT_GR_REGS", \
988 "IWMMXT_REGS", \ 993 "IWMMXT_REGS", \
989 "LO_REGS", \ 994 "LO_REGS", \
990 "STACK_REG", \ 995 "STACK_REG", \
991 "BASE_REGS", \ 996 "BASE_REGS", \
992 "HI_REGS", \ 997 "HI_REGS", \
993 "CC_REG", \ 998 "CC_REG", \
994 "VFPCC_REG", \ 999 "VFPCC_REG", \
995 "GENERAL_REGS", \ 1000 "GENERAL_REGS", \
996 "ALL_REGS", \ 1001 "ALL_REGS", \
997} 1002}
998 1003
999/* Define which registers fit in which classes. 1004/* Define which registers fit in which classes.
1000 This is an initializer for a vector of HARD_REG_SET 1005 This is an initializer for a vector of HARD_REG_SET
1001 of length N_REG_CLASSES. */ 1006 of length N_REG_CLASSES. */
1002#define REG_CLASS_CONTENTS \ 1007#define REG_CLASS_CONTENTS \
1003{ \ 1008{ \
1004 { 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \ 1009 { 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \
1005 { 0x00FF0000, 0x00000000, 0x00000000 }, /* FPA_REGS */ \ 1010 { 0x00FF0000, 0x00000000, 0x00000000 }, /* FPA_REGS */ \
1006 { 0xF8000000, 0x000007FF, 0x00000000 }, /* CIRRUS_REGS */ \ 1011 { 0xF8000000, 0x000007FF, 0x00000000 }, /* CIRRUS_REGS */ \
1007 { 0x00000000, 0x80000000, 0x7FFFFFFF }, /* VFP_REGS */ \ 1012 { 0x00000000, 0x80000000, 0x7FFFFFFF }, /* VFP_REGS */ \
1008 { 0x00000000, 0x00007800, 0x00000000 }, /* IWMMXT_GR_REGS */ \ 1013 { 0x00000000, 0x00007800, 0x00000000 }, /* IWMMXT_GR_REGS */ \
1009 { 0x00000000, 0x7FFF8000, 0x00000000 }, /* IWMMXT_REGS */ \ 1014 { 0x00000000, 0x7FFF8000, 0x00000000 }, /* IWMMXT_REGS */ \
1010 { 0x000000FF, 0x00000000, 0x00000000 }, /* LO_REGS */ \ 1015 { 0x000000FF, 0x00000000, 0x00000000 }, /* LO_REGS */ \
1011 { 0x00002000, 0x00000000, 0x00000000 }, /* STACK_REG */ \ 1016 { 0x00002000, 0x00000000, 0x00000000 }, /* STACK_REG */ \
1012 { 0x000020FF, 0x00000000, 0x00000000 }, /* BASE_REGS */ \ 1017 { 0x000020FF, 0x00000000, 0x00000000 }, /* BASE_REGS */ \
1013 { 0x0000FF00, 0x00000000, 0x00000000 }, /* HI_REGS */ \ 1018 { 0x0000FF00, 0x00000000, 0x00000000 }, /* HI_REGS */ \
1014 { 0x01000000, 0x00000000, 0x00000000 }, /* CC_REG */ \ 1019 { 0x01000000, 0x00000000, 0x00000000 }, /* CC_REG */ \
1015 { 0x00000000, 0x00000000, 0x80000000 }, /* VFPCC_REG */ \ 1020 { 0x00000000, 0x00000000, 0x80000000 }, /* VFPCC_REG */ \
1016 { 0x0200FFFF, 0x00000000, 0x00000000 }, /* GENERAL_REGS */ \ 1021 { 0x0200FFFF, 0x00000000, 0x00000000 }, /* GENERAL_REGS */ \
1017 { 0xFAFFFFFF, 0xFFFFFFFF, 0x7FFFFFFF } /* ALL_REGS */ \ 1022 { 0xFAFFFFFF, 0xFFFFFFFF, 0x7FFFFFFF } /* ALL_REGS */ \
1018} 1023}
1019 1024
1020/* The same information, inverted: 1025/* The same information, inverted:
1021 Return the class number of the smallest class containing 1026 Return the class number of the smallest class containing
1022 reg number REGNO. This could be a conditional expression 1027 reg number REGNO. This could be a conditional expression
1023 or could index an array. */ 1028 or could index an array. */
1024#define REGNO_REG_CLASS(REGNO) arm_regno_class (REGNO) 1029#define REGNO_REG_CLASS(REGNO) arm_regno_class (REGNO)
1025 1030
1026/* FPA registers can't do subreg as all values are reformatted to internal 1031/* FPA registers can't do subreg as all values are reformatted to internal
1027 precision. VFP registers may only be accessed in the mode they 1032 precision. VFP registers may only be accessed in the mode they
1028 were set. */ 1033 were set. */
1029#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \ 1034#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
1030 (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \ 1035 (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \
1031 ? reg_classes_intersect_p (FPA_REGS, (CLASS)) \ 1036 ? reg_classes_intersect_p (FPA_REGS, (CLASS)) \
1032 || reg_classes_intersect_p (VFP_REGS, (CLASS)) \ 1037 || reg_classes_intersect_p (VFP_REGS, (CLASS)) \
1033 : 0) 1038 : 0)
1034 1039
1035/* We need to define this for LO_REGS on thumb. Otherwise we can end up 1040/* We need to define this for LO_REGS on thumb. Otherwise we can end up
1036 using r0-r4 for function arguments, r7 for the stack frame and don't 1041 using r0-r4 for function arguments, r7 for the stack frame and don't
1037 have enough left over to do doubleword arithmetic. */ 1042 have enough left over to do doubleword arithmetic. */
1038#define CLASS_LIKELY_SPILLED_P(CLASS) \ 1043#define CLASS_LIKELY_SPILLED_P(CLASS) \
1039 ((TARGET_THUMB && (CLASS) == LO_REGS) \ 1044 ((TARGET_THUMB && (CLASS) == LO_REGS) \
1040 || (CLASS) == CC_REG) 1045 || (CLASS) == CC_REG)
1041 1046
1042/* The class value for index registers, and the one for base regs. */ 1047/* The class value for index registers, and the one for base regs. */
1043#define INDEX_REG_CLASS (TARGET_THUMB ? LO_REGS : GENERAL_REGS) 1048#define INDEX_REG_CLASS (TARGET_THUMB ? LO_REGS : GENERAL_REGS)
1044#define BASE_REG_CLASS (TARGET_THUMB ? LO_REGS : GENERAL_REGS) 1049#define BASE_REG_CLASS (TARGET_THUMB ? LO_REGS : GENERAL_REGS)
1045 1050
1046/* For the Thumb the high registers cannot be used as base registers 1051/* For the Thumb the high registers cannot be used as base registers
1047 when addressing quantities in QI or HI mode; if we don't know the 1052 when addressing quantities in QI or HI mode; if we don't know the
1048 mode, then we must be conservative. */ 1053 mode, then we must be conservative. */
1049#define MODE_BASE_REG_CLASS(MODE) \ 1054#define MODE_BASE_REG_CLASS(MODE) \
1050 (TARGET_ARM ? GENERAL_REGS : \ 1055 (TARGET_ARM ? GENERAL_REGS : \
1051 (((MODE) == SImode) ? BASE_REGS : LO_REGS)) 1056 (((MODE) == SImode) ? BASE_REGS : LO_REGS))
1052 1057
1053/* For Thumb we can not support SP+reg addressing, so we return LO_REGS 1058/* For Thumb we can not support SP+reg addressing, so we return LO_REGS
1054 instead of BASE_REGS. */ 1059 instead of BASE_REGS. */
1055#define MODE_BASE_REG_REG_CLASS(MODE) BASE_REG_CLASS 1060#define MODE_BASE_REG_REG_CLASS(MODE) BASE_REG_CLASS
1056 1061
1057/* When SMALL_REGISTER_CLASSES is nonzero, the compiler allows 1062/* When SMALL_REGISTER_CLASSES is nonzero, the compiler allows
1058 registers explicitly used in the rtl to be used as spill registers 1063 registers explicitly used in the rtl to be used as spill registers
1059 but prevents the compiler from extending the lifetime of these 1064 but prevents the compiler from extending the lifetime of these
1060 registers. */ 1065 registers. */
1061#define SMALL_REGISTER_CLASSES TARGET_THUMB 1066#define SMALL_REGISTER_CLASSES TARGET_THUMB
1062 1067
1063/* Get reg_class from a letter such as appears in the machine description. 1068/* Get reg_class from a letter such as appears in the machine description.
1064 We only need constraint `f' for FPA_REGS (`r' == GENERAL_REGS) for the 1069 We only need constraint `f' for FPA_REGS (`r' == GENERAL_REGS) for the
1065 ARM, but several more letters for the Thumb. */ 1070 ARM, but several more letters for the Thumb. */
1066#define REG_CLASS_FROM_LETTER(C) \ 1071#define REG_CLASS_FROM_LETTER(C) \
1067 ( (C) == 'f' ? FPA_REGS \ 1072 ( (C) == 'f' ? FPA_REGS \
1068 : (C) == 'v' ? CIRRUS_REGS \ 1073 : (C) == 'v' ? CIRRUS_REGS \
1069 : (C) == 'w' ? VFP_REGS \ 1074 : (C) == 'w' ? VFP_REGS \
1070 : (C) == 'y' ? IWMMXT_REGS \ 1075 : (C) == 'y' ? IWMMXT_REGS \
1071 : (C) == 'z' ? IWMMXT_GR_REGS \ 1076 : (C) == 'z' ? IWMMXT_GR_REGS \
1072 : (C) == 'l' ? (TARGET_ARM ? GENERAL_REGS : LO_REGS) \ 1077 : (C) == 'l' ? (TARGET_ARM ? GENERAL_REGS : LO_REGS) \
1073 : TARGET_ARM ? NO_REGS \ 1078 : TARGET_ARM ? NO_REGS \
1074 : (C) == 'h' ? HI_REGS \ 1079 : (C) == 'h' ? HI_REGS \
1075 : (C) == 'b' ? BASE_REGS \ 1080 : (C) == 'b' ? BASE_REGS \
1076 : (C) == 'k' ? STACK_REG \ 1081 : (C) == 'k' ? STACK_REG \
1077 : (C) == 'c' ? CC_REG \ 1082 : (C) == 'c' ? CC_REG \
1078 : NO_REGS) 1083 : NO_REGS)
1079 1084