fr30.c (TARGET_PROMOTE_PROTOTYPES): New.
[gcc.git] / gcc / config / fr30 / fr30.h
1 /*{{{ Comment. */
2
3 /* Definitions of FR30 target.
4 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004
5 Free Software Foundation, Inc.
6 Contributed by Cygnus Solutions.
7
8 This file is part of GCC.
9
10 GCC is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
13 any later version.
14
15 GCC is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with GCC; see the file COPYING. If not, write to
22 the Free Software Foundation, 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
24
25 /*}}}*/ \f
26 /*{{{ Driver configuration. */
27
28 /* Defined in svr4.h. */
29 #undef SWITCH_TAKES_ARG
30
31 /* Defined in svr4.h. */
32 #undef WORD_SWITCH_TAKES_ARG
33
34 /*}}}*/ \f
35 /*{{{ Run-time target specifications. */
36
37 #undef ASM_SPEC
38 #define ASM_SPEC "%{v}"
39
40 /* Define this to be a string constant containing `-D' options to define the
41 predefined macros that identify this machine and system. These macros will
42 be predefined unless the `-ansi' option is specified. */
43
44 #define TARGET_CPU_CPP_BUILTINS() \
45 do \
46 { \
47 builtin_define_std ("fr30"); \
48 builtin_assert ("machine=fr30"); \
49 } \
50 while (0)
51
52 /* Use LDI:20 instead of LDI:32 to load addresses. */
53 #define TARGET_SMALL_MODEL_MASK (1 << 0)
54 #define TARGET_SMALL_MODEL (target_flags & TARGET_SMALL_MODEL_MASK)
55
56 #define TARGET_DEFAULT 0
57
58 /* This declaration should be present. */
59 extern int target_flags;
60
61 #define TARGET_SWITCHES \
62 { \
63 { "small-model", TARGET_SMALL_MODEL_MASK, \
64 N_("Assume small address space") }, \
65 { "no-small-model", - TARGET_SMALL_MODEL_MASK, "" }, \
66 { "no-lsim", 0, "" }, \
67 { "", TARGET_DEFAULT, "" } \
68 }
69
70 #define TARGET_VERSION fprintf (stderr, " (fr30)");
71
72 #define CAN_DEBUG_WITHOUT_FP
73
74 #undef STARTFILE_SPEC
75 #define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
76
77 /* Include the OS stub library, so that the code can be simulated.
78 This is not the right way to do this. Ideally this kind of thing
79 should be done in the linker script - but I have not worked out how
80 to specify the location of a linker script in a gcc command line yet... */
81 #undef ENDFILE_SPEC
82 #define ENDFILE_SPEC "%{!mno-lsim:-lsim} crtend.o%s crtn.o%s"
83
84 /*}}}*/ \f
85 /*{{{ Storage Layout. */
86
87 #define BITS_BIG_ENDIAN 1
88
89 #define BYTES_BIG_ENDIAN 1
90
91 #define WORDS_BIG_ENDIAN 1
92
93 #define UNITS_PER_WORD 4
94
95 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
96 do \
97 { \
98 if (GET_MODE_CLASS (MODE) == MODE_INT \
99 && GET_MODE_SIZE (MODE) < 4) \
100 (MODE) = SImode; \
101 } \
102 while (0)
103
104 #define PARM_BOUNDARY 32
105
106 #define STACK_BOUNDARY 32
107
108 #define FUNCTION_BOUNDARY 32
109
110 #define BIGGEST_ALIGNMENT 32
111
112 #define DATA_ALIGNMENT(TYPE, ALIGN) \
113 (TREE_CODE (TYPE) == ARRAY_TYPE \
114 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
115 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
116
117 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
118 (TREE_CODE (EXP) == STRING_CST \
119 && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
120
121 #define STRICT_ALIGNMENT 1
122
123 /* Defined in svr4.h. */
124 #define PCC_BITFIELD_TYPE_MATTERS 1
125
126 /*}}}*/ \f
127 /*{{{ Layout of Source Language Data Types. */
128
129 #define SHORT_TYPE_SIZE 16
130 #define INT_TYPE_SIZE 32
131 #define LONG_TYPE_SIZE 32
132 #define LONG_LONG_TYPE_SIZE 64
133 #define FLOAT_TYPE_SIZE 32
134 #define DOUBLE_TYPE_SIZE 64
135 #define LONG_DOUBLE_TYPE_SIZE 64
136
137 #define DEFAULT_SIGNED_CHAR 1
138
139 /*}}}*/ \f
140 /*{{{ REGISTER BASICS. */
141
142 /* Number of hardware registers known to the compiler. They receive numbers 0
143 through `FIRST_PSEUDO_REGISTER-1'; thus, the first pseudo register's number
144 really is assigned the number `FIRST_PSEUDO_REGISTER'. */
145 #define FIRST_PSEUDO_REGISTER 21
146
147 /* Fixed register assignments: */
148
149 /* Here we do a BAD THING - reserve a register for use by the machine
150 description file. There are too many places in compiler where it
151 assumes that it can issue a branch or jump instruction without
152 providing a scratch register for it, and reload just cannot cope, so
153 we keep a register back for these situations. */
154 #define COMPILER_SCRATCH_REGISTER 0
155
156 /* The register that contains the result of a function call. */
157 #define RETURN_VALUE_REGNUM 4
158
159 /* The first register that can contain the arguments to a function. */
160 #define FIRST_ARG_REGNUM 4
161
162 /* A call-used register that can be used during the function prologue. */
163 #define PROLOGUE_TMP_REGNUM COMPILER_SCRATCH_REGISTER
164
165 /* Register numbers used for passing a function's static chain pointer. If
166 register windows are used, the register number as seen by the called
167 function is `STATIC_CHAIN_INCOMING_REGNUM', while the register number as
168 seen by the calling function is `STATIC_CHAIN_REGNUM'. If these registers
169 are the same, `STATIC_CHAIN_INCOMING_REGNUM' need not be defined.
170
171 The static chain register need not be a fixed register.
172
173 If the static chain is passed in memory, these macros should not be defined;
174 instead, the next two macros should be defined. */
175 #define STATIC_CHAIN_REGNUM 12
176 /* #define STATIC_CHAIN_INCOMING_REGNUM */
177
178 /* An FR30 specific hardware register. */
179 #define ACCUMULATOR_REGNUM 13
180
181 /* The register number of the frame pointer register, which is used to access
182 automatic variables in the stack frame. On some machines, the hardware
183 determines which register this is. On other machines, you can choose any
184 register you wish for this purpose. */
185 #define FRAME_POINTER_REGNUM 14
186
187 /* The register number of the stack pointer register, which must also be a
188 fixed register according to `FIXED_REGISTERS'. On most machines, the
189 hardware determines which register this is. */
190 #define STACK_POINTER_REGNUM 15
191
192 /* The following a fake hard registers that describe some of the dedicated
193 registers on the FR30. */
194 #define CONDITION_CODE_REGNUM 16
195 #define RETURN_POINTER_REGNUM 17
196 #define MD_HIGH_REGNUM 18
197 #define MD_LOW_REGNUM 19
198
199 /* An initializer that says which registers are used for fixed purposes all
200 throughout the compiled code and are therefore not available for general
201 allocation. These would include the stack pointer, the frame pointer
202 (except on machines where that can be used as a general register when no
203 frame pointer is needed), the program counter on machines where that is
204 considered one of the addressable registers, and any other numbered register
205 with a standard use.
206
207 This information is expressed as a sequence of numbers, separated by commas
208 and surrounded by braces. The Nth number is 1 if register N is fixed, 0
209 otherwise.
210
211 The table initialized from this macro, and the table initialized by the
212 following one, may be overridden at run time either automatically, by the
213 actions of the macro `CONDITIONAL_REGISTER_USAGE', or by the user with the
214 command options `-ffixed-REG', `-fcall-used-REG' and `-fcall-saved-REG'. */
215 #define FIXED_REGISTERS \
216 { 1, 0, 0, 0, 0, 0, 0, 0, /* 0 - 7 */ \
217 0, 0, 0, 0, 0, 0, 0, 1, /* 8 - 15 */ \
218 1, 1, 1, 1, 1 } /* 16 - 20 */
219
220 /* XXX - MDL and MDH set as fixed for now - this is until I can get the
221 mul patterns working. */
222
223 /* Like `FIXED_REGISTERS' but has 1 for each register that is clobbered (in
224 general) by function calls as well as for fixed registers. This macro
225 therefore identifies the registers that are not available for general
226 allocation of values that must live across function calls.
227
228 If a register has 0 in `CALL_USED_REGISTERS', the compiler automatically
229 saves it on function entry and restores it on function exit, if the register
230 is used within the function. */
231 #define CALL_USED_REGISTERS \
232 { 1, 1, 1, 1, 1, 1, 1, 1, /* 0 - 7 */ \
233 0, 0, 0, 0, 1, 1, 0, 1, /* 8 - 15 */ \
234 1, 1, 1, 1, 1 } /* 16 - 20 */
235
236 /* A C initializer containing the assembler's names for the machine registers,
237 each one as a C string constant. This is what translates register numbers
238 in the compiler into assembler language. */
239 #define REGISTER_NAMES \
240 { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
241 "r8", "r9", "r10", "r11", "r12", "ac", "fp", "sp", \
242 "cc", "rp", "mdh", "mdl", "ap" \
243 }
244
245 /* If defined, a C initializer for an array of structures containing a name and
246 a register number. This macro defines additional names for hard registers,
247 thus allowing the `asm' option in declarations to refer to registers using
248 alternate names. */
249 #define ADDITIONAL_REGISTER_NAMES \
250 { \
251 {"r13", 13}, {"r14", 14}, {"r15", 15}, {"usp", 15}, {"ps", 16}\
252 }
253
254 /*}}}*/ \f
255 /*{{{ How Values Fit in Registers. */
256
257 /* A C expression for the number of consecutive hard registers, starting at
258 register number REGNO, required to hold a value of mode MODE. */
259
260 #define HARD_REGNO_NREGS(REGNO, MODE) \
261 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
262
263 /* A C expression that is nonzero if it is permissible to store a value of mode
264 MODE in hard register number REGNO (or in several registers starting with
265 that one). */
266
267 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
268
269 /* A C expression that is nonzero if it is desirable to choose register
270 allocation so as to avoid move instructions between a value of mode MODE1
271 and a value of mode MODE2.
272
273 If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R, MODE2)' are
274 ever different for any R, then `MODES_TIEABLE_P (MODE1, MODE2)' must be
275 zero. */
276 #define MODES_TIEABLE_P(MODE1, MODE2) 1
277
278 /*}}}*/ \f
279 /*{{{ Register Classes. */
280
281 /* An enumeral type that must be defined with all the register class names as
282 enumeral values. `NO_REGS' must be first. `ALL_REGS' must be the last
283 register class, followed by one more enumeral value, `LIM_REG_CLASSES',
284 which is not a register class but rather tells how many classes there are.
285
286 Each register class has a number, which is the value of casting the class
287 name to type `int'. The number serves as an index in many of the tables
288 described below. */
289 enum reg_class
290 {
291 NO_REGS,
292 MULTIPLY_32_REG, /* the MDL register as used by the MULH, MULUH insns */
293 MULTIPLY_64_REG, /* the MDH,MDL register pair as used by MUL and MULU */
294 LOW_REGS, /* registers 0 through 7 */
295 HIGH_REGS, /* registers 8 through 15 */
296 REAL_REGS, /* ie all the general hardware registers on the FR30 */
297 ALL_REGS,
298 LIM_REG_CLASSES
299 };
300
301 #define GENERAL_REGS REAL_REGS
302 #define N_REG_CLASSES ((int) LIM_REG_CLASSES)
303
304 /* An initializer containing the names of the register classes as C string
305 constants. These names are used in writing some of the debugging dumps. */
306 #define REG_CLASS_NAMES \
307 { \
308 "NO_REGS", \
309 "MULTIPLY_32_REG", \
310 "MULTIPLY_64_REG", \
311 "LOW_REGS", \
312 "HIGH_REGS", \
313 "REAL_REGS", \
314 "ALL_REGS" \
315 }
316
317 /* An initializer containing the contents of the register classes, as integers
318 which are bit masks. The Nth integer specifies the contents of class N.
319 The way the integer MASK is interpreted is that register R is in the class
320 if `MASK & (1 << R)' is 1.
321
322 When the machine has more than 32 registers, an integer does not suffice.
323 Then the integers are replaced by sub-initializers, braced groupings
324 containing several integers. Each sub-initializer must be suitable as an
325 initializer for the type `HARD_REG_SET' which is defined in
326 `hard-reg-set.h'. */
327 #define REG_CLASS_CONTENTS \
328 { \
329 { 0 }, \
330 { 1 << MD_LOW_REGNUM }, \
331 { (1 << MD_LOW_REGNUM) | (1 << MD_HIGH_REGNUM) }, \
332 { (1 << 8) - 1 }, \
333 { ((1 << 8) - 1) << 8 }, \
334 { (1 << CONDITION_CODE_REGNUM) - 1 }, \
335 { (1 << FIRST_PSEUDO_REGISTER) - 1 } \
336 }
337
338 /* A C expression whose value is a register class containing hard register
339 REGNO. In general there is more than one such class; choose a class which
340 is "minimal", meaning that no smaller class also contains the register. */
341 #define REGNO_REG_CLASS(REGNO) \
342 ( (REGNO) < 8 ? LOW_REGS \
343 : (REGNO) < CONDITION_CODE_REGNUM ? HIGH_REGS \
344 : (REGNO) == MD_LOW_REGNUM ? MULTIPLY_32_REG \
345 : (REGNO) == MD_HIGH_REGNUM ? MULTIPLY_64_REG \
346 : ALL_REGS)
347
348 /* A macro whose definition is the name of the class to which a valid base
349 register must belong. A base register is one used in an address which is
350 the register value plus a displacement. */
351 #define BASE_REG_CLASS REAL_REGS
352
353 /* A macro whose definition is the name of the class to which a valid index
354 register must belong. An index register is one used in an address where its
355 value is either multiplied by a scale factor or added to another register
356 (as well as added to a displacement). */
357 #define INDEX_REG_CLASS REAL_REGS
358
359 /* A C expression which defines the machine-dependent operand constraint
360 letters for register classes. If CHAR is such a letter, the value should be
361 the register class corresponding to it. Otherwise, the value should be
362 `NO_REGS'. The register letter `r', corresponding to class `GENERAL_REGS',
363 will not be passed to this macro; you do not need to handle it.
364
365 The following letters are unavailable, due to being used as
366 constraints:
367 '0'..'9'
368 '<', '>'
369 'E', 'F', 'G', 'H'
370 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P'
371 'Q', 'R', 'S', 'T', 'U'
372 'V', 'X'
373 'g', 'i', 'm', 'n', 'o', 'p', 'r', 's' */
374
375 #define REG_CLASS_FROM_LETTER(CHAR) \
376 ( (CHAR) == 'd' ? MULTIPLY_64_REG \
377 : (CHAR) == 'e' ? MULTIPLY_32_REG \
378 : (CHAR) == 'h' ? HIGH_REGS \
379 : (CHAR) == 'l' ? LOW_REGS \
380 : (CHAR) == 'a' ? ALL_REGS \
381 : NO_REGS)
382
383 /* A C expression which is nonzero if register number NUM is suitable for use
384 as a base register in operand addresses. It may be either a suitable hard
385 register or a pseudo register that has been allocated such a hard register. */
386 #define REGNO_OK_FOR_BASE_P(NUM) 1
387
388 /* A C expression which is nonzero if register number NUM is suitable for use
389 as an index register in operand addresses. It may be either a suitable hard
390 register or a pseudo register that has been allocated such a hard register.
391
392 The difference between an index register and a base register is that the
393 index register may be scaled. If an address involves the sum of two
394 registers, neither one of them scaled, then either one may be labeled the
395 "base" and the other the "index"; but whichever labeling is used must fit
396 the machine's constraints of which registers may serve in each capacity.
397 The compiler will try both labelings, looking for one that is valid, and
398 will reload one or both registers only if neither labeling works. */
399 #define REGNO_OK_FOR_INDEX_P(NUM) 1
400
401 /* A C expression that places additional restrictions on the register class to
402 use when it is necessary to copy value X into a register in class CLASS.
403 The value is a register class; perhaps CLASS, or perhaps another, smaller
404 class. On many machines, the following definition is safe:
405
406 #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
407
408 Sometimes returning a more restrictive class makes better code. For
409 example, on the 68000, when X is an integer constant that is in range for a
410 `moveq' instruction, the value of this macro is always `DATA_REGS' as long
411 as CLASS includes the data registers. Requiring a data register guarantees
412 that a `moveq' will be used.
413
414 If X is a `const_double', by returning `NO_REGS' you can force X into a
415 memory constant. This is useful on certain machines where immediate
416 floating values cannot be loaded into certain kinds of registers. */
417 #define PREFERRED_RELOAD_CLASS(X, CLASS) CLASS
418
419 /* A C expression for the maximum number of consecutive registers of
420 class CLASS needed to hold a value of mode MODE.
421
422 This is closely related to the macro `HARD_REGNO_NREGS'. In fact, the value
423 of the macro `CLASS_MAX_NREGS (CLASS, MODE)' should be the maximum value of
424 `HARD_REGNO_NREGS (REGNO, MODE)' for all REGNO values in the class CLASS.
425
426 This macro helps control the handling of multiple-word values in
427 the reload pass. */
428 #define CLASS_MAX_NREGS(CLASS, MODE) HARD_REGNO_NREGS (0, MODE)
429
430 /*}}}*/ \f
431 /*{{{ CONSTANTS. */
432
433 /* A C expression that defines the machine-dependent operand constraint letters
434 (`I', `J', `K', .. 'P') that specify particular ranges of integer values.
435 If C is one of those letters, the expression should check that VALUE, an
436 integer, is in the appropriate range and return 1 if so, 0 otherwise. If C
437 is not one of those letters, the value should be 0 regardless of VALUE. */
438 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
439 ( (C) == 'I' ? IN_RANGE (VALUE, 0, 15) \
440 : (C) == 'J' ? IN_RANGE (VALUE, -16, -1) \
441 : (C) == 'K' ? IN_RANGE (VALUE, 16, 31) \
442 : (C) == 'L' ? IN_RANGE (VALUE, 0, (1 << 8) - 1) \
443 : (C) == 'M' ? IN_RANGE (VALUE, 0, (1 << 20) - 1) \
444 : (C) == 'P' ? IN_RANGE (VALUE, -(1 << 8), (1 << 8) - 1) \
445 : 0)
446
447 /* A C expression that defines the machine-dependent operand constraint letters
448 (`G', `H') that specify particular ranges of `const_double' values.
449
450 If C is one of those letters, the expression should check that VALUE, an RTX
451 of code `const_double', is in the appropriate range and return 1 if so, 0
452 otherwise. If C is not one of those letters, the value should be 0
453 regardless of VALUE.
454
455 `const_double' is used for all floating-point constants and for `DImode'
456 fixed-point constants. A given letter can accept either or both kinds of
457 values. It can use `GET_MODE' to distinguish between these kinds. */
458 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
459
460 /* A C expression that defines the optional machine-dependent constraint
461 letters (`Q', `R', `S', `T', `U') that can be used to segregate specific
462 types of operands, usually memory references, for the target machine.
463 Normally this macro will not be defined. If it is required for a particular
464 target machine, it should return 1 if VALUE corresponds to the operand type
465 represented by the constraint letter C. If C is not defined as an extra
466 constraint, the value returned should be 0 regardless of VALUE.
467
468 For example, on the ROMP, load instructions cannot have their output in r0
469 if the memory reference contains a symbolic address. Constraint letter `Q'
470 is defined as representing a memory address that does *not* contain a
471 symbolic address. An alternative is specified with a `Q' constraint on the
472 input and `r' on the output. The next alternative specifies `m' on the
473 input and a register class that does not include r0 on the output. */
474 #define EXTRA_CONSTRAINT(VALUE, C) \
475 ((C) == 'Q' ? (GET_CODE (VALUE) == MEM && GET_CODE (XEXP (VALUE, 0)) == SYMBOL_REF) : 0)
476
477 /*}}}*/ \f
478 /*{{{ Basic Stack Layout. */
479
480 /* Define this macro if pushing a word onto the stack moves the stack pointer
481 to a smaller address. */
482 #define STACK_GROWS_DOWNWARD 1
483
484 /* Define this macro if the addresses of local variable slots are at negative
485 offsets from the frame pointer. */
486 #define FRAME_GROWS_DOWNWARD 1
487
488 /* Offset from the frame pointer to the first local variable slot to be
489 allocated.
490
491 If `FRAME_GROWS_DOWNWARD', find the next slot's offset by subtracting the
492 first slot's length from `STARTING_FRAME_OFFSET'. Otherwise, it is found by
493 adding the length of the first slot to the value `STARTING_FRAME_OFFSET'. */
494 /* #define STARTING_FRAME_OFFSET -4 */
495 #define STARTING_FRAME_OFFSET 0
496
497 /* Offset from the stack pointer register to the first location at which
498 outgoing arguments are placed. If not specified, the default value of zero
499 is used. This is the proper value for most machines.
500
501 If `ARGS_GROW_DOWNWARD', this is the offset to the location above the first
502 location at which outgoing arguments are placed. */
503 #define STACK_POINTER_OFFSET 0
504
505 /* Offset from the argument pointer register to the first argument's address.
506 On some machines it may depend on the data type of the function.
507
508 If `ARGS_GROW_DOWNWARD', this is the offset to the location above the first
509 argument's address. */
510 #define FIRST_PARM_OFFSET(FUNDECL) 0
511
512 /* A C expression whose value is RTL representing the location of the incoming
513 return address at the beginning of any function, before the prologue. This
514 RTL is either a `REG', indicating that the return value is saved in `REG',
515 or a `MEM' representing a location in the stack.
516
517 You only need to define this macro if you want to support call frame
518 debugging information like that provided by DWARF 2. */
519 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (SImode, RETURN_POINTER_REGNUM)
520
521 /*}}}*/ \f
522 /*{{{ Register That Address the Stack Frame. */
523
524 /* The register number of the arg pointer register, which is used to access the
525 function's argument list. On some machines, this is the same as the frame
526 pointer register. On some machines, the hardware determines which register
527 this is. On other machines, you can choose any register you wish for this
528 purpose. If this is not the same register as the frame pointer register,
529 then you must mark it as a fixed register according to `FIXED_REGISTERS', or
530 arrange to be able to eliminate it. */
531 #define ARG_POINTER_REGNUM 20
532
533 /*}}}*/ \f
534 /*{{{ Eliminating the Frame Pointer and the Arg Pointer. */
535
536 /* A C expression which is nonzero if a function must have and use a frame
537 pointer. This expression is evaluated in the reload pass. If its value is
538 nonzero the function will have a frame pointer.
539
540 The expression can in principle examine the current function and decide
541 according to the facts, but on most machines the constant 0 or the constant
542 1 suffices. Use 0 when the machine allows code to be generated with no
543 frame pointer, and doing so saves some time or space. Use 1 when there is
544 no possible advantage to avoiding a frame pointer.
545
546 In certain cases, the compiler does not know how to produce valid code
547 without a frame pointer. The compiler recognizes those cases and
548 automatically gives the function a frame pointer regardless of what
549 `FRAME_POINTER_REQUIRED' says. You don't need to worry about them.
550
551 In a function that does not require a frame pointer, the frame pointer
552 register can be allocated for ordinary usage, unless you mark it as a fixed
553 register. See `FIXED_REGISTERS' for more information. */
554 /* #define FRAME_POINTER_REQUIRED 0 */
555 #define FRAME_POINTER_REQUIRED \
556 (flag_omit_frame_pointer == 0 || current_function_pretend_args_size > 0)
557
558 /* If defined, this macro specifies a table of register pairs used to eliminate
559 unneeded registers that point into the stack frame. If it is not defined,
560 the only elimination attempted by the compiler is to replace references to
561 the frame pointer with references to the stack pointer.
562
563 The definition of this macro is a list of structure initializations, each of
564 which specifies an original and replacement register.
565
566 On some machines, the position of the argument pointer is not known until
567 the compilation is completed. In such a case, a separate hard register must
568 be used for the argument pointer. This register can be eliminated by
569 replacing it with either the frame pointer or the argument pointer,
570 depending on whether or not the frame pointer has been eliminated.
571
572 In this case, you might specify:
573 #define ELIMINABLE_REGS \
574 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
575 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
576 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
577
578 Note that the elimination of the argument pointer with the stack pointer is
579 specified first since that is the preferred elimination. */
580
581 #define ELIMINABLE_REGS \
582 { \
583 {ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
584 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
585 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM} \
586 }
587
588 /* A C expression that returns nonzero if the compiler is allowed to try to
589 replace register number FROM with register number TO. This macro
590 need only be defined if `ELIMINABLE_REGS' is defined, and will usually be
591 the constant 1, since most of the cases preventing register elimination are
592 things that the compiler already knows about. */
593
594 #define CAN_ELIMINATE(FROM, TO) \
595 ((TO) == FRAME_POINTER_REGNUM || ! frame_pointer_needed)
596
597 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It specifies the
598 initial difference between the specified pair of registers. This macro must
599 be defined if `ELIMINABLE_REGS' is defined. */
600 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
601 (OFFSET) = fr30_compute_frame_size (FROM, TO)
602
603 /*}}}*/ \f
604 /*{{{ Passing Function Arguments on the Stack. */
605
606 /* If defined, the maximum amount of space required for outgoing arguments will
607 be computed and placed into the variable
608 `current_function_outgoing_args_size'. No space will be pushed onto the
609 stack for each call; instead, the function prologue should increase the
610 stack frame size by this amount.
611
612 Defining both `PUSH_ROUNDING' and `ACCUMULATE_OUTGOING_ARGS' is not
613 proper. */
614 #define ACCUMULATE_OUTGOING_ARGS 1
615
616 /* A C expression that should indicate the number of bytes of its own arguments
617 that a function pops on returning, or 0 if the function pops no arguments
618 and the caller must therefore pop them all after the function returns.
619
620 FUNDECL is a C variable whose value is a tree node that describes the
621 function in question. Normally it is a node of type `FUNCTION_DECL' that
622 describes the declaration of the function. From this it is possible to
623 obtain the DECL_ATTRIBUTES of the function.
624
625 FUNTYPE is a C variable whose value is a tree node that describes the
626 function in question. Normally it is a node of type `FUNCTION_TYPE' that
627 describes the data type of the function. From this it is possible to obtain
628 the data types of the value and arguments (if known).
629
630 When a call to a library function is being considered, FUNTYPE will contain
631 an identifier node for the library function. Thus, if you need to
632 distinguish among various library functions, you can do so by their names.
633 Note that "library function" in this context means a function used to
634 perform arithmetic, whose name is known specially in the compiler and was
635 not mentioned in the C code being compiled.
636
637 STACK-SIZE is the number of bytes of arguments passed on the stack. If a
638 variable number of bytes is passed, it is zero, and argument popping will
639 always be the responsibility of the calling function.
640
641 On the VAX, all functions always pop their arguments, so the definition of
642 this macro is STACK-SIZE. On the 68000, using the standard calling
643 convention, no functions pop their arguments, so the value of the macro is
644 always 0 in this case. But an alternative calling convention is available
645 in which functions that take a fixed number of arguments pop them but other
646 functions (such as `printf') pop nothing (the caller pops all). When this
647 convention is in use, FUNTYPE is examined to determine whether a function
648 takes a fixed number of arguments. */
649 #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
650
651 /* Implement `va_arg'. */
652 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
653 fr30_va_arg (valist, type)
654
655 /*}}}*/ \f
656 /*{{{ Function Arguments in Registers. */
657
658 /* Nonzero if we do not know how to pass TYPE solely in registers.
659 We cannot do so in the following cases:
660
661 - if the type has variable size
662 - if the type is marked as addressable (it is required to be constructed
663 into the stack)
664 - if the type is a structure or union. */
665
666 #define MUST_PASS_IN_STACK(MODE, TYPE) \
667 (((MODE) == BLKmode) \
668 || ((TYPE) != NULL \
669 && TYPE_SIZE (TYPE) != NULL \
670 && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \
671 || TREE_CODE (TYPE) == RECORD_TYPE \
672 || TREE_CODE (TYPE) == UNION_TYPE \
673 || TREE_CODE (TYPE) == QUAL_UNION_TYPE \
674 || TREE_ADDRESSABLE (TYPE))))
675
676 /* The number of register assigned to holding function arguments. */
677
678 #define FR30_NUM_ARG_REGS 4
679
680 /* A C expression that controls whether a function argument is passed in a
681 register, and which register.
682
683 The usual way to make the ANSI library `stdarg.h' work on a machine where
684 some arguments are usually passed in registers, is to cause nameless
685 arguments to be passed on the stack instead. This is done by making
686 `FUNCTION_ARG' return 0 whenever NAMED is 0.
687
688 You may use the macro `MUST_PASS_IN_STACK (MODE, TYPE)' in the definition of
689 this macro to determine if this argument is of a type that must be passed in
690 the stack. If `REG_PARM_STACK_SPACE' is not defined and `FUNCTION_ARG'
691 returns nonzero for such an argument, the compiler will abort. If
692 `REG_PARM_STACK_SPACE' is defined, the argument will be computed in the
693 stack and then loaded into a register. */
694
695 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
696 ( (NAMED) == 0 ? NULL_RTX \
697 : MUST_PASS_IN_STACK (MODE, TYPE) ? NULL_RTX \
698 : (CUM) >= FR30_NUM_ARG_REGS ? NULL_RTX \
699 : gen_rtx (REG, MODE, CUM + FIRST_ARG_REGNUM))
700
701 /* A C type for declaring a variable that is used as the first argument of
702 `FUNCTION_ARG' and other related values. For some target machines, the type
703 `int' suffices and can hold the number of bytes of argument so far.
704
705 There is no need to record in `CUMULATIVE_ARGS' anything about the arguments
706 that have been passed on the stack. The compiler has other variables to
707 keep track of that. For target machines on which all arguments are passed
708 on the stack, there is no need to store anything in `CUMULATIVE_ARGS';
709 however, the data structure must exist and should not be empty, so use
710 `int'. */
711 /* On the FR30 this value is an accumulating count of the number of argument
712 registers that have been filled with argument values, as opposed to say,
713 the number of bytes of argument accumulated so far. */
714 #define CUMULATIVE_ARGS int
715
716 /* A C expression for the number of words, at the beginning of an argument,
717 must be put in registers. The value must be zero for arguments that are
718 passed entirely in registers or that are entirely pushed on the stack.
719
720 On some machines, certain arguments must be passed partially in registers
721 and partially in memory. On these machines, typically the first N words of
722 arguments are passed in registers, and the rest on the stack. If a
723 multi-word argument (a `double' or a structure) crosses that boundary, its
724 first few words must be passed in registers and the rest must be pushed.
725 This macro tells the compiler when this occurs, and how many of the words
726 should go in registers.
727
728 `FUNCTION_ARG' for these arguments should return the first register to be
729 used by the caller for this argument; likewise `FUNCTION_INCOMING_ARG', for
730 the called function. */
731 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
732 fr30_function_arg_partial_nregs (CUM, MODE, TYPE, NAMED)
733
734 /* A C expression that indicates when an argument must be passed by reference.
735 If nonzero for an argument, a copy of that argument is made in memory and a
736 pointer to the argument is passed instead of the argument itself. The
737 pointer is passed in whatever way is appropriate for passing a pointer to
738 that type.
739
740 On machines where `REG_PARM_STACK_SPACE' is not defined, a suitable
741 definition of this macro might be:
742 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
743 MUST_PASS_IN_STACK (MODE, TYPE) */
744 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
745 MUST_PASS_IN_STACK (MODE, TYPE)
746
747 /* A C statement (sans semicolon) for initializing the variable CUM for the
748 state at the beginning of the argument list. The variable has type
749 `CUMULATIVE_ARGS'. The value of FNTYPE is the tree node for the data type
750 of the function which will receive the args, or 0 if the args are to a
751 compiler support library function. The value of INDIRECT is nonzero when
752 processing an indirect call, for example a call through a function pointer.
753 The value of INDIRECT is zero for a call to an explicitly named function, a
754 library function call, or when `INIT_CUMULATIVE_ARGS' is used to find
755 arguments for the function being compiled.
756
757 When processing a call to a compiler support library function, LIBNAME
758 identifies which one. It is a `symbol_ref' rtx which contains the name of
759 the function, as a string. LIBNAME is 0 when an ordinary C function call is
760 being processed. Thus, each time this macro is called, either LIBNAME or
761 FNTYPE is nonzero, but never both of them at once. */
762 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) (CUM) = 0
763
764 /* A C statement (sans semicolon) to update the summarizer variable CUM to
765 advance past an argument in the argument list. The values MODE, TYPE and
766 NAMED describe that argument. Once this is done, the variable CUM is
767 suitable for analyzing the *following* argument with `FUNCTION_ARG', etc.
768
769 This macro need not do anything if the argument in question was passed on
770 the stack. The compiler knows how to track the amount of stack space used
771 for arguments without any special help. */
772 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
773 (CUM) += (NAMED) * fr30_num_arg_regs (MODE, TYPE)
774
775 /* A C expression that is nonzero if REGNO is the number of a hard register in
776 which function arguments are sometimes passed. This does *not* include
777 implicit arguments such as the static chain and the structure-value address.
778 On many machines, no registers can be used for this purpose since all
779 function arguments are pushed on the stack. */
780 #define FUNCTION_ARG_REGNO_P(REGNO) \
781 ((REGNO) >= FIRST_ARG_REGNUM && ((REGNO) < FIRST_ARG_REGNUM + FR30_NUM_ARG_REGS))
782
783 /*}}}*/ \f
784 /*{{{ How Scalar Function Values are Returned. */
785
786 /* A C expression to create an RTX representing the place where a function
787 returns a value of data type VALTYPE. VALTYPE is a tree node representing a
788 data type. Write `TYPE_MODE (VALTYPE)' to get the machine mode used to
789 represent that type. On many machines, only the mode is relevant.
790 (Actually, on most machines, scalar values are returned in the same place
791 regardless of mode).
792
793 If `PROMOTE_FUNCTION_RETURN' is defined, you must apply the same promotion
794 rules specified in `PROMOTE_MODE' if VALTYPE is a scalar type.
795
796 If the precise function being called is known, FUNC is a tree node
797 (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This makes it
798 possible to use a different value-returning convention for specific
799 functions when all their calls are known.
800
801 `FUNCTION_VALUE' is not used for return vales with aggregate data types,
802 because these are returned in another way. See `STRUCT_VALUE_REGNUM' and
803 related macros, below. */
804 #define FUNCTION_VALUE(VALTYPE, FUNC) \
805 gen_rtx_REG (TYPE_MODE (VALTYPE), RETURN_VALUE_REGNUM)
806
807 /* A C expression to create an RTX representing the place where a library
808 function returns a value of mode MODE. If the precise function being called
809 is known, FUNC is a tree node (`FUNCTION_DECL') for it; otherwise, FUNC is a
810 null pointer. This makes it possible to use a different value-returning
811 convention for specific functions when all their calls are known.
812
813 Note that "library function" in this context means a compiler support
814 routine, used to perform arithmetic, whose name is known specially by the
815 compiler and was not mentioned in the C code being compiled.
816
817 The definition of `LIBRARY_VALUE' need not be concerned aggregate data
818 types, because none of the library functions returns such types. */
819 #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, RETURN_VALUE_REGNUM)
820
821 /* A C expression that is nonzero if REGNO is the number of a hard register in
822 which the values of called function may come back. */
823
824 #define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == RETURN_VALUE_REGNUM)
825
826 /*}}}*/ \f
827 /*{{{ How Large Values are Returned. */
828
829 /* Define this macro to be 1 if all structure and union return values must be
830 in memory. Since this results in slower code, this should be defined only
831 if needed for compatibility with other compilers or with an ABI. If you
832 define this macro to be 0, then the conventions used for structure and union
833 return values are decided by the `RETURN_IN_MEMORY' macro.
834
835 If not defined, this defaults to the value 1. */
836 #define DEFAULT_PCC_STRUCT_RETURN 1
837
838 /* If the structure value address is not passed in a register, define
839 `STRUCT_VALUE' as an expression returning an RTX for the place where the
840 address is passed. If it returns 0, the address is passed as an "invisible"
841 first argument. */
842 #define STRUCT_VALUE 0
843
844 /*}}}*/ \f
845 /*{{{ Generating Code for Profiling. */
846
847 /* A C statement or compound statement to output to FILE some assembler code to
848 call the profiling subroutine `mcount'. Before calling, the assembler code
849 must load the address of a counter variable into a register where `mcount'
850 expects to find the address. The name of this variable is `LP' followed by
851 the number LABELNO, so you would generate the name using `LP%d' in a
852 `fprintf'.
853
854 The details of how the address should be passed to `mcount' are determined
855 by your operating system environment, not by GCC. To figure them out,
856 compile a small program for profiling using the system's installed C
857 compiler and look at the assembler code that results. */
858 #define FUNCTION_PROFILER(FILE, LABELNO) \
859 { \
860 fprintf (FILE, "\t mov rp, r1\n" ); \
861 fprintf (FILE, "\t ldi:32 mcount, r0\n" ); \
862 fprintf (FILE, "\t call @r0\n" ); \
863 fprintf (FILE, ".word\tLP%d\n", LABELNO); \
864 }
865
866 /*}}}*/ \f
867 /*{{{ Implementing the VARARGS Macros. */
868
869 /* This macro offers an alternative to using `__builtin_saveregs' and defining
870 the macro `EXPAND_BUILTIN_SAVEREGS'. Use it to store the anonymous register
871 arguments into the stack so that all the arguments appear to have been
872 passed consecutively on the stack. Once this is done, you can use the
873 standard implementation of varargs that works for machines that pass all
874 their arguments on the stack.
875
876 The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure, containing
877 the values that obtain after processing of the named arguments. The
878 arguments MODE and TYPE describe the last named argument--its machine mode
879 and its data type as a tree node.
880
881 The macro implementation should do two things: first, push onto the stack
882 all the argument registers *not* used for the named arguments, and second,
883 store the size of the data thus pushed into the `int'-valued variable whose
884 name is supplied as the argument PRETEND_ARGS_SIZE. The value that you
885 store here will serve as additional offset for setting up the stack frame.
886
887 Because you must generate code to push the anonymous arguments at compile
888 time without knowing their data types, `SETUP_INCOMING_VARARGS' is only
889 useful on machines that have just a single category of argument register and
890 use it uniformly for all data types.
891
892 If the argument SECOND_TIME is nonzero, it means that the arguments of the
893 function are being analyzed for the second time. This happens for an inline
894 function, which is not actually compiled until the end of the source file.
895 The macro `SETUP_INCOMING_VARARGS' should not generate any instructions in
896 this case. */
897 #define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_ARGS_SIZE, SECOND_TIME) \
898 if (! SECOND_TIME) \
899 fr30_setup_incoming_varargs (ARGS_SO_FAR, MODE, TYPE, & PRETEND_ARGS_SIZE)
900
901 /*}}}*/ \f
902 /*{{{ Trampolines for Nested Functions. */
903
904 /* On the FR30, the trampoline is:
905
906 nop
907 ldi:32 STATIC, r12
908 nop
909 ldi:32 FUNCTION, r0
910 jmp @r0
911
912 The no-ops are to guarantee that the static chain and final
913 target are 32 bit aligned within the trampoline. That allows us to
914 initialize those locations with simple SImode stores. The alternative
915 would be to use HImode stores. */
916
917 /* A C statement to output, on the stream FILE, assembler code for a block of
918 data that contains the constant parts of a trampoline. This code should not
919 include a label--the label is taken care of automatically. */
920 #define TRAMPOLINE_TEMPLATE(FILE) \
921 { \
922 fprintf (FILE, "\tnop\n"); \
923 fprintf (FILE, "\tldi:32\t#0, %s\n", reg_names [STATIC_CHAIN_REGNUM]); \
924 fprintf (FILE, "\tnop\n"); \
925 fprintf (FILE, "\tldi:32\t#0, %s\n", reg_names [COMPILER_SCRATCH_REGISTER]); \
926 fprintf (FILE, "\tjmp\t@%s\n", reg_names [COMPILER_SCRATCH_REGISTER]); \
927 }
928
929 /* A C expression for the size in bytes of the trampoline, as an integer. */
930 #define TRAMPOLINE_SIZE 18
931
932 /* We want the trampoline to be aligned on a 32bit boundary so that we can
933 make sure the location of the static chain & target function within
934 the trampoline is also aligned on a 32bit boundary. */
935 #define TRAMPOLINE_ALIGNMENT 32
936
937 /* A C statement to initialize the variable parts of a trampoline. ADDR is an
938 RTX for the address of the trampoline; FNADDR is an RTX for the address of
939 the nested function; STATIC_CHAIN is an RTX for the static chain value that
940 should be passed to the function when it is called. */
941 #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN) \
942 do \
943 { \
944 emit_move_insn (gen_rtx (MEM, SImode, plus_constant (ADDR, 4)), STATIC_CHAIN);\
945 emit_move_insn (gen_rtx (MEM, SImode, plus_constant (ADDR, 12)), FNADDR); \
946 } while (0);
947
948 /*}}}*/ \f
949 /*{{{ Addressing Modes. */
950
951 /* A C expression that is 1 if the RTX X is a constant which is a valid
952 address. On most machines, this can be defined as `CONSTANT_P (X)', but a
953 few machines are more restrictive in which constant addresses are supported.
954
955 `CONSTANT_P' accepts integer-values expressions whose values are not
956 explicitly known, such as `symbol_ref', `label_ref', and `high' expressions
957 and `const' arithmetic expressions, in addition to `const_int' and
958 `const_double' expressions. */
959 #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
960
961 /* A number, the maximum number of registers that can appear in a valid memory
962 address. Note that it is up to you to specify a value equal to the maximum
963 number that `GO_IF_LEGITIMATE_ADDRESS' would ever accept. */
964 #define MAX_REGS_PER_ADDRESS 1
965
966 /* A C compound statement with a conditional `goto LABEL;' executed if X (an
967 RTX) is a legitimate memory address on the target machine for a memory
968 operand of mode MODE. */
969
970 /* On the FR30 we only have one real addressing mode - an address in a
971 register. There are three special cases however:
972
973 * indexed addressing using small positive offsets from the stack pointer
974
975 * indexed addressing using small signed offsets from the frame pointer
976
977 * register plus register addressing using R13 as the base register.
978
979 At the moment we only support the first two of these special cases. */
980
981 #ifdef REG_OK_STRICT
982 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
983 do \
984 { \
985 if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
986 goto LABEL; \
987 if (GET_CODE (X) == PLUS \
988 && ((MODE) == SImode || (MODE) == SFmode) \
989 && XEXP (X, 0) == stack_pointer_rtx \
990 && GET_CODE (XEXP (X, 1)) == CONST_INT \
991 && IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 << 6) - 4)) \
992 goto LABEL; \
993 if (GET_CODE (X) == PLUS \
994 && ((MODE) == SImode || (MODE) == SFmode) \
995 && XEXP (X, 0) == frame_pointer_rtx \
996 && GET_CODE (XEXP (X, 1)) == CONST_INT \
997 && IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 << 9) - 4)) \
998 goto LABEL; \
999 } \
1000 while (0)
1001 #else
1002 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
1003 do \
1004 { \
1005 if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
1006 goto LABEL; \
1007 if (GET_CODE (X) == PLUS \
1008 && ((MODE) == SImode || (MODE) == SFmode) \
1009 && XEXP (X, 0) == stack_pointer_rtx \
1010 && GET_CODE (XEXP (X, 1)) == CONST_INT \
1011 && IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 << 6) - 4)) \
1012 goto LABEL; \
1013 if (GET_CODE (X) == PLUS \
1014 && ((MODE) == SImode || (MODE) == SFmode) \
1015 && GET_CODE (XEXP (X, 0)) == REG \
1016 && (REGNO (XEXP (X, 0)) == FRAME_POINTER_REGNUM \
1017 || REGNO (XEXP (X, 0)) == ARG_POINTER_REGNUM) \
1018 && GET_CODE (XEXP (X, 1)) == CONST_INT \
1019 && IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 << 9) - 4)) \
1020 goto LABEL; \
1021 } \
1022 while (0)
1023 #endif
1024
1025 /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
1026 use as a base register. For hard registers, it should always accept those
1027 which the hardware permits and reject the others. Whether the macro accepts
1028 or rejects pseudo registers must be controlled by `REG_OK_STRICT' as
1029 described above. This usually requires two variant definitions, of which
1030 `REG_OK_STRICT' controls the one actually used. */
1031 #ifdef REG_OK_STRICT
1032 #define REG_OK_FOR_BASE_P(X) (((unsigned) REGNO (X)) <= STACK_POINTER_REGNUM)
1033 #else
1034 #define REG_OK_FOR_BASE_P(X) 1
1035 #endif
1036
1037 /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
1038 use as an index register.
1039
1040 The difference between an index register and a base register is that the
1041 index register may be scaled. If an address involves the sum of two
1042 registers, neither one of them scaled, then either one may be labeled the
1043 "base" and the other the "index"; but whichever labeling is used must fit
1044 the machine's constraints of which registers may serve in each capacity.
1045 The compiler will try both labelings, looking for one that is valid, and
1046 will reload one or both registers only if neither labeling works. */
1047 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
1048
1049 /* A C compound statement that attempts to replace X with a valid memory
1050 address for an operand of mode MODE. WIN will be a C statement label
1051 elsewhere in the code; the macro definition may use
1052
1053 GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN);
1054
1055 to avoid further processing if the address has become legitimate.
1056
1057 X will always be the result of a call to `break_out_memory_refs', and OLDX
1058 will be the operand that was given to that function to produce X.
1059
1060 The code generated by this macro should not alter the substructure of X. If
1061 it transforms X into a more legitimate form, it should assign X (which will
1062 always be a C variable) a new value.
1063
1064 It is not necessary for this macro to come up with a legitimate address.
1065 The compiler has standard ways of doing so in all cases. In fact, it is
1066 safe for this macro to do nothing. But often a machine-dependent strategy
1067 can generate better code. */
1068 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)
1069
1070 /* A C statement or compound statement with a conditional `goto LABEL;'
1071 executed if memory address X (an RTX) can have different meanings depending
1072 on the machine mode of the memory reference it is used for or if the address
1073 is valid for some modes but not others.
1074
1075 Autoincrement and autodecrement addresses typically have mode-dependent
1076 effects because the amount of the increment or decrement is the size of the
1077 operand being addressed. Some machines have other mode-dependent addresses.
1078 Many RISC machines have no mode-dependent addresses.
1079
1080 You may assume that ADDR is a valid address for the machine. */
1081 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)
1082
1083 /* A C expression that is nonzero if X is a legitimate constant for an
1084 immediate operand on the target machine. You can assume that X satisfies
1085 `CONSTANT_P', so you need not check this. In fact, `1' is a suitable
1086 definition for this macro on machines where anything `CONSTANT_P' is valid. */
1087 #define LEGITIMATE_CONSTANT_P(X) 1
1088
1089 /*}}}*/ \f
1090 /*{{{ Describing Relative Costs of Operations */
1091
1092 /* Define this macro as a C expression which is nonzero if accessing less than
1093 a word of memory (i.e. a `char' or a `short') is no faster than accessing a
1094 word of memory, i.e., if such access require more than one instruction or if
1095 there is no difference in cost between byte and (aligned) word loads.
1096
1097 When this macro is not defined, the compiler will access a field by finding
1098 the smallest containing object; when it is defined, a fullword load will be
1099 used if alignment permits. Unless bytes accesses are faster than word
1100 accesses, using word accesses is preferable since it may eliminate
1101 subsequent memory access if subsequent accesses occur to other fields in the
1102 same word of the structure, but to different bytes. */
1103 #define SLOW_BYTE_ACCESS 1
1104
1105 /*}}}*/ \f
1106 /*{{{ Dividing the output into sections. */
1107
1108 /* A C expression whose value is a string containing the assembler operation
1109 that should precede instructions and read-only data. Normally `".text"' is
1110 right. */
1111 #define TEXT_SECTION_ASM_OP "\t.text"
1112
1113 /* A C expression whose value is a string containing the assembler operation to
1114 identify the following data as writable initialized data. Normally
1115 `".data"' is right. */
1116 #define DATA_SECTION_ASM_OP "\t.data"
1117
1118 /* If defined, a C expression whose value is a string containing the
1119 assembler operation to identify the following data as
1120 uninitialized global data. If not defined, and neither
1121 `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
1122 uninitialized global data will be output in the data section if
1123 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
1124 used. */
1125 #define BSS_SECTION_ASM_OP "\t.section .bss"
1126
1127 /*}}}*/ \f
1128 /*{{{ The Overall Framework of an Assembler File. */
1129
1130 /* A C string constant describing how to begin a comment in the target
1131 assembler language. The compiler assumes that the comment will end at the
1132 end of the line. */
1133 #define ASM_COMMENT_START ";"
1134
1135 /* A C string constant for text to be output before each `asm' statement or
1136 group of consecutive ones. Normally this is `"#APP"', which is a comment
1137 that has no effect on most assemblers but tells the GNU assembler that it
1138 must check the lines that follow for all valid assembler constructs. */
1139 #define ASM_APP_ON "#APP\n"
1140
1141 /* A C string constant for text to be output after each `asm' statement or
1142 group of consecutive ones. Normally this is `"#NO_APP"', which tells the
1143 GNU assembler to resume making the time-saving assumptions that are valid
1144 for ordinary compiler output. */
1145 #define ASM_APP_OFF "#NO_APP\n"
1146
1147 /*}}}*/ \f
1148 /*{{{ Output and Generation of Labels. */
1149
1150 /* Globalizing directive for a label. */
1151 #define GLOBAL_ASM_OP "\t.globl "
1152
1153 /*}}}*/ \f
1154 /*{{{ Output of Assembler Instructions. */
1155
1156 /* A C compound statement to output to stdio stream STREAM the assembler syntax
1157 for an instruction operand X. X is an RTL expression.
1158
1159 CODE is a value that can be used to specify one of several ways of printing
1160 the operand. It is used when identical operands must be printed differently
1161 depending on the context. CODE comes from the `%' specification that was
1162 used to request printing of the operand. If the specification was just
1163 `%DIGIT' then CODE is 0; if the specification was `%LTR DIGIT' then CODE is
1164 the ASCII code for LTR.
1165
1166 If X is a register, this macro should print the register's name. The names
1167 can be found in an array `reg_names' whose type is `char *[]'. `reg_names'
1168 is initialized from `REGISTER_NAMES'.
1169
1170 When the machine description has a specification `%PUNCT' (a `%' followed by
1171 a punctuation character), this macro is called with a null pointer for X and
1172 the punctuation character for CODE. */
1173 #define PRINT_OPERAND(STREAM, X, CODE) fr30_print_operand (STREAM, X, CODE)
1174
1175 /* A C expression which evaluates to true if CODE is a valid punctuation
1176 character for use in the `PRINT_OPERAND' macro. If
1177 `PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no punctuation
1178 characters (except for the standard one, `%') are used in this way. */
1179 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) (CODE == '#')
1180
1181 /* A C compound statement to output to stdio stream STREAM the assembler syntax
1182 for an instruction operand that is a memory reference whose address is X. X
1183 is an RTL expression. */
1184
1185 #define PRINT_OPERAND_ADDRESS(STREAM, X) fr30_print_operand_address (STREAM, X)
1186
1187 /* If defined, C string expressions to be used for the `%R', `%L', `%U', and
1188 `%I' options of `asm_fprintf' (see `final.c'). These are useful when a
1189 single `md' file must support multiple assembler formats. In that case, the
1190 various `tm.h' files can define these macros differently.
1191
1192 USER_LABEL_PREFIX is defined in svr4.h. */
1193 #define REGISTER_PREFIX "%"
1194 #define LOCAL_LABEL_PREFIX "."
1195 #define USER_LABEL_PREFIX ""
1196 #define IMMEDIATE_PREFIX ""
1197
1198 /*}}}*/ \f
1199 /*{{{ Output of Dispatch Tables. */
1200
1201 /* This macro should be provided on machines where the addresses in a dispatch
1202 table are relative to the table's own address.
1203
1204 The definition should be a C statement to output to the stdio stream STREAM
1205 an assembler pseudo-instruction to generate a difference between two labels.
1206 VALUE and REL are the numbers of two internal labels. The definitions of
1207 these labels are output using `(*targetm.asm_out.internal_label)', and they must be
1208 printed in the same way here. For example,
1209
1210 fprintf (STREAM, "\t.word L%d-L%d\n", VALUE, REL) */
1211 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
1212 fprintf (STREAM, "\t.word .L%d-.L%d\n", VALUE, REL)
1213
1214 /* This macro should be provided on machines where the addresses in a dispatch
1215 table are absolute.
1216
1217 The definition should be a C statement to output to the stdio stream STREAM
1218 an assembler pseudo-instruction to generate a reference to a label. VALUE
1219 is the number of an internal label whose definition is output using
1220 `(*targetm.asm_out.internal_label)'. For example,
1221
1222 fprintf (STREAM, "\t.word L%d\n", VALUE) */
1223 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
1224 fprintf (STREAM, "\t.word .L%d\n", VALUE)
1225
1226 /*}}}*/ \f
1227 /*{{{ Assembler Commands for Alignment. */
1228
1229 /* A C statement to output to the stdio stream STREAM an assembler command to
1230 advance the location counter to a multiple of 2 to the POWER bytes. POWER
1231 will be a C expression of type `int'. */
1232 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
1233 fprintf ((STREAM), "\t.p2align %d\n", (POWER))
1234
1235 /*}}}*/ \f
1236 /*{{{ Miscellaneous Parameters. */
1237
1238 /* An alias for a machine mode name. This is the machine mode that elements of
1239 a jump-table should have. */
1240 #define CASE_VECTOR_MODE SImode
1241
1242 /* The maximum number of bytes that a single instruction can move quickly from
1243 memory to memory. */
1244 #define MOVE_MAX 8
1245
1246 /* A C expression which is nonzero if on this machine it is safe to "convert"
1247 an integer of INPREC bits to one of OUTPREC bits (where OUTPREC is smaller
1248 than INPREC) by merely operating on it as if it had only OUTPREC bits.
1249
1250 On many machines, this expression can be 1.
1251
1252 When `TRULY_NOOP_TRUNCATION' returns 1 for a pair of sizes for modes for
1253 which `MODES_TIEABLE_P' is 0, suboptimal code can result. If this is the
1254 case, making `TRULY_NOOP_TRUNCATION' return 0 in such cases may improve
1255 things. */
1256 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1257
1258 /* An alias for the machine mode for pointers. On most machines, define this
1259 to be the integer mode corresponding to the width of a hardware pointer;
1260 `SImode' on 32-bit machine or `DImode' on 64-bit machines. On some machines
1261 you must define this to be one of the partial integer modes, such as
1262 `PSImode'.
1263
1264 The width of `Pmode' must be at least as large as the value of
1265 `POINTER_SIZE'. If it is not equal, you must define the macro
1266 `POINTERS_EXTEND_UNSIGNED' to specify how pointers are extended to `Pmode'. */
1267 #define Pmode SImode
1268
1269 /* An alias for the machine mode used for memory references to functions being
1270 called, in `call' RTL expressions. On most machines this should be
1271 `QImode'. */
1272 #define FUNCTION_MODE QImode
1273
1274 /* If cross-compiling, don't require stdio.h etc to build libgcc.a. */
1275 #if defined CROSS_COMPILE && ! defined inhibit_libc
1276 #define inhibit_libc
1277 #endif
1278
1279 /*}}}*/ \f
1280 /*{{{ Exported variables */
1281
1282 /* Define the information needed to generate branch and scc insns. This is
1283 stored from the compare operation. Note that we can't use "rtx" here
1284 since it hasn't been defined! */
1285
1286 extern struct rtx_def * fr30_compare_op0;
1287 extern struct rtx_def * fr30_compare_op1;
1288
1289 /*}}}*/ \f
1290 /*{{{ PERDICATE_CODES. */
1291
1292 #define PREDICATE_CODES \
1293 { "stack_add_operand", { CONST_INT }}, \
1294 { "high_register_operand", { REG }}, \
1295 { "low_register_operand", { REG }}, \
1296 { "call_operand", { MEM }}, \
1297 { "fp_displacement_operand", { CONST_INT }}, \
1298 { "sp_displacement_operand", { CONST_INT }}, \
1299 { "di_operand", { CONST_INT, CONST_DOUBLE, REG, MEM }}, \
1300 { "nonimmediate_di_operand", { REG, MEM }}, \
1301 { "add_immediate_operand", { REG, CONST_INT }},
1302
1303 /*}}}*/ \f
1304
1305 /* Local Variables: */
1306 /* folded-file: t */
1307 /* End: */