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