| 1 |
/*{{{ Comment. */ |
| 2 |
|
| 3 |
/* Definitions of FR30 target. |
| 4 |
Copyright (C) 1998-2025 Free Software Foundation, Inc. |
| 5 |
Contributed by Cygnus Solutions. |
| 6 |
|
| 7 |
This file is part of GCC. |
| 8 |
|
| 9 |
GCC 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 3, or (at your option) |
| 12 |
any later version. |
| 13 |
|
| 14 |
GCC 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 GCC; see the file COPYING3. If not see |
| 21 |
<http://www.gnu.org/licenses/>. */ |
| 22 |
|
| 23 |
/*}}}*/ |
| 24 |
/*{{{ Run-time target specifications. */ |
| 25 |
|
| 26 |
#undef ASM_SPEC |
| 27 |
#define ASM_SPEC "" |
| 28 |
|
| 29 |
/* Define this to be a string constant containing `-D' options to define the |
| 30 |
predefined macros that identify this machine and system. These macros will |
| 31 |
be predefined unless the `-ansi' option is specified. */ |
| 32 |
|
| 33 |
#define TARGET_CPU_CPP_BUILTINS() \ |
| 34 |
do \ |
| 35 |
{ \ |
| 36 |
builtin_define_std ("fr30"); \ |
| 37 |
builtin_assert ("machine=fr30"); \ |
| 38 |
} \ |
| 39 |
while (0) |
| 40 |
|
| 41 |
#undef STARTFILE_SPEC |
| 42 |
#define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s" |
| 43 |
|
| 44 |
/* Include the OS stub library, so that the code can be simulated. |
| 45 |
This is not the right way to do this. Ideally this kind of thing |
| 46 |
should be done in the linker script - but I have not worked out how |
| 47 |
to specify the location of a linker script in a gcc command line yet... */ |
| 48 |
#undef ENDFILE_SPEC |
| 49 |
#define ENDFILE_SPEC "%{!mno-lsim:-lsim} crtend.o%s crtn.o%s" |
| 50 |
|
| 51 |
#undef LIB_SPEC |
| 52 |
#define LIB_SPEC "-lc" |
| 53 |
|
| 54 |
#undef LINK_SPEC |
| 55 |
#define LINK_SPEC "%{h*} %{v:-V} \ |
| 56 |
%{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic}" |
| 57 |
|
| 58 |
/*}}}*/ |
| 59 |
/*{{{ Storage Layout. */ |
| 60 |
|
| 61 |
#define BITS_BIG_ENDIAN 1 |
| 62 |
|
| 63 |
#define BYTES_BIG_ENDIAN 1 |
| 64 |
|
| 65 |
#define WORDS_BIG_ENDIAN 1 |
| 66 |
|
| 67 |
#define UNITS_PER_WORD 4 |
| 68 |
|
| 69 |
#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \ |
| 70 |
do \ |
| 71 |
{ \ |
| 72 |
if (GET_MODE_CLASS (MODE) == MODE_INT \ |
| 73 |
&& GET_MODE_SIZE (MODE) < 4) \ |
| 74 |
(MODE) = SImode; \ |
| 75 |
} \ |
| 76 |
while (0) |
| 77 |
|
| 78 |
#define PARM_BOUNDARY 32 |
| 79 |
|
| 80 |
#define STACK_BOUNDARY 32 |
| 81 |
|
| 82 |
#define FUNCTION_BOUNDARY 32 |
| 83 |
|
| 84 |
#define BIGGEST_ALIGNMENT 32 |
| 85 |
|
| 86 |
#define DATA_ALIGNMENT(TYPE, ALIGN) \ |
| 87 |
(TREE_CODE (TYPE) == ARRAY_TYPE \ |
| 88 |
&& TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ |
| 89 |
&& (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) |
| 90 |
|
| 91 |
#define STRICT_ALIGNMENT 1 |
| 92 |
|
| 93 |
#define PCC_BITFIELD_TYPE_MATTERS 1 |
| 94 |
|
| 95 |
/*}}}*/ |
| 96 |
/*{{{ Layout of Source Language Data Types. */ |
| 97 |
|
| 98 |
#define SHORT_TYPE_SIZE 16 |
| 99 |
#define INT_TYPE_SIZE 32 |
| 100 |
#define LONG_TYPE_SIZE 32 |
| 101 |
#define LONG_LONG_TYPE_SIZE 64 |
| 102 |
|
| 103 |
#define DEFAULT_SIGNED_CHAR 1 |
| 104 |
|
| 105 |
#undef SIZE_TYPE |
| 106 |
#define SIZE_TYPE "unsigned int" |
| 107 |
|
| 108 |
#undef PTRDIFF_TYPE |
| 109 |
#define PTRDIFF_TYPE "int" |
| 110 |
|
| 111 |
#undef WCHAR_TYPE |
| 112 |
#define WCHAR_TYPE "long int" |
| 113 |
|
| 114 |
#undef WCHAR_TYPE_SIZE |
| 115 |
#define WCHAR_TYPE_SIZE BITS_PER_WORD |
| 116 |
|
| 117 |
/*}}}*/ |
| 118 |
/*{{{ REGISTER BASICS. */ |
| 119 |
|
| 120 |
/* Number of hardware registers known to the compiler. They receive numbers 0 |
| 121 |
through `FIRST_PSEUDO_REGISTER-1'; thus, the first pseudo register's number |
| 122 |
really is assigned the number `FIRST_PSEUDO_REGISTER'. */ |
| 123 |
#define FIRST_PSEUDO_REGISTER 21 |
| 124 |
|
| 125 |
/* Fixed register assignments: */ |
| 126 |
|
| 127 |
/* Here we do a BAD THING - reserve a register for use by the machine |
| 128 |
description file. There are too many places in compiler where it |
| 129 |
assumes that it can issue a branch or jump instruction without |
| 130 |
providing a scratch register for it, and reload just cannot cope, so |
| 131 |
we keep a register back for these situations. */ |
| 132 |
#define COMPILER_SCRATCH_REGISTER 0 |
| 133 |
|
| 134 |
/* The register that contains the result of a function call. */ |
| 135 |
#define RETURN_VALUE_REGNUM 4 |
| 136 |
|
| 137 |
/* The first register that can contain the arguments to a function. */ |
| 138 |
#define FIRST_ARG_REGNUM 4 |
| 139 |
|
| 140 |
/* A call-used register that can be used during the function prologue. */ |
| 141 |
#define PROLOGUE_TMP_REGNUM COMPILER_SCRATCH_REGISTER |
| 142 |
|
| 143 |
/* Register numbers used for passing a function's static chain pointer. If |
| 144 |
register windows are used, the register number as seen by the called |
| 145 |
function is `STATIC_CHAIN_INCOMING_REGNUM', while the register number as |
| 146 |
seen by the calling function is `STATIC_CHAIN_REGNUM'. If these registers |
| 147 |
are the same, `STATIC_CHAIN_INCOMING_REGNUM' need not be defined. |
| 148 |
|
| 149 |
The static chain register need not be a fixed register. |
| 150 |
|
| 151 |
If the static chain is passed in memory, these macros should not be defined; |
| 152 |
instead, the next two macros should be defined. */ |
| 153 |
#define STATIC_CHAIN_REGNUM 12 |
| 154 |
/* #define STATIC_CHAIN_INCOMING_REGNUM */ |
| 155 |
|
| 156 |
/* An FR30 specific hardware register. */ |
| 157 |
#define ACCUMULATOR_REGNUM 13 |
| 158 |
|
| 159 |
/* The register number of the frame pointer register, which is used to access |
| 160 |
automatic variables in the stack frame. On some machines, the hardware |
| 161 |
determines which register this is. On other machines, you can choose any |
| 162 |
register you wish for this purpose. */ |
| 163 |
#define FRAME_POINTER_REGNUM 14 |
| 164 |
|
| 165 |
/* The register number of the stack pointer register, which must also be a |
| 166 |
fixed register according to `FIXED_REGISTERS'. On most machines, the |
| 167 |
hardware determines which register this is. */ |
| 168 |
#define STACK_POINTER_REGNUM 15 |
| 169 |
|
| 170 |
/* The following a fake hard registers that describe some of the dedicated |
| 171 |
registers on the FR30. */ |
| 172 |
#define CONDITION_CODE_REGNUM 16 |
| 173 |
#define RETURN_POINTER_REGNUM 17 |
| 174 |
#define MD_HIGH_REGNUM 18 |
| 175 |
#define MD_LOW_REGNUM 19 |
| 176 |
|
| 177 |
/* An initializer that says which registers are used for fixed purposes all |
| 178 |
throughout the compiled code and are therefore not available for general |
| 179 |
allocation. These would include the stack pointer, the frame pointer |
| 180 |
(except on machines where that can be used as a general register when no |
| 181 |
frame pointer is needed), the program counter on machines where that is |
| 182 |
considered one of the addressable registers, and any other numbered register |
| 183 |
with a standard use. |
| 184 |
|
| 185 |
This information is expressed as a sequence of numbers, separated by commas |
| 186 |
and surrounded by braces. The Nth number is 1 if register N is fixed, 0 |
| 187 |
otherwise. |
| 188 |
|
| 189 |
The table initialized from this macro, and the table initialized by the |
| 190 |
following one, may be overridden at run time either automatically, by the |
| 191 |
actions of the macro `TARGET_CONDITIONAL_REGISTER_USAGE', or by the user |
| 192 |
with the command options `-ffixed-REG', `-fcall-used-REG' and |
| 193 |
`-fcall-saved-REG'. */ |
| 194 |
#define FIXED_REGISTERS \ |
| 195 |
{ 1, 0, 0, 0, 0, 0, 0, 0, /* 0 - 7 */ \ |
| 196 |
0, 0, 0, 0, 0, 0, 0, 1, /* 8 - 15 */ \ |
| 197 |
1, 1, 1, 1, 1 } /* 16 - 20 */ |
| 198 |
|
| 199 |
/* XXX - MDL and MDH set as fixed for now - this is until I can get the |
| 200 |
mul patterns working. */ |
| 201 |
|
| 202 |
/* Like `FIXED_REGISTERS' but has 1 for each register that is clobbered (in |
| 203 |
general) by function calls as well as for fixed registers. This macro |
| 204 |
therefore identifies the registers that are not available for general |
| 205 |
allocation of values that must live across function calls. |
| 206 |
|
| 207 |
If a register has 0 in `CALL_USED_REGISTERS', the compiler automatically |
| 208 |
saves it on function entry and restores it on function exit, if the register |
| 209 |
is used within the function. */ |
| 210 |
#define CALL_USED_REGISTERS \ |
| 211 |
{ 1, 1, 1, 1, 1, 1, 1, 1, /* 0 - 7 */ \ |
| 212 |
0, 0, 0, 0, 1, 1, 0, 1, /* 8 - 15 */ \ |
| 213 |
1, 1, 1, 1, 1 } /* 16 - 20 */ |
| 214 |
|
| 215 |
/* A C initializer containing the assembler's names for the machine registers, |
| 216 |
each one as a C string constant. This is what translates register numbers |
| 217 |
in the compiler into assembler language. */ |
| 218 |
#define REGISTER_NAMES \ |
| 219 |
{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ |
| 220 |
"r8", "r9", "r10", "r11", "r12", "ac", "fp", "sp", \ |
| 221 |
"cc", "rp", "mdh", "mdl", "ap" \ |
| 222 |
} |
| 223 |
|
| 224 |
/* If defined, a C initializer for an array of structures containing a name and |
| 225 |
a register number. This macro defines additional names for hard registers, |
| 226 |
thus allowing the `asm' option in declarations to refer to registers using |
| 227 |
alternate names. */ |
| 228 |
#define ADDITIONAL_REGISTER_NAMES \ |
| 229 |
{ \ |
| 230 |
{"r13", 13}, {"r14", 14}, {"r15", 15}, {"usp", 15}, {"ps", 16}\ |
| 231 |
} |
| 232 |
|
| 233 |
/*}}}*/ |
| 234 |
/*{{{ Register Classes. */ |
| 235 |
|
| 236 |
/* An enumeral type that must be defined with all the register class names as |
| 237 |
enumeral values. `NO_REGS' must be first. `ALL_REGS' must be the last |
| 238 |
register class, followed by one more enumeral value, `LIM_REG_CLASSES', |
| 239 |
which is not a register class but rather tells how many classes there are. |
| 240 |
|
| 241 |
Each register class has a number, which is the value of casting the class |
| 242 |
name to type `int'. The number serves as an index in many of the tables |
| 243 |
described below. */ |
| 244 |
enum reg_class |
| 245 |
{ |
| 246 |
NO_REGS, |
| 247 |
MULTIPLY_32_REG, /* the MDL register as used by the MULH, MULUH insns */ |
| 248 |
MULTIPLY_64_REG, /* the MDH,MDL register pair as used by MUL and MULU */ |
| 249 |
LOW_REGS, /* registers 0 through 7 */ |
| 250 |
HIGH_REGS, /* registers 8 through 15 */ |
| 251 |
REAL_REGS, /* i.e. all the general hardware registers on the FR30 */ |
| 252 |
ALL_REGS, |
| 253 |
LIM_REG_CLASSES |
| 254 |
}; |
| 255 |
|
| 256 |
#define GENERAL_REGS REAL_REGS |
| 257 |
#define N_REG_CLASSES ((int) LIM_REG_CLASSES) |
| 258 |
|
| 259 |
/* An initializer containing the names of the register classes as C string |
| 260 |
constants. These names are used in writing some of the debugging dumps. */ |
| 261 |
#define REG_CLASS_NAMES \ |
| 262 |
{ \ |
| 263 |
"NO_REGS", \ |
| 264 |
"MULTIPLY_32_REG", \ |
| 265 |
"MULTIPLY_64_REG", \ |
| 266 |
"LOW_REGS", \ |
| 267 |
"HIGH_REGS", \ |
| 268 |
"REAL_REGS", \ |
| 269 |
"ALL_REGS" \ |
| 270 |
} |
| 271 |
|
| 272 |
/* An initializer containing the contents of the register classes, as integers |
| 273 |
which are bit masks. The Nth integer specifies the contents of class N. |
| 274 |
The way the integer MASK is interpreted is that register R is in the class |
| 275 |
if `MASK & (1 << R)' is 1. |
| 276 |
|
| 277 |
When the machine has more than 32 registers, an integer does not suffice. |
| 278 |
Then the integers are replaced by sub-initializers, braced groupings |
| 279 |
containing several integers. Each sub-initializer must be suitable as an |
| 280 |
initializer for the type `HARD_REG_SET' which is defined in |
| 281 |
`hard-reg-set.h'. */ |
| 282 |
#define REG_CLASS_CONTENTS \ |
| 283 |
{ \ |
| 284 |
{ 0 }, \ |
| 285 |
{ 1 << MD_LOW_REGNUM }, \ |
| 286 |
{ (1 << MD_LOW_REGNUM) | (1 << MD_HIGH_REGNUM) }, \ |
| 287 |
{ (1 << 8) - 1 }, \ |
| 288 |
{ ((1 << 8) - 1) << 8 }, \ |
| 289 |
{ (1 << CONDITION_CODE_REGNUM) - 1 }, \ |
| 290 |
{ (1 << FIRST_PSEUDO_REGISTER) - 1 } \ |
| 291 |
} |
| 292 |
|
| 293 |
/* A C expression whose value is a register class containing hard register |
| 294 |
REGNO. In general there is more than one such class; choose a class which |
| 295 |
is "minimal", meaning that no smaller class also contains the register. */ |
| 296 |
#define REGNO_REG_CLASS(REGNO) \ |
| 297 |
( (REGNO) < 8 ? LOW_REGS \ |
| 298 |
: (REGNO) < CONDITION_CODE_REGNUM ? HIGH_REGS \ |
| 299 |
: (REGNO) == MD_LOW_REGNUM ? MULTIPLY_32_REG \ |
| 300 |
: (REGNO) == MD_HIGH_REGNUM ? MULTIPLY_64_REG \ |
| 301 |
: ALL_REGS) |
| 302 |
|
| 303 |
/* A macro whose definition is the name of the class to which a valid base |
| 304 |
register must belong. A base register is one used in an address which is |
| 305 |
the register value plus a displacement. */ |
| 306 |
#define BASE_REG_CLASS REAL_REGS |
| 307 |
|
| 308 |
/* A macro whose definition is the name of the class to which a valid index |
| 309 |
register must belong. An index register is one used in an address where its |
| 310 |
value is either multiplied by a scale factor or added to another register |
| 311 |
(as well as added to a displacement). */ |
| 312 |
#define INDEX_REG_CLASS REAL_REGS |
| 313 |
|
| 314 |
/* A C expression which is nonzero if register number NUM is suitable for use |
| 315 |
as a base register in operand addresses. It may be either a suitable hard |
| 316 |
register or a pseudo register that has been allocated such a hard register. */ |
| 317 |
#define REGNO_OK_FOR_BASE_P(NUM) 1 |
| 318 |
|
| 319 |
/* A C expression which is nonzero if register number NUM is suitable for use |
| 320 |
as an index register in operand addresses. It may be either a suitable hard |
| 321 |
register or a pseudo register that has been allocated such a hard register. |
| 322 |
|
| 323 |
The difference between an index register and a base register is that the |
| 324 |
index register may be scaled. If an address involves the sum of two |
| 325 |
registers, neither one of them scaled, then either one may be labeled the |
| 326 |
"base" and the other the "index"; but whichever labeling is used must fit |
| 327 |
the machine's constraints of which registers may serve in each capacity. |
| 328 |
The compiler will try both labelings, looking for one that is valid, and |
| 329 |
will reload one or both registers only if neither labeling works. */ |
| 330 |
#define REGNO_OK_FOR_INDEX_P(NUM) 1 |
| 331 |
|
| 332 |
#define CLASS_MAX_NREGS(CLASS, MODE) targetm.hard_regno_nregs (0, MODE) |
| 333 |
|
| 334 |
/*}}}*/ |
| 335 |
/*{{{ Basic Stack Layout. */ |
| 336 |
|
| 337 |
/* Define this macro if pushing a word onto the stack moves the stack pointer |
| 338 |
to a smaller address. */ |
| 339 |
#define STACK_GROWS_DOWNWARD 1 |
| 340 |
|
| 341 |
/* Define this to macro nonzero if the addresses of local variable slots |
| 342 |
are at negative offsets from the frame pointer. */ |
| 343 |
#define FRAME_GROWS_DOWNWARD 1 |
| 344 |
|
| 345 |
/* Offset from the stack pointer register to the first location at which |
| 346 |
outgoing arguments are placed. If not specified, the default value of zero |
| 347 |
is used. This is the proper value for most machines. |
| 348 |
|
| 349 |
If `ARGS_GROW_DOWNWARD', this is the offset to the location above the first |
| 350 |
location at which outgoing arguments are placed. */ |
| 351 |
#define STACK_POINTER_OFFSET 0 |
| 352 |
|
| 353 |
/* Offset from the argument pointer register to the first argument's address. |
| 354 |
On some machines it may depend on the data type of the function. |
| 355 |
|
| 356 |
If `ARGS_GROW_DOWNWARD', this is the offset to the location above the first |
| 357 |
argument's address. */ |
| 358 |
#define FIRST_PARM_OFFSET(FUNDECL) 0 |
| 359 |
|
| 360 |
/* A C expression whose value is RTL representing the location of the incoming |
| 361 |
return address at the beginning of any function, before the prologue. This |
| 362 |
RTL is either a `REG', indicating that the return value is saved in `REG', |
| 363 |
or a `MEM' representing a location in the stack. |
| 364 |
|
| 365 |
You only need to define this macro if you want to support call frame |
| 366 |
debugging information like that provided by DWARF 2. */ |
| 367 |
#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (SImode, RETURN_POINTER_REGNUM) |
| 368 |
|
| 369 |
/*}}}*/ |
| 370 |
/*{{{ Register That Address the Stack Frame. */ |
| 371 |
|
| 372 |
/* The register number of the arg pointer register, which is used to access the |
| 373 |
function's argument list. On some machines, this is the same as the frame |
| 374 |
pointer register. On some machines, the hardware determines which register |
| 375 |
this is. On other machines, you can choose any register you wish for this |
| 376 |
purpose. If this is not the same register as the frame pointer register, |
| 377 |
then you must mark it as a fixed register according to `FIXED_REGISTERS', or |
| 378 |
arrange to be able to eliminate it. */ |
| 379 |
#define ARG_POINTER_REGNUM 20 |
| 380 |
|
| 381 |
/*}}}*/ |
| 382 |
/*{{{ Eliminating the Frame Pointer and the Arg Pointer. */ |
| 383 |
|
| 384 |
/* If defined, this macro specifies a table of register pairs used to eliminate |
| 385 |
unneeded registers that point into the stack frame. If it is not defined, |
| 386 |
the only elimination attempted by the compiler is to replace references to |
| 387 |
the frame pointer with references to the stack pointer. |
| 388 |
|
| 389 |
The definition of this macro is a list of structure initializations, each of |
| 390 |
which specifies an original and replacement register. |
| 391 |
|
| 392 |
On some machines, the position of the argument pointer is not known until |
| 393 |
the compilation is completed. In such a case, a separate hard register must |
| 394 |
be used for the argument pointer. This register can be eliminated by |
| 395 |
replacing it with either the frame pointer or the argument pointer, |
| 396 |
depending on whether or not the frame pointer has been eliminated. |
| 397 |
|
| 398 |
In this case, you might specify: |
| 399 |
#define ELIMINABLE_REGS \ |
| 400 |
{{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ |
| 401 |
{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ |
| 402 |
{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}} |
| 403 |
|
| 404 |
Note that the elimination of the argument pointer with the stack pointer is |
| 405 |
specified first since that is the preferred elimination. */ |
| 406 |
|
| 407 |
#define ELIMINABLE_REGS \ |
| 408 |
{ \ |
| 409 |
{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ |
| 410 |
{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ |
| 411 |
{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM} \ |
| 412 |
} |
| 413 |
|
| 414 |
/* This macro returns the initial difference between the specified pair |
| 415 |
of registers. */ |
| 416 |
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ |
| 417 |
(OFFSET) = fr30_compute_frame_size (FROM, TO) |
| 418 |
|
| 419 |
/*}}}*/ |
| 420 |
/*{{{ Passing Function Arguments on the Stack. */ |
| 421 |
|
| 422 |
/* If defined, the maximum amount of space required for outgoing arguments will |
| 423 |
be computed and placed into the variable |
| 424 |
`crtl->outgoing_args_size'. No space will be pushed onto the |
| 425 |
stack for each call; instead, the function prologue should increase the |
| 426 |
stack frame size by this amount. |
| 427 |
|
| 428 |
Defining both `PUSH_ROUNDING' and `ACCUMULATE_OUTGOING_ARGS' is not |
| 429 |
proper. */ |
| 430 |
#define ACCUMULATE_OUTGOING_ARGS 1 |
| 431 |
|
| 432 |
/*}}}*/ |
| 433 |
/*{{{ Function Arguments in Registers. */ |
| 434 |
|
| 435 |
/* The number of register assigned to holding function arguments. */ |
| 436 |
|
| 437 |
#define FR30_NUM_ARG_REGS 4 |
| 438 |
|
| 439 |
/* A C type for declaring a variable that is used as the first argument of |
| 440 |
`FUNCTION_ARG' and other related values. For some target machines, the type |
| 441 |
`int' suffices and can hold the number of bytes of argument so far. |
| 442 |
|
| 443 |
There is no need to record in `CUMULATIVE_ARGS' anything about the arguments |
| 444 |
that have been passed on the stack. The compiler has other variables to |
| 445 |
keep track of that. For target machines on which all arguments are passed |
| 446 |
on the stack, there is no need to store anything in `CUMULATIVE_ARGS'; |
| 447 |
however, the data structure must exist and should not be empty, so use |
| 448 |
`int'. */ |
| 449 |
/* On the FR30 this value is an accumulating count of the number of argument |
| 450 |
registers that have been filled with argument values, as opposed to say, |
| 451 |
the number of bytes of argument accumulated so far. */ |
| 452 |
#define CUMULATIVE_ARGS int |
| 453 |
|
| 454 |
/* A C statement (sans semicolon) for initializing the variable CUM for the |
| 455 |
state at the beginning of the argument list. The variable has type |
| 456 |
`CUMULATIVE_ARGS'. The value of FNTYPE is the tree node for the data type |
| 457 |
of the function which will receive the args, or 0 if the args are to a |
| 458 |
compiler support library function. The value of INDIRECT is nonzero when |
| 459 |
processing an indirect call, for example a call through a function pointer. |
| 460 |
The value of INDIRECT is zero for a call to an explicitly named function, a |
| 461 |
library function call, or when `INIT_CUMULATIVE_ARGS' is used to find |
| 462 |
arguments for the function being compiled. |
| 463 |
|
| 464 |
When processing a call to a compiler support library function, LIBNAME |
| 465 |
identifies which one. It is a `symbol_ref' rtx which contains the name of |
| 466 |
the function, as a string. LIBNAME is 0 when an ordinary C function call is |
| 467 |
being processed. Thus, each time this macro is called, either LIBNAME or |
| 468 |
FNTYPE is nonzero, but never both of them at once. */ |
| 469 |
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \ |
| 470 |
(CUM) = 0 |
| 471 |
|
| 472 |
/* A C expression that is nonzero if REGNO is the number of a hard register in |
| 473 |
which function arguments are sometimes passed. This does *not* include |
| 474 |
implicit arguments such as the static chain and the structure-value address. |
| 475 |
On many machines, no registers can be used for this purpose since all |
| 476 |
function arguments are pushed on the stack. */ |
| 477 |
#define FUNCTION_ARG_REGNO_P(REGNO) \ |
| 478 |
((REGNO) >= FIRST_ARG_REGNUM && ((REGNO) < FIRST_ARG_REGNUM + FR30_NUM_ARG_REGS)) |
| 479 |
|
| 480 |
/*}}}*/ |
| 481 |
/*{{{ How Large Values are Returned. */ |
| 482 |
|
| 483 |
/* Define this macro to be 1 if all structure and union return values must be |
| 484 |
in memory. Since this results in slower code, this should be defined only |
| 485 |
if needed for compatibility with other compilers or with an ABI. If you |
| 486 |
define this macro to be 0, then the conventions used for structure and union |
| 487 |
return values are decided by the `TARGET_RETURN_IN_MEMORY' macro. |
| 488 |
|
| 489 |
If not defined, this defaults to the value 1. */ |
| 490 |
#define DEFAULT_PCC_STRUCT_RETURN 1 |
| 491 |
|
| 492 |
/*}}}*/ |
| 493 |
/*{{{ Generating Code for Profiling. */ |
| 494 |
|
| 495 |
/* A C statement or compound statement to output to FILE some assembler code to |
| 496 |
call the profiling subroutine `mcount'. Before calling, the assembler code |
| 497 |
must load the address of a counter variable into a register where `mcount' |
| 498 |
expects to find the address. The name of this variable is `LP' followed by |
| 499 |
the number LABELNO, so you would generate the name using `LP%d' in a |
| 500 |
`fprintf'. |
| 501 |
|
| 502 |
The details of how the address should be passed to `mcount' are determined |
| 503 |
by your operating system environment, not by GCC. To figure them out, |
| 504 |
compile a small program for profiling using the system's installed C |
| 505 |
compiler and look at the assembler code that results. */ |
| 506 |
#define FUNCTION_PROFILER(FILE, LABELNO) \ |
| 507 |
{ \ |
| 508 |
fprintf (FILE, "\t mov rp, r1\n" ); \ |
| 509 |
fprintf (FILE, "\t ldi:32 mcount, r0\n" ); \ |
| 510 |
fprintf (FILE, "\t call @r0\n" ); \ |
| 511 |
fprintf (FILE, ".word\tLP%d\n", LABELNO); \ |
| 512 |
} |
| 513 |
|
| 514 |
/*}}}*/ |
| 515 |
/*{{{ Trampolines for Nested Functions. */ |
| 516 |
|
| 517 |
/* A C expression for the size in bytes of the trampoline, as an integer. */ |
| 518 |
#define TRAMPOLINE_SIZE 18 |
| 519 |
|
| 520 |
/* We want the trampoline to be aligned on a 32bit boundary so that we can |
| 521 |
make sure the location of the static chain & target function within |
| 522 |
the trampoline is also aligned on a 32bit boundary. */ |
| 523 |
#define TRAMPOLINE_ALIGNMENT 32 |
| 524 |
|
| 525 |
/*}}}*/ |
| 526 |
/*{{{ Addressing Modes. */ |
| 527 |
|
| 528 |
/* A number, the maximum number of registers that can appear in a valid memory |
| 529 |
address. Note that it is up to you to specify a value equal to the maximum |
| 530 |
number that `GO_IF_LEGITIMATE_ADDRESS' would ever accept. */ |
| 531 |
#define MAX_REGS_PER_ADDRESS 1 |
| 532 |
|
| 533 |
/* A C compound statement with a conditional `goto LABEL;' executed if X (an |
| 534 |
RTX) is a legitimate memory address on the target machine for a memory |
| 535 |
operand of mode MODE. */ |
| 536 |
|
| 537 |
/* On the FR30 we only have one real addressing mode - an address in a |
| 538 |
register. There are three special cases however: |
| 539 |
|
| 540 |
* indexed addressing using small positive offsets from the stack pointer |
| 541 |
|
| 542 |
* indexed addressing using small signed offsets from the frame pointer |
| 543 |
|
| 544 |
* register plus register addressing using R13 as the base register. |
| 545 |
|
| 546 |
At the moment we only support the first two of these special cases. */ |
| 547 |
|
| 548 |
#ifdef REG_OK_STRICT |
| 549 |
#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ |
| 550 |
do \ |
| 551 |
{ \ |
| 552 |
if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \ |
| 553 |
goto LABEL; \ |
| 554 |
if (GET_CODE (X) == PLUS \ |
| 555 |
&& ((MODE) == SImode || (MODE) == SFmode) \ |
| 556 |
&& GET_CODE (XEXP (X, 0)) == REG \ |
| 557 |
&& REGNO (XEXP (X, 0)) == STACK_POINTER_REGNUM \ |
| 558 |
&& GET_CODE (XEXP (X, 1)) == CONST_INT \ |
| 559 |
&& IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 << 6) - 4)) \ |
| 560 |
goto LABEL; \ |
| 561 |
if (GET_CODE (X) == PLUS \ |
| 562 |
&& ((MODE) == SImode || (MODE) == SFmode) \ |
| 563 |
&& GET_CODE (XEXP (X, 0)) == REG \ |
| 564 |
&& REGNO (XEXP (X, 0)) == FRAME_POINTER_REGNUM \ |
| 565 |
&& GET_CODE (XEXP (X, 1)) == CONST_INT \ |
| 566 |
&& IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 << 9) - 4)) \ |
| 567 |
goto LABEL; \ |
| 568 |
} \ |
| 569 |
while (0) |
| 570 |
#else |
| 571 |
#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ |
| 572 |
do \ |
| 573 |
{ \ |
| 574 |
if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \ |
| 575 |
goto LABEL; \ |
| 576 |
if (GET_CODE (X) == PLUS \ |
| 577 |
&& ((MODE) == SImode || (MODE) == SFmode) \ |
| 578 |
&& GET_CODE (XEXP (X, 0)) == REG \ |
| 579 |
&& REGNO (XEXP (X, 0)) == STACK_POINTER_REGNUM \ |
| 580 |
&& GET_CODE (XEXP (X, 1)) == CONST_INT \ |
| 581 |
&& IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 << 6) - 4)) \ |
| 582 |
goto LABEL; \ |
| 583 |
if (GET_CODE (X) == PLUS \ |
| 584 |
&& ((MODE) == SImode || (MODE) == SFmode) \ |
| 585 |
&& GET_CODE (XEXP (X, 0)) == REG \ |
| 586 |
&& (REGNO (XEXP (X, 0)) == FRAME_POINTER_REGNUM \ |
| 587 |
|| REGNO (XEXP (X, 0)) == ARG_POINTER_REGNUM) \ |
| 588 |
&& GET_CODE (XEXP (X, 1)) == CONST_INT \ |
| 589 |
&& IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 << 9) - 4)) \ |
| 590 |
goto LABEL; \ |
| 591 |
} \ |
| 592 |
while (0) |
| 593 |
#endif |
| 594 |
|
| 595 |
/* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for |
| 596 |
use as a base register. For hard registers, it should always accept those |
| 597 |
which the hardware permits and reject the others. Whether the macro accepts |
| 598 |
or rejects pseudo registers must be controlled by `REG_OK_STRICT' as |
| 599 |
described above. This usually requires two variant definitions, of which |
| 600 |
`REG_OK_STRICT' controls the one actually used. */ |
| 601 |
#ifdef REG_OK_STRICT |
| 602 |
#define REG_OK_FOR_BASE_P(X) (((unsigned) REGNO (X)) <= STACK_POINTER_REGNUM) |
| 603 |
#else |
| 604 |
#define REG_OK_FOR_BASE_P(X) 1 |
| 605 |
#endif |
| 606 |
|
| 607 |
/* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for |
| 608 |
use as an index register. |
| 609 |
|
| 610 |
The difference between an index register and a base register is that the |
| 611 |
index register may be scaled. If an address involves the sum of two |
| 612 |
registers, neither one of them scaled, then either one may be labeled the |
| 613 |
"base" and the other the "index"; but whichever labeling is used must fit |
| 614 |
the machine's constraints of which registers may serve in each capacity. |
| 615 |
The compiler will try both labelings, looking for one that is valid, and |
| 616 |
will reload one or both registers only if neither labeling works. */ |
| 617 |
#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X) |
| 618 |
|
| 619 |
/*}}}*/ |
| 620 |
/*{{{ Describing Relative Costs of Operations */ |
| 621 |
|
| 622 |
/* Define this macro as a C expression which is nonzero if accessing less than |
| 623 |
a word of memory (i.e. a `char' or a `short') is no faster than accessing a |
| 624 |
word of memory, i.e., if such access require more than one instruction or if |
| 625 |
there is no difference in cost between byte and (aligned) word loads. |
| 626 |
|
| 627 |
When this macro is not defined, the compiler will access a field by finding |
| 628 |
the smallest containing object; when it is defined, a fullword load will be |
| 629 |
used if alignment permits. Unless bytes accesses are faster than word |
| 630 |
accesses, using word accesses is preferable since it may eliminate |
| 631 |
subsequent memory access if subsequent accesses occur to other fields in the |
| 632 |
same word of the structure, but to different bytes. */ |
| 633 |
#define SLOW_BYTE_ACCESS 1 |
| 634 |
|
| 635 |
/*}}}*/ |
| 636 |
/*{{{ Dividing the output into sections. */ |
| 637 |
|
| 638 |
/* A C expression whose value is a string containing the assembler operation |
| 639 |
that should precede instructions and read-only data. Normally `".text"' is |
| 640 |
right. */ |
| 641 |
#define TEXT_SECTION_ASM_OP "\t.text" |
| 642 |
|
| 643 |
/* A C expression whose value is a string containing the assembler operation to |
| 644 |
identify the following data as writable initialized data. Normally |
| 645 |
`".data"' is right. */ |
| 646 |
#define DATA_SECTION_ASM_OP "\t.data" |
| 647 |
|
| 648 |
#define BSS_SECTION_ASM_OP "\t.section .bss" |
| 649 |
|
| 650 |
/*}}}*/ |
| 651 |
/*{{{ The Overall Framework of an Assembler File. */ |
| 652 |
|
| 653 |
/* A C string constant describing how to begin a comment in the target |
| 654 |
assembler language. The compiler assumes that the comment will end at the |
| 655 |
end of the line. */ |
| 656 |
#define ASM_COMMENT_START ";" |
| 657 |
|
| 658 |
/* A C string constant for text to be output before each `asm' statement or |
| 659 |
group of consecutive ones. Normally this is `"#APP"', which is a comment |
| 660 |
that has no effect on most assemblers but tells the GNU assembler that it |
| 661 |
must check the lines that follow for all valid assembler constructs. */ |
| 662 |
#define ASM_APP_ON "#APP\n" |
| 663 |
|
| 664 |
/* A C string constant for text to be output after each `asm' statement or |
| 665 |
group of consecutive ones. Normally this is `"#NO_APP"', which tells the |
| 666 |
GNU assembler to resume making the time-saving assumptions that are valid |
| 667 |
for ordinary compiler output. */ |
| 668 |
#define ASM_APP_OFF "#NO_APP\n" |
| 669 |
|
| 670 |
/*}}}*/ |
| 671 |
/*{{{ Output and Generation of Labels. */ |
| 672 |
|
| 673 |
/* Globalizing directive for a label. */ |
| 674 |
#define GLOBAL_ASM_OP "\t.globl " |
| 675 |
|
| 676 |
/*}}}*/ |
| 677 |
/*{{{ Output of Assembler Instructions. */ |
| 678 |
|
| 679 |
/* A C compound statement to output to stdio stream STREAM the assembler syntax |
| 680 |
for an instruction operand X. X is an RTL expression. |
| 681 |
|
| 682 |
CODE is a value that can be used to specify one of several ways of printing |
| 683 |
the operand. It is used when identical operands must be printed differently |
| 684 |
depending on the context. CODE comes from the `%' specification that was |
| 685 |
used to request printing of the operand. If the specification was just |
| 686 |
`%DIGIT' then CODE is 0; if the specification was `%LTR DIGIT' then CODE is |
| 687 |
the ASCII code for LTR. |
| 688 |
|
| 689 |
If X is a register, this macro should print the register's name. The names |
| 690 |
can be found in an array `reg_names' whose type is `char *[]'. `reg_names' |
| 691 |
is initialized from `REGISTER_NAMES'. |
| 692 |
|
| 693 |
When the machine description has a specification `%PUNCT' (a `%' followed by |
| 694 |
a punctuation character), this macro is called with a null pointer for X and |
| 695 |
the punctuation character for CODE. */ |
| 696 |
#define PRINT_OPERAND(STREAM, X, CODE) fr30_print_operand (STREAM, X, CODE) |
| 697 |
|
| 698 |
/* A C expression which evaluates to true if CODE is a valid punctuation |
| 699 |
character for use in the `PRINT_OPERAND' macro. If |
| 700 |
`PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no punctuation |
| 701 |
characters (except for the standard one, `%') are used in this way. */ |
| 702 |
#define PRINT_OPERAND_PUNCT_VALID_P(CODE) (CODE == '#') |
| 703 |
|
| 704 |
/* A C compound statement to output to stdio stream STREAM the assembler syntax |
| 705 |
for an instruction operand that is a memory reference whose address is X. X |
| 706 |
is an RTL expression. */ |
| 707 |
|
| 708 |
#define PRINT_OPERAND_ADDRESS(STREAM, X) fr30_print_operand_address (STREAM, X) |
| 709 |
|
| 710 |
#define REGISTER_PREFIX "%" |
| 711 |
#define LOCAL_LABEL_PREFIX "." |
| 712 |
#define USER_LABEL_PREFIX "" |
| 713 |
#define IMMEDIATE_PREFIX "" |
| 714 |
|
| 715 |
/*}}}*/ |
| 716 |
/*{{{ Output of Dispatch Tables. */ |
| 717 |
|
| 718 |
/* This macro should be provided on machines where the addresses in a dispatch |
| 719 |
table are relative to the table's own address. |
| 720 |
|
| 721 |
The definition should be a C statement to output to the stdio stream STREAM |
| 722 |
an assembler pseudo-instruction to generate a difference between two labels. |
| 723 |
VALUE and REL are the numbers of two internal labels. The definitions of |
| 724 |
these labels are output using `(*targetm.asm_out.internal_label)', and they must be |
| 725 |
printed in the same way here. For example, |
| 726 |
|
| 727 |
fprintf (STREAM, "\t.word L%d-L%d\n", VALUE, REL) */ |
| 728 |
#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \ |
| 729 |
fprintf (STREAM, "\t.word .L%d-.L%d\n", VALUE, REL) |
| 730 |
|
| 731 |
/* This macro should be provided on machines where the addresses in a dispatch |
| 732 |
table are absolute. |
| 733 |
|
| 734 |
The definition should be a C statement to output to the stdio stream STREAM |
| 735 |
an assembler pseudo-instruction to generate a reference to a label. VALUE |
| 736 |
is the number of an internal label whose definition is output using |
| 737 |
`(*targetm.asm_out.internal_label)'. For example, |
| 738 |
|
| 739 |
fprintf (STREAM, "\t.word L%d\n", VALUE) */ |
| 740 |
#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \ |
| 741 |
fprintf (STREAM, "\t.word .L%d\n", VALUE) |
| 742 |
|
| 743 |
/*}}}*/ |
| 744 |
/*{{{ Assembler Commands for Alignment. */ |
| 745 |
|
| 746 |
/* A C statement to output to the stdio stream STREAM an assembler command to |
| 747 |
advance the location counter to a multiple of 2 to the POWER bytes. POWER |
| 748 |
will be a C expression of type `int'. */ |
| 749 |
#define ASM_OUTPUT_ALIGN(STREAM, POWER) \ |
| 750 |
fprintf ((STREAM), "\t.p2align %d\n", (POWER)) |
| 751 |
|
| 752 |
/*}}}*/ |
| 753 |
/*{{{ Miscellaneous Parameters. */ |
| 754 |
|
| 755 |
/* An alias for a machine mode name. This is the machine mode that elements of |
| 756 |
a jump-table should have. */ |
| 757 |
#define CASE_VECTOR_MODE SImode |
| 758 |
|
| 759 |
/* The maximum number of bytes that a single instruction can move quickly from |
| 760 |
memory to memory. */ |
| 761 |
#define MOVE_MAX 8 |
| 762 |
|
| 763 |
/* An alias for the machine mode for pointers. On most machines, define this |
| 764 |
to be the integer mode corresponding to the width of a hardware pointer; |
| 765 |
`SImode' on 32-bit machine or `DImode' on 64-bit machines. On some machines |
| 766 |
you must define this to be one of the partial integer modes, such as |
| 767 |
`PSImode'. |
| 768 |
|
| 769 |
The width of `Pmode' must be at least as large as the value of |
| 770 |
`POINTER_SIZE'. If it is not equal, you must define the macro |
| 771 |
`POINTERS_EXTEND_UNSIGNED' to specify how pointers are extended to `Pmode'. */ |
| 772 |
#define Pmode SImode |
| 773 |
|
| 774 |
/* An alias for the machine mode used for memory references to functions being |
| 775 |
called, in `call' RTL expressions. On most machines this should be |
| 776 |
`QImode'. */ |
| 777 |
#define FUNCTION_MODE QImode |
| 778 |
|
| 779 |
/*}}}*/ |
| 780 |
|
| 781 |
/* Local Variables: */ |
| 782 |
/* folded-file: t */ |
| 783 |
/* End: */ |