OSDN Git Service

* doc/invoke.texi (Option Summary): Add ms1 options.
[pf3gnuchains/gcc-fork.git] / gcc / config / ms1 / ms1.h
1 /* Target Definitions for MorphoRISC1
2    Copyright (C) 2005 Free Software Foundation, Inc.
3    Contributed by Red Hat, Inc.
4
5    This file is part of GCC.
6
7    GCC is free software; you can redistribute it and/or modify it
8    under the terms of the GNU General Public License as published
9    by the Free Software Foundation; either version 2, or (at your
10    option) any later version.
11
12    GCC is distributed in the hope that it will be useful, but WITHOUT
13    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15    License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with GCC; see the file COPYING.  If not, write to the Free
19    Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
20    02110-1301, USA.  */
21
22 extern struct rtx_def * ms1_ucmpsi3_libcall;
23
24 enum processor_type
25 {
26   PROCESSOR_MS1_64_001,
27   PROCESSOR_MS1_16_002,
28   PROCESSOR_MS1_16_003
29 };
30
31 enum epilogue_type
32 {
33   EH_EPILOGUE,
34   NORMAL_EPILOGUE
35 };
36
37 extern enum processor_type ms1_cpu;
38
39 \f
40 /* A C string constant that tells the GCC driver program options to pass to
41    the assembler.  */
42 #undef  ASM_SPEC
43 #define ASM_SPEC "%{march=ms1-16-002: -march=ms1-16-002} %{march=ms1-16-003: -march=ms1-16-003} %{!march=*: -march=ms1-16-002}"
44
45 /* A string to pass to at the end of the comman given to the linker.  */
46 #undef  LIB_SPEC
47 #define LIB_SPEC "--start-group -lc -lsim --end-group \
48 %{msim: ; \
49 march=ms1-64-001:-T 64-001.ld%s; \
50 march=MS1-64-001:-T 64-001.ld%s; \
51 march=ms1-16-002:-T 16-002.ld%s; \
52 march=MS1-16-002:-T 16-002.ld%s; \
53 march=ms1-16-003:-T 16-003.ld%s; \
54 march=MS1-16-003:-T 16-003.ld%s}"
55
56 /* A string to pass at the very beginning of the command given to the
57    linker.  */
58 #undef  STARTFILE_SPEC
59 #define STARTFILE_SPEC "%{msim:crt0.o%s;\
60 march=ms1-64-001:%{!mno-crt0:crt0-64-001.o%s} startup-64-001.o%s; \
61 march=MS1-64-001:%{!mno-crt0:crt0-64-001.o%s} startup-64-001.o%s; \
62 march=ms1-16-002:%{!mno-crt0:crt0-16-002.o%s} startup-16-002.o%s; \
63 march=MS1-16-002:%{!mno-crt0:crt0-16-002.o%s} startup-16-002.o%s; \
64 march=ms1-16-003:%{!mno-crt0:crt0-16-003.o%s} startup-16-003.o%s; \
65 march=MS1-16-003:%{!mno-crt0:crt0-16-003.o%s} startup-16-003.o%s} \
66 crti.o%s crtbegin.o%s"
67
68 /* A string to pass at the end of the command given to the linker.  */
69 #undef  ENDFILE_SPEC
70 #define ENDFILE_SPEC "%{msim:exit.o%s; \
71 march=ms1-64-001:exit-64-001.o%s; \
72 march=MS1-64-001:exit-64-001.o%s; \
73 march=ms1-16-002:exit-16-002.o%s; \
74 march=MS1-16-002:exit-16-002.o%s; \
75 march=ms1-16-003:exit-16-003.o%s; \
76 march=MS1-16-003:exit-16-003.o%s} \
77  crtend.o%s crtn.o%s"
78 \f
79 /* Run-time target specifications.  */
80
81 #define TARGET_CPU_CPP_BUILTINS()               \
82   do                                            \
83     {                                           \
84       builtin_define_std ("ms1");               \
85       builtin_assert ("machine=ms1");   \
86     }                                           \
87   while (0)
88
89 #define TARGET_VERSION  fprintf (stderr, " (ms1)");
90
91 #define OVERRIDE_OPTIONS ms1_override_options ()
92
93 #define CAN_DEBUG_WITHOUT_FP 1
94
95 \f
96 /* Storage Layout.  */
97
98 #define BITS_BIG_ENDIAN 0
99
100 #define BYTES_BIG_ENDIAN 1
101
102 #define WORDS_BIG_ENDIAN 1
103
104 #define UNITS_PER_WORD 4
105
106 /* A macro to update MODE and UNSIGNEDP when an object whose type is TYPE and
107    which has the specified mode and signedness is to be stored in a register.
108    This macro is only called when TYPE is a scalar type.
109
110    On most RISC machines, which only have operations that operate on a full
111    register, define this macro to set M to `word_mode' if M is an integer mode
112    narrower than `BITS_PER_WORD'.  In most cases, only integer modes should be
113    widened because wider-precision floating-point operations are usually more
114    expensive than their narrower counterparts.
115
116    For most machines, the macro definition does not change UNSIGNEDP.  However,
117    some machines, have instructions that preferentially handle either signed or
118    unsigned quantities of certain modes.  For example, on the DEC Alpha, 32-bit
119    loads from memory and 32-bit add instructions sign-extend the result to 64
120    bits.  On such machines, set UNSIGNEDP according to which kind of extension
121    is more efficient.
122
123    Do not define this macro if it would never modify MODE.  */
124 #define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE)                       \
125   do                                                            \
126     {                                                           \
127       if (GET_MODE_CLASS (MODE) == MODE_INT                     \
128           && GET_MODE_SIZE (MODE) < 4)                          \
129         (MODE) = SImode;                                        \
130     }                                                           \
131   while (0)
132
133 /* Normal alignment required for function parameters on the stack, in bits.
134    All stack parameters receive at least this much alignment regardless of data
135    type.  On most machines, this is the same as the size of an integer.  */
136 #define PARM_BOUNDARY 32
137
138 /* Define this macro to the minimum alignment enforced by hardware for
139    the stack pointer on this machine.  The definition is a C
140    expression for the desired alignment (measured in bits).  This
141    value is used as a default if PREFERRED_STACK_BOUNDARY is not
142    defined.  On most machines, this should be the same as
143    PARM_BOUNDARY.  */
144 #define STACK_BOUNDARY 32
145
146 /* Alignment required for a function entry point, in bits.  */
147 #define FUNCTION_BOUNDARY 32
148
149 /* Biggest alignment that any data type can require on this machine,
150    in bits.  */
151 #define BIGGEST_ALIGNMENT 32
152
153 /* If defined, a C expression to compute the alignment for a variable
154    in the static store.  TYPE is the data type, and ALIGN is the
155    alignment that the object would ordinarily have.  The value of this
156    macro is used instead of that alignment to align the object.
157
158    If this macro is not defined, then ALIGN is used.  */
159 #define DATA_ALIGNMENT(TYPE, ALIGN)             \
160   (TREE_CODE (TYPE) == ARRAY_TYPE               \
161    && TYPE_MODE (TREE_TYPE (TYPE)) == QImode    \
162    && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
163
164 /* If defined, a C expression to compute the alignment given to a constant that
165    is being placed in memory.  CONSTANT is the constant and ALIGN is the
166    alignment that the object would ordinarily have.  The value of this macro is
167    used instead of that alignment to align the object.
168
169    If this macro is not defined, then ALIGN is used.
170
171    The typical use of this macro is to increase alignment for string constants
172    to be word aligned so that `strcpy' calls that copy constants can be done
173    inline.  */
174 #define CONSTANT_ALIGNMENT(EXP, ALIGN)  \
175   (TREE_CODE (EXP) == STRING_CST        \
176    && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
177
178 /* Number of bits which any structure or union's size must be a multiple of.
179    Each structure or union's size is rounded up to a multiple of this.
180
181    If you do not define this macro, the default is the same as `BITS_PER_UNIT'.  */
182 #define STRUCTURE_SIZE_BOUNDARY 32
183
184 /* Define this macro to be the value 1 if instructions will fail to work if
185    given data not on the nominal alignment.  If instructions will merely go
186    slower in that case, define this macro as 0.  */
187 #define STRICT_ALIGNMENT 1
188
189 /* Define this if you wish to imitate the way many other C compilers handle
190    alignment of bitfields and the structures that contain them.  */
191 #define PCC_BITFIELD_TYPE_MATTERS 1
192 \f
193 /* Layout of Source Language Data Types.  */
194
195 #define INT_TYPE_SIZE 32
196
197 #define SHORT_TYPE_SIZE 16
198
199 #define LONG_TYPE_SIZE 32
200
201 #define LONG_LONG_TYPE_SIZE 64
202
203 #define CHAR_TYPE_SIZE 8
204
205 #define FLOAT_TYPE_SIZE 32
206
207 #define DOUBLE_TYPE_SIZE 64
208
209 #define LONG_DOUBLE_TYPE_SIZE 64
210
211 #define DEFAULT_SIGNED_CHAR 1
212 \f
213 /* Register Basics.  */
214
215 /* General purpose registers.  */
216 #define GPR_FIRST       0               /* First gpr */
217 #define GPR_LAST        15              /* Last possible gpr */
218
219 #define GPR_R0          0               /* Always 0 */
220 #define GPR_R7          7               /* Used as a scratch register */
221 #define GPR_R8          8               /* Used as a scratch register */
222 #define GPR_R9          9               /* Used as a scratch register */
223 #define GPR_R10         10              /* Used as a scratch register */
224 #define GPR_R11         11              /* Used as a scratch register */
225 #define GPR_FP          12              /* Frame pointer */
226 #define GPR_SP          13              /* Stack pointer */
227 #define GPR_LINK        14              /* Saved return address as
228                                            seen  by the caller */
229 #define GPR_INTERRUPT_LINK 15           /* hold return addres for interrupts */
230
231 /* Argument register that is eliminated in favor of the frame and/or stack
232    pointer.  Also add register to point to where the return address is
233    stored.  */
234 #define SPECIAL_REG_FIRST               (GPR_LAST + 1)
235 #define SPECIAL_REG_LAST                (SPECIAL_REG_FIRST)
236 #define ARG_POINTER_REGNUM              (SPECIAL_REG_FIRST + 0)
237 #define SPECIAL_REG_P(R)                ((R) == SPECIAL_REG_FIRST)
238
239 /* The first/last register that can contain the arguments to a function.  */
240 #define FIRST_ARG_REGNUM        1
241 #define LAST_ARG_REGNUM         4
242
243 /* The register used to hold functions return value */
244 #define RETVAL_REGNUM           11
245
246 #define FIRST_PSEUDO_REGISTER (GPR_FIRST + 17)
247
248 #define IS_PSEUDO_P(R)  (REGNO (R) >= FIRST_PSEUDO_REGISTER)
249
250 /* R0           always has the value 0
251    R10          static link
252    R12  FP      pointer to active frame
253    R13  SP      pointer to top of stack
254    R14  RA      return address
255    R15  IRA     interrupt return address.  */
256 #define FIXED_REGISTERS { 1, 0, 0, 0, 0, 0, 0, 0, \
257                           0, 0, 0, 0, 1, 1, 1, 1, \
258                           1                       \
259                          }
260
261 /* Like `FIXED_REGISTERS' but has 1 for each register that is clobbered (in
262    general) by function calls as well as for fixed registers.  This macro
263    therefore identifies the registers that are not available for general
264    allocation of values that must live across function calls.  */
265 #define CALL_USED_REGISTERS     { 1, 1, 1, 1, 1, 0, 0, 1, \
266                                   1, 1, 1, 1, 1, 1, 1, 1, \
267                                   1                       \
268                                 }
269
270 \f
271 /* How Values Fit in Registers.  */
272
273 #define HARD_REGNO_NREGS(REGNO, MODE)                           \
274   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
275
276 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
277
278 /* A C expression that is nonzero if a value of mode MODE1 is
279    accessible in mode MODE2 without copying.  */
280 #define MODES_TIEABLE_P(MODE1, MODE2) 1
281 \f
282 /* Register Classes.  */
283
284 enum reg_class
285 {
286   NO_REGS,
287   ALL_REGS,
288   LIM_REG_CLASSES
289 };
290
291 #define   GENERAL_REGS  ALL_REGS
292
293 #define N_REG_CLASSES ((int) LIM_REG_CLASSES)
294
295 #define REG_CLASS_NAMES {"NO_REGS", "ALL_REGS" }
296
297 #define REG_CLASS_CONTENTS \
298    {                                                                    \
299      { 0x0, 0x0 },                                                      \
300      { (((1 << (GPR_LAST + 1)) - 1) & ~(1 << GPR_FIRST)), 0x0 },        \
301    }
302
303 /* A C expression whose value is a register class containing hard register
304    REGNO.  In general there is more than one such class; choose a class which
305    is "minimal", meaning that no smaller class also contains the register.  */
306 #define REGNO_REG_CLASS(REGNO) GENERAL_REGS
307
308 #define BASE_REG_CLASS GENERAL_REGS
309
310 #define INDEX_REG_CLASS NO_REGS
311
312 #define REG_CLASS_FROM_LETTER(CHAR) NO_REGS
313
314 #define REGNO_OK_FOR_BASE_P(NUM) 1
315
316 #define REGNO_OK_FOR_INDEX_P(NUM) 1
317
318 /* A C expression that places additional restrictions on the register class to
319    use when it is necessary to copy value X into a register in class CLASS.
320    The value is a register class; perhaps CLASS, or perhaps another, smaller
321    class.  On many machines, the following definition is safe:
322
323         #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
324 */
325 #define PREFERRED_RELOAD_CLASS(X, CLASS) (CLASS)
326
327 #define SECONDARY_RELOAD_CLASS(CLASS,MODE,X) \
328   ms1_secondary_reload_class((CLASS), (MODE), (X))
329
330 /* A C expression for the maximum number of consecutive registers of
331    class CLASS needed to hold a value of mode MODE.  */
332 #define CLASS_MAX_NREGS(CLASS, MODE) \
333   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
334
335 /* For MorphoRISC1:
336
337    `I'  is used for the range of constants an arithmetic insn can
338         actually contain (16 bits signed integers).
339
340    `J'  is used for the range which is just zero (ie, $r0).
341
342    `K'  is used for the range of constants a logical insn can actually
343         contain (16 bit zero-extended integers).
344
345    `L'  is used for the range of constants that be loaded with lui
346         (ie, the bottom 16 bits are zero).
347
348    `M'  is used for the range of constants that take two words to load
349         (ie, not matched by `I', `K', and `L').
350
351    `N'  is used for negative 16 bit constants other than -65536.
352
353    `O'  is a 15 bit signed integer.
354
355    `P'  is used for positive 16 bit constants.  */
356
357 #define SMALL_INT(X) ((unsigned HOST_WIDE_INT) (INTVAL (X) + 0x8000) < 0x10000)
358 #define SMALL_INT_UNSIGNED(X) ((unsigned HOST_WIDE_INT) (INTVAL (X)) < 0x10000)
359
360 /* A C expression that defines the machine-dependent operand
361    constraint letters that specify particular ranges of integer
362    values.  If C is one of those letters, the expression should check
363    that VALUE, an integer, is in the appropriate range and return 1 if
364    so, 0 otherwise.  If C is not one of those letters, the value
365    should be 0 regardless of VALUE.  */
366 #define CONST_OK_FOR_LETTER_P(VALUE, C)                                 \
367   ((C) == 'I' ? ((unsigned HOST_WIDE_INT) ((VALUE) + 0x8000) < 0x10000) \
368    : (C) == 'J' ? ((VALUE) == 0)                                        \
369    : (C) == 'K' ? ((unsigned HOST_WIDE_INT) (VALUE) < 0x10000)          \
370    : (C) == 'L' ? (((VALUE) & 0x0000ffff) == 0                          \
371                    && (((VALUE) & ~2147483647) == 0                     \
372                        || ((VALUE) & ~2147483647) == ~2147483647))      \
373    : (C) == 'M' ? ((((VALUE) & ~0x0000ffff) != 0)                       \
374                    && (((VALUE) & ~0x0000ffff) != ~0x0000ffff)          \
375                    && (((VALUE) & 0x0000ffff) != 0                      \
376                        || (((VALUE) & ~2147483647) != 0                 \
377                            && ((VALUE) & ~2147483647) != ~2147483647))) \
378    : (C) == 'N' ? ((unsigned HOST_WIDE_INT) ((VALUE) + 0xffff) < 0xffff) \
379    : (C) == 'O' ? ((unsigned HOST_WIDE_INT) ((VALUE) + 0x4000) < 0x8000) \
380    : (C) == 'P' ? ((VALUE) != 0 && (((VALUE) & ~0x0000ffff) == 0))      \
381    : 0)
382
383 /* A C expression that defines the machine-dependent operand constraint letters
384    (`G', `H') that specify particular ranges of `const_double' values.  */
385 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
386
387 /* Most negative value represent on ms1 */
388 #define MS1_MIN_INT 0x80000000
389 \f
390 /* Basic Stack Layout.  */
391
392 enum save_direction
393 {
394   FROM_PROCESSOR_TO_MEM,
395   FROM_MEM_TO_PROCESSOR
396 };
397
398 /* Tell prologue and epilogue if register REGNO should be saved / restored.
399    The return address and frame pointer are treated separately.
400    Don't consider them here.  */
401 #define MUST_SAVE_REGISTER(regno)                               \
402   (   (regno) != GPR_LINK                                       \
403    && (regno) != GPR_FP                                         \
404    && (regno) != GPR_SP                                         \
405    && (regno) != GPR_R0                                         \
406    &&   (( regs_ever_live [regno] && ! call_used_regs [regno] ) \
407        /* Save ira register in an interrupt handler.  */        \
408         || (interrupt_handler && (regno) == GPR_INTERRUPT_LINK) \
409        /* Save any register used in an interrupt handler.  */   \
410         || (interrupt_handler && regs_ever_live [regno])        \
411        /* Save call clobbered registers in non-leaf interrupt   \
412           handlers.  */                                         \
413         || (interrupt_handler && call_used_regs[regno]          \
414            && !current_function_is_leaf)                        \
415         ||(current_function_calls_eh_return                     \
416            && (regno == GPR_R7 || regno == GPR_R8))             \
417         )                                                       \
418   )
419
420 #define STACK_GROWS_DOWNWARD 1
421
422 /* Offset from the frame pointer to the first local variable slot to be
423    allocated.
424
425    If `FRAME_GROWS_DOWNWARD', find the next slot's offset by
426    subtracting the first slot's length from `STARTING_FRAME_OFFSET'.
427    Otherwise, it is found by adding the length of the first slot to
428    the value `STARTING_FRAME_OFFSET'.  */
429 #define STARTING_FRAME_OFFSET current_function_outgoing_args_size
430
431 /* Offset from the argument pointer register to the first argument's address.
432    On some machines it may depend on the data type of the function.
433
434    If `ARGS_GROW_DOWNWARD', this is the offset to the location above the first
435    argument's address.  */
436 #define FIRST_PARM_OFFSET(FUNDECL) 0
437
438 #define RETURN_ADDR_RTX(COUNT, FRAMEADDR)                               \
439     ms1_return_addr_rtx (COUNT)
440
441 /* A C expression whose value is RTL representing the location of the incoming
442    return address at the beginning of any function, before the prologue.  This
443    RTL is either a `REG', indicating that the return value is saved in `REG',
444    or a `MEM' representing a location in the stack.
445
446    You only need to define this macro if you want to support call frame
447    debugging information like that provided by DWARF 2.  */
448 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (SImode, GPR_LINK)
449
450 /* A C expression whose value is an integer giving the offset, in bytes, from
451    the value of the stack pointer register to the top of the stack frame at the
452    beginning of any function, before the prologue.  The top of the frame is
453    defined to be the value of the stack pointer in the previous frame, just
454    before the call instruction.
455
456    You only need to define this macro if you want to support call frame
457    debugging information like that provided by DWARF 2.  */
458 #define INCOMING_FRAME_SP_OFFSET 0
459
460 #define STACK_POINTER_REGNUM GPR_SP
461
462 #define FRAME_POINTER_REGNUM GPR_FP
463
464 /* The register number of the arg pointer register, which is used to
465    access the function's argument list.  */
466 #define ARG_POINTER_REGNUM              (SPECIAL_REG_FIRST + 0)
467
468 /* Register numbers used for passing a function's static chain pointer.  */
469 #define STATIC_CHAIN_REGNUM 10
470
471 /* A C expression which is nonzero if a function must have and use a frame
472    pointer.  */
473 #define FRAME_POINTER_REQUIRED 0
474
475 /* Structure to be filled in by compute_frame_size with register
476    save masks, and offsets for the current function.  */
477
478 struct ms1_frame_info
479 {
480   unsigned int total_size;      /* # Bytes that the entire frame takes up.  */
481   unsigned int pretend_size;    /* # Bytes we push and pretend caller did.  */
482   unsigned int args_size;       /* # Bytes that outgoing arguments take up.  */
483   unsigned int extra_size;
484   unsigned int reg_size;        /* # Bytes needed to store regs.  */
485   unsigned int var_size;        /* # Bytes that variables take up.  */
486   unsigned int frame_size;      /* # Bytes in current frame.  */
487   unsigned int reg_mask;        /* Mask of saved registers.  */
488   unsigned int save_fp;         /* Nonzero if frame pointer must be saved.  */
489   unsigned int save_lr;         /* Nonzero if return pointer must be saved.  */
490   int          initialized;     /* Nonzero if frame size already calculated.  */
491 }; 
492
493 extern struct ms1_frame_info current_frame_info;
494
495 /* If defined, this macro specifies a table of register pairs used to eliminate
496    unneeded registers that point into the stack frame.  */
497 #define ELIMINABLE_REGS                                                 \
498 {                                                                       \
499   {ARG_POINTER_REGNUM,   STACK_POINTER_REGNUM},                         \
500   {ARG_POINTER_REGNUM,   FRAME_POINTER_REGNUM},                         \
501   {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}                          \
502 }
503
504 /* A C expression that returns non-zero if the compiler is allowed to try to
505    replace register number FROM with register number TO.  */
506 #define CAN_ELIMINATE(FROM, TO)                                         \
507  ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM          \
508   ? ! frame_pointer_needed                                              \
509   : 1)
510
511 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'.  It
512    specifies the initial difference between the specified pair of
513    registers.  This macro must be defined if `ELIMINABLE_REGS' is
514    defined.  */
515 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)                    \
516   (OFFSET) = ms1_initial_elimination_offset (FROM, TO)
517
518 /* If defined, the maximum amount of space required for outgoing
519    arguments will be computed and placed into the variable
520    `current_function_outgoing_args_size'.  */
521 #define ACCUMULATE_OUTGOING_ARGS 1
522
523 /* Define this if it is the responsibility of the caller to
524    allocate the area reserved for arguments passed in registers.  */
525 #define OUTGOING_REG_PARM_STACK_SPACE
526
527 /* The number of register assigned to holding function arguments.  */
528 #define MS1_NUM_ARG_REGS        4
529
530 /* Define this if it is the responsibility of the caller to allocate
531    the area reserved for arguments passed in registers.  */
532 #define REG_PARM_STACK_SPACE(FNDECL) (MS1_NUM_ARG_REGS * UNITS_PER_WORD)
533
534 /* Define this macro if `REG_PARM_STACK_SPACE' is defined, but the stack
535    parameters don't skip the area specified by it.  */
536 #define STACK_PARMS_IN_REG_PARM_AREA
537
538 /* A C expression that should indicate the number of bytes of its own
539    arguments that a function pops on returning, or 0 if the function
540    pops no arguments and the caller must therefore pop them all after
541    the function returns.  */
542 #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
543
544 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
545    ms1_function_arg (& (CUM), (MODE), (TYPE), (NAMED), FALSE)
546
547 #define CUMULATIVE_ARGS int
548
549 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS)        \
550     ms1_init_cumulative_args (& (CUM), FNTYPE, LIBNAME, FNDECL, FALSE)
551
552 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)                    \
553     ms1_function_arg_advance (&CUM, MODE, TYPE, NAMED)
554
555 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE)                               \
556     ms1_function_arg_boundary (MODE, TYPE)
557
558 #define FUNCTION_ARG_REGNO_P(REGNO)                                     \
559   ((REGNO) >= FIRST_ARG_REGNUM && ((REGNO) <= LAST_ARG_REGNUM))
560
561 #define RETURN_VALUE_REGNUM     RETVAL_REGNUM
562      
563 #define FUNCTION_VALUE(VALTYPE, FUNC) \
564    ms1_function_value (VALTYPE, TYPE_MODE(VALTYPE), FUNC)
565
566 #define LIBCALL_VALUE(MODE) \
567    ms1_function_value (NULL_TREE, MODE, NULL_TREE)
568
569 #define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == RETURN_VALUE_REGNUM)
570
571 /* A C expression which can inhibit the returning of certain function
572    values in registers, based on the type of value.  */
573 #define RETURN_IN_MEMORY(TYPE) (int_size_in_bytes (TYPE) > UNITS_PER_WORD)
574
575 /* Define this macro to be 1 if all structure and union return values must be
576    in memory.  */
577 #define DEFAULT_PCC_STRUCT_RETURN 0
578
579 /* Define this macro as a C expression that is nonzero if the return
580    instruction or the function epilogue ignores the value of the stack
581    pointer; in other words, if it is safe to delete an instruction to
582    adjust the stack pointer before a return from the function.  */
583 #define EXIT_IGNORE_STACK 1
584
585 #define EPILOGUE_USES(REGNO) ms1_epilogue_uses(REGNO)
586
587 /* Define this macro if the function epilogue contains delay slots to which
588    instructions from the rest of the function can be "moved".  */
589 #define DELAY_SLOTS_FOR_EPILOGUE 1
590
591 /* A C expression that returns 1 if INSN can be placed in delay slot number N
592    of the epilogue.  */
593 #define ELIGIBLE_FOR_EPILOGUE_DELAY(INSN, N) 0
594
595 #define FUNCTION_PROFILER(FILE, LABELNO) gcc_unreachable ()
596
597 #define EXPAND_BUILTIN_VA_START(VALIST, NEXTARG)                \
598   ms1_va_start (VALIST, NEXTARG)
599
600 /* Trampolines are not implemented.  */
601 #define TRAMPOLINE_SIZE 0
602
603 #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN)
604
605 /* ?? What is this -- aldyh ?? */
606 #define UCMPSI3_LIBCALL         "__ucmpsi3"
607
608 /* Addressing Modes.  */
609
610 /* A C expression that is 1 if the RTX X is a constant which is a valid
611    address.  */
612 #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
613
614 /* A number, the maximum number of registers that can appear in a valid memory
615    address.  Note that it is up to you to specify a value equal to the maximum
616    number that `GO_IF_LEGITIMATE_ADDRESS' would ever accept.  */
617 #define MAX_REGS_PER_ADDRESS 1
618
619 #ifdef REG_OK_STRICT
620 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
621 {                                               \
622   if (ms1_legitimate_address_p (MODE, X, 1))    \
623     goto ADDR;                                  \
624 }
625 #else
626 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
627 {                                               \
628   if (ms1_legitimate_address_p (MODE, X, 0))    \
629     goto ADDR;                                  \
630 }
631 #endif
632
633 #ifdef REG_OK_STRICT
634 #define REG_OK_FOR_BASE_P(X) ms1_reg_ok_for_base_p (X, 1)
635 #else
636 #define REG_OK_FOR_BASE_P(X) ms1_reg_ok_for_base_p (X, 0)
637 #endif
638
639 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
640
641 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) {}
642
643 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)
644
645 #define LEGITIMATE_CONSTANT_P(X) 1
646
647 /* A C expression for the cost of moving data of mode M between a register and
648    memory.  A value of 2 is the default; this cost is relative to those in
649    `REGISTER_MOVE_COST'.
650
651    If moving between registers and memory is more expensive than between two
652    registers, you should define this macro to express the relative cost.  */
653 #define MEMORY_MOVE_COST(M,C,I) 10
654
655 /* Define this macro as a C expression which is nonzero if accessing less than
656    a word of memory (i.e. a `char' or a `short') is no faster than accessing a
657    word of memory.  */
658 #define SLOW_BYTE_ACCESS 1
659
660 #define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) 1 
661
662 #define TEXT_SECTION_ASM_OP ".text"
663
664 #define DATA_SECTION_ASM_OP ".data"
665
666 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
667
668 /* A C string constant for text to be output before each `asm' statement or
669    group of consecutive ones.  Normally this is `"#APP"', which is a comment
670    that has no effect on most assemblers but tells the GNU assembler that it
671    must check the lines that follow for all valid assembler constructs.  */
672 #define ASM_APP_ON "#APP\n"
673
674 /* A C string constant for text to be output after each `asm' statement or
675    group of consecutive ones.  Normally this is `"#NO_APP"', which tells the
676    GNU assembler to resume making the time-saving assumptions that are valid
677    for ordinary compiler output.  */
678 #define ASM_APP_OFF "#NO_APP\n"
679
680 /* This is how to output an assembler line defining a `char' constant.  */
681 #define ASM_OUTPUT_CHAR(FILE, VALUE)                    \
682   do                                                    \
683     {                                                   \
684       fprintf (FILE, "\t.byte\t");                      \
685       output_addr_const (FILE, (VALUE));                \
686       fprintf (FILE, "\n");                             \
687     }                                                   \
688   while (0)
689
690 /* This is how to output an assembler line defining a `short' constant.  */
691 #define ASM_OUTPUT_SHORT(FILE, VALUE)                   \
692   do                                                    \
693     {                                                   \
694       fprintf (FILE, "\t.hword\t");                     \
695       output_addr_const (FILE, (VALUE));                \
696       fprintf (FILE, "\n");                             \
697     }                                                   \
698   while (0)
699
700 /* This is how to output an assembler line defining an `int' constant.
701    We also handle symbol output here.  */
702 #define ASM_OUTPUT_INT(FILE, VALUE)                     \
703   do                                                    \
704     {                                                   \
705       fprintf (FILE, "\t.word\t");                      \
706       output_addr_const (FILE, (VALUE));                \
707       fprintf (FILE, "\n");                             \
708     }                                                   \
709   while (0)
710
711 /* A C statement to output to the stdio stream STREAM an assembler instruction
712    to assemble a single byte containing the number VALUE.
713
714    This declaration must be present.  */
715 #define ASM_OUTPUT_BYTE(STREAM, VALUE) \
716   fprintf (STREAM, "\t%s\t0x%x\n", ASM_BYTE_OP, (VALUE))
717
718 /* Globalizing directive for a label.  */
719 #define GLOBAL_ASM_OP "\t.globl "
720
721 #define REGISTER_NAMES                                                  \
722 { "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7",                       \
723   "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15",                 \
724   "ap" }
725
726 /* If defined, a C initializer for an array of structures containing a name and
727    a register number.  This macro defines additional names for hard registers,
728    thus allowing the `asm' option in declarations to refer to registers using
729    alternate names.  */
730 #define ADDITIONAL_REGISTER_NAMES \
731 { { "FP", 12}, {"SP", 13}, {"RA", 14}, {"IRA", 15} }
732
733 /* Define this macro if you are using an unusual assembler that requires
734    different names for the machine instructions.
735
736    The definition is a C statement or statements which output an assembler
737    instruction opcode to the stdio stream STREAM.  The macro-operand PTR is a
738    variable of type `char *' which points to the opcode name in its "internal"
739    form--the form that is written in the machine description.  The definition
740    should output the opcode name to STREAM, performing any translation you
741    desire, and increment the variable PTR to point at the end of the opcode so
742    that it will not be output twice.  */
743 #define ASM_OUTPUT_OPCODE(STREAM, PTR) \
744    (PTR) = ms1_asm_output_opcode (STREAM, PTR)
745
746 #define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
747   ms1_final_prescan_insn (INSN, OPVEC, NOPERANDS)
748
749 #define PRINT_OPERAND(STREAM, X, CODE) ms1_print_operand (STREAM, X, CODE)
750
751 /* A C expression which evaluates to true if CODE is a valid punctuation
752    character for use in the `PRINT_OPERAND' macro.  */
753 /* #:  Print nop for delay slot.  */
754 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '#')
755
756 #define PRINT_OPERAND_ADDRESS(STREAM, X) ms1_print_operand_address (STREAM, X)
757
758 /* If defined, C string expressions to be used for the `%R', `%L', `%U', and
759    `%I' options of `asm_fprintf' (see `final.c').  These are useful when a
760    single `md' file must support multiple assembler formats.  In that case, the
761    various `tm.h' files can define these macros differently.
762
763    USER_LABEL_PREFIX is defined in svr4.h.  */
764 #define REGISTER_PREFIX     "%"
765 #define LOCAL_LABEL_PREFIX  "."
766 #define USER_LABEL_PREFIX   ""
767 #define IMMEDIATE_PREFIX    ""
768
769 /* This macro should be provided on machines where the addresses in a dispatch
770    table are relative to the table's own address.
771
772    The definition should be a C statement to output to the stdio stream STREAM
773    an assembler pseudo-instruction to generate a difference between two labels.
774    VALUE and REL are the numbers of two internal labels.  The definitions of
775    these labels are output using `targetm.asm_out.internal_label', and they
776    must be printed in the same way here.  */
777 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
778 fprintf (STREAM, "\t.word .L%d-.L%d\n", VALUE, REL)
779
780 /* This macro should be provided on machines where the addresses in a dispatch
781    table are absolute.
782
783    The definition should be a C statement to output to the stdio stream STREAM
784    an assembler pseudo-instruction to generate a reference to a label.  VALUE
785    is the number of an internal label whose definition is output using
786    `targetm.asm_out.internal_label'.  */
787 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
788 fprintf (STREAM, "\t.word .L%d\n", VALUE)
789
790 #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (GPR_LINK)
791
792 #define EH_RETURN_DATA_REGNO(N) \
793   ((N) == 0 ? GPR_R7 : (N) == 1 ? GPR_R8 : INVALID_REGNUM)
794
795 #define EH_RETURN_STACKADJ_REGNO        GPR_R11
796 #define EH_RETURN_STACKADJ_RTX          \
797         gen_rtx_REG (SImode, EH_RETURN_STACKADJ_REGNO)
798 #define EH_RETURN_HANDLER_REGNO         GPR_R10
799 #define EH_RETURN_HANDLER_RTX           \
800         gen_rtx_REG (SImode, EH_RETURN_HANDLER_REGNO)
801 \f
802 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
803   fprintf ((STREAM), "\t.p2align %d\n", (POWER))
804
805 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
806
807 #ifndef DWARF2_DEBUGGING_INFO
808 #define DWARF2_DEBUGGING_INFO
809 #endif
810
811 /* Define this macro if GCC should produce dwarf version 2-style
812    line numbers.  This usually requires extending the assembler to
813    support them, and #defining DWARF2_LINE_MIN_INSN_LENGTH in the
814    assembler configuration header files.  */
815 #define DWARF2_ASM_LINE_DEBUG_INFO 1
816
817 /* An alias for a machine mode name.  This is the machine mode that
818    elements of a jump-table should have.  */
819 #define CASE_VECTOR_MODE SImode
820
821 /* Define this macro if operations between registers with integral
822    mode smaller than a word are always performed on the entire
823    register.  Most RISC machines have this property and most CISC
824    machines do not.  */
825 #define WORD_REGISTER_OPERATIONS
826
827 /* The maximum number of bytes that a single instruction can move quickly from
828    memory to memory.  */
829 #define MOVE_MAX 4
830
831 /* A C expression which is nonzero if on this machine it is safe to "convert"
832    an integer of INPREC bits to one of OUTPREC bits (where OUTPREC is smaller
833    than INPREC) by merely operating on it as if it had only OUTPREC bits.
834
835    On many machines, this expression can be 1.
836
837    When `TRULY_NOOP_TRUNCATION' returns 1 for a pair of sizes for modes for
838    which `MODES_TIEABLE_P' is 0, suboptimal code can result.  If this is the
839    case, making `TRULY_NOOP_TRUNCATION' return 0 in such cases may improve
840    things.  */
841 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
842
843 #define Pmode SImode
844
845 /* An alias for the machine mode used for memory references to functions being
846    called, in `call' RTL expressions.  On most machines this should be
847    `QImode'.  */
848 #define FUNCTION_MODE QImode
849
850 #define HANDLE_SYSV_PRAGMA 1
851
852 /* Indicate how many instructions can be issued at the same time.  */
853 #define ISSUE_RATE 1
854
855 /* Define the information needed to generate branch and scc insns.  This is
856    stored from the compare operation.  Note that we can't use "rtx" here
857    since it hasn't been defined!  */
858
859 extern struct rtx_def * ms1_compare_op0;
860 extern struct rtx_def * ms1_compare_op1;
861