Add the FRV port
[official-gcc.git] / gcc / config / frv / frv.h
blob2502fc0c31155258f8d45943f86848760db8b95e
1 /* Target macros for the FRV port of GCC.
2 Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
3 Contributed by Red Hat Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published
9 by the Free Software Foundation; either version 2, or (at your
10 option) any later version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
22 #ifndef __FRV_H__
23 #define __FRV_H__
25 /* Set up System V.4 (aka ELF) defaults. */
26 #include "svr4.h"
29 /* Frv general purpose macros. */
30 /* Align an address. */
31 #define ADDR_ALIGN(addr,align) (((addr) + (align) - 1) & ~((align) - 1))
33 /* Return true if a value is inside a range. */
34 #define IN_RANGE_P(VALUE, LOW, HIGH) \
35 ( (((HOST_WIDE_INT)(VALUE)) >= (HOST_WIDE_INT)(LOW)) \
36 && (((HOST_WIDE_INT)(VALUE)) <= ((HOST_WIDE_INT)(HIGH))))
39 /* Driver configuration. */
41 /* A C expression which determines whether the option `-CHAR' takes arguments.
42 The value should be the number of arguments that option takes-zero, for many
43 options.
45 By default, this macro is defined to handle the standard options properly.
46 You need not define it unless you wish to add additional options which take
47 arguments.
49 Defined in svr4.h. */
50 #undef SWITCH_TAKES_ARG
51 #define SWITCH_TAKES_ARG(CHAR) \
52 (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G')
54 /* A C expression which determines whether the option `-NAME' takes arguments.
55 The value should be the number of arguments that option takes-zero, for many
56 options. This macro rather than `SWITCH_TAKES_ARG' is used for
57 multi-character option names.
59 By default, this macro is defined as `DEFAULT_WORD_SWITCH_TAKES_ARG', which
60 handles the standard options properly. You need not define
61 `WORD_SWITCH_TAKES_ARG' unless you wish to add additional options which take
62 arguments. Any redefinition should call `DEFAULT_WORD_SWITCH_TAKES_ARG' and
63 then check for additional options.
65 Defined in svr4.h. */
66 #undef WORD_SWITCH_TAKES_ARG
68 /* A C string constant that tells the GNU CC driver program options to pass to
69 the assembler. It can also specify how to translate options you give to GNU
70 CC into options for GNU CC to pass to the assembler. See the file `sun3.h'
71 for an example of this.
73 Do not define this macro if it does not need to do anything.
75 Defined in svr4.h. */
76 #undef ASM_SPEC
77 #define ASM_SPEC "\
78 %{G*} %{v} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
79 %{mtomcat-stats} \
80 %{!mno-eflags: \
81 %{mcpu=*} \
82 %{mgpr-*} %{mfpr-*} \
83 %{msoft-float} %{mhard-float} \
84 %{mdword} %{mno-dword} \
85 %{mdouble} %{mno-double} \
86 %{mmedia} %{mno-media} \
87 %{mmuladd} %{mno-muladd} \
88 %{mpack} %{mno-pack} \
89 %{fpic: -mpic} %{fPIC: -mPIC} %{mlibrary-pic}}"
91 /* Another C string constant used much like `LINK_SPEC'. The difference
92 between the two is that `STARTFILE_SPEC' is used at the very beginning of
93 the command given to the linker.
95 If this macro is not defined, a default is provided that loads the standard
96 C startup file from the usual place. See `gcc.c'.
98 Defined in svr4.h. */
99 #undef STARTFILE_SPEC
100 #define STARTFILE_SPEC "crt0%O%s frvbegin%O%s"
102 /* Another C string constant used much like `LINK_SPEC'. The difference
103 between the two is that `ENDFILE_SPEC' is used at the very end of the
104 command given to the linker.
106 Do not define this macro if it does not need to do anything.
108 Defined in svr4.h. */
109 #undef ENDFILE_SPEC
110 #define ENDFILE_SPEC "frvend%O%s"
112 /* A C string constant that tells the GNU CC driver program options to pass to
113 CPP. It can also specify how to translate options you give to GNU CC into
114 options for GNU CC to pass to the CPP.
116 Do not define this macro if it does not need to do anything. */
118 /* The idea here is to use the -mcpu option to define macros based on the
119 processor's features, using the features of the default processor if
120 no -mcpu option is given. These macros can then be overridden by
121 other -m options. */
122 #define CPP_SPEC "\
123 %{mcpu=frv: %(cpp_frv)} \
124 %{mcpu=fr500: %(cpp_fr500)} \
125 %{mcpu=fr400: %(cpp_fr400)} \
126 %{mcpu=fr300: %(cpp_simple)} \
127 %{mcpu=tomcat: %(cpp_fr500)} \
128 %{mcpu=simple: %(cpp_simple)} \
129 %{!mcpu*: %(cpp_cpu_default)} \
130 %{mno-media: -D__FRV_ACC__=0 %{msoft-float: -D__FRV_FPR__=0}} \
131 %{mhard-float: -D__FRV_HARD_FLOAT__} \
132 %{msoft-float: -U__FRV_HARD_FLOAT__} \
133 %{mgpr-32: -U__FRV_GPR__ -D__FRV_GPR__=32} \
134 %{mgpr-64: -U__FRV_GPR__ -D__FRV_GPR__=64} \
135 %{mfpr-32: -U__FRV_FPR__ -D__FRV_FPR__=32} \
136 %{mfpr-64: -U__FRV_FPR__ -D__FRV_FPR__=64} \
137 %{macc-4: -U__FRV_ACC__ -D__FRV_ACC__=4} \
138 %{macc-8: -U__FRV_ACC__ -D__FRV_ACC__=8} \
139 %{mdword: -D__FRV_DWORD__} \
140 %{mno-dword: -U__FRV_DWORD__} \
141 %{mno-pack: -U__FRV_VLIW__} \
142 %{fleading-underscore: -D__FRV_UNDERSCORE__}"
144 /* CPU defaults. Each CPU has its own CPP spec that defines the default
145 macros for that CPU. Each CPU also has its own default target mask.
147 CPU GPRs FPRs ACCs FPU MulAdd ldd/std Issue rate
148 --- ---- ---- ---- --- ------ ------- ----------
149 FRV 64 64 8 double yes yes 4
150 FR500 64 64 8 single no yes 4
151 FR400 32 32 4 none no yes 2
152 Simple 32 0 0 none no no 1 */
155 #define CPP_FRV_SPEC "\
156 -D__FRV_GPR__=64 \
157 -D__FRV_FPR__=64 \
158 -D__FRV_ACC__=8 \
159 -D__FRV_HARD_FLOAT__ \
160 -D__FRV_DWORD__ \
161 -D__FRV_VLIW__=4"
163 #define CPP_FR500_SPEC "\
164 -D__FRV_GPR__=64 \
165 -D__FRV_FPR__=64 \
166 -D__FRV_ACC__=8 \
167 -D__FRV_HARD_FLOAT__ \
168 -D__FRV_DWORD__ \
169 -D__FRV_VLIW__=4"
171 #define CPP_FR400_SPEC "\
172 -D__FRV_GPR__=32 \
173 -D__FRV_FPR__=32 \
174 -D__FRV_ACC__=4 \
175 -D__FRV_DWORD__ \
176 -D__FRV_VLIW__=2"
178 #define CPP_SIMPLE_SPEC "\
179 -D__FRV_GPR__=32 \
180 -D__FRV_FPR__=0 \
181 -D__FRV_ACC__=0 \
182 %{mmedia: -D__FRV_ACC__=8} \
183 %{mhard-float|mmedia: -D__FRV_FPR__=64}"
185 #define MASK_DEFAULT_FRV \
186 (MASK_MEDIA \
187 | MASK_DOUBLE \
188 | MASK_MULADD \
189 | MASK_DWORD \
190 | MASK_PACK)
192 #define MASK_DEFAULT_FR500 \
193 (MASK_MEDIA | MASK_DWORD | MASK_PACK)
195 #define MASK_DEFAULT_FR400 \
196 (MASK_GPR_32 \
197 | MASK_FPR_32 \
198 | MASK_MEDIA \
199 | MASK_ACC_4 \
200 | MASK_SOFT_FLOAT \
201 | MASK_DWORD \
202 | MASK_PACK)
204 #define MASK_DEFAULT_SIMPLE \
205 (MASK_GPR_32 | MASK_SOFT_FLOAT)
207 /* A C string constant that tells the GNU CC driver program options to pass to
208 `cc1'. It can also specify how to translate options you give to GNU CC into
209 options for GNU CC to pass to the `cc1'.
211 Do not define this macro if it does not need to do anything. */
212 /* For ABI compliance, we need to put bss data into the normal data section. */
213 #define CC1_SPEC "%{G*}"
215 /* A C string constant that tells the GNU CC driver program options to pass to
216 the linker. It can also specify how to translate options you give to GNU CC
217 into options for GNU CC to pass to the linker.
219 Do not define this macro if it does not need to do anything.
221 Defined in svr4.h. */
222 /* Override the svr4.h version with one that dispenses without the svr4
223 shared library options, notably -G. */
224 #undef LINK_SPEC
225 #define LINK_SPEC "\
226 %{h*} %{v:-V} \
227 %{b} %{Wl,*:%*} \
228 %{static:-dn -Bstatic} \
229 %{shared:-Bdynamic} \
230 %{symbolic:-Bsymbolic} \
231 %{G*} \
232 %{YP,*} \
233 %{Qy:} %{!Qn:-Qy}"
235 /* Another C string constant used much like `LINK_SPEC'. The difference
236 between the two is that `LIB_SPEC' is used at the end of the command given
237 to the linker.
239 If this macro is not defined, a default is provided that loads the standard
240 C library from the usual place. See `gcc.c'.
242 Defined in svr4.h. */
244 #undef LIB_SPEC
245 #define LIB_SPEC "--start-group -lc -lsim --end-group"
247 /* This macro defines names of additional specifications to put in the specs
248 that can be used in various specifications like CC1_SPEC. Its definition
249 is an initializer with a subgrouping for each command option.
251 Each subgrouping contains a string constant, that defines the
252 specification name, and a string constant that used by the GNU CC driver
253 program.
255 Do not define this macro if it does not need to do anything. */
257 #ifndef SUBTARGET_EXTRA_SPECS
258 #define SUBTARGET_EXTRA_SPECS
259 #endif
261 #define EXTRA_SPECS \
262 { "cpp_frv", CPP_FRV_SPEC }, \
263 { "cpp_fr500", CPP_FR500_SPEC }, \
264 { "cpp_fr400", CPP_FR400_SPEC }, \
265 { "cpp_simple", CPP_SIMPLE_SPEC }, \
266 { "cpp_cpu_default", CPP_CPU_DEFAULT_SPEC }, \
267 SUBTARGET_EXTRA_SPECS
269 #ifndef CPP_CPU_DEFAULT_SPEC
270 #define CPP_CPU_DEFAULT_SPEC CPP_FR500_SPEC
271 #define CPU_TYPE FRV_CPU_FR500
272 #endif
274 /* Allow us to easily change the default for -malloc-cc. */
275 #ifndef DEFAULT_NO_ALLOC_CC
276 #define MASK_DEFAULT_ALLOC_CC MASK_ALLOC_CC
277 #else
278 #define MASK_DEFAULT_ALLOC_CC 0
279 #endif
281 /* Run-time target specifications */
283 /* Define this to be a string constant containing `-D' options to define the
284 predefined macros that identify this machine and system. These macros will
285 be predefined unless the `-ansi' option is specified.
287 In addition, a parallel set of macros are predefined, whose names are made
288 by appending `__' at the beginning and at the end. These `__' macros are
289 permitted by the ANSI standard, so they are predefined regardless of whether
290 `-ansi' is specified. */
292 #define CPP_PREDEFINES "-D__frv__ -Amachine(frv)"
295 /* This declaration should be present. */
296 extern int target_flags;
298 /* This series of macros is to allow compiler command arguments to enable or
299 disable the use of optional features of the target machine. For example,
300 one machine description serves both the 68000 and the 68020; a command
301 argument tells the compiler whether it should use 68020-only instructions or
302 not. This command argument works by means of a macro `TARGET_68020' that
303 tests a bit in `target_flags'.
305 Define a macro `TARGET_FEATURENAME' for each such option. Its definition
306 should test a bit in `target_flags'; for example:
308 #define TARGET_68020 (target_flags & 1)
310 One place where these macros are used is in the condition-expressions of
311 instruction patterns. Note how `TARGET_68020' appears frequently in the
312 68000 machine description file, `m68k.md'. Another place they are used is
313 in the definitions of the other macros in the `MACHINE.h' file. */
315 #define MASK_GPR_32 0x00000001 /* Limit gprs to 32 registers */
316 #define MASK_FPR_32 0x00000002 /* Limit fprs to 32 registers */
317 #define MASK_SOFT_FLOAT 0x00000004 /* Use software floating point */
318 #define MASK_ALLOC_CC 0x00000008 /* Dynamically allocate icc/fcc's */
319 #define MASK_DWORD 0x00000010 /* Change ABi to allow dbl word insns*/
320 #define MASK_DOUBLE 0x00000020 /* Use double precision instructions */
321 #define MASK_MEDIA 0x00000040 /* Use media instructions */
322 #define MASK_MULADD 0x00000080 /* Use multiply add/subtract insns */
323 #define MASK_LIBPIC 0x00000100 /* -fpic that can be linked w/o pic */
324 #define MASK_ACC_4 0x00000200 /* Only use four media accumulators */
325 #define MASK_PACK 0x00000400 /* Set to enable packed output */
327 /* put debug masks up high */
328 #define MASK_DEBUG_ARG 0x40000000 /* debug argument handling */
329 #define MASK_DEBUG_ADDR 0x20000000 /* debug go_if_legitimate_address */
330 #define MASK_DEBUG_STACK 0x10000000 /* debug stack frame */
331 #define MASK_DEBUG 0x08000000 /* general debugging switch */
332 #define MASK_DEBUG_LOC 0x04000000 /* optimize line # table */
333 #define MASK_DEBUG_COND_EXEC 0x02000000 /* debug cond exec code */
334 #define MASK_NO_COND_MOVE 0x01000000 /* disable conditional moves */
335 #define MASK_NO_SCC 0x00800000 /* disable set conditional codes */
336 #define MASK_NO_COND_EXEC 0x00400000 /* disable conditional execution */
337 #define MASK_NO_VLIW_BRANCH 0x00200000 /* disable repacking branches */
338 #define MASK_NO_MULTI_CE 0x00100000 /* disable multi-level cond exec */
339 #define MASK_NO_NESTED_CE 0x00080000 /* disable nested cond exec */
341 #define MASK_DEFAULT MASK_DEFAULT_ALLOC_CC
343 #define TARGET_GPR_32 ((target_flags & MASK_GPR_32) != 0)
344 #define TARGET_FPR_32 ((target_flags & MASK_FPR_32) != 0)
345 #define TARGET_SOFT_FLOAT ((target_flags & MASK_SOFT_FLOAT) != 0)
346 #define TARGET_ALLOC_CC ((target_flags & MASK_ALLOC_CC) != 0)
347 #define TARGET_DWORD ((target_flags & MASK_DWORD) != 0)
348 #define TARGET_DOUBLE ((target_flags & MASK_DOUBLE) != 0)
349 #define TARGET_MEDIA ((target_flags & MASK_MEDIA) != 0)
350 #define TARGET_MULADD ((target_flags & MASK_MULADD) != 0)
351 #define TARGET_LIBPIC ((target_flags & MASK_LIBPIC) != 0)
352 #define TARGET_ACC_4 ((target_flags & MASK_ACC_4) != 0)
353 #define TARGET_DEBUG_ARG ((target_flags & MASK_DEBUG_ARG) != 0)
354 #define TARGET_DEBUG_ADDR ((target_flags & MASK_DEBUG_ADDR) != 0)
355 #define TARGET_DEBUG_STACK ((target_flags & MASK_DEBUG_STACK) != 0)
356 #define TARGET_DEBUG ((target_flags & MASK_DEBUG) != 0)
357 #define TARGET_DEBUG_LOC ((target_flags & MASK_DEBUG_LOC) != 0)
358 #define TARGET_DEBUG_COND_EXEC ((target_flags & MASK_DEBUG_COND_EXEC) != 0)
359 #define TARGET_NO_COND_MOVE ((target_flags & MASK_NO_COND_MOVE) != 0)
360 #define TARGET_NO_SCC ((target_flags & MASK_NO_SCC) != 0)
361 #define TARGET_NO_COND_EXEC ((target_flags & MASK_NO_COND_EXEC) != 0)
362 #define TARGET_NO_VLIW_BRANCH ((target_flags & MASK_NO_VLIW_BRANCH) != 0)
363 #define TARGET_NO_MULTI_CE ((target_flags & MASK_NO_MULTI_CE) != 0)
364 #define TARGET_NO_NESTED_CE ((target_flags & MASK_NO_NESTED_CE) != 0)
365 #define TARGET_PACK ((target_flags & MASK_PACK) != 0)
367 #define TARGET_GPR_64 (! TARGET_GPR_32)
368 #define TARGET_FPR_64 (! TARGET_FPR_32)
369 #define TARGET_HARD_FLOAT (! TARGET_SOFT_FLOAT)
370 #define TARGET_FIXED_CC (! TARGET_ALLOC_CC)
371 #define TARGET_COND_MOVE (! TARGET_NO_COND_MOVE)
372 #define TARGET_SCC (! TARGET_NO_SCC)
373 #define TARGET_COND_EXEC (! TARGET_NO_COND_EXEC)
374 #define TARGET_VLIW_BRANCH (! TARGET_NO_VLIW_BRANCH)
375 #define TARGET_MULTI_CE (! TARGET_NO_MULTI_CE)
376 #define TARGET_NESTED_CE (! TARGET_NO_NESTED_CE)
377 #define TARGET_ACC_8 (! TARGET_ACC_4)
379 #define TARGET_HAS_FPRS (TARGET_HARD_FLOAT || TARGET_MEDIA)
381 #define NUM_GPRS (TARGET_GPR_32? 32 : 64)
382 #define NUM_FPRS (!TARGET_HAS_FPRS? 0 : TARGET_FPR_32? 32 : 64)
383 #define NUM_ACCS (!TARGET_MEDIA? 0 : TARGET_ACC_4? 4 : 8)
385 /* Macros to identify the blend of media instructions available. Revision 1
386 is the one found on the FR500. Revision 2 includes the changes made for
387 the FR400.
389 Treat the generic processor as a revision 1 machine for now, for
390 compatibility with earlier releases. */
392 #define TARGET_MEDIA_REV1 \
393 (TARGET_MEDIA \
394 && (frv_cpu_type == FRV_CPU_GENERIC \
395 || frv_cpu_type == FRV_CPU_FR500))
397 #define TARGET_MEDIA_REV2 \
398 (TARGET_MEDIA && frv_cpu_type == FRV_CPU_FR400)
400 /* This macro defines names of command options to set and clear bits in
401 `target_flags'. Its definition is an initializer with a subgrouping for
402 each command option.
404 Each subgrouping contains a string constant, that defines the option name,
405 a number, which contains the bits to set in `target_flags', and an optional
406 second string which is the textual description that will be displayed when
407 the user passes --help on the command line. If the number entry is negative
408 then the specified bits will be cleared instead of being set. If the second
409 string entry is present but empty, then no help information will be displayed
410 for that option, but it will not count as an undocumented option. The actual
411 option name, asseen on the command line is made by appending `-m' to the
412 specified name.
414 One of the subgroupings should have a null string. The number in this
415 grouping is the default value for `target_flags'. Any target options act
416 starting with that value.
418 Here is an example which defines `-m68000' and `-m68020' with opposite
419 meanings, and picks the latter as the default:
421 #define TARGET_SWITCHES \
422 { { "68020", 1, ""}, \
423 { "68000", -1, "Compile for the m68000"}, \
424 { "", 1, }}
426 This declaration must be present. */
428 #define TARGET_SWITCHES \
429 {{ "gpr-32", MASK_GPR_32, "Only use 32 gprs"}, \
430 { "gpr-64", -MASK_GPR_32, "Use 64 gprs"}, \
431 { "fpr-32", MASK_FPR_32, "Only use 32 fprs"}, \
432 { "fpr-64", -MASK_FPR_32, "Use 64 fprs"}, \
433 { "hard-float", -MASK_SOFT_FLOAT, "Use hardware floating point" },\
434 { "soft-float", MASK_SOFT_FLOAT, "Use software floating point" },\
435 { "alloc-cc", MASK_ALLOC_CC, "Dynamically allocate cc's" }, \
436 { "fixed-cc", -MASK_ALLOC_CC, "Just use icc0/fcc0" }, \
437 { "dword", MASK_DWORD, "Change ABI to allow double word insns" }, \
438 { "no-dword", -MASK_DWORD, "Do not use double word insns" }, \
439 { "double", MASK_DOUBLE, "Use fp double instructions" }, \
440 { "no-double", -MASK_DOUBLE, "Do not use fp double insns" }, \
441 { "media", MASK_MEDIA, "Use media instructions" }, \
442 { "no-media", -MASK_MEDIA, "Do not use media insns" }, \
443 { "muladd", MASK_MULADD, "Use multiply add/subtract instructions" }, \
444 { "no-muladd", -MASK_MULADD, "Do not use multiply add/subtract insns" }, \
445 { "library-pic", MASK_LIBPIC, "PIC support for building libraries" }, \
446 { "acc-4", MASK_ACC_4, "Use 4 media accumulators" }, \
447 { "acc-8", -MASK_ACC_4, "Use 8 media accumulators" }, \
448 { "pack", MASK_PACK, "Pack VLIW instructions" }, \
449 { "no-pack", -MASK_PACK, "Do not pack VLIW instructions" }, \
450 { "no-eflags", 0, "Do not mark ABI switches in e_flags" }, \
451 { "debug-arg", MASK_DEBUG_ARG, "Internal debug switch" }, \
452 { "debug-addr", MASK_DEBUG_ADDR, "Internal debug switch" }, \
453 { "debug-stack", MASK_DEBUG_STACK, "Internal debug switch" }, \
454 { "debug", MASK_DEBUG, "Internal debug switch" }, \
455 { "debug-cond-exec", MASK_DEBUG_COND_EXEC, "Internal debug switch" }, \
456 { "debug-loc", MASK_DEBUG_LOC, "Internal debug switch" }, \
457 { "cond-move", -MASK_NO_COND_MOVE, "Enable conditional moves" }, \
458 { "no-cond-move", MASK_NO_COND_MOVE, "Disable conditional moves" }, \
459 { "scc", -MASK_NO_SCC, "Enable setting gprs to the result of comparisons" }, \
460 { "no-scc", MASK_NO_SCC, "Disable setting gprs to the result of comparisons" }, \
461 { "cond-exec", -MASK_NO_COND_EXEC, "Enable conditional execution other than moves/scc" }, \
462 { "no-cond-exec", MASK_NO_COND_EXEC, "Disable conditional execution other than moves/scc" }, \
463 { "vliw-branch", -MASK_NO_VLIW_BRANCH, "Run pass to pack branches into VLIW insns" }, \
464 { "no-vliw-branch", MASK_NO_VLIW_BRANCH, "Do not run pass to pack branches into VLIW insns" }, \
465 { "multi-cond-exec", -MASK_NO_MULTI_CE, "Disable optimizing &&/|| in conditional execution" }, \
466 { "no-multi-cond-exec", MASK_NO_MULTI_CE, "Enable optimizing &&/|| in conditional execution" }, \
467 { "nested-cond-exec", -MASK_NO_NESTED_CE, "Enable nested conditional execution optimizations" }, \
468 { "no-nested-cond-exec" ,MASK_NO_NESTED_CE, "Disable nested conditional execution optimizations" }, \
469 { "tomcat-stats", 0, "Cause gas to print tomcat statistics" }, \
470 { "", MASK_DEFAULT, "" }} \
472 /* This macro is similar to `TARGET_SWITCHES' but defines names of command
473 options that have values. Its definition is an initializer with a
474 subgrouping for each command option.
476 Each subgrouping contains a string constant, that defines the fixed part of
477 the option name, the address of a variable, and an optional description string.
478 The variable, of type `char *', is set to the text following the fixed part of
479 the option as it is specified on the command line. The actual option name is
480 made by appending `-m' to the specified name.
482 Here is an example which defines `-mshort-data-NUMBER'. If the given option
483 is `-mshort-data-512', the variable `m88k_short_data' will be set to the
484 string `"512"'.
486 extern char *m88k_short_data;
487 #define TARGET_OPTIONS \
488 { { "short-data-", & m88k_short_data, \
489 "Specify the size of the short data section" } }
491 This declaration is optional. */
492 #define TARGET_OPTIONS \
494 { "cpu=", &frv_cpu_string, "Set cpu type" }, \
495 { "branch-cost=", &frv_branch_cost_string, "Internal debug switch" }, \
496 { "cond-exec-insns=", &frv_condexec_insns_str, "Internal debug switch" }, \
497 { "cond-exec-temps=", &frv_condexec_temps_str, "Internal debug switch" }, \
498 { "sched-lookahead=", &frv_sched_lookahead_str,"Internal debug switch" }, \
501 /* This macro is a C statement to print on `stderr' a string describing the
502 particular machine description choice. Every machine description should
503 define `TARGET_VERSION'. For example:
505 #ifdef MOTOROLA
506 #define TARGET_VERSION \
507 fprintf (stderr, " (68k, Motorola syntax)");
508 #else
509 #define TARGET_VERSION \
510 fprintf (stderr, " (68k, MIT syntax)");
511 #endif */
512 #define TARGET_VERSION fprintf (stderr, _(" (frv)"))
514 /* Sometimes certain combinations of command options do not make sense on a
515 particular target machine. You can define a macro `OVERRIDE_OPTIONS' to
516 take account of this. This macro, if defined, is executed once just after
517 all the command options have been parsed.
519 Don't use this macro to turn on various extra optimizations for `-O'. That
520 is what `OPTIMIZATION_OPTIONS' is for. */
522 #define OVERRIDE_OPTIONS frv_override_options ()
524 /* Some machines may desire to change what optimizations are performed for
525 various optimization levels. This macro, if defined, is executed once just
526 after the optimization level is determined and before the remainder of the
527 command options have been parsed. Values set in this macro are used as the
528 default values for the other command line options.
530 LEVEL is the optimization level specified; 2 if `-O2' is specified, 1 if
531 `-O' is specified, and 0 if neither is specified.
533 SIZE is non-zero if `-Os' is specified, 0 otherwise.
535 You should not use this macro to change options that are not
536 machine-specific. These should uniformly selected by the same optimization
537 level on all supported machines. Use this macro to enable machbine-specific
538 optimizations.
540 *Do not examine `write_symbols' in this macro!* The debugging options are
541 *not supposed to alter the generated code. */
542 #define OPTIMIZATION_OPTIONS(LEVEL,SIZE) frv_optimization_options (LEVEL, SIZE)
545 /* Define this macro if debugging can be performed even without a frame
546 pointer. If this macro is defined, GNU CC will turn on the
547 `-fomit-frame-pointer' option whenever `-O' is specified. */
548 /* Frv needs a specific frame layout that includes the frame pointer */
550 #define CAN_DEBUG_WITHOUT_FP
553 /* Small Data Area Support. */
554 /* Maximum size of variables that go in .sdata/.sbss.
555 The -msdata=foo switch also controls how small variables are handled. */
556 #ifndef SDATA_DEFAULT_SIZE
557 #define SDATA_DEFAULT_SIZE 8
558 #endif
560 extern int g_switch_value; /* value of the -G xx switch */
561 extern int g_switch_set; /* whether -G xx was passed. */
564 /* Storage Layout */
566 /* Define this macro to have the value 1 if the most significant bit in a byte
567 has the lowest number; otherwise define it to have the value zero. This
568 means that bit-field instructions count from the most significant bit. If
569 the machine has no bit-field instructions, then this must still be defined,
570 but it doesn't matter which value it is defined to. This macro need not be
571 a constant.
573 This macro does not affect the way structure fields are packed into bytes or
574 words; that is controlled by `BYTES_BIG_ENDIAN'. */
575 #define BITS_BIG_ENDIAN 1
577 /* Define this macro to have the value 1 if the most significant byte in a word
578 has the lowest number. This macro need not be a constant. */
579 #define BYTES_BIG_ENDIAN 1
581 /* Define this macro to have the value 1 if, in a multiword object, the most
582 significant word has the lowest number. This applies to both memory
583 locations and registers; GNU CC fundamentally assumes that the order of
584 words in memory is the same as the order in registers. This macro need not
585 be a constant. */
586 #define WORDS_BIG_ENDIAN 1
588 /* Number of storage units in a word; normally 4. */
589 #define UNITS_PER_WORD 4
591 /* A macro to update MODE and UNSIGNEDP when an object whose type is TYPE and
592 which has the specified mode and signedness is to be stored in a register.
593 This macro is only called when TYPE is a scalar type.
595 On most RISC machines, which only have operations that operate on a full
596 register, define this macro to set M to `word_mode' if M is an integer mode
597 narrower than `BITS_PER_WORD'. In most cases, only integer modes should be
598 widened because wider-precision floating-point operations are usually more
599 expensive than their narrower counterparts.
601 For most machines, the macro definition does not change UNSIGNEDP. However,
602 some machines, have instructions that preferentially handle either signed or
603 unsigned quantities of certain modes. For example, on the DEC Alpha, 32-bit
604 loads from memory and 32-bit add instructions sign-extend the result to 64
605 bits. On such machines, set UNSIGNEDP according to which kind of extension
606 is more efficient.
608 Do not define this macro if it would never modify MODE. */
609 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
610 do \
612 if (GET_MODE_CLASS (MODE) == MODE_INT \
613 && GET_MODE_SIZE (MODE) < 4) \
614 (MODE) = SImode; \
616 while (0)
618 /* Normal alignment required for function parameters on the stack, in bits.
619 All stack parameters receive at least this much alignment regardless of data
620 type. On most machines, this is the same as the size of an integer. */
621 #define PARM_BOUNDARY 32
623 /* Define this macro if you wish to preserve a certain alignment for the stack
624 pointer. The definition is a C expression for the desired alignment
625 (measured in bits).
627 If `PUSH_ROUNDING' is not defined, the stack will always be aligned to the
628 specified boundary. If `PUSH_ROUNDING' is defined and specifies a less
629 strict alignment than `STACK_BOUNDARY', the stack may be momentarily
630 unaligned while pushing arguments. */
631 #define STACK_BOUNDARY 64
633 /* Alignment required for a function entry point, in bits. */
634 #define FUNCTION_BOUNDARY 128
636 /* Biggest alignment that any data type can require on this machine,
637 in bits. */
638 #define BIGGEST_ALIGNMENT 64
640 /* @@@ A hack, needed because libobjc wants to use ADJUST_FIELD_ALIGN for
641 some reason. */
642 #ifdef IN_TARGET_LIBS
643 #define BIGGEST_FIELD_ALIGNMENT 64
644 #else
645 /* An expression for the alignment of a structure field FIELD if the
646 alignment computed in the usual way is COMPUTED. GNU CC uses this
647 value instead of the value in `BIGGEST_ALIGNMENT' or
648 `BIGGEST_FIELD_ALIGNMENT', if defined, for structure fields only. */
649 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
650 frv_adjust_field_align (FIELD, COMPUTED)
651 #endif
653 /* If defined, a C expression to compute the alignment for a static variable.
654 TYPE is the data type, and ALIGN is the alignment that the object
655 would ordinarily have. The value of this macro is used instead of that
656 alignment to align the object.
658 If this macro is not defined, then ALIGN is used.
660 One use of this macro is to increase alignment of medium-size data to make
661 it all fit in fewer cache lines. Another is to cause character arrays to be
662 word-aligned so that `strcpy' calls that copy constants to character arrays
663 can be done inline. */
664 #define DATA_ALIGNMENT(TYPE, ALIGN) \
665 (TREE_CODE (TYPE) == ARRAY_TYPE \
666 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
667 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
669 /* If defined, a C expression to compute the alignment given to a constant that
670 is being placed in memory. CONSTANT is the constant and ALIGN is the
671 alignment that the object would ordinarily have. The value of this macro is
672 used instead of that alignment to align the object.
674 If this macro is not defined, then ALIGN is used.
676 The typical use of this macro is to increase alignment for string constants
677 to be word aligned so that `strcpy' calls that copy constants can be done
678 inline. */
679 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
680 (TREE_CODE (EXP) == STRING_CST \
681 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
683 /* Define this macro to be the value 1 if instructions will fail to work if
684 given data not on the nominal alignment. If instructions will merely go
685 slower in that case, define this macro as 0. */
686 #define STRICT_ALIGNMENT 1
688 /* Define this if you wish to imitate the way many other C compilers handle
689 alignment of bitfields and the structures that contain them.
691 The behavior is that the type written for a bitfield (`int', `short', or
692 other integer type) imposes an alignment for the entire structure, as if the
693 structure really did contain an ordinary field of that type. In addition,
694 the bitfield is placed within the structure so that it would fit within such
695 a field, not crossing a boundary for it.
697 Thus, on most machines, a bitfield whose type is written as `int' would not
698 cross a four-byte boundary, and would force four-byte alignment for the
699 whole structure. (The alignment used may not be four bytes; it is
700 controlled by the other alignment parameters.)
702 If the macro is defined, its definition should be a C expression; a nonzero
703 value for the expression enables this behavior.
705 Note that if this macro is not defined, or its value is zero, some bitfields
706 may cross more than one alignment boundary. The compiler can support such
707 references if there are `insv', `extv', and `extzv' insns that can directly
708 reference memory.
710 The other known way of making bitfields work is to define
711 `STRUCTURE_SIZE_BOUNDARY' as large as `BIGGEST_ALIGNMENT'. Then every
712 structure can be accessed with fullwords.
714 Unless the machine has bitfield instructions or you define
715 `STRUCTURE_SIZE_BOUNDARY' that way, you must define
716 `PCC_BITFIELD_TYPE_MATTERS' to have a nonzero value.
718 If your aim is to make GNU CC use the same conventions for laying out
719 bitfields as are used by another compiler, here is how to investigate what
720 the other compiler does. Compile and run this program:
722 struct foo1
724 char x;
725 char :0;
726 char y;
729 struct foo2
731 char x;
732 int :0;
733 char y;
736 main ()
738 printf ("Size of foo1 is %d\n",
739 sizeof (struct foo1));
740 printf ("Size of foo2 is %d\n",
741 sizeof (struct foo2));
742 exit (0);
745 If this prints 2 and 5, then the compiler's behavior is what you would get
746 from `PCC_BITFIELD_TYPE_MATTERS'.
748 Defined in svr4.h. */
749 #define PCC_BITFIELD_TYPE_MATTERS 1
751 /* A code distinguishing the floating point format of the target machine.
752 There are three defined values:
754 IEEE_FLOAT_FORMAT'
755 This code indicates IEEE floating point. It is the default;
756 there is no need to define this macro when the format is IEEE.
758 VAX_FLOAT_FORMAT'
759 This code indicates the peculiar format used on the Vax.
761 UNKNOWN_FLOAT_FORMAT'
762 This code indicates any other format.
764 The value of this macro is compared with `HOST_FLOAT_FORMAT'
765 to determine whether the target machine has the same format as
766 the host machine. If any other formats are actually in use on supported
767 machines, new codes should be defined for them.
769 The ordering of the component words of floating point values stored in
770 memory is controlled by `FLOAT_WORDS_BIG_ENDIAN' for the target machine and
771 `HOST_FLOAT_WORDS_BIG_ENDIAN' for the host. */
772 #define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
774 /* GNU CC supports two ways of implementing C++ vtables: traditional or with
775 so-called "thunks". The flag `-fvtable-thunk' chooses between them. Define
776 this macro to be a C expression for the default value of that flag. If
777 `DEFAULT_VTABLE_THUNKS' is 0, GNU CC uses the traditional implementation by
778 default. The "thunk" implementation is more efficient (especially if you
779 have provided an implementation of `ASM_OUTPUT_MI_THUNK', but is not binary
780 compatible with code compiled using the traditional implementation. If you
781 are writing a new ports, define `DEFAULT_VTABLE_THUNKS' to 1.
783 If you do not define this macro, the default for `-fvtable-thunk' is 0. */
784 #define DEFAULT_VTABLE_THUNKS 1
787 /* Layout of Source Language Data Types. */
789 #define CHAR_TYPE_SIZE 8
790 #define SHORT_TYPE_SIZE 16
791 #define INT_TYPE_SIZE 32
792 #define LONG_TYPE_SIZE 32
793 #define LONG_LONG_TYPE_SIZE 64
794 #define FLOAT_TYPE_SIZE 32
795 #define DOUBLE_TYPE_SIZE 64
796 #define LONG_DOUBLE_TYPE_SIZE 64
798 /* An expression whose value is 1 or 0, according to whether the type `char'
799 should be signed or unsigned by default. The user can always override this
800 default with the options `-fsigned-char' and `-funsigned-char'. */
801 #define DEFAULT_SIGNED_CHAR 1
804 /* General purpose registers. */
805 #define GPR_FIRST 0 /* First gpr */
806 #define GPR_LAST (GPR_FIRST + 63) /* Last gpr */
807 #define GPR_R0 GPR_FIRST /* R0, constant 0 */
808 #define GPR_FP (GPR_FIRST + 2) /* Frame pointer */
809 #define GPR_SP (GPR_FIRST + 1) /* Stack pointer */
810 /* small data register */
811 #define SDA_BASE_REG ((unsigned)(flag_pic ? PIC_REGNO : (GPR_FIRST+16)))
812 #define PIC_REGNO (GPR_FIRST + 17) /* PIC register */
814 #define FPR_FIRST 64 /* First FP reg */
815 #define FPR_LAST 127 /* Last FP reg */
817 #define DEFAULT_CONDEXEC_TEMPS 4 /* reserve 4 regs by default */
818 #define GPR_TEMP_NUM frv_condexec_temps /* # gprs to reserve for temps */
820 /* We reserve the last CR and CCR in each category to be used as a reload
821 register to reload the CR/CCR registers. This is a kludge. */
822 #define CC_FIRST 128 /* First ICC/FCC reg */
823 #define CC_LAST 135 /* Last ICC/FCC reg */
824 #define ICC_FIRST (CC_FIRST + 4) /* First ICC reg */
825 #define ICC_LAST (CC_FIRST + 7) /* Last ICC reg */
826 #define ICC_TEMP (CC_FIRST + 7) /* Temporary ICC reg */
827 #define FCC_FIRST (CC_FIRST) /* First FCC reg */
828 #define FCC_LAST (CC_FIRST + 3) /* Last FCC reg */
830 /* Amount to shift a value to locate a ICC or FCC register in the CCR
831 register and shift it to the bottom 4 bits. */
832 #define CC_SHIFT_RIGHT(REGNO) (((REGNO) - CC_FIRST) << 2)
834 /* Mask to isolate a single ICC/FCC value. */
835 #define CC_MASK 0xf
837 /* Masks to isolate the various bits in an ICC field. */
838 #define ICC_MASK_N 0x8 /* negative */
839 #define ICC_MASK_Z 0x4 /* zero */
840 #define ICC_MASK_V 0x2 /* overflow */
841 #define ICC_MASK_C 0x1 /* carry */
843 /* Mask to isolate the N/Z flags in an ICC. */
844 #define ICC_MASK_NZ (ICC_MASK_N | ICC_MASK_Z)
846 /* Mask to isolate the Z/C flags in an ICC. */
847 #define ICC_MASK_ZC (ICC_MASK_Z | ICC_MASK_C)
849 /* Masks to isolate the various bits in a FCC field. */
850 #define FCC_MASK_E 0x8 /* equal */
851 #define FCC_MASK_L 0x4 /* less than */
852 #define FCC_MASK_G 0x2 /* greater than */
853 #define FCC_MASK_U 0x1 /* unordered */
855 /* For CCR registers, the machine wants CR4..CR7 to be used for integer
856 code and CR0..CR3 to be used for floating point. */
857 #define CR_FIRST 136 /* First CCR */
858 #define CR_LAST 143 /* Last CCR */
859 #define CR_NUM (CR_LAST-CR_FIRST+1) /* # of CCRs (8) */
860 #define ICR_FIRST (CR_FIRST + 4) /* First integer CCR */
861 #define ICR_LAST (CR_FIRST + 7) /* Last integer CCR */
862 #define ICR_TEMP ICR_LAST /* Temp integer CCR */
863 #define FCR_FIRST (CR_FIRST + 0) /* First float CCR */
864 #define FCR_LAST (CR_FIRST + 3) /* Last float CCR */
866 /* Amount to shift a value to locate a CR register in the CCCR special purpose
867 register and shift it to the bottom 2 bits. */
868 #define CR_SHIFT_RIGHT(REGNO) (((REGNO) - CR_FIRST) << 1)
870 /* Mask to isolate a single CR value. */
871 #define CR_MASK 0x3
873 #define ACC_FIRST 144 /* First acc register */
874 #define ACC_LAST 151 /* Last acc register */
876 #define ACCG_FIRST 152 /* First accg register */
877 #define ACCG_LAST 159 /* Last accg register */
879 #define AP_FIRST 160 /* fake argument pointer */
881 #define SPR_FIRST 161
882 #define SPR_LAST 162
883 #define LR_REGNO (SPR_FIRST)
884 #define LCR_REGNO (SPR_FIRST + 1)
886 #define GPR_P(R) IN_RANGE_P (R, GPR_FIRST, GPR_LAST)
887 #define GPR_OR_AP_P(R) (GPR_P (R) || (R) == ARG_POINTER_REGNUM)
888 #define FPR_P(R) IN_RANGE_P (R, FPR_FIRST, FPR_LAST)
889 #define CC_P(R) IN_RANGE_P (R, CC_FIRST, CC_LAST)
890 #define ICC_P(R) IN_RANGE_P (R, ICC_FIRST, ICC_LAST)
891 #define FCC_P(R) IN_RANGE_P (R, FCC_FIRST, FCC_LAST)
892 #define CR_P(R) IN_RANGE_P (R, CR_FIRST, CR_LAST)
893 #define ICR_P(R) IN_RANGE_P (R, ICR_FIRST, ICR_LAST)
894 #define FCR_P(R) IN_RANGE_P (R, FCR_FIRST, FCR_LAST)
895 #define ACC_P(R) IN_RANGE_P (R, ACC_FIRST, ACC_LAST)
896 #define ACCG_P(R) IN_RANGE_P (R, ACCG_FIRST, ACCG_LAST)
897 #define SPR_P(R) IN_RANGE_P (R, SPR_FIRST, SPR_LAST)
899 #define GPR_OR_PSEUDO_P(R) (GPR_P (R) || (R) >= FIRST_PSEUDO_REGISTER)
900 #define FPR_OR_PSEUDO_P(R) (FPR_P (R) || (R) >= FIRST_PSEUDO_REGISTER)
901 #define GPR_AP_OR_PSEUDO_P(R) (GPR_OR_AP_P (R) || (R) >= FIRST_PSEUDO_REGISTER)
902 #define CC_OR_PSEUDO_P(R) (CC_P (R) || (R) >= FIRST_PSEUDO_REGISTER)
903 #define ICC_OR_PSEUDO_P(R) (ICC_P (R) || (R) >= FIRST_PSEUDO_REGISTER)
904 #define FCC_OR_PSEUDO_P(R) (FCC_P (R) || (R) >= FIRST_PSEUDO_REGISTER)
905 #define CR_OR_PSEUDO_P(R) (CR_P (R) || (R) >= FIRST_PSEUDO_REGISTER)
906 #define ICR_OR_PSEUDO_P(R) (ICR_P (R) || (R) >= FIRST_PSEUDO_REGISTER)
907 #define FCR_OR_PSEUDO_P(R) (FCR_P (R) || (R) >= FIRST_PSEUDO_REGISTER)
908 #define ACC_OR_PSEUDO_P(R) (ACC_P (R) || (R) >= FIRST_PSEUDO_REGISTER)
909 #define ACCG_OR_PSEUDO_P(R) (ACCG_P (R) || (R) >= FIRST_PSEUDO_REGISTER)
911 #define MAX_STACK_IMMEDIATE_OFFSET 2047
914 /* Register Basics. */
916 /* Number of hardware registers known to the compiler. They receive numbers 0
917 through `FIRST_PSEUDO_REGISTER-1'; thus, the first pseudo register's number
918 really is assigned the number `FIRST_PSEUDO_REGISTER'. */
919 #define FIRST_PSEUDO_REGISTER (SPR_LAST + 1)
921 /* The first/last register that can contain the arguments to a function. */
922 #define FIRST_ARG_REGNUM (GPR_FIRST + 8)
923 #define LAST_ARG_REGNUM (FIRST_ARG_REGNUM + FRV_NUM_ARG_REGS - 1)
925 /* Registers used by the exception handling functions. These should be
926 registers that are not otherwised used by the calling sequence. */
927 #define FIRST_EH_REGNUM 14
928 #define LAST_EH_REGNUM 15
930 /* Scratch registers used in the prologue, epilogue and thunks.
931 OFFSET_REGNO is for loading constant addends that are too big for a
932 single instruction. TEMP_REGNO is used for transferring SPRs to and from
933 the stack, and various other activities. */
934 #define OFFSET_REGNO 4
935 #define TEMP_REGNO 5
937 /* Registers used in the prologue. OLD_SP_REGNO is the old stack pointer,
938 which is sometimes used to set up the frame pointer. */
939 #define OLD_SP_REGNO 6
941 /* Registers used in the epilogue. STACKADJ_REGNO stores the exception
942 handler's stack adjustment. */
943 #define STACKADJ_REGNO 6
945 /* Registers used in thunks. JMP_REGNO is used for loading the target
946 address. */
947 #define JUMP_REGNO 6
949 #define EH_RETURN_DATA_REGNO(N) ((N) <= (LAST_EH_REGNUM - FIRST_EH_REGNUM)? \
950 (N) + FIRST_EH_REGNUM : INVALID_REGNUM)
951 #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, STACKADJ_REGNO)
952 #define EH_RETURN_HANDLER_RTX RETURN_ADDR_RTX (0, frame_pointer_rtx)
954 /* An initializer that says which registers are used for fixed purposes all
955 throughout the compiled code and are therefore not available for general
956 allocation. These would include the stack pointer, the frame pointer
957 (except on machines where that can be used as a general register when no
958 frame pointer is needed), the program counter on machines where that is
959 considered one of the addressable registers, and any other numbered register
960 with a standard use.
962 This information is expressed as a sequence of numbers, separated by commas
963 and surrounded by braces. The Nth number is 1 if register N is fixed, 0
964 otherwise.
966 The table initialized from this macro, and the table initialized by the
967 following one, may be overridden at run time either automatically, by the
968 actions of the macro `CONDITIONAL_REGISTER_USAGE', or by the user with the
969 command options `-ffixed-REG', `-fcall-used-REG' and `-fcall-saved-REG'. */
971 /* gr0 -- Hard Zero
972 gr1 -- Stack Pointer
973 gr2 -- Frame Pointer
974 gr3 -- Hidden Parameter
975 gr16 -- Small Data reserved
976 gr17 -- Pic reserved
977 gr28 -- OS reserved
978 gr29 -- OS reserved
979 gr30 -- OS reserved
980 gr31 -- OS reserved
981 cr3 -- reserved to reload FCC registers.
982 cr7 -- reserved to reload ICC registers. */
983 #define FIXED_REGISTERS \
984 { /* Integer Registers */ \
985 1, 1, 1, 1, 0, 0, 0, 0, /* 000-007, gr0 - gr7 */ \
986 0, 0, 0, 0, 0, 0, 0, 0, /* 008-015, gr8 - gr15 */ \
987 1, 1, 0, 0, 0, 0, 0, 0, /* 016-023, gr16 - gr23 */ \
988 0, 0, 0, 0, 1, 1, 1, 1, /* 024-031, gr24 - gr31 */ \
989 0, 0, 0, 0, 0, 0, 0, 0, /* 032-039, gr32 - gr39 */ \
990 0, 0, 0, 0, 0, 0, 0, 0, /* 040-040, gr48 - gr47 */ \
991 0, 0, 0, 0, 0, 0, 0, 0, /* 048-055, gr48 - gr55 */ \
992 0, 0, 0, 0, 0, 0, 0, 0, /* 056-063, gr56 - gr63 */ \
993 /* Float Registers */ \
994 0, 0, 0, 0, 0, 0, 0, 0, /* 064-071, fr0 - fr7 */ \
995 0, 0, 0, 0, 0, 0, 0, 0, /* 072-079, fr8 - fr15 */ \
996 0, 0, 0, 0, 0, 0, 0, 0, /* 080-087, fr16 - fr23 */ \
997 0, 0, 0, 0, 0, 0, 0, 0, /* 088-095, fr24 - fr31 */ \
998 0, 0, 0, 0, 0, 0, 0, 0, /* 096-103, fr32 - fr39 */ \
999 0, 0, 0, 0, 0, 0, 0, 0, /* 104-111, fr48 - fr47 */ \
1000 0, 0, 0, 0, 0, 0, 0, 0, /* 112-119, fr48 - fr55 */ \
1001 0, 0, 0, 0, 0, 0, 0, 0, /* 120-127, fr56 - fr63 */ \
1002 /* Condition Code Registers */ \
1003 0, 0, 0, 0, /* 128-131, fcc0 - fcc3 */ \
1004 0, 0, 0, 1, /* 132-135, icc0 - icc3 */ \
1005 /* Conditional execution Registers (CCR) */ \
1006 0, 0, 0, 0, 0, 0, 0, 1, /* 136-143, cr0 - cr7 */ \
1007 /* Accumulators */ \
1008 1, 1, 1, 1, 1, 1, 1, 1, /* 144-151, acc0 - acc7 */ \
1009 1, 1, 1, 1, 1, 1, 1, 1, /* 152-159, accg0 - accg7 */ \
1010 /* Other registers */ \
1011 1, /* 160, AP - fake arg ptr */ \
1012 0, /* 161, LR - Link register*/ \
1013 0, /* 162, LCR - Loop count reg*/ \
1016 /* Like `FIXED_REGISTERS' but has 1 for each register that is clobbered (in
1017 general) by function calls as well as for fixed registers. This macro
1018 therefore identifies the registers that are not available for general
1019 allocation of values that must live across function calls.
1021 If a register has 0 in `CALL_USED_REGISTERS', the compiler automatically
1022 saves it on function entry and restores it on function exit, if the register
1023 is used within the function. */
1024 #define CALL_USED_REGISTERS \
1025 { /* Integer Registers */ \
1026 1, 1, 1, 1, 1, 1, 1, 1, /* 000-007, gr0 - gr7 */ \
1027 1, 1, 1, 1, 1, 1, 1, 1, /* 008-015, gr8 - gr15 */ \
1028 1, 1, 0, 0, 0, 0, 0, 0, /* 016-023, gr16 - gr23 */ \
1029 0, 0, 0, 0, 1, 1, 1, 1, /* 024-031, gr24 - gr31 */ \
1030 1, 1, 1, 1, 1, 1, 1, 1, /* 032-039, gr32 - gr39 */ \
1031 1, 1, 1, 1, 1, 1, 1, 1, /* 040-040, gr48 - gr47 */ \
1032 0, 0, 0, 0, 0, 0, 0, 0, /* 048-055, gr48 - gr55 */ \
1033 0, 0, 0, 0, 0, 0, 0, 0, /* 056-063, gr56 - gr63 */ \
1034 /* Float Registers */ \
1035 1, 1, 1, 1, 1, 1, 1, 1, /* 064-071, fr0 - fr7 */ \
1036 1, 1, 1, 1, 1, 1, 1, 1, /* 072-079, fr8 - fr15 */ \
1037 0, 0, 0, 0, 0, 0, 0, 0, /* 080-087, fr16 - fr23 */ \
1038 0, 0, 0, 0, 0, 0, 0, 0, /* 088-095, fr24 - fr31 */ \
1039 1, 1, 1, 1, 1, 1, 1, 1, /* 096-103, fr32 - fr39 */ \
1040 1, 1, 1, 1, 1, 1, 1, 1, /* 104-111, fr48 - fr47 */ \
1041 0, 0, 0, 0, 0, 0, 0, 0, /* 112-119, fr48 - fr55 */ \
1042 0, 0, 0, 0, 0, 0, 0, 0, /* 120-127, fr56 - fr63 */ \
1043 /* Condition Code Registers */ \
1044 1, 1, 1, 1, /* 128-131, fcc0 - fcc3 */ \
1045 1, 1, 1, 1, /* 132-135, icc0 - icc3 */ \
1046 /* Conditional execution Registers (CCR) */ \
1047 1, 1, 1, 1, 1, 1, 1, 1, /* 136-143, cr0 - cr7 */ \
1048 /* Accumulators */ \
1049 1, 1, 1, 1, 1, 1, 1, 1, /* 144-151, acc0 - acc7 */ \
1050 1, 1, 1, 1, 1, 1, 1, 1, /* 152-159, accg0 - accg7 */ \
1051 /* Other registers */ \
1052 1, /* 160, AP - fake arg ptr */ \
1053 1, /* 161, LR - Link register*/ \
1054 1, /* 162, LCR - Loop count reg */ \
1057 /* Zero or more C statements that may conditionally modify two variables
1058 `fixed_regs' and `call_used_regs' (both of type `char []') after they have
1059 been initialized from the two preceding macros.
1061 This is necessary in case the fixed or call-clobbered registers depend on
1062 target flags.
1064 You need not define this macro if it has no work to do.
1066 If the usage of an entire class of registers depends on the target flags,
1067 you may indicate this to GCC by using this macro to modify `fixed_regs' and
1068 `call_used_regs' to 1 for each of the registers in the classes which should
1069 not be used by GCC. Also define the macro `REG_CLASS_FROM_LETTER' to return
1070 `NO_REGS' if it is called with a letter for a class that shouldn't be used.
1072 (However, if this class is not included in `GENERAL_REGS' and all of the
1073 insn patterns whose constraints permit this class are controlled by target
1074 switches, then GCC will automatically avoid using these registers when the
1075 target switches are opposed to them.) */
1077 #define CONDITIONAL_REGISTER_USAGE frv_conditional_register_usage ()
1080 /* Order of allocation of registers. */
1082 /* If defined, an initializer for a vector of integers, containing the numbers
1083 of hard registers in the order in which GNU CC should prefer to use them
1084 (from most preferred to least).
1086 If this macro is not defined, registers are used lowest numbered first (all
1087 else being equal).
1089 One use of this macro is on machines where the highest numbered registers
1090 must always be saved and the save-multiple-registers instruction supports
1091 only sequences of consecutive registers. On such machines, define
1092 `REG_ALLOC_ORDER' to be an initializer that lists the highest numbered
1093 allocatable register first. */
1095 /* On the FRV, allocate GR16 and GR17 after other saved registers so that we
1096 have a better chance of allocating 2 registers at a time and can use the
1097 double word load/store instructions in the prologue. */
1098 #define REG_ALLOC_ORDER \
1100 /* volatile registers */ \
1101 GPR_FIRST + 4, GPR_FIRST + 5, GPR_FIRST + 6, GPR_FIRST + 7, \
1102 GPR_FIRST + 8, GPR_FIRST + 9, GPR_FIRST + 10, GPR_FIRST + 11, \
1103 GPR_FIRST + 12, GPR_FIRST + 13, GPR_FIRST + 14, GPR_FIRST + 15, \
1104 GPR_FIRST + 32, GPR_FIRST + 33, GPR_FIRST + 34, GPR_FIRST + 35, \
1105 GPR_FIRST + 36, GPR_FIRST + 37, GPR_FIRST + 38, GPR_FIRST + 39, \
1106 GPR_FIRST + 40, GPR_FIRST + 41, GPR_FIRST + 42, GPR_FIRST + 43, \
1107 GPR_FIRST + 44, GPR_FIRST + 45, GPR_FIRST + 46, GPR_FIRST + 47, \
1109 FPR_FIRST + 0, FPR_FIRST + 1, FPR_FIRST + 2, FPR_FIRST + 3, \
1110 FPR_FIRST + 4, FPR_FIRST + 5, FPR_FIRST + 6, FPR_FIRST + 7, \
1111 FPR_FIRST + 8, FPR_FIRST + 9, FPR_FIRST + 10, FPR_FIRST + 11, \
1112 FPR_FIRST + 12, FPR_FIRST + 13, FPR_FIRST + 14, FPR_FIRST + 15, \
1113 FPR_FIRST + 32, FPR_FIRST + 33, FPR_FIRST + 34, FPR_FIRST + 35, \
1114 FPR_FIRST + 36, FPR_FIRST + 37, FPR_FIRST + 38, FPR_FIRST + 39, \
1115 FPR_FIRST + 40, FPR_FIRST + 41, FPR_FIRST + 42, FPR_FIRST + 43, \
1116 FPR_FIRST + 44, FPR_FIRST + 45, FPR_FIRST + 46, FPR_FIRST + 47, \
1118 ICC_FIRST + 0, ICC_FIRST + 1, ICC_FIRST + 2, ICC_FIRST + 3, \
1119 FCC_FIRST + 0, FCC_FIRST + 1, FCC_FIRST + 2, FCC_FIRST + 3, \
1120 CR_FIRST + 0, CR_FIRST + 1, CR_FIRST + 2, CR_FIRST + 3, \
1121 CR_FIRST + 4, CR_FIRST + 5, CR_FIRST + 6, CR_FIRST + 7, \
1123 /* saved registers */ \
1124 GPR_FIRST + 18, GPR_FIRST + 19, \
1125 GPR_FIRST + 20, GPR_FIRST + 21, GPR_FIRST + 22, GPR_FIRST + 23, \
1126 GPR_FIRST + 24, GPR_FIRST + 25, GPR_FIRST + 26, GPR_FIRST + 27, \
1127 GPR_FIRST + 48, GPR_FIRST + 49, GPR_FIRST + 50, GPR_FIRST + 51, \
1128 GPR_FIRST + 52, GPR_FIRST + 53, GPR_FIRST + 54, GPR_FIRST + 55, \
1129 GPR_FIRST + 56, GPR_FIRST + 57, GPR_FIRST + 58, GPR_FIRST + 59, \
1130 GPR_FIRST + 60, GPR_FIRST + 61, GPR_FIRST + 62, GPR_FIRST + 63, \
1131 GPR_FIRST + 16, GPR_FIRST + 17, \
1133 FPR_FIRST + 16, FPR_FIRST + 17, FPR_FIRST + 18, FPR_FIRST + 19, \
1134 FPR_FIRST + 20, FPR_FIRST + 21, FPR_FIRST + 22, FPR_FIRST + 23, \
1135 FPR_FIRST + 24, FPR_FIRST + 25, FPR_FIRST + 26, FPR_FIRST + 27, \
1136 FPR_FIRST + 28, FPR_FIRST + 29, FPR_FIRST + 30, FPR_FIRST + 31, \
1137 FPR_FIRST + 48, FPR_FIRST + 49, FPR_FIRST + 50, FPR_FIRST + 51, \
1138 FPR_FIRST + 52, FPR_FIRST + 53, FPR_FIRST + 54, FPR_FIRST + 55, \
1139 FPR_FIRST + 56, FPR_FIRST + 57, FPR_FIRST + 58, FPR_FIRST + 59, \
1140 FPR_FIRST + 60, FPR_FIRST + 61, FPR_FIRST + 62, FPR_FIRST + 63, \
1142 /* special or fixed registers */ \
1143 GPR_FIRST + 0, GPR_FIRST + 1, GPR_FIRST + 2, GPR_FIRST + 3, \
1144 GPR_FIRST + 28, GPR_FIRST + 29, GPR_FIRST + 30, GPR_FIRST + 31, \
1145 ACC_FIRST + 0, ACC_FIRST + 1, ACC_FIRST + 2, ACC_FIRST + 3, \
1146 ACC_FIRST + 4, ACC_FIRST + 5, ACC_FIRST + 6, ACC_FIRST + 7, \
1147 ACCG_FIRST + 0, ACCG_FIRST + 1, ACCG_FIRST + 2, ACCG_FIRST + 3, \
1148 ACCG_FIRST + 4, ACCG_FIRST + 5, ACCG_FIRST + 6, ACCG_FIRST + 7, \
1149 AP_FIRST, LR_REGNO, LCR_REGNO \
1153 /* How Values Fit in Registers. */
1155 /* A C expression for the number of consecutive hard registers, starting at
1156 register number REGNO, required to hold a value of mode MODE.
1158 On a machine where all registers are exactly one word, a suitable definition
1159 of this macro is
1161 #define HARD_REGNO_NREGS(REGNO, MODE) \
1162 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
1163 / UNITS_PER_WORD)) */
1165 /* On the FRV, make the CC modes take 3 words in the integer registers, so that
1166 we can build the appropriate instructions to properly reload the values. */
1167 #define HARD_REGNO_NREGS(REGNO, MODE) frv_hard_regno_nregs (REGNO, MODE)
1169 /* A C expression that is nonzero if it is permissible to store a value of mode
1170 MODE in hard register number REGNO (or in several registers starting with
1171 that one). For a machine where all registers are equivalent, a suitable
1172 definition is
1174 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
1176 It is not necessary for this macro to check for the numbers of fixed
1177 registers, because the allocation mechanism considers them to be always
1178 occupied.
1180 On some machines, double-precision values must be kept in even/odd register
1181 pairs. The way to implement that is to define this macro to reject odd
1182 register numbers for such modes.
1184 The minimum requirement for a mode to be OK in a register is that the
1185 `movMODE' instruction pattern support moves between the register and any
1186 other hard register for which the mode is OK; and that moving a value into
1187 the register and back out not alter it.
1189 Since the same instruction used to move `SImode' will work for all narrower
1190 integer modes, it is not necessary on any machine for `HARD_REGNO_MODE_OK'
1191 to distinguish between these modes, provided you define patterns `movhi',
1192 etc., to take advantage of this. This is useful because of the interaction
1193 between `HARD_REGNO_MODE_OK' and `MODES_TIEABLE_P'; it is very desirable for
1194 all integer modes to be tieable.
1196 Many machines have special registers for floating point arithmetic. Often
1197 people assume that floating point machine modes are allowed only in floating
1198 point registers. This is not true. Any registers that can hold integers
1199 can safely *hold* a floating point machine mode, whether or not floating
1200 arithmetic can be done on it in those registers. Integer move instructions
1201 can be used to move the values.
1203 On some machines, though, the converse is true: fixed-point machine modes
1204 may not go in floating registers. This is true if the floating registers
1205 normalize any value stored in them, because storing a non-floating value
1206 there would garble it. In this case, `HARD_REGNO_MODE_OK' should reject
1207 fixed-point machine modes in floating registers. But if the floating
1208 registers do not automatically normalize, if you can store any bit pattern
1209 in one and retrieve it unchanged without a trap, then any machine mode may
1210 go in a floating register, so you can define this macro to say so.
1212 The primary significance of special floating registers is rather that they
1213 are the registers acceptable in floating point arithmetic instructions.
1214 However, this is of no concern to `HARD_REGNO_MODE_OK'. You handle it by
1215 writing the proper constraints for those instructions.
1217 On some machines, the floating registers are especially slow to access, so
1218 that it is better to store a value in a stack frame than in such a register
1219 if floating point arithmetic is not being done. As long as the floating
1220 registers are not in class `GENERAL_REGS', they will not be used unless some
1221 pattern's constraint asks for one. */
1222 #define HARD_REGNO_MODE_OK(REGNO, MODE) frv_hard_regno_mode_ok (REGNO, MODE)
1224 /* A C expression that is nonzero if it is desirable to choose register
1225 allocation so as to avoid move instructions between a value of mode MODE1
1226 and a value of mode MODE2.
1228 If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R, MODE2)' are
1229 ever different for any R, then `MODES_TIEABLE_P (MODE1, MODE2)' must be
1230 zero. */
1231 #define MODES_TIEABLE_P(MODE1, MODE2) (MODE1 == MODE2)
1233 /* Define this macro if the compiler should avoid copies to/from CCmode
1234 registers. You should only define this macro if support fo copying to/from
1235 CCmode is incomplete. */
1236 #define AVOID_CCMODE_COPIES
1239 /* Register Classes. */
1241 /* An enumeral type that must be defined with all the register class names as
1242 enumeral values. `NO_REGS' must be first. `ALL_REGS' must be the last
1243 register class, followed by one more enumeral value, `LIM_REG_CLASSES',
1244 which is not a register class but rather tells how many classes there are.
1246 Each register class has a number, which is the value of casting the class
1247 name to type `int'. The number serves as an index in many of the tables
1248 described below. */
1249 enum reg_class
1251 NO_REGS,
1252 ICC_REGS,
1253 FCC_REGS,
1254 CC_REGS,
1255 ICR_REGS,
1256 FCR_REGS,
1257 CR_REGS,
1258 LCR_REG,
1259 LR_REG,
1260 SPR_REGS,
1261 QUAD_ACC_REGS,
1262 EVEN_ACC_REGS,
1263 ACC_REGS,
1264 ACCG_REGS,
1265 QUAD_FPR_REGS,
1266 FEVEN_REGS,
1267 FPR_REGS,
1268 QUAD_REGS,
1269 EVEN_REGS,
1270 GPR_REGS,
1271 ALL_REGS,
1272 LIM_REG_CLASSES
1275 #define GENERAL_REGS GPR_REGS
1277 /* The number of distinct register classes, defined as follows:
1279 #define N_REG_CLASSES (int) LIM_REG_CLASSES */
1280 #define N_REG_CLASSES ((int) LIM_REG_CLASSES)
1282 /* An initializer containing the names of the register classes as C string
1283 constants. These names are used in writing some of the debugging dumps. */
1284 #define REG_CLASS_NAMES { \
1285 "NO_REGS", \
1286 "ICC_REGS", \
1287 "FCC_REGS", \
1288 "CC_REGS", \
1289 "ICR_REGS", \
1290 "FCR_REGS", \
1291 "CR_REGS", \
1292 "LCR_REG", \
1293 "LR_REG", \
1294 "SPR_REGS", \
1295 "QUAD_ACC_REGS", \
1296 "EVEN_ACC_REGS", \
1297 "ACC_REGS", \
1298 "ACCG_REGS", \
1299 "QUAD_FPR_REGS", \
1300 "FEVEN_REGS", \
1301 "FPR_REGS", \
1302 "QUAD_REGS", \
1303 "EVEN_REGS", \
1304 "GPR_REGS", \
1305 "ALL_REGS" \
1308 /* An initializer containing the contents of the register classes, as integers
1309 which are bit masks. The Nth integer specifies the contents of class N.
1310 The way the integer MASK is interpreted is that register R is in the class
1311 if `MASK & (1 << R)' is 1.
1313 When the machine has more than 32 registers, an integer does not suffice.
1314 Then the integers are replaced by sub-initializers, braced groupings
1315 containing several integers. Each sub-initializer must be suitable as an
1316 initializer for the type `HARD_REG_SET' which is defined in
1317 `hard-reg-set.h'. */
1318 #define REG_CLASS_CONTENTS \
1319 { /* gr0-gr31 gr32-gr63 fr0-fr31 fr32-fr-63 cc/ccr/acc ap/spr */ \
1320 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x0}, /* NO_REGS */\
1321 { 0x00000000,0x00000000,0x00000000,0x00000000,0x000000f0,0x0}, /* ICC_REGS */\
1322 { 0x00000000,0x00000000,0x00000000,0x00000000,0x0000000f,0x0}, /* FCC_REGS */\
1323 { 0x00000000,0x00000000,0x00000000,0x00000000,0x000000ff,0x0}, /* CC_REGS */\
1324 { 0x00000000,0x00000000,0x00000000,0x00000000,0x0000f000,0x0}, /* ICR_REGS */\
1325 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000f00,0x0}, /* FCR_REGS */\
1326 { 0x00000000,0x00000000,0x00000000,0x00000000,0x0000ff00,0x0}, /* CR_REGS */\
1327 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x4}, /* LCR_REGS */\
1328 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x2}, /* LR_REGS */\
1329 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x6}, /* SPR_REGS */\
1330 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00ff0000,0x0}, /* QUAD_ACC */\
1331 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00ff0000,0x0}, /* EVEN_ACC */\
1332 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00ff0000,0x0}, /* ACC_REGS */\
1333 { 0x00000000,0x00000000,0x00000000,0x00000000,0xff000000,0x0}, /* ACCG_REGS*/\
1334 { 0x00000000,0x00000000,0xffffffff,0xffffffff,0x00000000,0x0}, /* QUAD_FPR */\
1335 { 0x00000000,0x00000000,0xffffffff,0xffffffff,0x00000000,0x0}, /* FEVEN_REG*/\
1336 { 0x00000000,0x00000000,0xffffffff,0xffffffff,0x00000000,0x0}, /* FPR_REGS */\
1337 { 0x0ffffffc,0xffffffff,0x00000000,0x00000000,0x00000000,0x0}, /* QUAD_REGS*/\
1338 { 0xfffffffc,0xffffffff,0x00000000,0x00000000,0x00000000,0x0}, /* EVEN_REGS*/\
1339 { 0xffffffff,0xffffffff,0x00000000,0x00000000,0x00000000,0x1}, /* GPR_REGS */\
1340 { 0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0x7}, /* ALL_REGS */\
1343 /* A C expression whose value is a register class containing hard register
1344 REGNO. In general there is more than one such class; choose a class which
1345 is "minimal", meaning that no smaller class also contains the register. */
1347 extern enum reg_class regno_reg_class[];
1348 #define REGNO_REG_CLASS(REGNO) regno_reg_class [REGNO]
1350 /* A macro whose definition is the name of the class to which a valid base
1351 register must belong. A base register is one used in an address which is
1352 the register value plus a displacement. */
1353 #define BASE_REG_CLASS GPR_REGS
1355 /* A macro whose definition is the name of the class to which a valid index
1356 register must belong. An index register is one used in an address where its
1357 value is either multiplied by a scale factor or added to another register
1358 (as well as added to a displacement). */
1359 #define INDEX_REG_CLASS GPR_REGS
1361 /* A C expression which defines the machine-dependent operand constraint
1362 letters for register classes. If CHAR is such a letter, the value should be
1363 the register class corresponding to it. Otherwise, the value should be
1364 `NO_REGS'. The register letter `r', corresponding to class `GENERAL_REGS',
1365 will not be passed to this macro; you do not need to handle it.
1367 The following letters are unavailable, due to being used as
1368 constraints:
1369 '0'..'9'
1370 '<', '>'
1371 'E', 'F', 'G', 'H'
1372 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P'
1373 'Q', 'R', 'S', 'T', 'U'
1374 'V', 'X'
1375 'g', 'i', 'm', 'n', 'o', 'p', 'r', 's' */
1377 extern enum reg_class reg_class_from_letter[];
1378 #define REG_CLASS_FROM_LETTER(CHAR) reg_class_from_letter [CHAR]
1380 /* A C expression which is nonzero if register number NUM is suitable for use
1381 as a base register in operand addresses. It may be either a suitable hard
1382 register or a pseudo register that has been allocated such a hard register. */
1383 #define REGNO_OK_FOR_BASE_P(NUM) \
1384 ((NUM) < FIRST_PSEUDO_REGISTER \
1385 ? GPR_P (NUM) \
1386 : (reg_renumber [NUM] >= 0 && GPR_P (reg_renumber [NUM])))
1388 /* A C expression which is nonzero if register number NUM is suitable for use
1389 as an index register in operand addresses. It may be either a suitable hard
1390 register or a pseudo register that has been allocated such a hard register.
1392 The difference between an index register and a base register is that the
1393 index register may be scaled. If an address involves the sum of two
1394 registers, neither one of them scaled, then either one may be labeled the
1395 "base" and the other the "index"; but whichever labeling is used must fit
1396 the machine's constraints of which registers may serve in each capacity.
1397 The compiler will try both labelings, looking for one that is valid, and
1398 will reload one or both registers only if neither labeling works. */
1399 #define REGNO_OK_FOR_INDEX_P(NUM) \
1400 ((NUM) < FIRST_PSEUDO_REGISTER \
1401 ? GPR_P (NUM) \
1402 : (reg_renumber [NUM] >= 0 && GPR_P (reg_renumber [NUM])))
1404 /* A C expression that places additional restrictions on the register class to
1405 use when it is necessary to copy value X into a register in class CLASS.
1406 The value is a register class; perhaps CLASS, or perhaps another, smaller
1407 class. On many machines, the following definition is safe:
1409 #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
1411 Sometimes returning a more restrictive class makes better code. For
1412 example, on the 68000, when X is an integer constant that is in range for a
1413 `moveq' instruction, the value of this macro is always `DATA_REGS' as long
1414 as CLASS includes the data registers. Requiring a data register guarantees
1415 that a `moveq' will be used.
1417 If X is a `const_double', by returning `NO_REGS' you can force X into a
1418 memory constant. This is useful on certain machines where immediate
1419 floating values cannot be loaded into certain kinds of registers.
1421 This declaration must be present. */
1422 #define PREFERRED_RELOAD_CLASS(X, CLASS) CLASS
1424 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \
1425 frv_secondary_reload_class (CLASS, MODE, X, TRUE)
1427 #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \
1428 frv_secondary_reload_class (CLASS, MODE, X, FALSE)
1430 /* A C expression whose value is nonzero if pseudos that have been assigned to
1431 registers of class CLASS would likely be spilled because registers of CLASS
1432 are needed for spill registers.
1434 The default value of this macro returns 1 if CLASS has exactly one register
1435 and zero otherwise. On most machines, this default should be used. Only
1436 define this macro to some other expression if pseudo allocated by
1437 `local-alloc.c' end up in memory because their hard registers were needed
1438 for spill registers. If this macro returns nonzero for those classes, those
1439 pseudos will only be allocated by `global.c', which knows how to reallocate
1440 the pseudo to another register. If there would not be another register
1441 available for reallocation, you should not change the definition of this
1442 macro since the only effect of such a definition would be to slow down
1443 register allocation. */
1444 #define CLASS_LIKELY_SPILLED_P(CLASS) frv_class_likely_spilled_p (CLASS)
1446 /* A C expression for the maximum number of consecutive registers of
1447 class CLASS needed to hold a value of mode MODE.
1449 This is closely related to the macro `HARD_REGNO_NREGS'. In fact, the value
1450 of the macro `CLASS_MAX_NREGS (CLASS, MODE)' should be the maximum value of
1451 `HARD_REGNO_NREGS (REGNO, MODE)' for all REGNO values in the class CLASS.
1453 This macro helps control the handling of multiple-word values in
1454 the reload pass.
1456 This declaration is required. */
1457 #define CLASS_MAX_NREGS(CLASS, MODE) frv_class_max_nregs (CLASS, MODE)
1459 #define ZERO_P(x) (x == CONST0_RTX (GET_MODE (x)))
1461 /* 6 bit signed immediate. */
1462 #define CONST_OK_FOR_I(VALUE) IN_RANGE_P(VALUE, -32, 31)
1463 /* 10 bit signed immediate. */
1464 #define CONST_OK_FOR_J(VALUE) IN_RANGE_P(VALUE, -512, 511)
1465 /* Unused */
1466 #define CONST_OK_FOR_K(VALUE) 0
1467 /* 16 bit signed immediate. */
1468 #define CONST_OK_FOR_L(VALUE) IN_RANGE_P(VALUE, -32768, 32767)
1469 /* 16 bit unsigned immediate. */
1470 #define CONST_OK_FOR_M(VALUE) IN_RANGE_P (VALUE, 0, 65535)
1471 /* 12 bit signed immediate that is negative. */
1472 #define CONST_OK_FOR_N(VALUE) IN_RANGE_P(VALUE, -2048, -1)
1473 /* Zero */
1474 #define CONST_OK_FOR_O(VALUE) ((VALUE) == 0)
1475 /* 12 bit signed immediate that is negative. */
1476 #define CONST_OK_FOR_P(VALUE) IN_RANGE_P(VALUE, 1, 2047)
1478 /* A C expression that defines the machine-dependent operand constraint letters
1479 (`I', `J', `K', .. 'P') that specify particular ranges of integer values.
1480 If C is one of those letters, the expression should check that VALUE, an
1481 integer, is in the appropriate range and return 1 if so, 0 otherwise. If C
1482 is not one of those letters, the value should be 0 regardless of VALUE. */
1483 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
1484 ( (C) == 'I' ? CONST_OK_FOR_I (VALUE) \
1485 : (C) == 'J' ? CONST_OK_FOR_J (VALUE) \
1486 : (C) == 'K' ? CONST_OK_FOR_K (VALUE) \
1487 : (C) == 'L' ? CONST_OK_FOR_L (VALUE) \
1488 : (C) == 'M' ? CONST_OK_FOR_M (VALUE) \
1489 : (C) == 'N' ? CONST_OK_FOR_N (VALUE) \
1490 : (C) == 'O' ? CONST_OK_FOR_O (VALUE) \
1491 : (C) == 'P' ? CONST_OK_FOR_P (VALUE) \
1492 : 0)
1495 /* A C expression that defines the machine-dependent operand constraint letters
1496 (`G', `H') that specify particular ranges of `const_double' values.
1498 If C is one of those letters, the expression should check that VALUE, an RTX
1499 of code `const_double', is in the appropriate range and return 1 if so, 0
1500 otherwise. If C is not one of those letters, the value should be 0
1501 regardless of VALUE.
1503 `const_double' is used for all floating-point constants and for `DImode'
1504 fixed-point constants. A given letter can accept either or both kinds of
1505 values. It can use `GET_MODE' to distinguish between these kinds. */
1507 #define CONST_DOUBLE_OK_FOR_G(VALUE) \
1508 ((GET_MODE (VALUE) == VOIDmode \
1509 && CONST_DOUBLE_LOW (VALUE) == 0 \
1510 && CONST_DOUBLE_HIGH (VALUE) == 0) \
1511 || ((GET_MODE (VALUE) == SFmode \
1512 || GET_MODE (VALUE) == DFmode) \
1513 && (VALUE) == CONST0_RTX (GET_MODE (VALUE))))
1515 #define CONST_DOUBLE_OK_FOR_H(VALUE) 0
1517 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
1518 ( (C) == 'G' ? CONST_DOUBLE_OK_FOR_G (VALUE) \
1519 : (C) == 'H' ? CONST_DOUBLE_OK_FOR_H (VALUE) \
1520 : 0)
1522 /* A C expression that defines the optional machine-dependent constraint
1523 letters (`Q', `R', `S', `T', `U') that can be used to segregate specific
1524 types of operands, usually memory references, for the target machine.
1525 Normally this macro will not be defined. If it is required for a particular
1526 target machine, it should return 1 if VALUE corresponds to the operand type
1527 represented by the constraint letter C. If C is not defined as an extra
1528 constraint, the value returned should be 0 regardless of VALUE.
1530 For example, on the ROMP, load instructions cannot have their output in r0
1531 if the memory reference contains a symbolic address. Constraint letter `Q'
1532 is defined as representing a memory address that does *not* contain a
1533 symbolic address. An alternative is specified with a `Q' constraint on the
1534 input and `r' on the output. The next alternative specifies `m' on the
1535 input and a register class that does not include r0 on the output. */
1537 /* Small data references */
1538 #define EXTRA_CONSTRAINT_FOR_Q(VALUE) \
1539 (small_data_symbolic_operand (VALUE, GET_MODE (VALUE)))
1541 /* Double word memory ops that take one instruction. */
1542 #define EXTRA_CONSTRAINT_FOR_R(VALUE) \
1543 (dbl_memory_one_insn_operand (VALUE, GET_MODE (VALUE)))
1545 /* SYMBOL_REF */
1546 #define EXTRA_CONSTRAINT_FOR_S(VALUE) (GET_CODE (VALUE) == SYMBOL_REF)
1548 /* Double word memory ops that take two instructions. */
1549 #define EXTRA_CONSTRAINT_FOR_T(VALUE) \
1550 (dbl_memory_two_insn_operand (VALUE, GET_MODE (VALUE)))
1552 /* Memory operand for conditional execution. */
1553 #define EXTRA_CONSTRAINT_FOR_U(VALUE) \
1554 (condexec_memory_operand (VALUE, GET_MODE (VALUE)))
1556 #define EXTRA_CONSTRAINT(VALUE, C) \
1557 ( (C) == 'Q' ? EXTRA_CONSTRAINT_FOR_Q (VALUE) \
1558 : (C) == 'R' ? EXTRA_CONSTRAINT_FOR_R (VALUE) \
1559 : (C) == 'S' ? EXTRA_CONSTRAINT_FOR_S (VALUE) \
1560 : (C) == 'T' ? EXTRA_CONSTRAINT_FOR_T (VALUE) \
1561 : (C) == 'U' ? EXTRA_CONSTRAINT_FOR_U (VALUE) \
1562 : 0)
1565 /* Basic Stack Layout. */
1567 /* Structure to describe information about a saved range of registers */
1569 typedef struct frv_stack_regs {
1570 const char * name; /* name of the register ranges */
1571 int first; /* first register in the range */
1572 int last; /* last register in the range */
1573 int size_1word; /* # of bytes to be stored via 1 word stores */
1574 int size_2words; /* # of bytes to be stored via 2 word stores */
1575 unsigned char field_p; /* true if the registers are a single SPR */
1576 unsigned char dword_p; /* true if we can do dword stores */
1577 unsigned char special_p; /* true if the regs have a fixed save loc. */
1578 } frv_stack_regs_t;
1580 /* Register ranges to look into saving. */
1581 #define STACK_REGS_GPR 0 /* Gprs (normally gr16..gr31, gr48..gr63) */
1582 #define STACK_REGS_FPR 1 /* Fprs (normally fr16..fr31, fr48..fr63) */
1583 #define STACK_REGS_LR 2 /* LR register */
1584 #define STACK_REGS_CC 3 /* CCrs (normally not saved) */
1585 #define STACK_REGS_LCR 5 /* lcr register */
1586 #define STACK_REGS_STDARG 6 /* stdarg registers */
1587 #define STACK_REGS_STRUCT 7 /* structure return (gr3) */
1588 #define STACK_REGS_FP 8 /* FP register */
1589 #define STACK_REGS_MAX 9 /* # of register ranges */
1591 /* Values for save_p field. */
1592 #define REG_SAVE_NO_SAVE 0 /* register not saved */
1593 #define REG_SAVE_1WORD 1 /* save the register */
1594 #define REG_SAVE_2WORDS 2 /* save register and register+1 */
1596 /* Structure used to define the frv stack. */
1598 typedef struct frv_stack {
1599 int total_size; /* total bytes allocated for stack */
1600 int vars_size; /* variable save area size */
1601 int parameter_size; /* outgoing parameter size */
1602 int stdarg_size; /* size of regs needed to be saved for stdarg */
1603 int regs_size; /* size of the saved registers */
1604 int regs_size_1word; /* # of bytes to be stored via 1 word stores */
1605 int regs_size_2words; /* # of bytes to be stored via 2 word stores */
1606 int header_size; /* size of the old FP, struct ret., LR save */
1607 int pretend_size; /* size of pretend args */
1608 int vars_offset; /* offset to save local variables from new SP*/
1609 int regs_offset; /* offset to save registers from new SP */
1610 /* register range information */
1611 frv_stack_regs_t regs[STACK_REGS_MAX];
1612 /* offset to store each register */
1613 int reg_offset[FIRST_PSEUDO_REGISTER];
1614 /* whether to save register (& reg+1) */
1615 unsigned char save_p[FIRST_PSEUDO_REGISTER];
1616 } frv_stack_t;
1618 /* Define this macro if pushing a word onto the stack moves the stack pointer
1619 to a smaller address. */
1620 #define STACK_GROWS_DOWNWARD 1
1622 /* Define this macro if the addresses of local variable slots are at negative
1623 offsets from the frame pointer. */
1624 #define FRAME_GROWS_DOWNWARD
1626 /* Offset from the frame pointer to the first local variable slot to be
1627 allocated.
1629 If `FRAME_GROWS_DOWNWARD', find the next slot's offset by subtracting the
1630 first slot's length from `STARTING_FRAME_OFFSET'. Otherwise, it is found by
1631 adding the length of the first slot to the value `STARTING_FRAME_OFFSET'. */
1632 #define STARTING_FRAME_OFFSET 0
1634 /* Offset from the stack pointer register to the first location at which
1635 outgoing arguments are placed. If not specified, the default value of zero
1636 is used. This is the proper value for most machines.
1638 If `ARGS_GROW_DOWNWARD', this is the offset to the location above the first
1639 location at which outgoing arguments are placed. */
1640 #define STACK_POINTER_OFFSET 0
1642 /* Offset from the argument pointer register to the first argument's address.
1643 On some machines it may depend on the data type of the function.
1645 If `ARGS_GROW_DOWNWARD', this is the offset to the location above the first
1646 argument's address. */
1647 #define FIRST_PARM_OFFSET(FUNDECL) 0
1649 /* A C expression whose value is RTL representing the address in a stack frame
1650 where the pointer to the caller's frame is stored. Assume that FRAMEADDR is
1651 an RTL expression for the address of the stack frame itself.
1653 If you don't define this macro, the default is to return the value of
1654 FRAMEADDR--that is, the stack frame address is also the address of the stack
1655 word that points to the previous frame. */
1656 #define DYNAMIC_CHAIN_ADDRESS(FRAMEADDR) frv_dynamic_chain_address (FRAMEADDR)
1658 /* A C expression whose value is RTL representing the value of the return
1659 address for the frame COUNT steps up from the current frame, after the
1660 prologue. FRAMEADDR is the frame pointer of the COUNT frame, or the frame
1661 pointer of the COUNT - 1 frame if `RETURN_ADDR_IN_PREVIOUS_FRAME' is
1662 defined.
1664 The value of the expression must always be the correct address when COUNT is
1665 zero, but may be `NULL_RTX' if there is not way to determine the return
1666 address of other frames. */
1667 #define RETURN_ADDR_RTX(COUNT, FRAMEADDR) frv_return_addr_rtx (COUNT, FRAMEADDR)
1669 /* This function contains machine specific function data. */
1670 struct machine_function GTY(())
1672 /* True if we have created an rtx that relies on the stack frame. */
1673 int frame_needed;
1676 #define RETURN_POINTER_REGNUM LR_REGNO
1678 /* A C expression whose value is RTL representing the location of the incoming
1679 return address at the beginning of any function, before the prologue. This
1680 RTL is either a `REG', indicating that the return value is saved in `REG',
1681 or a `MEM' representing a location in the stack.
1683 You only need to define this macro if you want to support call frame
1684 debugging information like that provided by DWARF 2. */
1685 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (SImode, RETURN_POINTER_REGNUM)
1688 /* Register That Address the Stack Frame. */
1690 /* The register number of the stack pointer register, which must also be a
1691 fixed register according to `FIXED_REGISTERS'. On most machines, the
1692 hardware determines which register this is. */
1693 #define STACK_POINTER_REGNUM (GPR_FIRST + 1)
1695 /* The register number of the frame pointer register, which is used to access
1696 automatic variables in the stack frame. On some machines, the hardware
1697 determines which register this is. On other machines, you can choose any
1698 register you wish for this purpose. */
1699 #define FRAME_POINTER_REGNUM (GPR_FIRST + 2)
1701 /* The register number of the arg pointer register, which is used to access the
1702 function's argument list. On some machines, this is the same as the frame
1703 pointer register. On some machines, the hardware determines which register
1704 this is. On other machines, you can choose any register you wish for this
1705 purpose. If this is not the same register as the frame pointer register,
1706 then you must mark it as a fixed register according to `FIXED_REGISTERS', or
1707 arrange to be able to eliminate it. */
1709 /* On frv this is a fake register that is eliminated in
1710 terms of either the frame pointer or stack pointer. */
1711 #define ARG_POINTER_REGNUM AP_FIRST
1713 /* Register numbers used for passing a function's static chain pointer. If
1714 register windows are used, the register number as seen by the called
1715 function is `STATIC_CHAIN_INCOMING_REGNUM', while the register number as
1716 seen by the calling function is `STATIC_CHAIN_REGNUM'. If these registers
1717 are the same, `STATIC_CHAIN_INCOMING_REGNUM' need not be defined.
1719 The static chain register need not be a fixed register.
1721 If the static chain is passed in memory, these macros should not be defined;
1722 instead, the next two macros should be defined. */
1723 #define STATIC_CHAIN_REGNUM (GPR_FIRST + 7)
1724 #define STATIC_CHAIN_INCOMING_REGNUM (GPR_FIRST + 7)
1727 /* Eliminating the Frame Pointer and the Arg Pointer. */
1729 /* A C expression which is nonzero if a function must have and use a frame
1730 pointer. This expression is evaluated in the reload pass. If its value is
1731 nonzero the function will have a frame pointer.
1733 The expression can in principle examine the current function and decide
1734 according to the facts, but on most machines the constant 0 or the constant
1735 1 suffices. Use 0 when the machine allows code to be generated with no
1736 frame pointer, and doing so saves some time or space. Use 1 when there is
1737 no possible advantage to avoiding a frame pointer.
1739 In certain cases, the compiler does not know how to produce valid code
1740 without a frame pointer. The compiler recognizes those cases and
1741 automatically gives the function a frame pointer regardless of what
1742 `FRAME_POINTER_REQUIRED' says. You don't need to worry about them.
1744 In a function that does not require a frame pointer, the frame pointer
1745 register can be allocated for ordinary usage, unless you mark it as a fixed
1746 register. See `FIXED_REGISTERS' for more information. */
1747 #define FRAME_POINTER_REQUIRED frv_frame_pointer_required ()
1749 /* If defined, this macro specifies a table of register pairs used to eliminate
1750 unneeded registers that point into the stack frame. If it is not defined,
1751 the only elimination attempted by the compiler is to replace references to
1752 the frame pointer with references to the stack pointer.
1754 The definition of this macro is a list of structure initializations, each of
1755 which specifies an original and replacement register.
1757 On some machines, the position of the argument pointer is not known until
1758 the compilation is completed. In such a case, a separate hard register must
1759 be used for the argument pointer. This register can be eliminated by
1760 replacing it with either the frame pointer or the argument pointer,
1761 depending on whether or not the frame pointer has been eliminated.
1763 In this case, you might specify:
1764 #define ELIMINABLE_REGS \
1765 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1766 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
1767 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
1769 Note that the elimination of the argument pointer with the stack pointer is
1770 specified first since that is the preferred elimination. */
1772 #define ELIMINABLE_REGS \
1774 {ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
1775 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
1776 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM} \
1779 /* A C expression that returns non-zero if the compiler is allowed to try to
1780 replace register number FROM with register number TO. This macro need only
1781 be defined if `ELIMINABLE_REGS' is defined, and will usually be the constant
1782 1, since most of the cases preventing register elimination are things that
1783 the compiler already knows about. */
1785 #define CAN_ELIMINATE(FROM, TO) \
1786 ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
1787 ? ! frame_pointer_needed \
1788 : 1)
1790 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It specifies the
1791 initial difference between the specified pair of registers. This macro must
1792 be defined if `ELIMINABLE_REGS' is defined. */
1794 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1795 (OFFSET) = frv_initial_elimination_offset (FROM, TO)
1798 /* Passing Function Arguments on the Stack. */
1800 /* If defined, the maximum amount of space required for outgoing arguments will
1801 be computed and placed into the variable
1802 `current_function_outgoing_args_size'. No space will be pushed onto the
1803 stack for each call; instead, the function prologue should increase the
1804 stack frame size by this amount.
1806 Defining both `PUSH_ROUNDING' and `ACCUMULATE_OUTGOING_ARGS' is not
1807 proper. */
1808 #define ACCUMULATE_OUTGOING_ARGS 1
1810 /* A C expression that should indicate the number of bytes of its own arguments
1811 that a function pops on returning, or 0 if the function pops no arguments
1812 and the caller must therefore pop them all after the function returns.
1814 FUNDECL is a C variable whose value is a tree node that describes the
1815 function in question. Normally it is a node of type `FUNCTION_DECL' that
1816 describes the declaration of the function. From this it is possible to
1817 obtain the DECL_ATTRIBUTES of the function.
1819 FUNTYPE is a C variable whose value is a tree node that describes the
1820 function in question. Normally it is a node of type `FUNCTION_TYPE' that
1821 describes the data type of the function. From this it is possible to obtain
1822 the data types of the value and arguments (if known).
1824 When a call to a library function is being considered, FUNTYPE will contain
1825 an identifier node for the library function. Thus, if you need to
1826 distinguish among various library functions, you can do so by their names.
1827 Note that "library function" in this context means a function used to
1828 perform arithmetic, whose name is known specially in the compiler and was
1829 not mentioned in the C code being compiled.
1831 STACK-SIZE is the number of bytes of arguments passed on the stack. If a
1832 variable number of bytes is passed, it is zero, and argument popping will
1833 always be the responsibility of the calling function.
1835 On the Vax, all functions always pop their arguments, so the definition of
1836 this macro is STACK-SIZE. On the 68000, using the standard calling
1837 convention, no functions pop their arguments, so the value of the macro is
1838 always 0 in this case. But an alternative calling convention is available
1839 in which functions that take a fixed number of arguments pop them but other
1840 functions (such as `printf') pop nothing (the caller pops all). When this
1841 convention is in use, FUNTYPE is examined to determine whether a function
1842 takes a fixed number of arguments. */
1843 #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
1846 /* Function Arguments in Registers. */
1848 /* Nonzero if we do not know how to pass TYPE solely in registers.
1849 We cannot do so in the following cases:
1851 - if the type has variable size
1852 - if the type is marked as addressable (it is required to be constructed
1853 into the stack)
1854 - if the type is a structure or union. */
1856 #define MUST_PASS_IN_STACK(MODE,TYPE) \
1857 (((MODE) == BLKmode) \
1858 || ((TYPE) != 0 \
1859 && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \
1860 || TREE_CODE (TYPE) == RECORD_TYPE \
1861 || TREE_CODE (TYPE) == UNION_TYPE \
1862 || TREE_CODE (TYPE) == QUAL_UNION_TYPE \
1863 || TREE_ADDRESSABLE (TYPE))))
1865 /* The number of register assigned to holding function arguments. */
1867 #define FRV_NUM_ARG_REGS 6
1869 /* A C expression that controls whether a function argument is passed in a
1870 register, and which register.
1872 The arguments are CUM, of type CUMULATIVE_ARGS, which summarizes (in a way
1873 defined by INIT_CUMULATIVE_ARGS and FUNCTION_ARG_ADVANCE) all of the previous
1874 arguments so far passed in registers; MODE, the machine mode of the argument;
1875 TYPE, the data type of the argument as a tree node or 0 if that is not known
1876 (which happens for C support library functions); and NAMED, which is 1 for an
1877 ordinary argument and 0 for nameless arguments that correspond to `...' in the
1878 called function's prototype.
1880 The value of the expression should either be a `reg' RTX for the hard
1881 register in which to pass the argument, or zero to pass the argument on the
1882 stack.
1884 For machines like the Vax and 68000, where normally all arguments are
1885 pushed, zero suffices as a definition.
1887 The usual way to make the ANSI library `stdarg.h' work on a machine where
1888 some arguments are usually passed in registers, is to cause nameless
1889 arguments to be passed on the stack instead. This is done by making
1890 `FUNCTION_ARG' return 0 whenever NAMED is 0.
1892 You may use the macro `MUST_PASS_IN_STACK (MODE, TYPE)' in the definition of
1893 this macro to determine if this argument is of a type that must be passed in
1894 the stack. If `REG_PARM_STACK_SPACE' is not defined and `FUNCTION_ARG'
1895 returns non-zero for such an argument, the compiler will abort. If
1896 `REG_PARM_STACK_SPACE' is defined, the argument will be computed in the
1897 stack and then loaded into a register. */
1898 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1899 frv_function_arg (&CUM, MODE, TYPE, NAMED, FALSE)
1901 /* Define this macro if the target machine has "register windows", so that the
1902 register in which a function sees an arguments is not necessarily the same
1903 as the one in which the caller passed the argument.
1905 For such machines, `FUNCTION_ARG' computes the register in which the caller
1906 passes the value, and `FUNCTION_INCOMING_ARG' should be defined in a similar
1907 fashion to tell the function being called where the arguments will arrive.
1909 If `FUNCTION_INCOMING_ARG' is not defined, `FUNCTION_ARG' serves both
1910 purposes. */
1912 #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
1913 frv_function_arg (&CUM, MODE, TYPE, NAMED, TRUE)
1915 /* A C expression for the number of words, at the beginning of an argument,
1916 must be put in registers. The value must be zero for arguments that are
1917 passed entirely in registers or that are entirely pushed on the stack.
1919 On some machines, certain arguments must be passed partially in registers
1920 and partially in memory. On these machines, typically the first N words of
1921 arguments are passed in registers, and the rest on the stack. If a
1922 multi-word argument (a `double' or a structure) crosses that boundary, its
1923 first few words must be passed in registers and the rest must be pushed.
1924 This macro tells the compiler when this occurs, and how many of the words
1925 should go in registers.
1927 `FUNCTION_ARG' for these arguments should return the first register to be
1928 used by the caller for this argument; likewise `FUNCTION_INCOMING_ARG', for
1929 the called function. */
1930 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
1931 frv_function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
1933 /* extern int frv_function_arg_partial_nregs PARAMS ((CUMULATIVE_ARGS, int, Tree, int)); */
1935 /* A C expression that indicates when an argument must be passed by reference.
1936 If nonzero for an argument, a copy of that argument is made in memory and a
1937 pointer to the argument is passed instead of the argument itself. The
1938 pointer is passed in whatever way is appropriate for passing a pointer to
1939 that type.
1941 On machines where `REG_PARM_STACK_SPACE' is not defined, a suitable
1942 definition of this macro might be
1943 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
1944 MUST_PASS_IN_STACK (MODE, TYPE) */
1945 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
1946 frv_function_arg_pass_by_reference (&CUM, MODE, TYPE, NAMED)
1948 /* If defined, a C expression that indicates when it is the called function's
1949 responsibility to make a copy of arguments passed by invisible reference.
1950 Normally, the caller makes a copy and passes the address of the copy to the
1951 routine being called. When FUNCTION_ARG_CALLEE_COPIES is defined and is
1952 nonzero, the caller does not make a copy. Instead, it passes a pointer to
1953 the "live" value. The called function must not modify this value. If it
1954 can be determined that the value won't be modified, it need not make a copy;
1955 otherwise a copy must be made. */
1956 #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
1957 frv_function_arg_callee_copies (&CUM, MODE, TYPE, NAMED)
1959 /* If defined, a C expression that indicates when it is more desirable to keep
1960 an argument passed by invisible reference as a reference, rather than
1961 copying it to a pseudo register. */
1962 #define FUNCTION_ARG_KEEP_AS_REFERENCE(CUM, MODE, TYPE, NAMED) \
1963 frv_function_arg_keep_as_reference (&CUM, MODE, TYPE, NAMED)
1965 /* A C type for declaring a variable that is used as the first argument of
1966 `FUNCTION_ARG' and other related values. For some target machines, the type
1967 `int' suffices and can hold the number of bytes of argument so far.
1969 There is no need to record in `CUMULATIVE_ARGS' anything about the arguments
1970 that have been passed on the stack. The compiler has other variables to
1971 keep track of that. For target machines on which all arguments are passed
1972 on the stack, there is no need to store anything in `CUMULATIVE_ARGS';
1973 however, the data structure must exist and should not be empty, so use
1974 `int'. */
1975 #define CUMULATIVE_ARGS int
1977 /* A C statement (sans semicolon) for initializing the variable CUM for the
1978 state at the beginning of the argument list. The variable has type
1979 `CUMULATIVE_ARGS'. The value of FNTYPE is the tree node for the data type
1980 of the function which will receive the args, or 0 if the args are to a
1981 compiler support library function. The value of INDIRECT is nonzero when
1982 processing an indirect call, for example a call through a function pointer.
1983 The value of INDIRECT is zero for a call to an explicitly named function, a
1984 library function call, or when `INIT_CUMULATIVE_ARGS' is used to find
1985 arguments for the function being compiled.
1987 When processing a call to a compiler support library function, LIBNAME
1988 identifies which one. It is a `symbol_ref' rtx which contains the name of
1989 the function, as a string. LIBNAME is 0 when an ordinary C function call is
1990 being processed. Thus, each time this macro is called, either LIBNAME or
1991 FNTYPE is nonzero, but never both of them at once. */
1993 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \
1994 frv_init_cumulative_args (&CUM, FNTYPE, LIBNAME, INDIRECT, FALSE)
1996 /* Like `INIT_CUMULATIVE_ARGS' but overrides it for the purposes of finding the
1997 arguments for the function being compiled. If this macro is undefined,
1998 `INIT_CUMULATIVE_ARGS' is used instead.
2000 The value passed for LIBNAME is always 0, since library routines with
2001 special calling conventions are never compiled with GNU CC. The argument
2002 LIBNAME exists for symmetry with `INIT_CUMULATIVE_ARGS'. */
2004 #define INIT_CUMULATIVE_INCOMING_ARGS(CUM, FNTYPE, LIBNAME) \
2005 frv_init_cumulative_args (&CUM, FNTYPE, LIBNAME, FALSE, TRUE)
2007 /* A C statement (sans semicolon) to update the summarizer variable CUM to
2008 advance past an argument in the argument list. The values MODE, TYPE and
2009 NAMED describe that argument. Once this is done, the variable CUM is
2010 suitable for analyzing the *following* argument with `FUNCTION_ARG', etc.
2012 This macro need not do anything if the argument in question was passed on
2013 the stack. The compiler knows how to track the amount of stack space used
2014 for arguments without any special help. */
2015 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
2016 frv_function_arg_advance (&CUM, MODE, TYPE, NAMED)
2018 /* If defined, a C expression that gives the alignment boundary, in bits, of an
2019 argument with the specified mode and type. If it is not defined,
2020 `PARM_BOUNDARY' is used for all arguments. */
2022 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
2023 frv_function_arg_boundary (MODE, TYPE)
2025 /* A C expression that is nonzero if REGNO is the number of a hard register in
2026 which function arguments are sometimes passed. This does *not* include
2027 implicit arguments such as the static chain and the structure-value address.
2028 On many machines, no registers can be used for this purpose since all
2029 function arguments are pushed on the stack. */
2030 #define FUNCTION_ARG_REGNO_P(REGNO) \
2031 ((REGNO) >= FIRST_ARG_REGNUM && ((REGNO) <= LAST_ARG_REGNUM))
2034 /* How Scalar Function Values are Returned. */
2036 /* The number of the hard register that is used to return a scalar value from a
2037 function call. */
2038 #define RETURN_VALUE_REGNUM (GPR_FIRST + 8)
2040 /* A C expression to create an RTX representing the place where a function
2041 returns a value of data type VALTYPE. VALTYPE is a tree node representing a
2042 data type. Write `TYPE_MODE (VALTYPE)' to get the machine mode used to
2043 represent that type. On many machines, only the mode is relevant.
2044 (Actually, on most machines, scalar values are returned in the same place
2045 regardless of mode).
2047 If `PROMOTE_FUNCTION_RETURN' is defined, you must apply the same promotion
2048 rules specified in `PROMOTE_MODE' if VALTYPE is a scalar type.
2050 If the precise function being called is known, FUNC is a tree node
2051 (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This makes it
2052 possible to use a different value-returning convention for specific
2053 functions when all their calls are known.
2055 `FUNCTION_VALUE' is not used for return vales with aggregate data types,
2056 because these are returned in another way. See `STRUCT_VALUE_REGNUM' and
2057 related macros, below. */
2058 #define FUNCTION_VALUE(VALTYPE, FUNC) \
2059 gen_rtx (REG, TYPE_MODE (VALTYPE), RETURN_VALUE_REGNUM)
2061 /* A C expression to create an RTX representing the place where a library
2062 function returns a value of mode MODE.
2064 Note that "library function" in this context means a compiler support
2065 routine, used to perform arithmetic, whose name is known specially by the
2066 compiler and was not mentioned in the C code being compiled.
2068 The definition of `LIBRARY_VALUE' need not be concerned aggregate data
2069 types, because none of the library functions returns such types. */
2070 #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, RETURN_VALUE_REGNUM)
2072 /* A C expression that is nonzero if REGNO is the number of a hard register in
2073 which the values of called function may come back.
2075 A register whose use for returning values is limited to serving as the
2076 second of a pair (for a value of type `double', say) need not be recognized
2077 by this macro. So for most machines, this definition suffices:
2079 #define FUNCTION_VALUE_REGNO_P(N) ((N) == RETURN)
2081 If the machine has register windows, so that the caller and the called
2082 function use different registers for the return value, this macro should
2083 recognize only the caller's register numbers. */
2084 #define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == RETURN_VALUE_REGNUM)
2087 /* How Large Values are Returned. */
2089 /* If the structure value address is passed in a register, then
2090 `STRUCT_VALUE_REGNUM' should be the number of that register. */
2091 #define STRUCT_VALUE_REGNUM (GPR_FIRST + 3)
2094 /* Function Entry and Exit. */
2096 /* Define this macro as a C expression that is nonzero if the return
2097 instruction or the function epilogue ignores the value of the stack pointer;
2098 in other words, if it is safe to delete an instruction to adjust the stack
2099 pointer before a return from the function.
2101 Note that this macro's value is relevant only for functions for which frame
2102 pointers are maintained. It is never safe to delete a final stack
2103 adjustment in a function that has no frame pointer, and the compiler knows
2104 this regardless of `EXIT_IGNORE_STACK'. */
2105 #define EXIT_IGNORE_STACK 1
2107 /* A C compound statement that outputs the assembler code for a thunk function,
2108 used to implement C++ virtual function calls with multiple inheritance. The
2109 thunk acts as a wrapper around a virtual function, adjusting the implicit
2110 object parameter before handing control off to the real function.
2112 First, emit code to add the integer DELTA to the location that contains the
2113 incoming first argument. Assume that this argument contains a pointer, and
2114 is the one used to pass the `this' pointer in C++. This is the incoming
2115 argument *before* the function prologue, e.g. `%o0' on a sparc. The
2116 addition must preserve the values of all other incoming arguments.
2118 After the addition, emit code to jump to FUNCTION, which is a
2119 `FUNCTION_DECL'. This is a direct pure jump, not a call, and does not touch
2120 the return address. Hence returning from FUNCTION will return to whoever
2121 called the current `thunk'.
2123 The effect must be as if FUNCTION had been called directly with the adjusted
2124 first argument. This macro is responsible for emitting all of the code for
2125 a thunk function; `FUNCTION_PROLOGUE' and `FUNCTION_EPILOGUE' are not
2126 invoked.
2128 The THUNK_FNDECL is redundant. (DELTA and FUNCTION have already been
2129 extracted from it.) It might possibly be useful on some targets, but
2130 probably not.
2132 If you do not define this macro, the target-independent code in the C++
2133 frontend will generate a less efficient heavyweight thunk that calls
2134 FUNCTION instead of jumping to it. The generic approach does not support
2135 varargs. */
2136 #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
2137 frv_asm_output_mi_thunk (FILE, THUNK_FNDECL, (long)DELTA, FUNCTION)
2140 /* Generating Code for Profiling. */
2142 /* A C statement or compound statement to output to FILE some assembler code to
2143 call the profiling subroutine `mcount'. Before calling, the assembler code
2144 must load the address of a counter variable into a register where `mcount'
2145 expects to find the address. The name of this variable is `LP' followed by
2146 the number LABELNO, so you would generate the name using `LP%d' in a
2147 `fprintf'.
2149 The details of how the address should be passed to `mcount' are determined
2150 by your operating system environment, not by GNU CC. To figure them out,
2151 compile a small program for profiling using the system's installed C
2152 compiler and look at the assembler code that results.
2154 This declaration must be present, but it can be an abort if profiling is
2155 not implemented. */
2157 #define FUNCTION_PROFILER(FILE, LABELNO) abort ()
2160 /* Implementing the Varargs Macros. */
2162 /* If defined, is a C expression that produces the machine-specific code for a
2163 call to `__builtin_saveregs'. This code will be moved to the very beginning
2164 of the function, before any parameter access are made. The return value of
2165 this function should be an RTX that contains the value to use as the return
2166 of `__builtin_saveregs'.
2168 If this macro is not defined, the compiler will output an ordinary call to
2169 the library function `__builtin_saveregs'. */
2171 #define EXPAND_BUILTIN_SAVEREGS() frv_expand_builtin_saveregs ()
2173 /* This macro offers an alternative to using `__builtin_saveregs' and defining
2174 the macro `EXPAND_BUILTIN_SAVEREGS'. Use it to store the anonymous register
2175 arguments into the stack so that all the arguments appear to have been
2176 passed consecutively on the stack. Once this is done, you can use the
2177 standard implementation of varargs that works for machines that pass all
2178 their arguments on the stack.
2180 The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure, containing
2181 the values that obtain after processing of the named arguments. The
2182 arguments MODE and TYPE describe the last named argument--its machine mode
2183 and its data type as a tree node.
2185 The macro implementation should do two things: first, push onto the stack
2186 all the argument registers *not* used for the named arguments, and second,
2187 store the size of the data thus pushed into the `int'-valued variable whose
2188 name is supplied as the argument PRETEND_ARGS_SIZE. The value that you
2189 store here will serve as additional offset for setting up the stack frame.
2191 Because you must generate code to push the anonymous arguments at compile
2192 time without knowing their data types, `SETUP_INCOMING_VARARGS' is only
2193 useful on machines that have just a single category of argument register and
2194 use it uniformly for all data types.
2196 If the argument SECOND_TIME is nonzero, it means that the arguments of the
2197 function are being analyzed for the second time. This happens for an inline
2198 function, which is not actually compiled until the end of the source file.
2199 The macro `SETUP_INCOMING_VARARGS' should not generate any instructions in
2200 this case. */
2201 #define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_ARGS_SIZE, SECOND_TIME) \
2202 frv_setup_incoming_varargs (& ARGS_SO_FAR, (int) MODE, TYPE, \
2203 & PRETEND_ARGS_SIZE, SECOND_TIME)
2205 /* Implement the stdarg/varargs va_start macro. STDARG_P is non-zero if this
2206 is stdarg.h instead of varargs.h. VALIST is the tree of the va_list
2207 variable to initialize. NEXTARG is the machine independent notion of the
2208 'next' argument after the variable arguments. If not defined, a standard
2209 implementation will be defined that works for arguments passed on the stack. */
2211 #define EXPAND_BUILTIN_VA_START(VALIST, NEXTARG) \
2212 (frv_expand_builtin_va_start(VALIST, NEXTARG))
2214 /* Implement the stdarg/varargs va_arg macro. VALIST is the variable of type
2215 va_list as a tree, TYPE is the type passed to va_arg. */
2217 #define EXPAND_BUILTIN_VA_ARG(VALIST, TYPE) \
2218 (frv_expand_builtin_va_arg (VALIST, TYPE))
2221 /* Trampolines for Nested Functions. */
2223 /* A C expression for the size in bytes of the trampoline, as an integer. */
2224 #define TRAMPOLINE_SIZE frv_trampoline_size ()
2226 /* Alignment required for trampolines, in bits.
2228 If you don't define this macro, the value of `BIGGEST_ALIGNMENT' is used for
2229 aligning trampolines. */
2230 #define TRAMPOLINE_ALIGNMENT 32
2232 /* A C statement to initialize the variable parts of a trampoline. ADDR is an
2233 RTX for the address of the trampoline; FNADDR is an RTX for the address of
2234 the nested function; STATIC_CHAIN is an RTX for the static chain value that
2235 should be passed to the function when it is called. */
2236 #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN) \
2237 frv_initialize_trampoline (ADDR, FNADDR, STATIC_CHAIN)
2239 /* Define this macro if trampolines need a special subroutine to do their work.
2240 The macro should expand to a series of `asm' statements which will be
2241 compiled with GNU CC. They go in a library function named
2242 `__transfer_from_trampoline'.
2244 If you need to avoid executing the ordinary prologue code of a compiled C
2245 function when you jump to the subroutine, you can do so by placing a special
2246 label of your own in the assembler code. Use one `asm' statement to
2247 generate an assembler label, and another to make the label global. Then
2248 trampolines can use that label to jump directly to your special assembler
2249 code. */
2251 #ifdef __FRV_UNDERSCORE__
2252 #define TRAMPOLINE_TEMPLATE_NAME "___trampoline_template"
2253 #else
2254 #define TRAMPOLINE_TEMPLATE_NAME "__trampoline_template"
2255 #endif
2257 #define TRANSFER_FROM_TRAMPOLINE \
2258 extern int _write (int, const void *, unsigned); \
2260 void \
2261 __trampoline_setup (addr, size, fnaddr, sc) \
2262 short * addr; \
2263 int size; \
2264 int fnaddr; \
2265 int sc; \
2267 extern short __trampoline_template[]; \
2268 short * to = addr; \
2269 short * from = &__trampoline_template[0]; \
2270 int i; \
2272 if (size < 20) \
2274 _write (2, "__trampoline_setup bad size\n", \
2275 sizeof ("__trampoline_setup bad size\n") - 1); \
2276 exit (-1); \
2279 to[0] = from[0]; \
2280 to[1] = (short)(fnaddr); \
2281 to[2] = from[2]; \
2282 to[3] = (short)(sc); \
2283 to[4] = from[4]; \
2284 to[5] = (short)(fnaddr >> 16); \
2285 to[6] = from[6]; \
2286 to[7] = (short)(sc >> 16); \
2287 to[8] = from[8]; \
2288 to[9] = from[9]; \
2290 for (i = 0; i < 20; i++) \
2291 __asm__ volatile ("dcf @(%0,%1)\n\tici @(%0,%1)" :: "r" (to), "r" (i)); \
2294 __asm__("\n" \
2295 "\t.globl " TRAMPOLINE_TEMPLATE_NAME "\n" \
2296 "\t.text\n" \
2297 TRAMPOLINE_TEMPLATE_NAME ":\n" \
2298 "\tsetlos #0, gr6\n" /* jump register */ \
2299 "\tsetlos #0, gr7\n" /* static chain */ \
2300 "\tsethi #0, gr6\n" \
2301 "\tsethi #0, gr7\n" \
2302 "\tjmpl @(gr0,gr6)\n");
2305 /* Implicit Calls to Library Routines. */
2307 /* A C string constant giving the name of the function to call for the
2308 remainder in division of one signed full-word by another. If you do not
2309 define this macro, the default name is used, which is `__modsi3', a function
2310 defined in `libgcc.a'. */
2311 #define MODSI3_LIBCALL "__modi"
2313 /* A C string constant giving the name of the function to call for the
2314 remainder in division of one unsigned full-word by another. If you do not
2315 define this macro, the default name is used, which is `__umodsi3', a
2316 function defined in `libgcc.a'. */
2317 #define UMODSI3_LIBCALL "__umodi"
2319 /* A C string constant giving the name of the function to call for
2320 multiplication of one signed double-word by another. If you do not define
2321 this macro, the default name is used, which is `__muldi3', a function
2322 defined in `libgcc.a'. */
2323 #define MULDI3_LIBCALL "__mulll"
2325 /* A C string constant giving the name of the function to call for division of
2326 one signed double-word by another. If you do not define this macro, the
2327 default name is used, which is `__divdi3', a function defined in `libgcc.a'. */
2328 #define DIVDI3_LIBCALL "__divll"
2330 /* A C string constant giving the name of the function to call for division of
2331 one unsigned full-word by another. If you do not define this macro, the
2332 default name is used, which is `__udivdi3', a function defined in
2333 `libgcc.a'. */
2334 #define UDIVDI3_LIBCALL "__udivll"
2336 /* A C string constant giving the name of the function to call for the
2337 remainder in division of one signed double-word by another. If you do not
2338 define this macro, the default name is used, which is `__moddi3', a function
2339 defined in `libgcc.a'. */
2340 #define MODDI3_LIBCALL "__modll"
2342 /* A C string constant giving the name of the function to call for the
2343 remainder in division of one unsigned full-word by another. If you do not
2344 define this macro, the default name is used, which is `__umoddi3', a
2345 function defined in `libgcc.a'. */
2346 #define UMODDI3_LIBCALL "__umodll"
2348 /* Define this macro as a C statement that declares additional library routines
2349 renames existing ones. `init_optabs' calls this macro after initializing all
2350 the normal library routines. */
2351 #define INIT_TARGET_OPTABS \
2352 do \
2354 add_optab->handlers [(int) DImode].libfunc \
2355 = init_one_libfunc ("__addll"); \
2356 sub_optab->handlers [(int) DImode].libfunc \
2357 = init_one_libfunc ("__subll"); \
2358 and_optab->handlers [(int) DImode].libfunc \
2359 = init_one_libfunc ("__andll"); \
2360 ior_optab->handlers [(int) DImode].libfunc \
2361 = init_one_libfunc ("__orll"); \
2362 xor_optab->handlers [(int) DImode].libfunc \
2363 = init_one_libfunc ("__xorll"); \
2364 one_cmpl_optab->handlers [(int) DImode].libfunc \
2365 = init_one_libfunc ("__notll"); \
2366 add_optab->handlers [(int) SFmode].libfunc \
2367 = init_one_libfunc ("__addf"); \
2368 sub_optab->handlers [(int) SFmode].libfunc \
2369 = init_one_libfunc ("__subf"); \
2370 smul_optab->handlers [(int) SFmode].libfunc \
2371 = init_one_libfunc ("__mulf"); \
2372 sdiv_optab->handlers [(int) SFmode].libfunc \
2373 = init_one_libfunc ("__divf"); \
2374 add_optab->handlers [(int) DFmode].libfunc \
2375 = init_one_libfunc ("__addd"); \
2376 sub_optab->handlers [(int) DFmode].libfunc \
2377 = init_one_libfunc ("__subd"); \
2378 smul_optab->handlers [(int) DFmode].libfunc \
2379 = init_one_libfunc ("__muld"); \
2380 sdiv_optab->handlers [(int) DFmode].libfunc \
2381 = init_one_libfunc ("__divd"); \
2382 fixsfsi_libfunc = init_one_libfunc ("__ftoi"); \
2383 fixunssfsi_libfunc = init_one_libfunc ("__ftoui"); \
2384 fixsfdi_libfunc = init_one_libfunc ("__ftoll"); \
2385 fixunssfdi_libfunc = init_one_libfunc ("__ftoull"); \
2386 fixdfsi_libfunc = init_one_libfunc ("__dtoi"); \
2387 fixunsdfsi_libfunc = init_one_libfunc ("__dtoui"); \
2388 fixdfdi_libfunc = init_one_libfunc ("__dtoll"); \
2389 fixunsdfdi_libfunc = init_one_libfunc ("__dtoull"); \
2390 floatsisf_libfunc = init_one_libfunc ("__itof"); \
2391 floatdisf_libfunc = init_one_libfunc ("__lltof"); \
2392 floatsidf_libfunc = init_one_libfunc ("__itod"); \
2393 floatdidf_libfunc = init_one_libfunc ("__lltod"); \
2394 extendsfdf2_libfunc = init_one_libfunc ("__ftod"); \
2395 truncdfsf2_libfunc = init_one_libfunc ("__dtof"); \
2397 while (0)
2400 /* Addressing Modes. */
2402 /* A C expression that is 1 if the RTX X is a constant which is a valid
2403 address. On most machines, this can be defined as `CONSTANT_P (X)', but a
2404 few machines are more restrictive in which constant addresses are supported.
2406 `CONSTANT_P' accepts integer-values expressions whose values are not
2407 explicitly known, such as `symbol_ref', `label_ref', and `high' expressions
2408 and `const' arithmetic expressions, in addition to `const_int' and
2409 `const_double' expressions. */
2410 #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
2412 /* A number, the maximum number of registers that can appear in a valid memory
2413 address. Note that it is up to you to specify a value equal to the maximum
2414 number that `GO_IF_LEGITIMATE_ADDRESS' would ever accept. */
2415 #define MAX_REGS_PER_ADDRESS 2
2417 /* A C compound statement with a conditional `goto LABEL;' executed if X (an
2418 RTX) is a legitimate memory address on the target machine for a memory
2419 operand of mode MODE.
2421 It usually pays to define several simpler macros to serve as subroutines for
2422 this one. Otherwise it may be too complicated to understand.
2424 This macro must exist in two variants: a strict variant and a non-strict
2425 one. The strict variant is used in the reload pass. It must be defined so
2426 that any pseudo-register that has not been allocated a hard register is
2427 considered a memory reference. In contexts where some kind of register is
2428 required, a pseudo-register with no hard register must be rejected.
2430 The non-strict variant is used in other passes. It must be defined to
2431 accept all pseudo-registers in every context where some kind of register is
2432 required.
2434 Compiler source files that want to use the strict variant of this macro
2435 define the macro `REG_OK_STRICT'. You should use an `#ifdef REG_OK_STRICT'
2436 conditional to define the strict variant in that case and the non-strict
2437 variant otherwise.
2439 Subroutines to check for acceptable registers for various purposes (one for
2440 base registers, one for index registers, and so on) are typically among the
2441 subroutines used to define `GO_IF_LEGITIMATE_ADDRESS'. Then only these
2442 subroutine macros need have two variants; the higher levels of macros may be
2443 the same whether strict or not.
2445 Normally, constant addresses which are the sum of a `symbol_ref' and an
2446 integer are stored inside a `const' RTX to mark them as constant.
2447 Therefore, there is no need to recognize such sums specifically as
2448 legitimate addresses. Normally you would simply recognize any `const' as
2449 legitimate.
2451 Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle constant sums that
2452 are not marked with `const'. It assumes that a naked `plus' indicates
2453 indexing. If so, then you *must* reject such naked constant sums as
2454 illegitimate addresses, so that none of them will be given to
2455 `PRINT_OPERAND_ADDRESS'.
2457 On some machines, whether a symbolic address is legitimate depends on the
2458 section that the address refers to. On these machines, define the macro
2459 `ENCODE_SECTION_INFO' to store the information into the `symbol_ref', and
2460 then check for it here. When you see a `const', you will have to look
2461 inside it to find the `symbol_ref' in order to determine the section.
2463 The best way to modify the name string is by adding text to the beginning,
2464 with suitable punctuation to prevent any ambiguity. Allocate the new name
2465 in `saveable_obstack'. You will have to modify `ASM_OUTPUT_LABELREF' to
2466 remove and decode the added text and output the name accordingly, and define
2467 `STRIP_NAME_ENCODING' to access the original name string.
2469 You can check the information stored here into the `symbol_ref' in the
2470 definitions of the macros `GO_IF_LEGITIMATE_ADDRESS' and
2471 `PRINT_OPERAND_ADDRESS'. */
2473 #ifdef REG_OK_STRICT
2474 #define REG_OK_STRICT_P 1
2475 #else
2476 #define REG_OK_STRICT_P 0
2477 #endif
2479 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
2480 do \
2482 if (frv_legitimate_address_p (MODE, X, REG_OK_STRICT_P, FALSE)) \
2483 goto LABEL; \
2485 while (0)
2487 /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
2488 use as a base register. For hard registers, it should always accept those
2489 which the hardware permits and reject the others. Whether the macro accepts
2490 or rejects pseudo registers must be controlled by `REG_OK_STRICT' as
2491 described above. This usually requires two variant definitions, of which
2492 `REG_OK_STRICT' controls the one actually used. */
2493 #ifdef REG_OK_STRICT
2494 #define REG_OK_FOR_BASE_P(X) GPR_P (REGNO (X))
2495 #else
2496 #define REG_OK_FOR_BASE_P(X) GPR_AP_OR_PSEUDO_P (REGNO (X))
2497 #endif
2499 /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
2500 use as an index register.
2502 The difference between an index register and a base register is that the
2503 index register may be scaled. If an address involves the sum of two
2504 registers, neither one of them scaled, then either one may be labeled the
2505 "base" and the other the "index"; but whichever labeling is used must fit
2506 the machine's constraints of which registers may serve in each capacity.
2507 The compiler will try both labelings, looking for one that is valid, and
2508 will reload one or both registers only if neither labeling works. */
2509 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
2511 /* A C compound statement that attempts to replace X with a valid memory
2512 address for an operand of mode MODE. WIN will be a C statement label
2513 elsewhere in the code; the macro definition may use
2515 GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN);
2517 to avoid further processing if the address has become legitimate.
2519 X will always be the result of a call to `break_out_memory_refs', and OLDX
2520 will be the operand that was given to that function to produce X.
2522 The code generated by this macro should not alter the substructure of X. If
2523 it transforms X into a more legitimate form, it should assign X (which will
2524 always be a C variable) a new value.
2526 It is not necessary for this macro to come up with a legitimate address.
2527 The compiler has standard ways of doing so in all cases. In fact, it is
2528 safe for this macro to do nothing. But often a machine-dependent strategy
2529 can generate better code. */
2531 /* On the FRV, we use it to convert small data and pic references into using
2532 the appropriate pointer in the address. */
2533 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
2534 do \
2536 rtx newx = frv_legitimize_address (X, OLDX, MODE); \
2538 if (newx) \
2540 (X) = newx; \
2541 goto WIN; \
2544 while (0)
2546 /* A C statement or compound statement with a conditional `goto LABEL;'
2547 executed if memory address X (an RTX) can have different meanings depending
2548 on the machine mode of the memory reference it is used for or if the address
2549 is valid for some modes but not others.
2551 Autoincrement and autodecrement addresses typically have mode-dependent
2552 effects because the amount of the increment or decrement is the size of the
2553 operand being addressed. Some machines have other mode-dependent addresses.
2554 Many RISC machines have no mode-dependent addresses.
2556 You may assume that ADDR is a valid address for the machine. */
2557 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)
2559 /* A C expression that is nonzero if X is a legitimate constant for an
2560 immediate operand on the target machine. You can assume that X satisfies
2561 `CONSTANT_P', so you need not check this. In fact, `1' is a suitable
2562 definition for this macro on machines where anything `CONSTANT_P' is valid. */
2563 #define LEGITIMATE_CONSTANT_P(X) frv_legitimate_constant_p (X)
2565 /* The load-and-update commands allow pre-modification in addresses.
2566 The index has to be in a register. */
2567 #define HAVE_PRE_MODIFY_REG 1
2570 /* Returns a mode from class `MODE_CC' to be used when comparison operation
2571 code OP is applied to rtx X and Y. For example, on the Sparc,
2572 `SELECT_CC_MODE' is defined as (see *note Jump Patterns::. for a
2573 description of the reason for this definition)
2575 #define SELECT_CC_MODE(OP,X,Y) \
2576 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
2577 ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode) \
2578 : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \
2579 || GET_CODE (X) == NEG) \
2580 ? CC_NOOVmode : CCmode))
2582 You need not define this macro if `EXTRA_CC_MODES' is not defined. */
2583 #define SELECT_CC_MODE(OP, X, Y) \
2584 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
2585 ? CC_FPmode \
2586 : (((OP) == LEU || (OP) == GTU || (OP) == LTU || (OP) == GEU) \
2587 ? CC_UNSmode \
2588 : CCmode))
2590 /* A C expression whose value is one if it is always safe to reverse a
2591 comparison whose mode is MODE. If `SELECT_CC_MODE' can ever return MODE for
2592 a floating-point inequality comparison, then `REVERSIBLE_CC_MODE (MODE)'
2593 must be zero.
2595 You need not define this macro if it would always returns zero or if the
2596 floating-point format is anything other than `IEEE_FLOAT_FORMAT'. For
2597 example, here is the definition used on the Sparc, where floating-point
2598 inequality comparisons are always given `CCFPEmode':
2600 #define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode) */
2602 /* On frv, don't consider floating point comparisons to be reversible. In
2603 theory, fp equality comparisons can be reversible */
2604 #define REVERSIBLE_CC_MODE(MODE) ((MODE) == CCmode || (MODE) == CC_UNSmode)
2606 /* Frv CCR_MODE's are not reversible. */
2607 #define REVERSE_CONDEXEC_PREDICATES_P(x,y) 0
2610 /* Describing Relative Costs of Operations. */
2612 /* A part of a C `switch' statement that describes the relative costs of
2613 constant RTL expressions. It must contain `case' labels for expression
2614 codes `const_int', `const', `symbol_ref', `label_ref' and `const_double'.
2615 Each case must ultimately reach a `return' statement to return the relative
2616 cost of the use of that kind of constant value in an expression. The cost
2617 may depend on the precise value of the constant, which is available for
2618 examination in X, and the rtx code of the expression in which it is
2619 contained, found in OUTER_CODE.
2621 CODE is the expression code--redundant, since it can be obtained with
2622 `GET_CODE (X)'. */
2623 #define CONST_COSTS(X, CODE, OUTER_CODE) \
2624 case CONST: \
2625 case LABEL_REF: \
2626 case SYMBOL_REF: \
2627 case CONST_DOUBLE: \
2628 return COSTS_N_INSNS (2); \
2630 case CONST_INT: \
2631 /* Make 12 bit integers really cheap */ \
2632 return IN_RANGE_P (INTVAL (X), -2048, 2047) ? 0 : COSTS_N_INSNS (2); \
2634 /* Like `CONST_COSTS' but applies to nonconstant RTL expressions. This can be
2635 used, for example, to indicate how costly a multiply instruction is. In
2636 writing this macro, you can use the construct `COSTS_N_INSNS (N)' to specify
2637 a cost equal to N fast instructions. OUTER_CODE is the code of the
2638 expression in which X is contained.
2640 This macro is optional; do not define it if the default cost assumptions are
2641 adequate for the target machine. */
2642 #define RTX_COSTS(X, CODE, OUTER_CODE) \
2643 case PLUS: \
2644 case MINUS: \
2645 case AND: \
2646 case IOR: \
2647 case XOR: \
2648 case ASHIFT: \
2649 case ASHIFTRT: \
2650 case LSHIFTRT: \
2651 case NOT: \
2652 case NEG: \
2653 case COMPARE: \
2654 if (GET_MODE (X) == SImode) \
2655 return COSTS_N_INSNS (1); \
2656 else if (GET_MODE (X) == DImode) \
2657 return COSTS_N_INSNS (2); \
2658 else \
2659 return COSTS_N_INSNS (3); /* guess */ \
2661 case MULT: \
2662 if (GET_MODE (X) == SImode) \
2663 return COSTS_N_INSNS (2); \
2664 else \
2665 return COSTS_N_INSNS (6); /* guess */ \
2667 case DIV: \
2668 case UDIV: \
2669 return COSTS_N_INSNS (18);
2671 /* A C expression for the cost of moving data from a register in class FROM to
2672 one in class TO. The classes are expressed using the enumeration values
2673 such as `GENERAL_REGS'. A value of 4 is the default; other values are
2674 interpreted relative to that.
2676 It is not required that the cost always equal 2 when FROM is the same as TO;
2677 on some machines it is expensive to move between registers if they are not
2678 general registers.
2680 If reload sees an insn consisting of a single `set' between two hard
2681 registers, and if `REGISTER_MOVE_COST' applied to their classes returns a
2682 value of 2, reload does not check to ensure that the constraints of the insn
2683 are met. Setting a cost of other than 2 will allow reload to verify that
2684 the constraints are met. You should do this if the `movM' pattern's
2685 constraints do not allow such copying. */
2686 #define REGISTER_MOVE_COST(MODE, FROM, TO) frv_register_move_cost (FROM, TO)
2688 /* A C expression for the cost of moving data of mode M between a register and
2689 memory. A value of 2 is the default; this cost is relative to those in
2690 `REGISTER_MOVE_COST'.
2692 If moving between registers and memory is more expensive than between two
2693 registers, you should define this macro to express the relative cost. */
2694 #define MEMORY_MOVE_COST(M,C,I) 4
2696 /* A C expression for the cost of a branch instruction. A value of 1 is the
2697 default; other values are interpreted relative to that. */
2699 /* Here are additional macros which do not specify precise relative costs, but
2700 only that certain actions are more expensive than GNU CC would ordinarily
2701 expect. */
2703 /* We used to default the branch cost to 2, but I changed it to 1, to avoid
2704 generating SCC instructions and or/and-ing them together, and then doing the
2705 branch on the result, which collectively generate much worse code. */
2706 #ifndef DEFAULT_BRANCH_COST
2707 #define DEFAULT_BRANCH_COST 1
2708 #endif
2710 #define BRANCH_COST frv_branch_cost_int
2712 /* Define this macro as a C expression which is nonzero if accessing less than
2713 a word of memory (i.e. a `char' or a `short') is no faster than accessing a
2714 word of memory, i.e., if such access require more than one instruction or if
2715 there is no difference in cost between byte and (aligned) word loads.
2717 When this macro is not defined, the compiler will access a field by finding
2718 the smallest containing object; when it is defined, a fullword load will be
2719 used if alignment permits. Unless bytes accesses are faster than word
2720 accesses, using word accesses is preferable since it may eliminate
2721 subsequent memory access if subsequent accesses occur to other fields in the
2722 same word of the structure, but to different bytes. */
2723 #define SLOW_BYTE_ACCESS 1
2725 /* Define this macro if zero-extension (of a `char' or `short' to an `int') can
2726 be done faster if the destination is a register that is known to be zero.
2728 If you define this macro, you must have instruction patterns that recognize
2729 RTL structures like this:
2731 (set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...)
2733 and likewise for `HImode'. */
2734 #define SLOW_ZERO_EXTEND 0
2736 /* Define this macro if it is as good or better to call a constant function
2737 address than to call an address kept in a register. */
2738 #define NO_FUNCTION_CSE
2740 /* Define this macro if it is as good or better for a function to call itself
2741 with an explicit address than to call an address kept in a register. */
2742 #define NO_RECURSIVE_FUNCTION_CSE
2745 /* Dividing the output into sections. */
2747 /* A C expression whose value is a string containing the assembler operation
2748 that should precede instructions and read-only data. Normally `".text"' is
2749 right. */
2750 #define TEXT_SECTION_ASM_OP "\t.text"
2752 /* A C expression whose value is a string containing the assembler operation to
2753 identify the following data as writable initialized data. Normally
2754 `".data"' is right. */
2755 #define DATA_SECTION_ASM_OP "\t.data"
2757 /* If defined, a C expression whose value is a string containing the
2758 assembler operation to identify the following data as
2759 uninitialized global data. If not defined, and neither
2760 `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
2761 uninitialized global data will be output in the data section if
2762 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
2763 used. */
2764 #define BSS_SECTION_ASM_OP "\t.section .bss,\"aw\""
2766 /* Short Data Support */
2767 #define SDATA_SECTION_ASM_OP "\t.section .sdata,\"aw\""
2768 #define SBSS_SECTION_ASM_OP "\t.section .sbss,\"aw\""
2770 /* On svr4, we *do* have support for the .init and .fini sections, and we
2771 can put stuff in there to be executed before and after `main'. We let
2772 crtstuff.c and other files know this by defining the following symbols.
2773 The definitions say how to change sections to the .init and .fini
2774 sections. This is the same for all known svr4 assemblers.
2776 The standard System V.4 macros will work, but they look ugly in the
2777 assembly output, so redefine them. */
2779 #undef INIT_SECTION_ASM_OP
2780 #undef FINI_SECTION_ASM_OP
2781 #define INIT_SECTION_ASM_OP "\t.section .init,\"ax\""
2782 #define FINI_SECTION_ASM_OP "\t.section .fini,\"ax\""
2784 /* A C expression whose value is a string containing the assembler operation to
2785 switch to the fixup section that records all initialized pointers in a -fpic
2786 program so they can be changed program startup time if the program is loaded
2787 at a different address than linked for. */
2788 #define FIXUP_SECTION_ASM_OP "\t.section .rofixup,\"a\""
2790 /* A list of names for sections other than the standard two, which are
2791 `in_text' and `in_data'. You need not define this macro
2792 on a system with no other sections (that GCC needs to use). */
2793 #undef EXTRA_SECTIONS
2794 #define EXTRA_SECTIONS in_sdata, in_sbss, in_const, in_fixup
2796 /* One or more functions to be defined in "varasm.c". These
2797 functions should do jobs analogous to those of `text_section' and
2798 `data_section', for your additional sections. Do not define this
2799 macro if you do not define `EXTRA_SECTIONS'. */
2800 #undef EXTRA_SECTION_FUNCTIONS
2801 #define EXTRA_SECTION_FUNCTIONS \
2802 SDATA_SECTION_FUNCTION \
2803 SBSS_SECTION_FUNCTION \
2804 FIXUP_SECTION_FUNCTION
2807 #define SDATA_SECTION_FUNCTION \
2808 void \
2809 sdata_section () \
2811 if (in_section != in_sdata) \
2813 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
2814 in_section = in_sdata; \
2818 #define SBSS_SECTION_FUNCTION \
2819 void \
2820 sbss_section () \
2822 if (in_section != in_sbss) \
2824 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
2825 in_section = in_sbss; \
2829 #define FIXUP_SECTION_FUNCTION \
2830 void \
2831 fixup_section () \
2833 if (in_section != in_fixup) \
2835 fprintf (asm_out_file, "%s\n", FIXUP_SECTION_ASM_OP); \
2836 in_section = in_fixup; \
2840 /* A C statement or statements to switch to the appropriate section for output
2841 of EXP. You can assume that EXP is either a `VAR_DECL' node or a constant
2842 of some sort. RELOC indicates whether the initial value of EXP requires
2843 link-time relocations. Select the section by calling `text_section' or one
2844 of the alternatives for other sections.
2846 Do not define this macro if you put all read-only variables and constants in
2847 the read-only data section (usually the text section).
2849 Defined in svr4.h. */
2850 #undef SELECT_SECTION
2851 #define SELECT_SECTION(EXP, RELOC, ALIGN) frv_select_section ((EXP), (RELOC))
2853 /* A C statement or statements to switch to the appropriate section for output
2854 of RTX in mode MODE. You can assume that RTX is some kind of constant in
2855 RTL. The argument MODE is redundant except in the case of a `const_int'
2856 rtx. Select the section by calling `text_section' or one of the
2857 alternatives for other sections.
2859 Do not define this macro if you put all constants in the read-only data
2860 section.
2862 Defined in svr4.h. */
2863 #undef SELECT_RTX_SECTION
2864 #define SELECT_RTX_SECTION(MODE, RTX, ALIGN) frv_select_rtx_section (MODE, RTX)
2866 #define SDATA_FLAG_CHAR '@'
2868 #define SDATA_NAME_P(NAME) (*(NAME) == SDATA_FLAG_CHAR)
2870 #define ENCODE_SECTION_INFO(DECL, FIRST) \
2871 do \
2873 if (FIRST) \
2874 frv_encode_section_info (DECL); \
2876 while (0)
2878 /* Decode SYM_NAME and store the real name part in VAR, sans
2879 the characters that encode section info. Define this macro if
2880 ENCODE_SECTION_INFO alters the symbol's name string. */
2882 #define STRIP_NAME_ENCODING(VAR, SYMBOL_NAME) \
2883 do \
2885 const char * _name = (SYMBOL_NAME); \
2887 while (* _name == '*' || * _name == SDATA_FLAG_CHAR) \
2888 _name ++; \
2889 (VAR) = _name; \
2891 while (0)
2894 /* Position Independent Code. */
2896 /* A C expression that is nonzero if X is a legitimate immediate operand on the
2897 target machine when generating position independent code. You can assume
2898 that X satisfies `CONSTANT_P', so you need not check this. You can also
2899 assume FLAG_PIC is true, so you need not check it either. You need not
2900 define this macro if all constants (including `SYMBOL_REF') can be immediate
2901 operands when generating position independent code. */
2902 #define LEGITIMATE_PIC_OPERAND_P(X) \
2903 ( GET_CODE (X) == CONST_INT \
2904 || GET_CODE (X) == CONST_DOUBLE \
2905 || (GET_CODE (X) == HIGH && GET_CODE (XEXP (X, 0)) == CONST_INT) \
2906 || GET_CODE (X) == CONSTANT_P_RTX)
2909 /* The Overall Framework of an Assembler File. */
2911 /* A C string constant describing how to begin a comment in the target
2912 assembler language. The compiler assumes that the comment will end at the
2913 end of the line. */
2914 #define ASM_COMMENT_START ";"
2916 /* A C string constant for text to be output before each `asm' statement or
2917 group of consecutive ones. Normally this is `"#APP"', which is a comment
2918 that has no effect on most assemblers but tells the GNU assembler that it
2919 must check the lines that follow for all valid assembler constructs. */
2920 #define ASM_APP_ON "#APP\n"
2922 /* A C string constant for text to be output after each `asm' statement or
2923 group of consecutive ones. Normally this is `"#NO_APP"', which tells the
2924 GNU assembler to resume making the time-saving assumptions that are valid
2925 for ordinary compiler output. */
2926 #define ASM_APP_OFF "#NO_APP\n"
2929 /* Output of Data. */
2931 /* This is how to output a label to dwarf/dwarf2. */
2932 #define ASM_OUTPUT_DWARF_ADDR(STREAM, LABEL) \
2933 do { \
2934 fprintf (STREAM, "\t.picptr\t"); \
2935 assemble_name (STREAM, LABEL); \
2936 } while (0)
2938 /* Whether to emit the gas specific dwarf2 line number support. */
2939 #define DWARF2_ASM_LINE_DEBUG_INFO (TARGET_DEBUG_LOC)
2941 /* Output of Uninitialized Variables. */
2943 /* A C statement (sans semicolon) to output to the stdio stream STREAM the
2944 assembler definition of a local-common-label named NAME whose size is SIZE
2945 bytes. The variable ROUNDED is the size rounded up to whatever alignment
2946 the caller wants.
2948 Use the expression `assemble_name (STREAM, NAME)' to output the name itself;
2949 before and after that, output the additional assembler syntax for defining
2950 the name, and a newline.
2952 This macro controls how the assembler definitions of uninitialized static
2953 variables are output. */
2954 #undef ASM_OUTPUT_LOCAL
2956 /* Like `ASM_OUTPUT_LOCAL' except takes the required alignment as a separate,
2957 explicit argument. If you define this macro, it is used in place of
2958 `ASM_OUTPUT_LOCAL', and gives you more flexibility in handling the required
2959 alignment of the variable. The alignment is specified as the number of
2960 bits.
2962 Defined in svr4.h. */
2963 #undef ASM_OUTPUT_ALIGNED_LOCAL
2965 /* This is for final.c, because it is used by ASM_DECLARE_OBJECT_NAME. */
2966 extern int size_directive_output;
2968 /* Like `ASM_OUTPUT_ALIGNED_LOCAL' except that it takes an additional
2969 parameter - the DECL of variable to be output, if there is one.
2970 This macro can be called with DECL == NULL_TREE. If you define
2971 this macro, it is used in place of `ASM_OUTPUT_LOCAL' and
2972 `ASM_OUTPUT_ALIGNED_LOCAL', and gives you more flexibility in
2973 handling the destination of the variable. */
2974 #undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
2975 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGN) \
2976 do { \
2977 if (SDATA_NAME_P (NAME)) \
2978 sbss_section (); \
2979 else \
2980 bss_section (); \
2981 ASM_OUTPUT_ALIGN (STREAM, floor_log2 ((ALIGN) / BITS_PER_UNIT)); \
2982 ASM_DECLARE_OBJECT_NAME (STREAM, NAME, DECL); \
2983 ASM_OUTPUT_SKIP (STREAM, (SIZE) ? (SIZE) : 1); \
2984 } while (0)
2987 /* Output and Generation of Labels. */
2989 /* A C statement (sans semicolon) to output to the stdio stream STREAM the
2990 assembler definition of a label named NAME. Use the expression
2991 `assemble_name (STREAM, NAME)' to output the name itself; before and after
2992 that, output the additional assembler syntax for defining the name, and a
2993 newline. */
2994 #define ASM_OUTPUT_LABEL(STREAM, NAME) \
2995 do { \
2996 assemble_name (STREAM, NAME); \
2997 fputs (":\n", STREAM); \
2998 } while (0)
3000 /* A C statement (sans semicolon) to output to the stdio stream STREAM some
3001 commands that will make the label NAME global; that is, available for
3002 reference from other files. Use the expression `assemble_name (STREAM,
3003 NAME)' to output the name itself; before and after that, output the
3004 additional assembler syntax for making that name global, and a newline. */
3005 #define ASM_GLOBALIZE_LABEL(STREAM, NAME) \
3006 do { \
3007 fputs ("\t.globl ", STREAM); \
3008 assemble_name (STREAM, NAME); \
3009 fputs ("\n", STREAM); \
3010 } while (0)
3012 /* A C statement (sans semicolon) to output to the stdio stream STREAM a
3013 reference in assembler syntax to a label named NAME. This should add `_' to
3014 the front of the name, if that is customary on your operating system, as it
3015 is in most Berkeley Unix systems. This macro is used in `assemble_name'. */
3016 #undef ASM_OUTPUT_LABELREF
3017 #define ASM_OUTPUT_LABELREF(STREAM, NAME) \
3018 do { \
3019 const char *_name = (NAME); \
3020 while (*_name == '*' || *_name == SDATA_FLAG_CHAR) \
3021 _name++; \
3022 asm_fprintf (STREAM, "%U%s", _name); \
3023 } while (0)
3025 /* A C statement to store into the string STRING a label whose name is made
3026 from the string PREFIX and the number NUM.
3028 This string, when output subsequently by `assemble_name', should produce the
3029 output that `ASM_OUTPUT_INTERNAL_LABEL' would produce with the same PREFIX
3030 and NUM.
3032 If the string begins with `*', then `assemble_name' will output the rest of
3033 the string unchanged. It is often convenient for
3034 `ASM_GENERATE_INTERNAL_LABEL' to use `*' in this way. If the string doesn't
3035 start with `*', then `ASM_OUTPUT_LABELREF' gets to output the string, and
3036 may change it. (Of course, `ASM_OUTPUT_LABELREF' is also part of your
3037 machine description, so you should know what it does on your machine.)
3039 Defined in svr4.h. */
3040 #undef ASM_GENERATE_INTERNAL_LABEL
3041 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
3042 do { \
3043 sprintf (LABEL, "*.%s%ld", PREFIX, (long)NUM); \
3044 } while (0)
3046 /* A C expression to assign to OUTVAR (which is a variable of type `char *') a
3047 newly allocated string made from the string NAME and the number NUMBER, with
3048 some suitable punctuation added. Use `alloca' to get space for the string.
3050 The string will be used as an argument to `ASM_OUTPUT_LABELREF' to produce
3051 an assembler label for an internal static variable whose name is NAME.
3052 Therefore, the string must be such as to result in valid assembler code.
3053 The argument NUMBER is different each time this macro is executed; it
3054 prevents conflicts between similarly-named internal static variables in
3055 different scopes.
3057 Ideally this string should not be a valid C identifier, to prevent any
3058 conflict with the user's own symbols. Most assemblers allow periods or
3059 percent signs in assembler symbols; putting at least one of these between
3060 the name and the number will suffice. */
3061 #define ASM_FORMAT_PRIVATE_NAME(OUTVAR, NAME, NUMBER) \
3062 do { \
3063 (OUTVAR) = (char *) alloca (strlen ((NAME)) + 12); \
3064 sprintf ((OUTVAR), "%s.%ld", (NAME), (long)(NUMBER)); \
3065 } while (0)
3068 /* Macros Controlling Initialization Routines. */
3070 /* If defined, a C string constant for the assembler operation to identify the
3071 following data as initialization code. If not defined, GNU CC will assume
3072 such a section does not exist. When you are using special sections for
3073 initialization and termination functions, this macro also controls how
3074 `crtstuff.c' and `libgcc2.c' arrange to run the initialization functions.
3076 Defined in svr4.h. */
3077 #undef INIT_SECTION_ASM_OP
3079 /* If defined, `main' will call `__main' despite the presence of
3080 `INIT_SECTION_ASM_OP'. This macro should be defined for systems where the
3081 init section is not actually run automatically, but is still useful for
3082 collecting the lists of constructors and destructors. */
3083 #define INVOKE__main
3085 /* Output appropriate code tp call a static constructor. */
3086 #undef ASM_OUTPUT_CONSTRUCTOR
3087 #define ASM_OUTPUT_CONSTRUCTOR(STREAM,NAME) \
3088 do { \
3089 ctors_section (); \
3090 fprintf (STREAM, "\t.picptr\t"); \
3091 assemble_name (STREAM, NAME); \
3092 fprintf (STREAM, "\n"); \
3093 } while (0)
3095 /* Output appropriate code tp call a static destructor. */
3096 #undef ASM_OUTPUT_DESTRUCTOR
3097 #define ASM_OUTPUT_DESTRUCTOR(STREAM,NAME) \
3098 do { \
3099 dtors_section (); \
3100 fprintf (STREAM, "\t.picptr\t"); \
3101 assemble_name (STREAM, NAME); \
3102 fprintf (STREAM, "\n"); \
3103 } while (0)
3106 /* Output of Assembler Instructions. */
3108 /* A C initializer containing the assembler's names for the machine registers,
3109 each one as a C string constant. This is what translates register numbers
3110 in the compiler into assembler language. */
3111 #define REGISTER_NAMES \
3113 "gr0", "sp", "fp", "gr3", "gr4", "gr5", "gr6", "gr7", \
3114 "gr8", "gr9", "gr10", "gr11", "gr12", "gr13", "gr14", "gr15", \
3115 "gr16", "gr17", "gr18", "gr19", "gr20", "gr21", "gr22", "gr23", \
3116 "gr24", "gr25", "gr26", "gr27", "gr28", "gr29", "gr30", "gr31", \
3117 "gr32", "gr33", "gr34", "gr35", "gr36", "gr37", "gr38", "gr39", \
3118 "gr40", "gr41", "gr42", "gr43", "gr44", "gr45", "gr46", "gr47", \
3119 "gr48", "gr49", "gr50", "gr51", "gr52", "gr53", "gr54", "gr55", \
3120 "gr56", "gr57", "gr58", "gr59", "gr60", "gr61", "gr62", "gr63", \
3122 "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", \
3123 "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", \
3124 "fr16", "fr17", "fr18", "fr19", "fr20", "fr21", "fr22", "fr23", \
3125 "fr24", "fr25", "fr26", "fr27", "fr28", "fr29", "fr30", "fr31", \
3126 "fr32", "fr33", "fr34", "fr35", "fr36", "fr37", "fr38", "fr39", \
3127 "fr40", "fr41", "fr42", "fr43", "fr44", "fr45", "fr46", "fr47", \
3128 "fr48", "fr49", "fr50", "fr51", "fr52", "fr53", "fr54", "fr55", \
3129 "fr56", "fr57", "fr58", "fr59", "fr60", "fr61", "fr62", "fr63", \
3131 "fcc0", "fcc1", "fcc2", "fcc3", "icc0", "icc1", "icc2", "icc3", \
3132 "cc0", "cc1", "cc2", "cc3", "cc4", "cc5", "cc6", "cc7", \
3133 "acc0", "acc1", "acc2", "acc3", "acc4", "acc5", "acc6", "acc7", \
3134 "accg0","accg1","accg2","accg3","accg4","accg5","accg6","accg7", \
3135 "ap", "lr", "lcr" \
3138 /* Define this macro if you are using an unusual assembler that
3139 requires different names for the machine instructions.
3141 The definition is a C statement or statements which output an
3142 assembler instruction opcode to the stdio stream STREAM. The
3143 macro-operand PTR is a variable of type `char *' which points to
3144 the opcode name in its "internal" form--the form that is written
3145 in the machine description. The definition should output the
3146 opcode name to STREAM, performing any translation you desire, and
3147 increment the variable PTR to point at the end of the opcode so
3148 that it will not be output twice.
3150 In fact, your macro definition may process less than the entire
3151 opcode name, or more than the opcode name; but if you want to
3152 process text that includes `%'-sequences to substitute operands,
3153 you must take care of the substitution yourself. Just be sure to
3154 increment PTR over whatever text should not be output normally.
3156 If you need to look at the operand values, they can be found as the
3157 elements of `recog_operand'.
3159 If the macro definition does nothing, the instruction is output in
3160 the usual way. */
3162 #define ASM_OUTPUT_OPCODE(STREAM, PTR)\
3163 (PTR) = frv_asm_output_opcode (STREAM, PTR)
3165 /* If defined, a C statement to be executed just prior to the output
3166 of assembler code for INSN, to modify the extracted operands so
3167 they will be output differently.
3169 Here the argument OPVEC is the vector containing the operands
3170 extracted from INSN, and NOPERANDS is the number of elements of
3171 the vector which contain meaningful data for this insn. The
3172 contents of this vector are what will be used to convert the insn
3173 template into assembler code, so you can change the assembler
3174 output by changing the contents of the vector.
3176 This macro is useful when various assembler syntaxes share a single
3177 file of instruction patterns; by defining this macro differently,
3178 you can cause a large class of instructions to be output
3179 differently (such as with rearranged operands). Naturally,
3180 variations in assembler syntax affecting individual insn patterns
3181 ought to be handled by writing conditional output routines in
3182 those patterns.
3184 If this macro is not defined, it is equivalent to a null statement. */
3186 #define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS)\
3187 frv_final_prescan_insn (INSN, OPVEC, NOPERANDS)
3190 /* A C compound statement to output to stdio stream STREAM the assembler syntax
3191 for an instruction operand X. X is an RTL expression.
3193 CODE is a value that can be used to specify one of several ways of printing
3194 the operand. It is used when identical operands must be printed differently
3195 depending on the context. CODE comes from the `%' specification that was
3196 used to request printing of the operand. If the specification was just
3197 `%DIGIT' then CODE is 0; if the specification was `%LTR DIGIT' then CODE is
3198 the ASCII code for LTR.
3200 If X is a register, this macro should print the register's name. The names
3201 can be found in an array `reg_names' whose type is `char *[]'. `reg_names'
3202 is initialized from `REGISTER_NAMES'.
3204 When the machine description has a specification `%PUNCT' (a `%' followed by
3205 a punctuation character), this macro is called with a null pointer for X and
3206 the punctuation character for CODE. */
3207 #define PRINT_OPERAND(STREAM, X, CODE) frv_print_operand (STREAM, X, CODE)
3209 /* A C expression which evaluates to true if CODE is a valid punctuation
3210 character for use in the `PRINT_OPERAND' macro. If
3211 `PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no punctuation
3212 characters (except for the standard one, `%') are used in this way. */
3213 /* . == gr0
3214 # == hint operand -- always zero for now
3215 @ == small data base register (gr16)
3216 ~ == pic register (gr17)
3217 * == temporary integer CCR register (cr3)
3218 & == temporary integer ICC register (icc3) */
3219 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
3220 ((CODE) == '.' || (CODE) == '#' || (CODE) == SDATA_FLAG_CHAR || (CODE) == '~' \
3221 || (CODE) == '*' || (CODE) == '&')
3223 /* A C compound statement to output to stdio stream STREAM the assembler syntax
3224 for an instruction operand that is a memory reference whose address is X. X
3225 is an RTL expression.
3227 On some machines, the syntax for a symbolic address depends on the section
3228 that the address refers to. On these machines, define the macro
3229 `ENCODE_SECTION_INFO' to store the information into the `symbol_ref', and
3230 then check for it here.
3232 This declaration must be present. */
3233 #define PRINT_OPERAND_ADDRESS(STREAM, X) frv_print_operand_address (STREAM, X)
3235 /* If defined, C string expressions to be used for the `%R', `%L', `%U', and
3236 `%I' options of `asm_fprintf' (see `final.c'). These are useful when a
3237 single `md' file must support multiple assembler formats. In that case, the
3238 various `tm.h' files can define these macros differently.
3240 USER_LABEL_PREFIX is defined in svr4.h. */
3241 #undef USER_LABEL_PREFIX
3242 #define USER_LABEL_PREFIX ""
3243 #define REGISTER_PREFIX ""
3244 #define LOCAL_LABEL_PREFIX "."
3245 #define IMMEDIATE_PREFIX "#"
3248 /* Output of dispatch tables. */
3250 /* This macro should be provided on machines where the addresses in a dispatch
3251 table are relative to the table's own address.
3253 The definition should be a C statement to output to the stdio stream STREAM
3254 an assembler pseudo-instruction to generate a difference between two labels.
3255 VALUE and REL are the numbers of two internal labels. The definitions of
3256 these labels are output using `ASM_OUTPUT_INTERNAL_LABEL', and they must be
3257 printed in the same way here. For example,
3259 fprintf (STREAM, "\t.word L%d-L%d\n", VALUE, REL) */
3260 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
3261 fprintf (STREAM, "\t.word .L%d-.L%d\n", VALUE, REL)
3263 /* This macro should be provided on machines where the addresses in a dispatch
3264 table are absolute.
3266 The definition should be a C statement to output to the stdio stream STREAM
3267 an assembler pseudo-instruction to generate a reference to a label. VALUE
3268 is the number of an internal label whose definition is output using
3269 `ASM_OUTPUT_INTERNAL_LABEL'. For example,
3271 fprintf (STREAM, "\t.word L%d\n", VALUE) */
3272 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
3273 fprintf (STREAM, "\t.word .L%d\n", VALUE)
3275 /* Define this if the label before a jump-table needs to be output specially.
3276 The first three arguments are the same as for `ASM_OUTPUT_INTERNAL_LABEL';
3277 the fourth argument is the jump-table which follows (a `jump_insn'
3278 containing an `addr_vec' or `addr_diff_vec').
3280 This feature is used on system V to output a `swbeg' statement for the
3281 table.
3283 If this macro is not defined, these labels are output with
3284 `ASM_OUTPUT_INTERNAL_LABEL'.
3286 Defined in svr4.h. */
3287 /* When generating embedded PIC or mips16 code we want to put the jump
3288 table in the .text section. In all other cases, we want to put the
3289 jump table in the .rdata section. Unfortunately, we can't use
3290 JUMP_TABLES_IN_TEXT_SECTION, because it is not conditional.
3291 Instead, we use ASM_OUTPUT_CASE_LABEL to switch back to the .text
3292 section if appropriate. */
3294 #undef ASM_OUTPUT_CASE_LABEL
3295 #define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \
3296 do { \
3297 if (flag_pic) \
3298 function_section (current_function_decl); \
3299 ASM_OUTPUT_INTERNAL_LABEL (STREAM, PREFIX, NUM); \
3300 } while (0)
3302 /* Define this to determine whether case statement labels are relative to
3303 the start of the case statement or not. */
3305 #define CASE_VECTOR_PC_RELATIVE (flag_pic)
3308 /* Assembler Commands for Exception Regions. */
3310 /* Define this macro to 0 if your target supports DWARF 2 frame unwind
3311 information, but it does not yet work with exception handling. Otherwise,
3312 if your target supports this information (if it defines
3313 `INCOMING_RETURN_ADDR_RTX' and either `UNALIGNED_INT_ASM_OP' or
3314 `OBJECT_FORMAT_ELF'), GCC will provide a default definition of 1.
3316 If this macro is defined to 1, the DWARF 2 unwinder will be the default
3317 exception handling mechanism; otherwise, setjmp/longjmp will be used by
3318 default.
3320 If this macro is defined to anything, the DWARF 2 unwinder will be used
3321 instead of inline unwinders and __unwind_function in the non-setjmp case. */
3322 #define DWARF2_UNWIND_INFO 1
3324 #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (LR_REGNO)
3326 /* Assembler Commands for Alignment. */
3328 /* A C statement to output to the stdio stream STREAM an assembler instruction
3329 to advance the location counter by NBYTES bytes. Those bytes should be zero
3330 when loaded. NBYTES will be a C expression of type `int'.
3332 Defined in svr4.h. */
3333 #undef ASM_OUTPUT_SKIP
3334 #define ASM_OUTPUT_SKIP(STREAM, NBYTES) \
3335 fprintf (STREAM, "\t.zero\t%u\n", (NBYTES))
3337 /* A C statement to output to the stdio stream STREAM an assembler command to
3338 advance the location counter to a multiple of 2 to the POWER bytes. POWER
3339 will be a C expression of type `int'. */
3340 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
3341 fprintf ((STREAM), "\t.p2align %d\n", (POWER))
3344 /* Macros Affecting all Debug Formats. */
3346 /* A C expression that returns the DBX register number for the compiler
3347 register number REGNO. In simple cases, the value of this expression may be
3348 REGNO itself. But sometimes there are some registers that the compiler
3349 knows about and DBX does not, or vice versa. In such cases, some register
3350 may need to have one number in the compiler and another for DBX.
3352 If two registers have consecutive numbers inside GNU CC, and they can be
3353 used as a pair to hold a multiword value, then they *must* have consecutive
3354 numbers after renumbering with `DBX_REGISTER_NUMBER'. Otherwise, debuggers
3355 will be unable to access such a pair, because they expect register pairs to
3356 be consecutive in their own numbering scheme.
3358 If you find yourself defining `DBX_REGISTER_NUMBER' in way that does not
3359 preserve register pairs, then what you must do instead is redefine the
3360 actual register numbering scheme.
3362 This declaration is required. */
3363 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
3365 /* A C expression that returns the type of debugging output GNU CC produces
3366 when the user specifies `-g' or `-ggdb'. Define this if you have arranged
3367 for GNU CC to support more than one format of debugging output. Currently,
3368 the allowable values are `DBX_DEBUG', `SDB_DEBUG', `DWARF_DEBUG',
3369 `DWARF2_DEBUG', and `XCOFF_DEBUG'.
3371 The value of this macro only affects the default debugging output; the user
3372 can always get a specific type of output by using `-gstabs', `-gcoff',
3373 `-gdwarf-1', `-gdwarf-2', or `-gxcoff'.
3375 Defined in svr4.h. */
3376 #undef PREFERRED_DEBUGGING_TYPE
3377 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
3379 /* This version of UNIQUE_SECTION overrides the one in elfos.h. We
3380 need to check whether DECL is destined for the .sdata section. */
3382 #undef UNIQUE_SECTION
3383 #define UNIQUE_SECTION(DECL,RELOC) frv_unique_section (DECL, RELOC)
3385 /* Miscellaneous Parameters. */
3387 /* Define this if you have defined special-purpose predicates in the file
3388 `MACHINE.c'. This macro is called within an initializer of an array of
3389 structures. The first field in the structure is the name of a predicate and
3390 the second field is an array of rtl codes. For each predicate, list all rtl
3391 codes that can be in expressions matched by the predicate. The list should
3392 have a trailing comma. Here is an example of two entries in the list for a
3393 typical RISC machine:
3395 #define PREDICATE_CODES \
3396 {"gen_reg_rtx_operand", {SUBREG, REG}}, \
3397 {"reg_or_short_cint_operand", {SUBREG, REG, CONST_INT}},
3399 Defining this macro does not affect the generated code (however, incorrect
3400 definitions that omit an rtl code that may be matched by the predicate can
3401 cause the compiler to malfunction). Instead, it allows the table built by
3402 `genrecog' to be more compact and efficient, thus speeding up the compiler.
3403 The most important predicates to include in the list specified by this macro
3404 are thoses used in the most insn patterns. */
3405 #define PREDICATE_CODES \
3406 { "integer_register_operand", { REG, SUBREG }}, \
3407 { "frv_load_operand", { REG, SUBREG, MEM }}, \
3408 { "gpr_no_subreg_operand", { REG }}, \
3409 { "gpr_or_fpr_operand", { REG, SUBREG }}, \
3410 { "gpr_or_int12_operand", { REG, SUBREG, CONST_INT }}, \
3411 { "gpr_fpr_or_int12_operand", { REG, SUBREG, CONST_INT }}, \
3412 { "gpr_or_int10_operand", { REG, SUBREG, CONST_INT }}, \
3413 { "gpr_or_int_operand", { REG, SUBREG, CONST_INT }}, \
3414 { "move_source_operand", { REG, SUBREG, CONST_INT, MEM, \
3415 CONST_DOUBLE, CONST, \
3416 SYMBOL_REF, LABEL_REF }}, \
3417 { "move_destination_operand", { REG, SUBREG, MEM }}, \
3418 { "condexec_source_operand", { REG, SUBREG, CONST_INT, MEM, \
3419 CONST_DOUBLE }}, \
3420 { "condexec_dest_operand", { REG, SUBREG, MEM }}, \
3421 { "reg_or_0_operand", { REG, SUBREG, CONST_INT }}, \
3422 { "lr_operand", { REG }}, \
3423 { "gpr_or_memory_operand", { REG, SUBREG, MEM }}, \
3424 { "fpr_or_memory_operand", { REG, SUBREG, MEM }}, \
3425 { "int12_operand", { CONST_INT }}, \
3426 { "int_2word_operand", { CONST_INT, CONST_DOUBLE, \
3427 SYMBOL_REF, LABEL_REF, CONST }}, \
3428 { "pic_register_operand", { REG }}, \
3429 { "pic_symbolic_operand", { SYMBOL_REF, LABEL_REF, CONST }}, \
3430 { "small_data_register_operand", { REG }}, \
3431 { "small_data_symbolic_operand", { SYMBOL_REF, CONST }}, \
3432 { "icc_operand", { REG }}, \
3433 { "fcc_operand", { REG }}, \
3434 { "cc_operand", { REG }}, \
3435 { "icr_operand", { REG }}, \
3436 { "fcr_operand", { REG }}, \
3437 { "cr_operand", { REG }}, \
3438 { "fpr_operand", { REG, SUBREG }}, \
3439 { "even_reg_operand", { REG, SUBREG }}, \
3440 { "odd_reg_operand", { REG, SUBREG }}, \
3441 { "even_gpr_operand", { REG, SUBREG }}, \
3442 { "odd_gpr_operand", { REG, SUBREG }}, \
3443 { "quad_fpr_operand", { REG, SUBREG }}, \
3444 { "even_fpr_operand", { REG, SUBREG }}, \
3445 { "odd_fpr_operand", { REG, SUBREG }}, \
3446 { "dbl_memory_one_insn_operand", { MEM }}, \
3447 { "dbl_memory_two_insn_operand", { MEM }}, \
3448 { "call_operand", { REG, SUBREG, PLUS, CONST_INT, \
3449 SYMBOL_REF, LABEL_REF, CONST }}, \
3450 { "upper_int16_operand", { CONST_INT }}, \
3451 { "uint16_operand", { CONST_INT }}, \
3452 { "relational_operator", { EQ, NE, LE, LT, GE, GT, \
3453 LEU, LTU, GEU, GTU }}, \
3454 { "signed_relational_operator", { EQ, NE, LE, LT, GE, GT }}, \
3455 { "unsigned_relational_operator", { LEU, LTU, GEU, GTU }}, \
3456 { "float_relational_operator", { EQ, NE, LE, LT, GE, GT }}, \
3457 { "ccr_eqne_operator", { EQ, NE }}, \
3458 { "minmax_operator", { SMIN, SMAX, UMIN, UMAX }}, \
3459 { "condexec_si_binary_operator", { PLUS, MINUS, AND, IOR, XOR, \
3460 ASHIFT, ASHIFTRT, LSHIFTRT }}, \
3461 { "condexec_si_divide_operator", { DIV, UDIV }}, \
3462 { "condexec_si_unary_operator", { NOT, NEG }}, \
3463 { "condexec_sf_binary_operator", { PLUS, MINUS, MULT, DIV }}, \
3464 { "condexec_sf_unary_operator", { ABS, NEG, SQRT }}, \
3465 { "intop_compare_operator", { PLUS, MINUS, AND, IOR, XOR, \
3466 ASHIFT, ASHIFTRT, LSHIFTRT }}, \
3467 { "condexec_intop_cmp_operator", { PLUS, MINUS, AND, IOR, XOR, \
3468 ASHIFT, ASHIFTRT, LSHIFTRT }}, \
3469 { "fpr_or_int6_operand", { REG, SUBREG, CONST_INT }}, \
3470 { "int6_operand", { CONST_INT }}, \
3471 { "int5_operand", { CONST_INT }}, \
3472 { "uint5_operand", { CONST_INT }}, \
3473 { "uint4_operand", { CONST_INT }}, \
3474 { "uint1_operand", { CONST_INT }}, \
3475 { "acc_operand", { REG, SUBREG }}, \
3476 { "even_acc_operand", { REG, SUBREG }}, \
3477 { "quad_acc_operand", { REG, SUBREG }}, \
3478 { "accg_operand", { REG, SUBREG }},
3480 /* An alias for a machine mode name. This is the machine mode that elements of
3481 a jump-table should have. */
3482 #define CASE_VECTOR_MODE SImode
3484 /* Define this macro if operations between registers with integral mode smaller
3485 than a word are always performed on the entire register. Most RISC machines
3486 have this property and most CISC machines do not. */
3487 #define WORD_REGISTER_OPERATIONS
3489 /* Define this macro to be a C expression indicating when insns that read
3490 memory in MODE, an integral mode narrower than a word, set the bits outside
3491 of MODE to be either the sign-extension or the zero-extension of the data
3492 read. Return `SIGN_EXTEND' for values of MODE for which the insn
3493 sign-extends, `ZERO_EXTEND' for which it zero-extends, and `NIL' for other
3494 modes.
3496 This macro is not called with MODE non-integral or with a width greater than
3497 or equal to `BITS_PER_WORD', so you may return any value in this case. Do
3498 not define this macro if it would always return `NIL'. On machines where
3499 this macro is defined, you will normally define it as the constant
3500 `SIGN_EXTEND' or `ZERO_EXTEND'. */
3501 #define LOAD_EXTEND_OP(MODE) SIGN_EXTEND
3503 /* Define if loading short immediate values into registers sign extends. */
3504 #define SHORT_IMMEDIATES_SIGN_EXTEND
3506 /* An alias for a tree code that is the easiest kind of division to compile
3507 code for in the general case. It may be `TRUNC_DIV_EXPR', `FLOOR_DIV_EXPR',
3508 `CEIL_DIV_EXPR' or `ROUND_DIV_EXPR'. These four division operators differ
3509 in how they round the result to an integer. `EASY_DIV_EXPR' is used when it
3510 is permissible to use any of those kinds of division and the choice should
3511 be made on the basis of efficiency. */
3512 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
3514 /* The maximum number of bytes that a single instruction can move quickly from
3515 memory to memory. */
3516 #define MOVE_MAX 8
3518 /* A C expression which is nonzero if on this machine it is safe to "convert"
3519 an integer of INPREC bits to one of OUTPREC bits (where OUTPREC is smaller
3520 than INPREC) by merely operating on it as if it had only OUTPREC bits.
3522 On many machines, this expression can be 1.
3524 When `TRULY_NOOP_TRUNCATION' returns 1 for a pair of sizes for modes for
3525 which `MODES_TIEABLE_P' is 0, suboptimal code can result. If this is the
3526 case, making `TRULY_NOOP_TRUNCATION' return 0 in such cases may improve
3527 things. */
3528 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
3530 /* An alias for the machine mode for pointers. On most machines, define this
3531 to be the integer mode corresponding to the width of a hardware pointer;
3532 `SImode' on 32-bit machine or `DImode' on 64-bit machines. On some machines
3533 you must define this to be one of the partial integer modes, such as
3534 `PSImode'.
3536 The width of `Pmode' must be at least as large as the value of
3537 `POINTER_SIZE'. If it is not equal, you must define the macro
3538 `POINTERS_EXTEND_UNSIGNED' to specify how pointers are extended to `Pmode'. */
3539 #define Pmode SImode
3541 /* An alias for the machine mode used for memory references to functions being
3542 called, in `call' RTL expressions. On most machines this should be
3543 `QImode'. */
3544 #define FUNCTION_MODE QImode
3546 /* Define this macro to handle System V style pragmas: #pragma pack and
3547 #pragma weak. Note, #pragma weak will only be supported if SUPPORT_WEAK is
3548 defined.
3550 Defined in svr4.h. */
3551 #define HANDLE_SYSV_PRAGMA
3553 /* A C expression for the maximum number of instructions to execute via
3554 conditional execution instructions instead of a branch. A value of
3555 BRANCH_COST+1 is the default if the machine does not use
3556 cc0, and 1 if it does use cc0. */
3557 #define MAX_CONDITIONAL_EXECUTE frv_condexec_insns
3559 /* Default value of MAX_CONDITIONAL_EXECUTE if no -mcond-exec-insns= */
3560 #define DEFAULT_CONDEXEC_INSNS 8
3562 /* A C expression to modify the code described by the conditional if
3563 information CE_INFO, possibly updating the tests in TRUE_EXPR, and
3564 FALSE_EXPR for converting if-then and if-then-else code to conditional
3565 instructions. Set either TRUE_EXPR or FALSE_EXPR to a null pointer if the
3566 tests cannot be converted. */
3567 #define IFCVT_MODIFY_TESTS(CE_INFO, TRUE_EXPR, FALSE_EXPR) \
3568 frv_ifcvt_modify_tests (CE_INFO, &TRUE_EXPR, &FALSE_EXPR)
3570 /* A C expression to modify the code described by the conditional if
3571 information CE_INFO, for the basic block BB, possibly updating the tests in
3572 TRUE_EXPR, and FALSE_EXPR for converting the && and || parts of if-then or
3573 if-then-else code to conditional instructions. OLD_TRUE and OLD_FALSE are
3574 the previous tests. Set either TRUE_EXPR or FALSE_EXPR to a null pointer if
3575 the tests cannot be converted. */
3576 #define IFCVT_MODIFY_MULTIPLE_TESTS(CE_INFO, BB, TRUE_EXPR, FALSE_EXPR) \
3577 frv_ifcvt_modify_multiple_tests (CE_INFO, BB, &TRUE_EXPR, &FALSE_EXPR)
3579 /* A C expression to modify the code described by the conditional if
3580 information CE_INFO with the new PATTERN in INSN. If PATTERN is a null
3581 pointer after the IFCVT_MODIFY_INSN macro executes, it is assumed that that
3582 insn cannot be converted to be executed conditionally. */
3583 #define IFCVT_MODIFY_INSN(CE_INFO, PATTERN, INSN) \
3584 (PATTERN) = frv_ifcvt_modify_insn (CE_INFO, PATTERN, INSN)
3586 /* A C expression to perform any final machine dependent modifications in
3587 converting code to conditional execution in the code described by the
3588 conditional if information CE_INFO. */
3589 #define IFCVT_MODIFY_FINAL(CE_INFO) frv_ifcvt_modify_final (CE_INFO)
3591 /* A C expression to cancel any machine dependent modifications in converting
3592 code to conditional execution in the code described by the conditional if
3593 information CE_INFO. */
3594 #define IFCVT_MODIFY_CANCEL(CE_INFO) frv_ifcvt_modify_cancel (CE_INFO)
3596 /* Initialize the extra fields provided by IFCVT_EXTRA_FIELDS. */
3597 #define IFCVT_INIT_EXTRA_FIELDS(CE_INFO) frv_ifcvt_init_extra_fields (CE_INFO)
3599 /* Indicate how many instructions can be issued at the same time. */
3600 #define ISSUE_RATE \
3601 (! TARGET_PACK ? 1 \
3602 : (frv_cpu_type == FRV_CPU_GENERIC \
3603 || frv_cpu_type == FRV_CPU_FR500 \
3604 || frv_cpu_type == FRV_CPU_TOMCAT) ? 4 \
3605 : frv_cpu_type == FRV_CPU_FR400 ? 2 : 1)
3607 /* Set and clear whether this insn begins a VLIW insn. */
3608 #define CLEAR_VLIW_START(INSN) PUT_MODE (INSN, VOIDmode)
3609 #define SET_VLIW_START(INSN) PUT_MODE (INSN, TImode)
3611 /* The definition of the following macro results in that the 2nd jump
3612 optimization (after the 2nd insn scheduling) is minimal. It is
3613 necessary to define when start cycle marks of insns (TImode is used
3614 for this) is used for VLIW insn packing. Some jump optimizations
3615 make such marks invalid. These marks are corrected for some
3616 (minimal) optimizations. ??? Probably the macro is temporary.
3617 Final solution could making the 2nd jump optimizations before the
3618 2nd instruction scheduling or corrections of the marks for all jump
3619 optimizations. Although some jump optimizations are actually
3620 deoptimizations for VLIW (super-scalar) processors. */
3622 #define MINIMAL_SECOND_JUMP_OPTIMIZATION
3624 /* Return true if parallel operations are expected to be emitted via the
3625 packing flag. */
3626 #define PACKING_FLAG_USED_P() \
3627 (optimize && flag_schedule_insns_after_reload && ISSUE_RATE > 1)
3629 /* If the following macro is defined and non zero and deterministic
3630 finite state automata are used for pipeline hazard recognition, the
3631 code making resource-constrained software pipelining is on. */
3632 #define RCSP_SOFTWARE_PIPELINING 1
3634 /* If the following macro is defined and non zero and deterministic
3635 finite state automata are used for pipeline hazard recognition, we
3636 will try to exchange insns in queue ready to improve the schedule.
3637 The more macro value, the more tries will be made. */
3638 #define FIRST_CYCLE_MULTIPASS_SCHEDULING 1
3640 /* The following macro is used only when value of
3641 FIRST_CYCLE_MULTIPASS_SCHEDULING is nonzero. The more macro value,
3642 the more tries will be made to choose better schedule. If the
3643 macro value is zero or negative there will be no multi-pass
3644 scheduling. */
3645 #define FIRST_CYCLE_MULTIPASS_SCHEDULING_LOOKAHEAD frv_sched_lookahead
3647 /* Return true if a function is ok to be called as a sibcall. */
3648 #define FUNCTION_OK_FOR_SIBCALL(DECL) 0
3650 enum frv_builtins
3652 FRV_BUILTIN_MAND,
3653 FRV_BUILTIN_MOR,
3654 FRV_BUILTIN_MXOR,
3655 FRV_BUILTIN_MNOT,
3656 FRV_BUILTIN_MAVEH,
3657 FRV_BUILTIN_MSATHS,
3658 FRV_BUILTIN_MSATHU,
3659 FRV_BUILTIN_MADDHSS,
3660 FRV_BUILTIN_MADDHUS,
3661 FRV_BUILTIN_MSUBHSS,
3662 FRV_BUILTIN_MSUBHUS,
3663 FRV_BUILTIN_MPACKH,
3664 FRV_BUILTIN_MQADDHSS,
3665 FRV_BUILTIN_MQADDHUS,
3666 FRV_BUILTIN_MQSUBHSS,
3667 FRV_BUILTIN_MQSUBHUS,
3668 FRV_BUILTIN_MUNPACKH,
3669 FRV_BUILTIN_MDPACKH,
3670 FRV_BUILTIN_MBTOH,
3671 FRV_BUILTIN_MHTOB,
3672 FRV_BUILTIN_MCOP1,
3673 FRV_BUILTIN_MCOP2,
3674 FRV_BUILTIN_MROTLI,
3675 FRV_BUILTIN_MROTRI,
3676 FRV_BUILTIN_MWCUT,
3677 FRV_BUILTIN_MSLLHI,
3678 FRV_BUILTIN_MSRLHI,
3679 FRV_BUILTIN_MSRAHI,
3680 FRV_BUILTIN_MEXPDHW,
3681 FRV_BUILTIN_MEXPDHD,
3682 FRV_BUILTIN_MMULHS,
3683 FRV_BUILTIN_MMULHU,
3684 FRV_BUILTIN_MMULXHS,
3685 FRV_BUILTIN_MMULXHU,
3686 FRV_BUILTIN_MMACHS,
3687 FRV_BUILTIN_MMACHU,
3688 FRV_BUILTIN_MMRDHS,
3689 FRV_BUILTIN_MMRDHU,
3690 FRV_BUILTIN_MQMULHS,
3691 FRV_BUILTIN_MQMULHU,
3692 FRV_BUILTIN_MQMULXHU,
3693 FRV_BUILTIN_MQMULXHS,
3694 FRV_BUILTIN_MQMACHS,
3695 FRV_BUILTIN_MQMACHU,
3696 FRV_BUILTIN_MCPXRS,
3697 FRV_BUILTIN_MCPXRU,
3698 FRV_BUILTIN_MCPXIS,
3699 FRV_BUILTIN_MCPXIU,
3700 FRV_BUILTIN_MQCPXRS,
3701 FRV_BUILTIN_MQCPXRU,
3702 FRV_BUILTIN_MQCPXIS,
3703 FRV_BUILTIN_MQCPXIU,
3704 FRV_BUILTIN_MCUT,
3705 FRV_BUILTIN_MCUTSS,
3706 FRV_BUILTIN_MWTACC,
3707 FRV_BUILTIN_MWTACCG,
3708 FRV_BUILTIN_MRDACC,
3709 FRV_BUILTIN_MRDACCG,
3710 FRV_BUILTIN_MTRAP,
3711 FRV_BUILTIN_MCLRACC,
3712 FRV_BUILTIN_MCLRACCA,
3713 FRV_BUILTIN_MDUNPACKH,
3714 FRV_BUILTIN_MBTOHE,
3715 FRV_BUILTIN_MQXMACHS,
3716 FRV_BUILTIN_MQXMACXHS,
3717 FRV_BUILTIN_MQMACXHS,
3718 FRV_BUILTIN_MADDACCS,
3719 FRV_BUILTIN_MSUBACCS,
3720 FRV_BUILTIN_MASACCS,
3721 FRV_BUILTIN_MDADDACCS,
3722 FRV_BUILTIN_MDSUBACCS,
3723 FRV_BUILTIN_MDASACCS,
3724 FRV_BUILTIN_MABSHS,
3725 FRV_BUILTIN_MDROTLI,
3726 FRV_BUILTIN_MCPLHI,
3727 FRV_BUILTIN_MCPLI,
3728 FRV_BUILTIN_MDCUTSSI,
3729 FRV_BUILTIN_MQSATHS,
3730 FRV_BUILTIN_MHSETLOS,
3731 FRV_BUILTIN_MHSETLOH,
3732 FRV_BUILTIN_MHSETHIS,
3733 FRV_BUILTIN_MHSETHIH,
3734 FRV_BUILTIN_MHDSETS,
3735 FRV_BUILTIN_MHDSETH
3738 #define MD_INIT_BUILTINS do { \
3739 frv_init_builtins (); \
3740 } while (0)
3742 #define MD_EXPAND_BUILTIN(EXP, TARGET, SUBTARGET, MODE, IGNORE) \
3743 frv_expand_builtin ((EXP), (TARGET), (SUBTARGET), (MODE), (IGNORE))
3745 /* Enable prototypes on the call rtl functions. */
3746 #define MD_CALL_PROTOTYPES 1
3748 extern GTY(()) rtx frv_compare_op0; /* operand save for */
3749 extern GTY(()) rtx frv_compare_op1; /* comparison generation */
3751 #endif /* __FRV_H__ */