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