OSDN Git Service

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