]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/arm/arm.h
Implement new macro: ASM_FPRINTF_EXTENSIONS
[thirdparty/gcc.git] / gcc / config / arm / arm.h
CommitLineData
f5a1b0d2 1/* Definitions of target machine for GNU compiler, for ARM.
63114329 2 Copyright (C) 1991, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
35d965d5 3 Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
8b109b37 4 and Martin Simmons (@harleqn.co.uk).
ff9940b0 5 More major hacks by Richard Earnshaw (rwe11@cl.cam.ac.uk)
6cfc7210
NC
6 Minor hacks by Nick Clifton (nickc@cygnus.com)
7
35d965d5
RS
8This file is part of GNU CC.
9
10GNU CC is free software; you can redistribute it and/or modify
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation; either version 2, or (at your option)
13any later version.
14
15GNU CC is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with GNU CC; see the file COPYING. If not, write to
8fb289e7
RK
22the Free Software Foundation, 59 Temple Place - Suite 330,
23Boston, MA 02111-1307, USA. */
35d965d5 24
52a02435 25/* Configuration triples for ARM ports work as follows:
9e7d0bcc 26 (This is a bit of a mess and needs some thought)
52a02435
DE
27 arm-*-*: little endian
28 armel-*-*: little endian
29 armeb-*-*: big endian
5da4dc2c
DE
30 If a non-embedded environment (ie: "real" OS) is specified, `arm'
31 should default to that used by the OS.
52a02435
DE
32*/
33
b355a481
NC
34#ifndef __ARM_H__
35#define __ARM_H__
36
7a801826
RE
37#define TARGET_CPU_arm2 0x0000
38#define TARGET_CPU_arm250 0x0000
39#define TARGET_CPU_arm3 0x0000
40#define TARGET_CPU_arm6 0x0001
41#define TARGET_CPU_arm600 0x0001
42#define TARGET_CPU_arm610 0x0002
43#define TARGET_CPU_arm7 0x0001
44#define TARGET_CPU_arm7m 0x0004
45#define TARGET_CPU_arm7dm 0x0004
46#define TARGET_CPU_arm7dmi 0x0004
47#define TARGET_CPU_arm700 0x0001
48#define TARGET_CPU_arm710 0x0002
49#define TARGET_CPU_arm7100 0x0002
50#define TARGET_CPU_arm7500 0x0002
51#define TARGET_CPU_arm7500fe 0x1001
52#define TARGET_CPU_arm7tdmi 0x0008
53#define TARGET_CPU_arm8 0x0010
54#define TARGET_CPU_arm810 0x0020
55#define TARGET_CPU_strongarm 0x0040
56#define TARGET_CPU_strongarm110 0x0040
f5a1b0d2 57#define TARGET_CPU_strongarm1100 0x0040
b36ba79f
RE
58#define TARGET_CPU_arm9 0x0080
59#define TARGET_CPU_arm9tdmi 0x0080
7a801826
RE
60/* Configure didn't specify */
61#define TARGET_CPU_generic 0x8000
ff9940b0 62
89c7ca52
RE
63enum arm_cond_code
64{
65 ARM_EQ = 0, ARM_NE, ARM_CS, ARM_CC, ARM_MI, ARM_PL, ARM_VS, ARM_VC,
66 ARM_HI, ARM_LS, ARM_GE, ARM_LT, ARM_GT, ARM_LE, ARM_AL, ARM_NV
67};
6cfc7210 68
89c7ca52 69extern enum arm_cond_code arm_current_cc;
62b10bbc 70extern char * arm_condition_codes[];
ff9940b0 71
89c7ca52
RE
72#define ARM_INVERSE_CONDITION_CODE(X) ((enum arm_cond_code) (((int)X) ^ 1))
73
6cfc7210
NC
74extern int arm_target_label;
75extern int arm_ccfsm_state;
76extern struct rtx_def * arm_target_insn;
77extern int lr_save_eliminated;
ff9940b0
RE
78/* This is needed by the tail-calling peepholes */
79extern int frame_pointer_needed;
6cfc7210
NC
80/* Run-time compilation parameters selecting different hardware subsets. */
81extern int target_flags;
82/* The floating point instruction architecture, can be 2 or 3 */
83extern const char * target_fp_name;
ff9940b0 84
35d965d5 85\f
7a801826
RE
86/* Just in case configure has failed to define anything. */
87#ifndef TARGET_CPU_DEFAULT
88#define TARGET_CPU_DEFAULT TARGET_CPU_generic
89#endif
90
91/* If the configuration file doesn't specify the cpu, the subtarget may
92 override it. If it doesn't, then default to an ARM6. */
93#if TARGET_CPU_DEFAULT == TARGET_CPU_generic
94#undef TARGET_CPU_DEFAULT
95#ifdef SUBTARGET_CPU_DEFAULT
96#define TARGET_CPU_DEFAULT SUBTARGET_CPU_DEFAULT
97#else
98#define TARGET_CPU_DEFAULT TARGET_CPU_arm6
99#endif
100#endif
101
102#if TARGET_CPU_DEFAULT == TARGET_CPU_arm2
103#define CPP_ARCH_DEFAULT_SPEC "-D__ARM_ARCH_2__"
104#else
18543a22 105#if TARGET_CPU_DEFAULT == TARGET_CPU_arm6 || TARGET_CPU_DEFAULT == TARGET_CPU_arm610 || TARGET_CPU_DEFAULT == TARGET_CPU_arm7500fe
7a801826
RE
106#define CPP_ARCH_DEFAULT_SPEC "-D__ARM_ARCH_3__"
107#else
108#if TARGET_CPU_DEFAULT == TARGET_CPU_arm7m
109#define CPP_ARCH_DEFAULT_SPEC "-D__ARM_ARCH_3M__"
110#else
9f6ce990 111#if TARGET_CPU_DEFAULT == TARGET_CPU_arm7tdmi || TARGET_CPU_DEFAULT == TARGET_CPU_arm9
7a801826
RE
112#define CPP_ARCH_DEFAULT_SPEC "-D__ARM_ARCH_4T__"
113#else
114#if TARGET_CPU_DEFAULT == TARGET_CPU_arm8 || TARGET_CPU_DEFAULT == TARGET_CPU_arm810 || TARGET_CPU_DEFAULT == TARGET_CPU_strongarm
115#define CPP_ARCH_DEFAULT_SPEC "-D__ARM_ARCH_4__"
116#else
117Unrecognized value in TARGET_CPU_DEFAULT.
118#endif
119#endif
120#endif
121#endif
122#endif
123
ff9940b0
RE
124#ifndef CPP_PREDEFINES
125#define CPP_PREDEFINES "-Darm -Acpu(arm) -Amachine(arm)"
126#endif
35d965d5 127
38fc909b
RE
128#define CPP_SPEC "\
129%(cpp_cpu_arch) %(cpp_apcs_pc) %(cpp_float) \
130%(cpp_endian) %(subtarget_cpp_spec)"
7a801826 131
71791e16
RE
132/* Set the architecture define -- if -march= is set, then it overrides
133 the -mcpu= setting. */
7a801826 134#define CPP_CPU_ARCH_SPEC "\
71791e16
RE
135%{march=arm2:-D__ARM_ARCH_2__} \
136%{march=arm250:-D__ARM_ARCH_2__} \
137%{march=arm3:-D__ARM_ARCH_2__} \
138%{march=arm6:-D__ARM_ARCH_3__} \
139%{march=arm600:-D__ARM_ARCH_3__} \
140%{march=arm610:-D__ARM_ARCH_3__} \
141%{march=arm7:-D__ARM_ARCH_3__} \
142%{march=arm700:-D__ARM_ARCH_3__} \
143%{march=arm710:-D__ARM_ARCH_3__} \
144%{march=arm7100:-D__ARM_ARCH_3__} \
145%{march=arm7500:-D__ARM_ARCH_3__} \
146%{march=arm7500fe:-D__ARM_ARCH_3__} \
147%{march=arm7m:-D__ARM_ARCH_3M__} \
148%{march=arm7dm:-D__ARM_ARCH_3M__} \
149%{march=arm7dmi:-D__ARM_ARCH_3M__} \
150%{march=arm7tdmi:-D__ARM_ARCH_4T__} \
151%{march=arm8:-D__ARM_ARCH_4__} \
152%{march=arm810:-D__ARM_ARCH_4__} \
b36ba79f 153%{march=arm9:-D__ARM_ARCH_4T__} \
60d0536b
NC
154%{march=arm920:-D__ARM_ARCH_4__} \
155%{march=arm920t:-D__ARM_ARCH_4T__} \
b36ba79f 156%{march=arm9tdmi:-D__ARM_ARCH_4T__} \
71791e16
RE
157%{march=strongarm:-D__ARM_ARCH_4__} \
158%{march=strongarm110:-D__ARM_ARCH_4__} \
f5a1b0d2 159%{march=strongarm1100:-D__ARM_ARCH_4__} \
71791e16
RE
160%{march=armv2:-D__ARM_ARCH_2__} \
161%{march=armv2a:-D__ARM_ARCH_2__} \
162%{march=armv3:-D__ARM_ARCH_3__} \
163%{march=armv3m:-D__ARM_ARCH_3M__} \
164%{march=armv4:-D__ARM_ARCH_4__} \
165%{march=armv4t:-D__ARM_ARCH_4T__} \
62b10bbc 166%{march=armv5:-D__ARM_ARCH_5__} \
71791e16
RE
167%{!march=*: \
168 %{mcpu=arm2:-D__ARM_ARCH_2__} \
169 %{mcpu=arm250:-D__ARM_ARCH_2__} \
170 %{mcpu=arm3:-D__ARM_ARCH_2__} \
171 %{mcpu=arm6:-D__ARM_ARCH_3__} \
172 %{mcpu=arm600:-D__ARM_ARCH_3__} \
173 %{mcpu=arm610:-D__ARM_ARCH_3__} \
174 %{mcpu=arm7:-D__ARM_ARCH_3__} \
175 %{mcpu=arm700:-D__ARM_ARCH_3__} \
176 %{mcpu=arm710:-D__ARM_ARCH_3__} \
177 %{mcpu=arm7100:-D__ARM_ARCH_3__} \
178 %{mcpu=arm7500:-D__ARM_ARCH_3__} \
179 %{mcpu=arm7500fe:-D__ARM_ARCH_3__} \
180 %{mcpu=arm7m:-D__ARM_ARCH_3M__} \
181 %{mcpu=arm7dm:-D__ARM_ARCH_3M__} \
182 %{mcpu=arm7dmi:-D__ARM_ARCH_3M__} \
183 %{mcpu=arm7tdmi:-D__ARM_ARCH_4T__} \
184 %{mcpu=arm8:-D__ARM_ARCH_4__} \
185 %{mcpu=arm810:-D__ARM_ARCH_4__} \
b36ba79f 186 %{mcpu=arm9:-D__ARM_ARCH_4T__} \
60d0536b
NC
187 %{mcpu=arm920:-D__ARM_ARCH_4__} \
188 %{mcpu=arm920t:-D__ARM_ARCH_4T__} \
b36ba79f 189 %{mcpu=arm9tdmi:-D__ARM_ARCH_4T__} \
71791e16
RE
190 %{mcpu=strongarm:-D__ARM_ARCH_4__} \
191 %{mcpu=strongarm110:-D__ARM_ARCH_4__} \
f5a1b0d2 192 %{mcpu=strongarm1100:-D__ARM_ARCH_4__} \
dfa08768 193 %{!mcpu*:%(cpp_cpu_arch_default)}} \
11c1a207 194"
7a801826
RE
195
196/* Define __APCS_26__ if the PC also contains the PSR */
7a801826
RE
197#define CPP_APCS_PC_SPEC "\
198%{mapcs-32:%{mapcs-26:%e-mapcs-26 and -mapcs-32 may not be used together} \
199 -D__APCS_32__} \
200%{mapcs-26:-D__APCS_26__} \
dfa08768 201%{!mapcs-32: %{!mapcs-26:%(cpp_apcs_pc_default)}} \
7a801826
RE
202"
203
b355a481 204#ifndef CPP_APCS_PC_DEFAULT_SPEC
7a801826 205#define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_26__"
b355a481 206#endif
7a801826
RE
207
208#define CPP_FLOAT_SPEC "\
209%{msoft-float:\
210 %{mhard-float:%e-msoft-float and -mhard_float may not be used together} \
211 -D__SOFTFP__} \
212%{!mhard-float:%{!msoft-float:%(cpp_float_default)}} \
213"
214
215/* Default is hard float, which doesn't define anything */
216#define CPP_FLOAT_DEFAULT_SPEC ""
217
218#define CPP_ENDIAN_SPEC "\
6cfc7210
NC
219%{mbig-endian: \
220 %{mlittle-endian: \
221 %e-mbig-endian and -mlittle-endian may not be used together} \
222 -D__ARMEB__ %{mwords-little-endian:-D__ARMWEL__}} \
223%{!mlittle-endian:%{!mbig-endian:%(cpp_endian_default)}} \
7a801826
RE
224"
225
226/* Default is little endian, which doesn't define anything. */
227#define CPP_ENDIAN_DEFAULT_SPEC ""
228
dfa08768 229#define CC1_SPEC ""
7a801826
RE
230
231/* This macro defines names of additional specifications to put in the specs
232 that can be used in various specifications like CC1_SPEC. Its definition
233 is an initializer with a subgrouping for each command option.
234
235 Each subgrouping contains a string constant, that defines the
236 specification name, and a string constant that used by the GNU CC driver
237 program.
238
239 Do not define this macro if it does not need to do anything. */
240#define EXTRA_SPECS \
241 { "cpp_cpu_arch", CPP_CPU_ARCH_SPEC }, \
242 { "cpp_cpu_arch_default", CPP_ARCH_DEFAULT_SPEC }, \
243 { "cpp_apcs_pc", CPP_APCS_PC_SPEC }, \
244 { "cpp_apcs_pc_default", CPP_APCS_PC_DEFAULT_SPEC }, \
245 { "cpp_float", CPP_FLOAT_SPEC }, \
246 { "cpp_float_default", CPP_FLOAT_DEFAULT_SPEC }, \
247 { "cpp_endian", CPP_ENDIAN_SPEC }, \
248 { "cpp_endian_default", CPP_ENDIAN_DEFAULT_SPEC }, \
38fc909b 249 { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \
7a801826
RE
250 SUBTARGET_EXTRA_SPECS
251
252#define SUBTARGET_EXTRA_SPECS
6cfc7210 253#ifndef SUBTARGET_CPP_SPEC
38fc909b 254#define SUBTARGET_CPP_SPEC ""
6cfc7210 255#endif
7a801826 256
35d965d5
RS
257\f
258/* Run-time Target Specification. */
ff9940b0 259#ifndef TARGET_VERSION
6cfc7210 260#define TARGET_VERSION fputs (" (ARM/generic)", stderr);
ff9940b0 261#endif
35d965d5 262
35d965d5
RS
263/* Nonzero if the function prologue (and epilogue) should obey
264 the ARM Procedure Call Standard. */
6cfc7210 265#define ARM_FLAG_APCS_FRAME (1 << 0)
35d965d5
RS
266
267/* Nonzero if the function prologue should output the function name to enable
268 the post mortem debugger to print a backtrace (very useful on RISCOS,
11c1a207
RE
269 unused on RISCiX). Specifying this flag also enables
270 -fno-omit-frame-pointer.
35d965d5 271 XXX Must still be implemented in the prologue. */
6cfc7210 272#define ARM_FLAG_POKE (1 << 1)
35d965d5
RS
273
274/* Nonzero if floating point instructions are emulated by the FPE, in which
275 case instruction scheduling becomes very uninteresting. */
6cfc7210 276#define ARM_FLAG_FPE (1 << 2)
35d965d5 277
11c1a207
RE
278/* Nonzero if destined for a processor in 32-bit program mode. Takes out bit
279 that assume restoration of the condition flags when returning from a
280 branch and link (ie a function). */
6cfc7210 281#define ARM_FLAG_APCS_32 (1 << 3)
11c1a207 282
dfa08768
RE
283/* FLAGS 0x0008 and 0x0010 are now spare (used to be arm3/6 selection). */
284
11c1a207
RE
285/* Nonzero if stack checking should be performed on entry to each function
286 which allocates temporary variables on the stack. */
6cfc7210 287#define ARM_FLAG_APCS_STACK (1 << 4)
11c1a207
RE
288
289/* Nonzero if floating point parameters should be passed to functions in
290 floating point registers. */
6cfc7210 291#define ARM_FLAG_APCS_FLOAT (1 << 5)
11c1a207
RE
292
293/* Nonzero if re-entrant, position independent code should be generated.
294 This is equivalent to -fpic. */
6cfc7210 295#define ARM_FLAG_APCS_REENT (1 << 6)
11c1a207
RE
296
297/* Nonzero if the MMU will trap unaligned word accesses, so shorts must be
298 loaded byte-at-a-time. */
6cfc7210 299#define ARM_FLAG_SHORT_BYTE (1 << 7)
11c1a207
RE
300
301/* Nonzero if all floating point instructions are missing (and there is no
302 emulator either). Generate function calls for all ops in this case. */
6cfc7210 303#define ARM_FLAG_SOFT_FLOAT (1 << 8)
11c1a207
RE
304
305/* Nonzero if we should compile with BYTES_BIG_ENDIAN set to 1. */
6cfc7210 306#define ARM_FLAG_BIG_END (1 << 9)
11c1a207
RE
307
308/* Nonzero if we should compile for Thumb interworking. */
6cfc7210 309#define ARM_FLAG_INTERWORK (1 << 10)
11c1a207 310
ddee6aba
RE
311/* Nonzero if we should have little-endian words even when compiling for
312 big-endian (for backwards compatibility with older versions of GCC). */
6cfc7210 313#define ARM_FLAG_LITTLE_WORDS (1 << 11)
ddee6aba 314
f5a1b0d2 315/* Nonzero if we need to protect the prolog from scheduling */
6cfc7210 316#define ARM_FLAG_NO_SCHED_PRO (1 << 12)
f5a1b0d2 317
c11145f6
CM
318/* Nonzero if a call to abort should be generated if a noreturn
319function tries to return. */
6cfc7210 320#define ARM_FLAG_ABORT_NORETURN (1 << 13)
c11145f6 321
ed0e6530
PB
322/* Nonzero if function prologues should not load the PIC register. */
323#define ARM_FLAG_SINGLE_PIC_BASE (1 << 14)
324
11c1a207
RE
325#define TARGET_APCS (target_flags & ARM_FLAG_APCS_FRAME)
326#define TARGET_POKE_FUNCTION_NAME (target_flags & ARM_FLAG_POKE)
327#define TARGET_FPE (target_flags & ARM_FLAG_FPE)
11c1a207
RE
328#define TARGET_APCS_32 (target_flags & ARM_FLAG_APCS_32)
329#define TARGET_APCS_STACK (target_flags & ARM_FLAG_APCS_STACK)
330#define TARGET_APCS_FLOAT (target_flags & ARM_FLAG_APCS_FLOAT)
331#define TARGET_APCS_REENT (target_flags & ARM_FLAG_APCS_REENT)
6cc8c0b3 332/* Note: TARGET_SHORT_BY_BYTES is really a misnomer. What it means is
60d0536b 333 that short values should not be accessed using word load instructions
6cc8c0b3
NC
334 as there is a possibility that they may not be word aligned and this
335 would generate an MMU fault. On processors which do not have a 16 bit
336 load instruction therefore, short values must be loaded by individual
337 byte accesses rather than loading a word and then shifting the desired
338 value into place. */
11c1a207
RE
339#define TARGET_SHORT_BY_BYTES (target_flags & ARM_FLAG_SHORT_BYTE)
340#define TARGET_SOFT_FLOAT (target_flags & ARM_FLAG_SOFT_FLOAT)
341#define TARGET_HARD_FLOAT (! TARGET_SOFT_FLOAT)
342#define TARGET_BIG_END (target_flags & ARM_FLAG_BIG_END)
6cfc7210 343#define TARGET_INTERWORK (target_flags & ARM_FLAG_INTERWORK)
ddee6aba 344#define TARGET_LITTLE_WORDS (target_flags & ARM_FLAG_LITTLE_WORDS)
f5a1b0d2 345#define TARGET_NO_SCHED_PRO (target_flags & ARM_FLAG_NO_SCHED_PRO)
c11145f6 346#define TARGET_ABORT_NORETURN (target_flags & ARM_FLAG_ABORT_NORETURN)
ed0e6530 347#define TARGET_SINGLE_PIC_BASE (target_flags & ARM_FLAG_SINGLE_PIC_BASE)
3ada8e17
DE
348
349/* SUBTARGET_SWITCHES is used to add flags on a per-config basis.
350 Bit 31 is reserved. See riscix.h. */
351#ifndef SUBTARGET_SWITCHES
352#define SUBTARGET_SWITCHES
ff9940b0
RE
353#endif
354
6cfc7210
NC
355#define TARGET_SWITCHES \
356{ \
357 {"apcs", ARM_FLAG_APCS_FRAME, "" }, \
358 {"apcs-frame", ARM_FLAG_APCS_FRAME, \
359 "Generate APCS conformant stack frames" }, \
360 {"no-apcs-frame", -ARM_FLAG_APCS_FRAME, "" }, \
361 {"poke-function-name", ARM_FLAG_POKE, \
362 "Store function names in object code" }, \
363 {"no-poke-function-name", -ARM_FLAG_POKE, "" }, \
364 {"fpe", ARM_FLAG_FPE, "" }, \
365 {"apcs-32", ARM_FLAG_APCS_32, \
366 "Use the 32bit version of the APCS" }, \
367 {"apcs-26", -ARM_FLAG_APCS_32, \
368 "Use the 26bit version of the APCS" }, \
369 {"apcs-stack-check", ARM_FLAG_APCS_STACK, "" }, \
370 {"no-apcs-stack-check", -ARM_FLAG_APCS_STACK, "" }, \
371 {"apcs-float", ARM_FLAG_APCS_FLOAT, \
372 "Pass FP arguments in FP registers" }, \
373 {"no-apcs-float", -ARM_FLAG_APCS_FLOAT, "" }, \
374 {"apcs-reentrant", ARM_FLAG_APCS_REENT, \
375 "Generate re-entrant, PIC code" }, \
376 {"no-apcs-reentrant", -ARM_FLAG_APCS_REENT, "" }, \
377 {"short-load-bytes", ARM_FLAG_SHORT_BYTE, \
378 "Load shorts a byte at a time" }, \
379 {"no-short-load-bytes", -ARM_FLAG_SHORT_BYTE, "" }, \
380 {"short-load-words", -ARM_FLAG_SHORT_BYTE, \
ed0e6530 381 "Load shorts a word at a time" }, \
6cfc7210
NC
382 {"no-short-load-words", ARM_FLAG_SHORT_BYTE, "" }, \
383 {"soft-float", ARM_FLAG_SOFT_FLOAT, \
384 "Use library calls to perform FP operations" }, \
385 {"hard-float", -ARM_FLAG_SOFT_FLOAT, \
386 "Use hardware floating point instructions" }, \
387 {"big-endian", ARM_FLAG_BIG_END, \
388 "Assume target CPU is configured as big endian" }, \
389 {"little-endian", -ARM_FLAG_BIG_END, \
390 "Assume target CPU is configured as little endian" }, \
391 {"words-little-endian", ARM_FLAG_LITTLE_WORDS, \
392 "Assume big endian bytes, little endian words" }, \
393 {"thumb-interwork", ARM_FLAG_INTERWORK, \
7e58a4d3 394 "Support calls between THUMB and ARM instructions sets" }, \
6cfc7210
NC
395 {"no-thumb-interwork", -ARM_FLAG_INTERWORK, "" }, \
396 {"abort-on-noreturn", ARM_FLAG_ABORT_NORETURN, \
397 "Generate a call to abort if a noreturn function returns"}, \
398 {"no-abort-on-noreturn", -ARM_FLAG_ABORT_NORETURN, ""}, \
399 {"sched-prolog", -ARM_FLAG_NO_SCHED_PRO, \
400 "Do not move instructions into a function's prologue" }, \
401 {"no-sched-prolog", ARM_FLAG_NO_SCHED_PRO, "" }, \
ed0e6530
PB
402 {"single-pic-base", ARM_FLAG_SINGLE_PIC_BASE, \
403 "Do not load the PIC register in function prologues" }, \
404 {"no-single-pic-base", -ARM_FLAG_SINGLE_PIC_BASE, "" },\
6cfc7210
NC
405 SUBTARGET_SWITCHES \
406 {"", TARGET_DEFAULT } \
35d965d5
RS
407}
408
43cffd11
RE
409#define TARGET_OPTIONS \
410{ \
f5a1b0d2
NC
411 {"cpu=", & arm_select[0].string, \
412 "Specify the name of the target CPU" }, \
413 {"arch=", & arm_select[1].string, \
414 "Specify the name of the target architecture" }, \
415 {"tune=", & arm_select[2].string, "" }, \
416 {"fpe=", & target_fp_name, "" }, \
417 {"fp=", & target_fp_name, \
418 "Specify the version of the floating point emulator" }, \
419 { "structure-size-boundary=", & structure_size_string, \
ed0e6530
PB
420 "Specify the minumum bit alignment of structures" }, \
421 { "pic-register=", & arm_pic_register_string, \
422 "Specify the register to be used for PIC addressing" } \
11c1a207 423}
ff9940b0 424
62dd06ea
RE
425struct arm_cpu_select
426{
f9cc092a
RE
427 const char * string;
428 const char * name;
429 const struct processors * processors;
62dd06ea
RE
430};
431
f5a1b0d2
NC
432/* This is a magic array. If the user specifies a command line switch
433 which matches one of the entries in TARGET_OPTIONS then the corresponding
434 string pointer will be set to the value specified by the user. */
62dd06ea
RE
435extern struct arm_cpu_select arm_select[];
436
11c1a207
RE
437enum prog_mode_type
438{
439 prog_mode26,
440 prog_mode32
441};
442
443/* Recast the program mode class to be the prog_mode attribute */
444#define arm_prog_mode ((enum attr_prog_mode) arm_prgmode)
445
446extern enum prog_mode_type arm_prgmode;
447
448/* What sort of floating point unit do we have? Hardware or software.
449 If software, is it issue 2 or issue 3? */
24f0c1b4
RE
450enum floating_point_type
451{
452 FP_HARD,
11c1a207
RE
453 FP_SOFT2,
454 FP_SOFT3
24f0c1b4
RE
455};
456
457/* Recast the floating point class to be the floating point attribute. */
458#define arm_fpu_attr ((enum attr_fpu) arm_fpu)
459
71791e16 460/* What type of floating point to tune for */
24f0c1b4
RE
461extern enum floating_point_type arm_fpu;
462
71791e16
RE
463/* What type of floating point instructions are available */
464extern enum floating_point_type arm_fpu_arch;
465
18543a22 466/* Default floating point architecture. Override in sub-target if
71791e16
RE
467 necessary. */
468#define FP_DEFAULT FP_SOFT2
469
11c1a207
RE
470/* Nonzero if the processor has a fast multiply insn, and one that does
471 a 64-bit multiply of two 32-bit values. */
472extern int arm_fast_multiply;
473
71791e16 474/* Nonzero if this chip supports the ARM Architecture 4 extensions */
11c1a207
RE
475extern int arm_arch4;
476
62b10bbc
NC
477/* Nonzero if this chip supports the ARM Architecture 5 extensions */
478extern int arm_arch5;
479
f5a1b0d2
NC
480/* Nonzero if this chip can benefit from load scheduling. */
481extern int arm_ld_sched;
482
483/* Nonzero if this chip is a StrongARM. */
484extern int arm_is_strong;
485
486/* Nonzero if this chip is a an ARM6 or an ARM7. */
487extern int arm_is_6_or_7;
488
2ce9c1b9 489#ifndef TARGET_DEFAULT
35d965d5 490#define TARGET_DEFAULT 0
2ce9c1b9 491#endif
35d965d5 492
11c1a207
RE
493/* The frame pointer register used in gcc has nothing to do with debugging;
494 that is controlled by the APCS-FRAME option. */
495/* Not fully implemented yet */
496/* #define CAN_DEBUG_WITHOUT_FP 1 */
35d965d5 497
11c1a207
RE
498#define TARGET_MEM_FUNCTIONS 1
499
500#define OVERRIDE_OPTIONS arm_override_options ()
86efdc8e
PB
501
502/* Nonzero if PIC code requires explicit qualifiers to generate
503 PLT and GOT relocs rather than the assembler doing so implicitly.
ed0e6530
PB
504 Subtargets can override these if required. */
505#ifndef NEED_GOT_RELOC
506#define NEED_GOT_RELOC 0
507#endif
508#ifndef NEED_PLT_RELOC
509#define NEED_PLT_RELOC 0
e2723c62 510#endif
84306176
PB
511
512/* Nonzero if we need to refer to the GOT with a PC-relative
513 offset. In other words, generate
514
515 .word _GLOBAL_OFFSET_TABLE_ - [. - (.Lxx + 8)]
516
517 rather than
518
519 .word _GLOBAL_OFFSET_TABLE_ - (.Lxx + 8)
520
521 The default is true, which matches NetBSD. Subtargets can
522 override this if required. */
523#ifndef GOT_PCREL
524#define GOT_PCREL 1
525#endif
35d965d5
RS
526\f
527/* Target machine storage Layout. */
528
ff9940b0
RE
529
530/* Define this macro if it is advisable to hold scalars in registers
531 in a wider mode than that declared by the program. In such cases,
532 the value is constrained to be within the bounds of the declared
533 type, but kept valid in the wider mode. The signedness of the
534 extension may differ from that of the type. */
535
536/* It is far faster to zero extend chars than to sign extend them */
537
6cfc7210 538#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
2ce9c1b9
RE
539 if (GET_MODE_CLASS (MODE) == MODE_INT \
540 && GET_MODE_SIZE (MODE) < 4) \
541 { \
542 if (MODE == QImode) \
543 UNSIGNEDP = 1; \
544 else if (MODE == HImode) \
545 UNSIGNEDP = TARGET_SHORT_BY_BYTES != 0; \
546 (MODE) = SImode; \
ff9940b0
RE
547 }
548
18543a22
ILT
549/* Define this macro if the promotion described by `PROMOTE_MODE'
550 should also be done for outgoing function arguments. */
551/* This is required to ensure that push insns always push a word. */
552#define PROMOTE_FUNCTION_ARGS
553
ff9940b0
RE
554/* Define for XFmode extended real floating point support.
555 This will automatically cause REAL_ARITHMETIC to be defined. */
556/* For the ARM:
557 I think I have added all the code to make this work. Unfortunately,
558 early releases of the floating point emulation code on RISCiX used a
559 different format for extended precision numbers. On my RISCiX box there
560 is a bug somewhere which causes the machine to lock up when running enquire
561 with long doubles. There is the additional aspect that Norcroft C
562 treats long doubles as doubles and we ought to remain compatible.
563 Perhaps someone with an FPA coprocessor and not running RISCiX would like
564 to try this someday. */
565/* #define LONG_DOUBLE_TYPE_SIZE 96 */
566
567/* Disable XFmode patterns in md file */
568#define ENABLE_XF_PATTERNS 0
569
570/* Define if you don't want extended real, but do want to use the
571 software floating point emulator for REAL_ARITHMETIC and
572 decimal <-> binary conversion. */
573/* See comment above */
574#define REAL_ARITHMETIC
575
35d965d5
RS
576/* Define this if most significant bit is lowest numbered
577 in instructions that operate on numbered bit-fields. */
578#define BITS_BIG_ENDIAN 0
579
9c872872 580/* Define this if most significant byte of a word is the lowest numbered.
3ada8e17
DE
581 Most ARM processors are run in little endian mode, so that is the default.
582 If you want to have it run-time selectable, change the definition in a
583 cover file to be TARGET_BIG_ENDIAN. */
11c1a207 584#define BYTES_BIG_ENDIAN (TARGET_BIG_END != 0)
35d965d5
RS
585
586/* Define this if most significant word of a multiword number is the lowest
11c1a207
RE
587 numbered.
588 This is always false, even when in big-endian mode. */
ddee6aba
RE
589#define WORDS_BIG_ENDIAN (BYTES_BIG_ENDIAN && ! TARGET_LITTLE_WORDS)
590
591/* LIBGCC2_WORDS_BIG_ENDIAN has to be a constant, so we define this based
592 on processor pre-defineds when compiling libgcc2.c. */
593#if defined(__ARMEB__) && !defined(__ARMWEL__)
594#define LIBGCC2_WORDS_BIG_ENDIAN 1
595#else
596#define LIBGCC2_WORDS_BIG_ENDIAN 0
597#endif
35d965d5 598
11c1a207
RE
599/* Define this if most significant word of doubles is the lowest numbered.
600 This is always true, even when in little-endian mode. */
7fc6c9f0
RK
601#define FLOAT_WORDS_BIG_ENDIAN 1
602
b4ac57ab 603/* Number of bits in an addressable storage unit */
35d965d5
RS
604#define BITS_PER_UNIT 8
605
606#define BITS_PER_WORD 32
607
608#define UNITS_PER_WORD 4
609
610#define POINTER_SIZE 32
611
612#define PARM_BOUNDARY 32
613
614#define STACK_BOUNDARY 32
615
616#define FUNCTION_BOUNDARY 32
617
618#define EMPTY_FIELD_BOUNDARY 32
619
620#define BIGGEST_ALIGNMENT 32
621
ff9940b0
RE
622/* Make strings word-aligned so strcpy from constants will be faster. */
623#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
624 (TREE_CODE (EXP) == STRING_CST \
625 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
626
b4ac57ab 627/* Every structures size must be a multiple of 32 bits. */
7d94bb81
DE
628/* This is for compatibility with ARMCC. ARM SDT Reference Manual
629 (ARM DUI 0020D) page 2-20 says "Structures are aligned on word
630 boundaries". */
b355a481 631#ifndef STRUCTURE_SIZE_BOUNDARY
b4ac57ab 632#define STRUCTURE_SIZE_BOUNDARY 32
b355a481 633#endif
2a5307b1 634
b355a481 635/* Used when parsing command line option -mstructure_size_boundary. */
f9cc092a 636extern const char * structure_size_string;
b4ac57ab 637
ff9940b0
RE
638/* Non-zero if move instructions will actually fail to work
639 when given unaligned data. */
35d965d5
RS
640#define STRICT_ALIGNMENT 1
641
ff9940b0
RE
642#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
643
35d965d5
RS
644\f
645/* Standard register usage. */
646
647/* Register allocation in ARM Procedure Call Standard (as used on RISCiX):
648 (S - saved over call).
649
650 r0 * argument word/integer result
651 r1-r3 argument word
652
653 r4-r8 S register variable
654 r9 S (rfp) register variable (real frame pointer)
f5a1b0d2
NC
655
656 r10 F S (sl) stack limit (used by -mapcs-stack-check)
35d965d5
RS
657 r11 F S (fp) argument pointer
658 r12 (ip) temp workspace
659 r13 F S (sp) lower end of current stack frame
660 r14 (lr) link address/workspace
661 r15 F (pc) program counter
662
663 f0 floating point result
664 f1-f3 floating point scratch
665
666 f4-f7 S floating point variable
667
ff9940b0
RE
668 cc This is NOT a real register, but is used internally
669 to represent things that use or set the condition
670 codes.
671 sfp This isn't either. It is used during rtl generation
672 since the offset between the frame pointer and the
673 auto's isn't known until after register allocation.
674 afp Nor this, we only need this because of non-local
675 goto. Without it fp appears to be used and the
676 elimination code won't get rid of sfp. It tracks
677 fp exactly at all times.
678
35d965d5
RS
679 *: See CONDITIONAL_REGISTER_USAGE */
680
ff9940b0
RE
681/* The stack backtrace structure is as follows:
682 fp points to here: | save code pointer | [fp]
683 | return link value | [fp, #-4]
684 | return sp value | [fp, #-8]
685 | return fp value | [fp, #-12]
686 [| saved r10 value |]
687 [| saved r9 value |]
688 [| saved r8 value |]
689 [| saved r7 value |]
690 [| saved r6 value |]
691 [| saved r5 value |]
692 [| saved r4 value |]
693 [| saved r3 value |]
694 [| saved r2 value |]
695 [| saved r1 value |]
696 [| saved r0 value |]
697 [| saved f7 value |] three words
698 [| saved f6 value |] three words
699 [| saved f5 value |] three words
700 [| saved f4 value |] three words
701 r0-r3 are not normally saved in a C function. */
702
703/* The number of hard registers is 16 ARM + 8 FPU + 1 CC + 1 SFP. */
704#define FIRST_PSEUDO_REGISTER 27
35d965d5
RS
705
706/* 1 for registers that have pervasive standard uses
707 and are not available for the register allocator. */
708#define FIXED_REGISTERS \
709{ \
710 0,0,0,0,0,0,0,0, \
6cc8c0b3 711 0,0,0,1,0,1,0,1, \
ff9940b0
RE
712 0,0,0,0,0,0,0,0, \
713 1,1,1 \
35d965d5
RS
714}
715
716/* 1 for registers not available across function calls.
717 These must include the FIXED_REGISTERS and also any
718 registers that can be used without being saved.
719 The latter must include the registers where values are returned
720 and the register where structure-value addresses are passed.
ff9940b0
RE
721 Aside from that, you can include as many other registers as you like.
722 The CC is not preserved over function calls on the ARM 6, so it is
723 easier to assume this for all. SFP is preserved, since FP is. */
35d965d5
RS
724#define CALL_USED_REGISTERS \
725{ \
726 1,1,1,1,0,0,0,0, \
6cc8c0b3 727 0,0,0,1,1,1,1,1, \
ff9940b0
RE
728 1,1,1,1,0,0,0,0, \
729 1,1,1 \
35d965d5
RS
730}
731
6cc8c0b3
NC
732#ifndef SUBTARGET_CONDITIONAL_REGISTER_USAGE
733#define SUBTARGET_CONDITIONAL_REGISTER_USAGE
734#endif
735
35d965d5
RS
736/* If doing stupid life analysis, avoid a bug causing a return value r0 to be
737 trampled. This effectively reduces the number of available registers by 1.
738 XXX It is a hack, I know.
739 XXX Is this still needed? */
740#define CONDITIONAL_REGISTER_USAGE \
3ada8e17
DE
741{ \
742 if (obey_regdecls) \
743 fixed_regs[0] = 1; \
744 if (TARGET_SOFT_FLOAT) \
745 { \
746 int regno; \
747 for (regno = 16; regno < 24; ++regno) \
748 fixed_regs[regno] = call_used_regs[regno] = 1; \
749 } \
7a801826
RE
750 if (flag_pic) \
751 { \
752 fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
6ed30148 753 call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
7a801826 754 } \
6cc8c0b3 755 else if (TARGET_APCS_STACK) \
f5a1b0d2 756 { \
6cc8c0b3
NC
757 fixed_regs[10] = 1; \
758 call_used_regs[10] = 1; \
f5a1b0d2 759 } \
6cc8c0b3 760 SUBTARGET_CONDITIONAL_REGISTER_USAGE \
35d965d5
RS
761}
762
6cfc7210
NC
763/* Convert fron bytes to ints. */
764#define NUM_INTS(X) (((X) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
765
766/* The number of (integer) registers required to hold a quantity of type MODE. */
767#define NUM_REGS(MODE) \
768 NUM_INTS (GET_MODE_SIZE (MODE))
769
770/* The number of (integer) registers required to hold a quantity of TYPE MODE. */
771#define NUM_REGS2(MODE, TYPE) \
772 NUM_INTS ((MODE) == BLKmode ? int_size_in_bytes (TYPE) : GET_MODE_SIZE (MODE))
773
774/* The number of (integer) argument register available. */
775#define NUM_ARG_REGS 4
776
777/* Return the regiser number of the N'th (integer) argument. */
778#define ARG_REGISTER(N) (N - 1)
779
780/* The number of the last argument register. */
781#define LAST_ARG_REGNUM ARG_REGISTER (NUM_ARG_REGS)
782
35d965d5
RS
783/* Return number of consecutive hard regs needed starting at reg REGNO
784 to hold something of mode MODE.
785 This is ordinarily the length in words of a value of mode MODE
786 but can be less for certain modes in special long registers.
787
788 On the ARM regs are UNITS_PER_WORD bits wide; FPU regs can hold any FP
789 mode. */
6cfc7210
NC
790#define HARD_REGNO_NREGS(REGNO, MODE) \
791 (( REGNO >= 16 \
792 && REGNO != FRAME_POINTER_REGNUM \
793 && REGNO != ARG_POINTER_REGNUM) \
794 ? 1 : NUM_REGS (MODE))
35d965d5
RS
795
796/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
797 This is TRUE for ARM regs since they can hold anything, and TRUE for FPU
798 regs holding FP. */
ff9940b0
RE
799#define HARD_REGNO_MODE_OK(REGNO, MODE) \
800 ((GET_MODE_CLASS (MODE) == MODE_CC) ? (REGNO == CC_REGNUM) : \
801 ((REGNO) < 16 || REGNO == FRAME_POINTER_REGNUM \
802 || REGNO == ARG_POINTER_REGNUM \
803 || GET_MODE_CLASS (MODE) == MODE_FLOAT))
35d965d5
RS
804
805/* Value is 1 if it is a good idea to tie two pseudo registers
806 when one has mode MODE1 and one has mode MODE2.
807 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
808 for any hard reg, then this must be 0 for correct output. */
809#define MODES_TIEABLE_P(MODE1, MODE2) \
3967692c 810 (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
35d965d5
RS
811
812/* Specify the registers used for certain standard purposes.
813 The values of these macros are register numbers. */
814
815/* Define this if the program counter is overloaded on a register. */
816#define PC_REGNUM 15
817
818/* Register to use for pushing function arguments. */
819#define STACK_POINTER_REGNUM 13
6cfc7210 820#define SP_REGNUM STACK_POINTER_REGNUM
35d965d5
RS
821
822/* Base register for access to local variables of the function. */
ff9940b0
RE
823#define FRAME_POINTER_REGNUM 25
824
825/* Define this to be where the real frame pointer is if it is not possible to
826 work out the offset between the frame pointer and the automatic variables
827 until after register allocation has taken place. FRAME_POINTER_REGNUM
828 should point to a special register that we will make sure is eliminated. */
829#define HARD_FRAME_POINTER_REGNUM 11
6cfc7210 830#define FP_REGNUM HARD_FRAME_POINTER_REGNUM
35d965d5 831
62b10bbc
NC
832/* Register which holds return address from a subroutine call. */
833#define LR_REGNUM 14
834
835/* Scratch register - used in all kinds of places, eg trampolines. */
836#define IP_REGNUM 12
837
35d965d5
RS
838/* Value should be nonzero if functions must have frame pointers.
839 Zero means the frame pointer need not be set up (and parms may be accessed
ff9940b0
RE
840 via the stack pointer) in functions that seem suitable.
841 If we have to have a frame pointer we might as well make use of it.
842 APCS says that the frame pointer does not need to be pushed in leaf
2a5307b1 843 functions, or simple tail call functions. */
688743e7
RE
844#define FRAME_POINTER_REQUIRED \
845 (current_function_has_nonlocal_label || (TARGET_APCS && !leaf_function_p ()))
35d965d5
RS
846
847/* Base register for access to arguments of the function. */
ff9940b0 848#define ARG_POINTER_REGNUM 26
35d965d5
RS
849
850/* The native (Norcroft) Pascal compiler for the ARM passes the static chain
851 as an invisible last argument (possible since varargs don't exist in
852 Pascal), so the following is not true. */
853#define STATIC_CHAIN_REGNUM 8
854
855/* Register in which address to store a structure value
856 is passed to a function. */
857#define STRUCT_VALUE_REGNUM 0
858
ff9940b0
RE
859/* Internal, so that we don't need to refer to a raw number */
860#define CC_REGNUM 24
861
35d965d5 862/* The order in which register should be allocated. It is good to use ip
ff9940b0
RE
863 since no saving is required (though calls clobber it) and it never contains
864 function parameters. It is quite good to use lr since other calls may
865 clobber it anyway. Allocate r0 through r3 in reverse order since r3 is
866 least likely to contain a function parameter; in addition results are
867 returned in r0.
868 */
ff73fb53 869#define REG_ALLOC_ORDER \
35d965d5 870{ \
ff73fb53
NC
871 3, 2, 1, 0, 12, 14, 4, 5, \
872 6, 7, 8, 10, 9, 11, 13, 15, \
ff9940b0 873 16, 17, 18, 19, 20, 21, 22, 23, \
ff73fb53 874 24, 25, 26 \
35d965d5
RS
875}
876\f
877/* Register and constant classes. */
878
879/* Register classes: all ARM regs or all FPU regs---simple! */
880enum reg_class
881{
882 NO_REGS,
883 FPU_REGS,
884 GENERAL_REGS,
885 ALL_REGS,
886 LIM_REG_CLASSES
887};
888
889#define N_REG_CLASSES (int) LIM_REG_CLASSES
890
891/* Give names of register classes as strings for dump file. */
892#define REG_CLASS_NAMES \
893{ \
894 "NO_REGS", \
895 "FPU_REGS", \
896 "GENERAL_REGS", \
897 "ALL_REGS", \
898}
899
900/* Define which registers fit in which classes.
901 This is an initializer for a vector of HARD_REG_SET
902 of length N_REG_CLASSES. */
aec3cfba
NC
903#define REG_CLASS_CONTENTS \
904{ \
905 { 0x0000000 }, /* NO_REGS */ \
906 { 0x0FF0000 }, /* FPU_REGS */ \
907 { 0x200FFFF }, /* GENERAL_REGS */ \
908 { 0x2FFFFFF } /* ALL_REGS */ \
35d965d5
RS
909}
910
911/* The same information, inverted:
912 Return the class number of the smallest class containing
913 reg number REGNO. This could be a conditional expression
914 or could index an array. */
ff9940b0
RE
915#define REGNO_REG_CLASS(REGNO) \
916 (((REGNO) < 16 || REGNO == FRAME_POINTER_REGNUM \
917 || REGNO == ARG_POINTER_REGNUM) \
918 ? GENERAL_REGS : (REGNO) == CC_REGNUM \
919 ? NO_REGS : FPU_REGS)
35d965d5
RS
920
921/* The class value for index registers, and the one for base regs. */
922#define INDEX_REG_CLASS GENERAL_REGS
923#define BASE_REG_CLASS GENERAL_REGS
924
925/* Get reg_class from a letter such as appears in the machine description.
926 We only need constraint `f' for FPU_REGS (`r' == GENERAL_REGS). */
927#define REG_CLASS_FROM_LETTER(C) \
928 ((C)=='f' ? FPU_REGS : NO_REGS)
929
930/* The letters I, J, K, L and M in a register constraint string
931 can be used to stand for particular ranges of immediate operands.
932 This macro defines what the ranges are.
933 C is the letter, and VALUE is a constant value.
934 Return 1 if VALUE is in the range specified by C.
b4ac57ab 935 I: immediate arithmetic operand (i.e. 8 bits shifted as required).
ff9940b0 936 J: valid indexing constants.
aef1764c 937 K: ~value ok in rhs argument of data operand.
3967692c
RE
938 L: -value ok in rhs argument of data operand.
939 M: 0..32, or a power of 2 (for shifts, or mult done by shift). */
aef1764c
RE
940#define CONST_OK_FOR_LETTER_P(VALUE, C) \
941 ((C) == 'I' ? const_ok_for_arm (VALUE) : \
942 (C) == 'J' ? ((VALUE) < 4096 && (VALUE) > -4096) : \
943 (C) == 'K' ? (const_ok_for_arm (~(VALUE))) : \
3967692c
RE
944 (C) == 'L' ? (const_ok_for_arm (-(VALUE))) : \
945 (C) == 'M' ? (((VALUE >= 0 && VALUE <= 32)) \
946 || (((VALUE) & ((VALUE) - 1)) == 0)) \
947 : 0)
ff9940b0
RE
948
949/* For the ARM, `Q' means that this is a memory operand that is just
950 an offset from a register.
951 `S' means any symbol that has the SYMBOL_REF_FLAG set or a CONSTANT_POOL
952 address. This means that the symbol is in the text segment and can be
953 accessed without using a load. */
954
7a801826
RE
955#define EXTRA_CONSTRAINT(OP, C) \
956 ((C) == 'Q' ? GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == REG \
957 : (C) == 'R' ? (GET_CODE (OP) == MEM \
958 && GET_CODE (XEXP (OP, 0)) == SYMBOL_REF \
959 && CONSTANT_POOL_ADDRESS_P (XEXP (OP, 0))) \
960 : (C) == 'S' ? (optimize > 0 && CONSTANT_ADDRESS_P (OP)) \
961 : 0)
ff9940b0
RE
962
963/* Constant letter 'G' for the FPU immediate constants.
964 'H' means the same constant negated. */
965#define CONST_DOUBLE_OK_FOR_LETTER_P(X,C) \
966 ((C) == 'G' ? const_double_rtx_ok_for_fpu (X) \
967 : (C) == 'H' ? neg_const_double_rtx_ok_for_fpu (X) : 0)
35d965d5
RS
968
969/* Given an rtx X being reloaded into a reg required to be
970 in class CLASS, return the class of reg to actually use.
971 In general this is just CLASS; but on some machines
972 in some cases it is preferable to use a more restrictive class. */
973#define PREFERRED_RELOAD_CLASS(X, CLASS) (CLASS)
974
ff9940b0
RE
975/* Return the register class of a scratch register needed to copy IN into
976 or out of a register in CLASS in MODE. If it can be done directly,
977 NO_REGS is returned. */
11c1a207
RE
978#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS,MODE,X) \
979 (((MODE) == HImode && ! arm_arch4 && true_regnum (X) == -1) \
980 ? GENERAL_REGS : NO_REGS)
ff9940b0 981
2ce9c1b9 982/* If we need to load shorts byte-at-a-time, then we need a scratch. */
ed4c4348 983#define SECONDARY_INPUT_RELOAD_CLASS(CLASS,MODE,X) \
a2767b67 984 (((MODE) == HImode && ! arm_arch4 && TARGET_SHORT_BY_BYTES \
ed4c4348
RE
985 && (GET_CODE (X) == MEM \
986 || ((GET_CODE (X) == REG || GET_CODE (X) == SUBREG) \
987 && true_regnum (X) == -1))) \
2ce9c1b9
RE
988 ? GENERAL_REGS : NO_REGS)
989
6f734908
RE
990/* Try a machine-dependent way of reloading an illegitimate address
991 operand. If we find one, push the reload and jump to WIN. This
992 macro is used in only one place: `find_reloads_address' in reload.c.
993
994 For the ARM, we wish to handle large displacements off a base
995 register by splitting the addend across a MOV and the mem insn.
996 This can cut the number of reloads needed. */
62b10bbc
NC
997#define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND_LEVELS, WIN) \
998 do \
999 { \
1000 if (GET_CODE (X) == PLUS \
1001 && GET_CODE (XEXP (X, 0)) == REG \
1002 && REGNO (XEXP (X, 0)) < FIRST_PSEUDO_REGISTER \
1003 && REG_MODE_OK_FOR_BASE_P (XEXP (X, 0), MODE) \
1004 && GET_CODE (XEXP (X, 1)) == CONST_INT) \
1005 { \
1006 HOST_WIDE_INT val = INTVAL (XEXP (X, 1)); \
1007 HOST_WIDE_INT low, high; \
1008 \
1009 if (MODE == DImode || (TARGET_SOFT_FLOAT && MODE == DFmode)) \
1010 low = ((val & 0xf) ^ 0x8) - 0x8; \
1011 else if (MODE == SImode || MODE == QImode \
1012 || (MODE == SFmode && TARGET_SOFT_FLOAT) \
1013 || (MODE == HImode && ! arm_arch4)) \
1014 /* Need to be careful, -4096 is not a valid offset */ \
1015 low = val >= 0 ? (val & 0xfff) : -((-val) & 0xfff); \
1016 else if (MODE == HImode && arm_arch4) \
1017 /* Need to be careful, -256 is not a valid offset */ \
1018 low = val >= 0 ? (val & 0xff) : -((-val) & 0xff); \
1019 else if (GET_MODE_CLASS (MODE) == MODE_FLOAT \
1020 && TARGET_HARD_FLOAT) \
1021 /* Need to be careful, -1024 is not a valid offset */ \
1022 low = val >= 0 ? (val & 0x3ff) : -((-val) & 0x3ff); \
1023 else \
1024 break; \
1025 \
1026 high = ((((val - low) & 0xffffffff) ^ 0x80000000) - 0x80000000); \
1027 /* Check for overflow or zero */ \
1028 if (low == 0 || high == 0 || (high + low != val)) \
1029 break; \
1030 \
1031 /* Reload the high part into a base reg; leave the low part \
1032 in the mem. */ \
1033 X = gen_rtx_PLUS (GET_MODE (X), \
1034 gen_rtx_PLUS (GET_MODE (X), XEXP (X, 0), \
1035 GEN_INT (high)), \
1036 GEN_INT (low)); \
1037 push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL_PTR, \
1038 BASE_REG_CLASS, GET_MODE (X), VOIDmode, 0, 0, \
1039 OPNUM, TYPE); \
1040 goto WIN; \
1041 } \
1042 } \
1043 while (0)
6f734908 1044
35d965d5
RS
1045/* Return the maximum number of consecutive registers
1046 needed to represent mode MODE in a register of class CLASS.
1047 ARM regs are UNITS_PER_WORD bits while FPU regs can hold any FP mode */
1048#define CLASS_MAX_NREGS(CLASS, MODE) \
6cfc7210 1049 ((CLASS) == FPU_REGS ? 1 : NUM_REGS (MODE))
35d965d5 1050
ff9940b0 1051/* Moves between FPU_REGS and GENERAL_REGS are two memory insns. */
35d965d5
RS
1052#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
1053 ((((CLASS1) == FPU_REGS && (CLASS2) != FPU_REGS) \
1054 || ((CLASS2) == FPU_REGS && (CLASS1) != FPU_REGS)) \
ff9940b0 1055 ? 20 : 2)
35d965d5
RS
1056\f
1057/* Stack layout; function entry, exit and calling. */
1058
1059/* Define this if pushing a word on the stack
1060 makes the stack pointer a smaller address. */
1061#define STACK_GROWS_DOWNWARD 1
1062
1063/* Define this if the nominal address of the stack frame
1064 is at the high-address end of the local variables;
1065 that is, each additional local variable allocated
1066 goes at a more negative offset in the frame. */
1067#define FRAME_GROWS_DOWNWARD 1
1068
1069/* Offset within stack frame to start allocating local variables at.
1070 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
1071 first local allocated. Otherwise, it is the offset to the BEGINNING
1072 of the first local allocated. */
1073#define STARTING_FRAME_OFFSET 0
1074
1075/* If we generate an insn to push BYTES bytes,
1076 this says how many the stack pointer really advances by. */
18543a22
ILT
1077/* The push insns do not do this rounding implicitly. So don't define this. */
1078/* #define PUSH_ROUNDING(NPUSHED) (((NPUSHED) + 3) & ~3) */
1079
1080/* Define this if the maximum size of all the outgoing args is to be
1081 accumulated and pushed during the prologue. The amount can be
1082 found in the variable current_function_outgoing_args_size. */
6cfc7210 1083#define ACCUMULATE_OUTGOING_ARGS 1
35d965d5
RS
1084
1085/* Offset of first parameter from the argument pointer register value. */
1086#define FIRST_PARM_OFFSET(FNDECL) 4
1087
1088/* Value is the number of byte of arguments automatically
1089 popped when returning from a subroutine call.
8b109b37 1090 FUNDECL is the declaration node of the function (as a tree),
35d965d5
RS
1091 FUNTYPE is the data type of the function (as a tree),
1092 or for a library call it is an identifier node for the subroutine name.
1093 SIZE is the number of bytes of arguments passed on the stack.
1094
1095 On the ARM, the caller does not pop any of its arguments that were passed
1096 on the stack. */
6cfc7210 1097#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) 0
35d965d5
RS
1098
1099/* Define how to find the value returned by a library function
1100 assuming the value has mode MODE. */
1101#define LIBCALL_VALUE(MODE) \
3ada8e17 1102 (GET_MODE_CLASS (MODE) == MODE_FLOAT && TARGET_HARD_FLOAT \
43cffd11
RE
1103 ? gen_rtx_REG (MODE, 16) \
1104 : gen_rtx_REG (MODE, 0))
35d965d5 1105
6cfc7210
NC
1106/* Define how to find the value returned by a function.
1107 VALTYPE is the data type of the value (as a tree).
1108 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1109 otherwise, FUNC is 0. */
1110#define FUNCTION_VALUE(VALTYPE, FUNC) \
1111 LIBCALL_VALUE (TYPE_MODE (VALTYPE))
1112
35d965d5
RS
1113/* 1 if N is a possible register number for a function value.
1114 On the ARM, only r0 and f0 can return results. */
1115#define FUNCTION_VALUE_REGNO_P(REGNO) \
aec3cfba 1116 ((REGNO) == 0 || (((REGNO) == 16) && TARGET_HARD_FLOAT))
35d965d5 1117
11c1a207
RE
1118/* How large values are returned */
1119/* A C expression which can inhibit the returning of certain function values
1120 in registers, based on the type of value. */
f5a1b0d2 1121#define RETURN_IN_MEMORY(TYPE) arm_return_in_memory (TYPE)
11c1a207
RE
1122
1123/* Define DEFAULT_PCC_STRUCT_RETURN to 1 if all structure and union return
1124 values must be in memory. On the ARM, they need only do so if larger
1125 than a word, or if they contain elements offset from zero in the struct. */
1126#define DEFAULT_PCC_STRUCT_RETURN 0
1127
35d965d5
RS
1128/* Define where to put the arguments to a function.
1129 Value is zero to push the argument on the stack,
1130 or a hard register in which to store the argument.
1131
1132 MODE is the argument's machine mode.
1133 TYPE is the data type of the argument (as a tree).
1134 This is null for libcalls where that information may
1135 not be available.
1136 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1137 the preceding args and about the function being called.
1138 NAMED is nonzero if this argument is a named parameter
1139 (otherwise it is an extra parameter matching an ellipsis).
1140
1141 On the ARM, normally the first 16 bytes are passed in registers r0-r3; all
1142 other arguments are passed on the stack. If (NAMED == 0) (which happens
1143 only in assign_parms, since SETUP_INCOMING_VARARGS is defined), say it is
1144 passed in the stack (function_prologue will indeed make it pass in the
1145 stack if necessary). */
6cfc7210 1146#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
35d965d5 1147 ((NAMED) \
6cfc7210 1148 ? ((CUM) >= NUM_ARG_REGS ? 0 : gen_rtx_REG (MODE, CUM))\
35d965d5
RS
1149 : 0)
1150
1151/* For an arg passed partly in registers and partly in memory,
1152 this is the number of registers used.
1153 For args passed entirely in registers or entirely in memory, zero. */
6cfc7210
NC
1154#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
1155 ( NUM_ARG_REGS > (CUM) \
1156 && (NUM_ARG_REGS < ((CUM) + NUM_REGS2 (MODE, TYPE))) \
1157 ? NUM_ARG_REGS - (CUM) : 0)
35d965d5
RS
1158
1159/* A C type for declaring a variable that is used as the first argument of
1160 `FUNCTION_ARG' and other related values. For some target machines, the
1161 type `int' suffices and can hold the number of bytes of argument so far.
1162
1163 On the ARM, this is the number of bytes of arguments scanned so far. */
1164#define CUMULATIVE_ARGS int
1165
1166/* Initialize a variable CUM of type CUMULATIVE_ARGS
1167 for a call to a function whose data type is FNTYPE.
1168 For a library call, FNTYPE is 0.
1169 On the ARM, the offset starts at 0. */
2c7ee1a6 1170#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \
6cfc7210 1171 ((CUM) = (((FNTYPE) && aggregate_value_p (TREE_TYPE ((FNTYPE)))) ? 1 : 0))
35d965d5
RS
1172
1173/* Update the data in CUM to advance over an argument
1174 of mode MODE and data type TYPE.
1175 (TYPE is null for libcalls where that information may not be available.) */
6cfc7210
NC
1176#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1177 (CUM) += NUM_REGS2 (MODE, TYPE)
35d965d5
RS
1178
1179/* 1 if N is a possible register number for function argument passing.
1180 On the ARM, r0-r3 are used to pass args. */
1181#define FUNCTION_ARG_REGNO_P(REGNO) \
1182 ((REGNO) >= 0 && (REGNO) <= 3)
1183
1184/* Perform any actions needed for a function that is receiving a variable
1185 number of arguments. CUM is as above. MODE and TYPE are the mode and type
1186 of the current parameter. PRETEND_SIZE is a variable that should be set to
1187 the amount of stack that must be pushed by the prolog to pretend that our
1188 caller pushed it.
1189
1190 Normally, this macro will push all remaining incoming registers on the
1191 stack and set PRETEND_SIZE to the length of the registers pushed.
1192
1193 On the ARM, PRETEND_SIZE is set in order to have the prologue push the last
1194 named arg and all anonymous args onto the stack.
1195 XXX I know the prologue shouldn't be pushing registers, but it is faster
1196 that way. */
6cfc7210 1197#define SETUP_INCOMING_VARARGS(CUM, MODE, TYPE, PRETEND_SIZE, NO_RTL) \
35d965d5
RS
1198{ \
1199 extern int current_function_anonymous_args; \
1200 current_function_anonymous_args = 1; \
6cfc7210
NC
1201 if ((CUM) < NUM_ARG_REGS) \
1202 (PRETEND_SIZE) = (NUM_ARG_REGS - (CUM)) * UNITS_PER_WORD; \
35d965d5
RS
1203}
1204
1205/* Generate assembly output for the start of a function. */
1206#define FUNCTION_PROLOGUE(STREAM, SIZE) \
008cf58a 1207 output_func_prologue ((STREAM), (SIZE))
35d965d5 1208
afef3d7a
NC
1209/* If your target environment doesn't prefix user functions with an
1210 underscore, you may wish to re-define this to prevent any conflicts.
1211 e.g. AOF may prefix mcount with an underscore. */
1212#ifndef ARM_MCOUNT_NAME
1213#define ARM_MCOUNT_NAME "*mcount"
1214#endif
1215
1216/* Call the function profiler with a given profile label. The Acorn
1217 compiler puts this BEFORE the prolog but gcc puts it afterwards.
1218 On the ARM the full profile code will look like:
1219 .data
1220 LP1
1221 .word 0
1222 .text
1223 mov ip, lr
1224 bl mcount
1225 .word LP1
1226
1227 profile_function() in final.c outputs the .data section, FUNCTION_PROFILER
1228 will output the .text section.
1229
1230 The ``mov ip,lr'' seems like a good idea to stick with cc convention.
1231 ``prof'' doesn't seem to mind about this! */
6cfc7210
NC
1232#define FUNCTION_PROFILER(STREAM, LABELNO) \
1233{ \
1234 char temp[20]; \
1235 rtx sym; \
1236 \
1237 asm_fprintf (STREAM, "\tmov\t%R%s, %R%s\n\tbl\t", \
1238 reg_names[IP_REGNUM] /* ip */, \
1239 reg_names[LR_REGNUM] /* lr */); \
1240 assemble_name (STREAM, ARM_MCOUNT_NAME); \
1241 fputc ('\n', STREAM); \
1242 ASM_GENERATE_INTERNAL_LABEL (temp, "LP", LABELNO); \
1243 sym = gen_rtx (SYMBOL_REF, Pmode, temp); \
1244 ASM_OUTPUT_INT (STREAM, sym); \
35d965d5
RS
1245}
1246
1247/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1248 the stack pointer does not matter. The value is tested only in
1249 functions that have frame pointers.
1250 No definition is equivalent to always zero.
1251
1252 On the ARM, the function epilogue recovers the stack pointer from the
1253 frame. */
1254#define EXIT_IGNORE_STACK 1
1255
1256/* Generate the assembly code for function exit. */
1257#define FUNCTION_EPILOGUE(STREAM, SIZE) \
6cfc7210 1258 output_func_epilogue (STREAM, SIZE)
35d965d5
RS
1259
1260/* Determine if the epilogue should be output as RTL.
1261 You should override this if you define FUNCTION_EXTRA_EPILOGUE. */
b36ba79f 1262#define USE_RETURN_INSN(ISCOND) use_return_insn (ISCOND)
ff9940b0
RE
1263
1264/* Definitions for register eliminations.
1265
1266 This is an array of structures. Each structure initializes one pair
1267 of eliminable registers. The "from" register number is given first,
1268 followed by "to". Eliminations of the same "from" register are listed
1269 in order of preference.
1270
1271 We have two registers that can be eliminated on the ARM. First, the
1272 arg pointer register can often be eliminated in favor of the stack
1273 pointer register. Secondly, the pseudo frame pointer register can always
1274 be eliminated; it is replaced with either the stack or the real frame
1275 pointer. */
1276
1277#define ELIMINABLE_REGS \
6cfc7210
NC
1278{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
1279 { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \
1280 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
1281 { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }}
ff9940b0
RE
1282
1283/* Given FROM and TO register numbers, say whether this elimination is allowed.
1284 Frame pointer elimination is automatically handled.
1285
1286 All eliminations are permissible. Note that ARG_POINTER_REGNUM and
abc95ed3 1287 HARD_FRAME_POINTER_REGNUM are in fact the same thing. If we need a frame
ff9940b0
RE
1288 pointer, we must eliminate FRAME_POINTER_REGNUM into
1289 HARD_FRAME_POINTER_REGNUM and not into STACK_POINTER_REGNUM. */
1290#define CAN_ELIMINATE(FROM, TO) \
1291 (((TO) == STACK_POINTER_REGNUM && frame_pointer_needed) ? 0 : 1)
1292
1293/* Define the offset between two registers, one to be eliminated, and the other
1294 its replacement, at the start of a routine. */
1295#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1296{ \
3967692c 1297 int volatile_func = arm_volatile_func (); \
ff9940b0
RE
1298 if ((FROM) == ARG_POINTER_REGNUM && (TO) == HARD_FRAME_POINTER_REGNUM)\
1299 (OFFSET) = 0; \
18543a22
ILT
1300 else if ((FROM) == FRAME_POINTER_REGNUM \
1301 && (TO) == STACK_POINTER_REGNUM) \
9daca635
NC
1302 (OFFSET) = current_function_outgoing_args_size \
1303 + ((get_frame_size () + 3) & ~3); \
ff9940b0
RE
1304 else \
1305 { \
1306 int regno; \
1307 int offset = 12; \
008cf58a 1308 int saved_hard_reg = 0; \
ff9940b0 1309 \
3967692c
RE
1310 if (! volatile_func) \
1311 { \
1312 for (regno = 0; regno <= 10; regno++) \
1313 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
1314 saved_hard_reg = 1, offset += 4; \
6ed30148
RE
1315 /* PIC register is a fixed reg, so call_used_regs set. */ \
1316 if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM]) \
1317 saved_hard_reg = 1, offset += 4; \
3967692c
RE
1318 for (regno = 16; regno <=23; regno++) \
1319 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
1320 offset += 12; \
1321 } \
ff9940b0
RE
1322 if ((FROM) == FRAME_POINTER_REGNUM) \
1323 (OFFSET) = -offset; \
1324 else \
1325 { \
bd4d60ce 1326 if (! frame_pointer_needed) \
ff9940b0 1327 offset -= 16; \
18543a22 1328 if (! volatile_func \
62b10bbc 1329 && (regs_ever_live[LR_REGNUM] || saved_hard_reg)) \
ff9940b0 1330 offset += 4; \
18543a22 1331 offset += current_function_outgoing_args_size; \
9daca635 1332 (OFFSET) = ((get_frame_size () + 3) & ~3) + offset; \
ff9940b0
RE
1333 } \
1334 } \
1335}
35d965d5 1336
35d965d5
RS
1337/* Output assembler code for a block containing the constant parts
1338 of a trampoline, leaving space for the variable parts.
1339
1340 On the ARM, (if r8 is the static chain regnum, and remembering that
1341 referencing pc adds an offset of 8) the trampoline looks like:
1342 ldr r8, [pc, #0]
1343 ldr pc, [pc]
1344 .word static chain value
11c1a207
RE
1345 .word function's address
1346 ??? FIXME: When the trampoline returns, r8 will be clobbered. */
4eda77ec
RE
1347#define TRAMPOLINE_TEMPLATE(FILE) \
1348{ \
afef3d7a
NC
1349 fprintf ((FILE), "\tldr\t%s%s, [%s%s, #0]\n", \
1350 REGISTER_PREFIX, reg_names[STATIC_CHAIN_REGNUM], \
1351 REGISTER_PREFIX, reg_names[PC_REGNUM]); \
1352 fprintf ((FILE), "\tldr\t%s%s, [%s%s, #0]\n", \
1353 REGISTER_PREFIX, reg_names[PC_REGNUM], \
1354 REGISTER_PREFIX, reg_names[PC_REGNUM]); \
1355 ASM_OUTPUT_INT ((FILE), const0_rtx); \
1356 ASM_OUTPUT_INT ((FILE), const0_rtx); \
35d965d5
RS
1357}
1358
1359/* Length in units of the trampoline for entering a nested function. */
1360#define TRAMPOLINE_SIZE 16
1361
1362/* Alignment required for a trampoline in units. */
1363#define TRAMPOLINE_ALIGN 4
1364
1365/* Emit RTL insns to initialize the variable parts of a trampoline.
1366 FNADDR is an RTX for the address of the function's pure code.
1367 CXT is an RTX for the static chain value for the function. */
1368#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1369{ \
43cffd11 1370 emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 8)), \
35d965d5 1371 (CXT)); \
43cffd11 1372 emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 12)), \
35d965d5
RS
1373 (FNADDR)); \
1374}
1375
35d965d5
RS
1376\f
1377/* Addressing modes, and classification of registers for them. */
1378
1379#define HAVE_POST_INCREMENT 1
6cfc7210 1380#define HAVE_PRE_INCREMENT 1
35d965d5 1381#define HAVE_POST_DECREMENT 1
6cfc7210 1382#define HAVE_PRE_DECREMENT 1
35d965d5
RS
1383
1384/* Macros to check register numbers against specific register classes. */
1385
1386/* These assume that REGNO is a hard or pseudo reg number.
1387 They give nonzero only if REGNO is a hard reg of the suitable class
1388 or a pseudo reg currently allocated to a suitable hard reg.
1389 Since they use reg_renumber, they are safe only once reg_renumber
1390 has been allocated, which happens in local-alloc.c.
1391
1392 On the ARM, don't allow the pc to be used. */
ff9940b0
RE
1393#define REGNO_OK_FOR_BASE_P(REGNO) \
1394 ((REGNO) < 15 || (REGNO) == FRAME_POINTER_REGNUM \
1395 || (REGNO) == ARG_POINTER_REGNUM \
1396 || (unsigned) reg_renumber[(REGNO)] < 15 \
1397 || (unsigned) reg_renumber[(REGNO)] == FRAME_POINTER_REGNUM \
1398 || (unsigned) reg_renumber[(REGNO)] == ARG_POINTER_REGNUM)
1399#define REGNO_OK_FOR_INDEX_P(REGNO) \
35d965d5
RS
1400 REGNO_OK_FOR_BASE_P(REGNO)
1401
1402/* Maximum number of registers that can appear in a valid memory address.
ff9940b0
RE
1403 Shifts in addresses can't be by a register. */
1404
1405#define MAX_REGS_PER_ADDRESS 2
35d965d5
RS
1406
1407/* Recognize any constant value that is a valid address. */
1408/* XXX We can address any constant, eventually... */
11c1a207
RE
1409
1410#ifdef AOF_ASSEMBLER
1411
1412#define CONSTANT_ADDRESS_P(X) \
1413 (GET_CODE (X) == SYMBOL_REF \
1414 && CONSTANT_POOL_ADDRESS_P (X))
1415
1416#else
35d965d5 1417
008cf58a
RE
1418#define CONSTANT_ADDRESS_P(X) \
1419 (GET_CODE (X) == SYMBOL_REF \
1420 && (CONSTANT_POOL_ADDRESS_P (X) \
1421 || (optimize > 0 && SYMBOL_REF_FLAG (X))))
35d965d5 1422
11c1a207
RE
1423#endif /* AOF_ASSEMBLER */
1424
35d965d5
RS
1425/* Nonzero if the constant value X is a legitimate general operand.
1426 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
1427
1428 On the ARM, allow any integer (invalid ones are removed later by insn
1429 patterns), nice doubles and symbol_refs which refer to the function's
1430 constant pool XXX. */
11c1a207 1431#define LEGITIMATE_CONSTANT_P(X) (! label_mentioned_p (X))
ff9940b0
RE
1432
1433/* Symbols in the text segment can be accessed without indirecting via the
1434 constant pool; it may take an extra binary operation, but this is still
008cf58a
RE
1435 faster than indirecting via memory. Don't do this when not optimizing,
1436 since we won't be calculating al of the offsets necessary to do this
1437 simplification. */
11c1a207
RE
1438/* This doesn't work with AOF syntax, since the string table may be in
1439 a different AREA. */
1440#ifndef AOF_ASSEMBLER
ff9940b0
RE
1441#define ENCODE_SECTION_INFO(decl) \
1442{ \
008cf58a 1443 if (optimize > 0 && TREE_CONSTANT (decl) \
ff9940b0 1444 && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST)) \
228b6a3f
RS
1445 { \
1446 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' \
1447 ? TREE_CST_RTL (decl) : DECL_RTL (decl)); \
1448 SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1; \
1449 } \
ff9940b0 1450}
11c1a207 1451#endif
7a801826 1452
35d965d5
RS
1453/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1454 and check its validity for a certain class.
1455 We have two alternate definitions for each of them.
1456 The usual definition accepts all pseudo regs; the other rejects
1457 them unless they have been allocated suitable hard regs.
1458 The symbol REG_OK_STRICT causes the latter definition to be used. */
1459#ifndef REG_OK_STRICT
ff9940b0 1460
35d965d5
RS
1461/* Nonzero if X is a hard reg that can be used as a base reg
1462 or if it is a pseudo reg. */
ff9940b0
RE
1463#define REG_OK_FOR_BASE_P(X) \
1464 (REGNO (X) < 16 || REGNO (X) >= FIRST_PSEUDO_REGISTER \
1465 || REGNO (X) == FRAME_POINTER_REGNUM || REGNO (X) == ARG_POINTER_REGNUM)
1466
35d965d5
RS
1467/* Nonzero if X is a hard reg that can be used as an index
1468 or if it is a pseudo reg. */
1469#define REG_OK_FOR_INDEX_P(X) \
1470 REG_OK_FOR_BASE_P(X)
ff9940b0
RE
1471
1472#define REG_OK_FOR_PRE_POST_P(X) \
1473 (REGNO (X) < 16 || REGNO (X) >= FIRST_PSEUDO_REGISTER \
1474 || REGNO (X) == FRAME_POINTER_REGNUM || REGNO (X) == ARG_POINTER_REGNUM)
1475
35d965d5 1476#else
ff9940b0 1477
35d965d5
RS
1478/* Nonzero if X is a hard reg that can be used as a base reg. */
1479#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
ff9940b0 1480
35d965d5
RS
1481/* Nonzero if X is a hard reg that can be used as an index. */
1482#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
ff9940b0
RE
1483
1484#define REG_OK_FOR_PRE_POST_P(X) \
1485 (REGNO (X) < 16 || (unsigned) reg_renumber[REGNO (X)] < 16 \
1486 || REGNO (X) == FRAME_POINTER_REGNUM || REGNO (X) == ARG_POINTER_REGNUM \
1487 || (unsigned) reg_renumber[REGNO (X)] == FRAME_POINTER_REGNUM \
1488 || (unsigned) reg_renumber[REGNO (X)] == ARG_POINTER_REGNUM)
1489
35d965d5
RS
1490#endif
1491\f
1492/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1493 that is a valid memory address for an instruction.
1494 The MODE argument is the machine mode for the MEM expression
1495 that wants to use this address.
1496
1497 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */
1498#define BASE_REGISTER_RTX_P(X) \
1499 (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))
1500
1501#define INDEX_REGISTER_RTX_P(X) \
1502 (GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X))
1503
1504/* A C statement (sans semicolon) to jump to LABEL for legitimate index RTXs
1505 used by the macro GO_IF_LEGITIMATE_ADDRESS. Floating point indices can
1506 only be small constants. */
62b10bbc
NC
1507#define GO_IF_LEGITIMATE_INDEX(MODE, BASE_REGNO, INDEX, LABEL) \
1508 do \
1509 { \
1510 HOST_WIDE_INT range; \
1511 enum rtx_code code = GET_CODE (INDEX); \
1512 \
1513 if (TARGET_HARD_FLOAT && GET_MODE_CLASS (MODE) == MODE_FLOAT) \
1514 { \
1515 if (code == CONST_INT && INTVAL (INDEX) < 1024 \
1516 && INTVAL (INDEX) > -1024 \
1517 && (INTVAL (INDEX) & 3) == 0) \
1518 goto LABEL; \
1519 } \
1520 else \
1521 { \
1522 if (INDEX_REGISTER_RTX_P (INDEX) && GET_MODE_SIZE (MODE) <= 4) \
1523 goto LABEL; \
1524 if (GET_MODE_SIZE (MODE) <= 4 && code == MULT \
1525 && (! arm_arch4 || (MODE) != HImode)) \
1526 { \
1527 rtx xiop0 = XEXP (INDEX, 0); \
1528 rtx xiop1 = XEXP (INDEX, 1); \
1529 if (INDEX_REGISTER_RTX_P (xiop0) \
1530 && power_of_two_operand (xiop1, SImode)) \
1531 goto LABEL; \
1532 if (INDEX_REGISTER_RTX_P (xiop1) \
1533 && power_of_two_operand (xiop0, SImode)) \
1534 goto LABEL; \
1535 } \
1536 if (GET_MODE_SIZE (MODE) <= 4 \
1537 && (code == LSHIFTRT || code == ASHIFTRT \
1538 || code == ASHIFT || code == ROTATERT) \
1539 && (! arm_arch4 || (MODE) != HImode)) \
1540 { \
1541 rtx op = XEXP (INDEX, 1); \
1542 if (INDEX_REGISTER_RTX_P (XEXP (INDEX, 0)) \
1543 && GET_CODE (op) == CONST_INT && INTVAL (op) > 0 \
1544 && INTVAL (op) <= 31) \
1545 goto LABEL; \
1546 } \
1547 /* NASTY: Since this limits the addressing of unsigned byte loads */ \
1548 range = ((MODE) == HImode || (MODE) == QImode) \
1549 ? (arm_arch4 ? 256 : 4095) : 4096; \
1550 if (code == CONST_INT && INTVAL (INDEX) < range \
1551 && INTVAL (INDEX) > -range) \
1552 goto LABEL; \
1553 } \
1554 } \
1555 while (0)
35d965d5
RS
1556
1557/* Jump to LABEL if X is a valid address RTX. This must also take
1558 REG_OK_STRICT into account when deciding about valid registers, but it uses
1559 the above macros so we are in luck. Allow REG, REG+REG, REG+INDEX,
1560 INDEX+REG, REG-INDEX, and non floating SYMBOL_REF to the constant pool.
ff9940b0
RE
1561 Allow REG-only and AUTINC-REG if handling TImode or HImode. Other symbol
1562 refs must be forced though a static cell to ensure addressability. */
11c1a207 1563#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
35d965d5
RS
1564{ \
1565 if (BASE_REGISTER_RTX_P (X)) \
1566 goto LABEL; \
1567 else if ((GET_CODE (X) == POST_INC || GET_CODE (X) == PRE_DEC) \
1568 && GET_CODE (XEXP (X, 0)) == REG \
1569 && REG_OK_FOR_PRE_POST_P (XEXP (X, 0))) \
1570 goto LABEL; \
11c1a207
RE
1571 else if (GET_MODE_SIZE (MODE) >= 4 && reload_completed \
1572 && (GET_CODE (X) == LABEL_REF \
1573 || (GET_CODE (X) == CONST \
1574 && GET_CODE (XEXP ((X), 0)) == PLUS \
1575 && GET_CODE (XEXP (XEXP ((X), 0), 0)) == LABEL_REF \
1576 && GET_CODE (XEXP (XEXP ((X), 0), 1)) == CONST_INT)))\
1577 goto LABEL; \
35d965d5
RS
1578 else if ((MODE) == TImode) \
1579 ; \
11c1a207
RE
1580 else if ((MODE) == DImode || (TARGET_SOFT_FLOAT && (MODE) == DFmode)) \
1581 { \
1582 if (GET_CODE (X) == PLUS && BASE_REGISTER_RTX_P (XEXP (X, 0)) \
1583 && GET_CODE (XEXP (X, 1)) == CONST_INT) \
1584 { \
1585 HOST_WIDE_INT val = INTVAL (XEXP (X, 1)); \
1586 if (val == 4 || val == -4 || val == -8) \
1587 goto LABEL; \
1588 } \
1589 } \
35d965d5
RS
1590 else if (GET_CODE (X) == PLUS) \
1591 { \
1592 rtx xop0 = XEXP(X,0); \
1593 rtx xop1 = XEXP(X,1); \
1594 \
1595 if (BASE_REGISTER_RTX_P (xop0)) \
1596 GO_IF_LEGITIMATE_INDEX (MODE, REGNO (xop0), xop1, LABEL); \
1597 else if (BASE_REGISTER_RTX_P (xop1)) \
1598 GO_IF_LEGITIMATE_INDEX (MODE, REGNO (xop1), xop0, LABEL); \
1599 } \
18543a22
ILT
1600 /* Reload currently can't handle MINUS, so disable this for now */ \
1601 /* else if (GET_CODE (X) == MINUS) \
35d965d5
RS
1602 { \
1603 rtx xop0 = XEXP (X,0); \
1604 rtx xop1 = XEXP (X,1); \
1605 \
1606 if (BASE_REGISTER_RTX_P (xop0)) \
1607 GO_IF_LEGITIMATE_INDEX (MODE, -1, xop1, LABEL); \
18543a22 1608 } */ \
35d965d5
RS
1609 else if (GET_MODE_CLASS (MODE) != MODE_FLOAT \
1610 && GET_CODE (X) == SYMBOL_REF \
43cffd11
RE
1611 && CONSTANT_POOL_ADDRESS_P (X) \
1612 && ! (flag_pic \
1613 && symbol_mentioned_p (get_pool_constant (X)))) \
35d965d5
RS
1614 goto LABEL; \
1615 else if ((GET_CODE (X) == PRE_INC || GET_CODE (X) == POST_DEC) \
11c1a207 1616 && (GET_MODE_SIZE (MODE) <= 4) \
35d965d5
RS
1617 && GET_CODE (XEXP (X, 0)) == REG \
1618 && REG_OK_FOR_PRE_POST_P (XEXP (X, 0))) \
1619 goto LABEL; \
1620}
1621\f
1622/* Try machine-dependent ways of modifying an illegitimate address
1623 to be legitimate. If we find one, return the new, valid address.
1624 This macro is used in only one place: `memory_address' in explow.c.
1625
1626 OLDX is the address as it was before break_out_memory_refs was called.
1627 In some cases it is useful to look at this to decide what needs to be done.
1628
1629 MODE and WIN are passed so that this macro can use
1630 GO_IF_LEGITIMATE_ADDRESS.
1631
1632 It is always safe for this macro to do nothing. It exists to recognize
1633 opportunities to optimize the output.
1634
1635 On the ARM, try to convert [REG, #BIGCONST]
1636 into ADD BASE, REG, #UPPERCONST and [BASE, #VALIDCONST],
1637 where VALIDCONST == 0 in case of TImode. */
3967692c
RE
1638#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
1639{ \
1640 if (GET_CODE (X) == PLUS) \
1641 { \
1642 rtx xop0 = XEXP (X, 0); \
1643 rtx xop1 = XEXP (X, 1); \
1644 \
11c1a207 1645 if (CONSTANT_P (xop0) && ! symbol_mentioned_p (xop0)) \
3967692c 1646 xop0 = force_reg (SImode, xop0); \
11c1a207 1647 if (CONSTANT_P (xop1) && ! symbol_mentioned_p (xop1)) \
3967692c
RE
1648 xop1 = force_reg (SImode, xop1); \
1649 if (BASE_REGISTER_RTX_P (xop0) && GET_CODE (xop1) == CONST_INT) \
1650 { \
1651 HOST_WIDE_INT n, low_n; \
1652 rtx base_reg, val; \
1653 n = INTVAL (xop1); \
1654 \
11c1a207 1655 if (MODE == DImode || (TARGET_SOFT_FLOAT && MODE == DFmode)) \
3967692c
RE
1656 { \
1657 low_n = n & 0x0f; \
1658 n &= ~0x0f; \
1659 if (low_n > 4) \
1660 { \
1661 n += 16; \
1662 low_n -= 16; \
1663 } \
1664 } \
1665 else \
1666 { \
1667 low_n = ((MODE) == TImode ? 0 \
1668 : n >= 0 ? (n & 0xfff) : -((-n) & 0xfff)); \
1669 n -= low_n; \
1670 } \
1671 base_reg = gen_reg_rtx (SImode); \
43cffd11
RE
1672 val = force_operand (gen_rtx_PLUS (SImode, xop0, \
1673 GEN_INT (n)), NULL_RTX); \
3967692c
RE
1674 emit_move_insn (base_reg, val); \
1675 (X) = (low_n == 0 ? base_reg \
43cffd11 1676 : gen_rtx_PLUS (SImode, base_reg, GEN_INT (low_n))); \
3967692c
RE
1677 } \
1678 else if (xop0 != XEXP (X, 0) || xop1 != XEXP (x, 1)) \
43cffd11 1679 (X) = gen_rtx_PLUS (SImode, xop0, xop1); \
3967692c
RE
1680 } \
1681 else if (GET_CODE (X) == MINUS) \
1682 { \
1683 rtx xop0 = XEXP (X, 0); \
1684 rtx xop1 = XEXP (X, 1); \
1685 \
1686 if (CONSTANT_P (xop0)) \
1687 xop0 = force_reg (SImode, xop0); \
11c1a207 1688 if (CONSTANT_P (xop1) && ! symbol_mentioned_p (xop1)) \
3967692c
RE
1689 xop1 = force_reg (SImode, xop1); \
1690 if (xop0 != XEXP (X, 0) || xop1 != XEXP (X, 1)) \
43cffd11 1691 (X) = gen_rtx_MINUS (SImode, xop0, xop1); \
3967692c 1692 } \
7a801826
RE
1693 if (flag_pic) \
1694 (X) = legitimize_pic_address (OLDX, MODE, NULL_RTX); \
3967692c
RE
1695 if (memory_address_p (MODE, X)) \
1696 goto WIN; \
35d965d5
RS
1697}
1698
1699/* Go to LABEL if ADDR (a legitimate address expression)
1700 has an effect that depends on the machine mode it is used for. */
1701#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1702{ \
1703 if (GET_CODE(ADDR) == PRE_DEC || GET_CODE(ADDR) == POST_DEC \
1704 || GET_CODE(ADDR) == PRE_INC || GET_CODE(ADDR) == POST_INC) \
1705 goto LABEL; \
1706}
1707\f
1708/* Specify the machine mode that this machine uses
1709 for the index in the tablejump instruction. */
1710#define CASE_VECTOR_MODE SImode
1711
18543a22
ILT
1712/* Define as C expression which evaluates to nonzero if the tablejump
1713 instruction expects the table to contain offsets from the address of the
1714 table.
1715 Do not define this if the table should contain absolute addresses. */
1716/* #define CASE_VECTOR_PC_RELATIVE 1 */
35d965d5
RS
1717
1718/* Specify the tree operation to be used to convert reals to integers. */
1719#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1720
1721/* This is the kind of divide that is easiest to do in the general case. */
1722#define EASY_DIV_EXPR TRUNC_DIV_EXPR
1723
ff9940b0
RE
1724/* signed 'char' is most compatible, but RISC OS wants it unsigned.
1725 unsigned is probably best, but may break some code. */
1726#ifndef DEFAULT_SIGNED_CHAR
3967692c 1727#define DEFAULT_SIGNED_CHAR 0
35d965d5
RS
1728#endif
1729
1730/* Don't cse the address of the function being compiled. */
1731#define NO_RECURSIVE_FUNCTION_CSE 1
1732
1733/* Max number of bytes we can move from memory to memory
d17ce9af
TG
1734 in one reasonably fast instruction. */
1735#define MOVE_MAX 4
35d965d5 1736
ff9940b0
RE
1737/* Define if operations between registers always perform the operation
1738 on the full register even if a narrower mode is specified. */
1739#define WORD_REGISTER_OPERATIONS
1740
1741/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
1742 will either zero-extend or sign-extend. The value of this macro should
1743 be the code that says which one of the two operations is implicitly
1744 done, NIL if none. */
9c872872 1745#define LOAD_EXTEND_OP(MODE) \
11c1a207 1746 ((arm_arch4 || (MODE) == QImode) ? ZERO_EXTEND \
9c872872 1747 : ((BYTES_BIG_ENDIAN && (MODE) == HImode) ? SIGN_EXTEND : NIL))
ff9940b0 1748
35d965d5
RS
1749/* Define this if zero-extension is slow (more than one real instruction).
1750 On the ARM, it is more than one instruction only if not fetching from
1751 memory. */
1752/* #define SLOW_ZERO_EXTEND */
1753
1754/* Nonzero if access to memory by bytes is slow and undesirable. */
1755#define SLOW_BYTE_ACCESS 0
1756
1757/* Immediate shift counts are truncated by the output routines (or was it
1758 the assembler?). Shift counts in a register are truncated by ARM. Note
1759 that the native compiler puts too large (> 32) immediate shift counts
1760 into a register and shifts by the register, letting the ARM decide what
1761 to do instead of doing that itself. */
ff9940b0
RE
1762/* This is all wrong. Defining SHIFT_COUNT_TRUNCATED tells combine that
1763 code like (X << (Y % 32)) for register X, Y is equivalent to (X << Y).
1764 On the arm, Y in a register is used modulo 256 for the shift. Only for
1765 rotates is modulo 32 used. */
1766/* #define SHIFT_COUNT_TRUNCATED 1 */
35d965d5 1767
35d965d5
RS
1768/* All integers have the same format so truncation is easy. */
1769#define TRULY_NOOP_TRUNCATION(OUTPREC,INPREC) 1
1770
1771/* Calling from registers is a massive pain. */
1772#define NO_FUNCTION_CSE 1
1773
1774/* Chars and shorts should be passed as ints. */
1775#define PROMOTE_PROTOTYPES 1
1776
35d965d5
RS
1777/* The machine modes of pointers and functions */
1778#define Pmode SImode
1779#define FUNCTION_MODE Pmode
1780
1781/* The structure type of the machine dependent info field of insns
1782 No uses for this yet. */
1783/* #define INSN_MACHINE_INFO struct machine_info */
1784
1785/* The relative costs of various types of constants. Note that cse.c defines
1786 REG = 1, SUBREG = 2, any node = (2 + sum of subnodes). */
ff9940b0
RE
1787#define CONST_COSTS(RTX, CODE, OUTER_CODE) \
1788 case CONST_INT: \
1789 if (const_ok_for_arm (INTVAL (RTX))) \
1790 return (OUTER_CODE) == SET ? 2 : -1; \
1791 else if (OUTER_CODE == AND \
1792 && const_ok_for_arm (~INTVAL (RTX))) \
1793 return -1; \
1794 else if ((OUTER_CODE == COMPARE \
1795 || OUTER_CODE == PLUS || OUTER_CODE == MINUS) \
1796 && const_ok_for_arm (-INTVAL (RTX))) \
1797 return -1; \
1798 else \
1799 return 5; \
1800 case CONST: \
1801 case LABEL_REF: \
1802 case SYMBOL_REF: \
1803 return 6; \
1804 case CONST_DOUBLE: \
1805 if (const_double_rtx_ok_for_fpu (RTX)) \
1806 return (OUTER_CODE) == SET ? 2 : -1; \
1807 else if (((OUTER_CODE) == COMPARE || (OUTER_CODE) == PLUS) \
1808 && neg_const_double_rtx_ok_for_fpu (RTX)) \
1809 return -1; \
1810 return(7);
1811
3967692c
RE
1812#define ARM_FRAME_RTX(X) \
1813 ((X) == frame_pointer_rtx || (X) == stack_pointer_rtx \
1814 || (X) == arg_pointer_rtx)
1815
62b10bbc 1816#define DEFAULT_RTX_COSTS(X, CODE, OUTER_CODE) \
6cfc7210 1817 return arm_rtx_costs (X, CODE);
ff9940b0
RE
1818
1819/* Moves to and from memory are quite expensive */
cbd5b9a2 1820#define MEMORY_MOVE_COST(MODE,CLASS,IN) 10
ff9940b0 1821
3967692c 1822/* All address computations that can be done are free, but rtx cost returns
ddd5a7c1 1823 the same for practically all of them. So we weight the different types
3967692c
RE
1824 of address here in the order (most pref first):
1825 PRE/POST_INC/DEC, SHIFT or NON-INT sum, INT sum, REG, MEM or LABEL. */
1826#define ADDRESS_COST(X) \
1827 (10 - ((GET_CODE (X) == MEM || GET_CODE (X) == LABEL_REF \
1828 || GET_CODE (X) == SYMBOL_REF) \
1829 ? 0 \
1830 : ((GET_CODE (X) == PRE_INC || GET_CODE (X) == PRE_DEC \
1831 || GET_CODE (X) == POST_INC || GET_CODE (X) == POST_DEC) \
1832 ? 10 \
1833 : (((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS) \
1834 ? 6 + (GET_CODE (XEXP (X, 1)) == CONST_INT ? 2 \
1835 : ((GET_RTX_CLASS (GET_CODE (XEXP (X, 0))) == '2' \
1836 || GET_RTX_CLASS (GET_CODE (XEXP (X, 0))) == 'c' \
1837 || GET_RTX_CLASS (GET_CODE (XEXP (X, 1))) == '2' \
1838 || GET_RTX_CLASS (GET_CODE (XEXP (X, 1))) == 'c') \
1839 ? 1 : 0)) \
1840 : 4)))))
ff9940b0
RE
1841
1842/* Try to generate sequences that don't involve branches, we can then use
1843 conditional instructions */
1844#define BRANCH_COST 4
7a801826
RE
1845
1846/* A C statement to update the variable COST based on the relationship
1847 between INSN that is dependent on DEP through dependence LINK. */
6cfc7210
NC
1848#define ADJUST_COST(INSN, LINK, DEP, COST) \
1849 (COST) = arm_adjust_cost (INSN, LINK, DEP, COST)
7a801826
RE
1850\f
1851/* Position Independent Code. */
1852/* We decide which register to use based on the compilation options and
1853 the assembler in use; this is more general than the APCS restriction of
1854 using sb (r9) all the time. */
1855extern int arm_pic_register;
1856
ed0e6530
PB
1857/* Used when parsing command line option -mpic-register=. */
1858extern const char * arm_pic_register_string;
1859
7a801826
RE
1860/* The register number of the register used to address a table of static
1861 data addresses in memory. */
1862#define PIC_OFFSET_TABLE_REGNUM arm_pic_register
1863
1864#define FINALIZE_PIC arm_finalize_pic ()
1865
f5a1b0d2
NC
1866/* We can't directly access anything that contains a symbol,
1867 nor can we indirect via the constant pool. */
43cffd11
RE
1868#define LEGITIMATE_PIC_OPERAND_P(X) \
1869 (! symbol_mentioned_p (X) \
1870 && (! CONSTANT_POOL_ADDRESS_P (X) \
1871 || ! symbol_mentioned_p (get_pool_constant (X))))
13bd191d
PB
1872
1873/* We need to know when we are making a constant pool; this determines
1874 whether data needs to be in the GOT or can be referenced via a GOT
1875 offset. */
1876extern int making_const_table;
7a801826 1877
35d965d5 1878\f
ff9940b0
RE
1879/* Condition code information. */
1880/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
1881 return the mode to be used for the comparison.
ddd5a7c1 1882 CCFPEmode should be used with floating inequalities,
ff9940b0 1883 CCFPmode should be used with floating equalities.
ddd5a7c1 1884 CC_NOOVmode should be used with SImode integer equalities.
69fcc21d 1885 CC_Zmode should be used if only the Z flag is set correctly
ff9940b0
RE
1886 CCmode should be used otherwise. */
1887
89c7ca52
RE
1888#define EXTRA_CC_MODES CC_NOOVmode, CC_Zmode, CC_SWPmode, \
1889 CCFPmode, CCFPEmode, CC_DNEmode, CC_DEQmode, CC_DLEmode, \
1890 CC_DLTmode, CC_DGEmode, CC_DGTmode, CC_DLEUmode, CC_DLTUmode, \
62dd06ea 1891 CC_DGEUmode, CC_DGTUmode, CC_Cmode
89c7ca52
RE
1892
1893#define EXTRA_CC_NAMES "CC_NOOV", "CC_Z", "CC_SWP", "CCFP", "CCFPE", \
1894 "CC_DNE", "CC_DEQ", "CC_DLE", "CC_DLT", "CC_DGE", "CC_DGT", "CC_DLEU", \
62dd06ea 1895 "CC_DLTU", "CC_DGEU", "CC_DGTU", "CC_C"
89c7ca52 1896
89c7ca52 1897#define SELECT_CC_MODE(OP,X,Y) arm_select_cc_mode ((OP), (X), (Y))
ff9940b0 1898
008cf58a
RE
1899#define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode)
1900
62b10bbc
NC
1901#define CANONICALIZE_COMPARISON(CODE, OP0, OP1) \
1902 do \
1903 { \
1904 if (GET_CODE (OP1) == CONST_INT \
1905 && ! (const_ok_for_arm (INTVAL (OP1)) \
1906 || (const_ok_for_arm (- INTVAL (OP1))))) \
1907 { \
1908 rtx const_op = OP1; \
1909 CODE = arm_canonicalize_comparison ((CODE), &const_op); \
1910 OP1 = const_op; \
1911 } \
1912 } \
1913 while (0)
62dd06ea 1914
ff9940b0
RE
1915#define STORE_FLAG_VALUE 1
1916
1917/* Define the information needed to generate branch insns. This is
1918 stored from the compare operation. Note that we can't use "rtx" here
1919 since it hasn't been defined! */
1920
62b10bbc
NC
1921extern struct rtx_def * arm_compare_op0;
1922extern struct rtx_def * arm_compare_op1;
ff9940b0
RE
1923
1924/* Define the codes that are matched by predicates in arm.c */
1925#define PREDICATE_CODES \
1926 {"s_register_operand", {SUBREG, REG}}, \
71791e16 1927 {"f_register_operand", {SUBREG, REG}}, \
ff9940b0
RE
1928 {"arm_add_operand", {SUBREG, REG, CONST_INT}}, \
1929 {"fpu_add_operand", {SUBREG, REG, CONST_DOUBLE}}, \
1930 {"arm_rhs_operand", {SUBREG, REG, CONST_INT}}, \
1931 {"fpu_rhs_operand", {SUBREG, REG, CONST_DOUBLE}}, \
1932 {"arm_not_operand", {SUBREG, REG, CONST_INT}}, \
69fcc21d 1933 {"offsettable_memory_operand", {MEM}}, \
4d818c85 1934 {"bad_signed_byte_operand", {MEM}}, \
69fcc21d 1935 {"alignable_memory_operand", {MEM}}, \
ff9940b0
RE
1936 {"shiftable_operator", {PLUS, MINUS, AND, IOR, XOR}}, \
1937 {"minmax_operator", {SMIN, SMAX, UMIN, UMAX}}, \
3967692c 1938 {"shift_operator", {ASHIFT, ASHIFTRT, LSHIFTRT, ROTATERT, MULT}}, \
ff9940b0 1939 {"di_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE, MEM}}, \
c383667d 1940 {"soft_df_operand", {SUBREG, REG, CONST_DOUBLE, MEM}}, \
ff9940b0
RE
1941 {"load_multiple_operation", {PARALLEL}}, \
1942 {"store_multiple_operation", {PARALLEL}}, \
1943 {"equality_operator", {EQ, NE}}, \
1944 {"arm_rhsm_operand", {SUBREG, REG, CONST_INT, MEM}}, \
1945 {"const_shift_operand", {CONST_INT}}, \
1946 {"index_operand", {SUBREG, REG, CONST_INT}}, \
3967692c
RE
1947 {"reg_or_int_operand", {SUBREG, REG, CONST_INT}}, \
1948 {"multi_register_push", {PARALLEL}}, \
31e6408a 1949 {"cc_register", {REG}}, \
89c7ca52 1950 {"dominant_cc_register", {REG}},
ff9940b0 1951
35d965d5 1952\f
35d965d5 1953
11c1a207
RE
1954/* Gcc puts the pool in the wrong place for ARM, since we can only
1955 load addresses a limited distance around the pc. We do some
1956 special munging to move the constant pool values to the correct
1957 point in the code. */
1958#define MACHINE_DEPENDENT_REORG(INSN) arm_reorg ((INSN))
35d965d5 1959
11c1a207
RE
1960/* The pool is empty, since we have moved everything into the code. */
1961#define ASM_OUTPUT_SPECIAL_POOL_ENTRY(FILE,X,MODE,ALIGN,LABELNO,JUMPTO) \
1962 goto JUMPTO
35d965d5
RS
1963
1964/* Output an internal label definition. */
b355a481 1965#ifndef ASM_OUTPUT_INTERNAL_LABEL
62b10bbc
NC
1966#define ASM_OUTPUT_INTERNAL_LABEL(STREAM, PREFIX, NUM) \
1967 do \
1968 { \
2a5307b1 1969 char * s = (char *) alloca (40 + strlen (PREFIX)); \
62b10bbc
NC
1970 \
1971 if (arm_ccfsm_state == 3 && arm_target_label == (NUM) \
1972 && !strcmp (PREFIX, "L")) \
18543a22 1973 { \
62b10bbc 1974 arm_ccfsm_state = 0; \
18543a22
ILT
1975 arm_target_insn = NULL; \
1976 } \
62b10bbc
NC
1977 ASM_GENERATE_INTERNAL_LABEL (s, (PREFIX), (NUM)); \
1978 ASM_OUTPUT_LABEL (STREAM, s); \
1979 } \
1980 while (0)
b355a481 1981#endif
2a5307b1 1982
35d965d5 1983/* Output a push or a pop instruction (only used when profiling). */
6cfc7210
NC
1984#define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
1985 asm_fprintf (STREAM,"\tstmfd\t%Rsp!,{%R%s}\n", \
1986 reg_names [REGNO])
1987
1988#define ASM_OUTPUT_REG_POP(STREAM, REGNO) \
1989 asm_fprintf (STREAM,"\tldmfd\t%Rsp!,{%R%s}\n", \
1990 reg_names [REGNO])
35d965d5 1991
6cfc7210
NC
1992#define ARM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
1993 do \
1994 { \
1995 if (TARGET_POKE_FUNCTION_NAME) \
1996 arm_poke_function_name (STREAM, NAME); \
1997 } \
1998 while (0)
35d965d5 1999
35d965d5
RS
2000/* Target characters. */
2001#define TARGET_BELL 007
2002#define TARGET_BS 010
2003#define TARGET_TAB 011
2004#define TARGET_NEWLINE 012
2005#define TARGET_VT 013
2006#define TARGET_FF 014
2007#define TARGET_CR 015
2008\f
35d965d5
RS
2009/* Only perform branch elimination (by making instructions conditional) if
2010 we're optimising. Otherwise it's of no use anyway. */
2011#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
2012 if (optimize) \
74bbc178 2013 arm_final_prescan_insn (INSN)
35d965d5 2014
7bc7696c
RE
2015#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
2016 ((CODE) == '?' || (CODE) == '|' || (CODE) == '@')
6cfc7210 2017
7bc7696c 2018/* Output an operand of an instruction. */
35d965d5 2019#define PRINT_OPERAND(STREAM, X, CODE) \
7bc7696c
RE
2020 arm_print_operand (STREAM, X, CODE)
2021
2022#define ARM_SIGN_EXTEND(x) ((HOST_WIDE_INT) \
2023 (HOST_BITS_PER_WIDE_INT <= 32 ? (x) \
2024 : (((x) & (unsigned HOST_WIDE_INT) 0xffffffff) | \
2025 (((x) & (unsigned HOST_WIDE_INT) 0x80000000) \
2026 ? ((~ (HOST_WIDE_INT) 0) \
2027 & ~ (unsigned HOST_WIDE_INT) 0xffffffff) \
2028 : 0))))
35d965d5
RS
2029
2030/* Output the address of an operand. */
2031#define PRINT_OPERAND_ADDRESS(STREAM,X) \
2032{ \
2033 int is_minus = GET_CODE (X) == MINUS; \
2034 \
2035 if (GET_CODE (X) == REG) \
6cfc7210 2036 asm_fprintf (STREAM, "[%R%s, #0]", reg_names[REGNO (X)]); \
35d965d5
RS
2037 else if (GET_CODE (X) == PLUS || is_minus) \
2038 { \
2039 rtx base = XEXP (X, 0); \
2040 rtx index = XEXP (X, 1); \
2a5307b1 2041 char * base_reg_name; \
7bc7696c 2042 HOST_WIDE_INT offset = 0; \
35d965d5
RS
2043 if (GET_CODE (base) != REG) \
2044 { \
2045 /* Ensure that BASE is a register (one of them must be). */ \
2046 rtx temp = base; \
2047 base = index; \
2048 index = temp; \
2049 } \
2050 base_reg_name = reg_names[REGNO (base)]; \
2051 switch (GET_CODE (index)) \
2052 { \
2053 case CONST_INT: \
2054 offset = INTVAL (index); \
2055 if (is_minus) \
2056 offset = -offset; \
6cfc7210 2057 asm_fprintf (STREAM, "[%R%s, #%d]", base_reg_name, offset); \
35d965d5
RS
2058 break; \
2059 \
2060 case REG: \
6cfc7210
NC
2061 asm_fprintf (STREAM, "[%R%s, %s%R%s]", \
2062 base_reg_name, is_minus ? "-" : "", \
2063 reg_names[REGNO (index)] ); \
35d965d5
RS
2064 break; \
2065 \
2066 case MULT: \
ff9940b0
RE
2067 case ASHIFTRT: \
2068 case LSHIFTRT: \
2069 case ASHIFT: \
ff9940b0
RE
2070 case ROTATERT: \
2071 { \
6cfc7210
NC
2072 asm_fprintf (STREAM, "[%R%s, %s%R%s", \
2073 base_reg_name, is_minus ? "-" : "", \
2074 reg_names[REGNO (XEXP (index, 0))]); \
7bc7696c
RE
2075 arm_print_operand (STREAM, index, 'S'); \
2076 fputs ("]", STREAM); \
ff9940b0
RE
2077 break; \
2078 } \
35d965d5
RS
2079 \
2080 default: \
2081 abort(); \
2082 } \
2083 } \
2084 else if (GET_CODE (X) == PRE_INC || GET_CODE (X) == POST_INC \
2085 || GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_DEC) \
2086 { \
2087 extern int output_memory_reference_mode; \
2088 \
2089 if (GET_CODE (XEXP (X, 0)) != REG) \
2090 abort (); \
2091 \
2092 if (GET_CODE (X) == PRE_DEC || GET_CODE (X) == PRE_INC) \
6cfc7210
NC
2093 asm_fprintf (STREAM, "[%R%s, #%s%d]!", \
2094 reg_names[REGNO (XEXP (X, 0))], \
2095 GET_CODE (X) == PRE_DEC ? "-" : "", \
2096 GET_MODE_SIZE (output_memory_reference_mode)); \
35d965d5 2097 else \
6cfc7210
NC
2098 asm_fprintf (STREAM, "[%R%s], #%s%d", \
2099 reg_names[REGNO (XEXP (X, 0))], \
2100 GET_CODE (X) == POST_DEC ? "-" : "", \
2101 GET_MODE_SIZE (output_memory_reference_mode)); \
35d965d5 2102 } \
13bd191d 2103 else output_addr_const (STREAM, X); \
35d965d5 2104}
62dd06ea 2105
7a801826 2106/* Handles PIC addr specially */
13bd191d 2107#define OUTPUT_INT_ADDR_CONST(STREAM,X) \
7a801826 2108 { \
13bd191d 2109 if (flag_pic && GET_CODE (X) == CONST && is_pic (X)) \
7a801826 2110 { \
13bd191d
PB
2111 output_addr_const (STREAM, XEXP (XEXP (XEXP (X, 0), 0), 0)); \
2112 fputs (" - (", STREAM); \
2113 output_addr_const (STREAM, XEXP (XEXP (XEXP (X, 0), 1), 0)); \
2114 fputs (")", STREAM); \
7a801826 2115 } \
13bd191d 2116 else output_addr_const (STREAM, X); \
687f77a1
NC
2117 \
2118 /* Mark symbols as position independent. We only do this in the \
2119 .text segment, not in the .data segment. */ \
ed0e6530 2120 if (NEED_GOT_RELOC && flag_pic && making_const_table && \
687f77a1
NC
2121 (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == LABEL_REF)) \
2122 { \
2123 if (GET_CODE (X) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (X)) \
2124 fprintf (STREAM, "(GOTOFF)"); \
2125 else if (GET_CODE (X) == LABEL_REF) \
2126 fprintf (STREAM, "(GOTOFF)"); \
2127 else \
2128 fprintf (STREAM, "(GOT)"); \
2129 } \
7a801826
RE
2130 }
2131
62dd06ea
RE
2132/* Output code to add DELTA to the first argument, and then jump to FUNCTION.
2133 Used for C++ multiple inheritance. */
62b10bbc
NC
2134#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
2135 do \
2136 { \
2137 int mi_delta = (DELTA); \
2138 char * mi_op = mi_delta < 0 ? "sub" : "add"; \
2139 int shift = 0; \
2140 int this_regno = (aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) \
2141 ? 1 : 0); \
2142 if (mi_delta < 0) mi_delta = -mi_delta; \
2143 while (mi_delta != 0) \
2144 { \
2145 if (mi_delta & (3 << shift) == 0) \
2146 shift += 2; \
2147 else \
2148 { \
6cfc7210
NC
2149 asm_fprintf (FILE, "\t%s\t%R%s, %R%s, #%d\n", \
2150 mi_op, reg_names[this_regno], \
2151 reg_names[this_regno], \
2152 mi_delta & (0xff << shift)); \
62b10bbc
NC
2153 mi_delta &= ~(0xff << shift); \
2154 shift += 8; \
2155 } \
2156 } \
2157 fputs ("\tb\t", FILE); \
2158 assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \
ed0e6530 2159 if (NEED_PLT_RELOC) \
62b10bbc
NC
2160 fputs ("(PLT)", FILE); \
2161 fputc ('\n', FILE); \
2162 } \
2163 while (0)
39950dff 2164
6a5d7526
MS
2165/* A C expression whose value is RTL representing the value of the return
2166 address for the frame COUNT steps up from the current frame. */
2167
2168#define RETURN_ADDR_RTX(COUNT, FRAME) \
2169 ((COUNT == 0) \
43cffd11 2170 ? gen_rtx_MEM (Pmode, plus_constant (FRAME, -4)) \
18543a22 2171 : NULL_RTX)
6a5d7526 2172
39950dff
MS
2173/* Used to mask out junk bits from the return address, such as
2174 processor state, interrupt status, condition codes and the like. */
2175#define MASK_RETURN_ADDR \
2176 /* If we are generating code for an ARM2/ARM3 machine or for an ARM6 \
2177 in 26 bit mode, the condition codes must be masked out of the \
2178 return address. This does not apply to ARM6 and later processors \
2179 when running in 32 bit mode. */ \
7a801826 2180 ((!TARGET_APCS_32) ? (GEN_INT (0x03fffffc)) : (GEN_INT (0xffffffff)))
71791e16 2181
0e8285f1
RE
2182/* The remainder of this file is only needed for building the compiler
2183 itself, not for the collateral. */
2184#ifdef HAVE_CONFIG_H
2185
2186/* Prototypes for functions in arm.c */
aec3cfba
NC
2187
2188#ifdef BUFSIZ /* stdio.h has been included, ok to use FILE * */
2189#define STDIO_PROTO(ARGS) PROTO (ARGS)
2190#else
2191#define STDIO_PROTO(ARGS) ()
2192#endif
2193
2194#ifndef TREE_CODE
2195union tree_node;
2196#define Tree union tree_node *
2197#else
2198#define Tree tree
2199#endif
2200
2201#ifndef RTX_CODE
2202struct rtx_def;
2203#define Rtx struct rtx_def *
2204#else
2205#define Rtx rtx
2206#endif
2207
2208#ifndef HOST_WIDE_INT
2209#include "hwint.h"
2210#endif
6cfc7210 2211
aec3cfba
NC
2212#define Hint HOST_WIDE_INT
2213
2214#ifndef HAVE_MACHINE_MODES
2215#include "machmode.h"
2216#endif
6cfc7210 2217
aec3cfba
NC
2218#define Mmode enum machine_mode
2219
2220#ifdef RTX_CODE
2221#define RTX_CODE_PROTO(ARGS) PROTO (ARGS)
2222#else
2223#define RTX_CODE_PROTO(ARGS) ()
2224#endif
6cfc7210 2225
aec3cfba
NC
2226#define Rcode enum rtx_code
2227
2228void arm_override_options PROTO ((void));
2229int use_return_insn PROTO ((int));
2230int const_ok_for_arm PROTO ((Hint));
aec3cfba
NC
2231int arm_split_constant RTX_CODE_PROTO ((Rcode, Mmode, Hint, Rtx, Rtx, int));
2232Rcode arm_canonicalize_comparison RTX_CODE_PROTO ((Rcode, Rtx *));
2233int arm_return_in_memory PROTO ((Tree));
2234int legitimate_pic_operand_p PROTO ((Rtx));
2235Rtx legitimize_pic_address PROTO ((Rtx, Mmode, Rtx));
2236int is_pic PROTO ((Rtx));
2237void arm_finalize_pic PROTO ((void));
74bbc178 2238int arm_rtx_costs RTX_CODE_PROTO ((Rtx, Rcode));
aec3cfba
NC
2239int arm_adjust_cost PROTO ((Rtx, Rtx, Rtx, int));
2240int const_double_rtx_ok_for_fpu PROTO ((Rtx));
2241int neg_const_double_rtx_ok_for_fpu PROTO ((Rtx));
2242int s_register_operand PROTO ((Rtx, Mmode));
2243int f_register_operand PROTO ((Rtx, Mmode));
2244int reg_or_int_operand PROTO ((Rtx, Mmode));
2245int reload_memory_operand PROTO ((Rtx, Mmode));
2246int arm_rhs_operand PROTO ((Rtx, Mmode));
2247int arm_rhsm_operand PROTO ((Rtx, Mmode));
2248int arm_add_operand PROTO ((Rtx, Mmode));
2249int arm_not_operand PROTO ((Rtx, Mmode));
2250int offsettable_memory_operand PROTO ((Rtx, Mmode));
2251int alignable_memory_operand PROTO ((Rtx, Mmode));
2252int bad_signed_byte_operand PROTO ((Rtx, Mmode));
2253int fpu_rhs_operand PROTO ((Rtx, Mmode));
2254int fpu_add_operand PROTO ((Rtx, Mmode));
2255int power_of_two_operand PROTO ((Rtx, Mmode));
2256int di_operand PROTO ((Rtx, Mmode));
2257int soft_df_operand PROTO ((Rtx, Mmode));
2258int index_operand PROTO ((Rtx, Mmode));
2259int const_shift_operand PROTO ((Rtx, Mmode));
2260int shiftable_operator PROTO ((Rtx, Mmode));
2261int shift_operator PROTO ((Rtx, Mmode));
2262int equality_operator PROTO ((Rtx, Mmode));
2263int minmax_operator PROTO ((Rtx, Mmode));
2264int cc_register PROTO ((Rtx, Mmode));
2265int dominant_cc_register PROTO ((Rtx, Mmode));
2266int symbol_mentioned_p PROTO ((Rtx));
2267int label_mentioned_p PROTO ((Rtx));
2268Rcode minmax_code PROTO ((Rtx));
2269int adjacent_mem_locations PROTO ((Rtx, Rtx));
2270int load_multiple_operation PROTO ((Rtx, Mmode));
2271int store_multiple_operation PROTO ((Rtx, Mmode));
2272int load_multiple_sequence PROTO ((Rtx *, int, int *, int *, Hint *));
2273char * emit_ldm_seq PROTO ((Rtx *, int));
2274int store_multiple_sequence PROTO ((Rtx *, int, int *, int *, Hint *));
2275char * emit_stm_seq PROTO ((Rtx *, int));
74bbc178 2276int arm_valid_machine_decl_attribute PROTO ((Tree, Tree, Tree));
aec3cfba
NC
2277Rtx arm_gen_load_multiple PROTO ((int, int, Rtx, int, int, int, int, int));
2278Rtx arm_gen_store_multiple PROTO ((int, int, Rtx, int, int, int, int, int));
2279int arm_gen_movstrqi PROTO ((Rtx *));
2280Rtx gen_rotated_half_load PROTO ((Rtx));
2281Mmode arm_select_cc_mode RTX_CODE_PROTO ((Rcode, Rtx, Rtx));
2282Rtx gen_compare_reg RTX_CODE_PROTO ((Rcode, Rtx, Rtx, int));
2283void arm_reload_in_hi PROTO ((Rtx *));
2284void arm_reload_out_hi PROTO ((Rtx *));
2285void arm_reorg PROTO ((Rtx));
2286char * fp_immediate_constant PROTO ((Rtx));
2287void print_multi_reg STDIO_PROTO ((FILE *, char *, int, int));
2288char * output_call PROTO ((Rtx *));
2289char * output_call_mem PROTO ((Rtx *));
2290char * output_mov_long_double_fpu_from_arm PROTO ((Rtx *));
2291char * output_mov_long_double_arm_from_fpu PROTO ((Rtx *));
2292char * output_mov_long_double_arm_from_arm PROTO ((Rtx *));
2293char * output_mov_double_fpu_from_arm PROTO ((Rtx *));
2294char * output_mov_double_arm_from_fpu PROTO ((Rtx *));
2295char * output_move_double PROTO ((Rtx *));
2296char * output_mov_immediate PROTO ((Rtx *));
2297char * output_add_immediate PROTO ((Rtx *));
2298char * arithmetic_instr PROTO ((Rtx, int));
2299void output_ascii_pseudo_op STDIO_PROTO ((FILE *, unsigned char *, int));
2300char * output_return_instruction PROTO ((Rtx, int, int));
2301int arm_volatile_func PROTO ((void));
ef179a26 2302void arm_poke_function_name STDIO_PROTO ((FILE *, char *));
aec3cfba
NC
2303void output_func_prologue STDIO_PROTO ((FILE *, int));
2304void output_func_epilogue STDIO_PROTO ((FILE *, int));
2305void arm_expand_prologue PROTO ((void));
2306void arm_print_operand STDIO_PROTO ((FILE *, Rtx, int));
74bbc178 2307void arm_final_prescan_insn PROTO ((Rtx));
aec3cfba
NC
2308int short_branch PROTO ((int, int));
2309void assemble_align PROTO((int)); /* Used in arm.md, but defined in output.c */
2310int multi_register_push PROTO ((Rtx, Mmode));
71791e16 2311#ifdef AOF_ASSEMBLER
aec3cfba
NC
2312Rtx aof_pic_entry PROTO ((Rtx));
2313void aof_dump_pic_table STDIO_PROTO ((FILE *));
2314char * aof_text_section PROTO ((void));
2315char * aof_data_section PROTO ((void));
2316void aof_add_import PROTO ((char *));
2317void aof_delete_import PROTO ((char *));
2318void aof_dump_imports STDIO_PROTO ((FILE *));
71791e16 2319#endif
0e8285f1 2320#endif /* HAVE_CONFIG_H */
b355a481
NC
2321
2322#endif /* __ARM_H__ */