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. 4 5 This file is part of GCC. 6 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. 11 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. 16 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. */ 21 22 #ifndef __FRV_H__ 23 #define __FRV_H__ 24 25 /* Set up System V.4 (aka ELF) defaults. */ 26 #include "svr4.h" 27 28 29 /* Frv general purpose macros. */ 30 /* Align an address. */ 31 #define ADDR_ALIGN(addr,align) (((addr) + (align) - 1) & ~((align) - 1)) 32 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)))) 37 38 39 /* Driver configuration. */ 40 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. 44 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. 48 49 Defined in svr4.h. */ 50 #undef SWITCH_TAKES_ARG 51 #define SWITCH_TAKES_ARG(CHAR) \ 52 (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') 53 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. 58 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. 64 65 Defined in svr4.h. */ 66 #undef WORD_SWITCH_TAKES_ARG 67 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. 72 73 Do not define this macro if it does not need to do anything. 74 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}}" 90 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. 94 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'. 97 98 Defined in svr4.h. */ 99 #undef STARTFILE_SPEC 100 #define STARTFILE_SPEC "crt0%O%s frvbegin%O%s" 101 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. 105 106 Do not define this macro if it does not need to do anything. 107 108 Defined in svr4.h. */ 109 #undef ENDFILE_SPEC 110 #define ENDFILE_SPEC "frvend%O%s" 111 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. 115 116 Do not define this macro if it does not need to do anything. */ 117 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__}" 143 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. 146 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 */ 153 154 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" 162 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" 170 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" 177 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}" 184 185 #define MASK_DEFAULT_FRV \ 186 (MASK_MEDIA \ 187 | MASK_DOUBLE \ 188 | MASK_MULADD \ 189 | MASK_DWORD \ 190 | MASK_PACK) 191 192 #define MASK_DEFAULT_FR500 \ 193 (MASK_MEDIA | MASK_DWORD | MASK_PACK) 194 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) 203 204 #define MASK_DEFAULT_SIMPLE \ 205 (MASK_GPR_32 | MASK_SOFT_FLOAT) 206 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'. 210 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*}" 214 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. 218 219 Do not define this macro if it does not need to do anything. 220 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}" 234 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. 238 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'. 241 242 Defined in svr4.h. */ 243 244 #undef LIB_SPEC 245 #define LIB_SPEC "--start-group -lc -lsim --end-group" 246 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. 250 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. 254 255 Do not define this macro if it does not need to do anything. */ 256 257 #ifndef SUBTARGET_EXTRA_SPECS 258 #define SUBTARGET_EXTRA_SPECS 259 #endif 260 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 268 269 #ifndef CPP_CPU_DEFAULT_SPEC 270 #define CPP_CPU_DEFAULT_SPEC CPP_FR500_SPEC 271 #define CPU_TYPE FRV_CPU_FR500 272 #endif 273 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 280 281 /* Run-time target specifications */ 282 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. 286 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. */ 291 292 #define CPP_PREDEFINES "-D__frv__ -Amachine(frv)" 293 294 295 /* This declaration should be present. */ 296 extern int target_flags; 297 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'. 304 305 Define a macro `TARGET_FEATURENAME' for each such option. Its definition 306 should test a bit in `target_flags'; for example: 307 308 #define TARGET_68020 (target_flags & 1) 309 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. */ 314 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 */ 326 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 */ 340 341 #define MASK_DEFAULT MASK_DEFAULT_ALLOC_CC 342 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) 366 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) 378 379 #define TARGET_HAS_FPRS (TARGET_HARD_FLOAT || TARGET_MEDIA) 380 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) 384 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. 388 389 Treat the generic processor as a revision 1 machine for now, for 390 compatibility with earlier releases. */ 391 392 #define TARGET_MEDIA_REV1 \ 393 (TARGET_MEDIA \ 394 && (frv_cpu_type == FRV_CPU_GENERIC \ 395 || frv_cpu_type == FRV_CPU_FR500)) 396 397 #define TARGET_MEDIA_REV2 \ 398 (TARGET_MEDIA && frv_cpu_type == FRV_CPU_FR400) 399 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. 403 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. 413 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. 417 418 Here is an example which defines `-m68000' and `-m68020' with opposite 419 meanings, and picks the latter as the default: 420 421 #define TARGET_SWITCHES \ 422 { { "68020", 1, ""}, \ 423 { "68000", -1, "Compile for the m68000"}, \ 424 { "", 1, }} 425 426 This declaration must be present. */ 427 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, "" }} \ 471 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. 475 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. 481 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"'. 485 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" } } 490 491 This declaration is optional. */ 492 #define TARGET_OPTIONS \ 493 { \ 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" }, \ 499 } 500 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: 504 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)")) 513 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. 518 519 Don't use this macro to turn on various extra optimizations for `-O'. That 520 is what `OPTIMIZATION_OPTIONS' is for. */ 521 522 #define OVERRIDE_OPTIONS frv_override_options () 523 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. 529 530 LEVEL is the optimization level specified; 2 if `-O2' is specified, 1 if 531 `-O' is specified, and 0 if neither is specified. 532 533 SIZE is nonzero if `-Os' is specified, 0 otherwise. 534 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. 539 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) 543 544 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 */ 549 550 #define CAN_DEBUG_WITHOUT_FP 551 552 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 559 560 extern int g_switch_value; /* value of the -G xx switch */ 561 extern int g_switch_set; /* whether -G xx was passed. */ 562 563 564 /* Storage Layout */ 565 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. 572 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 576 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 580 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 587 588 /* Number of storage units in a word; normally 4. */ 589 #define UNITS_PER_WORD 4 590 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. 594 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. 600 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. 607 608 Do not define this macro if it would never modify MODE. */ 609 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ 610 do \ 611 { \ 612 if (GET_MODE_CLASS (MODE) == MODE_INT \ 613 && GET_MODE_SIZE (MODE) < 4) \ 614 (MODE) = SImode; \ 615 } \ 616 while (0) 617 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 622 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). 626 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 632 633 /* Alignment required for a function entry point, in bits. */ 634 #define FUNCTION_BOUNDARY 128 635 636 /* Biggest alignment that any data type can require on this machine, 637 in bits. */ 638 #define BIGGEST_ALIGNMENT 64 639 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 652 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. 657 658 If this macro is not defined, then ALIGN is used. 659 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)) 668 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. 673 674 If this macro is not defined, then ALIGN is used. 675 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)) 682 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 687 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. 690 691 The behavior is that the type written for a bit-field (`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 bit-field is placed within the structure so that it would fit within such 695 a field, not crossing a boundary for it. 696 697 Thus, on most machines, a bit-field 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.) 701 702 If the macro is defined, its definition should be a C expression; a nonzero 703 value for the expression enables this behavior. 704 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. 709 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. 713 714 Unless the machine has bit-field instructions or you define 715 `STRUCTURE_SIZE_BOUNDARY' that way, you must define 716 `PCC_BITFIELD_TYPE_MATTERS' to have a nonzero value. 717 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: 721 722 struct foo1 723 { 724 char x; 725 char :0; 726 char y; 727 }; 728 729 struct foo2 730 { 731 char x; 732 int :0; 733 char y; 734 }; 735 736 main () 737 { 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); 743 } 744 745 If this prints 2 and 5, then the compiler's behavior is what you would get 746 from `PCC_BITFIELD_TYPE_MATTERS'. 747 748 Defined in svr4.h. */ 749 #define PCC_BITFIELD_TYPE_MATTERS 1 750 751 752 /* Layout of Source Language Data Types. */ 753 754 #define CHAR_TYPE_SIZE 8 755 #define SHORT_TYPE_SIZE 16 756 #define INT_TYPE_SIZE 32 757 #define LONG_TYPE_SIZE 32 758 #define LONG_LONG_TYPE_SIZE 64 759 #define FLOAT_TYPE_SIZE 32 760 #define DOUBLE_TYPE_SIZE 64 761 #define LONG_DOUBLE_TYPE_SIZE 64 762 763 /* An expression whose value is 1 or 0, according to whether the type `char' 764 should be signed or unsigned by default. The user can always override this 765 default with the options `-fsigned-char' and `-funsigned-char'. */ 766 #define DEFAULT_SIGNED_CHAR 1 767 768 769 /* General purpose registers. */ 770 #define GPR_FIRST 0 /* First gpr */ 771 #define GPR_LAST (GPR_FIRST + 63) /* Last gpr */ 772 #define GPR_R0 GPR_FIRST /* R0, constant 0 */ 773 #define GPR_FP (GPR_FIRST + 2) /* Frame pointer */ 774 #define GPR_SP (GPR_FIRST + 1) /* Stack pointer */ 775 /* small data register */ 776 #define SDA_BASE_REG ((unsigned)(flag_pic ? PIC_REGNO : (GPR_FIRST+16))) 777 #define PIC_REGNO (GPR_FIRST + 17) /* PIC register */ 778 779 #define FPR_FIRST 64 /* First FP reg */ 780 #define FPR_LAST 127 /* Last FP reg */ 781 782 #define DEFAULT_CONDEXEC_TEMPS 4 /* reserve 4 regs by default */ 783 #define GPR_TEMP_NUM frv_condexec_temps /* # gprs to reserve for temps */ 784 785 /* We reserve the last CR and CCR in each category to be used as a reload 786 register to reload the CR/CCR registers. This is a kludge. */ 787 #define CC_FIRST 128 /* First ICC/FCC reg */ 788 #define CC_LAST 135 /* Last ICC/FCC reg */ 789 #define ICC_FIRST (CC_FIRST + 4) /* First ICC reg */ 790 #define ICC_LAST (CC_FIRST + 7) /* Last ICC reg */ 791 #define ICC_TEMP (CC_FIRST + 7) /* Temporary ICC reg */ 792 #define FCC_FIRST (CC_FIRST) /* First FCC reg */ 793 #define FCC_LAST (CC_FIRST + 3) /* Last FCC reg */ 794 795 /* Amount to shift a value to locate a ICC or FCC register in the CCR 796 register and shift it to the bottom 4 bits. */ 797 #define CC_SHIFT_RIGHT(REGNO) (((REGNO) - CC_FIRST) << 2) 798 799 /* Mask to isolate a single ICC/FCC value. */ 800 #define CC_MASK 0xf 801 802 /* Masks to isolate the various bits in an ICC field. */ 803 #define ICC_MASK_N 0x8 /* negative */ 804 #define ICC_MASK_Z 0x4 /* zero */ 805 #define ICC_MASK_V 0x2 /* overflow */ 806 #define ICC_MASK_C 0x1 /* carry */ 807 808 /* Mask to isolate the N/Z flags in an ICC. */ 809 #define ICC_MASK_NZ (ICC_MASK_N | ICC_MASK_Z) 810 811 /* Mask to isolate the Z/C flags in an ICC. */ 812 #define ICC_MASK_ZC (ICC_MASK_Z | ICC_MASK_C) 813 814 /* Masks to isolate the various bits in a FCC field. */ 815 #define FCC_MASK_E 0x8 /* equal */ 816 #define FCC_MASK_L 0x4 /* less than */ 817 #define FCC_MASK_G 0x2 /* greater than */ 818 #define FCC_MASK_U 0x1 /* unordered */ 819 820 /* For CCR registers, the machine wants CR4..CR7 to be used for integer 821 code and CR0..CR3 to be used for floating point. */ 822 #define CR_FIRST 136 /* First CCR */ 823 #define CR_LAST 143 /* Last CCR */ 824 #define CR_NUM (CR_LAST-CR_FIRST+1) /* # of CCRs (8) */ 825 #define ICR_FIRST (CR_FIRST + 4) /* First integer CCR */ 826 #define ICR_LAST (CR_FIRST + 7) /* Last integer CCR */ 827 #define ICR_TEMP ICR_LAST /* Temp integer CCR */ 828 #define FCR_FIRST (CR_FIRST + 0) /* First float CCR */ 829 #define FCR_LAST (CR_FIRST + 3) /* Last float CCR */ 830 831 /* Amount to shift a value to locate a CR register in the CCCR special purpose 832 register and shift it to the bottom 2 bits. */ 833 #define CR_SHIFT_RIGHT(REGNO) (((REGNO) - CR_FIRST) << 1) 834 835 /* Mask to isolate a single CR value. */ 836 #define CR_MASK 0x3 837 838 #define ACC_FIRST 144 /* First acc register */ 839 #define ACC_LAST 151 /* Last acc register */ 840 841 #define ACCG_FIRST 152 /* First accg register */ 842 #define ACCG_LAST 159 /* Last accg register */ 843 844 #define AP_FIRST 160 /* fake argument pointer */ 845 846 #define SPR_FIRST 161 847 #define SPR_LAST 162 848 #define LR_REGNO (SPR_FIRST) 849 #define LCR_REGNO (SPR_FIRST + 1) 850 851 #define GPR_P(R) IN_RANGE_P (R, GPR_FIRST, GPR_LAST) 852 #define GPR_OR_AP_P(R) (GPR_P (R) || (R) == ARG_POINTER_REGNUM) 853 #define FPR_P(R) IN_RANGE_P (R, FPR_FIRST, FPR_LAST) 854 #define CC_P(R) IN_RANGE_P (R, CC_FIRST, CC_LAST) 855 #define ICC_P(R) IN_RANGE_P (R, ICC_FIRST, ICC_LAST) 856 #define FCC_P(R) IN_RANGE_P (R, FCC_FIRST, FCC_LAST) 857 #define CR_P(R) IN_RANGE_P (R, CR_FIRST, CR_LAST) 858 #define ICR_P(R) IN_RANGE_P (R, ICR_FIRST, ICR_LAST) 859 #define FCR_P(R) IN_RANGE_P (R, FCR_FIRST, FCR_LAST) 860 #define ACC_P(R) IN_RANGE_P (R, ACC_FIRST, ACC_LAST) 861 #define ACCG_P(R) IN_RANGE_P (R, ACCG_FIRST, ACCG_LAST) 862 #define SPR_P(R) IN_RANGE_P (R, SPR_FIRST, SPR_LAST) 863 864 #define GPR_OR_PSEUDO_P(R) (GPR_P (R) || (R) >= FIRST_PSEUDO_REGISTER) 865 #define FPR_OR_PSEUDO_P(R) (FPR_P (R) || (R) >= FIRST_PSEUDO_REGISTER) 866 #define GPR_AP_OR_PSEUDO_P(R) (GPR_OR_AP_P (R) || (R) >= FIRST_PSEUDO_REGISTER) 867 #define CC_OR_PSEUDO_P(R) (CC_P (R) || (R) >= FIRST_PSEUDO_REGISTER) 868 #define ICC_OR_PSEUDO_P(R) (ICC_P (R) || (R) >= FIRST_PSEUDO_REGISTER) 869 #define FCC_OR_PSEUDO_P(R) (FCC_P (R) || (R) >= FIRST_PSEUDO_REGISTER) 870 #define CR_OR_PSEUDO_P(R) (CR_P (R) || (R) >= FIRST_PSEUDO_REGISTER) 871 #define ICR_OR_PSEUDO_P(R) (ICR_P (R) || (R) >= FIRST_PSEUDO_REGISTER) 872 #define FCR_OR_PSEUDO_P(R) (FCR_P (R) || (R) >= FIRST_PSEUDO_REGISTER) 873 #define ACC_OR_PSEUDO_P(R) (ACC_P (R) || (R) >= FIRST_PSEUDO_REGISTER) 874 #define ACCG_OR_PSEUDO_P(R) (ACCG_P (R) || (R) >= FIRST_PSEUDO_REGISTER) 875 876 #define MAX_STACK_IMMEDIATE_OFFSET 2047 877 878 879 /* Register Basics. */ 880 881 /* Number of hardware registers known to the compiler. They receive numbers 0 882 through `FIRST_PSEUDO_REGISTER-1'; thus, the first pseudo register's number 883 really is assigned the number `FIRST_PSEUDO_REGISTER'. */ 884 #define FIRST_PSEUDO_REGISTER (SPR_LAST + 1) 885 886 /* The first/last register that can contain the arguments to a function. */ 887 #define FIRST_ARG_REGNUM (GPR_FIRST + 8) 888 #define LAST_ARG_REGNUM (FIRST_ARG_REGNUM + FRV_NUM_ARG_REGS - 1) 889 890 /* Registers used by the exception handling functions. These should be 891 registers that are not otherwised used by the calling sequence. */ 892 #define FIRST_EH_REGNUM 14 893 #define LAST_EH_REGNUM 15 894 895 /* Scratch registers used in the prologue, epilogue and thunks. 896 OFFSET_REGNO is for loading constant addends that are too big for a 897 single instruction. TEMP_REGNO is used for transferring SPRs to and from 898 the stack, and various other activities. */ 899 #define OFFSET_REGNO 4 900 #define TEMP_REGNO 5 901 902 /* Registers used in the prologue. OLD_SP_REGNO is the old stack pointer, 903 which is sometimes used to set up the frame pointer. */ 904 #define OLD_SP_REGNO 6 905 906 /* Registers used in the epilogue. STACKADJ_REGNO stores the exception 907 handler's stack adjustment. */ 908 #define STACKADJ_REGNO 6 909 910 /* Registers used in thunks. JMP_REGNO is used for loading the target 911 address. */ 912 #define JUMP_REGNO 6 913 914 #define EH_RETURN_DATA_REGNO(N) ((N) <= (LAST_EH_REGNUM - FIRST_EH_REGNUM)? \ 915 (N) + FIRST_EH_REGNUM : INVALID_REGNUM) 916 #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, STACKADJ_REGNO) 917 #define EH_RETURN_HANDLER_RTX RETURN_ADDR_RTX (0, frame_pointer_rtx) 918 919 /* An initializer that says which registers are used for fixed purposes all 920 throughout the compiled code and are therefore not available for general 921 allocation. These would include the stack pointer, the frame pointer 922 (except on machines where that can be used as a general register when no 923 frame pointer is needed), the program counter on machines where that is 924 considered one of the addressable registers, and any other numbered register 925 with a standard use. 926 927 This information is expressed as a sequence of numbers, separated by commas 928 and surrounded by braces. The Nth number is 1 if register N is fixed, 0 929 otherwise. 930 931 The table initialized from this macro, and the table initialized by the 932 following one, may be overridden at run time either automatically, by the 933 actions of the macro `CONDITIONAL_REGISTER_USAGE', or by the user with the 934 command options `-ffixed-REG', `-fcall-used-REG' and `-fcall-saved-REG'. */ 935 936 /* gr0 -- Hard Zero 937 gr1 -- Stack Pointer 938 gr2 -- Frame Pointer 939 gr3 -- Hidden Parameter 940 gr16 -- Small Data reserved 941 gr17 -- Pic reserved 942 gr28 -- OS reserved 943 gr29 -- OS reserved 944 gr30 -- OS reserved 945 gr31 -- OS reserved 946 cr3 -- reserved to reload FCC registers. 947 cr7 -- reserved to reload ICC registers. */ 948 #define FIXED_REGISTERS \ 949 { /* Integer Registers */ \ 950 1, 1, 1, 1, 0, 0, 0, 0, /* 000-007, gr0 - gr7 */ \ 951 0, 0, 0, 0, 0, 0, 0, 0, /* 008-015, gr8 - gr15 */ \ 952 1, 1, 0, 0, 0, 0, 0, 0, /* 016-023, gr16 - gr23 */ \ 953 0, 0, 0, 0, 1, 1, 1, 1, /* 024-031, gr24 - gr31 */ \ 954 0, 0, 0, 0, 0, 0, 0, 0, /* 032-039, gr32 - gr39 */ \ 955 0, 0, 0, 0, 0, 0, 0, 0, /* 040-040, gr48 - gr47 */ \ 956 0, 0, 0, 0, 0, 0, 0, 0, /* 048-055, gr48 - gr55 */ \ 957 0, 0, 0, 0, 0, 0, 0, 0, /* 056-063, gr56 - gr63 */ \ 958 /* Float Registers */ \ 959 0, 0, 0, 0, 0, 0, 0, 0, /* 064-071, fr0 - fr7 */ \ 960 0, 0, 0, 0, 0, 0, 0, 0, /* 072-079, fr8 - fr15 */ \ 961 0, 0, 0, 0, 0, 0, 0, 0, /* 080-087, fr16 - fr23 */ \ 962 0, 0, 0, 0, 0, 0, 0, 0, /* 088-095, fr24 - fr31 */ \ 963 0, 0, 0, 0, 0, 0, 0, 0, /* 096-103, fr32 - fr39 */ \ 964 0, 0, 0, 0, 0, 0, 0, 0, /* 104-111, fr48 - fr47 */ \ 965 0, 0, 0, 0, 0, 0, 0, 0, /* 112-119, fr48 - fr55 */ \ 966 0, 0, 0, 0, 0, 0, 0, 0, /* 120-127, fr56 - fr63 */ \ 967 /* Condition Code Registers */ \ 968 0, 0, 0, 0, /* 128-131, fcc0 - fcc3 */ \ 969 0, 0, 0, 1, /* 132-135, icc0 - icc3 */ \ 970 /* Conditional execution Registers (CCR) */ \ 971 0, 0, 0, 0, 0, 0, 0, 1, /* 136-143, cr0 - cr7 */ \ 972 /* Accumulators */ \ 973 1, 1, 1, 1, 1, 1, 1, 1, /* 144-151, acc0 - acc7 */ \ 974 1, 1, 1, 1, 1, 1, 1, 1, /* 152-159, accg0 - accg7 */ \ 975 /* Other registers */ \ 976 1, /* 160, AP - fake arg ptr */ \ 977 0, /* 161, LR - Link register*/ \ 978 0, /* 162, LCR - Loop count reg*/ \ 979 } 980 981 /* Like `FIXED_REGISTERS' but has 1 for each register that is clobbered (in 982 general) by function calls as well as for fixed registers. This macro 983 therefore identifies the registers that are not available for general 984 allocation of values that must live across function calls. 985 986 If a register has 0 in `CALL_USED_REGISTERS', the compiler automatically 987 saves it on function entry and restores it on function exit, if the register 988 is used within the function. */ 989 #define CALL_USED_REGISTERS \ 990 { /* Integer Registers */ \ 991 1, 1, 1, 1, 1, 1, 1, 1, /* 000-007, gr0 - gr7 */ \ 992 1, 1, 1, 1, 1, 1, 1, 1, /* 008-015, gr8 - gr15 */ \ 993 1, 1, 0, 0, 0, 0, 0, 0, /* 016-023, gr16 - gr23 */ \ 994 0, 0, 0, 0, 1, 1, 1, 1, /* 024-031, gr24 - gr31 */ \ 995 1, 1, 1, 1, 1, 1, 1, 1, /* 032-039, gr32 - gr39 */ \ 996 1, 1, 1, 1, 1, 1, 1, 1, /* 040-040, gr48 - gr47 */ \ 997 0, 0, 0, 0, 0, 0, 0, 0, /* 048-055, gr48 - gr55 */ \ 998 0, 0, 0, 0, 0, 0, 0, 0, /* 056-063, gr56 - gr63 */ \ 999 /* Float Registers */ \ 1000 1, 1, 1, 1, 1, 1, 1, 1, /* 064-071, fr0 - fr7 */ \ 1001 1, 1, 1, 1, 1, 1, 1, 1, /* 072-079, fr8 - fr15 */ \ 1002 0, 0, 0, 0, 0, 0, 0, 0, /* 080-087, fr16 - fr23 */ \ 1003 0, 0, 0, 0, 0, 0, 0, 0, /* 088-095, fr24 - fr31 */ \ 1004 1, 1, 1, 1, 1, 1, 1, 1, /* 096-103, fr32 - fr39 */ \ 1005 1, 1, 1, 1, 1, 1, 1, 1, /* 104-111, fr48 - fr47 */ \ 1006 0, 0, 0, 0, 0, 0, 0, 0, /* 112-119, fr48 - fr55 */ \ 1007 0, 0, 0, 0, 0, 0, 0, 0, /* 120-127, fr56 - fr63 */ \ 1008 /* Condition Code Registers */ \ 1009 1, 1, 1, 1, /* 128-131, fcc0 - fcc3 */ \ 1010 1, 1, 1, 1, /* 132-135, icc0 - icc3 */ \ 1011 /* Conditional execution Registers (CCR) */ \ 1012 1, 1, 1, 1, 1, 1, 1, 1, /* 136-143, cr0 - cr7 */ \ 1013 /* Accumulators */ \ 1014 1, 1, 1, 1, 1, 1, 1, 1, /* 144-151, acc0 - acc7 */ \ 1015 1, 1, 1, 1, 1, 1, 1, 1, /* 152-159, accg0 - accg7 */ \ 1016 /* Other registers */ \ 1017 1, /* 160, AP - fake arg ptr */ \ 1018 1, /* 161, LR - Link register*/ \ 1019 1, /* 162, LCR - Loop count reg */ \ 1020 } 1021 1022 /* Zero or more C statements that may conditionally modify two variables 1023 `fixed_regs' and `call_used_regs' (both of type `char []') after they have 1024 been initialized from the two preceding macros. 1025 1026 This is necessary in case the fixed or call-clobbered registers depend on 1027 target flags. 1028 1029 You need not define this macro if it has no work to do. 1030 1031 If the usage of an entire class of registers depends on the target flags, 1032 you may indicate this to GCC by using this macro to modify `fixed_regs' and 1033 `call_used_regs' to 1 for each of the registers in the classes which should 1034 not be used by GCC. Also define the macro `REG_CLASS_FROM_LETTER' to return 1035 `NO_REGS' if it is called with a letter for a class that shouldn't be used. 1036 1037 (However, if this class is not included in `GENERAL_REGS' and all of the 1038 insn patterns whose constraints permit this class are controlled by target 1039 switches, then GCC will automatically avoid using these registers when the 1040 target switches are opposed to them.) */ 1041 1042 #define CONDITIONAL_REGISTER_USAGE frv_conditional_register_usage () 1043 1044 1045 /* Order of allocation of registers. */ 1046 1047 /* If defined, an initializer for a vector of integers, containing the numbers 1048 of hard registers in the order in which GNU CC should prefer to use them 1049 (from most preferred to least). 1050 1051 If this macro is not defined, registers are used lowest numbered first (all 1052 else being equal). 1053 1054 One use of this macro is on machines where the highest numbered registers 1055 must always be saved and the save-multiple-registers instruction supports 1056 only sequences of consecutive registers. On such machines, define 1057 `REG_ALLOC_ORDER' to be an initializer that lists the highest numbered 1058 allocatable register first. */ 1059 1060 /* On the FRV, allocate GR16 and GR17 after other saved registers so that we 1061 have a better chance of allocating 2 registers at a time and can use the 1062 double word load/store instructions in the prologue. */ 1063 #define REG_ALLOC_ORDER \ 1064 { \ 1065 /* volatile registers */ \ 1066 GPR_FIRST + 4, GPR_FIRST + 5, GPR_FIRST + 6, GPR_FIRST + 7, \ 1067 GPR_FIRST + 8, GPR_FIRST + 9, GPR_FIRST + 10, GPR_FIRST + 11, \ 1068 GPR_FIRST + 12, GPR_FIRST + 13, GPR_FIRST + 14, GPR_FIRST + 15, \ 1069 GPR_FIRST + 32, GPR_FIRST + 33, GPR_FIRST + 34, GPR_FIRST + 35, \ 1070 GPR_FIRST + 36, GPR_FIRST + 37, GPR_FIRST + 38, GPR_FIRST + 39, \ 1071 GPR_FIRST + 40, GPR_FIRST + 41, GPR_FIRST + 42, GPR_FIRST + 43, \ 1072 GPR_FIRST + 44, GPR_FIRST + 45, GPR_FIRST + 46, GPR_FIRST + 47, \ 1073 \ 1074 FPR_FIRST + 0, FPR_FIRST + 1, FPR_FIRST + 2, FPR_FIRST + 3, \ 1075 FPR_FIRST + 4, FPR_FIRST + 5, FPR_FIRST + 6, FPR_FIRST + 7, \ 1076 FPR_FIRST + 8, FPR_FIRST + 9, FPR_FIRST + 10, FPR_FIRST + 11, \ 1077 FPR_FIRST + 12, FPR_FIRST + 13, FPR_FIRST + 14, FPR_FIRST + 15, \ 1078 FPR_FIRST + 32, FPR_FIRST + 33, FPR_FIRST + 34, FPR_FIRST + 35, \ 1079 FPR_FIRST + 36, FPR_FIRST + 37, FPR_FIRST + 38, FPR_FIRST + 39, \ 1080 FPR_FIRST + 40, FPR_FIRST + 41, FPR_FIRST + 42, FPR_FIRST + 43, \ 1081 FPR_FIRST + 44, FPR_FIRST + 45, FPR_FIRST + 46, FPR_FIRST + 47, \ 1082 \ 1083 ICC_FIRST + 0, ICC_FIRST + 1, ICC_FIRST + 2, ICC_FIRST + 3, \ 1084 FCC_FIRST + 0, FCC_FIRST + 1, FCC_FIRST + 2, FCC_FIRST + 3, \ 1085 CR_FIRST + 0, CR_FIRST + 1, CR_FIRST + 2, CR_FIRST + 3, \ 1086 CR_FIRST + 4, CR_FIRST + 5, CR_FIRST + 6, CR_FIRST + 7, \ 1087 \ 1088 /* saved registers */ \ 1089 GPR_FIRST + 18, GPR_FIRST + 19, \ 1090 GPR_FIRST + 20, GPR_FIRST + 21, GPR_FIRST + 22, GPR_FIRST + 23, \ 1091 GPR_FIRST + 24, GPR_FIRST + 25, GPR_FIRST + 26, GPR_FIRST + 27, \ 1092 GPR_FIRST + 48, GPR_FIRST + 49, GPR_FIRST + 50, GPR_FIRST + 51, \ 1093 GPR_FIRST + 52, GPR_FIRST + 53, GPR_FIRST + 54, GPR_FIRST + 55, \ 1094 GPR_FIRST + 56, GPR_FIRST + 57, GPR_FIRST + 58, GPR_FIRST + 59, \ 1095 GPR_FIRST + 60, GPR_FIRST + 61, GPR_FIRST + 62, GPR_FIRST + 63, \ 1096 GPR_FIRST + 16, GPR_FIRST + 17, \ 1097 \ 1098 FPR_FIRST + 16, FPR_FIRST + 17, FPR_FIRST + 18, FPR_FIRST + 19, \ 1099 FPR_FIRST + 20, FPR_FIRST + 21, FPR_FIRST + 22, FPR_FIRST + 23, \ 1100 FPR_FIRST + 24, FPR_FIRST + 25, FPR_FIRST + 26, FPR_FIRST + 27, \ 1101 FPR_FIRST + 28, FPR_FIRST + 29, FPR_FIRST + 30, FPR_FIRST + 31, \ 1102 FPR_FIRST + 48, FPR_FIRST + 49, FPR_FIRST + 50, FPR_FIRST + 51, \ 1103 FPR_FIRST + 52, FPR_FIRST + 53, FPR_FIRST + 54, FPR_FIRST + 55, \ 1104 FPR_FIRST + 56, FPR_FIRST + 57, FPR_FIRST + 58, FPR_FIRST + 59, \ 1105 FPR_FIRST + 60, FPR_FIRST + 61, FPR_FIRST + 62, FPR_FIRST + 63, \ 1106 \ 1107 /* special or fixed registers */ \ 1108 GPR_FIRST + 0, GPR_FIRST + 1, GPR_FIRST + 2, GPR_FIRST + 3, \ 1109 GPR_FIRST + 28, GPR_FIRST + 29, GPR_FIRST + 30, GPR_FIRST + 31, \ 1110 ACC_FIRST + 0, ACC_FIRST + 1, ACC_FIRST + 2, ACC_FIRST + 3, \ 1111 ACC_FIRST + 4, ACC_FIRST + 5, ACC_FIRST + 6, ACC_FIRST + 7, \ 1112 ACCG_FIRST + 0, ACCG_FIRST + 1, ACCG_FIRST + 2, ACCG_FIRST + 3, \ 1113 ACCG_FIRST + 4, ACCG_FIRST + 5, ACCG_FIRST + 6, ACCG_FIRST + 7, \ 1114 AP_FIRST, LR_REGNO, LCR_REGNO \ 1115 } 1116 1117 1118 /* How Values Fit in Registers. */ 1119 1120 /* A C expression for the number of consecutive hard registers, starting at 1121 register number REGNO, required to hold a value of mode MODE. 1122 1123 On a machine where all registers are exactly one word, a suitable definition 1124 of this macro is 1125 1126 #define HARD_REGNO_NREGS(REGNO, MODE) \ 1127 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \ 1128 / UNITS_PER_WORD)) */ 1129 1130 /* On the FRV, make the CC modes take 3 words in the integer registers, so that 1131 we can build the appropriate instructions to properly reload the values. */ 1132 #define HARD_REGNO_NREGS(REGNO, MODE) frv_hard_regno_nregs (REGNO, MODE) 1133 1134 /* A C expression that is nonzero if it is permissible to store a value of mode 1135 MODE in hard register number REGNO (or in several registers starting with 1136 that one). For a machine where all registers are equivalent, a suitable 1137 definition is 1138 1139 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1 1140 1141 It is not necessary for this macro to check for the numbers of fixed 1142 registers, because the allocation mechanism considers them to be always 1143 occupied. 1144 1145 On some machines, double-precision values must be kept in even/odd register 1146 pairs. The way to implement that is to define this macro to reject odd 1147 register numbers for such modes. 1148 1149 The minimum requirement for a mode to be OK in a register is that the 1150 `movMODE' instruction pattern support moves between the register and any 1151 other hard register for which the mode is OK; and that moving a value into 1152 the register and back out not alter it. 1153 1154 Since the same instruction used to move `SImode' will work for all narrower 1155 integer modes, it is not necessary on any machine for `HARD_REGNO_MODE_OK' 1156 to distinguish between these modes, provided you define patterns `movhi', 1157 etc., to take advantage of this. This is useful because of the interaction 1158 between `HARD_REGNO_MODE_OK' and `MODES_TIEABLE_P'; it is very desirable for 1159 all integer modes to be tieable. 1160 1161 Many machines have special registers for floating point arithmetic. Often 1162 people assume that floating point machine modes are allowed only in floating 1163 point registers. This is not true. Any registers that can hold integers 1164 can safely *hold* a floating point machine mode, whether or not floating 1165 arithmetic can be done on it in those registers. Integer move instructions 1166 can be used to move the values. 1167 1168 On some machines, though, the converse is true: fixed-point machine modes 1169 may not go in floating registers. This is true if the floating registers 1170 normalize any value stored in them, because storing a non-floating value 1171 there would garble it. In this case, `HARD_REGNO_MODE_OK' should reject 1172 fixed-point machine modes in floating registers. But if the floating 1173 registers do not automatically normalize, if you can store any bit pattern 1174 in one and retrieve it unchanged without a trap, then any machine mode may 1175 go in a floating register, so you can define this macro to say so. 1176 1177 The primary significance of special floating registers is rather that they 1178 are the registers acceptable in floating point arithmetic instructions. 1179 However, this is of no concern to `HARD_REGNO_MODE_OK'. You handle it by 1180 writing the proper constraints for those instructions. 1181 1182 On some machines, the floating registers are especially slow to access, so 1183 that it is better to store a value in a stack frame than in such a register 1184 if floating point arithmetic is not being done. As long as the floating 1185 registers are not in class `GENERAL_REGS', they will not be used unless some 1186 pattern's constraint asks for one. */ 1187 #define HARD_REGNO_MODE_OK(REGNO, MODE) frv_hard_regno_mode_ok (REGNO, MODE) 1188 1189 /* A C expression that is nonzero if it is desirable to choose register 1190 allocation so as to avoid move instructions between a value of mode MODE1 1191 and a value of mode MODE2. 1192 1193 If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R, MODE2)' are 1194 ever different for any R, then `MODES_TIEABLE_P (MODE1, MODE2)' must be 1195 zero. */ 1196 #define MODES_TIEABLE_P(MODE1, MODE2) (MODE1 == MODE2) 1197 1198 /* Define this macro if the compiler should avoid copies to/from CCmode 1199 registers. You should only define this macro if support fo copying to/from 1200 CCmode is incomplete. */ 1201 #define AVOID_CCMODE_COPIES 1202 1203 1204 /* Register Classes. */ 1205 1206 /* An enumeral type that must be defined with all the register class names as 1207 enumeral values. `NO_REGS' must be first. `ALL_REGS' must be the last 1208 register class, followed by one more enumeral value, `LIM_REG_CLASSES', 1209 which is not a register class but rather tells how many classes there are. 1210 1211 Each register class has a number, which is the value of casting the class 1212 name to type `int'. The number serves as an index in many of the tables 1213 described below. */ 1214 enum reg_class 1215 { 1216 NO_REGS, 1217 ICC_REGS, 1218 FCC_REGS, 1219 CC_REGS, 1220 ICR_REGS, 1221 FCR_REGS, 1222 CR_REGS, 1223 LCR_REG, 1224 LR_REG, 1225 SPR_REGS, 1226 QUAD_ACC_REGS, 1227 EVEN_ACC_REGS, 1228 ACC_REGS, 1229 ACCG_REGS, 1230 QUAD_FPR_REGS, 1231 FEVEN_REGS, 1232 FPR_REGS, 1233 QUAD_REGS, 1234 EVEN_REGS, 1235 GPR_REGS, 1236 ALL_REGS, 1237 LIM_REG_CLASSES 1238 }; 1239 1240 #define GENERAL_REGS GPR_REGS 1241 1242 /* The number of distinct register classes, defined as follows: 1243 1244 #define N_REG_CLASSES (int) LIM_REG_CLASSES */ 1245 #define N_REG_CLASSES ((int) LIM_REG_CLASSES) 1246 1247 /* An initializer containing the names of the register classes as C string 1248 constants. These names are used in writing some of the debugging dumps. */ 1249 #define REG_CLASS_NAMES { \ 1250 "NO_REGS", \ 1251 "ICC_REGS", \ 1252 "FCC_REGS", \ 1253 "CC_REGS", \ 1254 "ICR_REGS", \ 1255 "FCR_REGS", \ 1256 "CR_REGS", \ 1257 "LCR_REG", \ 1258 "LR_REG", \ 1259 "SPR_REGS", \ 1260 "QUAD_ACC_REGS", \ 1261 "EVEN_ACC_REGS", \ 1262 "ACC_REGS", \ 1263 "ACCG_REGS", \ 1264 "QUAD_FPR_REGS", \ 1265 "FEVEN_REGS", \ 1266 "FPR_REGS", \ 1267 "QUAD_REGS", \ 1268 "EVEN_REGS", \ 1269 "GPR_REGS", \ 1270 "ALL_REGS" \ 1271 } 1272 1273 /* An initializer containing the contents of the register classes, as integers 1274 which are bit masks. The Nth integer specifies the contents of class N. 1275 The way the integer MASK is interpreted is that register R is in the class 1276 if `MASK & (1 << R)' is 1. 1277 1278 When the machine has more than 32 registers, an integer does not suffice. 1279 Then the integers are replaced by sub-initializers, braced groupings 1280 containing several integers. Each sub-initializer must be suitable as an 1281 initializer for the type `HARD_REG_SET' which is defined in 1282 `hard-reg-set.h'. */ 1283 #define REG_CLASS_CONTENTS \ 1284 { /* gr0-gr31 gr32-gr63 fr0-fr31 fr32-fr-63 cc/ccr/acc ap/spr */ \ 1285 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x0}, /* NO_REGS */\ 1286 { 0x00000000,0x00000000,0x00000000,0x00000000,0x000000f0,0x0}, /* ICC_REGS */\ 1287 { 0x00000000,0x00000000,0x00000000,0x00000000,0x0000000f,0x0}, /* FCC_REGS */\ 1288 { 0x00000000,0x00000000,0x00000000,0x00000000,0x000000ff,0x0}, /* CC_REGS */\ 1289 { 0x00000000,0x00000000,0x00000000,0x00000000,0x0000f000,0x0}, /* ICR_REGS */\ 1290 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000f00,0x0}, /* FCR_REGS */\ 1291 { 0x00000000,0x00000000,0x00000000,0x00000000,0x0000ff00,0x0}, /* CR_REGS */\ 1292 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x4}, /* LCR_REGS */\ 1293 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x2}, /* LR_REGS */\ 1294 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x6}, /* SPR_REGS */\ 1295 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00ff0000,0x0}, /* QUAD_ACC */\ 1296 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00ff0000,0x0}, /* EVEN_ACC */\ 1297 { 0x00000000,0x00000000,0x00000000,0x00000000,0x00ff0000,0x0}, /* ACC_REGS */\ 1298 { 0x00000000,0x00000000,0x00000000,0x00000000,0xff000000,0x0}, /* ACCG_REGS*/\ 1299 { 0x00000000,0x00000000,0xffffffff,0xffffffff,0x00000000,0x0}, /* QUAD_FPR */\ 1300 { 0x00000000,0x00000000,0xffffffff,0xffffffff,0x00000000,0x0}, /* FEVEN_REG*/\ 1301 { 0x00000000,0x00000000,0xffffffff,0xffffffff,0x00000000,0x0}, /* FPR_REGS */\ 1302 { 0x0ffffffc,0xffffffff,0x00000000,0x00000000,0x00000000,0x0}, /* QUAD_REGS*/\ 1303 { 0xfffffffc,0xffffffff,0x00000000,0x00000000,0x00000000,0x0}, /* EVEN_REGS*/\ 1304 { 0xffffffff,0xffffffff,0x00000000,0x00000000,0x00000000,0x1}, /* GPR_REGS */\ 1305 { 0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0x7}, /* ALL_REGS */\ 1306 } 1307 1308 /* A C expression whose value is a register class containing hard register 1309 REGNO. In general there is more than one such class; choose a class which 1310 is "minimal", meaning that no smaller class also contains the register. */ 1311 1312 extern enum reg_class regno_reg_class[]; 1313 #define REGNO_REG_CLASS(REGNO) regno_reg_class [REGNO] 1314 1315 /* A macro whose definition is the name of the class to which a valid base 1316 register must belong. A base register is one used in an address which is 1317 the register value plus a displacement. */ 1318 #define BASE_REG_CLASS GPR_REGS 1319 1320 /* A macro whose definition is the name of the class to which a valid index 1321 register must belong. An index register is one used in an address where its 1322 value is either multiplied by a scale factor or added to another register 1323 (as well as added to a displacement). */ 1324 #define INDEX_REG_CLASS GPR_REGS 1325 1326 /* A C expression which defines the machine-dependent operand constraint 1327 letters for register classes. If CHAR is such a letter, the value should be 1328 the register class corresponding to it. Otherwise, the value should be 1329 `NO_REGS'. The register letter `r', corresponding to class `GENERAL_REGS', 1330 will not be passed to this macro; you do not need to handle it. 1331 1332 The following letters are unavailable, due to being used as 1333 constraints: 1334 '0'..'9' 1335 '<', '>' 1336 'E', 'F', 'G', 'H' 1337 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P' 1338 'Q', 'R', 'S', 'T', 'U' 1339 'V', 'X' 1340 'g', 'i', 'm', 'n', 'o', 'p', 'r', 's' */ 1341 1342 extern enum reg_class reg_class_from_letter[]; 1343 #define REG_CLASS_FROM_LETTER(CHAR) reg_class_from_letter [(unsigned char)(CHAR)] 1344 1345 /* A C expression which is nonzero if register number NUM is suitable for use 1346 as a base register in operand addresses. It may be either a suitable hard 1347 register or a pseudo register that has been allocated such a hard register. */ 1348 #define REGNO_OK_FOR_BASE_P(NUM) \ 1349 ((NUM) < FIRST_PSEUDO_REGISTER \ 1350 ? GPR_P (NUM) \ 1351 : (reg_renumber [NUM] >= 0 && GPR_P (reg_renumber [NUM]))) 1352 1353 /* A C expression which is nonzero if register number NUM is suitable for use 1354 as an index register in operand addresses. It may be either a suitable hard 1355 register or a pseudo register that has been allocated such a hard register. 1356 1357 The difference between an index register and a base register is that the 1358 index register may be scaled. If an address involves the sum of two 1359 registers, neither one of them scaled, then either one may be labeled the 1360 "base" and the other the "index"; but whichever labeling is used must fit 1361 the machine's constraints of which registers may serve in each capacity. 1362 The compiler will try both labelings, looking for one that is valid, and 1363 will reload one or both registers only if neither labeling works. */ 1364 #define REGNO_OK_FOR_INDEX_P(NUM) \ 1365 ((NUM) < FIRST_PSEUDO_REGISTER \ 1366 ? GPR_P (NUM) \ 1367 : (reg_renumber [NUM] >= 0 && GPR_P (reg_renumber [NUM]))) 1368 1369 /* A C expression that places additional restrictions on the register class to 1370 use when it is necessary to copy value X into a register in class CLASS. 1371 The value is a register class; perhaps CLASS, or perhaps another, smaller 1372 class. On many machines, the following definition is safe: 1373 1374 #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS 1375 1376 Sometimes returning a more restrictive class makes better code. For 1377 example, on the 68000, when X is an integer constant that is in range for a 1378 `moveq' instruction, the value of this macro is always `DATA_REGS' as long 1379 as CLASS includes the data registers. Requiring a data register guarantees 1380 that a `moveq' will be used. 1381 1382 If X is a `const_double', by returning `NO_REGS' you can force X into a 1383 memory constant. This is useful on certain machines where immediate 1384 floating values cannot be loaded into certain kinds of registers. 1385 1386 This declaration must be present. */ 1387 #define PREFERRED_RELOAD_CLASS(X, CLASS) CLASS 1388 1389 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \ 1390 frv_secondary_reload_class (CLASS, MODE, X, TRUE) 1391 1392 #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \ 1393 frv_secondary_reload_class (CLASS, MODE, X, FALSE) 1394 1395 /* A C expression whose value is nonzero if pseudos that have been assigned to 1396 registers of class CLASS would likely be spilled because registers of CLASS 1397 are needed for spill registers. 1398 1399 The default value of this macro returns 1 if CLASS has exactly one register 1400 and zero otherwise. On most machines, this default should be used. Only 1401 define this macro to some other expression if pseudo allocated by 1402 `local-alloc.c' end up in memory because their hard registers were needed 1403 for spill registers. If this macro returns nonzero for those classes, those 1404 pseudos will only be allocated by `global.c', which knows how to reallocate 1405 the pseudo to another register. If there would not be another register 1406 available for reallocation, you should not change the definition of this 1407 macro since the only effect of such a definition would be to slow down 1408 register allocation. */ 1409 #define CLASS_LIKELY_SPILLED_P(CLASS) frv_class_likely_spilled_p (CLASS) 1410 1411 /* A C expression for the maximum number of consecutive registers of 1412 class CLASS needed to hold a value of mode MODE. 1413 1414 This is closely related to the macro `HARD_REGNO_NREGS'. In fact, the value 1415 of the macro `CLASS_MAX_NREGS (CLASS, MODE)' should be the maximum value of 1416 `HARD_REGNO_NREGS (REGNO, MODE)' for all REGNO values in the class CLASS. 1417 1418 This macro helps control the handling of multiple-word values in 1419 the reload pass. 1420 1421 This declaration is required. */ 1422 #define CLASS_MAX_NREGS(CLASS, MODE) frv_class_max_nregs (CLASS, MODE) 1423 1424 #define ZERO_P(x) (x == CONST0_RTX (GET_MODE (x))) 1425 1426 /* 6 bit signed immediate. */ 1427 #define CONST_OK_FOR_I(VALUE) IN_RANGE_P(VALUE, -32, 31) 1428 /* 10 bit signed immediate. */ 1429 #define CONST_OK_FOR_J(VALUE) IN_RANGE_P(VALUE, -512, 511) 1430 /* Unused */ 1431 #define CONST_OK_FOR_K(VALUE) 0 1432 /* 16 bit signed immediate. */ 1433 #define CONST_OK_FOR_L(VALUE) IN_RANGE_P(VALUE, -32768, 32767) 1434 /* 16 bit unsigned immediate. */ 1435 #define CONST_OK_FOR_M(VALUE) IN_RANGE_P (VALUE, 0, 65535) 1436 /* 12 bit signed immediate that is negative. */ 1437 #define CONST_OK_FOR_N(VALUE) IN_RANGE_P(VALUE, -2048, -1) 1438 /* Zero */ 1439 #define CONST_OK_FOR_O(VALUE) ((VALUE) == 0) 1440 /* 12 bit signed immediate that is negative. */ 1441 #define CONST_OK_FOR_P(VALUE) IN_RANGE_P(VALUE, 1, 2047) 1442 1443 /* A C expression that defines the machine-dependent operand constraint letters 1444 (`I', `J', `K', .. 'P') that specify particular ranges of integer values. 1445 If C is one of those letters, the expression should check that VALUE, an 1446 integer, is in the appropriate range and return 1 if so, 0 otherwise. If C 1447 is not one of those letters, the value should be 0 regardless of VALUE. */ 1448 #define CONST_OK_FOR_LETTER_P(VALUE, C) \ 1449 ( (C) == 'I' ? CONST_OK_FOR_I (VALUE) \ 1450 : (C) == 'J' ? CONST_OK_FOR_J (VALUE) \ 1451 : (C) == 'K' ? CONST_OK_FOR_K (VALUE) \ 1452 : (C) == 'L' ? CONST_OK_FOR_L (VALUE) \ 1453 : (C) == 'M' ? CONST_OK_FOR_M (VALUE) \ 1454 : (C) == 'N' ? CONST_OK_FOR_N (VALUE) \ 1455 : (C) == 'O' ? CONST_OK_FOR_O (VALUE) \ 1456 : (C) == 'P' ? CONST_OK_FOR_P (VALUE) \ 1457 : 0) 1458 1459 1460 /* A C expression that defines the machine-dependent operand constraint letters 1461 (`G', `H') that specify particular ranges of `const_double' values. 1462 1463 If C is one of those letters, the expression should check that VALUE, an RTX 1464 of code `const_double', is in the appropriate range and return 1 if so, 0 1465 otherwise. If C is not one of those letters, the value should be 0 1466 regardless of VALUE. 1467 1468 `const_double' is used for all floating-point constants and for `DImode' 1469 fixed-point constants. A given letter can accept either or both kinds of 1470 values. It can use `GET_MODE' to distinguish between these kinds. */ 1471 1472 #define CONST_DOUBLE_OK_FOR_G(VALUE) \ 1473 ((GET_MODE (VALUE) == VOIDmode \ 1474 && CONST_DOUBLE_LOW (VALUE) == 0 \ 1475 && CONST_DOUBLE_HIGH (VALUE) == 0) \ 1476 || ((GET_MODE (VALUE) == SFmode \ 1477 || GET_MODE (VALUE) == DFmode) \ 1478 && (VALUE) == CONST0_RTX (GET_MODE (VALUE)))) 1479 1480 #define CONST_DOUBLE_OK_FOR_H(VALUE) 0 1481 1482 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ 1483 ( (C) == 'G' ? CONST_DOUBLE_OK_FOR_G (VALUE) \ 1484 : (C) == 'H' ? CONST_DOUBLE_OK_FOR_H (VALUE) \ 1485 : 0) 1486 1487 /* A C expression that defines the optional machine-dependent constraint 1488 letters (`Q', `R', `S', `T', `U') that can be used to segregate specific 1489 types of operands, usually memory references, for the target machine. 1490 Normally this macro will not be defined. If it is required for a particular 1491 target machine, it should return 1 if VALUE corresponds to the operand type 1492 represented by the constraint letter C. If C is not defined as an extra 1493 constraint, the value returned should be 0 regardless of VALUE. 1494 1495 For example, on the ROMP, load instructions cannot have their output in r0 1496 if the memory reference contains a symbolic address. Constraint letter `Q' 1497 is defined as representing a memory address that does *not* contain a 1498 symbolic address. An alternative is specified with a `Q' constraint on the 1499 input and `r' on the output. The next alternative specifies `m' on the 1500 input and a register class that does not include r0 on the output. */ 1501 1502 /* Small data references */ 1503 #define EXTRA_CONSTRAINT_FOR_Q(VALUE) \ 1504 (small_data_symbolic_operand (VALUE, GET_MODE (VALUE))) 1505 1506 /* Double word memory ops that take one instruction. */ 1507 #define EXTRA_CONSTRAINT_FOR_R(VALUE) \ 1508 (dbl_memory_one_insn_operand (VALUE, GET_MODE (VALUE))) 1509 1510 /* SYMBOL_REF */ 1511 #define EXTRA_CONSTRAINT_FOR_S(VALUE) (GET_CODE (VALUE) == SYMBOL_REF) 1512 1513 /* Double word memory ops that take two instructions. */ 1514 #define EXTRA_CONSTRAINT_FOR_T(VALUE) \ 1515 (dbl_memory_two_insn_operand (VALUE, GET_MODE (VALUE))) 1516 1517 /* Memory operand for conditional execution. */ 1518 #define EXTRA_CONSTRAINT_FOR_U(VALUE) \ 1519 (condexec_memory_operand (VALUE, GET_MODE (VALUE))) 1520 1521 #define EXTRA_CONSTRAINT(VALUE, C) \ 1522 ( (C) == 'Q' ? EXTRA_CONSTRAINT_FOR_Q (VALUE) \ 1523 : (C) == 'R' ? EXTRA_CONSTRAINT_FOR_R (VALUE) \ 1524 : (C) == 'S' ? EXTRA_CONSTRAINT_FOR_S (VALUE) \ 1525 : (C) == 'T' ? EXTRA_CONSTRAINT_FOR_T (VALUE) \ 1526 : (C) == 'U' ? EXTRA_CONSTRAINT_FOR_U (VALUE) \ 1527 : 0) 1528 1529 1530 /* Basic Stack Layout. */ 1531 1532 /* Structure to describe information about a saved range of registers */ 1533 1534 typedef struct frv_stack_regs { 1535 const char * name; /* name of the register ranges */ 1536 int first; /* first register in the range */ 1537 int last; /* last register in the range */ 1538 int size_1word; /* # of bytes to be stored via 1 word stores */ 1539 int size_2words; /* # of bytes to be stored via 2 word stores */ 1540 unsigned char field_p; /* true if the registers are a single SPR */ 1541 unsigned char dword_p; /* true if we can do dword stores */ 1542 unsigned char special_p; /* true if the regs have a fixed save loc. */ 1543 } frv_stack_regs_t; 1544 1545 /* Register ranges to look into saving. */ 1546 #define STACK_REGS_GPR 0 /* Gprs (normally gr16..gr31, gr48..gr63) */ 1547 #define STACK_REGS_FPR 1 /* Fprs (normally fr16..fr31, fr48..fr63) */ 1548 #define STACK_REGS_LR 2 /* LR register */ 1549 #define STACK_REGS_CC 3 /* CCrs (normally not saved) */ 1550 #define STACK_REGS_LCR 5 /* lcr register */ 1551 #define STACK_REGS_STDARG 6 /* stdarg registers */ 1552 #define STACK_REGS_STRUCT 7 /* structure return (gr3) */ 1553 #define STACK_REGS_FP 8 /* FP register */ 1554 #define STACK_REGS_MAX 9 /* # of register ranges */ 1555 1556 /* Values for save_p field. */ 1557 #define REG_SAVE_NO_SAVE 0 /* register not saved */ 1558 #define REG_SAVE_1WORD 1 /* save the register */ 1559 #define REG_SAVE_2WORDS 2 /* save register and register+1 */ 1560 1561 /* Structure used to define the frv stack. */ 1562 1563 typedef struct frv_stack { 1564 int total_size; /* total bytes allocated for stack */ 1565 int vars_size; /* variable save area size */ 1566 int parameter_size; /* outgoing parameter size */ 1567 int stdarg_size; /* size of regs needed to be saved for stdarg */ 1568 int regs_size; /* size of the saved registers */ 1569 int regs_size_1word; /* # of bytes to be stored via 1 word stores */ 1570 int regs_size_2words; /* # of bytes to be stored via 2 word stores */ 1571 int header_size; /* size of the old FP, struct ret., LR save */ 1572 int pretend_size; /* size of pretend args */ 1573 int vars_offset; /* offset to save local variables from new SP*/ 1574 int regs_offset; /* offset to save registers from new SP */ 1575 /* register range information */ 1576 frv_stack_regs_t regs[STACK_REGS_MAX]; 1577 /* offset to store each register */ 1578 int reg_offset[FIRST_PSEUDO_REGISTER]; 1579 /* whether to save register (& reg+1) */ 1580 unsigned char save_p[FIRST_PSEUDO_REGISTER]; 1581 } frv_stack_t; 1582 1583 /* Define this macro if pushing a word onto the stack moves the stack pointer 1584 to a smaller address. */ 1585 #define STACK_GROWS_DOWNWARD 1 1586 1587 /* Define this macro if the addresses of local variable slots are at negative 1588 offsets from the frame pointer. */ 1589 #define FRAME_GROWS_DOWNWARD 1590 1591 /* Offset from the frame pointer to the first local variable slot to be 1592 allocated. 1593 1594 If `FRAME_GROWS_DOWNWARD', find the next slot's offset by subtracting the 1595 first slot's length from `STARTING_FRAME_OFFSET'. Otherwise, it is found by 1596 adding the length of the first slot to the value `STARTING_FRAME_OFFSET'. */ 1597 #define STARTING_FRAME_OFFSET 0 1598 1599 /* Offset from the stack pointer register to the first location at which 1600 outgoing arguments are placed. If not specified, the default value of zero 1601 is used. This is the proper value for most machines. 1602 1603 If `ARGS_GROW_DOWNWARD', this is the offset to the location above the first 1604 location at which outgoing arguments are placed. */ 1605 #define STACK_POINTER_OFFSET 0 1606 1607 /* Offset from the argument pointer register to the first argument's address. 1608 On some machines it may depend on the data type of the function. 1609 1610 If `ARGS_GROW_DOWNWARD', this is the offset to the location above the first 1611 argument's address. */ 1612 #define FIRST_PARM_OFFSET(FUNDECL) 0 1613 1614 /* A C expression whose value is RTL representing the address in a stack frame 1615 where the pointer to the caller's frame is stored. Assume that FRAMEADDR is 1616 an RTL expression for the address of the stack frame itself. 1617 1618 If you don't define this macro, the default is to return the value of 1619 FRAMEADDR--that is, the stack frame address is also the address of the stack 1620 word that points to the previous frame. */ 1621 #define DYNAMIC_CHAIN_ADDRESS(FRAMEADDR) frv_dynamic_chain_address (FRAMEADDR) 1622 1623 /* A C expression whose value is RTL representing the value of the return 1624 address for the frame COUNT steps up from the current frame, after the 1625 prologue. FRAMEADDR is the frame pointer of the COUNT frame, or the frame 1626 pointer of the COUNT - 1 frame if `RETURN_ADDR_IN_PREVIOUS_FRAME' is 1627 defined. 1628 1629 The value of the expression must always be the correct address when COUNT is 1630 zero, but may be `NULL_RTX' if there is not way to determine the return 1631 address of other frames. */ 1632 #define RETURN_ADDR_RTX(COUNT, FRAMEADDR) frv_return_addr_rtx (COUNT, FRAMEADDR) 1633 1634 /* This function contains machine specific function data. */ 1635 struct machine_function GTY(()) 1636 { 1637 /* True if we have created an rtx that relies on the stack frame. */ 1638 int frame_needed; 1639 }; 1640 1641 #define RETURN_POINTER_REGNUM LR_REGNO 1642 1643 /* A C expression whose value is RTL representing the location of the incoming 1644 return address at the beginning of any function, before the prologue. This 1645 RTL is either a `REG', indicating that the return value is saved in `REG', 1646 or a `MEM' representing a location in the stack. 1647 1648 You only need to define this macro if you want to support call frame 1649 debugging information like that provided by DWARF 2. */ 1650 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (SImode, RETURN_POINTER_REGNUM) 1651 1652 1653 /* Register That Address the Stack Frame. */ 1654 1655 /* The register number of the stack pointer register, which must also be a 1656 fixed register according to `FIXED_REGISTERS'. On most machines, the 1657 hardware determines which register this is. */ 1658 #define STACK_POINTER_REGNUM (GPR_FIRST + 1) 1659 1660 /* The register number of the frame pointer register, which is used to access 1661 automatic variables in the stack frame. On some machines, the hardware 1662 determines which register this is. On other machines, you can choose any 1663 register you wish for this purpose. */ 1664 #define FRAME_POINTER_REGNUM (GPR_FIRST + 2) 1665 1666 /* The register number of the arg pointer register, which is used to access the 1667 function's argument list. On some machines, this is the same as the frame 1668 pointer register. On some machines, the hardware determines which register 1669 this is. On other machines, you can choose any register you wish for this 1670 purpose. If this is not the same register as the frame pointer register, 1671 then you must mark it as a fixed register according to `FIXED_REGISTERS', or 1672 arrange to be able to eliminate it. */ 1673 1674 /* On frv this is a fake register that is eliminated in 1675 terms of either the frame pointer or stack pointer. */ 1676 #define ARG_POINTER_REGNUM AP_FIRST 1677 1678 /* Register numbers used for passing a function's static chain pointer. If 1679 register windows are used, the register number as seen by the called 1680 function is `STATIC_CHAIN_INCOMING_REGNUM', while the register number as 1681 seen by the calling function is `STATIC_CHAIN_REGNUM'. If these registers 1682 are the same, `STATIC_CHAIN_INCOMING_REGNUM' need not be defined. 1683 1684 The static chain register need not be a fixed register. 1685 1686 If the static chain is passed in memory, these macros should not be defined; 1687 instead, the next two macros should be defined. */ 1688 #define STATIC_CHAIN_REGNUM (GPR_FIRST + 7) 1689 #define STATIC_CHAIN_INCOMING_REGNUM (GPR_FIRST + 7) 1690 1691 1692 /* Eliminating the Frame Pointer and the Arg Pointer. */ 1693 1694 /* A C expression which is nonzero if a function must have and use a frame 1695 pointer. This expression is evaluated in the reload pass. If its value is 1696 nonzero the function will have a frame pointer. 1697 1698 The expression can in principle examine the current function and decide 1699 according to the facts, but on most machines the constant 0 or the constant 1700 1 suffices. Use 0 when the machine allows code to be generated with no 1701 frame pointer, and doing so saves some time or space. Use 1 when there is 1702 no possible advantage to avoiding a frame pointer. 1703 1704 In certain cases, the compiler does not know how to produce valid code 1705 without a frame pointer. The compiler recognizes those cases and 1706 automatically gives the function a frame pointer regardless of what 1707 `FRAME_POINTER_REQUIRED' says. You don't need to worry about them. 1708 1709 In a function that does not require a frame pointer, the frame pointer 1710 register can be allocated for ordinary usage, unless you mark it as a fixed 1711 register. See `FIXED_REGISTERS' for more information. */ 1712 #define FRAME_POINTER_REQUIRED frv_frame_pointer_required () 1713 1714 /* If defined, this macro specifies a table of register pairs used to eliminate 1715 unneeded registers that point into the stack frame. If it is not defined, 1716 the only elimination attempted by the compiler is to replace references to 1717 the frame pointer with references to the stack pointer. 1718 1719 The definition of this macro is a list of structure initializations, each of 1720 which specifies an original and replacement register. 1721 1722 On some machines, the position of the argument pointer is not known until 1723 the compilation is completed. In such a case, a separate hard register must 1724 be used for the argument pointer. This register can be eliminated by 1725 replacing it with either the frame pointer or the argument pointer, 1726 depending on whether or not the frame pointer has been eliminated. 1727 1728 In this case, you might specify: 1729 #define ELIMINABLE_REGS \ 1730 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ 1731 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ 1732 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}} 1733 1734 Note that the elimination of the argument pointer with the stack pointer is 1735 specified first since that is the preferred elimination. */ 1736 1737 #define ELIMINABLE_REGS \ 1738 { \ 1739 {ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ 1740 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ 1741 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM} \ 1742 } 1743 1744 /* A C expression that returns nonzero if the compiler is allowed to try to 1745 replace register number FROM with register number TO. This macro need only 1746 be defined if `ELIMINABLE_REGS' is defined, and will usually be the constant 1747 1, since most of the cases preventing register elimination are things that 1748 the compiler already knows about. */ 1749 1750 #define CAN_ELIMINATE(FROM, TO) \ 1751 ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \ 1752 ? ! frame_pointer_needed \ 1753 : 1) 1754 1755 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It specifies the 1756 initial difference between the specified pair of registers. This macro must 1757 be defined if `ELIMINABLE_REGS' is defined. */ 1758 1759 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ 1760 (OFFSET) = frv_initial_elimination_offset (FROM, TO) 1761 1762 1763 /* Passing Function Arguments on the Stack. */ 1764 1765 /* If defined, the maximum amount of space required for outgoing arguments will 1766 be computed and placed into the variable 1767 `current_function_outgoing_args_size'. No space will be pushed onto the 1768 stack for each call; instead, the function prologue should increase the 1769 stack frame size by this amount. 1770 1771 Defining both `PUSH_ROUNDING' and `ACCUMULATE_OUTGOING_ARGS' is not 1772 proper. */ 1773 #define ACCUMULATE_OUTGOING_ARGS 1 1774 1775 /* A C expression that should indicate the number of bytes of its own arguments 1776 that a function pops on returning, or 0 if the function pops no arguments 1777 and the caller must therefore pop them all after the function returns. 1778 1779 FUNDECL is a C variable whose value is a tree node that describes the 1780 function in question. Normally it is a node of type `FUNCTION_DECL' that 1781 describes the declaration of the function. From this it is possible to 1782 obtain the DECL_ATTRIBUTES of the function. 1783 1784 FUNTYPE is a C variable whose value is a tree node that describes the 1785 function in question. Normally it is a node of type `FUNCTION_TYPE' that 1786 describes the data type of the function. From this it is possible to obtain 1787 the data types of the value and arguments (if known). 1788 1789 When a call to a library function is being considered, FUNTYPE will contain 1790 an identifier node for the library function. Thus, if you need to 1791 distinguish among various library functions, you can do so by their names. 1792 Note that "library function" in this context means a function used to 1793 perform arithmetic, whose name is known specially in the compiler and was 1794 not mentioned in the C code being compiled. 1795 1796 STACK-SIZE is the number of bytes of arguments passed on the stack. If a 1797 variable number of bytes is passed, it is zero, and argument popping will 1798 always be the responsibility of the calling function. 1799 1800 On the VAX, all functions always pop their arguments, so the definition of 1801 this macro is STACK-SIZE. On the 68000, using the standard calling 1802 convention, no functions pop their arguments, so the value of the macro is 1803 always 0 in this case. But an alternative calling convention is available 1804 in which functions that take a fixed number of arguments pop them but other 1805 functions (such as `printf') pop nothing (the caller pops all). When this 1806 convention is in use, FUNTYPE is examined to determine whether a function 1807 takes a fixed number of arguments. */ 1808 #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0 1809 1810 1811 /* Function Arguments in Registers. */ 1812 1813 /* Nonzero if we do not know how to pass TYPE solely in registers. 1814 We cannot do so in the following cases: 1815 1816 - if the type has variable size 1817 - if the type is marked as addressable (it is required to be constructed 1818 into the stack) 1819 - if the type is a structure or union. */ 1820 1821 #define MUST_PASS_IN_STACK(MODE,TYPE) \ 1822 (((MODE) == BLKmode) \ 1823 || ((TYPE) != 0 \ 1824 && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \ 1825 || TREE_CODE (TYPE) == RECORD_TYPE \ 1826 || TREE_CODE (TYPE) == UNION_TYPE \ 1827 || TREE_CODE (TYPE) == QUAL_UNION_TYPE \ 1828 || TREE_ADDRESSABLE (TYPE)))) 1829 1830 /* The number of register assigned to holding function arguments. */ 1831 1832 #define FRV_NUM_ARG_REGS 6 1833 1834 /* A C expression that controls whether a function argument is passed in a 1835 register, and which register. 1836 1837 The arguments are CUM, of type CUMULATIVE_ARGS, which summarizes (in a way 1838 defined by INIT_CUMULATIVE_ARGS and FUNCTION_ARG_ADVANCE) all of the previous 1839 arguments so far passed in registers; MODE, the machine mode of the argument; 1840 TYPE, the data type of the argument as a tree node or 0 if that is not known 1841 (which happens for C support library functions); and NAMED, which is 1 for an 1842 ordinary argument and 0 for nameless arguments that correspond to `...' in the 1843 called function's prototype. 1844 1845 The value of the expression should either be a `reg' RTX for the hard 1846 register in which to pass the argument, or zero to pass the argument on the 1847 stack. 1848 1849 For machines like the VAX and 68000, where normally all arguments are 1850 pushed, zero suffices as a definition. 1851 1852 The usual way to make the ANSI library `stdarg.h' work on a machine where 1853 some arguments are usually passed in registers, is to cause nameless 1854 arguments to be passed on the stack instead. This is done by making 1855 `FUNCTION_ARG' return 0 whenever NAMED is 0. 1856 1857 You may use the macro `MUST_PASS_IN_STACK (MODE, TYPE)' in the definition of 1858 this macro to determine if this argument is of a type that must be passed in 1859 the stack. If `REG_PARM_STACK_SPACE' is not defined and `FUNCTION_ARG' 1860 returns nonzero for such an argument, the compiler will abort. If 1861 `REG_PARM_STACK_SPACE' is defined, the argument will be computed in the 1862 stack and then loaded into a register. */ 1863 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ 1864 frv_function_arg (&CUM, MODE, TYPE, NAMED, FALSE) 1865 1866 /* Define this macro if the target machine has "register windows", so that the 1867 register in which a function sees an arguments is not necessarily the same 1868 as the one in which the caller passed the argument. 1869 1870 For such machines, `FUNCTION_ARG' computes the register in which the caller 1871 passes the value, and `FUNCTION_INCOMING_ARG' should be defined in a similar 1872 fashion to tell the function being called where the arguments will arrive. 1873 1874 If `FUNCTION_INCOMING_ARG' is not defined, `FUNCTION_ARG' serves both 1875 purposes. */ 1876 1877 #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \ 1878 frv_function_arg (&CUM, MODE, TYPE, NAMED, TRUE) 1879 1880 /* A C expression for the number of words, at the beginning of an argument, 1881 must be put in registers. The value must be zero for arguments that are 1882 passed entirely in registers or that are entirely pushed on the stack. 1883 1884 On some machines, certain arguments must be passed partially in registers 1885 and partially in memory. On these machines, typically the first N words of 1886 arguments are passed in registers, and the rest on the stack. If a 1887 multi-word argument (a `double' or a structure) crosses that boundary, its 1888 first few words must be passed in registers and the rest must be pushed. 1889 This macro tells the compiler when this occurs, and how many of the words 1890 should go in registers. 1891 1892 `FUNCTION_ARG' for these arguments should return the first register to be 1893 used by the caller for this argument; likewise `FUNCTION_INCOMING_ARG', for 1894 the called function. */ 1895 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ 1896 frv_function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED) 1897 1898 /* extern int frv_function_arg_partial_nregs PARAMS ((CUMULATIVE_ARGS, int, Tree, int)); */ 1899 1900 /* A C expression that indicates when an argument must be passed by reference. 1901 If nonzero for an argument, a copy of that argument is made in memory and a 1902 pointer to the argument is passed instead of the argument itself. The 1903 pointer is passed in whatever way is appropriate for passing a pointer to 1904 that type. 1905 1906 On machines where `REG_PARM_STACK_SPACE' is not defined, a suitable 1907 definition of this macro might be 1908 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ 1909 MUST_PASS_IN_STACK (MODE, TYPE) */ 1910 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ 1911 frv_function_arg_pass_by_reference (&CUM, MODE, TYPE, NAMED) 1912 1913 /* If defined, a C expression that indicates when it is the called function's 1914 responsibility to make a copy of arguments passed by invisible reference. 1915 Normally, the caller makes a copy and passes the address of the copy to the 1916 routine being called. When FUNCTION_ARG_CALLEE_COPIES is defined and is 1917 nonzero, the caller does not make a copy. Instead, it passes a pointer to 1918 the "live" value. The called function must not modify this value. If it 1919 can be determined that the value won't be modified, it need not make a copy; 1920 otherwise a copy must be made. */ 1921 #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \ 1922 frv_function_arg_callee_copies (&CUM, MODE, TYPE, NAMED) 1923 1924 /* If defined, a C expression that indicates when it is more desirable to keep 1925 an argument passed by invisible reference as a reference, rather than 1926 copying it to a pseudo register. */ 1927 #define FUNCTION_ARG_KEEP_AS_REFERENCE(CUM, MODE, TYPE, NAMED) \ 1928 frv_function_arg_keep_as_reference (&CUM, MODE, TYPE, NAMED) 1929 1930 /* A C type for declaring a variable that is used as the first argument of 1931 `FUNCTION_ARG' and other related values. For some target machines, the type 1932 `int' suffices and can hold the number of bytes of argument so far. 1933 1934 There is no need to record in `CUMULATIVE_ARGS' anything about the arguments 1935 that have been passed on the stack. The compiler has other variables to 1936 keep track of that. For target machines on which all arguments are passed 1937 on the stack, there is no need to store anything in `CUMULATIVE_ARGS'; 1938 however, the data structure must exist and should not be empty, so use 1939 `int'. */ 1940 #define CUMULATIVE_ARGS int 1941 1942 /* A C statement (sans semicolon) for initializing the variable CUM for the 1943 state at the beginning of the argument list. The variable has type 1944 `CUMULATIVE_ARGS'. The value of FNTYPE is the tree node for the data type 1945 of the function which will receive the args, or 0 if the args are to a 1946 compiler support library function. The value of INDIRECT is nonzero when 1947 processing an indirect call, for example a call through a function pointer. 1948 The value of INDIRECT is zero for a call to an explicitly named function, a 1949 library function call, or when `INIT_CUMULATIVE_ARGS' is used to find 1950 arguments for the function being compiled. 1951 1952 When processing a call to a compiler support library function, LIBNAME 1953 identifies which one. It is a `symbol_ref' rtx which contains the name of 1954 the function, as a string. LIBNAME is 0 when an ordinary C function call is 1955 being processed. Thus, each time this macro is called, either LIBNAME or 1956 FNTYPE is nonzero, but never both of them at once. */ 1957 1958 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \ 1959 frv_init_cumulative_args (&CUM, FNTYPE, LIBNAME, INDIRECT, FALSE) 1960 1961 /* Like `INIT_CUMULATIVE_ARGS' but overrides it for the purposes of finding the 1962 arguments for the function being compiled. If this macro is undefined, 1963 `INIT_CUMULATIVE_ARGS' is used instead. 1964 1965 The value passed for LIBNAME is always 0, since library routines with 1966 special calling conventions are never compiled with GNU CC. The argument 1967 LIBNAME exists for symmetry with `INIT_CUMULATIVE_ARGS'. */ 1968 1969 #define INIT_CUMULATIVE_INCOMING_ARGS(CUM, FNTYPE, LIBNAME) \ 1970 frv_init_cumulative_args (&CUM, FNTYPE, LIBNAME, FALSE, TRUE) 1971 1972 /* A C statement (sans semicolon) to update the summarizer variable CUM to 1973 advance past an argument in the argument list. The values MODE, TYPE and 1974 NAMED describe that argument. Once this is done, the variable CUM is 1975 suitable for analyzing the *following* argument with `FUNCTION_ARG', etc. 1976 1977 This macro need not do anything if the argument in question was passed on 1978 the stack. The compiler knows how to track the amount of stack space used 1979 for arguments without any special help. */ 1980 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ 1981 frv_function_arg_advance (&CUM, MODE, TYPE, NAMED) 1982 1983 /* If defined, a C expression that gives the alignment boundary, in bits, of an 1984 argument with the specified mode and type. If it is not defined, 1985 `PARM_BOUNDARY' is used for all arguments. */ 1986 1987 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \ 1988 frv_function_arg_boundary (MODE, TYPE) 1989 1990 /* A C expression that is nonzero if REGNO is the number of a hard register in 1991 which function arguments are sometimes passed. This does *not* include 1992 implicit arguments such as the static chain and the structure-value address. 1993 On many machines, no registers can be used for this purpose since all 1994 function arguments are pushed on the stack. */ 1995 #define FUNCTION_ARG_REGNO_P(REGNO) \ 1996 ((REGNO) >= FIRST_ARG_REGNUM && ((REGNO) <= LAST_ARG_REGNUM)) 1997 1998 1999 /* How Scalar Function Values are Returned. */ 2000 2001 /* The number of the hard register that is used to return a scalar value from a 2002 function call. */ 2003 #define RETURN_VALUE_REGNUM (GPR_FIRST + 8) 2004 2005 /* A C expression to create an RTX representing the place where a function 2006 returns a value of data type VALTYPE. VALTYPE is a tree node representing a 2007 data type. Write `TYPE_MODE (VALTYPE)' to get the machine mode used to 2008 represent that type. On many machines, only the mode is relevant. 2009 (Actually, on most machines, scalar values are returned in the same place 2010 regardless of mode). 2011 2012 If `PROMOTE_FUNCTION_RETURN' is defined, you must apply the same promotion 2013 rules specified in `PROMOTE_MODE' if VALTYPE is a scalar type. 2014 2015 If the precise function being called is known, FUNC is a tree node 2016 (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This makes it 2017 possible to use a different value-returning convention for specific 2018 functions when all their calls are known. 2019 2020 `FUNCTION_VALUE' is not used for return vales with aggregate data types, 2021 because these are returned in another way. See `STRUCT_VALUE_REGNUM' and 2022 related macros, below. */ 2023 #define FUNCTION_VALUE(VALTYPE, FUNC) \ 2024 gen_rtx (REG, TYPE_MODE (VALTYPE), RETURN_VALUE_REGNUM) 2025 2026 /* A C expression to create an RTX representing the place where a library 2027 function returns a value of mode MODE. 2028 2029 Note that "library function" in this context means a compiler support 2030 routine, used to perform arithmetic, whose name is known specially by the 2031 compiler and was not mentioned in the C code being compiled. 2032 2033 The definition of `LIBRARY_VALUE' need not be concerned aggregate data 2034 types, because none of the library functions returns such types. */ 2035 #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, RETURN_VALUE_REGNUM) 2036 2037 /* A C expression that is nonzero if REGNO is the number of a hard register in 2038 which the values of called function may come back. 2039 2040 A register whose use for returning values is limited to serving as the 2041 second of a pair (for a value of type `double', say) need not be recognized 2042 by this macro. So for most machines, this definition suffices: 2043 2044 #define FUNCTION_VALUE_REGNO_P(N) ((N) == RETURN) 2045 2046 If the machine has register windows, so that the caller and the called 2047 function use different registers for the return value, this macro should 2048 recognize only the caller's register numbers. */ 2049 #define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == RETURN_VALUE_REGNUM) 2050 2051 2052 /* How Large Values are Returned. */ 2053 2054 /* If the structure value address is passed in a register, then 2055 `STRUCT_VALUE_REGNUM' should be the number of that register. */ 2056 #define STRUCT_VALUE_REGNUM (GPR_FIRST + 3) 2057 2058 2059 /* Function Entry and Exit. */ 2060 2061 /* Define this macro as a C expression that is nonzero if the return 2062 instruction or the function epilogue ignores the value of the stack pointer; 2063 in other words, if it is safe to delete an instruction to adjust the stack 2064 pointer before a return from the function. 2065 2066 Note that this macro's value is relevant only for functions for which frame 2067 pointers are maintained. It is never safe to delete a final stack 2068 adjustment in a function that has no frame pointer, and the compiler knows 2069 this regardless of `EXIT_IGNORE_STACK'. */ 2070 #define EXIT_IGNORE_STACK 1 2071 2072 /* Generating Code for Profiling. */ 2073 2074 /* A C statement or compound statement to output to FILE some assembler code to 2075 call the profiling subroutine `mcount'. Before calling, the assembler code 2076 must load the address of a counter variable into a register where `mcount' 2077 expects to find the address. The name of this variable is `LP' followed by 2078 the number LABELNO, so you would generate the name using `LP%d' in a 2079 `fprintf'. 2080 2081 The details of how the address should be passed to `mcount' are determined 2082 by your operating system environment, not by GNU CC. To figure them out, 2083 compile a small program for profiling using the system's installed C 2084 compiler and look at the assembler code that results. 2085 2086 This declaration must be present, but it can be an abort if profiling is 2087 not implemented. */ 2088 2089 #define FUNCTION_PROFILER(FILE, LABELNO) abort () 2090 2091 2092 /* Implementing the Varargs Macros. */ 2093 2094 /* If defined, is a C expression that produces the machine-specific code for a 2095 call to `__builtin_saveregs'. This code will be moved to the very beginning 2096 of the function, before any parameter access are made. The return value of 2097 this function should be an RTX that contains the value to use as the return 2098 of `__builtin_saveregs'. 2099 2100 If this macro is not defined, the compiler will output an ordinary call to 2101 the library function `__builtin_saveregs'. */ 2102 2103 #define EXPAND_BUILTIN_SAVEREGS() frv_expand_builtin_saveregs () 2104 2105 /* This macro offers an alternative to using `__builtin_saveregs' and defining 2106 the macro `EXPAND_BUILTIN_SAVEREGS'. Use it to store the anonymous register 2107 arguments into the stack so that all the arguments appear to have been 2108 passed consecutively on the stack. Once this is done, you can use the 2109 standard implementation of varargs that works for machines that pass all 2110 their arguments on the stack. 2111 2112 The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure, containing 2113 the values that obtain after processing of the named arguments. The 2114 arguments MODE and TYPE describe the last named argument--its machine mode 2115 and its data type as a tree node. 2116 2117 The macro implementation should do two things: first, push onto the stack 2118 all the argument registers *not* used for the named arguments, and second, 2119 store the size of the data thus pushed into the `int'-valued variable whose 2120 name is supplied as the argument PRETEND_ARGS_SIZE. The value that you 2121 store here will serve as additional offset for setting up the stack frame. 2122 2123 Because you must generate code to push the anonymous arguments at compile 2124 time without knowing their data types, `SETUP_INCOMING_VARARGS' is only 2125 useful on machines that have just a single category of argument register and 2126 use it uniformly for all data types. 2127 2128 If the argument SECOND_TIME is nonzero, it means that the arguments of the 2129 function are being analyzed for the second time. This happens for an inline 2130 function, which is not actually compiled until the end of the source file. 2131 The macro `SETUP_INCOMING_VARARGS' should not generate any instructions in 2132 this case. */ 2133 #define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_ARGS_SIZE, SECOND_TIME) \ 2134 frv_setup_incoming_varargs (& ARGS_SO_FAR, (int) MODE, TYPE, \ 2135 & PRETEND_ARGS_SIZE, SECOND_TIME) 2136 2137 /* Implement the stdarg/varargs va_start macro. STDARG_P is nonzero if this 2138 is stdarg.h instead of varargs.h. VALIST is the tree of the va_list 2139 variable to initialize. NEXTARG is the machine independent notion of the 2140 'next' argument after the variable arguments. If not defined, a standard 2141 implementation will be defined that works for arguments passed on the stack. */ 2142 2143 #define EXPAND_BUILTIN_VA_START(VALIST, NEXTARG) \ 2144 (frv_expand_builtin_va_start(VALIST, NEXTARG)) 2145 2146 /* Implement the stdarg/varargs va_arg macro. VALIST is the variable of type 2147 va_list as a tree, TYPE is the type passed to va_arg. */ 2148 2149 #define EXPAND_BUILTIN_VA_ARG(VALIST, TYPE) \ 2150 (frv_expand_builtin_va_arg (VALIST, TYPE)) 2151 2152 2153 /* Trampolines for Nested Functions. */ 2154 2155 /* A C expression for the size in bytes of the trampoline, as an integer. */ 2156 #define TRAMPOLINE_SIZE frv_trampoline_size () 2157 2158 /* Alignment required for trampolines, in bits. 2159 2160 If you don't define this macro, the value of `BIGGEST_ALIGNMENT' is used for 2161 aligning trampolines. */ 2162 #define TRAMPOLINE_ALIGNMENT 32 2163 2164 /* A C statement to initialize the variable parts of a trampoline. ADDR is an 2165 RTX for the address of the trampoline; FNADDR is an RTX for the address of 2166 the nested function; STATIC_CHAIN is an RTX for the static chain value that 2167 should be passed to the function when it is called. */ 2168 #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN) \ 2169 frv_initialize_trampoline (ADDR, FNADDR, STATIC_CHAIN) 2170 2171 /* Define this macro if trampolines need a special subroutine to do their work. 2172 The macro should expand to a series of `asm' statements which will be 2173 compiled with GNU CC. They go in a library function named 2174 `__transfer_from_trampoline'. 2175 2176 If you need to avoid executing the ordinary prologue code of a compiled C 2177 function when you jump to the subroutine, you can do so by placing a special 2178 label of your own in the assembler code. Use one `asm' statement to 2179 generate an assembler label, and another to make the label global. Then 2180 trampolines can use that label to jump directly to your special assembler 2181 code. */ 2182 2183 #ifdef __FRV_UNDERSCORE__ 2184 #define TRAMPOLINE_TEMPLATE_NAME "___trampoline_template" 2185 #else 2186 #define TRAMPOLINE_TEMPLATE_NAME "__trampoline_template" 2187 #endif 2188 2189 #define TRANSFER_FROM_TRAMPOLINE \ 2190 extern int _write (int, const void *, unsigned); \ 2191 \ 2192 void \ 2193 __trampoline_setup (addr, size, fnaddr, sc) \ 2194 short * addr; \ 2195 int size; \ 2196 int fnaddr; \ 2197 int sc; \ 2198 { \ 2199 extern short __trampoline_template[]; \ 2200 short * to = addr; \ 2201 short * from = &__trampoline_template[0]; \ 2202 int i; \ 2203 \ 2204 if (size < 20) \ 2205 { \ 2206 _write (2, "__trampoline_setup bad size\n", \ 2207 sizeof ("__trampoline_setup bad size\n") - 1); \ 2208 exit (-1); \ 2209 } \ 2210 \ 2211 to[0] = from[0]; \ 2212 to[1] = (short)(fnaddr); \ 2213 to[2] = from[2]; \ 2214 to[3] = (short)(sc); \ 2215 to[4] = from[4]; \ 2216 to[5] = (short)(fnaddr >> 16); \ 2217 to[6] = from[6]; \ 2218 to[7] = (short)(sc >> 16); \ 2219 to[8] = from[8]; \ 2220 to[9] = from[9]; \ 2221 \ 2222 for (i = 0; i < 20; i++) \ 2223 __asm__ volatile ("dcf @(%0,%1)\n\tici @(%0,%1)" :: "r" (to), "r" (i)); \ 2224 } \ 2225 \ 2226 __asm__("\n" \ 2227 "\t.globl " TRAMPOLINE_TEMPLATE_NAME "\n" \ 2228 "\t.text\n" \ 2229 TRAMPOLINE_TEMPLATE_NAME ":\n" \ 2230 "\tsetlos #0, gr6\n" /* jump register */ \ 2231 "\tsetlos #0, gr7\n" /* static chain */ \ 2232 "\tsethi #0, gr6\n" \ 2233 "\tsethi #0, gr7\n" \ 2234 "\tjmpl @(gr0,gr6)\n"); 2235 2236 2237 /* Implicit Calls to Library Routines. */ 2238 2239 /* A C string constant giving the name of the function to call for the 2240 remainder in division of one signed full-word by another. If you do not 2241 define this macro, the default name is used, which is `__modsi3', a function 2242 defined in `libgcc.a'. */ 2243 #define MODSI3_LIBCALL "__modi" 2244 2245 /* A C string constant giving the name of the function to call for the 2246 remainder in division of one unsigned full-word by another. If you do not 2247 define this macro, the default name is used, which is `__umodsi3', a 2248 function defined in `libgcc.a'. */ 2249 #define UMODSI3_LIBCALL "__umodi" 2250 2251 /* A C string constant giving the name of the function to call for 2252 multiplication of one signed double-word by another. If you do not define 2253 this macro, the default name is used, which is `__muldi3', a function 2254 defined in `libgcc.a'. */ 2255 #define MULDI3_LIBCALL "__mulll" 2256 2257 /* A C string constant giving the name of the function to call for division of 2258 one signed double-word by another. If you do not define this macro, the 2259 default name is used, which is `__divdi3', a function defined in `libgcc.a'. */ 2260 #define DIVDI3_LIBCALL "__divll" 2261 2262 /* A C string constant giving the name of the function to call for division of 2263 one unsigned full-word by another. If you do not define this macro, the 2264 default name is used, which is `__udivdi3', a function defined in 2265 `libgcc.a'. */ 2266 #define UDIVDI3_LIBCALL "__udivll" 2267 2268 /* A C string constant giving the name of the function to call for the 2269 remainder in division of one signed double-word by another. If you do not 2270 define this macro, the default name is used, which is `__moddi3', a function 2271 defined in `libgcc.a'. */ 2272 #define MODDI3_LIBCALL "__modll" 2273 2274 /* A C string constant giving the name of the function to call for the 2275 remainder in division of one unsigned full-word by another. If you do not 2276 define this macro, the default name is used, which is `__umoddi3', a 2277 function defined in `libgcc.a'. */ 2278 #define UMODDI3_LIBCALL "__umodll" 2279 2280 /* Define this macro as a C statement that declares additional library routines 2281 renames existing ones. `init_optabs' calls this macro after initializing all 2282 the normal library routines. */ 2283 #define INIT_TARGET_OPTABS \ 2284 do \ 2285 { \ 2286 add_optab->handlers [(int) DImode].libfunc \ 2287 = init_one_libfunc ("__addll"); \ 2288 sub_optab->handlers [(int) DImode].libfunc \ 2289 = init_one_libfunc ("__subll"); \ 2290 and_optab->handlers [(int) DImode].libfunc \ 2291 = init_one_libfunc ("__andll"); \ 2292 ior_optab->handlers [(int) DImode].libfunc \ 2293 = init_one_libfunc ("__orll"); \ 2294 xor_optab->handlers [(int) DImode].libfunc \ 2295 = init_one_libfunc ("__xorll"); \ 2296 one_cmpl_optab->handlers [(int) DImode].libfunc \ 2297 = init_one_libfunc ("__notll"); \ 2298 add_optab->handlers [(int) SFmode].libfunc \ 2299 = init_one_libfunc ("__addf"); \ 2300 sub_optab->handlers [(int) SFmode].libfunc \ 2301 = init_one_libfunc ("__subf"); \ 2302 smul_optab->handlers [(int) SFmode].libfunc \ 2303 = init_one_libfunc ("__mulf"); \ 2304 sdiv_optab->handlers [(int) SFmode].libfunc \ 2305 = init_one_libfunc ("__divf"); \ 2306 add_optab->handlers [(int) DFmode].libfunc \ 2307 = init_one_libfunc ("__addd"); \ 2308 sub_optab->handlers [(int) DFmode].libfunc \ 2309 = init_one_libfunc ("__subd"); \ 2310 smul_optab->handlers [(int) DFmode].libfunc \ 2311 = init_one_libfunc ("__muld"); \ 2312 sdiv_optab->handlers [(int) DFmode].libfunc \ 2313 = init_one_libfunc ("__divd"); \ 2314 fixsfsi_libfunc = init_one_libfunc ("__ftoi"); \ 2315 fixunssfsi_libfunc = init_one_libfunc ("__ftoui"); \ 2316 fixsfdi_libfunc = init_one_libfunc ("__ftoll"); \ 2317 fixunssfdi_libfunc = init_one_libfunc ("__ftoull"); \ 2318 fixdfsi_libfunc = init_one_libfunc ("__dtoi"); \ 2319 fixunsdfsi_libfunc = init_one_libfunc ("__dtoui"); \ 2320 fixdfdi_libfunc = init_one_libfunc ("__dtoll"); \ 2321 fixunsdfdi_libfunc = init_one_libfunc ("__dtoull"); \ 2322 floatsisf_libfunc = init_one_libfunc ("__itof"); \ 2323 floatdisf_libfunc = init_one_libfunc ("__lltof"); \ 2324 floatsidf_libfunc = init_one_libfunc ("__itod"); \ 2325 floatdidf_libfunc = init_one_libfunc ("__lltod"); \ 2326 extendsfdf2_libfunc = init_one_libfunc ("__ftod"); \ 2327 truncdfsf2_libfunc = init_one_libfunc ("__dtof"); \ 2328 } \ 2329 while (0) 2330 2331 2332 /* Addressing Modes. */ 2333 2334 /* A C expression that is 1 if the RTX X is a constant which is a valid 2335 address. On most machines, this can be defined as `CONSTANT_P (X)', but a 2336 few machines are more restrictive in which constant addresses are supported. 2337 2338 `CONSTANT_P' accepts integer-values expressions whose values are not 2339 explicitly known, such as `symbol_ref', `label_ref', and `high' expressions 2340 and `const' arithmetic expressions, in addition to `const_int' and 2341 `const_double' expressions. */ 2342 #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X) 2343 2344 /* A number, the maximum number of registers that can appear in a valid memory 2345 address. Note that it is up to you to specify a value equal to the maximum 2346 number that `GO_IF_LEGITIMATE_ADDRESS' would ever accept. */ 2347 #define MAX_REGS_PER_ADDRESS 2 2348 2349 /* A C compound statement with a conditional `goto LABEL;' executed if X (an 2350 RTX) is a legitimate memory address on the target machine for a memory 2351 operand of mode MODE. 2352 2353 It usually pays to define several simpler macros to serve as subroutines for 2354 this one. Otherwise it may be too complicated to understand. 2355 2356 This macro must exist in two variants: a strict variant and a non-strict 2357 one. The strict variant is used in the reload pass. It must be defined so 2358 that any pseudo-register that has not been allocated a hard register is 2359 considered a memory reference. In contexts where some kind of register is 2360 required, a pseudo-register with no hard register must be rejected. 2361 2362 The non-strict variant is used in other passes. It must be defined to 2363 accept all pseudo-registers in every context where some kind of register is 2364 required. 2365 2366 Compiler source files that want to use the strict variant of this macro 2367 define the macro `REG_OK_STRICT'. You should use an `#ifdef REG_OK_STRICT' 2368 conditional to define the strict variant in that case and the non-strict 2369 variant otherwise. 2370 2371 Subroutines to check for acceptable registers for various purposes (one for 2372 base registers, one for index registers, and so on) are typically among the 2373 subroutines used to define `GO_IF_LEGITIMATE_ADDRESS'. Then only these 2374 subroutine macros need have two variants; the higher levels of macros may be 2375 the same whether strict or not. 2376 2377 Normally, constant addresses which are the sum of a `symbol_ref' and an 2378 integer are stored inside a `const' RTX to mark them as constant. 2379 Therefore, there is no need to recognize such sums specifically as 2380 legitimate addresses. Normally you would simply recognize any `const' as 2381 legitimate. 2382 2383 Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle constant sums that 2384 are not marked with `const'. It assumes that a naked `plus' indicates 2385 indexing. If so, then you *must* reject such naked constant sums as 2386 illegitimate addresses, so that none of them will be given to 2387 `PRINT_OPERAND_ADDRESS'. 2388 2389 On some machines, whether a symbolic address is legitimate depends on the 2390 section that the address refers to. On these machines, define the macro 2391 `ENCODE_SECTION_INFO' to store the information into the `symbol_ref', and 2392 then check for it here. When you see a `const', you will have to look 2393 inside it to find the `symbol_ref' in order to determine the section. 2394 2395 The best way to modify the name string is by adding text to the beginning, 2396 with suitable punctuation to prevent any ambiguity. Allocate the new name 2397 in `saveable_obstack'. You will have to modify `ASM_OUTPUT_LABELREF' to 2398 remove and decode the added text and output the name accordingly, and define 2399 `(* targetm.strip_name_encoding)' to access the original name string. 2400 2401 You can check the information stored here into the `symbol_ref' in the 2402 definitions of the macros `GO_IF_LEGITIMATE_ADDRESS' and 2403 `PRINT_OPERAND_ADDRESS'. */ 2404 2405 #ifdef REG_OK_STRICT 2406 #define REG_OK_STRICT_P 1 2407 #else 2408 #define REG_OK_STRICT_P 0 2409 #endif 2410 2411 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ 2412 do \ 2413 { \ 2414 if (frv_legitimate_address_p (MODE, X, REG_OK_STRICT_P, FALSE)) \ 2415 goto LABEL; \ 2416 } \ 2417 while (0) 2418 2419 /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for 2420 use as a base register. For hard registers, it should always accept those 2421 which the hardware permits and reject the others. Whether the macro accepts 2422 or rejects pseudo registers must be controlled by `REG_OK_STRICT' as 2423 described above. This usually requires two variant definitions, of which 2424 `REG_OK_STRICT' controls the one actually used. */ 2425 #ifdef REG_OK_STRICT 2426 #define REG_OK_FOR_BASE_P(X) GPR_P (REGNO (X)) 2427 #else 2428 #define REG_OK_FOR_BASE_P(X) GPR_AP_OR_PSEUDO_P (REGNO (X)) 2429 #endif 2430 2431 /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for 2432 use as an index register. 2433 2434 The difference between an index register and a base register is that the 2435 index register may be scaled. If an address involves the sum of two 2436 registers, neither one of them scaled, then either one may be labeled the 2437 "base" and the other the "index"; but whichever labeling is used must fit 2438 the machine's constraints of which registers may serve in each capacity. 2439 The compiler will try both labelings, looking for one that is valid, and 2440 will reload one or both registers only if neither labeling works. */ 2441 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X) 2442 2443 /* A C compound statement that attempts to replace X with a valid memory 2444 address for an operand of mode MODE. WIN will be a C statement label 2445 elsewhere in the code; the macro definition may use 2446 2447 GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN); 2448 2449 to avoid further processing if the address has become legitimate. 2450 2451 X will always be the result of a call to `break_out_memory_refs', and OLDX 2452 will be the operand that was given to that function to produce X. 2453 2454 The code generated by this macro should not alter the substructure of X. If 2455 it transforms X into a more legitimate form, it should assign X (which will 2456 always be a C variable) a new value. 2457 2458 It is not necessary for this macro to come up with a legitimate address. 2459 The compiler has standard ways of doing so in all cases. In fact, it is 2460 safe for this macro to do nothing. But often a machine-dependent strategy 2461 can generate better code. */ 2462 2463 /* On the FRV, we use it to convert small data and pic references into using 2464 the appropriate pointer in the address. */ 2465 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \ 2466 do \ 2467 { \ 2468 rtx newx = frv_legitimize_address (X, OLDX, MODE); \ 2469 \ 2470 if (newx) \ 2471 { \ 2472 (X) = newx; \ 2473 goto WIN; \ 2474 } \ 2475 } \ 2476 while (0) 2477 2478 /* A C statement or compound statement with a conditional `goto LABEL;' 2479 executed if memory address X (an RTX) can have different meanings depending 2480 on the machine mode of the memory reference it is used for or if the address 2481 is valid for some modes but not others. 2482 2483 Autoincrement and autodecrement addresses typically have mode-dependent 2484 effects because the amount of the increment or decrement is the size of the 2485 operand being addressed. Some machines have other mode-dependent addresses. 2486 Many RISC machines have no mode-dependent addresses. 2487 2488 You may assume that ADDR is a valid address for the machine. */ 2489 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) 2490 2491 /* A C expression that is nonzero if X is a legitimate constant for an 2492 immediate operand on the target machine. You can assume that X satisfies 2493 `CONSTANT_P', so you need not check this. In fact, `1' is a suitable 2494 definition for this macro on machines where anything `CONSTANT_P' is valid. */ 2495 #define LEGITIMATE_CONSTANT_P(X) frv_legitimate_constant_p (X) 2496 2497 /* The load-and-update commands allow pre-modification in addresses. 2498 The index has to be in a register. */ 2499 #define HAVE_PRE_MODIFY_REG 1 2500 2501 2502 /* Returns a mode from class `MODE_CC' to be used when comparison operation 2503 code OP is applied to rtx X and Y. For example, on the SPARC, 2504 `SELECT_CC_MODE' is defined as (see *note Jump Patterns::. for a 2505 description of the reason for this definition) 2506 2507 #define SELECT_CC_MODE(OP,X,Y) \ 2508 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ 2509 ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode) \ 2510 : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \ 2511 || GET_CODE (X) == NEG) \ 2512 ? CC_NOOVmode : CCmode)) 2513 2514 You need not define this macro if `EXTRA_CC_MODES' is not defined. */ 2515 #define SELECT_CC_MODE(OP, X, Y) \ 2516 (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ 2517 ? CC_FPmode \ 2518 : (((OP) == LEU || (OP) == GTU || (OP) == LTU || (OP) == GEU) \ 2519 ? CC_UNSmode \ 2520 : CCmode)) 2521 2522 /* A C expression whose value is one if it is always safe to reverse a 2523 comparison whose mode is MODE. If `SELECT_CC_MODE' can ever return MODE for 2524 a floating-point inequality comparison, then `REVERSIBLE_CC_MODE (MODE)' 2525 must be zero. 2526 2527 You need not define this macro if it would always returns zero or if the 2528 floating-point format is anything other than `IEEE_FLOAT_FORMAT'. For 2529 example, here is the definition used on the SPARC, where floating-point 2530 inequality comparisons are always given `CCFPEmode': 2531 2532 #define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode) */ 2533 2534 /* On frv, don't consider floating point comparisons to be reversible. In 2535 theory, fp equality comparisons can be reversible */ 2536 #define REVERSIBLE_CC_MODE(MODE) ((MODE) == CCmode || (MODE) == CC_UNSmode) 2537 2538 /* Frv CCR_MODE's are not reversible. */ 2539 #define REVERSE_CONDEXEC_PREDICATES_P(x,y) 0 2540 2541 2542 /* Describing Relative Costs of Operations. */ 2543 2544 /* A part of a C `switch' statement that describes the relative costs of 2545 constant RTL expressions. It must contain `case' labels for expression 2546 codes `const_int', `const', `symbol_ref', `label_ref' and `const_double'. 2547 Each case must ultimately reach a `return' statement to return the relative 2548 cost of the use of that kind of constant value in an expression. The cost 2549 may depend on the precise value of the constant, which is available for 2550 examination in X, and the rtx code of the expression in which it is 2551 contained, found in OUTER_CODE. 2552 2553 CODE is the expression code--redundant, since it can be obtained with 2554 `GET_CODE (X)'. */ 2555 #define CONST_COSTS(X, CODE, OUTER_CODE) \ 2556 case CONST: \ 2557 case LABEL_REF: \ 2558 case SYMBOL_REF: \ 2559 case CONST_DOUBLE: \ 2560 return COSTS_N_INSNS (2); \ 2561 \ 2562 case CONST_INT: \ 2563 /* Make 12 bit integers really cheap */ \ 2564 return IN_RANGE_P (INTVAL (X), -2048, 2047) ? 0 : COSTS_N_INSNS (2); \ 2565 2566 /* Like `CONST_COSTS' but applies to nonconstant RTL expressions. This can be 2567 used, for example, to indicate how costly a multiply instruction is. In 2568 writing this macro, you can use the construct `COSTS_N_INSNS (N)' to specify 2569 a cost equal to N fast instructions. OUTER_CODE is the code of the 2570 expression in which X is contained. 2571 2572 This macro is optional; do not define it if the default cost assumptions are 2573 adequate for the target machine. */ 2574 #define RTX_COSTS(X, CODE, OUTER_CODE) \ 2575 case PLUS: \ 2576 case MINUS: \ 2577 case AND: \ 2578 case IOR: \ 2579 case XOR: \ 2580 case ASHIFT: \ 2581 case ASHIFTRT: \ 2582 case LSHIFTRT: \ 2583 case NOT: \ 2584 case NEG: \ 2585 case COMPARE: \ 2586 if (GET_MODE (X) == SImode) \ 2587 return COSTS_N_INSNS (1); \ 2588 else if (GET_MODE (X) == DImode) \ 2589 return COSTS_N_INSNS (2); \ 2590 else \ 2591 return COSTS_N_INSNS (3); /* guess */ \ 2592 \ 2593 case MULT: \ 2594 if (GET_MODE (X) == SImode) \ 2595 return COSTS_N_INSNS (2); \ 2596 else \ 2597 return COSTS_N_INSNS (6); /* guess */ \ 2598 \ 2599 case DIV: \ 2600 case UDIV: \ 2601 return COSTS_N_INSNS (18); 2602 2603 /* A C expression for the cost of moving data from a register in class FROM to 2604 one in class TO. The classes are expressed using the enumeration values 2605 such as `GENERAL_REGS'. A value of 4 is the default; other values are 2606 interpreted relative to that. 2607 2608 It is not required that the cost always equal 2 when FROM is the same as TO; 2609 on some machines it is expensive to move between registers if they are not 2610 general registers. 2611 2612 If reload sees an insn consisting of a single `set' between two hard 2613 registers, and if `REGISTER_MOVE_COST' applied to their classes returns a 2614 value of 2, reload does not check to ensure that the constraints of the insn 2615 are met. Setting a cost of other than 2 will allow reload to verify that 2616 the constraints are met. You should do this if the `movM' pattern's 2617 constraints do not allow such copying. */ 2618 #define REGISTER_MOVE_COST(MODE, FROM, TO) frv_register_move_cost (FROM, TO) 2619 2620 /* A C expression for the cost of moving data of mode M between a register and 2621 memory. A value of 2 is the default; this cost is relative to those in 2622 `REGISTER_MOVE_COST'. 2623 2624 If moving between registers and memory is more expensive than between two 2625 registers, you should define this macro to express the relative cost. */ 2626 #define MEMORY_MOVE_COST(M,C,I) 4 2627 2628 /* A C expression for the cost of a branch instruction. A value of 1 is the 2629 default; other values are interpreted relative to that. */ 2630 2631 /* Here are additional macros which do not specify precise relative costs, but 2632 only that certain actions are more expensive than GNU CC would ordinarily 2633 expect. */ 2634 2635 /* We used to default the branch cost to 2, but I changed it to 1, to avoid 2636 generating SCC instructions and or/and-ing them together, and then doing the 2637 branch on the result, which collectively generate much worse code. */ 2638 #ifndef DEFAULT_BRANCH_COST 2639 #define DEFAULT_BRANCH_COST 1 2640 #endif 2641 2642 #define BRANCH_COST frv_branch_cost_int 2643 2644 /* Define this macro as a C expression which is nonzero if accessing less than 2645 a word of memory (i.e. a `char' or a `short') is no faster than accessing a 2646 word of memory, i.e., if such access require more than one instruction or if 2647 there is no difference in cost between byte and (aligned) word loads. 2648 2649 When this macro is not defined, the compiler will access a field by finding 2650 the smallest containing object; when it is defined, a fullword load will be 2651 used if alignment permits. Unless bytes accesses are faster than word 2652 accesses, using word accesses is preferable since it may eliminate 2653 subsequent memory access if subsequent accesses occur to other fields in the 2654 same word of the structure, but to different bytes. */ 2655 #define SLOW_BYTE_ACCESS 1 2656 2657 /* Define this macro if it is as good or better to call a constant function 2658 address than to call an address kept in a register. */ 2659 #define NO_FUNCTION_CSE 2660 2661 /* Define this macro if it is as good or better for a function to call itself 2662 with an explicit address than to call an address kept in a register. */ 2663 #define NO_RECURSIVE_FUNCTION_CSE 2664 2665 2666 /* Dividing the output into sections. */ 2667 2668 /* A C expression whose value is a string containing the assembler operation 2669 that should precede instructions and read-only data. Normally `".text"' is 2670 right. */ 2671 #define TEXT_SECTION_ASM_OP "\t.text" 2672 2673 /* A C expression whose value is a string containing the assembler operation to 2674 identify the following data as writable initialized data. Normally 2675 `".data"' is right. */ 2676 #define DATA_SECTION_ASM_OP "\t.data" 2677 2678 /* If defined, a C expression whose value is a string containing the 2679 assembler operation to identify the following data as 2680 uninitialized global data. If not defined, and neither 2681 `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined, 2682 uninitialized global data will be output in the data section if 2683 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be 2684 used. */ 2685 #define BSS_SECTION_ASM_OP "\t.section .bss,\"aw\"" 2686 2687 /* Short Data Support */ 2688 #define SDATA_SECTION_ASM_OP "\t.section .sdata,\"aw\"" 2689 #define SBSS_SECTION_ASM_OP "\t.section .sbss,\"aw\"" 2690 2691 /* On svr4, we *do* have support for the .init and .fini sections, and we 2692 can put stuff in there to be executed before and after `main'. We let 2693 crtstuff.c and other files know this by defining the following symbols. 2694 The definitions say how to change sections to the .init and .fini 2695 sections. This is the same for all known svr4 assemblers. 2696 2697 The standard System V.4 macros will work, but they look ugly in the 2698 assembly output, so redefine them. */ 2699 2700 #undef INIT_SECTION_ASM_OP 2701 #undef FINI_SECTION_ASM_OP 2702 #define INIT_SECTION_ASM_OP "\t.section .init,\"ax\"" 2703 #define FINI_SECTION_ASM_OP "\t.section .fini,\"ax\"" 2704 2705 /* A C expression whose value is a string containing the assembler operation to 2706 switch to the fixup section that records all initialized pointers in a -fpic 2707 program so they can be changed program startup time if the program is loaded 2708 at a different address than linked for. */ 2709 #define FIXUP_SECTION_ASM_OP "\t.section .rofixup,\"a\"" 2710 2711 /* A list of names for sections other than the standard two, which are 2712 `in_text' and `in_data'. You need not define this macro 2713 on a system with no other sections (that GCC needs to use). */ 2714 #undef EXTRA_SECTIONS 2715 #define EXTRA_SECTIONS in_sdata, in_sbss, in_const, in_fixup 2716 2717 /* One or more functions to be defined in "varasm.c". These 2718 functions should do jobs analogous to those of `text_section' and 2719 `data_section', for your additional sections. Do not define this 2720 macro if you do not define `EXTRA_SECTIONS'. */ 2721 #undef EXTRA_SECTION_FUNCTIONS 2722 #define EXTRA_SECTION_FUNCTIONS \ 2723 SDATA_SECTION_FUNCTION \ 2724 SBSS_SECTION_FUNCTION \ 2725 FIXUP_SECTION_FUNCTION 2726 2727 2728 #define SDATA_SECTION_FUNCTION \ 2729 void \ 2730 sdata_section () \ 2731 { \ 2732 if (in_section != in_sdata) \ 2733 { \ 2734 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \ 2735 in_section = in_sdata; \ 2736 } \ 2737 } \ 2738 2739 #define SBSS_SECTION_FUNCTION \ 2740 void \ 2741 sbss_section () \ 2742 { \ 2743 if (in_section != in_sbss) \ 2744 { \ 2745 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \ 2746 in_section = in_sbss; \ 2747 } \ 2748 } \ 2749 2750 #define FIXUP_SECTION_FUNCTION \ 2751 void \ 2752 fixup_section () \ 2753 { \ 2754 if (in_section != in_fixup) \ 2755 { \ 2756 fprintf (asm_out_file, "%s\n", FIXUP_SECTION_ASM_OP); \ 2757 in_section = in_fixup; \ 2758 } \ 2759 } \ 2760 2761 #define SDATA_FLAG_CHAR '@' 2762 2763 #define SDATA_NAME_P(NAME) (*(NAME) == SDATA_FLAG_CHAR) 2764 2765 /* Position Independent Code. */ 2766 2767 /* A C expression that is nonzero if X is a legitimate immediate operand on the 2768 target machine when generating position independent code. You can assume 2769 that X satisfies `CONSTANT_P', so you need not check this. You can also 2770 assume FLAG_PIC is true, so you need not check it either. You need not 2771 define this macro if all constants (including `SYMBOL_REF') can be immediate 2772 operands when generating position independent code. */ 2773 #define LEGITIMATE_PIC_OPERAND_P(X) \ 2774 ( GET_CODE (X) == CONST_INT \ 2775 || GET_CODE (X) == CONST_DOUBLE \ 2776 || (GET_CODE (X) == HIGH && GET_CODE (XEXP (X, 0)) == CONST_INT) \ 2777 || GET_CODE (X) == CONSTANT_P_RTX) 2778 2779 2780 /* The Overall Framework of an Assembler File. */ 2781 2782 /* A C string constant describing how to begin a comment in the target 2783 assembler language. The compiler assumes that the comment will end at the 2784 end of the line. */ 2785 #define ASM_COMMENT_START ";" 2786 2787 /* A C string constant for text to be output before each `asm' statement or 2788 group of consecutive ones. Normally this is `"#APP"', which is a comment 2789 that has no effect on most assemblers but tells the GNU assembler that it 2790 must check the lines that follow for all valid assembler constructs. */ 2791 #define ASM_APP_ON "#APP\n" 2792 2793 /* A C string constant for text to be output after each `asm' statement or 2794 group of consecutive ones. Normally this is `"#NO_APP"', which tells the 2795 GNU assembler to resume making the time-saving assumptions that are valid 2796 for ordinary compiler output. */ 2797 #define ASM_APP_OFF "#NO_APP\n" 2798 2799 2800 /* Output of Data. */ 2801 2802 /* This is how to output a label to dwarf/dwarf2. */ 2803 #define ASM_OUTPUT_DWARF_ADDR(STREAM, LABEL) \ 2804 do { \ 2805 fprintf (STREAM, "\t.picptr\t"); \ 2806 assemble_name (STREAM, LABEL); \ 2807 } while (0) 2808 2809 /* Whether to emit the gas specific dwarf2 line number support. */ 2810 #define DWARF2_ASM_LINE_DEBUG_INFO (TARGET_DEBUG_LOC) 2811 2812 /* Output of Uninitialized Variables. */ 2813 2814 /* A C statement (sans semicolon) to output to the stdio stream STREAM the 2815 assembler definition of a local-common-label named NAME whose size is SIZE 2816 bytes. The variable ROUNDED is the size rounded up to whatever alignment 2817 the caller wants. 2818 2819 Use the expression `assemble_name (STREAM, NAME)' to output the name itself; 2820 before and after that, output the additional assembler syntax for defining 2821 the name, and a newline. 2822 2823 This macro controls how the assembler definitions of uninitialized static 2824 variables are output. */ 2825 #undef ASM_OUTPUT_LOCAL 2826 2827 /* Like `ASM_OUTPUT_LOCAL' except takes the required alignment as a separate, 2828 explicit argument. If you define this macro, it is used in place of 2829 `ASM_OUTPUT_LOCAL', and gives you more flexibility in handling the required 2830 alignment of the variable. The alignment is specified as the number of 2831 bits. 2832 2833 Defined in svr4.h. */ 2834 #undef ASM_OUTPUT_ALIGNED_LOCAL 2835 2836 /* This is for final.c, because it is used by ASM_DECLARE_OBJECT_NAME. */ 2837 extern int size_directive_output; 2838 2839 /* Like `ASM_OUTPUT_ALIGNED_LOCAL' except that it takes an additional 2840 parameter - the DECL of variable to be output, if there is one. 2841 This macro can be called with DECL == NULL_TREE. If you define 2842 this macro, it is used in place of `ASM_OUTPUT_LOCAL' and 2843 `ASM_OUTPUT_ALIGNED_LOCAL', and gives you more flexibility in 2844 handling the destination of the variable. */ 2845 #undef ASM_OUTPUT_ALIGNED_DECL_LOCAL 2846 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGN) \ 2847 do { \ 2848 if (SDATA_NAME_P (NAME)) \ 2849 sbss_section (); \ 2850 else \ 2851 bss_section (); \ 2852 ASM_OUTPUT_ALIGN (STREAM, floor_log2 ((ALIGN) / BITS_PER_UNIT)); \ 2853 ASM_DECLARE_OBJECT_NAME (STREAM, NAME, DECL); \ 2854 ASM_OUTPUT_SKIP (STREAM, (SIZE) ? (SIZE) : 1); \ 2855 } while (0) 2856 2857 2858 /* Output and Generation of Labels. */ 2859 2860 /* A C statement (sans semicolon) to output to the stdio stream STREAM the 2861 assembler definition of a label named NAME. Use the expression 2862 `assemble_name (STREAM, NAME)' to output the name itself; before and after 2863 that, output the additional assembler syntax for defining the name, and a 2864 newline. */ 2865 #define ASM_OUTPUT_LABEL(STREAM, NAME) \ 2866 do { \ 2867 assemble_name (STREAM, NAME); \ 2868 fputs (":\n", STREAM); \ 2869 } while (0) 2870 2871 /* Globalizing directive for a label. */ 2872 #define GLOBAL_ASM_OP "\t.globl " 2873 2874 /* A C statement (sans semicolon) to output to the stdio stream STREAM a 2875 reference in assembler syntax to a label named NAME. This should add `_' to 2876 the front of the name, if that is customary on your operating system, as it 2877 is in most Berkeley Unix systems. This macro is used in `assemble_name'. */ 2878 #undef ASM_OUTPUT_LABELREF 2879 #define ASM_OUTPUT_LABELREF(STREAM, NAME) \ 2880 do { \ 2881 const char *_name = (NAME); \ 2882 while (*_name == '*' || *_name == SDATA_FLAG_CHAR) \ 2883 _name++; \ 2884 asm_fprintf (STREAM, "%U%s", _name); \ 2885 } while (0) 2886 2887 /* A C statement to store into the string STRING a label whose name is made 2888 from the string PREFIX and the number NUM. 2889 2890 This string, when output subsequently by `assemble_name', should produce the 2891 output that `ASM_OUTPUT_INTERNAL_LABEL' would produce with the same PREFIX 2892 and NUM. 2893 2894 If the string begins with `*', then `assemble_name' will output the rest of 2895 the string unchanged. It is often convenient for 2896 `ASM_GENERATE_INTERNAL_LABEL' to use `*' in this way. If the string doesn't 2897 start with `*', then `ASM_OUTPUT_LABELREF' gets to output the string, and 2898 may change it. (Of course, `ASM_OUTPUT_LABELREF' is also part of your 2899 machine description, so you should know what it does on your machine.) 2900 2901 Defined in svr4.h. */ 2902 #undef ASM_GENERATE_INTERNAL_LABEL 2903 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ 2904 do { \ 2905 sprintf (LABEL, "*.%s%ld", PREFIX, (long)NUM); \ 2906 } while (0) 2907 2908 /* A C expression to assign to OUTVAR (which is a variable of type `char *') a 2909 newly allocated string made from the string NAME and the number NUMBER, with 2910 some suitable punctuation added. Use `alloca' to get space for the string. 2911 2912 The string will be used as an argument to `ASM_OUTPUT_LABELREF' to produce 2913 an assembler label for an internal static variable whose name is NAME. 2914 Therefore, the string must be such as to result in valid assembler code. 2915 The argument NUMBER is different each time this macro is executed; it 2916 prevents conflicts between similarly-named internal static variables in 2917 different scopes. 2918 2919 Ideally this string should not be a valid C identifier, to prevent any 2920 conflict with the user's own symbols. Most assemblers allow periods or 2921 percent signs in assembler symbols; putting at least one of these between 2922 the name and the number will suffice. */ 2923 #define ASM_FORMAT_PRIVATE_NAME(OUTVAR, NAME, NUMBER) \ 2924 do { \ 2925 (OUTVAR) = (char *) alloca (strlen ((NAME)) + 12); \ 2926 sprintf ((OUTVAR), "%s.%ld", (NAME), (long)(NUMBER)); \ 2927 } while (0) 2928 2929 2930 /* Macros Controlling Initialization Routines. */ 2931 2932 /* If defined, a C string constant for the assembler operation to identify the 2933 following data as initialization code. If not defined, GNU CC will assume 2934 such a section does not exist. When you are using special sections for 2935 initialization and termination functions, this macro also controls how 2936 `crtstuff.c' and `libgcc2.c' arrange to run the initialization functions. 2937 2938 Defined in svr4.h. */ 2939 #undef INIT_SECTION_ASM_OP 2940 2941 /* If defined, `main' will call `__main' despite the presence of 2942 `INIT_SECTION_ASM_OP'. This macro should be defined for systems where the 2943 init section is not actually run automatically, but is still useful for 2944 collecting the lists of constructors and destructors. */ 2945 #define INVOKE__main 2946 2947 /* Output appropriate code tp call a static constructor. */ 2948 #undef ASM_OUTPUT_CONSTRUCTOR 2949 #define ASM_OUTPUT_CONSTRUCTOR(STREAM,NAME) \ 2950 do { \ 2951 ctors_section (); \ 2952 fprintf (STREAM, "\t.picptr\t"); \ 2953 assemble_name (STREAM, NAME); \ 2954 fprintf (STREAM, "\n"); \ 2955 } while (0) 2956 2957 /* Output appropriate code tp call a static destructor. */ 2958 #undef ASM_OUTPUT_DESTRUCTOR 2959 #define ASM_OUTPUT_DESTRUCTOR(STREAM,NAME) \ 2960 do { \ 2961 dtors_section (); \ 2962 fprintf (STREAM, "\t.picptr\t"); \ 2963 assemble_name (STREAM, NAME); \ 2964 fprintf (STREAM, "\n"); \ 2965 } while (0) 2966 2967 2968 /* Output of Assembler Instructions. */ 2969 2970 /* A C initializer containing the assembler's names for the machine registers, 2971 each one as a C string constant. This is what translates register numbers 2972 in the compiler into assembler language. */ 2973 #define REGISTER_NAMES \ 2974 { \ 2975 "gr0", "sp", "fp", "gr3", "gr4", "gr5", "gr6", "gr7", \ 2976 "gr8", "gr9", "gr10", "gr11", "gr12", "gr13", "gr14", "gr15", \ 2977 "gr16", "gr17", "gr18", "gr19", "gr20", "gr21", "gr22", "gr23", \ 2978 "gr24", "gr25", "gr26", "gr27", "gr28", "gr29", "gr30", "gr31", \ 2979 "gr32", "gr33", "gr34", "gr35", "gr36", "gr37", "gr38", "gr39", \ 2980 "gr40", "gr41", "gr42", "gr43", "gr44", "gr45", "gr46", "gr47", \ 2981 "gr48", "gr49", "gr50", "gr51", "gr52", "gr53", "gr54", "gr55", \ 2982 "gr56", "gr57", "gr58", "gr59", "gr60", "gr61", "gr62", "gr63", \ 2983 \ 2984 "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", \ 2985 "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", \ 2986 "fr16", "fr17", "fr18", "fr19", "fr20", "fr21", "fr22", "fr23", \ 2987 "fr24", "fr25", "fr26", "fr27", "fr28", "fr29", "fr30", "fr31", \ 2988 "fr32", "fr33", "fr34", "fr35", "fr36", "fr37", "fr38", "fr39", \ 2989 "fr40", "fr41", "fr42", "fr43", "fr44", "fr45", "fr46", "fr47", \ 2990 "fr48", "fr49", "fr50", "fr51", "fr52", "fr53", "fr54", "fr55", \ 2991 "fr56", "fr57", "fr58", "fr59", "fr60", "fr61", "fr62", "fr63", \ 2992 \ 2993 "fcc0", "fcc1", "fcc2", "fcc3", "icc0", "icc1", "icc2", "icc3", \ 2994 "cc0", "cc1", "cc2", "cc3", "cc4", "cc5", "cc6", "cc7", \ 2995 "acc0", "acc1", "acc2", "acc3", "acc4", "acc5", "acc6", "acc7", \ 2996 "accg0","accg1","accg2","accg3","accg4","accg5","accg6","accg7", \ 2997 "ap", "lr", "lcr" \ 2998 } 2999 3000 /* Define this macro if you are using an unusual assembler that 3001 requires different names for the machine instructions. 3002 3003 The definition is a C statement or statements which output an 3004 assembler instruction opcode to the stdio stream STREAM. The 3005 macro-operand PTR is a variable of type `char *' which points to 3006 the opcode name in its "internal" form--the form that is written 3007 in the machine description. The definition should output the 3008 opcode name to STREAM, performing any translation you desire, and 3009 increment the variable PTR to point at the end of the opcode so 3010 that it will not be output twice. 3011 3012 In fact, your macro definition may process less than the entire 3013 opcode name, or more than the opcode name; but if you want to 3014 process text that includes `%'-sequences to substitute operands, 3015 you must take care of the substitution yourself. Just be sure to 3016 increment PTR over whatever text should not be output normally. 3017 3018 If you need to look at the operand values, they can be found as the 3019 elements of `recog_operand'. 3020 3021 If the macro definition does nothing, the instruction is output in 3022 the usual way. */ 3023 3024 #define ASM_OUTPUT_OPCODE(STREAM, PTR)\ 3025 (PTR) = frv_asm_output_opcode (STREAM, PTR) 3026 3027 /* If defined, a C statement to be executed just prior to the output 3028 of assembler code for INSN, to modify the extracted operands so 3029 they will be output differently. 3030 3031 Here the argument OPVEC is the vector containing the operands 3032 extracted from INSN, and NOPERANDS is the number of elements of 3033 the vector which contain meaningful data for this insn. The 3034 contents of this vector are what will be used to convert the insn 3035 template into assembler code, so you can change the assembler 3036 output by changing the contents of the vector. 3037 3038 This macro is useful when various assembler syntaxes share a single 3039 file of instruction patterns; by defining this macro differently, 3040 you can cause a large class of instructions to be output 3041 differently (such as with rearranged operands). Naturally, 3042 variations in assembler syntax affecting individual insn patterns 3043 ought to be handled by writing conditional output routines in 3044 those patterns. 3045 3046 If this macro is not defined, it is equivalent to a null statement. */ 3047 3048 #define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS)\ 3049 frv_final_prescan_insn (INSN, OPVEC, NOPERANDS) 3050 3051 3052 /* A C compound statement to output to stdio stream STREAM the assembler syntax 3053 for an instruction operand X. X is an RTL expression. 3054 3055 CODE is a value that can be used to specify one of several ways of printing 3056 the operand. It is used when identical operands must be printed differently 3057 depending on the context. CODE comes from the `%' specification that was 3058 used to request printing of the operand. If the specification was just 3059 `%DIGIT' then CODE is 0; if the specification was `%LTR DIGIT' then CODE is 3060 the ASCII code for LTR. 3061 3062 If X is a register, this macro should print the register's name. The names 3063 can be found in an array `reg_names' whose type is `char *[]'. `reg_names' 3064 is initialized from `REGISTER_NAMES'. 3065 3066 When the machine description has a specification `%PUNCT' (a `%' followed by 3067 a punctuation character), this macro is called with a null pointer for X and 3068 the punctuation character for CODE. */ 3069 #define PRINT_OPERAND(STREAM, X, CODE) frv_print_operand (STREAM, X, CODE) 3070 3071 /* A C expression which evaluates to true if CODE is a valid punctuation 3072 character for use in the `PRINT_OPERAND' macro. If 3073 `PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no punctuation 3074 characters (except for the standard one, `%') are used in this way. */ 3075 /* . == gr0 3076 # == hint operand -- always zero for now 3077 @ == small data base register (gr16) 3078 ~ == pic register (gr17) 3079 * == temporary integer CCR register (cr3) 3080 & == temporary integer ICC register (icc3) */ 3081 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \ 3082 ((CODE) == '.' || (CODE) == '#' || (CODE) == SDATA_FLAG_CHAR || (CODE) == '~' \ 3083 || (CODE) == '*' || (CODE) == '&') 3084 3085 /* A C compound statement to output to stdio stream STREAM the assembler syntax 3086 for an instruction operand that is a memory reference whose address is X. X 3087 is an RTL expression. 3088 3089 On some machines, the syntax for a symbolic address depends on the section 3090 that the address refers to. On these machines, define the macro 3091 `ENCODE_SECTION_INFO' to store the information into the `symbol_ref', and 3092 then check for it here. 3093 3094 This declaration must be present. */ 3095 #define PRINT_OPERAND_ADDRESS(STREAM, X) frv_print_operand_address (STREAM, X) 3096 3097 /* If defined, C string expressions to be used for the `%R', `%L', `%U', and 3098 `%I' options of `asm_fprintf' (see `final.c'). These are useful when a 3099 single `md' file must support multiple assembler formats. In that case, the 3100 various `tm.h' files can define these macros differently. 3101 3102 USER_LABEL_PREFIX is defined in svr4.h. */ 3103 #undef USER_LABEL_PREFIX 3104 #define USER_LABEL_PREFIX "" 3105 #define REGISTER_PREFIX "" 3106 #define LOCAL_LABEL_PREFIX "." 3107 #define IMMEDIATE_PREFIX "#" 3108 3109 3110 /* Output of dispatch tables. */ 3111 3112 /* This macro should be provided on machines where the addresses in a dispatch 3113 table are relative to the table's own address. 3114 3115 The definition should be a C statement to output to the stdio stream STREAM 3116 an assembler pseudo-instruction to generate a difference between two labels. 3117 VALUE and REL are the numbers of two internal labels. The definitions of 3118 these labels are output using `ASM_OUTPUT_INTERNAL_LABEL', and they must be 3119 printed in the same way here. For example, 3120 3121 fprintf (STREAM, "\t.word L%d-L%d\n", VALUE, REL) */ 3122 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \ 3123 fprintf (STREAM, "\t.word .L%d-.L%d\n", VALUE, REL) 3124 3125 /* This macro should be provided on machines where the addresses in a dispatch 3126 table are absolute. 3127 3128 The definition should be a C statement to output to the stdio stream STREAM 3129 an assembler pseudo-instruction to generate a reference to a label. VALUE 3130 is the number of an internal label whose definition is output using 3131 `ASM_OUTPUT_INTERNAL_LABEL'. For example, 3132 3133 fprintf (STREAM, "\t.word L%d\n", VALUE) */ 3134 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \ 3135 fprintf (STREAM, "\t.word .L%d\n", VALUE) 3136 3137 /* Define this if the label before a jump-table needs to be output specially. 3138 The first three arguments are the same as for `ASM_OUTPUT_INTERNAL_LABEL'; 3139 the fourth argument is the jump-table which follows (a `jump_insn' 3140 containing an `addr_vec' or `addr_diff_vec'). 3141 3142 This feature is used on system V to output a `swbeg' statement for the 3143 table. 3144 3145 If this macro is not defined, these labels are output with 3146 `ASM_OUTPUT_INTERNAL_LABEL'. 3147 3148 Defined in svr4.h. */ 3149 /* When generating embedded PIC or mips16 code we want to put the jump 3150 table in the .text section. In all other cases, we want to put the 3151 jump table in the .rdata section. Unfortunately, we can't use 3152 JUMP_TABLES_IN_TEXT_SECTION, because it is not conditional. 3153 Instead, we use ASM_OUTPUT_CASE_LABEL to switch back to the .text 3154 section if appropriate. */ 3155 3156 #undef ASM_OUTPUT_CASE_LABEL 3157 #define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \ 3158 do { \ 3159 if (flag_pic) \ 3160 function_section (current_function_decl); \ 3161 ASM_OUTPUT_INTERNAL_LABEL (STREAM, PREFIX, NUM); \ 3162 } while (0) 3163 3164 /* Define this to determine whether case statement labels are relative to 3165 the start of the case statement or not. */ 3166 3167 #define CASE_VECTOR_PC_RELATIVE (flag_pic) 3168 3169 3170 /* Assembler Commands for Exception Regions. */ 3171 3172 /* Define this macro to 0 if your target supports DWARF 2 frame unwind 3173 information, but it does not yet work with exception handling. Otherwise, 3174 if your target supports this information (if it defines 3175 `INCOMING_RETURN_ADDR_RTX' and either `UNALIGNED_INT_ASM_OP' or 3176 `OBJECT_FORMAT_ELF'), GCC will provide a default definition of 1. 3177 3178 If this macro is defined to 1, the DWARF 2 unwinder will be the default 3179 exception handling mechanism; otherwise, setjmp/longjmp will be used by 3180 default. 3181 3182 If this macro is defined to anything, the DWARF 2 unwinder will be used 3183 instead of inline unwinders and __unwind_function in the non-setjmp case. */ 3184 #define DWARF2_UNWIND_INFO 1 3185 3186 #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (LR_REGNO) 3187 3188 /* Assembler Commands for Alignment. */ 3189 3190 /* A C statement to output to the stdio stream STREAM an assembler instruction 3191 to advance the location counter by NBYTES bytes. Those bytes should be zero 3192 when loaded. NBYTES will be a C expression of type `int'. 3193 3194 Defined in svr4.h. */ 3195 #undef ASM_OUTPUT_SKIP 3196 #define ASM_OUTPUT_SKIP(STREAM, NBYTES) \ 3197 fprintf (STREAM, "\t.zero\t%u\n", (NBYTES)) 3198 3199 /* A C statement to output to the stdio stream STREAM an assembler command to 3200 advance the location counter to a multiple of 2 to the POWER bytes. POWER 3201 will be a C expression of type `int'. */ 3202 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \ 3203 fprintf ((STREAM), "\t.p2align %d\n", (POWER)) 3204 3205 3206 /* Macros Affecting all Debug Formats. */ 3207 3208 /* A C expression that returns the DBX register number for the compiler 3209 register number REGNO. In simple cases, the value of this expression may be 3210 REGNO itself. But sometimes there are some registers that the compiler 3211 knows about and DBX does not, or vice versa. In such cases, some register 3212 may need to have one number in the compiler and another for DBX. 3213 3214 If two registers have consecutive numbers inside GNU CC, and they can be 3215 used as a pair to hold a multiword value, then they *must* have consecutive 3216 numbers after renumbering with `DBX_REGISTER_NUMBER'. Otherwise, debuggers 3217 will be unable to access such a pair, because they expect register pairs to 3218 be consecutive in their own numbering scheme. 3219 3220 If you find yourself defining `DBX_REGISTER_NUMBER' in way that does not 3221 preserve register pairs, then what you must do instead is redefine the 3222 actual register numbering scheme. 3223 3224 This declaration is required. */ 3225 #define DBX_REGISTER_NUMBER(REGNO) (REGNO) 3226 3227 /* A C expression that returns the type of debugging output GNU CC produces 3228 when the user specifies `-g' or `-ggdb'. Define this if you have arranged 3229 for GNU CC to support more than one format of debugging output. Currently, 3230 the allowable values are `DBX_DEBUG', `SDB_DEBUG', `DWARF_DEBUG', 3231 `DWARF2_DEBUG', and `XCOFF_DEBUG'. 3232 3233 The value of this macro only affects the default debugging output; the user 3234 can always get a specific type of output by using `-gstabs', `-gcoff', 3235 `-gdwarf-1', `-gdwarf-2', or `-gxcoff'. 3236 3237 Defined in svr4.h. */ 3238 #undef PREFERRED_DEBUGGING_TYPE 3239 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG 3240 3241 /* Miscellaneous Parameters. */ 3242 3243 /* Define this if you have defined special-purpose predicates in the file 3244 `MACHINE.c'. This macro is called within an initializer of an array of 3245 structures. The first field in the structure is the name of a predicate and 3246 the second field is an array of rtl codes. For each predicate, list all rtl 3247 codes that can be in expressions matched by the predicate. The list should 3248 have a trailing comma. Here is an example of two entries in the list for a 3249 typical RISC machine: 3250 3251 #define PREDICATE_CODES \ 3252 {"gen_reg_rtx_operand", {SUBREG, REG}}, \ 3253 {"reg_or_short_cint_operand", {SUBREG, REG, CONST_INT}}, 3254 3255 Defining this macro does not affect the generated code (however, incorrect 3256 definitions that omit an rtl code that may be matched by the predicate can 3257 cause the compiler to malfunction). Instead, it allows the table built by 3258 `genrecog' to be more compact and efficient, thus speeding up the compiler. 3259 The most important predicates to include in the list specified by this macro 3260 are thoses used in the most insn patterns. */ 3261 #define PREDICATE_CODES \ 3262 { "integer_register_operand", { REG, SUBREG }}, \ 3263 { "frv_load_operand", { REG, SUBREG, MEM }}, \ 3264 { "gpr_no_subreg_operand", { REG }}, \ 3265 { "gpr_or_fpr_operand", { REG, SUBREG }}, \ 3266 { "gpr_or_int12_operand", { REG, SUBREG, CONST_INT }}, \ 3267 { "gpr_fpr_or_int12_operand", { REG, SUBREG, CONST_INT }}, \ 3268 { "gpr_or_int10_operand", { REG, SUBREG, CONST_INT }}, \ 3269 { "gpr_or_int_operand", { REG, SUBREG, CONST_INT }}, \ 3270 { "move_source_operand", { REG, SUBREG, CONST_INT, MEM, \ 3271 CONST_DOUBLE, CONST, \ 3272 SYMBOL_REF, LABEL_REF }}, \ 3273 { "move_destination_operand", { REG, SUBREG, MEM }}, \ 3274 { "condexec_source_operand", { REG, SUBREG, CONST_INT, MEM, \ 3275 CONST_DOUBLE }}, \ 3276 { "condexec_dest_operand", { REG, SUBREG, MEM }}, \ 3277 { "reg_or_0_operand", { REG, SUBREG, CONST_INT }}, \ 3278 { "lr_operand", { REG }}, \ 3279 { "gpr_or_memory_operand", { REG, SUBREG, MEM }}, \ 3280 { "fpr_or_memory_operand", { REG, SUBREG, MEM }}, \ 3281 { "int12_operand", { CONST_INT }}, \ 3282 { "int_2word_operand", { CONST_INT, CONST_DOUBLE, \ 3283 SYMBOL_REF, LABEL_REF, CONST }}, \ 3284 { "pic_register_operand", { REG }}, \ 3285 { "pic_symbolic_operand", { SYMBOL_REF, LABEL_REF, CONST }}, \ 3286 { "small_data_register_operand", { REG }}, \ 3287 { "small_data_symbolic_operand", { SYMBOL_REF, CONST }}, \ 3288 { "icc_operand", { REG }}, \ 3289 { "fcc_operand", { REG }}, \ 3290 { "cc_operand", { REG }}, \ 3291 { "icr_operand", { REG }}, \ 3292 { "fcr_operand", { REG }}, \ 3293 { "cr_operand", { REG }}, \ 3294 { "fpr_operand", { REG, SUBREG }}, \ 3295 { "even_reg_operand", { REG, SUBREG }}, \ 3296 { "odd_reg_operand", { REG, SUBREG }}, \ 3297 { "even_gpr_operand", { REG, SUBREG }}, \ 3298 { "odd_gpr_operand", { REG, SUBREG }}, \ 3299 { "quad_fpr_operand", { REG, SUBREG }}, \ 3300 { "even_fpr_operand", { REG, SUBREG }}, \ 3301 { "odd_fpr_operand", { REG, SUBREG }}, \ 3302 { "dbl_memory_one_insn_operand", { MEM }}, \ 3303 { "dbl_memory_two_insn_operand", { MEM }}, \ 3304 { "call_operand", { REG, SUBREG, PLUS, CONST_INT, \ 3305 SYMBOL_REF, LABEL_REF, CONST }}, \ 3306 { "upper_int16_operand", { CONST_INT }}, \ 3307 { "uint16_operand", { CONST_INT }}, \ 3308 { "relational_operator", { EQ, NE, LE, LT, GE, GT, \ 3309 LEU, LTU, GEU, GTU }}, \ 3310 { "signed_relational_operator", { EQ, NE, LE, LT, GE, GT }}, \ 3311 { "unsigned_relational_operator", { LEU, LTU, GEU, GTU }}, \ 3312 { "float_relational_operator", { EQ, NE, LE, LT, GE, GT }}, \ 3313 { "ccr_eqne_operator", { EQ, NE }}, \ 3314 { "minmax_operator", { SMIN, SMAX, UMIN, UMAX }}, \ 3315 { "condexec_si_binary_operator", { PLUS, MINUS, AND, IOR, XOR, \ 3316 ASHIFT, ASHIFTRT, LSHIFTRT }}, \ 3317 { "condexec_si_divide_operator", { DIV, UDIV }}, \ 3318 { "condexec_si_unary_operator", { NOT, NEG }}, \ 3319 { "condexec_sf_binary_operator", { PLUS, MINUS, MULT, DIV }}, \ 3320 { "condexec_sf_unary_operator", { ABS, NEG, SQRT }}, \ 3321 { "intop_compare_operator", { PLUS, MINUS, AND, IOR, XOR, \ 3322 ASHIFT, ASHIFTRT, LSHIFTRT }}, \ 3323 { "condexec_intop_cmp_operator", { PLUS, MINUS, AND, IOR, XOR, \ 3324 ASHIFT, ASHIFTRT, LSHIFTRT }}, \ 3325 { "fpr_or_int6_operand", { REG, SUBREG, CONST_INT }}, \ 3326 { "int6_operand", { CONST_INT }}, \ 3327 { "int5_operand", { CONST_INT }}, \ 3328 { "uint5_operand", { CONST_INT }}, \ 3329 { "uint4_operand", { CONST_INT }}, \ 3330 { "uint1_operand", { CONST_INT }}, \ 3331 { "acc_operand", { REG, SUBREG }}, \ 3332 { "even_acc_operand", { REG, SUBREG }}, \ 3333 { "quad_acc_operand", { REG, SUBREG }}, \ 3334 { "accg_operand", { REG, SUBREG }}, 3335 3336 /* An alias for a machine mode name. This is the machine mode that elements of 3337 a jump-table should have. */ 3338 #define CASE_VECTOR_MODE SImode 3339 3340 /* Define this macro if operations between registers with integral mode smaller 3341 than a word are always performed on the entire register. Most RISC machines 3342 have this property and most CISC machines do not. */ 3343 #define WORD_REGISTER_OPERATIONS 3344 3345 /* Define this macro to be a C expression indicating when insns that read 3346 memory in MODE, an integral mode narrower than a word, set the bits outside 3347 of MODE to be either the sign-extension or the zero-extension of the data 3348 read. Return `SIGN_EXTEND' for values of MODE for which the insn 3349 sign-extends, `ZERO_EXTEND' for which it zero-extends, and `NIL' for other 3350 modes. 3351 3352 This macro is not called with MODE non-integral or with a width greater than 3353 or equal to `BITS_PER_WORD', so you may return any value in this case. Do 3354 not define this macro if it would always return `NIL'. On machines where 3355 this macro is defined, you will normally define it as the constant 3356 `SIGN_EXTEND' or `ZERO_EXTEND'. */ 3357 #define LOAD_EXTEND_OP(MODE) SIGN_EXTEND 3358 3359 /* Define if loading short immediate values into registers sign extends. */ 3360 #define SHORT_IMMEDIATES_SIGN_EXTEND 3361 3362 /* The maximum number of bytes that a single instruction can move quickly from 3363 memory to memory. */ 3364 #define MOVE_MAX 8 3365 3366 /* A C expression which is nonzero if on this machine it is safe to "convert" 3367 an integer of INPREC bits to one of OUTPREC bits (where OUTPREC is smaller 3368 than INPREC) by merely operating on it as if it had only OUTPREC bits. 3369 3370 On many machines, this expression can be 1. 3371 3372 When `TRULY_NOOP_TRUNCATION' returns 1 for a pair of sizes for modes for 3373 which `MODES_TIEABLE_P' is 0, suboptimal code can result. If this is the 3374 case, making `TRULY_NOOP_TRUNCATION' return 0 in such cases may improve 3375 things. */ 3376 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 3377 3378 /* An alias for the machine mode for pointers. On most machines, define this 3379 to be the integer mode corresponding to the width of a hardware pointer; 3380 `SImode' on 32-bit machine or `DImode' on 64-bit machines. On some machines 3381 you must define this to be one of the partial integer modes, such as 3382 `PSImode'. 3383 3384 The width of `Pmode' must be at least as large as the value of 3385 `POINTER_SIZE'. If it is not equal, you must define the macro 3386 `POINTERS_EXTEND_UNSIGNED' to specify how pointers are extended to `Pmode'. */ 3387 #define Pmode SImode 3388 3389 /* An alias for the machine mode used for memory references to functions being 3390 called, in `call' RTL expressions. On most machines this should be 3391 `QImode'. */ 3392 #define FUNCTION_MODE QImode 3393 3394 /* Define this macro to handle System V style pragmas: #pragma pack and 3395 #pragma weak. Note, #pragma weak will only be supported if SUPPORT_WEAK is 3396 defined. 3397 3398 Defined in svr4.h. */ 3399 #define HANDLE_SYSV_PRAGMA 1 3400 3401 /* A C expression for the maximum number of instructions to execute via 3402 conditional execution instructions instead of a branch. A value of 3403 BRANCH_COST+1 is the default if the machine does not use 3404 cc0, and 1 if it does use cc0. */ 3405 #define MAX_CONDITIONAL_EXECUTE frv_condexec_insns 3406 3407 /* Default value of MAX_CONDITIONAL_EXECUTE if no -mcond-exec-insns= */ 3408 #define DEFAULT_CONDEXEC_INSNS 8 3409 3410 /* A C expression to modify the code described by the conditional if 3411 information CE_INFO, possibly updating the tests in TRUE_EXPR, and 3412 FALSE_EXPR for converting if-then and if-then-else code to conditional 3413 instructions. Set either TRUE_EXPR or FALSE_EXPR to a null pointer if the 3414 tests cannot be converted. */ 3415 #define IFCVT_MODIFY_TESTS(CE_INFO, TRUE_EXPR, FALSE_EXPR) \ 3416 frv_ifcvt_modify_tests (CE_INFO, &TRUE_EXPR, &FALSE_EXPR) 3417 3418 /* A C expression to modify the code described by the conditional if 3419 information CE_INFO, for the basic block BB, possibly updating the tests in 3420 TRUE_EXPR, and FALSE_EXPR for converting the && and || parts of if-then or 3421 if-then-else code to conditional instructions. OLD_TRUE and OLD_FALSE are 3422 the previous tests. Set either TRUE_EXPR or FALSE_EXPR to a null pointer if 3423 the tests cannot be converted. */ 3424 #define IFCVT_MODIFY_MULTIPLE_TESTS(CE_INFO, BB, TRUE_EXPR, FALSE_EXPR) \ 3425 frv_ifcvt_modify_multiple_tests (CE_INFO, BB, &TRUE_EXPR, &FALSE_EXPR) 3426 3427 /* A C expression to modify the code described by the conditional if 3428 information CE_INFO with the new PATTERN in INSN. If PATTERN is a null 3429 pointer after the IFCVT_MODIFY_INSN macro executes, it is assumed that that 3430 insn cannot be converted to be executed conditionally. */ 3431 #define IFCVT_MODIFY_INSN(CE_INFO, PATTERN, INSN) \ 3432 (PATTERN) = frv_ifcvt_modify_insn (CE_INFO, PATTERN, INSN) 3433 3434 /* A C expression to perform any final machine dependent modifications in 3435 converting code to conditional execution in the code described by the 3436 conditional if information CE_INFO. */ 3437 #define IFCVT_MODIFY_FINAL(CE_INFO) frv_ifcvt_modify_final (CE_INFO) 3438 3439 /* A C expression to cancel any machine dependent modifications in converting 3440 code to conditional execution in the code described by the conditional if 3441 information CE_INFO. */ 3442 #define IFCVT_MODIFY_CANCEL(CE_INFO) frv_ifcvt_modify_cancel (CE_INFO) 3443 3444 /* Initialize the extra fields provided by IFCVT_EXTRA_FIELDS. */ 3445 #define IFCVT_INIT_EXTRA_FIELDS(CE_INFO) frv_ifcvt_init_extra_fields (CE_INFO) 3446 3447 /* Indicate how many instructions can be issued at the same time. */ 3448 #define ISSUE_RATE \ 3449 (! TARGET_PACK ? 1 \ 3450 : (frv_cpu_type == FRV_CPU_GENERIC \ 3451 || frv_cpu_type == FRV_CPU_FR500 \ 3452 || frv_cpu_type == FRV_CPU_TOMCAT) ? 4 \ 3453 : frv_cpu_type == FRV_CPU_FR400 ? 2 : 1) 3454 3455 /* Set and clear whether this insn begins a VLIW insn. */ 3456 #define CLEAR_VLIW_START(INSN) PUT_MODE (INSN, VOIDmode) 3457 #define SET_VLIW_START(INSN) PUT_MODE (INSN, TImode) 3458 3459 /* The definition of the following macro results in that the 2nd jump 3460 optimization (after the 2nd insn scheduling) is minimal. It is 3461 necessary to define when start cycle marks of insns (TImode is used 3462 for this) is used for VLIW insn packing. Some jump optimizations 3463 make such marks invalid. These marks are corrected for some 3464 (minimal) optimizations. ??? Probably the macro is temporary. 3465 Final solution could making the 2nd jump optimizations before the 3466 2nd instruction scheduling or corrections of the marks for all jump 3467 optimizations. Although some jump optimizations are actually 3468 deoptimizations for VLIW (super-scalar) processors. */ 3469 3470 #define MINIMAL_SECOND_JUMP_OPTIMIZATION 3471 3472 /* Return true if parallel operations are expected to be emitted via the 3473 packing flag. */ 3474 #define PACKING_FLAG_USED_P() \ 3475 (optimize && flag_schedule_insns_after_reload && ISSUE_RATE > 1) 3476 3477 /* If the following macro is defined and nonzero and deterministic 3478 finite state automata are used for pipeline hazard recognition, the 3479 code making resource-constrained software pipelining is on. */ 3480 #define RCSP_SOFTWARE_PIPELINING 1 3481 3482 /* If the following macro is defined and nonzero and deterministic 3483 finite state automata are used for pipeline hazard recognition, we 3484 will try to exchange insns in queue ready to improve the schedule. 3485 The more macro value, the more tries will be made. */ 3486 #define FIRST_CYCLE_MULTIPASS_SCHEDULING 1 3487 3488 /* The following macro is used only when value of 3489 FIRST_CYCLE_MULTIPASS_SCHEDULING is nonzero. The more macro value, 3490 the more tries will be made to choose better schedule. If the 3491 macro value is zero or negative there will be no multi-pass 3492 scheduling. */ 3493 #define FIRST_CYCLE_MULTIPASS_SCHEDULING_LOOKAHEAD frv_sched_lookahead 3494 3495 /* Return true if a function is ok to be called as a sibcall. */ 3496 #define FUNCTION_OK_FOR_SIBCALL(DECL) 0 3497 3498 enum frv_builtins 3499 { 3500 FRV_BUILTIN_MAND, 3501 FRV_BUILTIN_MOR, 3502 FRV_BUILTIN_MXOR, 3503 FRV_BUILTIN_MNOT, 3504 FRV_BUILTIN_MAVEH, 3505 FRV_BUILTIN_MSATHS, 3506 FRV_BUILTIN_MSATHU, 3507 FRV_BUILTIN_MADDHSS, 3508 FRV_BUILTIN_MADDHUS, 3509 FRV_BUILTIN_MSUBHSS, 3510 FRV_BUILTIN_MSUBHUS, 3511 FRV_BUILTIN_MPACKH, 3512 FRV_BUILTIN_MQADDHSS, 3513 FRV_BUILTIN_MQADDHUS, 3514 FRV_BUILTIN_MQSUBHSS, 3515 FRV_BUILTIN_MQSUBHUS, 3516 FRV_BUILTIN_MUNPACKH, 3517 FRV_BUILTIN_MDPACKH, 3518 FRV_BUILTIN_MBTOH, 3519 FRV_BUILTIN_MHTOB, 3520 FRV_BUILTIN_MCOP1, 3521 FRV_BUILTIN_MCOP2, 3522 FRV_BUILTIN_MROTLI, 3523 FRV_BUILTIN_MROTRI, 3524 FRV_BUILTIN_MWCUT, 3525 FRV_BUILTIN_MSLLHI, 3526 FRV_BUILTIN_MSRLHI, 3527 FRV_BUILTIN_MSRAHI, 3528 FRV_BUILTIN_MEXPDHW, 3529 FRV_BUILTIN_MEXPDHD, 3530 FRV_BUILTIN_MMULHS, 3531 FRV_BUILTIN_MMULHU, 3532 FRV_BUILTIN_MMULXHS, 3533 FRV_BUILTIN_MMULXHU, 3534 FRV_BUILTIN_MMACHS, 3535 FRV_BUILTIN_MMACHU, 3536 FRV_BUILTIN_MMRDHS, 3537 FRV_BUILTIN_MMRDHU, 3538 FRV_BUILTIN_MQMULHS, 3539 FRV_BUILTIN_MQMULHU, 3540 FRV_BUILTIN_MQMULXHU, 3541 FRV_BUILTIN_MQMULXHS, 3542 FRV_BUILTIN_MQMACHS, 3543 FRV_BUILTIN_MQMACHU, 3544 FRV_BUILTIN_MCPXRS, 3545 FRV_BUILTIN_MCPXRU, 3546 FRV_BUILTIN_MCPXIS, 3547 FRV_BUILTIN_MCPXIU, 3548 FRV_BUILTIN_MQCPXRS, 3549 FRV_BUILTIN_MQCPXRU, 3550 FRV_BUILTIN_MQCPXIS, 3551 FRV_BUILTIN_MQCPXIU, 3552 FRV_BUILTIN_MCUT, 3553 FRV_BUILTIN_MCUTSS, 3554 FRV_BUILTIN_MWTACC, 3555 FRV_BUILTIN_MWTACCG, 3556 FRV_BUILTIN_MRDACC, 3557 FRV_BUILTIN_MRDACCG, 3558 FRV_BUILTIN_MTRAP, 3559 FRV_BUILTIN_MCLRACC, 3560 FRV_BUILTIN_MCLRACCA, 3561 FRV_BUILTIN_MDUNPACKH, 3562 FRV_BUILTIN_MBTOHE, 3563 FRV_BUILTIN_MQXMACHS, 3564 FRV_BUILTIN_MQXMACXHS, 3565 FRV_BUILTIN_MQMACXHS, 3566 FRV_BUILTIN_MADDACCS, 3567 FRV_BUILTIN_MSUBACCS, 3568 FRV_BUILTIN_MASACCS, 3569 FRV_BUILTIN_MDADDACCS, 3570 FRV_BUILTIN_MDSUBACCS, 3571 FRV_BUILTIN_MDASACCS, 3572 FRV_BUILTIN_MABSHS, 3573 FRV_BUILTIN_MDROTLI, 3574 FRV_BUILTIN_MCPLHI, 3575 FRV_BUILTIN_MCPLI, 3576 FRV_BUILTIN_MDCUTSSI, 3577 FRV_BUILTIN_MQSATHS, 3578 FRV_BUILTIN_MHSETLOS, 3579 FRV_BUILTIN_MHSETLOH, 3580 FRV_BUILTIN_MHSETHIS, 3581 FRV_BUILTIN_MHSETHIH, 3582 FRV_BUILTIN_MHDSETS, 3583 FRV_BUILTIN_MHDSETH 3584 }; 3585 3586 /* Enable prototypes on the call rtl functions. */ 3587 #define MD_CALL_PROTOTYPES 1 3588 3589 extern GTY(()) rtx frv_compare_op0; /* operand save for */ 3590 extern GTY(()) rtx frv_compare_op1; /* comparison generation */ 3591 3592 #endif /* __FRV_H__ */ 3593