OSDN Git Service

Merge basic-improvements-branch to trunk
[pf3gnuchains/gcc-fork.git] / gcc / config / fr30 / fr30.h
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 GNU CC.
8
9 GNU CC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 GNU CC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GNU CC; see the file COPYING.  If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA.  */
23
24 /*}}}*/ \f
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 /*}}}*/ \f
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 /*}}}*/ \f
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 /*}}}*/ \f
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 /*}}}*/ \f
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 /*}}}*/ \f
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 /*}}}*/ \f
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 /*}}}*/ \f
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 /*}}}*/ \f
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 /*}}}*/ \f
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 /*}}}*/ \f
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 /*}}}*/ \f
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 /*}}}*/ \f
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) (CUM) = 0
768
769 /* A C statement (sans semicolon) to update the summarizer variable CUM to
770    advance past an argument in the argument list.  The values MODE, TYPE and
771    NAMED describe that argument.  Once this is done, the variable CUM is
772    suitable for analyzing the *following* argument with `FUNCTION_ARG', etc.
773
774    This macro need not do anything if the argument in question was passed on
775    the stack.  The compiler knows how to track the amount of stack space used
776    for arguments without any special help.  */
777 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)                    \
778   (CUM) += (NAMED) * fr30_num_arg_regs (MODE, TYPE)
779
780 /* A C expression that is nonzero if REGNO is the number of a hard register in
781    which function arguments are sometimes passed.  This does *not* include
782    implicit arguments such as the static chain and the structure-value address.
783    On many machines, no registers can be used for this purpose since all
784    function arguments are pushed on the stack.  */
785 #define FUNCTION_ARG_REGNO_P(REGNO) \
786   ((REGNO) >= FIRST_ARG_REGNUM && ((REGNO) < FIRST_ARG_REGNUM + FR30_NUM_ARG_REGS))
787
788 /*}}}*/ \f
789 /*{{{  How Scalar Function Values are Returned.  */ 
790
791 /* A C expression to create an RTX representing the place where a function
792    returns a value of data type VALTYPE.  VALTYPE is a tree node representing a
793    data type.  Write `TYPE_MODE (VALTYPE)' to get the machine mode used to
794    represent that type.  On many machines, only the mode is relevant.
795    (Actually, on most machines, scalar values are returned in the same place
796    regardless of mode).
797
798    If `PROMOTE_FUNCTION_RETURN' is defined, you must apply the same promotion
799    rules specified in `PROMOTE_MODE' if VALTYPE is a scalar type.
800
801    If the precise function being called is known, FUNC is a tree node
802    (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer.  This makes it
803    possible to use a different value-returning convention for specific
804    functions when all their calls are known.
805
806    `FUNCTION_VALUE' is not used for return vales with aggregate data types,
807    because these are returned in another way.  See `STRUCT_VALUE_REGNUM' and
808    related macros, below.  */
809 #define FUNCTION_VALUE(VALTYPE, FUNC) \
810      gen_rtx_REG (TYPE_MODE (VALTYPE), RETURN_VALUE_REGNUM)
811
812 /* A C expression to create an RTX representing the place where a library
813    function returns a value of mode MODE.  If the precise function being called
814    is known, FUNC is a tree node (`FUNCTION_DECL') for it; otherwise, FUNC is a
815    null pointer.  This makes it possible to use a different value-returning
816    convention for specific functions when all their calls are known.
817
818    Note that "library function" in this context means a compiler support
819    routine, used to perform arithmetic, whose name is known specially by the
820    compiler and was not mentioned in the C code being compiled.
821
822    The definition of `LIBRARY_VALUE' need not be concerned aggregate data
823    types, because none of the library functions returns such types.  */
824 #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, RETURN_VALUE_REGNUM)
825
826 /* A C expression that is nonzero if REGNO is the number of a hard register in
827    which the values of called function may come back. */
828
829 #define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == RETURN_VALUE_REGNUM)
830
831 /*}}}*/ \f
832 /*{{{  How Large Values are Returned.  */ 
833
834 /* Define this macro to be 1 if all structure and union return values must be
835    in memory.  Since this results in slower code, this should be defined only
836    if needed for compatibility with other compilers or with an ABI.  If you
837    define this macro to be 0, then the conventions used for structure and union
838    return values are decided by the `RETURN_IN_MEMORY' macro.
839
840    If not defined, this defaults to the value 1.  */
841 #define DEFAULT_PCC_STRUCT_RETURN 1
842
843 /* If the structure value address is not passed in a register, define
844    `STRUCT_VALUE' as an expression returning an RTX for the place where the
845    address is passed.  If it returns 0, the address is passed as an "invisible"
846    first argument.  */
847 #define STRUCT_VALUE 0
848
849 /*}}}*/ \f
850 /*{{{  Generating Code for Profiling.  */ 
851
852 /* A C statement or compound statement to output to FILE some assembler code to
853    call the profiling subroutine `mcount'.  Before calling, the assembler code
854    must load the address of a counter variable into a register where `mcount'
855    expects to find the address.  The name of this variable is `LP' followed by
856    the number LABELNO, so you would generate the name using `LP%d' in a
857    `fprintf'.
858
859    The details of how the address should be passed to `mcount' are determined
860    by your operating system environment, not by GNU CC.  To figure them out,
861    compile a small program for profiling using the system's installed C
862    compiler and look at the assembler code that results.  */
863 #define FUNCTION_PROFILER(FILE, LABELNO)        \
864 {                                               \
865   fprintf (FILE, "\t mov rp, r1\n" );           \
866   fprintf (FILE, "\t ldi:32 mcount, r0\n" );    \
867   fprintf (FILE, "\t call @r0\n" );             \
868   fprintf (FILE, ".word\tLP%d\n", LABELNO);     \
869 }
870
871 /*}}}*/ \f
872 /*{{{  Implementing the VARARGS Macros.  */ 
873
874 /* This macro offers an alternative to using `__builtin_saveregs' and defining
875    the macro `EXPAND_BUILTIN_SAVEREGS'.  Use it to store the anonymous register
876    arguments into the stack so that all the arguments appear to have been
877    passed consecutively on the stack.  Once this is done, you can use the
878    standard implementation of varargs that works for machines that pass all
879    their arguments on the stack.
880
881    The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure, containing
882    the values that obtain after processing of the named arguments.  The
883    arguments MODE and TYPE describe the last named argument--its machine mode
884    and its data type as a tree node.
885
886    The macro implementation should do two things: first, push onto the stack
887    all the argument registers *not* used for the named arguments, and second,
888    store the size of the data thus pushed into the `int'-valued variable whose
889    name is supplied as the argument PRETEND_ARGS_SIZE.  The value that you
890    store here will serve as additional offset for setting up the stack frame.
891
892    Because you must generate code to push the anonymous arguments at compile
893    time without knowing their data types, `SETUP_INCOMING_VARARGS' is only
894    useful on machines that have just a single category of argument register and
895    use it uniformly for all data types.
896
897    If the argument SECOND_TIME is nonzero, it means that the arguments of the
898    function are being analyzed for the second time.  This happens for an inline
899    function, which is not actually compiled until the end of the source file.
900    The macro `SETUP_INCOMING_VARARGS' should not generate any instructions in
901    this case.  */
902 #define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_ARGS_SIZE, SECOND_TIME) \
903   if (! SECOND_TIME) \
904     fr30_setup_incoming_varargs (ARGS_SO_FAR, MODE, TYPE, & PRETEND_ARGS_SIZE)
905
906 /* Define this macro if the location where a function argument is passed
907    depends on whether or not it is a named argument.
908
909    This macro controls how the NAMED argument to `FUNCTION_ARG' is set for
910    varargs and stdarg functions.  With this macro defined, the NAMED argument
911    is always true for named arguments, and false for unnamed arguments.  If
912    this is not defined, but `SETUP_INCOMING_VARARGS' is defined, then all
913    arguments are treated as named.  Otherwise, all named arguments except the
914    last are treated as named.  */
915 #define STRICT_ARGUMENT_NAMING 0
916
917 /*}}}*/ \f
918 /*{{{  Trampolines for Nested Functions.  */ 
919
920 /* On the FR30, the trampoline is:
921
922    nop
923    ldi:32 STATIC, r12
924    nop
925    ldi:32 FUNCTION, r0
926    jmp    @r0
927
928    The no-ops are to guarantee that the static chain and final
929    target are 32 bit ailgned within the trampoline.  That allows us to
930    initialize those locations with simple SImode stores.   The alternative
931    would be to use HImode stores.  */
932    
933 /* A C statement to output, on the stream FILE, assembler code for a block of
934    data that contains the constant parts of a trampoline.  This code should not
935    include a label--the label is taken care of automatically.  */
936 #define TRAMPOLINE_TEMPLATE(FILE)                                               \
937 {                                                                               \
938   fprintf (FILE, "\tnop\n");                                                    \
939   fprintf (FILE, "\tldi:32\t#0, %s\n", reg_names [STATIC_CHAIN_REGNUM]);        \
940   fprintf (FILE, "\tnop\n");                                                    \
941   fprintf (FILE, "\tldi:32\t#0, %s\n", reg_names [COMPILER_SCRATCH_REGISTER]);  \
942   fprintf (FILE, "\tjmp\t@%s\n", reg_names [COMPILER_SCRATCH_REGISTER]);        \
943 }
944
945 /* A C expression for the size in bytes of the trampoline, as an integer.  */
946 #define TRAMPOLINE_SIZE 18
947
948 /* We want the trampoline to be aligned on a 32bit boundary so that we can
949    make sure the location of the static chain & target function within
950    the trampoline is also aligned on a 32bit boundary.  */
951 #define TRAMPOLINE_ALIGNMENT 32
952
953 /* A C statement to initialize the variable parts of a trampoline.  ADDR is an
954    RTX for the address of the trampoline; FNADDR is an RTX for the address of
955    the nested function; STATIC_CHAIN is an RTX for the static chain value that
956    should be passed to the function when it is called.  */
957 #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN)                       \
958 do                                                                              \
959 {                                                                               \
960   emit_move_insn (gen_rtx (MEM, SImode, plus_constant (ADDR, 4)), STATIC_CHAIN);\
961   emit_move_insn (gen_rtx (MEM, SImode, plus_constant (ADDR, 12)), FNADDR);     \
962 } while (0);
963
964 /*}}}*/ \f
965 /*{{{  Addressing Modes.  */ 
966
967 /* A C expression that is 1 if the RTX X is a constant which is a valid
968    address.  On most machines, this can be defined as `CONSTANT_P (X)', but a
969    few machines are more restrictive in which constant addresses are supported.
970
971    `CONSTANT_P' accepts integer-values expressions whose values are not
972    explicitly known, such as `symbol_ref', `label_ref', and `high' expressions
973    and `const' arithmetic expressions, in addition to `const_int' and
974    `const_double' expressions.  */
975 #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
976
977 /* A number, the maximum number of registers that can appear in a valid memory
978    address.  Note that it is up to you to specify a value equal to the maximum
979    number that `GO_IF_LEGITIMATE_ADDRESS' would ever accept.  */
980 #define MAX_REGS_PER_ADDRESS 1
981
982 /* A C compound statement with a conditional `goto LABEL;' executed if X (an
983    RTX) is a legitimate memory address on the target machine for a memory
984    operand of mode MODE.  */
985
986 /* On the FR30 we only have one real addressing mode - an address in a
987    register.  There are three special cases however:
988    
989    * indexed addressing using small positive offsets from the stack pointer
990    
991    * indexed addressing using small signed offsets from the frame pointer
992
993    * register plus register addressing using R13 as the base register.
994
995    At the moment we only support the first two of these special cases.  */
996    
997 #ifdef REG_OK_STRICT
998 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL)                        \
999   do                                                                    \
1000     {                                                                   \
1001       if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))                 \
1002         goto LABEL;                                                     \
1003       if (GET_CODE (X) == PLUS                                          \
1004           && ((MODE) == SImode || (MODE) == SFmode)                     \
1005           && XEXP (X, 0) == stack_pointer_rtx                           \
1006           && GET_CODE (XEXP (X, 1)) == CONST_INT                        \
1007           && IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 <<  6) - 4))         \
1008         goto LABEL;                                                     \
1009       if (GET_CODE (X) == PLUS                                          \
1010           && ((MODE) == SImode || (MODE) == SFmode)                     \
1011           && XEXP (X, 0) == frame_pointer_rtx                           \
1012           && GET_CODE (XEXP (X, 1)) == CONST_INT                        \
1013           && IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 <<  9) - 4)) \
1014         goto LABEL;                                                     \
1015     }                                                                   \
1016   while (0)
1017 #else
1018 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL)                        \
1019   do                                                                    \
1020     {                                                                   \
1021       if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))                 \
1022         goto LABEL;                                                     \
1023       if (GET_CODE (X) == PLUS                                          \
1024           && ((MODE) == SImode || (MODE) == SFmode)                     \
1025           && XEXP (X, 0) == stack_pointer_rtx                           \
1026           && GET_CODE (XEXP (X, 1)) == CONST_INT                        \
1027           && IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 <<  6) - 4))         \
1028         goto LABEL;                                                     \
1029       if (GET_CODE (X) == PLUS                                          \
1030           && ((MODE) == SImode || (MODE) == SFmode)                     \
1031           && GET_CODE (XEXP (X, 0)) == REG \
1032           && (REGNO (XEXP (X, 0)) == FRAME_POINTER_REGNUM \
1033            || REGNO (XEXP (X, 0)) == ARG_POINTER_REGNUM) \
1034           && GET_CODE (XEXP (X, 1)) == CONST_INT                        \
1035           && IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 <<  9) - 4)) \
1036         goto LABEL;                                                     \
1037     }                                                                   \
1038   while (0)
1039 #endif
1040
1041 /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
1042    use as a base register.  For hard registers, it should always accept those
1043    which the hardware permits and reject the others.  Whether the macro accepts
1044    or rejects pseudo registers must be controlled by `REG_OK_STRICT' as
1045    described above.  This usually requires two variant definitions, of which
1046    `REG_OK_STRICT' controls the one actually used.  */
1047 #ifdef REG_OK_STRICT
1048 #define REG_OK_FOR_BASE_P(X) (((unsigned) REGNO (X)) <= STACK_POINTER_REGNUM)
1049 #else
1050 #define REG_OK_FOR_BASE_P(X) 1
1051 #endif
1052
1053 /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
1054    use as an index register.
1055
1056    The difference between an index register and a base register is that the
1057    index register may be scaled.  If an address involves the sum of two
1058    registers, neither one of them scaled, then either one may be labeled the
1059    "base" and the other the "index"; but whichever labeling is used must fit
1060    the machine's constraints of which registers may serve in each capacity.
1061    The compiler will try both labelings, looking for one that is valid, and
1062    will reload one or both registers only if neither labeling works.  */
1063 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
1064
1065 /* A C compound statement that attempts to replace X with a valid memory
1066    address for an operand of mode MODE.  WIN will be a C statement label
1067    elsewhere in the code; the macro definition may use
1068
1069         GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN);
1070
1071    to avoid further processing if the address has become legitimate.
1072
1073    X will always be the result of a call to `break_out_memory_refs', and OLDX
1074    will be the operand that was given to that function to produce X.
1075
1076    The code generated by this macro should not alter the substructure of X.  If
1077    it transforms X into a more legitimate form, it should assign X (which will
1078    always be a C variable) a new value.
1079
1080    It is not necessary for this macro to come up with a legitimate address.
1081    The compiler has standard ways of doing so in all cases.  In fact, it is
1082    safe for this macro to do nothing.  But often a machine-dependent strategy
1083    can generate better code.  */
1084 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)
1085
1086 /* A C statement or compound statement with a conditional `goto LABEL;'
1087    executed if memory address X (an RTX) can have different meanings depending
1088    on the machine mode of the memory reference it is used for or if the address
1089    is valid for some modes but not others.
1090
1091    Autoincrement and autodecrement addresses typically have mode-dependent
1092    effects because the amount of the increment or decrement is the size of the
1093    operand being addressed.  Some machines have other mode-dependent addresses.
1094    Many RISC machines have no mode-dependent addresses.
1095
1096    You may assume that ADDR is a valid address for the machine.  */
1097 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)
1098
1099 /* A C expression that is nonzero if X is a legitimate constant for an
1100    immediate operand on the target machine.  You can assume that X satisfies
1101    `CONSTANT_P', so you need not check this.  In fact, `1' is a suitable
1102    definition for this macro on machines where anything `CONSTANT_P' is valid.  */
1103 #define LEGITIMATE_CONSTANT_P(X) 1
1104
1105 /*}}}*/ \f
1106 /*{{{  Describing Relative Costs of Operations */ 
1107
1108 /* Define this macro as a C expression which is nonzero if accessing less than
1109    a word of memory (i.e. a `char' or a `short') is no faster than accessing a
1110    word of memory, i.e., if such access require more than one instruction or if
1111    there is no difference in cost between byte and (aligned) word loads.
1112
1113    When this macro is not defined, the compiler will access a field by finding
1114    the smallest containing object; when it is defined, a fullword load will be
1115    used if alignment permits.  Unless bytes accesses are faster than word
1116    accesses, using word accesses is preferable since it may eliminate
1117    subsequent memory access if subsequent accesses occur to other fields in the
1118    same word of the structure, but to different bytes.  */
1119 #define SLOW_BYTE_ACCESS 1
1120
1121 /*}}}*/ \f
1122 /*{{{  Dividing the output into sections.  */ 
1123
1124 /* A C expression whose value is a string containing the assembler operation
1125    that should precede instructions and read-only data.  Normally `".text"' is
1126    right.  */
1127 #define TEXT_SECTION_ASM_OP "\t.text"
1128
1129 /* A C expression whose value is a string containing the assembler operation to
1130    identify the following data as writable initialized data.  Normally
1131    `".data"' is right.  */
1132 #define DATA_SECTION_ASM_OP "\t.data"
1133
1134 /* If defined, a C expression whose value is a string containing the
1135    assembler operation to identify the following data as
1136    uninitialized global data.  If not defined, and neither
1137    `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
1138    uninitialized global data will be output in the data section if
1139    `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
1140    used.  */
1141 #define BSS_SECTION_ASM_OP "\t.section .bss"
1142
1143 /*}}}*/ \f
1144 /*{{{  The Overall Framework of an Assembler File.  */
1145
1146 /* A C string constant describing how to begin a comment in the target
1147    assembler language.  The compiler assumes that the comment will end at the
1148    end of the line.  */
1149 #define ASM_COMMENT_START ";"
1150
1151 /* A C string constant for text to be output before each `asm' statement or
1152    group of consecutive ones.  Normally this is `"#APP"', which is a comment
1153    that has no effect on most assemblers but tells the GNU assembler that it
1154    must check the lines that follow for all valid assembler constructs.  */
1155 #define ASM_APP_ON "#APP\n"
1156
1157 /* A C string constant for text to be output after each `asm' statement or
1158    group of consecutive ones.  Normally this is `"#NO_APP"', which tells the
1159    GNU assembler to resume making the time-saving assumptions that are valid
1160    for ordinary compiler output.  */
1161 #define ASM_APP_OFF "#NO_APP\n"
1162
1163 /*}}}*/ \f
1164 /*{{{  Output and Generation of Labels.  */ 
1165
1166 /* Globalizing directive for a label.  */
1167 #define GLOBAL_ASM_OP "\t.globl "
1168
1169 /*}}}*/ \f
1170 /*{{{  Output of Assembler Instructions.  */ 
1171
1172 /* A C compound statement to output to stdio stream STREAM the assembler syntax
1173    for an instruction operand X.  X is an RTL expression.
1174
1175    CODE is a value that can be used to specify one of several ways of printing
1176    the operand.  It is used when identical operands must be printed differently
1177    depending on the context.  CODE comes from the `%' specification that was
1178    used to request printing of the operand.  If the specification was just
1179    `%DIGIT' then CODE is 0; if the specification was `%LTR DIGIT' then CODE is
1180    the ASCII code for LTR.
1181
1182    If X is a register, this macro should print the register's name.  The names
1183    can be found in an array `reg_names' whose type is `char *[]'.  `reg_names'
1184    is initialized from `REGISTER_NAMES'.
1185
1186    When the machine description has a specification `%PUNCT' (a `%' followed by
1187    a punctuation character), this macro is called with a null pointer for X and
1188    the punctuation character for CODE.  */
1189 #define PRINT_OPERAND(STREAM, X, CODE)  fr30_print_operand (STREAM, X, CODE)
1190
1191 /* A C expression which evaluates to true if CODE is a valid punctuation
1192    character for use in the `PRINT_OPERAND' macro.  If
1193    `PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no punctuation
1194    characters (except for the standard one, `%') are used in this way.  */
1195 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) (CODE == '#')
1196
1197 /* A C compound statement to output to stdio stream STREAM the assembler syntax
1198    for an instruction operand that is a memory reference whose address is X.  X
1199    is an RTL expression.  */
1200
1201 #define PRINT_OPERAND_ADDRESS(STREAM, X) fr30_print_operand_address (STREAM, X)
1202
1203 /* If defined, C string expressions to be used for the `%R', `%L', `%U', and
1204    `%I' options of `asm_fprintf' (see `final.c').  These are useful when a
1205    single `md' file must support multiple assembler formats.  In that case, the
1206    various `tm.h' files can define these macros differently.
1207
1208    USER_LABEL_PREFIX is defined in svr4.h.  */
1209 #define REGISTER_PREFIX "%"
1210 #define LOCAL_LABEL_PREFIX "."
1211 #define USER_LABEL_PREFIX ""
1212 #define IMMEDIATE_PREFIX ""
1213
1214 /*}}}*/ \f
1215 /*{{{  Output of Dispatch Tables.  */ 
1216
1217 /* This macro should be provided on machines where the addresses in a dispatch
1218    table are relative to the table's own address.
1219
1220    The definition should be a C statement to output to the stdio stream STREAM
1221    an assembler pseudo-instruction to generate a difference between two labels.
1222    VALUE and REL are the numbers of two internal labels.  The definitions of
1223    these labels are output using `(*targetm.asm_out.internal_label)', and they must be
1224    printed in the same way here.  For example,
1225
1226         fprintf (STREAM, "\t.word L%d-L%d\n", VALUE, REL)  */
1227 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
1228 fprintf (STREAM, "\t.word .L%d-.L%d\n", VALUE, REL)
1229
1230 /* This macro should be provided on machines where the addresses in a dispatch
1231    table are absolute.
1232
1233    The definition should be a C statement to output to the stdio stream STREAM
1234    an assembler pseudo-instruction to generate a reference to a label.  VALUE
1235    is the number of an internal label whose definition is output using
1236    `(*targetm.asm_out.internal_label)'.  For example,
1237
1238         fprintf (STREAM, "\t.word L%d\n", VALUE)  */
1239 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
1240 fprintf (STREAM, "\t.word .L%d\n", VALUE)
1241
1242 /*}}}*/ \f
1243 /*{{{  Assembler Commands for Alignment.  */ 
1244
1245 /* A C statement to output to the stdio stream STREAM an assembler command to
1246    advance the location counter to a multiple of 2 to the POWER bytes.  POWER
1247    will be a C expression of type `int'.  */
1248 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
1249   fprintf ((STREAM), "\t.p2align %d\n", (POWER))
1250
1251 /*}}}*/ \f
1252 /*{{{  Miscellaneous Parameters.  */ 
1253
1254 /* An alias for a machine mode name.  This is the machine mode that elements of
1255    a jump-table should have.  */
1256 #define CASE_VECTOR_MODE SImode
1257
1258 /* The maximum number of bytes that a single instruction can move quickly from
1259    memory to memory.  */
1260 #define MOVE_MAX 8
1261
1262 /* A C expression which is nonzero if on this machine it is safe to "convert"
1263    an integer of INPREC bits to one of OUTPREC bits (where OUTPREC is smaller
1264    than INPREC) by merely operating on it as if it had only OUTPREC bits.
1265
1266    On many machines, this expression can be 1.
1267
1268    When `TRULY_NOOP_TRUNCATION' returns 1 for a pair of sizes for modes for
1269    which `MODES_TIEABLE_P' is 0, suboptimal code can result.  If this is the
1270    case, making `TRULY_NOOP_TRUNCATION' return 0 in such cases may improve
1271    things.  */
1272 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1273
1274 /* An alias for the machine mode for pointers.  On most machines, define this
1275    to be the integer mode corresponding to the width of a hardware pointer;
1276    `SImode' on 32-bit machine or `DImode' on 64-bit machines.  On some machines
1277    you must define this to be one of the partial integer modes, such as
1278    `PSImode'.
1279
1280    The width of `Pmode' must be at least as large as the value of
1281    `POINTER_SIZE'.  If it is not equal, you must define the macro
1282    `POINTERS_EXTEND_UNSIGNED' to specify how pointers are extended to `Pmode'.  */
1283 #define Pmode SImode
1284
1285 /* An alias for the machine mode used for memory references to functions being
1286    called, in `call' RTL expressions.  On most machines this should be
1287    `QImode'.  */
1288 #define FUNCTION_MODE QImode
1289
1290 /* If cross-compiling, don't require stdio.h etc to build libgcc.a.  */
1291 #if defined CROSS_COMPILE && ! defined inhibit_libc
1292 #define inhibit_libc
1293 #endif
1294
1295 /*}}}*/ \f
1296 /*{{{  Exported variables */ 
1297
1298 /* Define the information needed to generate branch and scc insns.  This is
1299    stored from the compare operation.  Note that we can't use "rtx" here
1300    since it hasn't been defined!  */
1301
1302 extern struct rtx_def * fr30_compare_op0;
1303 extern struct rtx_def * fr30_compare_op1;
1304
1305 /*}}}*/ \f
1306 /*{{{  PERDICATE_CODES.  */ 
1307
1308 #define PREDICATE_CODES                                 \
1309   { "stack_add_operand",        { CONST_INT }},         \
1310   { "high_register_operand",    { REG }},               \
1311   { "low_register_operand",     { REG }},               \
1312   { "call_operand",             { MEM }},               \
1313   { "fp_displacement_operand",  { CONST_INT }},         \
1314   { "sp_displacement_operand",  { CONST_INT }},         \
1315   { "di_operand",               { CONST_INT, CONST_DOUBLE, REG, MEM }}, \
1316   { "nonimmediate_di_operand",  { REG, MEM }},          \
1317   { "add_immediate_operand",    { REG, CONST_INT }},
1318
1319 /*}}}*/ \f
1320
1321 /* Local Variables: */
1322 /* folded-file: t   */
1323 /* End:             */