OSDN Git Service

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