OSDN Git Service

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