1 /* Definitions of target machine for GNU compiler, Mitsubishi M32R cpu.
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
3 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
26 /* ??? Create elf.h and have svr4.h include it. */
29 #undef SWITCH_TAKES_ARG
30 #undef WORD_SWITCH_TAKES_ARG
31 #undef HANDLE_SYSV_PRAGMA
35 #undef WCHAR_TYPE_SIZE
37 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
44 #undef SUBTARGET_SWITCHES
46 /* Print subsidiary information on the compiler version in use. */
47 #ifndef TARGET_VERSION
48 #define TARGET_VERSION fprintf (stderr, " (m32r)")
51 /* Switch Recognition by gcc.c. Add -G xx support */
53 #undef SWITCH_TAKES_ARG
54 #define SWITCH_TAKES_ARG(CHAR) \
55 (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G')
57 /* Names to predefine in the preprocessor for this target machine. */
58 /* __M32R__ is defined by the existing compiler so we use that. */
59 #define CPP_PREDEFINES "-Acpu=m32r -Amachine=m32r -D__M32R__"
61 /* This macro defines names of additional specifications to put in the specs
62 that can be used in various specifications like CC1_SPEC. Its definition
63 is an initializer with a subgrouping for each command option.
65 Each subgrouping contains a string constant, that defines the
66 specification name, and a string constant that used by the GNU CC driver
69 Do not define this macro if it does not need to do anything. */
71 #ifndef SUBTARGET_EXTRA_SPECS
72 #define SUBTARGET_EXTRA_SPECS
76 #define ASM_CPU_SPEC ""
80 #define CPP_CPU_SPEC ""
84 #define CC1_CPU_SPEC ""
88 #define LINK_CPU_SPEC ""
91 #ifndef STARTFILE_CPU_SPEC
92 #define STARTFILE_CPU_SPEC "%{!shared:crt0.o%s} crtinit.o%s"
95 #ifndef ENDFILE_CPU_SPEC
96 #define ENDFILE_CPU_SPEC "-lgloss crtfini.o%s"
100 #if 0 /* not supported yet */
101 #define RELAX_SPEC "%{mrelax:-relax}"
103 #define RELAX_SPEC ""
107 #define EXTRA_SPECS \
108 { "asm_cpu", ASM_CPU_SPEC }, \
109 { "cpp_cpu", CPP_CPU_SPEC }, \
110 { "cc1_cpu", CC1_CPU_SPEC }, \
111 { "link_cpu", LINK_CPU_SPEC }, \
112 { "startfile_cpu", STARTFILE_CPU_SPEC }, \
113 { "endfile_cpu", ENDFILE_CPU_SPEC }, \
114 { "relax", RELAX_SPEC }, \
115 SUBTARGET_EXTRA_SPECS
117 #define CC1_SPEC "%{G*} %(cc1_cpu)"
119 /* Options to pass on to the assembler. */
121 #define ASM_SPEC "%{v} %(asm_cpu) %(relax)"
123 #undef ASM_FINAL_SPEC
125 #define LINK_SPEC "%{v} %(link_cpu) %(relax)"
127 #undef STARTFILE_SPEC
128 #define STARTFILE_SPEC "%(startfile_cpu)"
131 #define ENDFILE_SPEC "%(endfile_cpu)"
135 /* Run-time compilation parameters selecting different hardware subsets. */
137 extern int target_flags;
139 /* If non-zero, tell the linker to do relaxing.
140 We don't do anything with the option, other than recognize it.
141 LINK_SPEC handles passing -relax to the linker.
142 This can cause incorrect debugging information as line numbers may
143 turn out wrong. This shouldn't be specified unless accompanied with -O2
144 [where the user expects debugging information to be less accurate]. */
145 #define TARGET_RELAX_MASK (1 << 0)
147 /* For miscellaneous debugging purposes. */
148 #define TARGET_DEBUG_MASK (1 << 1)
149 #define TARGET_DEBUG (target_flags & TARGET_DEBUG_MASK)
151 /* Align loops to 32 byte boundaries (cache line size). */
152 /* ??? This option is experimental and is not documented. */
153 #define TARGET_ALIGN_LOOPS_MASK (1 << 2)
154 #define TARGET_ALIGN_LOOPS (target_flags & TARGET_ALIGN_LOOPS_MASK)
156 /* Change issue rate. */
157 #define TARGET_ISSUE_RATE_MASK (1 << 3)
158 #define TARGET_ISSUE_RATE (target_flags & TARGET_ISSUE_RATE_MASK)
160 /* Change branch cost */
161 #define TARGET_BRANCH_COST_MASK (1 << 4)
162 #define TARGET_BRANCH_COST (target_flags & TARGET_BRANCH_COST_MASK)
164 /* Target machine to compile for. */
165 #define TARGET_M32R 1
167 /* Macro to define tables used to set the flags.
168 This is a list in braces of pairs in braces,
169 each pair being { "NAME", VALUE }
170 where VALUE is the bits to set or minus the bits to clear.
171 An empty string NAME is used to identify the default VALUE. */
173 #ifndef SUBTARGET_SWITCHES
174 #define SUBTARGET_SWITCHES
177 #ifndef TARGET_DEFAULT
178 #define TARGET_DEFAULT 0
181 #define TARGET_SWITCHES \
183 /* { "relax", TARGET_RELAX_MASK, "" }, \
184 { "no-relax", -TARGET_RELAX_MASK, "" },*/ \
185 { "debug", TARGET_DEBUG_MASK, \
186 N_("Display compile time statistics") }, \
187 { "align-loops", TARGET_ALIGN_LOOPS_MASK, \
188 N_("Align all loops to 32 byte boundary") }, \
189 { "no-align-loops", -TARGET_ALIGN_LOOPS_MASK, "" }, \
190 { "issue-rate=1", TARGET_ISSUE_RATE_MASK, \
191 N_("Only issue one instruction per cycle") }, \
192 { "issue-rate=2", -TARGET_ISSUE_RATE_MASK, "" }, \
193 { "branch-cost=1", TARGET_BRANCH_COST_MASK, \
194 N_("Prefer branches over conditional execution") }, \
195 { "branch-cost=2", -TARGET_BRANCH_COST_MASK, "" }, \
197 { "", TARGET_DEFAULT, "" } \
200 extern const char * m32r_model_string;
201 extern const char * m32r_sdata_string;
203 #ifndef SUBTARGET_OPTIONS
204 #define SUBTARGET_OPTIONS
207 #define TARGET_OPTIONS \
209 { "model=", & m32r_model_string, \
210 N_("Code size: small, medium or large") }, \
211 { "sdata=", & m32r_sdata_string, \
212 N_("Small data area: none, sdata, use") } \
218 Code models are used to select between two choices of two separate
219 possibilities (address space size, call insn to use):
221 small: addresses use 24 bits, use bl to make calls
222 medium: addresses use 32 bits, use bl to make calls (*1)
223 large: addresses use 32 bits, use seth/add3/jl to make calls (*2)
225 The fourth is "addresses use 24 bits, use seth/add3/jl to make calls" but
226 using this one doesn't make much sense.
228 (*1) The linker may eventually be able to relax seth/add3 -> ld24.
229 (*2) The linker may eventually be able to relax seth/add3/jl -> bl.
231 Internally these are recorded as TARGET_ADDR{24,32} and
234 The __model__ attribute can be used to select the code model to use when
235 accessing particular objects. */
237 enum m32r_model { M32R_MODEL_SMALL, M32R_MODEL_MEDIUM, M32R_MODEL_LARGE };
239 extern enum m32r_model m32r_model;
240 #define TARGET_MODEL_SMALL (m32r_model == M32R_MODEL_SMALL)
241 #define TARGET_MODEL_MEDIUM (m32r_model == M32R_MODEL_MEDIUM)
242 #define TARGET_MODEL_LARGE (m32r_model == M32R_MODEL_LARGE)
243 #define TARGET_ADDR24 (m32r_model == M32R_MODEL_SMALL)
244 #define TARGET_ADDR32 (! TARGET_ADDR24)
245 #define TARGET_CALL26 (! TARGET_CALL32)
246 #define TARGET_CALL32 (m32r_model == M32R_MODEL_LARGE)
248 /* The default is the small model. */
249 #ifndef M32R_MODEL_DEFAULT
250 #define M32R_MODEL_DEFAULT "small"
255 The SDA consists of sections .sdata, .sbss, and .scommon.
256 .scommon isn't a real section, symbols in it have their section index
257 set to SHN_M32R_SCOMMON, though support for it exists in the linker script.
259 Two switches control the SDA:
261 -G NNN - specifies the maximum size of variable to go in the SDA
263 -msdata=foo - specifies how such variables are handled
265 -msdata=none - small data area is disabled
267 -msdata=sdata - small data goes in the SDA, special code isn't
268 generated to use it, and special relocs aren't
271 -msdata=use - small data goes in the SDA, special code is generated
272 to use the SDA and special relocs are generated
274 The SDA is not multilib'd, it isn't necessary.
275 MULTILIB_EXTRA_OPTS is set in tmake_file to -msdata=sdata so multilib'd
276 libraries have small data in .sdata/SHN_M32R_SCOMMON so programs that use
277 -msdata=use will successfully link with them (references in header files
278 will cause the compiler to emit code that refers to library objects in
279 .data). ??? There can be a problem if the user passes a -G value greater
280 than the default and a library object in a header file is that size.
281 The default is 8 so this should be rare - if it occurs the user
282 is required to rebuild the libraries or use a smaller value for -G.
285 /* Maximum size of variables that go in .sdata/.sbss.
286 The -msdata=foo switch also controls how small variables are handled. */
287 #ifndef SDATA_DEFAULT_SIZE
288 #define SDATA_DEFAULT_SIZE 8
291 extern int g_switch_value; /* value of the -G xx switch */
292 extern int g_switch_set; /* whether -G xx was passed. */
294 enum m32r_sdata { M32R_SDATA_NONE, M32R_SDATA_SDATA, M32R_SDATA_USE };
296 extern enum m32r_sdata m32r_sdata;
297 #define TARGET_SDATA_NONE (m32r_sdata == M32R_SDATA_NONE)
298 #define TARGET_SDATA_SDATA (m32r_sdata == M32R_SDATA_SDATA)
299 #define TARGET_SDATA_USE (m32r_sdata == M32R_SDATA_USE)
301 /* Default is to disable the SDA
302 [for upward compatibility with previous toolchains]. */
303 #ifndef M32R_SDATA_DEFAULT
304 #define M32R_SDATA_DEFAULT "none"
307 /* Define this macro as a C expression for the initializer of an array of
308 strings to tell the driver program which options are defaults for this
309 target and thus do not need to be handled specially when using
310 `MULTILIB_OPTIONS'. */
311 #ifndef SUBTARGET_MULTILIB_DEFAULTS
312 #define SUBTARGET_MULTILIB_DEFAULTS
315 #ifndef MULTILIB_DEFAULTS
316 #define MULTILIB_DEFAULTS { "mmodel=small" SUBTARGET_MULTILIB_DEFAULTS }
319 /* Sometimes certain combinations of command options do not make
320 sense on a particular target machine. You can define a macro
321 `OVERRIDE_OPTIONS' to take account of this. This macro, if
322 defined, is executed once just after all the command options have
325 Don't use this macro to turn on various extra optimizations for
326 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
328 #ifndef SUBTARGET_OVERRIDE_OPTIONS
329 #define SUBTARGET_OVERRIDE_OPTIONS
332 #define OVERRIDE_OPTIONS \
335 /* These need to be done at start up. \
336 It's convenient to do them here. */ \
338 SUBTARGET_OVERRIDE_OPTIONS \
342 #ifndef SUBTARGET_OPTIMIZATION_OPTIONS
343 #define SUBTARGET_OPTIMIZATION_OPTIONS
346 #define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \
350 flag_regmove = TRUE; \
354 flag_omit_frame_pointer = TRUE; \
355 flag_strength_reduce = FALSE; \
358 SUBTARGET_OPTIMIZATION_OPTIONS \
362 /* Define this macro if debugging can be performed even without a
363 frame pointer. If this macro is defined, GNU CC will turn on the
364 `-fomit-frame-pointer' option whenever `-O' is specified. */
365 #define CAN_DEBUG_WITHOUT_FP
367 /* Target machine storage layout. */
369 /* Define to use software floating point emulator for REAL_ARITHMETIC and
370 decimal <-> binary conversion. */
371 #define REAL_ARITHMETIC
373 /* Define this if most significant bit is lowest numbered
374 in instructions that operate on numbered bit-fields. */
375 #define BITS_BIG_ENDIAN 1
377 /* Define this if most significant byte of a word is the lowest numbered. */
378 #define BYTES_BIG_ENDIAN 1
380 /* Define this if most significant word of a multiword number is the lowest
382 #define WORDS_BIG_ENDIAN 1
384 /* Define this macro if WORDS_BIG_ENDIAN is not constant. This must
385 be a constant value with the same meaning as WORDS_BIG_ENDIAN,
386 which will be used only when compiling libgcc2.c. Typically the
387 value will be set based on preprocessor defines. */
388 /*#define LIBGCC2_WORDS_BIG_ENDIAN 1*/
390 /* Number of bits in an addressable storage unit. */
391 #define BITS_PER_UNIT 8
393 /* Width in bits of a "word", which is the contents of a machine register.
394 Note that this is not necessarily the width of data type `int';
395 if using 16-bit ints on a 68000, this would still be 32.
396 But on a machine with 16-bit registers, this would be 16. */
397 #define BITS_PER_WORD 32
399 /* Width of a word, in units (bytes). */
400 #define UNITS_PER_WORD 4
402 /* Define this macro if it is advisable to hold scalars in registers
403 in a wider mode than that declared by the program. In such cases,
404 the value is constrained to be within the bounds of the declared
405 type, but kept valid in the wider mode. The signedness of the
406 extension may differ from that of the type. */
407 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
408 if (GET_MODE_CLASS (MODE) == MODE_INT \
409 && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
414 /* Define this macro if the promotion described by `PROMOTE_MODE'
415 should also be done for outgoing function arguments. */
416 /*#define PROMOTE_FUNCTION_ARGS*/
418 /* Likewise, if the function return value is promoted.
419 If defined, FUNCTION_VALUE must perform the same promotions done by
421 /*#define PROMOTE_FUNCTION_RETURN*/
423 /* Width in bits of a pointer.
424 See also the macro `Pmode' defined below. */
425 #define POINTER_SIZE 32
427 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
428 #define PARM_BOUNDARY 32
430 /* Boundary (in *bits*) on which stack pointer should be aligned. */
431 #define STACK_BOUNDARY 32
433 /* ALIGN FRAMES on word boundaries */
434 #define M32R_STACK_ALIGN(LOC) (((LOC)+3) & ~3)
436 /* Allocation boundary (in *bits*) for the code of a function. */
437 #define FUNCTION_BOUNDARY 32
439 /* Alignment of field after `int : 0' in a structure. */
440 #define EMPTY_FIELD_BOUNDARY 32
442 /* Every structure's size must be a multiple of this. */
443 #define STRUCTURE_SIZE_BOUNDARY 8
445 /* A bitfield declared as `int' forces `int' alignment for the struct. */
446 #define PCC_BITFIELD_TYPE_MATTERS 1
448 /* No data type wants to be aligned rounder than this. */
449 #define BIGGEST_ALIGNMENT 32
451 /* The best alignment to use in cases where we have a choice. */
452 #define FASTEST_ALIGNMENT 32
454 /* Make strings word-aligned so strcpy from constants will be faster. */
455 #define CONSTANT_ALIGNMENT(EXP, ALIGN) \
456 ((TREE_CODE (EXP) == STRING_CST \
457 && (ALIGN) < FASTEST_ALIGNMENT) \
458 ? FASTEST_ALIGNMENT : (ALIGN))
460 /* Make arrays of chars word-aligned for the same reasons. */
461 #define DATA_ALIGNMENT(TYPE, ALIGN) \
462 (TREE_CODE (TYPE) == ARRAY_TYPE \
463 && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
464 && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
466 /* Set this nonzero if move instructions will actually fail to work
467 when given unaligned data. */
468 #define STRICT_ALIGNMENT 1
470 /* Layout of source language data types. */
472 #define SHORT_TYPE_SIZE 16
473 #define INT_TYPE_SIZE 32
474 #define LONG_TYPE_SIZE 32
475 #define LONG_LONG_TYPE_SIZE 64
476 #define FLOAT_TYPE_SIZE 32
477 #define DOUBLE_TYPE_SIZE 64
478 #define LONG_DOUBLE_TYPE_SIZE 64
480 /* Define this as 1 if `char' should by default be signed; else as 0. */
481 #define DEFAULT_SIGNED_CHAR 1
483 #define SIZE_TYPE "long unsigned int"
484 #define PTRDIFF_TYPE "long int"
485 #define WCHAR_TYPE "short unsigned int"
486 #define WCHAR_TYPE_SIZE 16
488 /* Define results of standard character escape sequences. */
489 #define TARGET_BELL 007
490 #define TARGET_BS 010
491 #define TARGET_TAB 011
492 #define TARGET_NEWLINE 012
493 #define TARGET_VT 013
494 #define TARGET_FF 014
495 #define TARGET_CR 015
497 /* Standard register usage. */
499 /* Number of actual hardware registers.
500 The hardware registers are assigned numbers for the compiler
501 from 0 to just below FIRST_PSEUDO_REGISTER.
502 All registers that the compiler knows about must be given numbers,
503 even those that are not normally considered general registers. */
505 #define M32R_NUM_REGISTERS 19
507 #ifndef SUBTARGET_NUM_REGISTERS
508 #define SUBTARGET_NUM_REGISTERS 0
511 #define FIRST_PSEUDO_REGISTER (M32R_NUM_REGISTERS + SUBTARGET_NUM_REGISTERS)
513 /* 1 for registers that have pervasive standard uses
514 and are not available for the register allocator.
516 0-3 - arguments/results
517 4-5 - call used [4 is used as a tmp during prologue/epilogue generation]
519 7 - call used, static chain pointer
521 12 - call saved [reserved for global pointer]
523 14 - subroutine link register
529 By default, the extension registers are not available. */
531 #ifndef SUBTARGET_FIXED_REGISTERS
532 #define SUBTARGET_FIXED_REGISTERS
535 #define FIXED_REGISTERS \
537 0, 0, 0, 0, 0, 0, 0, 0, \
538 0, 0, 0, 0, 0, 0, 0, 1, \
540 SUBTARGET_FIXED_REGISTERS \
543 /* 1 for registers not available across function calls.
544 These must include the FIXED_REGISTERS and also any
545 registers that can be used without being saved.
546 The latter must include the registers where values are returned
547 and the register where structure-value addresses are passed.
548 Aside from that, you can include as many other registers as you like. */
550 #ifndef SUBTARGET_CALL_USED_REGISTERS
551 #define SUBTARGET_CALL_USED_REGISTERS
554 #define CALL_USED_REGISTERS \
556 1, 1, 1, 1, 1, 1, 1, 1, \
557 0, 0, 0, 0, 0, 0, 1, 1, \
559 SUBTARGET_CALL_USED_REGISTERS \
562 /* Zero or more C statements that may conditionally modify two variables
563 `fixed_regs' and `call_used_regs' (both of type `char []') after they
564 have been initialized from the two preceding macros.
566 This is necessary in case the fixed or call-clobbered registers depend
569 You need not define this macro if it has no work to do. */
571 #ifdef SUBTARGET_CONDITIONAL_REGISTER_USAGE
572 #define CONDITIONAL_REGISTER_USAGE SUBTARGET_CONDITIONAL_REGISTER_USAGE
575 /* If defined, an initializer for a vector of integers, containing the
576 numbers of hard registers in the order in which GNU CC should
577 prefer to use them (from most preferred to least). */
579 #ifndef SUBTARGET_REG_ALLOC_ORDER
580 #define SUBTARGET_REG_ALLOC_ORDER
583 #if 1 /* better for int code */
584 #define REG_ALLOC_ORDER \
586 4, 5, 6, 7, 2, 3, 8, 9, 10, \
587 11, 12, 13, 14, 0, 1, 15, 16, 17, 18 \
588 SUBTARGET_REG_ALLOC_ORDER \
591 #else /* better for fp code at expense of int code */
592 #define REG_ALLOC_ORDER \
594 0, 1, 2, 3, 4, 5, 6, 7, 8, \
595 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 \
596 SUBTARGET_REG_ALLOC_ORDER \
600 /* Return number of consecutive hard regs needed starting at reg REGNO
601 to hold something of mode MODE.
602 This is ordinarily the length in words of a value of mode MODE
603 but can be less for certain modes in special long registers. */
604 #define HARD_REGNO_NREGS(REGNO, MODE) \
605 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
607 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
608 extern unsigned int m32r_hard_regno_mode_ok[];
609 extern unsigned int m32r_mode_class[];
610 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
611 ((m32r_hard_regno_mode_ok[REGNO] & m32r_mode_class[MODE]) != 0)
613 /* A C expression that is nonzero if it is desirable to choose
614 register allocation so as to avoid move instructions between a
615 value of mode MODE1 and a value of mode MODE2.
617 If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
618 MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
619 MODE2)' must be zero. */
621 /* Tie QI/HI/SI modes together. */
622 #define MODES_TIEABLE_P(MODE1, MODE2) \
623 (GET_MODE_CLASS (MODE1) == MODE_INT \
624 && GET_MODE_CLASS (MODE2) == MODE_INT \
625 && GET_MODE_SIZE (MODE1) <= UNITS_PER_WORD \
626 && GET_MODE_SIZE (MODE2) <= UNITS_PER_WORD)
628 /* Register classes and constants. */
630 /* Define the classes of registers for register constraints in the
631 machine description. Also define ranges of constants.
633 One of the classes must always be named ALL_REGS and include all hard regs.
634 If there is more than one class, another class must be named NO_REGS
635 and contain no registers.
637 The name GENERAL_REGS must be the name of a class (or an alias for
638 another name such as ALL_REGS). This is the class of registers
639 that is allowed by "g" or "r" in a register constraint.
640 Also, registers outside this class are allocated only when
641 instructions express preferences for them.
643 The classes must be numbered in nondecreasing order; that is,
644 a larger-numbered class must never be contained completely
645 in a smaller-numbered class.
647 For any two classes, it is very desirable that there be another
648 class that represents their union.
650 It is important that any condition codes have class NO_REGS.
651 See `register_operand'. */
655 NO_REGS, CARRY_REG, ACCUM_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
658 #define N_REG_CLASSES ((int) LIM_REG_CLASSES)
660 /* Give names of register classes as strings for dump file. */
661 #define REG_CLASS_NAMES \
662 { "NO_REGS", "CARRY_REG", "ACCUM_REGS", "GENERAL_REGS", "ALL_REGS" }
664 /* Define which registers fit in which classes.
665 This is an initializer for a vector of HARD_REG_SET
666 of length N_REG_CLASSES. */
668 #ifndef SUBTARGET_REG_CLASS_CARRY
669 #define SUBTARGET_REG_CLASS_CARRY 0
672 #ifndef SUBTARGET_REG_CLASS_ACCUM
673 #define SUBTARGET_REG_CLASS_ACCUM 0
676 #ifndef SUBTARGET_REG_CLASS_GENERAL
677 #define SUBTARGET_REG_CLASS_GENERAL 0
680 #ifndef SUBTARGET_REG_CLASS_ALL
681 #define SUBTARGET_REG_CLASS_ALL 0
684 #define REG_CLASS_CONTENTS \
687 { 0x20000 | SUBTARGET_REG_CLASS_CARRY }, \
688 { 0x40000 | SUBTARGET_REG_CLASS_ACCUM }, \
689 { 0x1ffff | SUBTARGET_REG_CLASS_GENERAL }, \
690 { 0x7ffff | SUBTARGET_REG_CLASS_ALL }, \
693 /* The same information, inverted:
694 Return the class number of the smallest class containing
695 reg number REGNO. This could be a conditional expression
696 or could index an array. */
697 extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
698 #define REGNO_REG_CLASS(REGNO) (m32r_regno_reg_class[REGNO])
700 /* The class value for index registers, and the one for base regs. */
701 #define INDEX_REG_CLASS GENERAL_REGS
702 #define BASE_REG_CLASS GENERAL_REGS
704 #define REG_CLASS_FROM_LETTER(C) \
705 ((C) == 'c' ? CARRY_REG \
706 : (C) == 'a' ? ACCUM_REGS \
709 /* These assume that REGNO is a hard or pseudo reg number.
710 They give nonzero only if REGNO is a hard reg of the suitable class
711 or a pseudo reg currently allocated to a suitable hard reg.
712 Since they use reg_renumber, they are safe only once reg_renumber
713 has been allocated, which happens in local-alloc.c. */
714 #define REGNO_OK_FOR_BASE_P(REGNO) \
715 ((REGNO) < FIRST_PSEUDO_REGISTER \
716 ? GPR_P (REGNO) || (REGNO) == ARG_POINTER_REGNUM \
717 : GPR_P (reg_renumber[REGNO]))
718 #define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_BASE_P(REGNO)
720 /* Given an rtx X being reloaded into a reg required to be
721 in class CLASS, return the class of reg to actually use.
722 In general this is just CLASS; but on some machines
723 in some cases it is preferable to use a more restrictive class. */
724 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
727 /* Return the maximum number of consecutive registers
728 needed to represent mode MODE in a register of class CLASS. */
729 #define CLASS_MAX_NREGS(CLASS, MODE) \
730 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
732 /* The letters I, J, K, L, M, N, O, P in a register constraint string
733 can be used to stand for particular ranges of immediate operands.
734 This macro defines what the ranges are.
735 C is the letter, and VALUE is a constant value.
736 Return 1 if VALUE is in the range specified by C. */
737 /* 'I' is used for 8 bit signed immediates.
738 'J' is used for 16 bit signed immediates.
739 'K' is used for 16 bit unsigned immediates.
740 'L' is used for 16 bit immediates left shifted by 16 (sign ???).
741 'M' is used for 24 bit unsigned immediates.
742 'N' is used for any 32 bit non-symbolic value.
743 'O' is used for 5 bit unsigned immediates (shift count).
744 'P' is used for 16 bit signed immediates for compares
745 (values in the range -32767 to +32768). */
747 /* Return true if a value is inside a range. */
748 #define IN_RANGE_P(VALUE, LOW, HIGH) \
749 (((unsigned HOST_WIDE_INT)((VALUE) - (LOW))) \
750 <= ((unsigned HOST_WIDE_INT)((HIGH) - (LOW))))
752 /* Local to this file. */
753 #define INT8_P(X) ((X) >= -0x80 && (X) <= 0x7f)
754 #define INT16_P(X) ((X) >= -0x8000 && (X) <= 0x7fff)
755 #define CMP_INT16_P(X) ((X) >= -0x7fff && (X) <= 0x8000)
756 #define UPPER16_P(X) (((X) & 0xffff) == 0 \
757 && ((X) >> 16) >= -0x8000 \
758 && ((X) >> 16) <= 0x7fff)
759 #define UINT16_P(X) (((unsigned HOST_WIDE_INT) (X)) <= 0x0000ffff)
760 #define UINT24_P(X) (((unsigned HOST_WIDE_INT) (X)) <= 0x00ffffff)
761 #define UINT32_P(X) (((unsigned HOST_WIDE_INT) (X)) <= 0xffffffff)
762 #define UINT5_P(X) ((X) >= 0 && (X) < 32)
763 #define INVERTED_SIGNED_8BIT(VAL) ((VAL) >= -127 && (VAL) <= 128)
765 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
766 ((C) == 'I' ? INT8_P (VALUE) \
767 : (C) == 'J' ? INT16_P (VALUE) \
768 : (C) == 'K' ? UINT16_P (VALUE) \
769 : (C) == 'L' ? UPPER16_P (VALUE) \
770 : (C) == 'M' ? UINT24_P (VALUE) \
771 : (C) == 'N' ? INVERTED_SIGNED_8BIT (VALUE) \
772 : (C) == 'O' ? UINT5_P (VALUE) \
773 : (C) == 'P' ? CMP_INT16_P (VALUE) \
776 /* Similar, but for floating constants, and defining letters G and H.
777 Here VALUE is the CONST_DOUBLE rtx itself.
778 For the m32r, handle a few constants inline.
779 ??? We needn't treat DI and DF modes differently, but for now we do. */
780 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
781 ((C) == 'G' ? easy_di_const (VALUE) \
782 : (C) == 'H' ? easy_df_const (VALUE) \
785 /* A C expression that defines the optional machine-dependent constraint
786 letters that can be used to segregate specific types of operands,
787 usually memory references, for the target machine. It should return 1 if
788 VALUE corresponds to the operand type represented by the constraint letter
789 C. If C is not defined as an extra constraint, the value returned should
790 be 0 regardless of VALUE. */
791 /* Q is for symbolic addresses loadable with ld24.
792 R is for symbolic addresses when ld24 can't be used.
793 S is for stores with pre {inc,dec}rement
794 T is for indirect of a pointer.
795 U is for loads with post increment. */
797 #define EXTRA_CONSTRAINT(VALUE, C) \
798 ( (C) == 'Q' ? ((TARGET_ADDR24 && GET_CODE (VALUE) == LABEL_REF) \
799 || addr24_operand (VALUE, VOIDmode)) \
800 : (C) == 'R' ? ((TARGET_ADDR32 && GET_CODE (VALUE) == LABEL_REF) \
801 || addr32_operand (VALUE, VOIDmode)) \
802 : (C) == 'S' ? (GET_CODE (VALUE) == MEM \
803 && STORE_PREINC_PREDEC_P (GET_MODE (VALUE), \
805 : (C) == 'T' ? (GET_CODE (VALUE) == MEM \
806 && memreg_operand (VALUE, GET_MODE (VALUE))) \
807 : (C) == 'U' ? (GET_CODE (VALUE) == MEM \
808 && LOAD_POSTINC_P (GET_MODE (VALUE), \
812 /* Stack layout and stack pointer usage. */
814 /* Define this macro if pushing a word onto the stack moves the stack
815 pointer to a smaller address. */
816 #define STACK_GROWS_DOWNWARD
818 /* Define this if the nominal address of the stack frame
819 is at the high-address end of the local variables;
820 that is, each additional local variable allocated
821 goes at a more negative offset from the frame pointer. */
822 /*#define FRAME_GROWS_DOWNWARD*/
824 /* Offset from frame pointer to start allocating local variables at.
825 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
826 first local allocated. Otherwise, it is the offset to the BEGINNING
827 of the first local allocated. */
828 /* The frame pointer points at the same place as the stack pointer, except if
829 alloca has been called. */
830 #define STARTING_FRAME_OFFSET \
831 M32R_STACK_ALIGN (current_function_outgoing_args_size)
833 /* Offset from the stack pointer register to the first location at which
834 outgoing arguments are placed. */
835 #define STACK_POINTER_OFFSET 0
837 /* Offset of first parameter from the argument pointer register value. */
838 #define FIRST_PARM_OFFSET(FNDECL) 0
840 /* A C expression whose value is RTL representing the address in a
841 stack frame where the pointer to the caller's frame is stored.
842 Assume that FRAMEADDR is an RTL expression for the address of the
845 If you don't define this macro, the default is to return the value
846 of FRAMEADDR--that is, the stack frame address is also the address
847 of the stack word that points to the previous frame. */
848 /*define DYNAMIC_CHAIN_ADDRESS (FRAMEADDR)*/
850 /* A C expression whose value is RTL representing the value of the
851 return address for the frame COUNT steps up from the current frame.
852 FRAMEADDR is the frame pointer of the COUNT frame, or the frame
853 pointer of the COUNT - 1 frame if `RETURN_ADDR_IN_PREVIOUS_FRAME'
855 /* The current return address is in r14. */
856 #if 0 /* The default value should work. */
857 #define RETURN_ADDR_RTX(COUNT, FRAME) \
859 ? gen_rtx_REG (Pmode, 14) \
860 : copy_to_reg (gen_rtx_MEM (Pmode, \
861 memory_address (Pmode, \
862 plus_constant ((FRAME), \
866 /* Register to use for pushing function arguments. */
867 #define STACK_POINTER_REGNUM 15
869 /* Base register for access to local variables of the function. */
870 #define FRAME_POINTER_REGNUM 13
872 /* Base register for access to arguments of the function. */
873 #define ARG_POINTER_REGNUM 16
875 /* The register number of the return address pointer register, which
876 is used to access the current function's return address from the
877 stack. On some machines, the return address is not at a fixed
878 offset from the frame pointer or stack pointer or argument
879 pointer. This register can be defined to point to the return
880 address on the stack, and then be converted by `ELIMINABLE_REGS'
881 into either the frame pointer or stack pointer.
883 Do not define this macro unless there is no other way to get the
884 return address from the stack. */
886 /* #define RETURN_ADDRESS_POINTER_REGNUM */
888 /* Register in which static-chain is passed to a function. This must
889 not be a register used by the prologue. */
890 #define STATIC_CHAIN_REGNUM 7
892 /* These aren't official macros. */
893 #define PROLOGUE_TMP_REGNUM 4
894 #define RETURN_ADDR_REGNUM 14
895 /* #define GP_REGNUM 12 */
896 #define CARRY_REGNUM 17
897 #define ACCUM_REGNUM 18
898 #define M32R_MAX_INT_REGS 16
900 #ifndef SUBTARGET_GPR_P
901 #define SUBTARGET_GPR_P(REGNO) 0
904 #ifndef SUBTARGET_ACCUM_P
905 #define SUBTARGET_ACCUM_P(REGNO) 0
908 #ifndef SUBTARGET_CARRY_P
909 #define SUBTARGET_CARRY_P(REGNO) 0
912 #define GPR_P(REGNO) (IN_RANGE_P ((REGNO), 0, 15) || SUBTARGET_GPR_P (REGNO))
913 #define ACCUM_P(REGNO) ((REGNO) == ACCUM_REGNUM || SUBTARGET_ACCUM_P (REGNO))
914 #define CARRY_P(REGNO) ((REGNO) == CARRY_REGNUM || SUBTARGET_CARRY_P (REGNO))
916 /* Eliminating the frame and arg pointers. */
918 /* A C expression which is nonzero if a function must have and use a
919 frame pointer. This expression is evaluated in the reload pass.
920 If its value is nonzero the function will have a frame pointer. */
921 #define FRAME_POINTER_REQUIRED current_function_calls_alloca
924 /* C statement to store the difference between the frame pointer
925 and the stack pointer values immediately after the function prologue.
926 If `ELIMINABLE_REGS' is defined, this macro will be not be used and
927 need not be defined. */
928 #define INITIAL_FRAME_POINTER_OFFSET(VAR) \
929 ((VAR) = m32r_compute_frame_size (get_frame_size ()))
932 /* If defined, this macro specifies a table of register pairs used to
933 eliminate unneeded registers that point into the stack frame. If
934 it is not defined, the only elimination attempted by the compiler
935 is to replace references to the frame pointer with references to
938 Note that the elimination of the argument pointer with the stack
939 pointer is specified first since that is the preferred elimination. */
941 #define ELIMINABLE_REGS \
942 {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
943 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
944 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }}
946 /* A C expression that returns non-zero if the compiler is allowed to
947 try to replace register number FROM-REG with register number
948 TO-REG. This macro need only be defined if `ELIMINABLE_REGS' is
949 defined, and will usually be the constant 1, since most of the
950 cases preventing register elimination are things that the compiler
951 already knows about. */
953 #define CAN_ELIMINATE(FROM, TO) \
954 ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
955 ? ! frame_pointer_needed \
958 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
959 specifies the initial difference between the specified pair of
960 registers. This macro must be defined if `ELIMINABLE_REGS' is
963 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
965 int size = m32r_compute_frame_size (get_frame_size ()); \
967 if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
969 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
970 (OFFSET) = size - current_function_pretend_args_size; \
971 else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
972 (OFFSET) = size - current_function_pretend_args_size; \
977 /* Function argument passing. */
979 /* When a prototype says `char' or `short', really pass an `int'. */
980 #define PROMOTE_PROTOTYPES 1
982 /* If defined, the maximum amount of space required for outgoing
983 arguments will be computed and placed into the variable
984 `current_function_outgoing_args_size'. No space will be pushed
985 onto the stack for each call; instead, the function prologue should
986 increase the stack frame size by this amount. */
987 #define ACCUMULATE_OUTGOING_ARGS 1
989 /* Define this macro if functions should assume that stack space has
990 been allocated for arguments even when their values are passed in
993 The value of this macro is the size, in bytes, of the area
994 reserved for arguments passed in registers for the function
995 represented by FNDECL.
997 This space can be allocated by the caller, or be a part of the
998 machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE' says
1001 #define REG_PARM_STACK_SPACE(FNDECL) \
1002 (M32R_MAX_PARM_REGS * UNITS_PER_WORD)
1005 /* Value is the number of bytes of arguments automatically
1006 popped when returning from a subroutine call.
1007 FUNDECL is the declaration node of the function (as a tree),
1008 FUNTYPE is the data type of the function (as a tree),
1009 or for a library call it is an identifier node for the subroutine name.
1010 SIZE is the number of bytes of arguments passed on the stack. */
1011 #define RETURN_POPS_ARGS(DECL, FUNTYPE, SIZE) 0
1013 /* Nonzero if we do not know how to pass TYPE solely in registers. */
1014 #define MUST_PASS_IN_STACK(MODE, TYPE) \
1016 && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \
1017 || TREE_ADDRESSABLE (TYPE)))
1019 /* Define a data type for recording info about an argument list
1020 during the scan of that argument list. This data type should
1021 hold all necessary information about the function itself
1022 and about the args processed so far, enough to enable macros
1023 such as FUNCTION_ARG to determine where the next arg should go. */
1024 #define CUMULATIVE_ARGS int
1026 /* Initialize a variable CUM of type CUMULATIVE_ARGS
1027 for a call to a function whose data type is FNTYPE.
1028 For a library call, FNTYPE is 0. */
1029 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \
1032 /* The number of registers used for parameter passing. Local to this file. */
1033 #define M32R_MAX_PARM_REGS 4
1035 /* 1 if N is a possible register number for function argument passing. */
1036 #define FUNCTION_ARG_REGNO_P(N) \
1037 ((unsigned) (N) < M32R_MAX_PARM_REGS)
1039 /* The ROUND_ADVANCE* macros are local to this file. */
1040 /* Round SIZE up to a word boundary. */
1041 #define ROUND_ADVANCE(SIZE) \
1042 (((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
1044 /* Round arg MODE/TYPE up to the next word boundary. */
1045 #define ROUND_ADVANCE_ARG(MODE, TYPE) \
1046 ((MODE) == BLKmode \
1047 ? ROUND_ADVANCE ((unsigned int) int_size_in_bytes (TYPE)) \
1048 : ROUND_ADVANCE (GET_MODE_SIZE (MODE)))
1050 /* Round CUM up to the necessary point for argument MODE/TYPE. */
1051 #define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) (CUM)
1053 /* Return boolean indicating arg of type TYPE and mode MODE will be passed in
1054 a reg. This includes arguments that have to be passed by reference as the
1055 pointer to them is passed in a reg if one is available (and that is what
1057 This macro is only used in this file. */
1058 #define PASS_IN_REG_P(CUM, MODE, TYPE, NAMED) \
1059 (ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) < M32R_MAX_PARM_REGS)
1061 /* Determine where to put an argument to a function.
1062 Value is zero to push the argument on the stack,
1063 or a hard register in which to store the argument.
1065 MODE is the argument's machine mode.
1066 TYPE is the data type of the argument (as a tree).
1067 This is null for libcalls where that information may
1069 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1070 the preceding args and about the function being called.
1071 NAMED is nonzero if this argument is a named parameter
1072 (otherwise it is an extra parameter matching an ellipsis). */
1073 /* On the M32R the first M32R_MAX_PARM_REGS args are normally in registers
1074 and the rest are pushed. */
1075 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1076 (PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED)) \
1077 ? gen_rtx_REG ((MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))) \
1080 /* ??? Quick hack to try to get varargs working the normal way. */
1081 #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
1082 (((! current_function_varargs || (NAMED)) \
1083 && PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED))) \
1084 ? gen_rtx_REG ((MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))) \
1087 /* A C expression for the number of words, at the beginning of an
1088 argument, must be put in registers. The value must be zero for
1089 arguments that are passed entirely in registers or that are entirely
1090 pushed on the stack.
1092 On some machines, certain arguments must be passed partially in
1093 registers and partially in memory. On these machines, typically the
1094 first @var{n} words of arguments are passed in registers, and the rest
1095 on the stack. If a multi-word argument (a @code{double} or a
1096 structure) crosses that boundary, its first few words must be passed
1097 in registers and the rest must be pushed. This macro tells the
1098 compiler when this occurs, and how many of the words should go in
1100 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
1101 function_arg_partial_nregs (&CUM, (int)MODE, TYPE, NAMED)
1103 /* A C expression that indicates when an argument must be passed by
1104 reference. If nonzero for an argument, a copy of that argument is
1105 made in memory and a pointer to the argument is passed instead of
1106 the argument itself. The pointer is passed in whatever way is
1107 appropriate for passing a pointer to that type. */
1108 /* All arguments greater than 8 bytes are passed this way. */
1109 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
1110 ((TYPE) && int_size_in_bytes (TYPE) > 8)
1112 /* Update the data in CUM to advance over an argument
1113 of mode MODE and data type TYPE.
1114 (TYPE is null for libcalls where that information may not be available.) */
1115 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1116 ((CUM) = (ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) \
1117 + ROUND_ADVANCE_ARG ((MODE), (TYPE))))
1119 /* If defined, a C expression that gives the alignment boundary, in bits,
1120 of an argument with the specified mode and type. If it is not defined,
1121 PARM_BOUNDARY is used for all arguments. */
1123 /* We assume PARM_BOUNDARY == UNITS_PER_WORD here. */
1124 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
1125 (((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) <= PARM_BOUNDARY \
1127 : 2 * PARM_BOUNDARY)
1130 /* This macro offers an alternative
1131 to using `__builtin_saveregs' and defining the macro
1132 `EXPAND_BUILTIN_SAVEREGS'. Use it to store the anonymous register
1133 arguments into the stack so that all the arguments appear to have
1134 been passed consecutively on the stack. Once this is done, you
1135 can use the standard implementation of varargs that works for
1136 machines that pass all their arguments on the stack.
1138 The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure,
1139 containing the values that obtain after processing of the named
1140 arguments. The arguments MODE and TYPE describe the last named
1141 argument--its machine mode and its data type as a tree node.
1143 The macro implementation should do two things: first, push onto the
1144 stack all the argument registers *not* used for the named
1145 arguments, and second, store the size of the data thus pushed into
1146 the `int'-valued variable whose name is supplied as the argument
1147 PRETEND_SIZE. The value that you store here will serve as
1148 additional offset for setting up the stack frame.
1150 If the argument NO_RTL is nonzero, it means that the
1151 arguments of the function are being analyzed for the second time.
1152 This happens for an inline function, which is not actually
1153 compiled until the end of the source file. The macro
1154 `SETUP_INCOMING_VARARGS' should not generate any instructions in
1157 #define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_SIZE, NO_RTL) \
1158 m32r_setup_incoming_varargs (&ARGS_SO_FAR, MODE, TYPE, &PRETEND_SIZE, NO_RTL)
1160 /* Implement `va_arg'. */
1161 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
1162 m32r_va_arg (valist, type)
1164 /* Function results. */
1166 /* Define how to find the value returned by a function.
1167 VALTYPE is the data type of the value (as a tree).
1168 If the precise function being called is known, FUNC is its FUNCTION_DECL;
1169 otherwise, FUNC is 0. */
1170 #define FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG (TYPE_MODE (VALTYPE), 0)
1172 /* Define how to find the value returned by a library function
1173 assuming the value has mode MODE. */
1174 #define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, 0)
1176 /* 1 if N is a possible register number for a function value
1177 as seen by the caller. */
1178 /* ??? What about r1 in DI/DF values. */
1179 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
1181 /* A C expression which can inhibit the returning of certain function
1182 values in registers, based on the type of value. A nonzero value says
1183 to return the function value in memory, just as large structures are
1184 always returned. Here TYPE will be a C expression of type `tree',
1185 representing the data type of the value. */
1186 #define RETURN_IN_MEMORY(TYPE) \
1187 (int_size_in_bytes (TYPE) > 8)
1189 /* Tell GCC to use RETURN_IN_MEMORY. */
1190 #define DEFAULT_PCC_STRUCT_RETURN 0
1192 /* Register in which address to store a structure value
1193 is passed to a function, or 0 to use `invisible' first argument. */
1194 #define STRUCT_VALUE 0
1196 /* Function entry and exit. */
1198 /* Initialize data used by insn expanders. This is called from
1199 init_emit, once for each function, before code is generated. */
1200 #define INIT_EXPANDERS m32r_init_expanders ()
1202 /* This macro generates the assembly code for function entry.
1203 FILE is a stdio stream to output the code to.
1204 SIZE is an int: how many units of temporary storage to allocate.
1205 Refer to the array `regs_ever_live' to determine which registers
1206 to save; `regs_ever_live[I]' is nonzero if register number I
1207 is ever used in the function. This macro is responsible for
1208 knowing which registers should not be saved even if used. */
1209 #define FUNCTION_PROLOGUE(FILE, SIZE) \
1210 m32r_output_function_prologue (FILE, SIZE)
1212 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1213 the stack pointer does not matter. The value is tested only in
1214 functions that have frame pointers.
1215 No definition is equivalent to always zero. */
1216 #define EXIT_IGNORE_STACK 1
1218 /* This macro generates the assembly code for function exit,
1219 on machines that need it. If FUNCTION_EPILOGUE is not defined
1220 then individual return instructions are generated for each
1221 return statement. Args are same as for FUNCTION_PROLOGUE.
1223 The function epilogue should not depend on the current stack pointer!
1224 It should use the frame pointer only. This is mandatory because
1225 of alloca; we also take advantage of it to omit stack adjustments
1226 before returning. */
1227 #define FUNCTION_EPILOGUE(FILE, SIZE) \
1228 m32r_output_function_epilogue (FILE, SIZE)
1230 /* Output assembler code to FILE to increment profiler label # LABELNO
1231 for profiling a function entry. */
1232 #define FUNCTION_PROFILER(FILE, LABELNO) abort ()
1236 /* On the M32R, the trampoline is
1243 ??? Need addr32 support.
1246 /* Length in bytes of the trampoline for entering a nested function. */
1247 #define TRAMPOLINE_SIZE 12
1249 /* Emit RTL insns to initialize the variable parts of a trampoline.
1250 FNADDR is an RTX for the address of the function's pure code.
1251 CXT is an RTX for the static chain value for the function. */
1252 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1254 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 0)), \
1255 plus_constant ((CXT), 0xe7000000)); \
1256 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 4)), \
1257 plus_constant ((FNADDR), 0xe6000000)); \
1258 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 8)), \
1259 GEN_INT (0x1fc67000)); \
1260 emit_insn (gen_flush_icache (validize_mem (gen_rtx_MEM (SImode, TRAMP)))); \
1263 /* Library calls. */
1265 /* Generate calls to memcpy, memcmp and memset. */
1266 #define TARGET_MEM_FUNCTIONS
1268 /* Addressing modes, and classification of registers for them. */
1270 /* Maximum number of registers that can appear in a valid memory address. */
1271 #define MAX_REGS_PER_ADDRESS 1
1273 /* We have post-inc load and pre-dec,pre-inc store,
1274 but only for 4 byte vals. */
1275 #define HAVE_PRE_DECREMENT 1
1276 #define HAVE_PRE_INCREMENT 1
1277 #define HAVE_POST_INCREMENT 1
1279 /* Recognize any constant value that is a valid address. */
1280 #define CONSTANT_ADDRESS_P(X) \
1281 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1282 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST)
1284 /* Nonzero if the constant value X is a legitimate general operand.
1285 We don't allow (plus symbol large-constant) as the relocations can't
1286 describe it. INTVAL > 32767 handles both 16 bit and 24 bit relocations.
1287 We allow all CONST_DOUBLE's as the md file patterns will force the
1288 constant to memory if they can't handle them. */
1290 #define LEGITIMATE_CONSTANT_P(X) \
1291 (! (GET_CODE (X) == CONST \
1292 && GET_CODE (XEXP (X, 0)) == PLUS \
1293 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF \
1294 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
1295 && (unsigned HOST_WIDE_INT) INTVAL (XEXP (XEXP (X, 0), 1)) > 32767))
1297 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1298 and check its validity for a certain class.
1299 We have two alternate definitions for each of them.
1300 The usual definition accepts all pseudo regs; the other rejects
1301 them unless they have been allocated suitable hard regs.
1302 The symbol REG_OK_STRICT causes the latter definition to be used.
1304 Most source files want to accept pseudo regs in the hope that
1305 they will get allocated to the class that the insn wants them to be in.
1306 Source files for reload pass need to be strict.
1307 After reload, it makes no difference, since pseudo regs have
1308 been eliminated by then. */
1310 #ifdef REG_OK_STRICT
1312 /* Nonzero if X is a hard reg that can be used as a base reg. */
1313 #define REG_OK_FOR_BASE_P(X) GPR_P (REGNO (X))
1314 /* Nonzero if X is a hard reg that can be used as an index. */
1315 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
1319 /* Nonzero if X is a hard reg that can be used as a base reg
1320 or if it is a pseudo reg. */
1321 #define REG_OK_FOR_BASE_P(X) \
1322 (GPR_P (REGNO (X)) \
1323 || (REGNO (X)) == ARG_POINTER_REGNUM \
1324 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
1325 /* Nonzero if X is a hard reg that can be used as an index
1326 or if it is a pseudo reg. */
1327 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
1331 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1332 that is a valid memory address for an instruction.
1333 The MODE argument is the machine mode for the MEM expression
1334 that wants to use this address. */
1336 /* Local to this file. */
1337 #define RTX_OK_FOR_BASE_P(X) (REG_P (X) && REG_OK_FOR_BASE_P (X))
1339 /* Local to this file. */
1340 #define RTX_OK_FOR_OFFSET_P(X) \
1341 (GET_CODE (X) == CONST_INT && INT16_P (INTVAL (X)))
1343 /* Local to this file. */
1344 #define LEGITIMATE_OFFSET_ADDRESS_P(MODE, X) \
1345 (GET_CODE (X) == PLUS \
1346 && RTX_OK_FOR_BASE_P (XEXP (X, 0)) \
1347 && RTX_OK_FOR_OFFSET_P (XEXP (X, 1)))
1349 /* Local to this file. */
1350 /* For LO_SUM addresses, do not allow them if the MODE is > 1 word,
1351 since more than one instruction will be required. */
1352 #define LEGITIMATE_LO_SUM_ADDRESS_P(MODE, X) \
1353 (GET_CODE (X) == LO_SUM \
1354 && (MODE != BLKmode && GET_MODE_SIZE (MODE) <= UNITS_PER_WORD) \
1355 && RTX_OK_FOR_BASE_P (XEXP (X, 0)) \
1356 && CONSTANT_P (XEXP (X, 1)))
1358 /* Local to this file. */
1359 /* Is this a load and increment operation. */
1360 #define LOAD_POSTINC_P(MODE, X) \
1361 (((MODE) == SImode || (MODE) == SFmode) \
1362 && GET_CODE (X) == POST_INC \
1363 && GET_CODE (XEXP (X, 0)) == REG \
1364 && RTX_OK_FOR_BASE_P (XEXP (X, 0)))
1366 /* Local to this file. */
1367 /* Is this a increment/decrement and store operation. */
1368 #define STORE_PREINC_PREDEC_P(MODE, X) \
1369 (((MODE) == SImode || (MODE) == SFmode) \
1370 && (GET_CODE (X) == PRE_INC || GET_CODE (X) == PRE_DEC) \
1371 && GET_CODE (XEXP (X, 0)) == REG \
1372 && RTX_OK_FOR_BASE_P (XEXP (X, 0)))
1374 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1375 { if (RTX_OK_FOR_BASE_P (X)) \
1377 if (LEGITIMATE_OFFSET_ADDRESS_P ((MODE), (X))) \
1379 if (LEGITIMATE_LO_SUM_ADDRESS_P ((MODE), (X))) \
1381 if (LOAD_POSTINC_P ((MODE), (X))) \
1383 if (STORE_PREINC_PREDEC_P ((MODE), (X))) \
1387 /* Try machine-dependent ways of modifying an illegitimate address
1388 to be legitimate. If we find one, return the new, valid address.
1389 This macro is used in only one place: `memory_address' in explow.c.
1391 OLDX is the address as it was before break_out_memory_refs was called.
1392 In some cases it is useful to look at this to decide what needs to be done.
1394 MODE and WIN are passed so that this macro can use
1395 GO_IF_LEGITIMATE_ADDRESS.
1397 It is always safe for this macro to do nothing. It exists to recognize
1398 opportunities to optimize the output.
1400 ??? Is there anything useful we can do here for the M32R? */
1402 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)
1404 /* Go to LABEL if ADDR (a legitimate address expression)
1405 has an effect that depends on the machine mode it is used for. */
1406 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
1408 if (GET_CODE (ADDR) == PRE_DEC \
1409 || GET_CODE (ADDR) == PRE_INC \
1410 || GET_CODE (ADDR) == POST_INC \
1411 || GET_CODE (ADDR) == LO_SUM) \
1415 /* Condition code usage. */
1417 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
1418 return the mode to be used for the comparison. */
1419 #define SELECT_CC_MODE(OP, X, Y) \
1420 ((enum machine_mode)m32r_select_cc_mode ((int)OP, X, Y))
1422 /* Return non-zero if SELECT_CC_MODE will never return MODE for a
1423 floating point inequality comparison. */
1424 #define REVERSIBLE_CC_MODE(MODE) 1 /*???*/
1428 /* ??? I'm quite sure I don't understand enough of the subtleties involved
1429 in choosing the right numbers to use here, but there doesn't seem to be
1430 enough documentation on this. What I've done is define an insn to cost
1431 4 "units" and work from there. COSTS_N_INSNS (N) is defined as (N) * 4 - 2
1432 so that seems reasonable. Some values are supposed to be defined relative
1433 to each other and thus aren't necessarily related to COSTS_N_INSNS. */
1435 /* Compute the cost of computing a constant rtl expression RTX
1436 whose rtx-code is CODE. The body of this macro is a portion
1437 of a switch statement. If the code is computed here,
1438 return it with a return statement. Otherwise, break from the switch. */
1439 /* Small integers are as cheap as registers. 4 byte values can be fetched
1440 as immediate constants - let's give that the cost of an extra insn. */
1441 #define CONST_COSTS(X, CODE, OUTER_CODE) \
1443 if (INT16_P (INTVAL (X))) \
1445 /* fall through */ \
1450 case CONST_DOUBLE : \
1453 split_double (X, &high, &low); \
1454 return 4 * (!INT16_P (INTVAL (high)) \
1455 + !INT16_P (INTVAL (low))); \
1458 /* Compute the cost of an address. */
1459 #define ADDRESS_COST(ADDR) m32r_address_cost (ADDR)
1461 /* Compute extra cost of moving data between one register class
1463 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) 2
1465 /* Compute the cost of moving data between registers and memory. */
1466 /* Memory is 3 times as expensive as registers.
1467 ??? Is that the right way to look at it? */
1468 #define MEMORY_MOVE_COST(MODE,CLASS,IN_P) \
1469 (GET_MODE_SIZE (MODE) <= UNITS_PER_WORD ? 6 : 12)
1471 /* The cost of a branch insn. */
1472 /* A value of 2 here causes GCC to avoid using branches in comparisons like
1473 while (a < N && a). Branches aren't that expensive on the M32R so
1474 we define this as 1. Defining it as 2 had a heavy hit in fp-bit.c. */
1475 #define BRANCH_COST ((TARGET_BRANCH_COST) ? 2 : 1)
1477 /* Provide the costs of a rtl expression. This is in the body of a
1478 switch on CODE. The purpose for the cost of MULT is to encourage
1479 `synth_mult' to find a synthetic multiply when reasonable.
1481 If we need more than 12 insns to do a multiply, then go out-of-line,
1482 since the call overhead will be < 10% of the cost of the multiply. */
1483 #define RTX_COSTS(X, CODE, OUTER_CODE) \
1485 return COSTS_N_INSNS (3); \
1490 return COSTS_N_INSNS (10);
1492 /* Nonzero if access to memory by bytes is slow and undesirable.
1493 For RISC chips, it means that access to memory by bytes is no
1494 better than access by words when possible, so grab a whole word
1495 and maybe make use of that. */
1496 #define SLOW_BYTE_ACCESS 1
1498 /* Define this macro if it is as good or better to call a constant
1499 function address than to call an address kept in a register. */
1500 #define NO_FUNCTION_CSE
1502 /* Define this macro if it is as good or better for a function to call
1503 itself with an explicit address than to call an address kept in a
1505 #define NO_RECURSIVE_FUNCTION_CSE
1507 /* A C statement (sans semicolon) to update the integer variable COST based on
1508 the relationship between INSN that is dependent on DEP_INSN through the
1509 dependence LINK. The default is to make no adjustment to COST. This can be
1510 used for example to specify to the scheduler that an output- or
1511 anti-dependence does not incur the same cost as a data-dependence. */
1513 #define ADJUST_COST(INSN,LINK,DEP_INSN,COST) \
1514 (COST) = m32r_adjust_cost (INSN, LINK, DEP_INSN, COST)
1516 /* A C statement (sans semicolon) to update the integer scheduling
1517 priority `INSN_PRIORITY(INSN)'. Reduce the priority to execute
1518 the INSN earlier, increase the priority to execute INSN later.
1519 Do not define this macro if you do not need to adjust the
1520 scheduling priorities of insns. */
1521 #define ADJUST_PRIORITY(INSN) \
1522 INSN_PRIORITY (INSN) = m32r_adjust_priority (INSN, INSN_PRIORITY (INSN))
1524 /* Macro to determine whether the Haifa scheduler is used. */
1531 /* Indicate how many instructions can be issued at the same time.
1532 This is sort of a lie. The m32r can issue only 1 long insn at
1533 once, but it can issue 2 short insns. The default therefore is
1534 set at 2, but this can be overridden by the command line option
1536 #define ISSUE_RATE ((TARGET_ISSUE_RATE) ? 1 : 2)
1538 /* If we have a machine that can issue a variable # of instructions
1539 per cycle, indicate how many more instructions can be issued
1540 after the current one. */
1541 #define MD_SCHED_VARIABLE_ISSUE(STREAM, VERBOSE, INSN, HOW_MANY) \
1542 (HOW_MANY) = m32r_sched_variable_issue (STREAM, VERBOSE, INSN, HOW_MANY)
1544 /* Whether we are on an odd word boundary while scheduling. */
1545 extern int m32r_sched_odd_word_p;
1547 /* Hook to run before scheduling a block of insns. */
1548 #define MD_SCHED_INIT(STREAM, VERBOSE, MAX_READY) \
1549 m32r_sched_init (STREAM, VERBOSE)
1551 /* Hook to reorder the list of ready instructions. */
1552 #define MD_SCHED_REORDER(STREAM, VERBOSE, READY, N_READY, CLOCK, CIM) \
1555 m32r_sched_reorder (STREAM, VERBOSE, READY, N_READY); \
1560 /* When the `length' insn attribute is used, this macro specifies the
1561 value to be assigned to the address of the first insn in a
1562 function. If not specified, 0 is used. */
1563 #define FIRST_INSN_ADDRESS m32r_first_insn_address ()
1566 /* Section selection. */
1568 #define TEXT_SECTION_ASM_OP "\t.section .text"
1569 #define DATA_SECTION_ASM_OP "\t.section .data"
1570 #define RODATA_SECTION_ASM_OP "\t.section .rodata"
1571 #define BSS_SECTION_ASM_OP "\t.section .bss"
1572 #define SDATA_SECTION_ASM_OP "\t.section .sdata"
1573 #define SBSS_SECTION_ASM_OP "\t.section .sbss"
1574 /* This one is for svr4.h. */
1575 #undef CONST_SECTION_ASM_OP
1576 #define CONST_SECTION_ASM_OP "\t.section .rodata"
1578 /* A list of names for sections other than the standard two, which are
1579 `in_text' and `in_data'. You need not define this macro
1580 on a system with no other sections (that GCC needs to use). */
1581 #undef EXTRA_SECTIONS
1582 #define EXTRA_SECTIONS in_sdata, in_sbss, in_const, in_ctors, in_dtors
1584 /* One or more functions to be defined in "varasm.c". These
1585 functions should do jobs analogous to those of `text_section' and
1586 `data_section', for your additional sections. Do not define this
1587 macro if you do not define `EXTRA_SECTIONS'. */
1588 #undef EXTRA_SECTION_FUNCTIONS
1589 #define EXTRA_SECTION_FUNCTIONS \
1590 CONST_SECTION_FUNCTION \
1591 CTORS_SECTION_FUNCTION \
1592 DTORS_SECTION_FUNCTION \
1593 SDATA_SECTION_FUNCTION \
1594 SBSS_SECTION_FUNCTION
1596 #define SDATA_SECTION_FUNCTION \
1600 if (in_section != in_sdata) \
1602 fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
1603 in_section = in_sdata; \
1607 #define SBSS_SECTION_FUNCTION \
1611 if (in_section != in_sbss) \
1613 fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
1614 in_section = in_sbss; \
1618 /* A C statement or statements to switch to the appropriate section for
1619 output of EXP. You can assume that EXP is either a `VAR_DECL' node
1620 or a constant of some sort. RELOC indicates whether the initial value
1621 of EXP requires link-time relocations. */
1622 #undef SELECT_SECTION
1623 #define SELECT_SECTION(EXP, RELOC) m32r_select_section ((EXP), (RELOC))
1625 /* A C statement or statements to switch to the appropriate section for
1626 output of RTX in mode MODE. You can assume that RTX
1627 is some kind of constant in RTL. The argument MODE is redundant
1628 except in the case of a `const_int' rtx. Select the section by
1629 calling `text_section' or one of the alternatives for other
1632 Do not define this macro if you put all constants in the read-only
1635 #undef SELECT_RTX_SECTION
1637 /* Define this macro if jump tables (for tablejump insns) should be
1638 output in the text section, along with the assembler instructions.
1639 Otherwise, the readonly data section is used.
1640 This macro is irrelevant if there is no separate readonly data section. */
1641 /*#define JUMP_TABLES_IN_TEXT_SECTION*/
1643 /* Define this macro if references to a symbol must be treated
1644 differently depending on something about the variable or
1645 function named by the symbol (such as what section it is in).
1647 The macro definition, if any, is executed immediately after the
1648 rtl for DECL or other node is created.
1649 The value of the rtl will be a `mem' whose address is a
1652 The usual thing for this macro to do is to store a flag in the
1653 `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
1654 name string in the `symbol_ref' (if one bit is not enough
1657 #define SDATA_FLAG_CHAR '@'
1658 /* Small objects are recorded with no prefix for space efficiency since
1659 they'll be the most common. This isn't the case if the user passes
1660 -mmodel={medium|large} and one could choose to not mark symbols that
1661 are the default, but that complicates things. */
1662 /*#define SMALL_FLAG_CHAR '#'*/
1663 #define MEDIUM_FLAG_CHAR '%'
1664 #define LARGE_FLAG_CHAR '&'
1666 #define SDATA_NAME_P(NAME) (*(NAME) == SDATA_FLAG_CHAR)
1667 /*#define SMALL_NAME_P(NAME) (*(NAME) == SMALL_FLAG_CHAR)*/
1668 #define SMALL_NAME_P(NAME) (! ENCODED_NAME_P (NAME) && ! LIT_NAME_P (NAME))
1669 #define MEDIUM_NAME_P(NAME) (*(NAME) == MEDIUM_FLAG_CHAR)
1670 #define LARGE_NAME_P(NAME) (*(NAME) == LARGE_FLAG_CHAR)
1671 /* For string literals, etc. */
1672 #define LIT_NAME_P(NAME) ((NAME)[0] == '*' && (NAME)[1] == '.')
1674 #define ENCODED_NAME_P(SYMBOL_NAME) \
1675 (SDATA_NAME_P (SYMBOL_NAME) \
1676 /*|| SMALL_NAME_P (SYMBOL_NAME)*/ \
1677 || MEDIUM_NAME_P (SYMBOL_NAME) \
1678 || LARGE_NAME_P (SYMBOL_NAME))
1680 #define ENCODE_SECTION_INFO(DECL) m32r_encode_section_info (DECL)
1682 /* Decode SYM_NAME and store the real name part in VAR, sans
1683 the characters that encode section info. Define this macro if
1684 ENCODE_SECTION_INFO alters the symbol's name string. */
1685 /* Note that we have to handle symbols like "%*start". */
1686 #define STRIP_NAME_ENCODING(VAR, SYMBOL_NAME) \
1688 (VAR) = (SYMBOL_NAME) + ENCODED_NAME_P (SYMBOL_NAME); \
1689 (VAR) += *(VAR) == '*'; \
1694 /* The register number of the register used to address a table of static
1695 data addresses in memory. In some cases this register is defined by a
1696 processor's ``application binary interface'' (ABI). When this macro
1697 is defined, RTL is generated for this register once, as with the stack
1698 pointer and frame pointer registers. If this macro is not defined, it
1699 is up to the machine-dependent files to allocate such a register (if
1701 /*#define PIC_OFFSET_TABLE_REGNUM 12*/
1703 /* Define this macro if the register defined by PIC_OFFSET_TABLE_REGNUM is
1704 clobbered by calls. Do not define this macro if PIC_OFFSET_TABLE_REGNUM
1706 /* This register is call-saved on the M32R. */
1707 /*#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED*/
1709 /* By generating position-independent code, when two different programs (A
1710 and B) share a common library (libC.a), the text of the library can be
1711 shared whether or not the library is linked at the same address for both
1712 programs. In some of these environments, position-independent code
1713 requires not only the use of different addressing modes, but also
1714 special code to enable the use of these addressing modes.
1716 The FINALIZE_PIC macro serves as a hook to emit these special
1717 codes once the function is being compiled into assembly code, but not
1718 before. (It is not done before, because in the case of compiling an
1719 inline function, it would lead to multiple PIC prologues being
1720 included in functions which used inline functions and were compiled to
1721 assembly language.) */
1723 /*#define FINALIZE_PIC m32r_finalize_pic ()*/
1725 /* A C expression that is nonzero if X is a legitimate immediate
1726 operand on the target machine when generating position independent code.
1727 You can assume that X satisfies CONSTANT_P, so you need not
1728 check this. You can also assume `flag_pic' is true, so you need not
1729 check it either. You need not define this macro if all constants
1730 (including SYMBOL_REF) can be immediate operands when generating
1731 position independent code. */
1732 /*#define LEGITIMATE_PIC_OPERAND_P(X)*/
1734 /* Control the assembler format that we output. */
1736 /* Output at beginning of assembler file. */
1737 #define ASM_FILE_START(FILE) m32r_asm_file_start (FILE)
1739 /* A C string constant describing how to begin a comment in the target
1740 assembler language. The compiler assumes that the comment will
1741 end at the end of the line. */
1742 #define ASM_COMMENT_START ";"
1744 /* Output to assembler file text saying following lines
1745 may contain character constants, extra white space, comments, etc. */
1746 #define ASM_APP_ON ""
1748 /* Output to assembler file text saying following lines
1749 no longer contain unusual constructs. */
1750 #define ASM_APP_OFF ""
1752 /* This is how to output an assembler line defining a `char' constant. */
1753 #define ASM_OUTPUT_CHAR(FILE, VALUE) \
1756 fprintf (FILE, "\t.byte\t"); \
1757 output_addr_const (FILE, (VALUE)); \
1758 fprintf (FILE, "\n"); \
1762 /* This is how to output an assembler line defining a `short' constant. */
1763 #define ASM_OUTPUT_SHORT(FILE, VALUE) \
1766 fprintf (FILE, "\t.hword\t"); \
1767 output_addr_const (FILE, (VALUE)); \
1768 fprintf (FILE, "\n"); \
1772 /* This is how to output an assembler line defining an `int' constant.
1773 We also handle symbol output here. */
1774 #define ASM_OUTPUT_INT(FILE, VALUE) \
1777 fprintf (FILE, "\t.word\t"); \
1778 output_addr_const (FILE, (VALUE)); \
1779 fprintf (FILE, "\n"); \
1783 /* This is how to output an assembler line defining a `float' constant. */
1784 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
1789 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
1790 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
1791 fprintf (FILE, "\t.word\t0x%lx %s %s\n", \
1792 t, ASM_COMMENT_START, str); \
1796 /* This is how to output an assembler line defining a `double' constant. */
1797 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
1802 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
1803 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
1804 fprintf (FILE, "\t.word\t0x%lx %s %s\n\t.word\t0x%lx\n", \
1805 t[0], ASM_COMMENT_START, str, t[1]); \
1809 /* This is how to output an assembler line for a numeric constant byte. */
1810 #define ASM_OUTPUT_BYTE(FILE, VALUE) \
1811 fprintf (FILE, "%s0x%x\n", ASM_BYTE_OP, (VALUE))
1813 /* The assembler's parentheses characters. */
1814 #define ASM_OPEN_PAREN "("
1815 #define ASM_CLOSE_PAREN ")"
1817 /* This is how to output the definition of a user-level label named NAME,
1818 such as the label on a static function or variable NAME. */
1819 /* On the M32R we need to ensure the next instruction starts on a 32 bit
1820 boundary [the previous insn must either be 2 16 bit insns or 1 32 bit]. */
1821 #define ASM_OUTPUT_LABEL(FILE, NAME) \
1824 assemble_name (FILE, NAME); \
1825 fputs (":\n", FILE); \
1829 /* This is how to output a command to make the user-level label named NAME
1830 defined for reference from other files. */
1831 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \
1834 fputs ("\t.global\t", FILE); \
1835 assemble_name (FILE, NAME); \
1836 fputs ("\n", FILE); \
1840 /* This is how to output a reference to a user-level label named NAME.
1841 `assemble_name' uses this. */
1842 #undef ASM_OUTPUT_LABELREF
1843 #define ASM_OUTPUT_LABELREF(FILE, NAME) \
1846 const char * real_name; \
1847 STRIP_NAME_ENCODING (real_name, (NAME)); \
1848 asm_fprintf (FILE, "%U%s", real_name); \
1852 /* If -Os, don't force line number labels to begin at the beginning of
1853 the word; we still want the assembler to try to put things in parallel,
1854 should that be possible.
1855 For m32r/d, instructions are never in parallel (other than with a nop)
1856 and the simulator and stub both handle a breakpoint in the middle of
1857 a word so don't ever force line number labels to begin at the beginning
1860 #undef ASM_OUTPUT_SOURCE_LINE
1861 #define ASM_OUTPUT_SOURCE_LINE(file, line) \
1864 static int sym_lineno = 1; \
1865 fprintf (file, ".stabn 68,0,%d,.LM%d-", \
1866 line, sym_lineno); \
1868 (file, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
1869 fprintf (file, (optimize_size || TARGET_M32R) \
1870 ? "\n\t.debugsym .LM%d\n" \
1877 /* Store in OUTPUT a string (made with alloca) containing
1878 an assembler-name for a local static variable named NAME.
1879 LABELNO is an integer which is different for each call. */
1880 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1883 (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10);\
1884 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)); \
1888 /* How to refer to registers in assembler output.
1889 This sequence is indexed by compiler's hard-register-number (see above). */
1890 #ifndef SUBTARGET_REGISTER_NAMES
1891 #define SUBTARGET_REGISTER_NAMES
1894 #define REGISTER_NAMES \
1896 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
1897 "r8", "r9", "r10", "r11", "r12", "fp", "lr", "sp", \
1898 "ap", "cbit", "a0" \
1899 SUBTARGET_REGISTER_NAMES \
1902 /* If defined, a C initializer for an array of structures containing
1903 a name and a register number. This macro defines additional names
1904 for hard registers, thus allowing the `asm' option in declarations
1905 to refer to registers using alternate names. */
1906 #ifndef SUBTARGET_ADDITIONAL_REGISTER_NAMES
1907 #define SUBTARGET_ADDITIONAL_REGISTER_NAMES
1910 #define ADDITIONAL_REGISTER_NAMES \
1912 /*{ "gp", GP_REGNUM },*/ \
1913 { "r13", FRAME_POINTER_REGNUM }, \
1914 { "r14", RETURN_ADDR_REGNUM }, \
1915 { "r15", STACK_POINTER_REGNUM }, \
1916 SUBTARGET_ADDITIONAL_REGISTER_NAMES \
1919 /* A C expression which evaluates to true if CODE is a valid
1920 punctuation character for use in the `PRINT_OPERAND' macro. */
1921 extern char m32r_punct_chars[];
1922 #define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
1923 m32r_punct_chars[(unsigned char) (CHAR)]
1925 /* Print operand X (an rtx) in assembler syntax to file FILE.
1926 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1927 For `%' followed by punctuation, CODE is the punctuation and X is null. */
1928 #define PRINT_OPERAND(FILE, X, CODE) \
1929 m32r_print_operand (FILE, X, CODE)
1931 /* A C compound statement to output to stdio stream STREAM the
1932 assembler syntax for an instruction operand that is a memory
1933 reference whose address is ADDR. ADDR is an RTL expression.
1935 On some machines, the syntax for a symbolic address depends on
1936 the section that the address refers to. On these machines,
1937 define the macro `ENCODE_SECTION_INFO' to store the information
1938 into the `symbol_ref', and then check for it here. */
1939 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1940 m32r_print_operand_address (FILE, ADDR)
1942 /* If defined, C string expressions to be used for the `%R', `%L',
1943 `%U', and `%I' options of `asm_fprintf' (see `final.c'). These
1944 are useful when a single `md' file must support multiple assembler
1945 formats. In that case, the various `tm.h' files can define these
1946 macros differently. */
1947 #define REGISTER_PREFIX ""
1948 #define LOCAL_LABEL_PREFIX ".L"
1949 #define USER_LABEL_PREFIX ""
1950 #define IMMEDIATE_PREFIX "#"
1952 /* This is how to output an element of a case-vector that is absolute. */
1953 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1957 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
1958 fprintf (FILE, "\t.word\t"); \
1959 assemble_name (FILE, label); \
1960 fprintf (FILE, "\n"); \
1964 /* This is how to output an element of a case-vector that is relative. */
1965 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL)\
1969 ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
1970 fprintf (FILE, "\t.word\t"); \
1971 assemble_name (FILE, label); \
1972 fprintf (FILE, "-"); \
1973 ASM_GENERATE_INTERNAL_LABEL (label, "L", REL); \
1974 assemble_name (FILE, label); \
1975 fprintf (FILE, ")\n"); \
1979 /* The desired alignment for the location counter at the beginning
1981 /* On the M32R, align loops to 32 byte boundaries (cache line size)
1982 if -malign-loops. */
1983 #define LOOP_ALIGN(LABEL) (TARGET_ALIGN_LOOPS ? 5 : 0)
1985 /* Define this to be the maximum number of insns to move around when moving
1986 a loop test from the top of a loop to the bottom
1987 and seeing whether to duplicate it. The default is thirty.
1989 Loop unrolling currently doesn't like this optimization, so
1990 disable doing if we are unrolling loops and saving space. */
1991 #define LOOP_TEST_THRESHOLD (optimize_size \
1992 && !flag_unroll_loops \
1993 && !flag_unroll_all_loops ? 2 : 30)
1995 /* This is how to output an assembler line
1996 that says to advance the location counter
1997 to a multiple of 2**LOG bytes. */
1998 /* .balign is used to avoid confusion. */
1999 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
2003 fprintf (FILE, "\t.balign %d\n", 1 << (LOG)); \
2007 /* Like `ASM_OUTPUT_COMMON' except takes the required alignment as a
2008 separate, explicit argument. If you define this macro, it is used in
2009 place of `ASM_OUTPUT_COMMON', and gives you more flexibility in
2010 handling the required alignment of the variable. The alignment is
2011 specified as the number of bits. */
2013 #define SCOMMON_ASM_OP "\t.scomm\t"
2015 #undef ASM_OUTPUT_ALIGNED_COMMON
2016 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
2019 if (! TARGET_SDATA_NONE \
2020 && (SIZE) > 0 && (SIZE) <= g_switch_value) \
2021 fprintf ((FILE), "%s", SCOMMON_ASM_OP); \
2023 fprintf ((FILE), "%s", COMMON_ASM_OP); \
2024 assemble_name ((FILE), (NAME)); \
2025 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
2029 /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
2030 separate, explicit argument. If you define this macro, it is used in
2031 place of `ASM_OUTPUT_BSS', and gives you more flexibility in
2032 handling the required alignment of the variable. The alignment is
2033 specified as the number of bits.
2035 For the M32R we need sbss support. */
2037 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
2040 ASM_GLOBALIZE_LABEL (FILE, NAME); \
2041 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
2045 /* Debugging information. */
2047 /* Generate DBX and DWARF debugging information. */
2048 #undef DBX_DEBUGGING_INFO
2049 #undef DWARF_DEBUGGING_INFO
2050 #undef DWARF2_DEBUGGING_INFO
2052 #define DBX_DEBUGGING_INFO
2053 #define DWARF_DEBUGGING_INFO
2054 #define DWARF2_DEBUGGING_INFO
2056 /* Prefer STABS (for now). */
2057 #undef PREFERRED_DEBUGGING_TYPE
2058 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
2060 /* How to renumber registers for dbx and gdb. */
2061 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
2063 /* Turn off splitting of long stabs. */
2064 #define DBX_CONTIN_LENGTH 0
2066 /* Miscellaneous. */
2068 /* Specify the machine mode that this machine uses
2069 for the index in the tablejump instruction. */
2070 #define CASE_VECTOR_MODE Pmode
2072 /* Define as C expression which evaluates to nonzero if the tablejump
2073 instruction expects the table to contain offsets from the address of the
2075 Do not define this if the table should contain absolute addresses. */
2076 /* It's not clear what PIC will look like or whether we want to use -fpic
2077 for the embedded form currently being talked about. For now require -fpic
2078 to get pc relative switch tables. */
2079 /*#define CASE_VECTOR_PC_RELATIVE 1 */
2081 /* Define if operations between registers always perform the operation
2082 on the full register even if a narrower mode is specified. */
2083 #define WORD_REGISTER_OPERATIONS
2085 /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
2086 will either zero-extend or sign-extend. The value of this macro should
2087 be the code that says which one of the two operations is implicitly
2088 done, NIL if none. */
2089 #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
2091 /* Specify the tree operation to be used to convert reals to integers. */
2092 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
2094 /* This is the kind of divide that is easiest to do in the general case. */
2095 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
2097 /* Max number of bytes we can move from memory to memory
2098 in one reasonably fast instruction. */
2101 /* Define this to be nonzero if shift instructions ignore all but the low-order
2103 #define SHIFT_COUNT_TRUNCATED 1
2105 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
2106 is done just by pretending it is already truncated. */
2107 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
2109 /* We assume that the store-condition-codes instructions store 0 for false
2110 and some other value for true. This is the value stored for true. */
2111 #define STORE_FLAG_VALUE 1
2113 /* Specify the machine mode that pointers have.
2114 After generation of rtl, the compiler makes no further distinction
2115 between pointers and any other objects of this machine mode. */
2116 /* ??? The M32R doesn't have full 32 bit pointers, but making this PSImode has
2117 it's own problems (you have to add extendpsisi2 and truncsipsi2).
2119 #define Pmode SImode
2121 /* A function address in a call instruction. */
2122 #define FUNCTION_MODE SImode
2124 /* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
2125 is a valid machine specific attribute for DECL.
2126 The attributes in ATTRIBUTES have previously been assigned to TYPE. */
2127 #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
2128 m32r_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
2130 /* A C expression that returns zero if the attributes on TYPE1 and TYPE2 are
2131 incompatible, one if they are compatible, and two if they are
2132 nearly compatible (which causes a warning to be generated). */
2133 #define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
2134 m32r_comp_type_attributes (TYPE1, TYPE2)
2136 /* Give newly defined TYPE some default attributes. */
2137 #define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
2138 m32r_set_default_type_attributes (TYPE)
2140 /* Define the information needed to generate branch and scc insns. This is
2141 stored from the compare operation. Note that we can't use "rtx" here
2142 since it hasn't been defined! */
2143 extern struct rtx_def * m32r_compare_op0;
2144 extern struct rtx_def * m32r_compare_op1;
2146 /* M32R function types. */
2147 enum m32r_function_type
2149 M32R_FUNCTION_UNKNOWN, M32R_FUNCTION_NORMAL, M32R_FUNCTION_INTERRUPT
2152 #define M32R_INTERRUPT_P(TYPE) ((TYPE) == M32R_FUNCTION_INTERRUPT)
2154 /* Define this if you have defined special-purpose predicates in the
2155 file `MACHINE.c'. This macro is called within an initializer of an
2156 array of structures. The first field in the structure is the name
2157 of a predicate and the second field is an array of rtl codes. For
2158 each predicate, list all rtl codes that can be in expressions
2159 matched by the predicate. The list should have a trailing comma. */
2161 #define PREDICATE_CODES \
2162 { "conditional_move_operand", { REG, SUBREG, CONST_INT }}, \
2163 { "carry_compare_operand", { EQ, NE }}, \
2164 { "eqne_comparison_operator", { EQ, NE }}, \
2165 { "signed_comparison_operator", { EQ, NE, LT, LE, GT, GE }}, \
2166 { "move_dest_operand", { REG, SUBREG, MEM }}, \
2167 { "move_src_operand", { REG, SUBREG, MEM, CONST_INT, \
2168 CONST_DOUBLE, LABEL_REF, CONST, \
2170 { "move_double_src_operand", { REG, SUBREG, MEM, CONST_INT, \
2172 { "two_insn_const_operand", { CONST_INT }}, \
2173 { "symbolic_operand", { SYMBOL_REF, LABEL_REF, CONST }}, \
2174 { "seth_add3_operand", { SYMBOL_REF, LABEL_REF, CONST }}, \
2175 { "int8_operand", { CONST_INT }}, \
2176 { "uint16_operand", { CONST_INT }}, \
2177 { "reg_or_int16_operand", { REG, SUBREG, CONST_INT }}, \
2178 { "reg_or_uint16_operand", { REG, SUBREG, CONST_INT }}, \
2179 { "reg_or_cmp_int16_operand", { REG, SUBREG, CONST_INT }}, \
2180 { "reg_or_eq_int16_operand", { REG, SUBREG, CONST_INT }}, \
2181 { "cmp_int16_operand", { CONST_INT }}, \
2182 { "call_address_operand", { SYMBOL_REF, LABEL_REF, CONST }}, \
2183 { "extend_operand", { REG, SUBREG, MEM }}, \
2184 { "small_insn_p", { INSN, CALL_INSN, JUMP_INSN }}, \
2185 { "m32r_block_immediate_operand",{ CONST_INT }}, \
2186 { "large_insn_p", { INSN, CALL_INSN, JUMP_INSN }}, \
2187 { "seth_add3_operand", { SYMBOL_REF, LABEL_REF, CONST }},