1 /* Definitions of target machine for GNU compiler, 2 For Ubicom IP2022 Communications Controller 3 4 Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. 5 Contributed by Red Hat, Inc and Ubicom, Inc. 6 7 This file is part of GNU CC. 8 9 GNU CC is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 2, or (at your option) 12 any later version. 13 14 GNU CC is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with GNU CC; see the file COPYING. If not, write to 21 the Free Software Foundation, 59 Temple Place - Suite 330, 22 Boston, MA 02111-1307, USA. */ 23 24 25 /* Set up System V.4 (aka ELF) defaults. */ 26 27 #include "elfos.h" 28 #undef ASM_SPEC /* But we have a GAS assembler. */ 29 30 #define CPP_PREDEFINES \ 31 "-DIP2K -D_DOUBLE_IS_32BITS -D__BUFSIZ__=512 -D__FILENAME_MAX__=128" 32 /* Define this to be a string constant containing `-D' options to 33 define the predefined macros that identify this machine and system. 34 These macros will be predefined unless the `-ansi' option is 35 specified. 36 37 In addition, a parallel set of macros are predefined, whose names 38 are made by appending `__' at the beginning and at the end. These 39 `__' macros are permitted by the ANSI standard, so they are 40 predefined regardless of whether `-ansi' is specified. 41 42 For example, on the Sun, one can use the following value: 43 44 "-Dmc68000 -Dsun -Dunix" 45 46 The result is to define the macros `__mc68000__', `__sun__' and 47 `__unix__' unconditionally, and the macros `mc68000', `sun' and 48 `unix' provided `-ansi' is not specified. */ 49 50 51 /* This declaration should be present. */ 52 extern int target_flags; 53 54 /* `TARGET_...' 55 This series of macros is to allow compiler command arguments to 56 enable or disable the use of optional features of the target 57 machine. For example, one machine description serves both the 58 68000 and the 68020; a command argument tells the compiler whether 59 it should use 68020-only instructions or not. This command 60 argument works by means of a macro `TARGET_68020' that tests a bit 61 in `target_flags'. 62 63 Define a macro `TARGET_FEATURENAME' for each such option. Its 64 definition should test a bit in `target_flags'; for example: 65 66 #define TARGET_68020 (target_flags & 1) 67 68 One place where these macros are used is in the 69 condition-expressions of instruction patterns. Note how 70 `TARGET_68020' appears frequently in the 68000 machine description 71 file, `m68k.md'. Another place they are used is in the 72 definitions of the other macros in the `MACHINE.h' file. */ 73 74 75 76 #define TARGET_SWITCHES {{"",0, NULL}} 77 /* This macro defines names of command options to set and clear bits 78 in `target_flags'. Its definition is an initializer with a 79 subgrouping for each command option. 80 81 Each subgrouping contains a string constant, that defines the 82 option name, and a number, which contains the bits to set in 83 `target_flags'. A negative number says to clear bits instead; the 84 negative of the number is which bits to clear. The actual option 85 name is made by appending `-m' to the specified name. 86 87 One of the subgroupings should have a null string. The number in 88 this grouping is the default value for `target_flags'. Any target 89 options act starting with that value. 90 91 Here is an example which defines `-m68000' and `-m68020' with 92 opposite meanings, and picks the latter as the default: 93 94 #define TARGET_SWITCHES \ 95 { { "68020", 1}, \ 96 { "68000", -1}, \ 97 { "", 1}} */ 98 99 100 /* This macro is similar to `TARGET_SWITCHES' but defines names of 101 command options that have values. Its definition is an 102 initializer with a subgrouping for each command option. 103 104 Each subgrouping contains a string constant, that defines the 105 fixed part of the option name, and the address of a variable. The 106 variable, type `char *', is set to the variable part of the given 107 option if the fixed part matches. The actual option name is made 108 by appending `-m' to the specified name. 109 110 Here is an example which defines `-mshort-data-NUMBER'. If the 111 given option is `-mshort-data-512', the variable `m88k_short_data' 112 will be set to the string `"512"'. 113 114 extern char *m88k_short_data; 115 #define TARGET_OPTIONS \ 116 { { "short-data-", &m88k_short_data } } */ 117 118 #define TARGET_VERSION fprintf (stderr, " (ip2k, GNU assembler syntax)") 119 /* This macro is a C statement to print on `stderr' a string 120 describing the particular machine description choice. Every 121 machine description should define `TARGET_VERSION'. For example: 122 123 #ifdef MOTOROLA 124 #define TARGET_VERSION \ 125 fprintf (stderr, " (68k, Motorola syntax)") 126 #else 127 #define TARGET_VERSION \ 128 fprintf (stderr, " (68k, MIT syntax)") 129 #endif */ 130 131 /* Caller-saves is not a win for the IP2K. Pretty much anywhere that 132 a register is permitted allows SP-relative addresses too. 133 134 This machine doesn't have PIC addressing modes, so disable that also. */ 135 136 #define OVERRIDE_OPTIONS \ 137 do { \ 138 flag_caller_saves = 0; \ 139 flag_pic = 0; \ 140 } while (0) 141 142 /* `OVERRIDE_OPTIONS' 143 Sometimes certain combinations of command options do not make 144 sense on a particular target machine. You can define a macro 145 `OVERRIDE_OPTIONS' to take account of this. This macro, if 146 defined, is executed once just after all the command options have 147 been parsed. 148 149 Don't use this macro to turn on various extra optimizations for 150 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */ 151 152 /* Put each function in its own section so that PAGE-instruction 153 relaxation can do its best. */ 154 #define OPTIMIZATION_OPTIONS(LEVEL, SIZEFLAG) \ 155 do { \ 156 if ((LEVEL) || (SIZEFLAG)) \ 157 flag_function_sections = 1; \ 158 } while (0) 159 160 /* Define this if most significant byte of a word is the lowest numbered. */ 161 #define BITS_BIG_ENDIAN 0 162 163 /* Define this if most significant byte of a word is the lowest numbered. */ 164 #define BYTES_BIG_ENDIAN 1 165 166 /* Define this if most significant word of a multiword number is the lowest 167 numbered. */ 168 #define WORDS_BIG_ENDIAN 1 169 170 /* Number of bits in an addressable storage unit. */ 171 #define BITS_PER_UNIT 8 172 173 /* Width in bits of a "word", which is the contents of a machine register. 174 Note that this is not necessarily the width of data type `int'; */ 175 #define BITS_PER_WORD 8 176 177 /* Width of a word, in units (bytes). */ 178 #define UNITS_PER_WORD (BITS_PER_WORD / BITS_PER_UNIT) 179 180 /* Width in bits of a pointer. 181 See also the macro `Pmode' defined below. */ 182 #define POINTER_SIZE 16 183 184 /* Maximum sized of reasonable data type DImode or Dfmode ... */ 185 #define MAX_FIXED_MODE_SIZE 64 186 187 /* Allocation boundary (in *bits*) for storing arguments in argument list. */ 188 #define PARM_BOUNDARY 8 189 190 /* Allocation boundary (in *bits*) for the code of a function. */ 191 #define FUNCTION_BOUNDARY 16 192 193 /* Alignment of field after `int : 0' in a structure. */ 194 #define EMPTY_FIELD_BOUNDARY 8 195 196 /* No data type wants to be aligned rounder than this. */ 197 198 #define BIGGEST_ALIGNMENT 8 199 200 #define STRICT_ALIGNMENT 0 201 202 #define PCC_BITFIELD_TYPE_MATTERS 1 203 204 /* A C expression for the size in bits of the type `int' on the 205 target machine. If you don't define this, the default is one word. */ 206 #undef INT_TYPE_SIZE 207 #define INT_TYPE_SIZE 16 208 209 210 /* A C expression for the size in bits of the type `short' on the 211 target machine. If you don't define this, the default is half a 212 word. (If this would be less than one storage unit, it is rounded 213 up to one unit.) */ 214 #undef SHORT_TYPE_SIZE 215 #define SHORT_TYPE_SIZE 16 216 217 /* A C expression for the size in bits of the type `long' on the 218 target machine. If you don't define this, the default is one word. */ 219 #undef LONG_TYPE_SIZE 220 #define LONG_TYPE_SIZE 32 221 222 223 /* Maximum number for the size in bits of the type `long' on the 224 target machine. If this is undefined, the default is 225 `LONG_TYPE_SIZE'. Otherwise, it is the constant value that is the 226 largest value that `LONG_TYPE_SIZE' can have at run-time. This is 227 used in `cpp'. */ 228 #define MAX_LONG_TYPE_SIZE 32 229 230 /* A C expression for the size in bits of the type `long long' on the 231 target machine. If you don't define this, the default is two 232 words. If you want to support GNU Ada on your machine, the value 233 of macro must be at least 64. */ 234 #undef LONG_LONG_TYPE_SIZE 235 #define LONG_LONG_TYPE_SIZE 64 236 237 #undef CHAR_TYPE_SIZE 238 #define CHAR_TYPE_SIZE 8 239 /* A C expression for the size in bits of the type `char' on the 240 target machine. If you don't define this, the default is one 241 quarter of a word. (If this would be less than one storage unit, 242 it is rounded up to one unit.) */ 243 244 #undef FLOAT_TYPE_SIZE 245 #define FLOAT_TYPE_SIZE 32 246 /* A C expression for the size in bits of the type `float' on the 247 target machine. If you don't define this, the default is one word. */ 248 249 #undef DOUBLE_TYPE_SIZE 250 #define DOUBLE_TYPE_SIZE 32 251 /* A C expression for the size in bits of the type `double' on the 252 target machine. If you don't define this, the default is two 253 words. */ 254 255 256 /* A C expression for the size in bits of the type `long double' on 257 the target machine. If you don't define this, the default is two 258 words. */ 259 #undef LONG_DOUBLE_TYPE_SIZE 260 #define LONG_DOUBLE_TYPE_SIZE 32 261 262 #define DEFAULT_SIGNED_CHAR 1 263 /* An expression whose value is 1 or 0, according to whether the type 264 `char' should be signed or unsigned by default. The user can 265 always override this default with the options `-fsigned-char' and 266 `-funsigned-char'. */ 267 268 /* #define DEFAULT_SHORT_ENUMS 1 269 This was the default for the IP2k but gcc has a bug (as of 17th May 270 2001) in the way that library calls to the memory checker functions 271 are issues that screws things up if an enum is not equivalent to 272 an int. */ 273 /* `DEFAULT_SHORT_ENUMS' 274 A C expression to determine whether to give an `enum' type only as 275 many bytes as it takes to represent the range of possible values 276 of that type. A nonzero value means to do that; a zero value 277 means all `enum' types should be allocated like `int'. 278 279 If you don't define the macro, the default is 0. */ 280 281 #define SIZE_TYPE "unsigned int" 282 /* A C expression for a string describing the name of the data type 283 to use for size values. The typedef name `size_t' is defined 284 using the contents of the string. 285 286 The string can contain more than one keyword. If so, separate 287 them with spaces, and write first any length keyword, then 288 `unsigned' if appropriate, and finally `int'. The string must 289 exactly match one of the data type names defined in the function 290 `init_decl_processing' in the file `c-decl.c'. You may not omit 291 `int' or change the order--that would cause the compiler to crash 292 on startup. 293 294 If you don't define this macro, the default is `"long unsigned 295 int"'. */ 296 297 #define PTRDIFF_TYPE "int" 298 /* A C expression for a string describing the name of the data type 299 to use for the result of subtracting two pointers. The typedef 300 name `ptrdiff_t' is defined using the contents of the string. See 301 `SIZE_TYPE' above for more information. 302 303 If you don't define this macro, the default is `"long int"'. */ 304 305 #undef WCHAR_TYPE 306 #define WCHAR_TYPE "int" 307 #undef WCHAR_TYPE_SIZE 308 #define WCHAR_TYPE_SIZE 16 309 /* A C expression for the size in bits of the data type for wide 310 characters. This is used in `cpp', which cannot make use of 311 `WCHAR_TYPE'. */ 312 313 #define HARD_REG_SIZE (UNITS_PER_WORD) 314 /* Standard register usage. 315 316 for the IP2K, we are going to have a LOT of registers, but only some of them 317 are named. */ 318 319 #define FIRST_PSEUDO_REGISTER (0x104) /* Skip over physical regs, VFP, AP. */ 320 321 /* Number of hardware registers known to the compiler. They receive 322 numbers 0 through `FIRST_PSEUDO_REGISTER-1'; thus, the first 323 pseudo register's number really is assigned the number 324 `FIRST_PSEUDO_REGISTER'. */ 325 326 #define REG_IP 0x4 327 #define REG_IPH REG_IP 328 #define REG_IPL 0x5 329 330 #define REG_SP 0x6 331 #define REG_SPH REG_SP 332 #define REG_SPL 0x7 333 334 #define REG_PCH 0x8 335 #define REG_PCL 0x9 336 337 #define REG_W 0xa 338 #define REG_STATUS 0xb 339 340 #define REG_DP 0xc 341 #define REG_DPH REG_DP 342 #define REG_DPL 0xd 343 344 #define REG_MULH 0xf 345 346 #define REG_CALLH 0x7e /* Call-stack readout. */ 347 #define REG_CALLL 0x7f 348 349 350 #define REG_RESULT 0x80 /* Result register (upto 8 bytes). */ 351 #define REG_FP 0xfd /* 2 bytes for FRAME chain */ 352 353 #define REG_ZERO 0xff /* Initialized to zero by runtime. */ 354 355 #define REG_VFP 0x100 /* Virtual frame pointer. */ 356 #define REG_AP 0x102 /* Virtual arg pointer. */ 357 358 /* Status register bits. */ 359 #define Z_FLAG 0x2 360 #define DC_FLAG 0x1 361 #define C_FLAG 0x0 362 363 #define FIXED_REGISTERS {\ 364 1,1,1,1,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r0.. r31*/\ 365 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r32.. r63*/\ 366 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r64.. r95*/\ 367 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r96..r127*/\ 368 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,/*r128..r159*/\ 369 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/*r160..r191*/\ 370 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/*r192..r223*/\ 371 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/*r224..r255*/\ 372 1,1,1,1} 373 374 /* An initializer that says which registers are used for fixed 375 purposes all throughout the compiled code and are therefore not 376 available for general allocation. These would include the stack 377 pointer, the frame pointer (except on machines where that can be 378 used as a general register when no frame pointer is needed), the 379 program counter on machines where that is considered one of the 380 addressable registers, and any other numbered register with a 381 standard use. 382 383 This information is expressed as a sequence of numbers, separated 384 by commas and surrounded by braces. The Nth number is 1 if 385 register N is fixed, 0 otherwise. 386 387 The table initialized from this macro, and the table initialized by 388 the following one, may be overridden at run time either 389 automatically, by the actions of the macro 390 `CONDITIONAL_REGISTER_USAGE', or by the user with the command 391 options `-ffixed-REG', `-fcall-used-REG' and `-fcall-saved-REG'. */ 392 393 #define CALL_USED_REGISTERS { \ 394 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r0.. r31*/\ 395 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r32.. r63*/\ 396 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r64.. r95*/\ 397 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/* r96..r127*/\ 398 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/*r128..r159*/\ 399 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/*r160..r191*/\ 400 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/*r192..r223*/\ 401 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,/*r224..r255*/\ 402 1,1,1,1} 403 404 /* Like `FIXED_REGISTERS' but has 1 for each register that is 405 clobbered (in general) by function calls as well as for fixed 406 registers. This macro therefore identifies the registers that are 407 not available for general allocation of values that must live 408 across function calls. 409 410 If a register has 0 in `CALL_USED_REGISTERS', the compiler 411 automatically saves it on function entry and restores it on 412 function exit, if the register is used within the function. */ 413 414 #define NON_SAVING_SETJMP 0 415 /* If this macro is defined and has a nonzero value, it means that 416 `setjmp' and related functions fail to save the registers, or that 417 `longjmp' fails to restore them. To compensate, the compiler 418 avoids putting variables in registers in functions that use 419 `setjmp'. */ 420 421 #define REG_ALLOC_ORDER { \ 422 0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f, \ 423 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97, \ 424 0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f, \ 425 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, \ 426 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7, \ 427 0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf, \ 428 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7, \ 429 0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf, \ 430 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7, \ 431 0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf, \ 432 0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7, \ 433 0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf, \ 434 0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7, \ 435 0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef, \ 436 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7, \ 437 0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff, \ 438 0x00,0x01,0x02,0x03,0x0c,0x0d,0x06,0x07, \ 439 0x08,0x09,0x0a,0x0b,0x04,0x05,0x0e,0x0f, \ 440 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, \ 441 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, \ 442 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27, \ 443 0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, \ 444 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37, \ 445 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, \ 446 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47, \ 447 0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, \ 448 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57, \ 449 0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f, \ 450 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67, \ 451 0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, \ 452 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77, \ 453 0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f, \ 454 0x100,0x101,0x102,0x103} 455 456 /* If defined, an initializer for a vector of integers, containing the 457 numbers of hard registers in the order in which GNU CC should 458 prefer to use them (from most preferred to least). 459 460 If this macro is not defined, registers are used lowest numbered 461 first (all else being equal). 462 463 One use of this macro is on machines where the highest numbered 464 registers must always be saved and the save-multiple-registers 465 instruction supports only sequences of consecutive registers. On 466 such machines, define `REG_ALLOC_ORDER' to be an initializer that 467 lists the highest numbered allocatable register first. */ 468 469 #define ORDER_REGS_FOR_LOCAL_ALLOC ip2k_init_local_alloc (reg_alloc_order) 470 /* A C statement (sans semicolon) to choose the order in which to 471 allocate hard registers for pseudo-registers local to a basic 472 block. 473 474 Store the desired register order in the array `reg_alloc_order'. 475 Element 0 should be the register to allocate first; element 1, the 476 next register; and so on. 477 478 The macro body should not assume anything about the contents of 479 `reg_alloc_order' before execution of the macro. 480 481 On most machines, it is not necessary to define this macro. */ 482 483 /* Are we allowed to rename registers? For some reason, regrename was 484 changing DP to IP (when it appeared in addresses like (plus:HI 485 (reg: DP) (const_int 37)) - and that's bad because IP doesn't 486 permit offsets! */ 487 488 #define HARD_REGNO_RENAME_OK(REG, NREG) \ 489 (((REG) == REG_DPH) ? 0 \ 490 : ((REG) == REG_IPH) ? ((NREG) == REG_DPH) \ 491 : (((NREG) == REG_IPL) || ((NREG) == REG_DPL)) ? 0 : 1) 492 493 #define HARD_REGNO_NREGS(REGNO, MODE) \ 494 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) 495 496 /* A C expression for the number of consecutive hard registers, 497 starting at register number REGNO, required to hold a value of mode 498 MODE. 499 500 On a machine where all registers are exactly one word, a suitable 501 definition of this macro is 502 503 #define HARD_REGNO_NREGS(REGNO, MODE) \ 504 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \ 505 / UNITS_PER_WORD)) */ 506 507 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1 508 /* A C expression that is nonzero if it is permissible to store a 509 value of mode MODE in hard register number REGNO (or in several 510 registers starting with that one). For a machine where all 511 registers are equivalent, a suitable definition is 512 513 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1 514 515 It is not necessary for this macro to check for the numbers of 516 fixed registers, because the allocation mechanism considers them 517 to be always occupied. 518 519 On some machines, double-precision values must be kept in even/odd 520 register pairs. The way to implement that is to define this macro 521 to reject odd register numbers for such modes. 522 523 The minimum requirement for a mode to be OK in a register is that 524 the `movMODE' instruction pattern support moves between the 525 register and any other hard register for which the mode is OK; and 526 that moving a value into the register and back out not alter it. 527 528 Since the same instruction used to move `SImode' will work for all 529 narrower integer modes, it is not necessary on any machine for 530 `HARD_REGNO_MODE_OK' to distinguish between these modes, provided 531 you define patterns `movhi', etc., to take advantage of this. This 532 is useful because of the interaction between `HARD_REGNO_MODE_OK' 533 and `MODES_TIEABLE_P'; it is very desirable for all integer modes 534 to be tieable. 535 536 Many machines have special registers for floating point arithmetic. 537 Often people assume that floating point machine modes are allowed 538 only in floating point registers. This is not true. Any 539 registers that can hold integers can safely *hold* a floating 540 point machine mode, whether or not floating arithmetic can be done 541 on it in those registers. Integer move instructions can be used 542 to move the values. 543 544 On some machines, though, the converse is true: fixed-point machine 545 modes may not go in floating registers. This is true if the 546 floating registers normalize any value stored in them, because 547 storing a non-floating value there would garble it. In this case, 548 `HARD_REGNO_MODE_OK' should reject fixed-point machine modes in 549 floating registers. But if the floating registers do not 550 automatically normalize, if you can store any bit pattern in one 551 and retrieve it unchanged without a trap, then any machine mode 552 may go in a floating register, so you can define this macro to say 553 so. 554 555 The primary significance of special floating registers is rather 556 that they are the registers acceptable in floating point arithmetic 557 instructions. However, this is of no concern to 558 `HARD_REGNO_MODE_OK'. You handle it by writing the proper 559 constraints for those instructions. 560 561 On some machines, the floating registers are especially slow to 562 access, so that it is better to store a value in a stack frame 563 than in such a register if floating point arithmetic is not being 564 done. As long as the floating registers are not in class 565 `GENERAL_REGS', they will not be used unless some pattern's 566 constraint asks for one. */ 567 568 #define MODES_TIEABLE_P(MODE1, MODE2) \ 569 (((MODE1) == QImode && (MODE2) == HImode) \ 570 || ((MODE2) == QImode && (MODE1) == HImode)) 571 /* We originally had this as follows - this isn't a win on the IP2k 572 though as registers just get in our way! 573 574 #define MODES_TIEABLE_P(MODE1, MODE2) \ 575 (((MODE1) > HImode && (MODE2) == HImode) 576 || ((MODE1) == HImode && (MODE2) > HImode)) */ 577 578 /* A C expression that is nonzero if it is desirable to choose 579 register allocation so as to avoid move instructions between a 580 value of mode MODE1 and a value of mode MODE2. 581 582 If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R, 583 MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1, 584 MODE2)' must be zero. */ 585 586 enum reg_class { 587 NO_REGS, 588 DPH_REGS, 589 DPL_REGS, 590 DP_REGS, 591 SP_REGS, 592 IPH_REGS, 593 IPL_REGS, 594 IP_REGS, 595 DP_SP_REGS, 596 PTR_REGS, 597 NONPTR_REGS, 598 NONSP_REGS, 599 GENERAL_REGS, 600 ALL_REGS = GENERAL_REGS, 601 LIM_REG_CLASSES 602 }; 603 604 /* An enumeral type that must be defined with all the register class 605 names as enumeral values. `NO_REGS' must be first. `ALL_REGS' 606 must be the last register class, followed by one more enumeral 607 value, `LIM_REG_CLASSES', which is not a register class but rather 608 tells how many classes there are. 609 610 Each register class has a number, which is the value of casting 611 the class name to type `int'. The number serves as an index in 612 many of the tables described below. */ 613 614 615 #define N_REG_CLASSES (int)LIM_REG_CLASSES 616 /* The number of distinct register classes, defined as follows: 617 618 #define N_REG_CLASSES (int) LIM_REG_CLASSES */ 619 620 #define REG_CLASS_NAMES { \ 621 "NO_REGS", \ 622 "DPH_REGS", \ 623 "DPL_REGS", \ 624 "DP_REGS", \ 625 "SP_REGS", \ 626 "IPH_REGS", \ 627 "IPL_REGS", \ 628 "IP_REGS", \ 629 "DP_SP_REGS", \ 630 "PTR_REGS", \ 631 "NONPTR_REGS", \ 632 "NONSP_REGS", \ 633 "GENERAL_REGS" \ 634 } 635 /* An initializer containing the names of the register classes as C 636 string constants. These names are used in writing some of the 637 debugging dumps. */ 638 639 640 #define REG_CLASS_CONTENTS { \ 641 {0x00000000, 0, 0, 0, 0, 0, 0, 0, 0}, /* NO_REGS */ \ 642 {0x00001000, 0, 0, 0, 0, 0, 0, 0, 0}, /* DPH_REGS */ \ 643 {0x00002000, 0, 0, 0, 0, 0, 0, 0, 0}, /* DPL_REGS */ \ 644 {0x00003000, 0, 0, 0, 0, 0, 0, 0, 0}, /* DP_REGS */ \ 645 {0x000000c0, 0, 0, 0, 0, 0, 0, 0, 0}, /* SP_REGS */ \ 646 {0x00000010, 0, 0, 0, 0, 0, 0, 0, 0}, /* IPH_REGS */ \ 647 {0x00000020, 0, 0, 0, 0, 0, 0, 0, 0}, /* IPL_REGS */ \ 648 {0x00000030, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP_REGS */ \ 649 {0x000030c0, 0, 0, 0, 0, 0, 0, 0, 0}, /* DP_SP_REGS */ \ 650 {0x000030f0, 0, 0, 0, 0, 0, 0, 0, 0}, /* PTR_REGS */ \ 651 {0xffffcf0f,-1,-1,-1,-1,-1,-1,-1, 0}, /* NONPTR_REGS */ \ 652 {0xffffff3f,-1,-1,-1,-1,-1,-1,-1, 0}, /* NONSP_REGS */ \ 653 {0xffffffff,-1,-1,-1,-1,-1,-1,-1,15} /* GENERAL_REGS */ \ 654 } 655 656 /* An initializer containing the contents of the register classes, as 657 integers which are bit masks. The Nth integer specifies the 658 contents of class N. The way the integer MASK is interpreted is 659 that register R is in the class if `MASK & (1 << R)' is 1. 660 661 When the machine has more than 32 registers, an integer does not 662 suffice. Then the integers are replaced by sub-initializers, 663 braced groupings containing several integers. Each 664 sub-initializer must be suitable as an initializer for the type 665 `HARD_REG_SET' which is defined in `hard-reg-set.h'. */ 666 667 #define REGNO_REG_CLASS(R) \ 668 ( (R) == REG_IPH ? IPH_REGS \ 669 : (R) == REG_IPL ? IPL_REGS \ 670 : (R) == REG_DPH ? DPH_REGS \ 671 : (R) == REG_DPL ? DPL_REGS \ 672 : (R) == REG_SPH ? SP_REGS \ 673 : (R) == REG_SPL ? SP_REGS \ 674 : NONPTR_REGS) 675 676 /* A C expression whose value is a register class containing hard 677 register REGNO. In general there is more than one such class; 678 choose a class which is "minimal", meaning that no smaller class 679 also contains the register. */ 680 681 #define MODE_BASE_REG_CLASS(MODE) ((MODE) == QImode ? PTR_REGS : DP_SP_REGS) 682 /* This is a variation of the BASE_REG_CLASS macro which allows 683 the selection of a base register in a mode depenedent manner. 684 If MODE is VOIDmode then it should return the same value as 685 BASE_REG_CLASS. */ 686 687 #define BASE_REG_CLASS PTR_REGS 688 /* A macro whose definition is the name of the class to which a valid 689 base register must belong. A base register is one used in an 690 address which is the register value plus a displacement. */ 691 692 #define INDEX_REG_CLASS NO_REGS 693 /* A macro whose definition is the name of the class to which a valid 694 index register must belong. An index register is one used in an 695 address where its value is either multiplied by a scale factor or 696 added to another register (as well as added to a displacement). */ 697 698 699 #define REG_CLASS_FROM_LETTER(C) \ 700 ( (C) == 'j' ? IPH_REGS \ 701 : (C) == 'k' ? IPL_REGS \ 702 : (C) == 'f' ? IP_REGS \ 703 : (C) == 'y' ? DPH_REGS \ 704 : (C) == 'z' ? DPL_REGS \ 705 : (C) == 'b' ? DP_REGS \ 706 : (C) == 'u' ? NONSP_REGS \ 707 : (C) == 'q' ? SP_REGS \ 708 : (C) == 'c' ? DP_SP_REGS \ 709 : (C) == 'a' ? PTR_REGS \ 710 : (C) == 'd' ? NONPTR_REGS \ 711 : NO_REGS) 712 713 /* A C expression which defines the machine-dependent operand 714 constraint letters for register classes. If CHAR is such a 715 letter, the value should be the register class corresponding to 716 it. Otherwise, the value should be `NO_REGS'. The register 717 letter `r', corresponding to class `GENERAL_REGS', will not be 718 passed to this macro; you do not need to handle it. */ 719 720 721 #define REGNO_OK_FOR_BASE_P(R) \ 722 ((R) == REG_DP || (R) == REG_IP || (R) == REG_SP) 723 /* A C expression which is nonzero if register number R is suitable 724 for use as a base register in operand addresses. It may be either 725 a suitable hard register or a pseudo register that has been 726 allocated such a hard register. */ 727 728 #define REGNO_MODE_OK_FOR_BASE_P(R,M) \ 729 ((R) == REG_DP || (R) == REG_SP \ 730 || ((R) == REG_IP && GET_MODE_SIZE (M) <= 1)) 731 /* A C expression that is just like `REGNO_OK_FOR_BASE_P', except that 732 that expression may examine the mode of the memory reference in 733 MODE. You should define this macro if the mode of the memory 734 reference affects whether a register may be used as a base 735 register. If you define this macro, the compiler will use it 736 instead of `REGNO_OK_FOR_BASE_P'. */ 737 738 #define REGNO_OK_FOR_INDEX_P(NUM) 0 739 /* A C expression which is nonzero if register number NUM is suitable 740 for use as an index register in operand addresses. It may be 741 either a suitable hard register or a pseudo register that has been 742 allocated such a hard register. 743 744 The difference between an index register and a base register is 745 that the index register may be scaled. If an address involves the 746 sum of two registers, neither one of them scaled, then either one 747 may be labeled the "base" and the other the "index"; but whichever 748 labeling is used must fit the machine's constraints of which 749 registers may serve in each capacity. The compiler will try both 750 labelings, looking for one that is valid, and will reload one or 751 both registers only if neither labeling works. */ 752 753 #define PREFERRED_RELOAD_CLASS(X, CLASS) (CLASS) 754 /* A C expression that places additional restrictions on the register 755 class to use when it is necessary to copy value X into a register 756 in class CLASS. The value is a register class; perhaps CLASS, or 757 perhaps another, smaller class. On many machines, the following 758 definition is safe: 759 760 #define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS) 761 762 Sometimes returning a more restrictive class makes better code. 763 For example, on the 68000, when X is an integer constant that is 764 in range for a `moveq' instruction, the value of this macro is 765 always `DATA_REGS' as long as CLASS includes the data registers. 766 Requiring a data register guarantees that a `moveq' will be used. 767 768 If X is a `const_double', by returning `NO_REGS' you can force X 769 into a memory constant. This is useful on certain machines where 770 immediate floating values cannot be loaded into certain kinds of 771 registers. */ 772 773 /* `PREFERRED_OUTPUT_RELOAD_CLASS (X, CLASS)' 774 Like `PREFERRED_RELOAD_CLASS', but for output reloads instead of 775 input reloads. If you don't define this macro, the default is to 776 use CLASS, unchanged. */ 777 778 /* `LIMIT_RELOAD_CLASS (MODE, CLASS)' 779 A C expression that places additional restrictions on the register 780 class to use when it is necessary to be able to hold a value of 781 mode MODE in a reload register for which class CLASS would 782 ordinarily be used. 783 784 Unlike `PREFERRED_RELOAD_CLASS', this macro should be used when 785 there are certain modes that simply can't go in certain reload 786 classes. 787 788 The value is a register class; perhaps CLASS, or perhaps another, 789 smaller class. 790 791 Don't define this macro unless the target machine has limitations 792 which require the macro to do something nontrivial. */ 793 794 /* SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) 795 `SECONDARY_RELOAD_CLASS (CLASS, MODE, X)' 796 `SECONDARY_OUTPUT_RELOAD_CLASS (CLASS, MODE, X)' 797 Many machines have some registers that cannot be copied directly 798 to or from memory or even from other types of registers. An 799 example is the `MQ' register, which on most machines, can only be 800 copied to or from general registers, but not memory. Some 801 machines allow copying all registers to and from memory, but 802 require a scratch register for stores to some memory locations 803 (e.g., those with symbolic address on the RT, and those with 804 certain symbolic address on the SPARC when compiling PIC). In 805 some cases, both an intermediate and a scratch register are 806 required. 807 808 You should define these macros to indicate to the reload phase 809 that it may need to allocate at least one register for a reload in 810 addition to the register to contain the data. Specifically, if 811 copying X to a register CLASS in MODE requires an intermediate 812 register, you should define `SECONDARY_INPUT_RELOAD_CLASS' to 813 return the largest register class all of whose registers can be 814 used as intermediate registers or scratch registers. 815 816 If copying a register CLASS in MODE to X requires an intermediate 817 or scratch register, `SECONDARY_OUTPUT_RELOAD_CLASS' should be 818 defined to return the largest register class required. If the 819 requirements for input and output reloads are the same, the macro 820 `SECONDARY_RELOAD_CLASS' should be used instead of defining both 821 macros identically. 822 823 The values returned by these macros are often `GENERAL_REGS'. 824 Return `NO_REGS' if no spare register is needed; i.e., if X can be 825 directly copied to or from a register of CLASS in MODE without 826 requiring a scratch register. Do not define this macro if it 827 would always return `NO_REGS'. 828 829 If a scratch register is required (either with or without an 830 intermediate register), you should define patterns for 831 `reload_inM' or `reload_outM', as required (*note Standard 832 Names::.. These patterns, which will normally be implemented with 833 a `define_expand', should be similar to the `movM' patterns, 834 except that operand 2 is the scratch register. 835 836 Define constraints for the reload register and scratch register 837 that contain a single register class. If the original reload 838 register (whose class is CLASS) can meet the constraint given in 839 the pattern, the value returned by these macros is used for the 840 class of the scratch register. Otherwise, two additional reload 841 registers are required. Their classes are obtained from the 842 constraints in the insn pattern. 843 844 X might be a pseudo-register or a `subreg' of a pseudo-register, 845 which could either be in a hard register or in memory. Use 846 `true_regnum' to find out; it will return -1 if the pseudo is in 847 memory and the hard register number if it is in a register. 848 849 These macros should not be used in the case where a particular 850 class of registers can only be copied to memory and not to another 851 class of registers. In that case, secondary reload registers are 852 not needed and would not be helpful. Instead, a stack location 853 must be used to perform the copy and the `movM' pattern should use 854 memory as an intermediate storage. This case often occurs between 855 floating-point and general registers. */ 856 857 /* `SECONDARY_MEMORY_NEEDED (CLASS1, CLASS2, M)' 858 Certain machines have the property that some registers cannot be 859 copied to some other registers without using memory. Define this 860 macro on those machines to be a C expression that is nonzero if 861 objects of mode M in registers of CLASS1 can only be copied to 862 registers of class CLASS2 by storing a register of CLASS1 into 863 memory and loading that memory location into a register of CLASS2. 864 865 Do not define this macro if its value would always be zero. 866 867 `SECONDARY_MEMORY_NEEDED_RTX (MODE)' 868 Normally when `SECONDARY_MEMORY_NEEDED' is defined, the compiler 869 allocates a stack slot for a memory location needed for register 870 copies. If this macro is defined, the compiler instead uses the 871 memory location defined by this macro. 872 873 Do not define this macro if you do not define 874 `SECONDARY_MEMORY_NEEDED'. */ 875 876 #define SMALL_REGISTER_CLASSES 1 877 /* Normally the compiler avoids choosing registers that have been 878 explicitly mentioned in the rtl as spill registers (these 879 registers are normally those used to pass parameters and return 880 values). However, some machines have so few registers of certain 881 classes that there would not be enough registers to use as spill 882 registers if this were done. 883 884 Define `SMALL_REGISTER_CLASSES' to be an expression with a nonzero 885 value on these machines. When this macro has a nonzero value, the 886 compiler allows registers explicitly used in the rtl to be used as 887 spill registers but avoids extending the lifetime of these 888 registers. 889 890 It is always safe to define this macro with a nonzero value, but 891 if you unnecessarily define it, you will reduce the amount of 892 optimizations that can be performed in some cases. If you do not 893 define this macro with a nonzero value when it is required, the 894 compiler will run out of spill registers and print a fatal error 895 message. For most machines, you should not define this macro at 896 all. */ 897 898 #define CLASS_LIKELY_SPILLED_P(CLASS) class_likely_spilled_p(CLASS) 899 /* A C expression whose value is nonzero if pseudos that have been 900 assigned to registers of class CLASS would likely be spilled 901 because registers of CLASS are needed for spill registers. 902 903 The default value of this macro returns 1 if CLASS has exactly one 904 register and zero otherwise. On most machines, this default 905 should be used. Only define this macro to some other expression 906 if pseudo allocated by `local-alloc.c' end up in memory because 907 their hard registers were needed for spill registers. If this 908 macro returns nonzero for those classes, those pseudos will only 909 be allocated by `global.c', which knows how to reallocate the 910 pseudo to another register. If there would not be another 911 register available for reallocation, you should not change the 912 definition of this macro since the only effect of such a 913 definition would be to slow down register allocation. */ 914 915 #define CLASS_MAX_NREGS(CLASS, MODE) GET_MODE_SIZE (MODE) 916 /* A C expression for the maximum number of consecutive registers of 917 class CLASS needed to hold a value of mode MODE. 918 919 This is closely related to the macro `HARD_REGNO_NREGS'. In fact, 920 the value of the macro `CLASS_MAX_NREGS (CLASS, MODE)' should be 921 the maximum value of `HARD_REGNO_NREGS (REGNO, MODE)' for all 922 REGNO values in the class CLASS. 923 924 This macro helps control the handling of multiple-word values in 925 the reload pass. */ 926 927 #define CONST_OK_FOR_LETTER_P(VALUE, C) \ 928 ((C) == 'I' ? (VALUE) >= -255 && (VALUE) <= -1 : \ 929 (C) == 'J' ? (VALUE) >= 0 && (VALUE) <= 7 : \ 930 (C) == 'K' ? (VALUE) >= 0 && (VALUE) <= 127 : \ 931 (C) == 'L' ? (VALUE) > 0 && (VALUE) < 128: \ 932 (C) == 'M' ? (VALUE) == -1: \ 933 (C) == 'N' ? (VALUE) == 1: \ 934 (C) == 'O' ? (VALUE) == 0: \ 935 (C) == 'P' ? (VALUE) >= 0 && (VALUE) <= 255: \ 936 0) 937 938 /* A C expression that defines the machine-dependent operand 939 constraint letters (`I', `J', `K', ... `P') that specify 940 particular ranges of integer values. If C is one of those 941 letters, the expression should check that VALUE, an integer, is in 942 the appropriate range and return 1 if so, 0 otherwise. If C is 943 not one of those letters, the value should be 0 regardless of 944 VALUE. */ 945 946 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0 947 948 /* `CONST_DOUBLE_OK_FOR_LETTER_P (VALUE, C)' 949 A C expression that defines the machine-dependent operand 950 constraint letters that specify particular ranges of 951 `const_double' values (`G' or `H'). 952 953 If C is one of those letters, the expression should check that 954 VALUE, an RTX of code `const_double', is in the appropriate range 955 and return 1 if so, 0 otherwise. If C is not one of those 956 letters, the value should be 0 regardless of VALUE. 957 958 `const_double' is used for all floating-point constants and for 959 `DImode' fixed-point constants. A given letter can accept either 960 or both kinds of values. It can use `GET_MODE' to distinguish 961 between these kinds. */ 962 963 #define EXTRA_CONSTRAINT(X, C) ip2k_extra_constraint (X, C) 964 965 /* A C expression that defines the optional machine-dependent 966 constraint letters (``Q', `R', `S', `T', `U') that can' 967 be used to segregate specific types of operands, usually memory 968 references, for the target machine. Normally this macro will not 969 be defined. If it is required for a particular target machine, it 970 should return 1 if VALUE corresponds to the operand type 971 represented by the constraint letter C. If C is not defined as an 972 extra constraint, the value returned should be 0 regardless of 973 VALUE. 974 975 For example, on the ROMP, load instructions cannot have their 976 output in r0 if the memory reference contains a symbolic address. 977 Constraint letter `Q' is defined as representing a memory address 978 that does *not* contain a symbolic address. An alternative is 979 specified with a `Q' constraint on the input and `r' on the 980 output. The next alternative specifies `m' on the input and a 981 register class that does not include r0 on the output. */ 982 983 /* This is an undocumented variable which describes 984 how GCC will pop a data. */ 985 #define STACK_POP_CODE PRE_INC 986 987 #define STACK_PUSH_CODE POST_DEC 988 /* This macro defines the operation used when something is pushed on 989 the stack. In RTL, a push operation will be `(set (mem 990 (STACK_PUSH_CODE (reg sp))) ...)' 991 992 The choices are `PRE_DEC', `POST_DEC', `PRE_INC', and `POST_INC'. 993 Which of these is correct depends on the stack direction and on 994 whether the stack pointer points to the last item on the stack or 995 whether it points to the space for the next item on the stack. 996 997 The default is `PRE_DEC' when `STACK_GROWS_DOWNWARD' is defined, 998 which is almost always right, and `PRE_INC' otherwise, which is 999 often wrong. */ 1000 1001 1002 #define STACK_CHECK_BUILTIN 1 1003 /* Prologue code will do stack checking as necessary. */ 1004 1005 #define STARTING_FRAME_OFFSET (0) 1006 /* Offset from the frame pointer to the first local variable slot to 1007 be allocated. 1008 1009 If `FRAME_GROWS_DOWNWARD', find the next slot's offset by 1010 subtracting the first slot's length from `STARTING_FRAME_OFFSET'. 1011 Otherwise, it is found by adding the length of the first slot to 1012 the value `STARTING_FRAME_OFFSET'. */ 1013 1014 #define FRAME_GROWS_DOWNWARD 1 1015 #define STACK_GROWS_DOWNWARD 1 1016 1017 /* On IP2K arg pointer is virtual and resolves to either SP or FP 1018 after we've resolved what registers are saved (fp chain, return 1019 pc, etc. */ 1020 1021 #define FIRST_PARM_OFFSET(FUNDECL) 0 1022 /* Offset from the argument pointer register to the first argument's 1023 address. On some machines it may depend on the data type of the 1024 function. 1025 1026 If `ARGS_GROW_DOWNWARD', this is the offset to the location above 1027 the first argument's address. */ 1028 1029 /* `STACK_DYNAMIC_OFFSET (FUNDECL)' 1030 Offset from the stack pointer register to an item dynamically 1031 allocated on the stack, e.g., by `alloca'. 1032 1033 The default value for this macro is `STACK_POINTER_OFFSET' plus the 1034 length of the outgoing arguments. The default is correct for most 1035 machines. See `function.c' for details. */ 1036 1037 #define STACK_POINTER_OFFSET 1 1038 /* IP2K stack is post-decremented, so 0(sp) is address of open space 1039 and 1(sp) is offset to the location avobe the forst location at which 1040 outgoing arguments are placed. */ 1041 1042 #define STACK_BOUNDARY 8 1043 /* Define this macro if there is a guaranteed alignment for the stack 1044 pointer on this machine. The definition is a C expression for the 1045 desired alignment (measured in bits). This value is used as a 1046 default if PREFERRED_STACK_BOUNDARY is not defined. */ 1047 1048 #define STACK_POINTER_REGNUM REG_SP 1049 /* The register number of the stack pointer register, which must also 1050 be a fixed register according to `FIXED_REGISTERS'. On most 1051 machines, the hardware determines which register this is. */ 1052 1053 #define FRAME_POINTER_REGNUM REG_VFP 1054 /* The register number of the frame pointer register, which is used to 1055 access automatic variables in the stack frame. On some machines, 1056 the hardware determines which register this is. On other 1057 machines, you can choose any register you wish for this purpose. */ 1058 1059 #define HARD_FRAME_POINTER_REGNUM REG_FP 1060 1061 #define ARG_POINTER_REGNUM REG_AP 1062 /* The register number of the arg pointer register, which is used to 1063 access the function's argument list. On some machines, this is 1064 the same as the frame pointer register. On some machines, the 1065 hardware determines which register this is. On other machines, 1066 you can choose any register you wish for this purpose. If this is 1067 not the same register as the frame pointer register, then you must 1068 mark it as a fixed register according to `FIXED_REGISTERS', or 1069 arrange to be able to eliminate it (*note Elimination::.). */ 1070 1071 /* We don't really want to support nested functions. But we'll crash 1072 in various testsuite tests if we don't at least define the register 1073 to contain the static chain. The return value register is about as 1074 bad a place as any for this. */ 1075 1076 #define STATIC_CHAIN_REGNUM REG_RESULT 1077 /* Register numbers used for passing a function's static chain 1078 pointer. If register windows are used, the register number as 1079 seen by the called function is `STATIC_CHAIN_INCOMING_REGNUM', 1080 while the register number as seen by the calling function is 1081 `STATIC_CHAIN_REGNUM'. If these registers are the same, 1082 `STATIC_CHAIN_INCOMING_REGNUM' need not be defined. 1083 1084 The static chain register need not be a fixed register. 1085 1086 If the static chain is passed in memory, these macros should not be 1087 defined; instead, the next two macros should be defined. */ 1088 1089 #define FRAME_POINTER_REQUIRED (!flag_omit_frame_pointer) 1090 /* A C expression which is nonzero if a function must have and use a 1091 frame pointer. This expression is evaluated in the reload pass. 1092 If its value is nonzero the function will have a frame pointer. 1093 1094 The expression can in principle examine the current function and 1095 decide according to the facts, but on most machines the constant 0 1096 or the constant 1 suffices. Use 0 when the machine allows code to 1097 be generated with no frame pointer, and doing so saves some time 1098 or space. Use 1 when there is no possible advantage to avoiding a 1099 frame pointer. 1100 1101 In certain cases, the compiler does not know how to produce valid 1102 code without a frame pointer. The compiler recognizes those cases 1103 and automatically gives the function a frame pointer regardless of 1104 what `FRAME_POINTER_REQUIRED' says. You don't need to worry about 1105 them. 1106 1107 In a function that does not require a frame pointer, the frame 1108 pointer register can be allocated for ordinary usage, unless you 1109 mark it as a fixed register. See `FIXED_REGISTERS' for more 1110 information. */ 1111 1112 #define ELIMINABLE_REGS { \ 1113 {ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ 1114 {ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ 1115 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ 1116 {FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ 1117 {HARD_FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ 1118 } 1119 /* If defined, this macro specifies a table of register pairs used to 1120 eliminate unneeded registers that point into the stack frame. If 1121 it is not defined, the only elimination attempted by the compiler 1122 is to replace references to the frame pointer with references to 1123 the stack pointer. 1124 1125 The definition of this macro is a list of structure 1126 initializations, each of which specifies an original and 1127 replacement register. 1128 1129 On some machines, the position of the argument pointer is not 1130 known until the compilation is completed. In such a case, a 1131 separate hard register must be used for the argument pointer. 1132 This register can be eliminated by replacing it with either the 1133 frame pointer or the argument pointer, depending on whether or not 1134 the frame pointer has been eliminated. 1135 1136 In this case, you might specify: 1137 #define ELIMINABLE_REGS \ 1138 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ 1139 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ 1140 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}} 1141 1142 Note that the elimination of the argument pointer with the stack 1143 pointer is specified first since that is the preferred elimination. */ 1144 1145 1146 #define CAN_ELIMINATE(FROM, TO) \ 1147 ((FROM) == HARD_FRAME_POINTER_REGNUM \ 1148 ? (flag_omit_frame_pointer && !frame_pointer_needed) : 1) 1149 /* Don't eliminate FP unless we EXPLICITLY_ASKED */ 1150 1151 /* A C expression that returns nonzero if the compiler is allowed to 1152 try to replace register number FROM-REG with register number 1153 TO-REG. This macro need only be defined if `ELIMINABLE_REGS' is 1154 defined, and will usually be the constant 1, since most of the 1155 cases preventing register elimination are things that the compiler 1156 already knows about. */ 1157 1158 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ 1159 ((OFFSET) = ip2k_init_elim_offset ((FROM), (TO))) 1160 1161 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It 1162 specifies the initial difference between the specified pair of 1163 registers. This macro must be defined if `ELIMINABLE_REGS' is 1164 defined. */ 1165 1166 #define RETURN_ADDR_RTX(COUNT, X) \ 1167 (((COUNT) == 0) ? gen_rtx_REG (HImode, REG_CALLH) : NULL_RTX) 1168 /* A C expression whose value is RTL representing the value of the 1169 return address for the frame COUNT steps up from the current 1170 frame, after the prologue. FRAMEADDR is the frame pointer of the 1171 COUNT frame, or the frame pointer of the COUNT - 1 frame if 1172 `RETURN_ADDR_IN_PREVIOUS_FRAME' is defined. 1173 1174 The value of the expression must always be the correct address when 1175 COUNT is zero, but may be `NULL_RTX' if there is not way to 1176 determine the return address of other frames. */ 1177 1178 #define PUSH_ROUNDING(NPUSHED) (NPUSHED) 1179 /* A C expression that is the number of bytes actually pushed onto the 1180 stack when an instruction attempts to push NPUSHED bytes. 1181 1182 If the target machine does not have a push instruction, do not 1183 define this macro. That directs GNU CC to use an alternate 1184 strategy: to allocate the entire argument block and then store the 1185 arguments into it. 1186 1187 On some machines, the definition 1188 1189 #define PUSH_ROUNDING(BYTES) (BYTES) 1190 1191 will suffice. But on other machines, instructions that appear to 1192 push one byte actually push two bytes in an attempt to maintain 1193 alignment. Then the definition should be 1194 1195 #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1) */ 1196 1197 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \ 1198 ip2k_return_pops_args ((FUNDECL), (FUNTYPE), (SIZE)) 1199 /* A C expression that should indicate the number of bytes of its own 1200 arguments that a function pops on returning, or 0 if the function 1201 pops no arguments and the caller must therefore pop them all after 1202 the function returns. 1203 1204 FUNDECL is a C variable whose value is a tree node that describes 1205 the function in question. Normally it is a node of type 1206 `FUNCTION_DECL' that describes the declaration of the function. 1207 From this you can obtain the DECL_MACHINE_ATTRIBUTES of the 1208 function. 1209 1210 FUNTYPE is a C variable whose value is a tree node that describes 1211 the function in question. Normally it is a node of type 1212 `FUNCTION_TYPE' that describes the data type of the function. 1213 From this it is possible to obtain the data types of the value and 1214 arguments (if known). 1215 1216 When a call to a library function is being considered, FUNDECL 1217 will contain an identifier node for the library function. Thus, if 1218 you need to distinguish among various library functions, you can 1219 do so by their names. Note that "library function" in this 1220 context means a function used to perform arithmetic, whose name is 1221 known specially in the compiler and was not mentioned in the C 1222 code being compiled. 1223 1224 STACK-SIZE is the number of bytes of arguments passed on the 1225 stack. If a variable number of bytes is passed, it is zero, and 1226 argument popping will always be the responsibility of the calling 1227 function. 1228 1229 On the VAX, all functions always pop their arguments, so the 1230 definition of this macro is STACK-SIZE. On the 68000, using the 1231 standard calling convention, no functions pop their arguments, so 1232 the value of the macro is always 0 in this case. But an 1233 alternative calling convention is available in which functions 1234 that take a fixed number of arguments pop them but other functions 1235 (such as `printf') pop nothing (the caller pops all). When this 1236 convention is in use, FUNTYPE is examined to determine whether a 1237 function takes a fixed number of arguments. */ 1238 1239 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0 1240 /* A C expression that controls whether a function argument is passed 1241 in a register, and which register. 1242 1243 The arguments are CUM, which summarizes all the previous 1244 arguments; MODE, the machine mode of the argument; TYPE, the data 1245 type of the argument as a tree node or 0 if that is not known 1246 (which happens for C support library functions); and NAMED, which 1247 is 1 for an ordinary argument and 0 for nameless arguments that 1248 correspond to `...' in the called function's prototype. 1249 1250 The value of the expression is usually either a `reg' RTX for the 1251 hard register in which to pass the argument, or zero to pass the 1252 argument on the stack. 1253 1254 For machines like the VAX and 68000, where normally all arguments 1255 are pushed, zero suffices as a definition. 1256 1257 The value of the expression can also be a `parallel' RTX. This is 1258 used when an argument is passed in multiple locations. The mode 1259 of the of the `parallel' should be the mode of the entire 1260 argument. The `parallel' holds any number of `expr_list' pairs; 1261 each one describes where part of the argument is passed. In each 1262 `expr_list', the first operand can be either a `reg' RTX for the 1263 hard register in which to pass this part of the argument, or zero 1264 to pass the argument on the stack. If this operand is a `reg', 1265 then the mode indicates how large this part of the argument is. 1266 The second operand of the `expr_list' is a `const_int' which gives 1267 the offset in bytes into the entire argument where this part 1268 starts. 1269 1270 The usual way to make the ANSI library `stdarg.h' work on a machine 1271 where some arguments are usually passed in registers, is to cause 1272 nameless arguments to be passed on the stack instead. This is done 1273 by making `FUNCTION_ARG' return 0 whenever NAMED is 0. 1274 1275 You may use the macro `MUST_PASS_IN_STACK (MODE, TYPE)' in the 1276 definition of this macro to determine if this argument is of a 1277 type that must be passed in the stack. If `REG_PARM_STACK_SPACE' 1278 is not defined and `FUNCTION_ARG' returns nonzero for such an 1279 argument, the compiler will abort. If `REG_PARM_STACK_SPACE' is 1280 defined, the argument will be computed in the stack and then 1281 loaded into a register. */ 1282 1283 #define CUMULATIVE_ARGS int 1284 1285 /* A C type for declaring a variable that is used as the first 1286 argument of `FUNCTION_ARG' and other related values. For some 1287 target machines, the type `int' suffices and can hold the number 1288 of bytes of argument so far. 1289 1290 There is no need to record in `CUMULATIVE_ARGS' anything about the 1291 arguments that have been passed on the stack. The compiler has 1292 other variables to keep track of that. For target machines on 1293 which all arguments are passed on the stack, there is no need to 1294 store anything in `CUMULATIVE_ARGS'; however, the data structure 1295 must exist and should not be empty, so use `int'. */ 1296 1297 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \ 1298 ((CUM) = 0) 1299 1300 /* A C statement (sans semicolon) for initializing the variable CUM 1301 for the state at the beginning of the argument list. The variable 1302 has type `CUMULATIVE_ARGS'. The value of FNTYPE is the tree node 1303 for the data type of the function which will receive the args, or 0 1304 if the args are to a compiler support library function. The value 1305 of INDIRECT is nonzero when processing an indirect call, for 1306 example a call through a function pointer. The value of INDIRECT 1307 is zero for a call to an explicitly named function, a library 1308 function call, or when `INIT_CUMULATIVE_ARGS' is used to find 1309 arguments for the function being compiled. 1310 1311 When processing a call to a compiler support library function, 1312 LIBNAME identifies which one. It is a `symbol_ref' rtx which 1313 contains the name of the function, as a string. LIBNAME is 0 when 1314 an ordinary C function call is being processed. Thus, each time 1315 this macro is called, either LIBNAME or FNTYPE is nonzero, but 1316 never both of them at once. */ 1317 1318 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) 1319 1320 /* All arguments are passed on stack - do nothing here. */ 1321 1322 /* A C statement (sans semicolon) to update the summarizer variable 1323 CUM to advance past an argument in the argument list. The values 1324 MODE, TYPE and NAMED describe that argument. Once this is done, 1325 the variable CUM is suitable for analyzing the *following* 1326 argument with `FUNCTION_ARG', etc. 1327 1328 This macro need not do anything if the argument in question was 1329 passed on the stack. The compiler knows how to track the amount 1330 of stack space used for arguments without any special help. */ 1331 1332 #define FUNCTION_ARG_REGNO_P(R) 0 1333 /* A C expression that is nonzero if REGNO is the number of a hard 1334 register in which function arguments are sometimes passed. This 1335 does *not* include implicit arguments such as the static chain and 1336 the structure-value address. On many machines, no registers can be 1337 used for this purpose since all function arguments are pushed on 1338 the stack. */ 1339 1340 #define FUNCTION_VALUE(VALTYPE, FUNC) \ 1341 ((TYPE_MODE (VALTYPE) == QImode) \ 1342 ? gen_rtx_REG (TYPE_MODE (VALTYPE), REG_RESULT + 1) \ 1343 : gen_rtx_REG (TYPE_MODE (VALTYPE), REG_RESULT)) 1344 1345 /* Because functions returning 'char' actually widen to 'int', we have to 1346 use $81 as the return location if we think we only have a 'char'. */ 1347 1348 /* A C expression to create an RTX representing the place where a 1349 function returns a value of data type VALTYPE. VALTYPE is a tree 1350 node representing a data type. Write `TYPE_MODE (VALTYPE)' to get 1351 the machine mode used to represent that type. On many machines, 1352 only the mode is relevant. (Actually, on most machines, scalar 1353 values are returned in the same place regardless of mode). 1354 1355 The value of the expression is usually a `reg' RTX for the hard 1356 register where the return value is stored. The value can also be a 1357 `parallel' RTX, if the return value is in multiple places. See 1358 `FUNCTION_ARG' for an explanation of the `parallel' form. 1359 1360 If `PROMOTE_FUNCTION_RETURN' is defined, you must apply the same 1361 promotion rules specified in `PROMOTE_MODE' if VALTYPE is a scalar 1362 type. 1363 1364 If the precise function being called is known, FUNC is a tree node 1365 (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This 1366 makes it possible to use a different value-returning convention 1367 for specific functions when all their calls are known. 1368 1369 `FUNCTION_VALUE' is not used for return vales with aggregate data 1370 types, because these are returned in another way. See 1371 `STRUCT_VALUE_REGNUM' and related macros, below. */ 1372 1373 #define LIBCALL_VALUE(MODE) gen_rtx_REG ((MODE), REG_RESULT) 1374 /* A C expression to create an RTX representing the place where a 1375 library function returns a value of mode MODE. If the precise 1376 function being called is known, FUNC is a tree node 1377 (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This 1378 makes it possible to use a different value-returning convention 1379 for specific functions when all their calls are known. 1380 1381 Note that "library function" in this context means a compiler 1382 support routine, used to perform arithmetic, whose name is known 1383 specially by the compiler and was not mentioned in the C code being 1384 compiled. 1385 1386 The definition of `LIBRARY_VALUE' need not be concerned aggregate 1387 data types, because none of the library functions returns such 1388 types. */ 1389 1390 #define FUNCTION_VALUE_REGNO_P(N) ((N) == REG_RESULT) 1391 /* A C expression that is nonzero if REGNO is the number of a hard 1392 register in which the values of called function may come back. 1393 1394 A register whose use for returning values is limited to serving as 1395 the second of a pair (for a value of type `double', say) need not 1396 be recognized by this macro. So for most machines, this definition 1397 suffices: 1398 1399 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0) 1400 1401 If the machine has register windows, so that the caller and the 1402 called function use different registers for the return value, this 1403 macro should recognize only the caller's register numbers. */ 1404 1405 #define RETURN_IN_MEMORY(TYPE) \ 1406 ((TYPE_MODE (TYPE) == BLKmode) ? int_size_in_bytes (TYPE) > 8 : 0) 1407 /* A C expression which can inhibit the returning of certain function 1408 values in registers, based on the type of value. A nonzero value 1409 says to return the function value in memory, just as large 1410 structures are always returned. Here TYPE will be a C expression 1411 of type `tree', representing the data type of the value. 1412 1413 Note that values of mode `BLKmode' must be explicitly handled by 1414 this macro. Also, the option `-fpcc-struct-return' takes effect 1415 regardless of this macro. On most systems, it is possible to 1416 leave the macro undefined; this causes a default definition to be 1417 used, whose value is the constant 1 for `BLKmode' values, and 0 1418 otherwise. 1419 1420 Do not use this macro to indicate that structures and unions 1421 should always be returned in memory. You should instead use 1422 `DEFAULT_PCC_STRUCT_RETURN' to indicate this. */ 1423 1424 /* Indicate that large structures are passed by reference. */ 1425 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM,MODE,TYPE,NAMED) 0 1426 1427 1428 #define DEFAULT_PCC_STRUCT_RETURN 0 1429 /* Define this macro to be 1 if all structure and union return values 1430 must be in memory. Since this results in slower code, this should 1431 be defined only if needed for compatibility with other compilers 1432 or with an ABI. If you define this macro to be 0, then the 1433 conventions used for structure and union return values are decided 1434 by the `RETURN_IN_MEMORY' macro. 1435 1436 If not defined, this defaults to the value 1. */ 1437 1438 #define STRUCT_VALUE 0 1439 /* If the structure value address is not passed in a register, define 1440 `STRUCT_VALUE' as an expression returning an RTX for the place 1441 where the address is passed. If it returns 0, the address is 1442 passed as an "invisible" first argument. */ 1443 1444 #define STRUCT_VALUE_INCOMING 0 1445 /* If the incoming location is not a register, then you should define 1446 `STRUCT_VALUE_INCOMING' as an expression for an RTX for where the 1447 called function should find the value. If it should find the 1448 value on the stack, define this to create a `mem' which refers to 1449 the frame pointer. A definition of 0 means that the address is 1450 passed as an "invisible" first argument. */ 1451 1452 #define EPILOGUE_USES(REGNO) 0 1453 /* Define this macro as a C expression that is nonzero for registers 1454 are used by the epilogue or the `return' pattern. The stack and 1455 frame pointer registers are already be assumed to be used as 1456 needed. */ 1457 1458 #define SETUP_INCOMING_VARARGS(ARGS_SO_FAR,MODE,TYPE, \ 1459 PRETEND_ARGS_SIZE,SECOND_TIME) \ 1460 ((PRETEND_ARGS_SIZE) = (0)) 1461 1462 1463 /* Hmmm. We don't actually like constants as addresses - they always need 1464 to be loaded to a register, except for function calls which take an 1465 address by immediate value. But changing this to zero had negative 1466 effects, causing the compiler to get very confused.... */ 1467 1468 #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X) 1469 1470 /* A C expression that is 1 if the RTX X is a constant which is a 1471 valid address. On most machines, this can be defined as 1472 `CONSTANT_P (X)', but a few machines are more restrictive in which 1473 constant addresses are supported. 1474 1475 `CONSTANT_P' accepts integer-values expressions whose values are 1476 not explicitly known, such as `symbol_ref', `label_ref', and 1477 `high' expressions and `const' arithmetic expressions, in addition 1478 to `const_int' and `const_double' expressions. */ 1479 1480 #define MAX_REGS_PER_ADDRESS 1 1481 /* A number, the maximum number of registers that can appear in a 1482 valid memory address. Note that it is up to you to specify a 1483 value equal to the maximum number that `GO_IF_LEGITIMATE_ADDRESS' 1484 would ever accept. */ 1485 1486 #ifdef REG_OK_STRICT 1487 # define GO_IF_LEGITIMATE_ADDRESS(MODE, OPERAND, ADDR) \ 1488 { \ 1489 if (legitimate_address_p ((MODE), (OPERAND), 1)) \ 1490 goto ADDR; \ 1491 } 1492 #else 1493 # define GO_IF_LEGITIMATE_ADDRESS(MODE, OPERAND, ADDR) \ 1494 { \ 1495 if (legitimate_address_p ((MODE), (OPERAND), 0)) \ 1496 goto ADDR; \ 1497 } 1498 #endif 1499 /* A C compound statement with a conditional `goto LABEL;' executed 1500 if X (an RTX) is a legitimate memory address on the target machine 1501 for a memory operand of mode MODE. 1502 1503 It usually pays to define several simpler macros to serve as 1504 subroutines for this one. Otherwise it may be too complicated to 1505 understand. 1506 1507 This macro must exist in two variants: a strict variant and a 1508 non-strict one. The strict variant is used in the reload pass. It 1509 must be defined so that any pseudo-register that has not been 1510 allocated a hard register is considered a memory reference. In 1511 contexts where some kind of register is required, a pseudo-register 1512 with no hard register must be rejected. 1513 1514 The non-strict variant is used in other passes. It must be 1515 defined to accept all pseudo-registers in every context where some 1516 kind of register is required. 1517 1518 Compiler source files that want to use the strict variant of this 1519 macro define the macro `REG_OK_STRICT'. You should use an `#ifdef 1520 REG_OK_STRICT' conditional to define the strict variant in that 1521 case and the non-strict variant otherwise. 1522 1523 Subroutines to check for acceptable registers for various purposes 1524 (one for base registers, one for index registers, and so on) are 1525 typically among the subroutines used to define 1526 `GO_IF_LEGITIMATE_ADDRESS'. Then only these subroutine macros 1527 need have two variants; the higher levels of macros may be the 1528 same whether strict or not. 1529 1530 Normally, constant addresses which are the sum of a `symbol_ref' 1531 and an integer are stored inside a `const' RTX to mark them as 1532 constant. Therefore, there is no need to recognize such sums 1533 specifically as legitimate addresses. Normally you would simply 1534 recognize any `const' as legitimate. 1535 1536 Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle constant 1537 sums that are not marked with `const'. It assumes that a naked 1538 `plus' indicates indexing. If so, then you *must* reject such 1539 naked constant sums as illegitimate addresses, so that none of 1540 them will be given to `PRINT_OPERAND_ADDRESS'. 1541 1542 On some machines, whether a symbolic address is legitimate depends 1543 on the section that the address refers to. On these machines, 1544 define the macro `ENCODE_SECTION_INFO' to store the information 1545 into the `symbol_ref', and then check for it here. When you see a 1546 `const', you will have to look inside it to find the `symbol_ref' 1547 in order to determine the section. *Note Assembler Format::. 1548 1549 The best way to modify the name string is by adding text to the 1550 beginning, with suitable punctuation to prevent any ambiguity. 1551 Allocate the new name in `saveable_obstack'. You will have to 1552 modify `ASM_OUTPUT_LABELREF' to remove and decode the added text 1553 and output the name accordingly, and define `STRIP_NAME_ENCODING' 1554 to access the original name string. 1555 1556 You can check the information stored here into the `symbol_ref' in 1557 the definitions of the macros `GO_IF_LEGITIMATE_ADDRESS' and 1558 `PRINT_OPERAND_ADDRESS'. */ 1559 1560 /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is 1561 valid for use as a base register. For hard registers, it should 1562 always accept those which the hardware permits and reject the 1563 others. Whether the macro accepts or rejects pseudo registers 1564 must be controlled by `REG_OK_STRICT' as described above. This 1565 usually requires two variant definitions, of which `REG_OK_STRICT' 1566 controls the one actually used. */ 1567 1568 #define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) 1569 1570 #define REG_OK_FOR_BASE_NOSTRICT_P(X) \ 1571 (REGNO (X) >= FIRST_PSEUDO_REGISTER \ 1572 || (REGNO (X) == REG_FP) \ 1573 || (REGNO (X) == REG_VFP) \ 1574 || (REGNO (X) == REG_AP) \ 1575 || REG_OK_FOR_BASE_STRICT_P(X)) 1576 1577 #ifdef REG_OK_STRICT 1578 # define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P (X) 1579 #else 1580 # define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NOSTRICT_P (X) 1581 #endif 1582 1583 #define REG_OK_FOR_INDEX_P(X) 0 1584 /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is 1585 valid for use as an index register. 1586 1587 The difference between an index register and a base register is 1588 that the index register may be scaled. If an address involves the 1589 sum of two registers, neither one of them scaled, then either one 1590 may be labeled the "base" and the other the "index"; but whichever 1591 labeling is used must fit the machine's constraints of which 1592 registers may serve in each capacity. The compiler will try both 1593 labelings, looking for one that is valid, and will reload one or 1594 both registers only if neither labeling works. */ 1595 1596 1597 /* A C compound statement that attempts to replace X with a valid 1598 memory address for an operand of mode MODE. WIN will be a C 1599 statement label elsewhere in the code; the macro definition may use 1600 1601 GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN); 1602 1603 to avoid further processing if the address has become legitimate. 1604 1605 X will always be the result of a call to `break_out_memory_refs', 1606 and OLDX will be the operand that was given to that function to 1607 produce X. 1608 1609 The code generated by this macro should not alter the substructure 1610 of X. If it transforms X into a more legitimate form, it should 1611 assign X (which will always be a C variable) a new value. 1612 1613 It is not necessary for this macro to come up with a legitimate 1614 address. The compiler has standard ways of doing so in all cases. 1615 In fact, it is safe for this macro to do nothing. But often a 1616 machine-dependent strategy can generate better code. */ 1617 1618 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \ 1619 do { rtx orig_x = (X); \ 1620 (X) = legitimize_address ((X), (OLDX), (MODE), 0); \ 1621 if ((X) != orig_x && memory_address_p ((MODE), (X))) \ 1622 goto WIN; \ 1623 } while (0) 1624 1625 /* Is X a legitimate register to reload, or is it a pseudo stack-temp 1626 that is problematic for push_reload() ? */ 1627 1628 #define LRA_REG(X) \ 1629 (! (reg_equiv_memory_loc[REGNO (X)] \ 1630 && (reg_equiv_address[REGNO (X)] \ 1631 || num_not_at_initial_offset))) 1632 1633 /* Given a register X that failed the LRA_REG test, replace X 1634 by its memory equivalent, find the reloads needed for THAT memory 1635 location and substitute that back for the higher-level reload 1636 that we're conducting... */ 1637 1638 /* WARNING: we reference 'ind_levels' and 'insn' which are local variables 1639 in find_reloads_address (), where the LEGITIMIZE_RELOAD_ADDRESS macro 1640 expands. */ 1641 1642 #define FRA_REG(X,MODE,OPNUM,TYPE) \ 1643 do { \ 1644 rtx tem = make_memloc ((X), REGNO (X)); \ 1645 \ 1646 if (! strict_memory_address_p (GET_MODE (tem), XEXP (tem, 0))) \ 1647 { \ 1648 /* Note that we're doing address in address - cf. ADDR_TYPE */ \ 1649 find_reloads_address (GET_MODE (tem), &tem, XEXP (tem, 0), \ 1650 &XEXP (tem, 0), (OPNUM), \ 1651 ADDR_TYPE (TYPE), ind_levels, insn); \ 1652 } \ 1653 (X) = tem; \ 1654 } while (0) 1655 1656 1657 /* For the IP2K, we want to be clever about picking IP vs DP for a 1658 base pointer since IP only directly supports a zero displacement. 1659 (Note that we have modified all the HI patterns to correctly handle 1660 IP references by manipulating iph:ipl as we fetch the pieces). */ 1661 #define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND,WIN) \ 1662 { \ 1663 if (GET_CODE (X) == PLUS \ 1664 && REG_P (XEXP (X, 0)) \ 1665 && GET_CODE (XEXP (X, 1)) == CONST_INT) \ 1666 { \ 1667 int disp = INTVAL (XEXP (X, 1)); \ 1668 int fit = (disp >= 0 && disp <= (127 - 2 * GET_MODE_SIZE (MODE))); \ 1669 rtx reg = XEXP (X, 0); \ 1670 if (!fit) \ 1671 { \ 1672 push_reload ((X), NULL_RTX, &(X), \ 1673 NULL, MODE_BASE_REG_CLASS (MODE), GET_MODE (X), \ 1674 VOIDmode, 0, 0, OPNUM, TYPE); \ 1675 goto WIN; \ 1676 } \ 1677 if (reg_equiv_memory_loc[REGNO (reg)] \ 1678 && (reg_equiv_address[REGNO (reg)] || num_not_at_initial_offset)) \ 1679 { \ 1680 rtx mem = make_memloc (reg, REGNO (reg)); \ 1681 if (! strict_memory_address_p (GET_MODE (mem), XEXP (mem, 0))) \ 1682 { \ 1683 /* Note that we're doing address in address - cf. ADDR_TYPE */\ 1684 find_reloads_address (GET_MODE (mem), &mem, XEXP (mem, 0), \ 1685 &XEXP (mem, 0), (OPNUM), \ 1686 ADDR_TYPE (TYPE), (IND), insn); \ 1687 } \ 1688 push_reload (mem, NULL, &XEXP (X, 0), NULL, \ 1689 GENERAL_REGS, Pmode, VOIDmode, 0, 0, \ 1690 OPNUM, TYPE); \ 1691 push_reload (X, NULL, &X, NULL, \ 1692 MODE_BASE_REG_CLASS (MODE), GET_MODE (X), VOIDmode, \ 1693 0, 0, OPNUM, TYPE); \ 1694 goto WIN; \ 1695 } \ 1696 } \ 1697 } 1698 /* A C compound statement that attempts to replace X, which is an 1699 address that needs reloading, with a valid memory address for an 1700 operand of mode MODE. WIN will be a C statement label elsewhere 1701 in the code. It is not necessary to define this macro, but it 1702 might be useful for performance reasons. 1703 1704 For example, on the i386, it is sometimes possible to use a single 1705 reload register instead of two by reloading a sum of two pseudo 1706 registers into a register. On the other hand, for number of RISC 1707 processors offsets are limited so that often an intermediate 1708 address needs to be generated in order to address a stack slot. 1709 By defining LEGITIMIZE_RELOAD_ADDRESS appropriately, the 1710 intermediate addresses generated for adjacent some stack slots can 1711 be made identical, and thus be shared. 1712 1713 *Note*: This macro should be used with caution. It is necessary 1714 to know something of how reload works in order to effectively use 1715 this, and it is quite easy to produce macros that build in too 1716 much knowledge of reload internals. 1717 1718 *Note*: This macro must be able to reload an address created by a 1719 previous invocation of this macro. If it fails to handle such 1720 addresses then the compiler may generate incorrect code or abort. 1721 1722 The macro definition should use `push_reload' to indicate parts 1723 that need reloading; OPNUM, TYPE and IND_LEVELS are usually 1724 suitable to be passed unaltered to `push_reload'. 1725 1726 The code generated by this macro must not alter the substructure of 1727 X. If it transforms X into a more legitimate form, it should 1728 assign X (which will always be a C variable) a new value. This 1729 also applies to parts that you change indirectly by calling 1730 `push_reload'. 1731 1732 The macro definition may use `strict_memory_address_p' to test if 1733 the address has become legitimate. 1734 1735 If you want to change only a part of X, one standard way of doing 1736 this is to use `copy_rtx'. Note, however, that is unshares only a 1737 single level of rtl. Thus, if the part to be changed is not at the 1738 top level, you'll need to replace first the top leve It is not 1739 necessary for this macro to come up with a legitimate address; 1740 but often a machine-dependent strategy can generate better code. */ 1741 1742 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \ 1743 do { \ 1744 if (ip2k_mode_dependent_address (ADDR)) goto LABEL; \ 1745 } while (0) 1746 1747 /* A C statement or compound statement with a conditional `goto 1748 LABEL;' executed if memory address X (an RTX) can have different 1749 meanings depending on the machine mode of the memory reference it 1750 is used for or if the address is valid for some modes but not 1751 others. 1752 1753 Autoincrement and autodecrement addresses typically have 1754 mode-dependent effects because the amount of the increment or 1755 decrement is the size of the operand being addressed. Some 1756 machines have other mode-dependent addresses. Many RISC machines 1757 have no mode-dependent addresses. 1758 1759 You may assume that ADDR is a valid address for the machine. */ 1760 1761 #define LEGITIMATE_CONSTANT_P(X) 1 1762 /* A C expression that is nonzero if X is a legitimate constant for 1763 an immediate operand on the target machine. You can assume that X 1764 satisfies `CONSTANT_P', so you need not check this. In fact, `1' 1765 is a suitable definition for this macro on machines where anything 1766 `CONSTANT_P' is valid. */ 1767 1768 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \ 1769 case CONST_INT: \ 1770 return 0; \ 1771 case CONST: \ 1772 return 8; \ 1773 case LABEL_REF: \ 1774 return 0; \ 1775 case SYMBOL_REF: \ 1776 return 8; \ 1777 case CONST_DOUBLE: \ 1778 return 0; 1779 1780 /* A part of a C `switch' statement that describes the relative costs 1781 of constant RTL expressions. It must contain `case' labels for 1782 expression codes `const_int', `const', `symbol_ref', `label_ref' 1783 and `const_double'. Each case must ultimately reach a `return' 1784 statement to return the relative cost of the use of that kind of 1785 constant value in an expression. The cost may depend on the 1786 precise value of the constant, which is available for examination 1787 in X, and the rtx code of the expression in which it is contained, 1788 found in OUTER_CODE. 1789 1790 CODE is the expression code--redundant, since it can be obtained 1791 with `GET_CODE (X)'. */ 1792 1793 #define DEFAULT_RTX_COSTS(X, CODE, OUTER_CODE) \ 1794 return default_rtx_costs ((X), (CODE), (OUTER_CODE)) 1795 1796 /* Like `CONST_COSTS' but applies to nonconstant RTL expressions. 1797 This can be used, for example, to indicate how costly a multiply 1798 instruction is. In writing this macro, you can use the construct 1799 `COSTS_N_INSNS (N)' to specify a cost equal to N fast 1800 instructions. OUTER_CODE is the code of the expression in which X 1801 is contained. 1802 1803 This macro is optional; do not define it if the default cost 1804 assumptions are adequate for the target machine. */ 1805 1806 #define ADDRESS_COST(ADDRESS) ip2k_address_cost (ADDRESS) 1807 1808 /* An expression giving the cost of an addressing mode that contains 1809 ADDRESS. If not defined, the cost is computed from the ADDRESS 1810 expression and the `CONST_COSTS' values. 1811 1812 For most CISC machines, the default cost is a good approximation 1813 of the true cost of the addressing mode. However, on RISC 1814 machines, all instructions normally have the same length and 1815 execution time. Hence all addresses will have equal costs. 1816 1817 In cases where more than one form of an address is known, the form 1818 with the lowest cost will be used. If multiple forms have the 1819 same, lowest, cost, the one that is the most complex will be used. 1820 1821 For example, suppose an address that is equal to the sum of a 1822 register and a constant is used twice in the same basic block. 1823 When this macro is not defined, the address will be computed in a 1824 register and memory references will be indirect through that 1825 register. On machines where the cost of the addressing mode 1826 containing the sum is no higher than that of a simple indirect 1827 reference, this will produce an additional instruction and 1828 possibly require an additional register. Proper specification of 1829 this macro eliminates this overhead for such machines. 1830 1831 Similar use of this macro is made in strength reduction of loops. 1832 1833 ADDRESS need not be valid as an address. In such a case, the cost 1834 is not relevant and can be any value; invalid addresses need not be 1835 assigned a different cost. 1836 1837 On machines where an address involving more than one register is as 1838 cheap as an address computation involving only one register, 1839 defining `ADDRESS_COST' to reflect this can cause two registers to 1840 be live over a region of code where only one would have been if 1841 `ADDRESS_COST' were not defined in that manner. This effect should 1842 be considered in the definition of this macro. Equivalent costs 1843 should probably only be given to addresses with different numbers 1844 of registers on machines with lots of registers. 1845 1846 This macro will normally either not be defined or be defined as a 1847 constant. */ 1848 1849 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) 7 1850 /* A C expression for the cost of moving data from a register in class 1851 FROM to one in class TO. The classes are expressed using the 1852 enumeration values such as `GENERAL_REGS'. A value of 2 is the 1853 default; other values are interpreted relative to that. 1854 1855 It is not required that the cost always equal 2 when FROM is the 1856 same as TO; on some machines it is expensive to move between 1857 registers if they are not general registers. 1858 1859 If reload sees an insn consisting of a single `set' between two 1860 hard registers, and if `REGISTER_MOVE_COST' applied to their 1861 classes returns a value of 2, reload does not check to ensure that 1862 the constraints of the insn are met. Setting a cost of other than 1863 2 will allow reload to verify that the constraints are met. You 1864 should do this if the `movM' pattern's constraints do not allow 1865 such copying. */ 1866 1867 #define MEMORY_MOVE_COST(MODE,CLASS,IN) 6 1868 /* A C expression for the cost of moving data of mode M between a 1869 register and memory. A value of 4 is the default; this cost is 1870 relative to those in `REGISTER_MOVE_COST'. 1871 1872 If moving between registers and memory is more expensive than 1873 between two registers, you should define this macro to express the 1874 relative cost. */ 1875 1876 #define SLOW_BYTE_ACCESS 0 1877 /* Define this macro as a C expression which is nonzero if accessing 1878 less than a word of memory (i.e. a `char' or a `short') is no 1879 faster than accessing a word of memory, i.e., if such access 1880 require more than one instruction or if there is no difference in 1881 cost between byte and (aligned) word loads. 1882 1883 When this macro is not defined, the compiler will access a field by 1884 finding the smallest containing object; when it is defined, a 1885 fullword load will be used if alignment permits. Unless bytes 1886 accesses are faster than word accesses, using word accesses is 1887 preferable since it may eliminate subsequent memory access if 1888 subsequent accesses occur to other fields in the same word of the 1889 structure, but to different bytes. 1890 1891 `SLOW_ZERO_EXTEND' 1892 Define this macro if zero-extension (of a `char' or `short' to an 1893 `int') can be done faster if the destination is a register that is 1894 known to be zero. 1895 1896 If you define this macro, you must have instruction patterns that 1897 recognize RTL structures like this: 1898 1899 (set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...) 1900 1901 and likewise for `HImode'. 1902 1903 `SLOW_UNALIGNED_ACCESS' 1904 Define this macro to be the value 1 if unaligned accesses have a 1905 cost many times greater than aligned accesses, for example if they 1906 are emulated in a trap handler. 1907 1908 When this macro is nonzero, the compiler will act as if 1909 `STRICT_ALIGNMENT' were nonzero when generating code for block 1910 moves. This can cause significantly more instructions to be 1911 produced. Therefore, do not set this macro nonzero if unaligned 1912 accesses only add a cycle or two to the time for a memory access. 1913 1914 If the value of this macro is always zero, it need not be defined. 1915 1916 `DONT_REDUCE_ADDR' 1917 Define this macro to inhibit strength reduction of memory 1918 addresses. (On some machines, such strength reduction seems to do 1919 harm rather than good.) 1920 1921 `MOVE_RATIO' 1922 The number of scalar move insns which should be generated instead 1923 of a string move insn or a library call. Increasing the value 1924 will always make code faster, but eventually incurs high cost in 1925 increased code size. 1926 1927 If you don't define this, a reasonable default is used. */ 1928 1929 #define NO_FUNCTION_CSE 1930 /* Define this macro if it is as good or better to call a constant 1931 function address than to call an address kept in a register. */ 1932 1933 #define NO_RECURSIVE_FUNCTION_CSE 1934 /* Define this macro if it is as good or better for a function to call 1935 itself with an explicit address than to call an address kept in a 1936 register. 1937 1938 `ADJUST_COST (INSN, LINK, DEP_INSN, COST)' 1939 A C statement (sans semicolon) to update the integer variable COST 1940 based on the relationship between INSN that is dependent on 1941 DEP_INSN through the dependence LINK. The default is to make no 1942 adjustment to COST. This can be used for example to specify to 1943 the scheduler that an output- or anti-dependence does not incur 1944 the same cost as a data-dependence. 1945 1946 `ADJUST_PRIORITY (INSN)' 1947 A C statement (sans semicolon) to update the integer scheduling 1948 priority `INSN_PRIORITY(INSN)'. Reduce the priority to execute 1949 the INSN earlier, increase the priority to execute INSN later. 1950 Do not define this macro if you do not need to adjust the 1951 scheduling priorities of insns. */ 1952 1953 #define TEXT_SECTION_ASM_OP ".text" 1954 /* A C expression whose value is a string containing the assembler 1955 operation that should precede instructions and read-only data. 1956 Normally `".text"' is right. */ 1957 1958 #define DATA_SECTION_ASM_OP ".data" 1959 /* A C expression whose value is a string containing the assembler 1960 operation to identify the following data as writable initialized 1961 data. Normally `".data"' is right. */ 1962 1963 #define JUMP_TABLES_IN_TEXT_SECTION 1 1964 /* Define this macro if jump tables (for `tablejump' insns) should be 1965 output in the text section, along with the assembler instructions. 1966 Otherwise, the readonly data section is used. 1967 1968 This macro is irrelevant if there is no separate readonly data 1969 section. */ 1970 1971 #define ASM_COMMENT_START " ; " 1972 /* A C string constant describing how to begin a comment in the target 1973 assembler language. The compiler assumes that the comment will 1974 end at the end of the line. */ 1975 1976 #define ASM_APP_ON "/* #APP */\n" 1977 /* A C string constant for text to be output before each `asm' 1978 statement or group of consecutive ones. Normally this is 1979 `"#APP"', which is a comment that has no effect on most assemblers 1980 but tells the GNU assembler that it must check the lines that 1981 follow for all valid assembler constructs. */ 1982 1983 #define ASM_APP_OFF "/* #NOAPP */\n" 1984 /* A C string constant for text to be output after each `asm' 1985 statement or group of consecutive ones. Normally this is 1986 `"#NO_APP"', which tells the GNU assembler to resume making the 1987 time-saving assumptions that are valid for ordinary compiler 1988 output. */ 1989 1990 1991 #define OBJC_PROLOGUE {} 1992 /* A C statement to output any assembler statements which are 1993 required to precede any Objective-C object definitions or message 1994 sending. The statement is executed only when compiling an 1995 Objective-C program. */ 1996 1997 #define ASM_OUTPUT_DOUBLE(STREAM, VALUE) \ 1998 fprintf ((STREAM), ".double %.20e\n", (VALUE)) 1999 #define ASM_OUTPUT_FLOAT(STREAM, VALUE) \ 2000 asm_output_float ((STREAM), (VALUE)) 2001 2002 /* `ASM_OUTPUT_LONG_DOUBLE (STREAM, VALUE)' 2003 `ASM_OUTPUT_THREE_QUARTER_FLOAT (STREAM, VALUE)' 2004 `ASM_OUTPUT_SHORT_FLOAT (STREAM, VALUE)' 2005 `ASM_OUTPUT_BYTE_FLOAT (STREAM, VALUE)' 2006 A C statement to output to the stdio stream STREAM an assembler 2007 instruction to assemble a floating-point constant of `TFmode', 2008 `DFmode', `SFmode', `TQFmode', `HFmode', or `QFmode', 2009 respectively, whose value is VALUE. VALUE will be a C expression 2010 of type `REAL_VALUE_TYPE'. Macros such as 2011 `REAL_VALUE_TO_TARGET_DOUBLE' are useful for writing these 2012 definitions. */ 2013 2014 #define ASM_OUTPUT_INT(FILE, VALUE) \ 2015 ( fprintf ((FILE), "\t.long "), \ 2016 output_addr_const ((FILE), (VALUE)), \ 2017 fputs ("\n", (FILE))) 2018 2019 /* Likewise for `short' and `char' constants. */ 2020 2021 #define ASM_OUTPUT_SHORT(FILE,VALUE) \ 2022 asm_output_short ((FILE), (VALUE)) 2023 #define ASM_OUTPUT_CHAR(FILE,VALUE) \ 2024 asm_output_char ((FILE), (VALUE)) 2025 2026 /* `ASM_OUTPUT_QUADRUPLE_INT (STREAM, EXP)' 2027 A C statement to output to the stdio stream STREAM an assembler 2028 instruction to assemble an integer of 16, 8, 4, 2 or 1 bytes, 2029 respectively, whose value is VALUE. The argument EXP will be an 2030 RTL expression which represents a constant value. Use 2031 `output_addr_const (STREAM, EXP)' to output this value as an 2032 assembler expression. 2033 2034 For sizes larger than `UNITS_PER_WORD', if the action of a macro 2035 would be identical to repeatedly calling the macro corresponding to 2036 a size of `UNITS_PER_WORD', once for each word, you need not define 2037 the macro. */ 2038 2039 #define ASM_OUTPUT_BYTE(FILE,VALUE) \ 2040 asm_output_byte ((FILE), (VALUE)) 2041 /* A C statement to output to the stdio stream STREAM an assembler 2042 instruction to assemble a single byte containing the number VALUE. */ 2043 2044 #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) \ 2045 ((C) == '\n' || ((C) == '$')) 2046 /* Define this macro as a C expression which is nonzero if C is used 2047 as a logical line separator by the assembler. 2048 2049 If you do not define this macro, the default is that only the 2050 character `;' is treated as a logical line separator. */ 2051 2052 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \ 2053 do { \ 2054 fputs ("\t.comm ", (STREAM)); \ 2055 assemble_name ((STREAM), (NAME)); \ 2056 fprintf ((STREAM), ",%d\n", (SIZE)); \ 2057 } while (0) 2058 /* A C statement (sans semicolon) to output to the stdio stream 2059 STREAM the assembler definition of a common-label named NAME whose 2060 size is SIZE bytes. The variable ROUNDED is the size rounded up 2061 to whatever alignment the caller wants. 2062 2063 Use the expression `assemble_name (STREAM, NAME)' to output the 2064 name itself; before and after that, output the additional 2065 assembler syntax for defining the name, and a newline. 2066 2067 This macro controls how the assembler definitions of uninitialized 2068 common global variables are output. */ 2069 2070 #define ASM_OUTPUT_LOCAL(STREAM, NAME, SIZE, ROUNDED) \ 2071 do { \ 2072 fputs ("\t.lcomm ", (STREAM)); \ 2073 assemble_name ((STREAM), (NAME)); \ 2074 fprintf ((STREAM), ",%d\n", (SIZE)); \ 2075 } while (0) 2076 /* A C statement (sans semicolon) to output to the stdio stream 2077 STREAM the assembler definition of a local-common-label named NAME 2078 whose size is SIZE bytes. The variable ROUNDED is the size 2079 rounded up to whatever alignment the caller wants. 2080 2081 Use the expression `assemble_name (STREAM, NAME)' to output the 2082 name itself; before and after that, output the additional 2083 assembler syntax for defining the name, and a newline. 2084 2085 This macro controls how the assembler definitions of uninitialized 2086 static variables are output. */ 2087 2088 #undef WEAK_ASM_OP 2089 #define WEAK_ASM_OP ".weak" 2090 2091 #undef ASM_DECLARE_FUNCTION_SIZE 2092 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ 2093 do { \ 2094 if (!flag_inhibit_size_directive) \ 2095 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \ 2096 } while (0) 2097 /* A C statement (sans semicolon) to output to the stdio stream 2098 STREAM any text necessary for declaring the size of a function 2099 which is being defined. The argument NAME is the name of the 2100 function. The argument DECL is the `FUNCTION_DECL' tree node 2101 representing the function. 2102 2103 If this macro is not defined, then the function size is not 2104 defined. */ 2105 2106 #define ESCAPES \ 2107 "\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ 2108 \0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2109 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\ 2110 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\ 2111 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ 2112 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ 2113 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ 2114 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1" 2115 /* A table of bytes codes used by the ASM_OUTPUT_ASCII and 2116 ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table 2117 corresponds to a particular byte value [0..255]. For any 2118 given byte value, if the value in the corresponding table 2119 position is zero, the given character can be output directly. 2120 If the table value is 1, the byte must be output as a \ooo 2121 octal escape. If the tables value is anything else, then the 2122 byte value should be output as a \ followed by the value 2123 in the table. Note that we can use standard UN*X escape 2124 sequences for many control characters, but we don't use 2125 \a to represent BEL because some svr4 assemblers (e.g. on 2126 the i386) don't know about that. Also, we don't use \v 2127 since some versions of gas, such as 2.2 did not accept it. */ 2128 2129 /* Globalizing directive for a label. */ 2130 #define GLOBAL_ASM_OP ".global\t" 2131 2132 #undef ASM_FORMAT_PRIVATE_NAME 2133 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ 2134 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ 2135 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO))) 2136 2137 /* A C expression to assign to OUTVAR (which is a variable of type 2138 `char *') a newly allocated string made from the string NAME and 2139 the number NUMBER, with some suitable punctuation added. Use 2140 `alloca' to get space for the string. 2141 2142 The string will be used as an argument to `ASM_OUTPUT_LABELREF' to 2143 produce an assembler label for an internal static variable whose 2144 name is NAME. Therefore, the string must be such as to result in 2145 valid assembler code. The argument NUMBER is different each time 2146 this macro is executed; it prevents conflicts between 2147 similarly-named internal static variables in different scopes. 2148 2149 Ideally this string should not be a valid C identifier, to prevent 2150 any conflict with the user's own symbols. Most assemblers allow 2151 periods or percent signs in assembler symbols; putting at least 2152 one of these between the name and the number will suffice. */ 2153 2154 #define REGISTER_NAMES { \ 2155 "$00","$01","$02","$03","iph","ipl","sph","spl", \ 2156 "pch","pcl","wreg","status","dph","dpl","$0e","mulh", \ 2157 "$10","$11","$12","$13","$14","$15","$16","$17", \ 2158 "$18","$19","$1a","$1b","$1c","$1d","$1e","$1f", \ 2159 "$20","$21","$22","$23","$24","$25","$26","$27", \ 2160 "$28","$29","$2a","$2b","$2c","$2d","$2e","$2f", \ 2161 "$30","$31","$32","$33","$34","$35","$36","$37", \ 2162 "$38","$39","$3a","$3b","$3c","$3d","$3e","$3f", \ 2163 "$40","$41","$42","$43","$44","$45","$46","$47", \ 2164 "$48","$49","$4a","$4b","$4c","$4d","$4e","$4f", \ 2165 "$50","$51","$52","$53","$54","$55","$56","$57", \ 2166 "$58","$59","$5a","$5b","$5c","$5d","$5e","$5f", \ 2167 "$60","$61","$62","$63","$64","$65","$66","$67", \ 2168 "$68","$69","$6a","$6b","$6c","$6d","$6e","$6f", \ 2169 "$70","$71","$72","$73","$74","$75","$76","$77", \ 2170 "$78","$79","$7a","$7b","$7c","$7d","callh","calll", \ 2171 "$80","$81","$82","$83","$84","$85","$86","$87", \ 2172 "$88","$89","$8a","$8b","$8c","$8d","$8e","$8f", \ 2173 "$90","$91","$92","$93","$94","$95","$96","$97", \ 2174 "$98","$99","$9a","$9b","$9c","$9d","$9e","$9f", \ 2175 "$a0","$a1","$a2","$a3","$a4","$a5","$a6","$a7", \ 2176 "$a8","$a9","$aa","$ab","$ac","$ad","$ae","$af", \ 2177 "$b0","$b1","$b2","$b3","$b4","$b5","$b6","$b7", \ 2178 "$b8","$b9","$ba","$bb","$bc","$bd","$be","$bf", \ 2179 "$c0","$c1","$c2","$c3","$c4","$c5","$c6","$c7", \ 2180 "$c8","$c9","$ca","$cb","$cc","$cd","$ce","$cf", \ 2181 "$d0","$d1","$d2","$d3","$d4","$d5","$d6","$d7", \ 2182 "$d8","$d9","$da","$db","$dc","$dd","$de","$df", \ 2183 "$e0","$e1","$e2","$e3","$e4","$e5","$e6","$e7", \ 2184 "$e8","$e9","$ea","$eb","$ec","$ed","$ee","$ef", \ 2185 "$f0","$f1","$f2","$f3","$f4","$f5","$f6","$f7", \ 2186 "$f8","$f9","$fa","$fb","$fc","$fd","$fe","$ff", \ 2187 "vfph","vfpl","vaph","vapl"} 2188 2189 /* A C initializer containing the assembler's names for the machine 2190 registers, each one as a C string constant. This is what 2191 translates register numbers in the compiler into assembler 2192 language. */ 2193 2194 #define PRINT_OPERAND(STREAM, X, CODE) \ 2195 print_operand ((STREAM), (X), (CODE)) 2196 /* A C compound statement to output to stdio stream STREAM the 2197 assembler syntax for an instruction operand X. X is an RTL 2198 expression. 2199 2200 CODE is a value that can be used to specify one of several ways of 2201 printing the operand. It is used when identical operands must be 2202 printed differently depending on the context. CODE comes from the 2203 `%' specification that was used to request printing of the 2204 operand. If the specification was just `%DIGIT' then CODE is 0; 2205 if the specification was `%LTR DIGIT' then CODE is the ASCII code 2206 for LTR. 2207 2208 If X is a register, this macro should print the register's name. 2209 The names can be found in an array `reg_names' whose type is `char 2210 *[]'. `reg_names' is initialized from `REGISTER_NAMES'. 2211 2212 When the machine description has a specification `%PUNCT' (a `%' 2213 followed by a punctuation character), this macro is called with a 2214 null pointer for X and the punctuation character for CODE. */ 2215 2216 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \ 2217 ((CODE) == '<' || (CODE) == '>') 2218 2219 /* A C expression which evaluates to true if CODE is a valid 2220 punctuation character for use in the `PRINT_OPERAND' macro. If 2221 `PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no 2222 punctuation characters (except for the standard one, `%') are used 2223 in this way. */ 2224 2225 #define PRINT_OPERAND_ADDRESS(STREAM, X) print_operand_address(STREAM, X) 2226 /* A C compound statement to output to stdio stream STREAM the 2227 assembler syntax for an instruction operand that is a memory 2228 reference whose address is X. X is an RTL expression. 2229 2230 On some machines, the syntax for a symbolic address depends on the 2231 section that the address refers to. On these machines, define the 2232 macro `ENCODE_SECTION_INFO' to store the information into the 2233 `symbol_ref', and then check for it here. *Note Assembler 2234 Format::. */ 2235 2236 /* Since register names don't have a prefix, we must preface all 2237 user identifiers with the '_' to prevent confusion. */ 2238 2239 #undef USER_LABEL_PREFIX 2240 #define USER_LABEL_PREFIX "_" 2241 #define LOCAL_LABEL_PREFIX ".L" 2242 /* `LOCAL_LABEL_PREFIX' 2243 `REGISTER_PREFIX' 2244 `IMMEDIATE_PREFIX' 2245 If defined, C string expressions to be used for the `%R', `%L', 2246 `%U', and `%I' options of `asm_fprintf' (see `final.c'). These 2247 are useful when a single `md' file must support multiple assembler 2248 formats. In that case, the various `tm.h' files can define these 2249 macros differently. */ 2250 2251 2252 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \ 2253 asm_fprintf ((STREAM), "\tpage\t%L%d\n\tjmp\t%L%d\n", (VALUE), (VALUE)) 2254 2255 /* elfos.h presumes that we will want switch/case dispatch tables aligned. 2256 This is not so for the ip2k. */ 2257 #undef ASM_OUTPUT_CASE_LABEL 2258 2259 #undef ASM_OUTPUT_ADDR_VEC_ELT 2260 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \ 2261 asm_fprintf ((STREAM), "\tpage\t%L%d\n\tjmp\t%L%d\n", (VALUE), (VALUE)) 2262 2263 /* This macro should be provided on machines where the addresses in a 2264 dispatch table are absolute. 2265 2266 The definition should be a C statement to output to the stdio 2267 stream STREAM an assembler pseudo-instruction to generate a 2268 reference to a label. VALUE is the number of an internal label 2269 whose definition is output using `ASM_OUTPUT_INTERNAL_LABEL'. For 2270 example, 2271 2272 fprintf ((STREAM), "\t.word L%d\n", (VALUE)) */ 2273 2274 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \ 2275 fprintf ((STREAM), "\t.align %d\n", (POWER)) 2276 /* A C statement to output to the stdio stream STREAM an assembler 2277 command to advance the location counter to a multiple of 2 to the 2278 POWER bytes. POWER will be a C expression of type `int'. */ 2279 2280 /* Since instructions are 16 bit word addresses, we should lie and claim that 2281 the dispatch vectors are in QImode. Otherwise the offset into the jump 2282 table will be scaled by the MODE_SIZE. */ 2283 2284 #define CASE_VECTOR_MODE QImode 2285 /* An alias for a machine mode name. This is the machine mode that 2286 elements of a jump-table should have. */ 2287 2288 2289 /* `CASE_VALUES_THRESHOLD' 2290 Define this to be the smallest number of different values for 2291 which it is best to use a jump-table instead of a tree of 2292 conditional branches. The default is four for machines with a 2293 `casesi' instruction and five otherwise. This is best for most 2294 machines. */ 2295 2296 #undef WORD_REGISTER_OPERATIONS 2297 /* Define this macro if operations between registers with integral 2298 mode smaller than a word are always performed on the entire 2299 register. Most RISC machines have this property and most CISC 2300 machines do not. */ 2301 2302 #define MOVE_MAX 1 2303 /* The maximum number of bytes that a single instruction can move 2304 quickly between memory and registers or between two memory 2305 locations. */ 2306 2307 #define MOVE_RATIO 3 2308 /* MOVE_RATIO is the number of move instructions that is better than a 2309 block move. Make this small on the IP2k, since the code size grows very 2310 large with each move. */ 2311 2312 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 2313 /* A C expression which is nonzero if on this machine it is safe to 2314 "convert" an integer of INPREC bits to one of OUTPREC bits (where 2315 OUTPREC is smaller than INPREC) by merely operating on it as if it 2316 had only OUTPREC bits. 2317 2318 On many machines, this expression can be 1. 2319 2320 When `TRULY_NOOP_TRUNCATION' returns 1 for a pair of sizes for 2321 modes for which `MODES_TIEABLE_P' is 0, suboptimal code can result. 2322 If this is the case, making `TRULY_NOOP_TRUNCATION' return 0 in 2323 such cases may improve things. */ 2324 2325 #define Pmode HImode 2326 /* An alias for the machine mode for pointers. On most machines, 2327 define this to be the integer mode corresponding to the width of a 2328 hardware pointer; `SImode' on 32-bit machine or `DImode' on 64-bit 2329 machines. On some machines you must define this to be one of the 2330 partial integer modes, such as `PSImode'. 2331 2332 The width of `Pmode' must be at least as large as the value of 2333 `POINTER_SIZE'. If it is not equal, you must define the macro 2334 `POINTERS_EXTEND_UNSIGNED' to specify how pointers are extended to 2335 `Pmode'. */ 2336 2337 #define FUNCTION_MODE HImode 2338 /* An alias for the machine mode used for memory references to 2339 functions being called, in `call' RTL expressions. On most 2340 machines this should be `QImode'. */ 2341 2342 #define INTEGRATE_THRESHOLD(DECL) \ 2343 (1 + (3 * list_length (DECL_ARGUMENTS (DECL)) / 2)) 2344 /* A C expression for the maximum number of instructions above which 2345 the function DECL should not be inlined. DECL is a 2346 `FUNCTION_DECL' node. 2347 2348 The default definition of this macro is 64 plus 8 times the number 2349 of arguments that the function accepts. Some people think a larger 2350 threshold should be used on RISC machines. */ 2351 2352 #define DOLLARS_IN_IDENTIFIERS 0 2353 /* Define this macro to control use of the character `$' in identifier 2354 names. 0 means `$' is not allowed by default; 1 means it is 2355 allowed. 1 is the default; there is no need to define this macro 2356 in that case. This macro controls the compiler proper; it does 2357 not affect the preprocessor. */ 2358 2359 #define MACHINE_DEPENDENT_REORG(INSN) machine_dependent_reorg (INSN) 2360 /* In rare cases, correct code generation requires extra machine 2361 dependent processing between the second jump optimization pass and 2362 delayed branch scheduling. On those machines, define this macro 2363 as a C statement to act on the code starting at INSN. */ 2364 2365 extern int ip2k_reorg_in_progress; 2366 /* Flag if we're in the middle of IP2k-specific reorganization. */ 2367 2368 extern int ip2k_reorg_completed; 2369 /* Flag if we've completed our IP2k-specific reorganization. If we have 2370 then we allow quite a few more tricks than before. */ 2371 2372 extern int ip2k_reorg_split_dimode; 2373 extern int ip2k_reorg_split_simode; 2374 extern int ip2k_reorg_split_qimode; 2375 extern int ip2k_reorg_split_himode; 2376 /* Flags for various split operations that we run in sequence. */ 2377 2378 extern int ip2k_reorg_merge_qimode; 2379 /* Flag to indicate that it's safe to merge QImode operands. */ 2380 2381 #define GIV_SORT_CRITERION(X, Y) \ 2382 do { \ 2383 if (GET_CODE ((X)->add_val) == CONST_INT \ 2384 && GET_CODE ((Y)->add_val) == CONST_INT) \ 2385 return INTVAL ((X)->add_val) - INTVAL ((Y)->add_val); \ 2386 } while (0) 2387 2388 /* In some cases, the strength reduction optimization pass can 2389 produce better code if this is defined. This macro controls the 2390 order that induction variables are combined. This macro is 2391 particularly useful if the target has limited addressing modes. 2392 For instance, the SH target has only positive offsets in 2393 addresses. Thus sorting to put the smallest address first allows 2394 the most combinations to be found. */ 2395 2396 #define TRAMPOLINE_TEMPLATE(FILE) abort () 2397 2398 /* Length in units of the trampoline for entering a nested function. */ 2399 2400 #define TRAMPOLINE_SIZE 4 2401 2402 /* Emit RTL insns to initialize the variable parts of a trampoline. 2403 FNADDR is an RTX for the address of the function's pure code. 2404 CXT is an RTX for the static chain value for the function. */ 2405 2406 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ 2407 { \ 2408 emit_move_insn (gen_rtx_MEM (HImode, plus_constant ((TRAMP), 2)), \ 2409 CXT); \ 2410 emit_move_insn (gen_rtx_MEM (HImode, plus_constant ((TRAMP), 6)), \ 2411 FNADDR); \ 2412 } 2413 /* Store in cc_status the expressions 2414 that the condition codes will describe 2415 after execution of an instruction whose pattern is EXP. 2416 Do not alter them if the instruction would not alter the cc's. */ 2417 2418 #define NOTICE_UPDATE_CC(EXP, INSN) (void)(0) 2419 2420 /* Output assembler code to FILE to increment profiler label # LABELNO 2421 for profiling a function entry. */ 2422 2423 #define FUNCTION_PROFILER(FILE, LABELNO) \ 2424 fprintf ((FILE), "/* profiler %d */", (LABELNO)) 2425 2426 #define TARGET_MEM_FUNCTIONS 2427 /* Define this macro if GNU CC should generate calls to the System V 2428 (and ANSI C) library functions `memcpy' and `memset' rather than 2429 the BSD functions `bcopy' and `bzero'. */ 2430 2431 2432 #undef ENDFILE_SPEC 2433 #undef LINK_SPEC 2434 #undef STARTFILE_SPEC 2435 2436 /* Another C string constant used much like `LINK_SPEC'. The 2437 difference between the two is that `ENDFILE_SPEC' is used at the 2438 very end of the command given to the linker. 2439 2440 Do not define this macro if it does not need to do anything. */ 2441 2442 #if defined(__STDC__) || defined(ALMOST_STDC) 2443 #define AS2(a,b,c) #a "\t" #b "," #c 2444 #define AS1(a,b) #a "\t" #b 2445 #else 2446 #define AS1(a,b) "a b" 2447 #define AS2(a,b,c) "a b,c" 2448 #endif 2449 #define OUT_AS1(a,b) output_asm_insn (AS1 (a,b), operands) 2450 #define OUT_AS2(a,b,c) output_asm_insn (AS2 (a,b,c), operands) 2451 #define CR_TAB "\n\t" 2452 2453 /* Define this macro as a C statement that declares additional library 2454 routines renames existing ones. `init_optabs' calls this macro 2455 after initializing all the normal library routines. */ 2456 2457 #define INIT_TARGET_OPTABS \ 2458 { \ 2459 smul_optab->handlers[(int) SImode].libfunc \ 2460 = gen_rtx_SYMBOL_REF (Pmode, "_mulsi3"); \ 2461 \ 2462 smul_optab->handlers[(int) DImode].libfunc \ 2463 = gen_rtx_SYMBOL_REF (Pmode, "_muldi3"); \ 2464 \ 2465 cmp_optab->handlers[(int) HImode].libfunc \ 2466 = gen_rtx_SYMBOL_REF (Pmode, "_cmphi2"); \ 2467 \ 2468 cmp_optab->handlers[(int) SImode].libfunc \ 2469 = gen_rtx_SYMBOL_REF (Pmode, "_cmpsi2"); \ 2470 } 2471 2472 #define PREDICATE_CODES \ 2473 {"ip2k_ip_operand", {MEM}}, \ 2474 {"ip2k_short_operand", {MEM}}, \ 2475 {"ip2k_gen_operand", {MEM, REG, SUBREG}}, \ 2476 {"ip2k_nonptr_operand", {REG, SUBREG}}, \ 2477 {"ip2k_ptr_operand", {REG, SUBREG}}, \ 2478 {"ip2k_split_dest_operand", {REG, SUBREG, MEM}}, \ 2479 {"ip2k_sp_operand", {REG}}, \ 2480 {"ip2k_nonsp_reg_operand", {REG, SUBREG}}, \ 2481 {"ip2k_symbol_ref_operand", {SYMBOL_REF}}, \ 2482 {"ip2k_binary_operator", {PLUS, MINUS, MULT, DIV, \ 2483 UDIV, MOD, UMOD, AND, IOR, \ 2484 XOR, COMPARE, ASHIFT, \ 2485 ASHIFTRT, LSHIFTRT}}, \ 2486 {"ip2k_unary_operator", {NEG, NOT, SIGN_EXTEND, \ 2487 ZERO_EXTEND}}, \ 2488 {"ip2k_unsigned_comparison_operator", {LTU, GTU, NE, \ 2489 EQ, LEU, GEU}},\ 2490 {"ip2k_signed_comparison_operator", {LT, GT, LE, GE}}, 2491 2492 #define DWARF2_DEBUGGING_INFO 1 2493 2494 #define DWARF2_ASM_LINE_DEBUG_INFO 1 2495 2496 #define DBX_REGISTER_NUMBER(REGNO) (REGNO) 2497 2498 /* Miscellaneous macros to describe machine specifics. */ 2499 2500 #define STORE_FLAG_VALUE 1 2501 2502 #define IS_PSEUDO_P(R) (REGNO (R) >= FIRST_PSEUDO_REGISTER) 2503 2504 /* Default calculations would cause DWARF address sizes to be 2 bytes, 2505 but the Harvard architecture of the IP2k and the word-addressed 64k 2506 of instruction memory causes us to want a 32-bit "address" field. */ 2507 #undef DWARF2_ADDR_SIZE 2508 #define DWARF2_ADDR_SIZE 4 2509 2510