1 /* Definitions of target machine for GNU compiler.
2 Matsushita MN10300 series
3 Copyright (C) 1996 Free Software Foundation, Inc.
4 Contributed by Jeff Law (law@cygnus.com).
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
32 /* Names to predefine in the preprocessor for this target machine. */
34 #define CPP_PREDEFINES "-D__mn10300__ -D__MN10300__"
36 /* Run-time compilation parameters selecting different hardware subsets. */
38 extern int target_flags;
40 /* Macros used in the machine description to test the flags. */
42 /* Macro to define tables used to set the flags.
43 This is a list in braces of pairs in braces,
44 each pair being { "NAME", VALUE }
45 where VALUE is the bits to set or minus the bits to clear.
46 An empty string NAME is used to identify the default VALUE. */
48 #define TARGET_SWITCHES \
49 {{ "", TARGET_DEFAULT}}
51 #ifndef TARGET_DEFAULT
52 #define TARGET_DEFAULT 0
55 /* Print subsidiary information on the compiler version in use. */
57 #define TARGET_VERSION fprintf (stderr, " (MN10300)");
60 /* Target machine storage layout */
62 /* Define this if most significant bit is lowest numbered
63 in instructions that operate on numbered bit-fields.
64 This is not true on the Matsushita MN1003. */
65 #define BITS_BIG_ENDIAN 0
67 /* Define this if most significant byte of a word is the lowest numbered. */
68 /* This is not true on the Matsushita MN10300. */
69 #define BYTES_BIG_ENDIAN 0
71 /* Define this if most significant word of a multiword number is lowest
73 This is not true on the Matsushita MN10300. */
74 #define WORDS_BIG_ENDIAN 0
76 /* Number of bits in an addressable storage unit */
77 #define BITS_PER_UNIT 8
79 /* Width in bits of a "word", which is the contents of a machine register.
80 Note that this is not necessarily the width of data type `int';
81 if using 16-bit ints on a 68000, this would still be 32.
82 But on a machine with 16-bit registers, this would be 16. */
83 #define BITS_PER_WORD 32
85 /* Width of a word, in units (bytes). */
86 #define UNITS_PER_WORD 4
88 /* Width in bits of a pointer.
89 See also the macro `Pmode' defined below. */
90 #define POINTER_SIZE 32
92 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
93 #define PARM_BOUNDARY 32
95 /* The stack goes in 32 bit lumps. */
96 #define STACK_BOUNDARY 32
98 /* Allocation boundary (in *bits*) for the code of a function.
99 8 is the minimum boundary; it's unclear if bigger alignments
100 would improve performance. */
101 #define FUNCTION_BOUNDARY 8
103 /* No data type wants to be aligned rounder than this. */
104 #define BIGGEST_ALIGNMENT 32
106 /* Alignment of field after `int : 0' in a structure. */
107 #define EMPTY_FIELD_BOUNDARY 32
109 /* Define this if move instructions will actually fail to work
110 when given unaligned data. */
111 #define STRICT_ALIGNMENT 1
113 /* Define this as 1 if `char' should by default be signed; else as 0. */
114 #define DEFAULT_SIGNED_CHAR 0
116 /* Define results of standard character escape sequences. */
117 #define TARGET_BELL 007
118 #define TARGET_BS 010
119 #define TARGET_TAB 011
120 #define TARGET_NEWLINE 012
121 #define TARGET_VT 013
122 #define TARGET_FF 014
123 #define TARGET_CR 015
125 /* Standard register usage. */
127 /* Number of actual hardware registers.
128 The hardware registers are assigned numbers for the compiler
129 from 0 to just below FIRST_PSEUDO_REGISTER.
131 All registers that the compiler knows about must be given numbers,
132 even those that are not normally considered general registers. */
134 #define FIRST_PSEUDO_REGISTER 9
136 /* 1 for registers that have pervasive standard uses
137 and are not available for the register allocator. */
139 #define FIXED_REGISTERS \
140 { 0, 0, 0, 0, 0, 0, 0, 0, 1}
142 /* 1 for registers not available across function calls.
143 These must include the FIXED_REGISTERS and also any
144 registers that can be used without being saved.
145 The latter must include the registers where values are returned
146 and the register where structure-value addresses are passed.
147 Aside from that, you can include as many other registers as you
150 #define CALL_USED_REGISTERS \
151 { 1, 1, 0, 0, 1, 1, 0, 0, 1}
153 #define REG_ALLOC_ORDER \
154 { 0, 1, 4, 5, 2, 3, 6, 7, 8}
156 /* Return number of consecutive hard regs needed starting at reg REGNO
157 to hold something of mode MODE.
159 This is ordinarily the length in words of a value of mode MODE
160 but can be less for certain modes in special long registers. */
162 #define HARD_REGNO_NREGS(REGNO, MODE) \
163 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
165 /* Value is 1 if hard register REGNO can hold a value of machine-mode
168 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
169 (REGNO_REG_CLASS (REGNO) == DATA_REGS \
170 ? ((REGNO) & 1) == 0 || GET_MODE_SIZE (MODE) <= 4 \
171 : ((REGNO) & 1) == 0 || GET_MODE_SIZE (MODE) == 4)
173 /* Value is 1 if it is a good idea to tie two pseudo registers
174 when one has mode MODE1 and one has mode MODE2.
175 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
176 for any hard reg, then this must be 0 for correct output. */
177 #define MODES_TIEABLE_P(MODE1, MODE2) \
178 (MODE1 == MODE2 || GET_MODE_SIZE (MODE1) <= 4 && GET_MODE_SIZE (MODE2) <= 4)
180 /* 4 data, and effectively 3 address registers is small as far as I'm
182 #define SMALL_REGISTER_CLASSES 1
184 /* Define the classes of registers for register constraints in the
185 machine description. Also define ranges of constants.
187 One of the classes must always be named ALL_REGS and include all hard regs.
188 If there is more than one class, another class must be named NO_REGS
189 and contain no registers.
191 The name GENERAL_REGS must be the name of a class (or an alias for
192 another name such as ALL_REGS). This is the class of registers
193 that is allowed by "g" or "r" in a register constraint.
194 Also, registers outside this class are allocated only when
195 instructions express preferences for them.
197 The classes must be numbered in nondecreasing order; that is,
198 a larger-numbered class must never be contained completely
199 in a smaller-numbered class.
201 For any two classes, it is very desirable that there be another
202 class that represents their union. */
205 NO_REGS, DATA_REGS, ADDRESS_REGS, SP_REGS, DATA_OR_ADDRESS_REGS, DATA_OR_SP_REGS, SP_OR_ADDRESS_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
208 #define N_REG_CLASSES (int) LIM_REG_CLASSES
210 /* Give names of register classes as strings for dump file. */
212 #define REG_CLASS_NAMES \
213 { "NO_REGS", "DATA_REGS", "ADDRESS_REGS", \
214 "SP_REGS", "DATA_OR_ADDRESS_REGS", "DATA_OR_SP_REGS", \
215 "SP_OR_ADDRESS_REGS", "GENERAL_REGS", "ALL_REGS", "LIM_REGS" }
217 /* Define which registers fit in which classes.
218 This is an initializer for a vector of HARD_REG_SET
219 of length N_REG_CLASSES. */
221 #define REG_CLASS_CONTENTS \
223 0x00f, /* DATA_REGS */ \
224 0x0f0, /* ADDRESS_REGS */ \
225 0x100, /* SP_REGS */ \
226 0x0ff, /* DATA_OR_ADDRESS_REGS */\
227 0x00f, /* DATA_OR_SP_REGS */ \
228 0x0f0, /* SP_OR_ADDRESS_REGS */\
229 0x0ff, /* GENERAL_REGS */ \
230 0x0ff, /* ALL_REGS */ \
233 /* The same information, inverted:
234 Return the class number of the smallest class containing
235 reg number REGNO. This could be a conditional expression
236 or could index an array. */
238 #define REGNO_REG_CLASS(REGNO) \
239 ((REGNO) < 4 ? DATA_REGS : \
240 (REGNO) < 8 ? ADDRESS_REGS : \
241 (REGNO) == 8 ? SP_REGS: 0)
243 /* The class value for index registers, and the one for base regs. */
245 #define INDEX_REG_CLASS DATA_REGS
246 #define BASE_REG_CLASS SP_OR_ADDRESS_REGS
248 /* Get reg_class from a letter such as appears in the machine description. */
250 #define REG_CLASS_FROM_LETTER(C) \
251 ((C) == 'd' ? DATA_REGS : \
252 (C) == 'a' ? ADDRESS_REGS : \
253 (C) == 'x' ? SP_REGS : NO_REGS)
255 /* Macros to check register numbers against specific register classes. */
257 /* These assume that REGNO is a hard or pseudo reg number.
258 They give nonzero only if REGNO is a hard reg of the suitable class
259 or a pseudo reg currently allocated to a suitable hard reg.
260 Since they use reg_renumber, they are safe only once reg_renumber
261 has been allocated, which happens in local-alloc.c. */
263 #define REGNO_OK_FOR_BASE_P(regno) \
264 (((regno) > 3 && regno < FIRST_PSEUDO_REGISTER) \
265 || (reg_renumber[regno] > 3 && reg_renumber[regno] < FIRST_PSEUDO_REGISTER))
267 #define REGNO_OK_FOR_INDEX_P(regno) \
268 (((regno) >= 0 && regno < 4) \
269 || (reg_renumber[regno] >= 0 && reg_renumber[regno] < 4))
272 /* Given an rtx X being reloaded into a reg required to be
273 in class CLASS, return the class of reg to actually use.
274 In general this is just CLASS; but on some machines
275 in some cases it is preferable to use a more restrictive class. */
277 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
278 (X == stack_pointer_rtx && CLASS != SP_REGS ? ADDRESS_REGS : CLASS)
280 #define LIMIT_RELOAD_CLASS(MODE, CLASS) \
281 ((MODE == QImode || MODE == HImode) ? DATA_REGS : CLASS)
283 #define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
284 secondary_reload_class(CLASS,MODE,IN)
286 /* Return the maximum number of consecutive registers
287 needed to represent mode MODE in a register of class CLASS. */
289 #define CLASS_MAX_NREGS(CLASS, MODE) \
290 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
292 /* The letters I, J, K, L, M, N, O, P in a register constraint string
293 can be used to stand for particular ranges of immediate operands.
294 This macro defines what the ranges are.
295 C is the letter, and VALUE is a constant value.
296 Return 1 if VALUE is in the range specified by C. */
298 #define INT_8_BITS(VALUE) ((unsigned) (VALUE) + 0x80 < 0x100)
299 #define INT_16_BITS(VALUE) ((unsigned) (VALUE) + 0x8000 < 0x10000)
301 #define CONST_OK_FOR_I(VALUE) ((VALUE) == 0)
302 #define CONST_OK_FOR_J(VALUE) ((VALUE) == 1)
303 #define CONST_OK_FOR_K(VALUE) ((VALUE) == 2)
304 #define CONST_OK_FOR_L(VALUE) ((VALUE) == 4)
306 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
307 ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \
308 (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \
309 (C) == 'K' ? CONST_OK_FOR_K (VALUE) : \
310 (C) == 'L' ? CONST_OK_FOR_L (VALUE) : 0)
313 /* Similar, but for floating constants, and defining letters G and H.
314 Here VALUE is the CONST_DOUBLE rtx itself.
316 `G' is a floating-point zero. */
318 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
321 /* Stack layout; function entry, exit and calling. */
323 /* Define this if pushing a word on the stack
324 makes the stack pointer a smaller address. */
326 #define STACK_GROWS_DOWNWARD
328 /* Define this if the nominal address of the stack frame
329 is at the high-address end of the local variables;
330 that is, each additional local variable allocated
331 goes at a more negative offset in the frame. */
333 #define FRAME_GROWS_DOWNWARD
335 /* Offset within stack frame to start allocating local variables at.
336 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
337 first local allocated. Otherwise, it is the offset to the BEGINNING
338 of the first local allocated. */
340 #define STARTING_FRAME_OFFSET -20
342 /* Offset of first parameter from the argument pointer register value. */
343 /* Is equal to the size of the saved fp + pc, even if an fp isn't
344 saved since the value is used before we know. */
346 #define FIRST_PARM_OFFSET(FNDECL) 0
348 /* Specify the registers used for certain standard purposes.
349 The values of these macros are register numbers. */
351 /* Register to use for pushing function arguments. */
352 #define STACK_POINTER_REGNUM 8
354 /* Base register for access to local variables of the function. */
355 #define FRAME_POINTER_REGNUM 7
357 /* Base register for access to arguments of the function. */
358 #define ARG_POINTER_REGNUM 7
360 /* Register in which static-chain is passed to a function. */
361 #define STATIC_CHAIN_REGNUM 5
363 /* Value should be nonzero if functions must have frame pointers.
364 Zero means the frame pointer need not be set up (and parms
365 may be accessed via the stack pointer) in functions that seem suitable.
366 This is computed in `reload', in reload1.c.
368 Currently we always need a frame pointer. In the future we'd like
369 to be able to eliminate it. */
370 #define FRAME_POINTER_REQUIRED 1
372 /* Store in the variable DEPTH the initial difference between the
373 frame pointer reg contents and the stack pointer reg contents,
374 as of the start of the function body. This depends on the layout
375 of the fixed parts of the stack frame and on how registers are saved. */
377 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0
379 /* A guess for the MN10300. */
380 #define PROMOTE_PROTOTYPES 1
382 /* Value is the number of bytes of arguments automatically
383 popped when returning from a subroutine call.
384 FUNDECL is the declaration node of the function (as a tree),
385 FUNTYPE is the data type of the function (as a tree),
386 or for a library call it is an identifier node for the subroutine name.
387 SIZE is the number of bytes of arguments passed on the stack. */
389 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
391 /* 1 if N is a possible register number for function argument passing.
392 On the MN10300, no registers are used in this way. */
394 #define FUNCTION_ARG_REGNO_P(N) 0
396 /* Define a data type for recording info about an argument list
397 during the scan of that argument list. This data type should
398 hold all necessary information about the function itself
399 and about the args processed so far, enough to enable macros
400 such as FUNCTION_ARG to determine where the next arg should go.
402 On the MN10300, this is a single integer, which is a number of bytes
403 of arguments scanned so far. */
405 #define CUMULATIVE_ARGS int
407 /* Initialize a variable CUM of type CUMULATIVE_ARGS
408 for a call to a function whose data type is FNTYPE.
409 For a library call, FNTYPE is 0.
411 On the MN10300, the offset starts at 0. */
413 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
416 /* Update the data in CUM to advance over an argument
417 of mode MODE and data type TYPE.
418 (TYPE is null for libcalls where that information may not be available.) */
420 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
421 ((CUM) += ((MODE) != BLKmode \
422 ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
423 : (int_size_in_bytes (TYPE) + 3) & ~3))
425 /* Define where to put the arguments to a function.
426 Value is zero to push the argument on the stack,
427 or a hard register in which to store the argument.
429 MODE is the argument's machine mode.
430 TYPE is the data type of the argument (as a tree).
431 This is null for libcalls where that information may
433 CUM is a variable of type CUMULATIVE_ARGS which gives info about
434 the preceding args and about the function being called.
435 NAMED is nonzero if this argument is a named parameter
436 (otherwise it is an extra parameter matching an ellipsis). */
438 /* On the MN10300 all args are pushed. */
440 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
443 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
444 ((TYPE) && int_size_in_bytes (TYPE) > 8)
446 #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
447 ((TYPE) && int_size_in_bytes (TYPE) > 8)
449 /* Define how to find the value returned by a function.
450 VALTYPE is the data type of the value (as a tree).
451 If the precise function being called is known, FUNC is its FUNCTION_DECL;
452 otherwise, FUNC is 0. */
454 #define FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx (REG, TYPE_MODE (VALTYPE), 0)
456 /* Define how to find the value returned by a library function
457 assuming the value has mode MODE. */
459 #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 0)
461 /* 1 if N is a possible register number for a function value. */
463 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
465 /* Return values > 8 bytes in length in memory. */
466 #define DEFAULT_PCC_STRUCT_RETURN 0
467 #define RETURN_IN_MEMORY(TYPE) \
468 (int_size_in_bytes (TYPE) > 8 || TYPE_MODE (TYPE) == BLKmode)
470 /* Register in which address to store a structure value
471 is passed to a function. On the MN10300 it's passed as
472 the first parameter. */
474 #define STRUCT_VALUE 0
476 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
477 the stack pointer does not matter. The value is tested only in
478 functions that have frame pointers.
479 No definition is equivalent to always zero. */
481 #define EXIT_IGNORE_STACK 1
483 /* Output assembler code to FILE to increment profiler label # LABELNO
484 for profiling a function entry. */
486 #define FUNCTION_PROFILER(FILE, LABELNO) ;
488 #define TRAMPOLINE_TEMPLATE(FILE) \
490 fprintf (FILE, "\tadd -4,sp\n"); \
491 fprintf (FILE, "\t.long 0x0004fffa\n"); \
492 fprintf (FILE, "\tadd 4,sp\n"); \
493 fprintf (FILE, "\tmov mdr,d0\n"); \
494 fprintf (FILE, "\tmov d0,a0\n"); \
495 fprintf (FILE, "\tmov (15,a0),a1\n"); \
496 fprintf (FILE, "\tmov (19,a0),a0\n"); \
497 fprintf (FILE, "\tjmp (a0)\n"); \
498 fprintf (FILE, "\t.long 0\n"); \
499 fprintf (FILE, "\t.long 0\n"); \
502 /* Length in units of the trampoline for entering a nested function. */
504 #define TRAMPOLINE_SIZE 0x1d
506 #define TRAMPOLINE_ALIGNMENT 32
508 /* Emit RTL insns to initialize the variable parts of a trampoline.
509 FNADDR is an RTX for the address of the function's pure code.
510 CXT is an RTX for the static chain value for the function. */
512 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
514 emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 0x16)), \
516 emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 0x1a)), \
520 /* Addressing modes, and classification of registers for them. */
523 /* 1 if X is an rtx for a constant that is a valid address. */
525 #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
527 /* Extra constraints. */
529 #define EXTRA_CONSTRAINT(OP, C) \
530 ((C) == 'S' ? GET_CODE (OP) == SYMBOL_REF : 0)
532 /* Maximum number of registers that can appear in a valid memory address. */
534 #define MAX_REGS_PER_ADDRESS 2
536 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
537 and check its validity for a certain class.
538 We have two alternate definitions for each of them.
539 The usual definition accepts all pseudo regs; the other rejects
540 them unless they have been allocated suitable hard regs.
541 The symbol REG_OK_STRICT causes the latter definition to be used.
543 Most source files want to accept pseudo regs in the hope that
544 they will get allocated to the class that the insn wants them to be in.
545 Source files for reload pass need to be strict.
546 After reload, it makes no difference, since pseudo regs have
547 been eliminated by then. */
549 #ifndef REG_OK_STRICT
550 /* Nonzero if X is a hard reg that can be used as an index
551 or if it is a pseudo reg. */
552 #define REG_OK_FOR_INDEX_P(X) \
553 ((REGNO (X) >= 0 && REGNO(X) <= 3) || REGNO (X) >= FIRST_PSEUDO_REGISTER)
554 /* Nonzero if X is a hard reg that can be used as a base reg
555 or if it is a pseudo reg. */
556 #define REG_OK_FOR_BASE_P(X) \
557 ((REGNO (X) >= 4 && REGNO(X) <= 8) || REGNO (X) >= FIRST_PSEUDO_REGISTER)
559 /* Nonzero if X is a hard reg that can be used as an index. */
560 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
561 /* Nonzero if X is a hard reg that can be used as a base reg. */
562 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
566 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
567 that is a valid memory address for an instruction.
568 The MODE argument is the machine mode for the MEM expression
569 that wants to use this address.
571 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
572 except for CONSTANT_ADDRESS_P which is actually
573 machine-independent. */
575 /* Accept either REG or SUBREG where a register is valid. */
577 #define RTX_OK_FOR_BASE_P(X) \
578 ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \
579 || (GET_CODE (X) == SUBREG && REG_P (SUBREG_REG (X)) \
580 && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
582 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
584 if (CONSTANT_ADDRESS_P (X)) \
586 if (RTX_OK_FOR_BASE_P (X)) \
588 if (GET_CODE (X) == PLUS) \
590 rtx base = 0, index = 0; \
591 if (REG_P (XEXP (X, 0)) \
592 && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
593 base = XEXP (X, 0), index = XEXP (X, 1); \
594 if (REG_P (XEXP (X, 1)) \
595 && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
596 base = XEXP (X, 1), index = XEXP (X, 0); \
597 if (base != 0 && index != 0) \
599 if (GET_CODE (index) == CONST_INT) \
601 if (GET_CODE (index) == REG \
602 && REG_OK_FOR_INDEX_P (index)) \
609 /* Try machine-dependent ways of modifying an illegitimate address
610 to be legitimate. If we find one, return the new, valid address.
611 This macro is used in only one place: `memory_address' in explow.c.
613 OLDX is the address as it was before break_out_memory_refs was called.
614 In some cases it is useful to look at this to decide what needs to be done.
616 MODE and WIN are passed so that this macro can use
617 GO_IF_LEGITIMATE_ADDRESS.
619 It is always safe for this macro to do nothing. It exists to recognize
620 opportunities to optimize the output. */
622 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
624 /* Go to LABEL if ADDR (a legitimate address expression)
625 has an effect that depends on the machine mode it is used for. */
627 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
629 /* Nonzero if the constant value X is a legitimate general operand.
630 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
632 #define LEGITIMATE_CONSTANT_P(X) \
633 (GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT) \
636 /* Tell final.c how to eliminate redundant test instructions. */
638 /* Here we define machine-dependent flags and fields in cc_status
639 (see `conditions.h'). No extra ones are needed for the vax. */
641 /* Store in cc_status the expressions
642 that the condition codes will describe
643 after execution of an instruction whose pattern is EXP.
644 Do not alter them if the instruction would not alter the cc's. */
646 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
648 /* Compute the cost of computing a constant rtl expression RTX
649 whose rtx-code is CODE. The body of this macro is a portion
650 of a switch statement. If the code is computed here,
651 return it with a return statement. Otherwise, break from the switch. */
653 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
654 default: { int _zxy= const_costs(RTX, CODE); \
655 if(_zxy) return _zxy; break;}
657 #define REGISTER_MOVE_COST(CLASS1, CLASS2) 3
659 /* A crude cut at RTX_COSTS for the MN10300. */
661 /* Provide the costs of a rtl expression. This is in the body of a
664 There aren't DImode MOD, DIV or MULT operations, so call them
665 very expensive. Everything else is pretty much a costant cost. */
667 #define RTX_COSTS(RTX,CODE,OUTER_CODE) \
674 /* Nonzero if access to memory by bytes or half words is no faster
675 than accessing full words. */
676 #define SLOW_BYTE_ACCESS 1
678 /* According expr.c, a value of around 6 should minimize code size, and
679 for the MN10300 series, that's our primary concern. */
682 #define TEXT_SECTION_ASM_OP "\t.section .text"
683 #define DATA_SECTION_ASM_OP "\t.section .data"
684 #define BSS_SECTION_ASM_OP "\t.section .bss"
686 /* Output at beginning/end of assembler file. */
687 #undef ASM_FILE_START
688 #define ASM_FILE_START(FILE) asm_file_start(FILE)
690 #define ASM_COMMENT_START "#"
692 /* Output to assembler file text saying following lines
693 may contain character constants, extra white space, comments, etc. */
695 #define ASM_APP_ON "#APP\n"
697 /* Output to assembler file text saying following lines
698 no longer contain unusual constructs. */
700 #define ASM_APP_OFF "#NO_APP\n"
702 /* This is how to output an assembler line defining a `double' constant.
703 It is .dfloat or .gfloat, depending. */
705 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
706 do { char dstr[30]; \
707 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
708 fprintf (FILE, "\t.double %s\n", dstr); \
712 /* This is how to output an assembler line defining a `float' constant. */
713 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
714 do { char dstr[30]; \
715 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
716 fprintf (FILE, "\t.float %s\n", dstr); \
719 /* This is how to output an assembler line defining an `int' constant. */
721 #define ASM_OUTPUT_INT(FILE, VALUE) \
722 ( fprintf (FILE, "\t.long "), \
723 output_addr_const (FILE, (VALUE)), \
724 fprintf (FILE, "\n"))
726 /* Likewise for `char' and `short' constants. */
728 #define ASM_OUTPUT_SHORT(FILE, VALUE) \
729 ( fprintf (FILE, "\t.hword "), \
730 output_addr_const (FILE, (VALUE)), \
731 fprintf (FILE, "\n"))
733 #define ASM_OUTPUT_CHAR(FILE, VALUE) \
734 ( fprintf (FILE, "\t.byte "), \
735 output_addr_const (FILE, (VALUE)), \
736 fprintf (FILE, "\n"))
738 /* This is how to output an assembler line for a numeric constant byte. */
739 #define ASM_OUTPUT_BYTE(FILE, VALUE) \
740 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
742 /* Define the parentheses used to group arithmetic operations
743 in assembler code. */
745 #define ASM_OPEN_PAREN "("
746 #define ASM_CLOSE_PAREN ")"
748 /* This says how to output the assembler to define a global
749 uninitialized but not common symbol.
750 Try to use asm_output_bss to implement this macro. */
752 #define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED) \
753 asm_output_bss ((FILE), (DECL), (NAME), (SIZE), (ROUNDED))
755 /* This is how to output the definition of a user-level label named NAME,
756 such as the label on a static function or variable NAME. */
758 #define ASM_OUTPUT_LABEL(FILE, NAME) \
759 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
761 /* This is how to output a command to make the user-level label named NAME
762 defined for reference from other files. */
764 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \
765 do { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
767 /* This is how to output a reference to a user-level label named NAME.
768 `assemble_name' uses this. */
770 #undef ASM_OUTPUT_LABELREF
771 #define ASM_OUTPUT_LABELREF(FILE, NAME) \
774 STRIP_NAME_ENCODING (real_name, (NAME)); \
775 fprintf (FILE, "_%s", real_name); \
778 /* Store in OUTPUT a string (made with alloca) containing
779 an assembler-name for a local static variable named NAME.
780 LABELNO is an integer which is different for each call. */
782 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
783 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
784 sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
786 /* This is how we tell the assembler that two symbols have the same value. */
788 #define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
789 do { assemble_name(FILE, NAME1); \
790 fputs(" = ", FILE); \
791 assemble_name(FILE, NAME2); \
792 fputc('\n', FILE); } while (0)
795 /* How to refer to registers in assembler output.
796 This sequence is indexed by compiler's hard-register-number (see above). */
798 #define REGISTER_NAMES \
799 { "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3", "sp" }
801 /* Print an instruction operand X on file FILE.
802 look in mn10300.c for details */
804 #define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE,X,CODE)
806 /* Print a memory operand whose address is X, on file FILE.
807 This uses a function in output-vax.c. */
809 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
811 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)
812 #define ASM_OUTPUT_REG_POP(FILE,REGNO)
814 /* This is how to output an element of a case-vector that is absolute. */
816 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
817 asm_fprintf (FILE, "\t%s .L%d\n", ".long", VALUE)
819 /* This is how to output an element of a case-vector that is relative. */
821 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
822 fprintf (FILE, "\t%s .L%d-.L%d\n", ".long", VALUE, REL)
824 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
826 fprintf (FILE, "\t.align %d\n", (LOG))
828 /* We don't have to worry about dbx compatability for the mn10300. */
829 #define DEFAULT_GDB_EXTENSIONS 1
831 /* Use stabs debugging info by default. */
832 #undef PREFERRED_DEBUGGING_TYPE
833 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
835 #define DBX_REGISTER_NUMBER(REGNO) REGNO
837 /* Define to use software floating point emulator for REAL_ARITHMETIC and
838 decimal <-> binary conversion. */
839 #define REAL_ARITHMETIC
841 /* Specify the machine mode that this machine uses
842 for the index in the tablejump instruction. */
843 #define CASE_VECTOR_MODE Pmode
845 /* Define this if the case instruction drops through after the table
846 when the index is out of range. Don't define it if the case insn
847 jumps to the default label instead. */
848 #define CASE_DROPS_THROUGH
850 /* Define if operations between registers always perform the operation
851 on the full register even if a narrower mode is specified. */
852 #define WORD_REGISTER_OPERATIONS
854 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
856 /* Specify the tree operation to be used to convert reals to integers. */
857 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
859 /* This flag, if defined, says the same insns that convert to a signed fixnum
860 also convert validly to an unsigned one. */
861 #define FIXUNS_TRUNC_LIKE_FIX_TRUNC
863 /* This is the kind of divide that is easiest to do in the general case. */
864 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
866 /* Max number of bytes we can move from memory to memory
867 in one reasonably fast instruction. */
870 /* Define if shifts truncate the shift count
871 which implies one can omit a sign-extension or zero-extension
873 #define SHIFT_COUNT_TRUNCATED 1
875 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
876 is done just by pretending it is already truncated. */
877 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
879 #define STORE_FLAG_VALUE 1
881 /* Specify the machine mode that pointers have.
882 After generation of rtl, the compiler makes no further distinction
883 between pointers and any other objects of this machine mode. */
886 /* A function address in a call instruction
887 is a byte address (for indexing purposes)
888 so give the MEM rtx a byte's mode. */
889 #define FUNCTION_MODE QImode
891 /* The assembler op to get a word. */
893 #define FILE_ASM_OP "\t.file\n"
895 extern void asm_file_start ();
896 extern int const_costs ();
897 extern void print_operand ();
898 extern void print_operand_address ();
899 extern void expand_prologue ();
900 extern void expand_epilogue ();
901 extern void notice_update_cc ();
902 extern int call_address_operand ();
903 extern enum reg_class secondary_reload_class ();