xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/m32r/m32r.h (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
136ac495dSmrg /* Definitions of target machine for GNU compiler, Renesas M32R cpu.
2*8feb0f0bSmrg    Copyright (C) 1996-2020 Free Software Foundation, Inc.
336ac495dSmrg 
436ac495dSmrg    This file is part of GCC.
536ac495dSmrg 
636ac495dSmrg    GCC is free software; you can redistribute it and/or modify it
736ac495dSmrg    under the terms of the GNU General Public License as published
836ac495dSmrg    by the Free Software Foundation; either version 3, or (at your
936ac495dSmrg    option) any later version.
1036ac495dSmrg 
1136ac495dSmrg    GCC is distributed in the hope that it will be useful, but WITHOUT
1236ac495dSmrg    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1336ac495dSmrg    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
1436ac495dSmrg    License for more details.
1536ac495dSmrg 
1636ac495dSmrg    You should have received a copy of the GNU General Public License
1736ac495dSmrg    along with GCC; see the file COPYING3.  If not see
1836ac495dSmrg    <http://www.gnu.org/licenses/>.  */
1936ac495dSmrg 
2036ac495dSmrg /* Things to do:
2136ac495dSmrg - longlong.h?
2236ac495dSmrg */
2336ac495dSmrg 
2436ac495dSmrg #undef SIZE_TYPE
2536ac495dSmrg #undef PTRDIFF_TYPE
2636ac495dSmrg #undef WCHAR_TYPE
2736ac495dSmrg #undef WCHAR_TYPE_SIZE
2836ac495dSmrg #undef CPP_SPEC
2936ac495dSmrg #undef ASM_SPEC
3036ac495dSmrg #undef LINK_SPEC
3136ac495dSmrg #undef STARTFILE_SPEC
3236ac495dSmrg #undef ENDFILE_SPEC
3336ac495dSmrg 
3436ac495dSmrg #undef ASM_APP_ON
3536ac495dSmrg #undef ASM_APP_OFF
3636ac495dSmrg 
3736ac495dSmrg 
3836ac495dSmrg /* M32R/X overrides.  */
3936ac495dSmrg 
4036ac495dSmrg /* Additional flags for the preprocessor.  */
4136ac495dSmrg #define CPP_CPU_SPEC "%{m32rx:-D__M32RX__ -D__m32rx__ -U__M32R2__ -U__m32r2__} \
4236ac495dSmrg %{m32r2:-D__M32R2__ -D__m32r2__ -U__M32RX__ -U__m32rx__} \
4336ac495dSmrg %{m32r:-U__M32RX__  -U__m32rx__ -U__M32R2__ -U__m32r2__} \
4436ac495dSmrg  "
4536ac495dSmrg 
4636ac495dSmrg /* Assembler switches.  */
4736ac495dSmrg #define ASM_CPU_SPEC \
4836ac495dSmrg "%{m32r} %{m32rx} %{m32r2} %{!O0: %{O*: -O}} --no-warn-explicit-parallel-conflicts"
4936ac495dSmrg 
5036ac495dSmrg /* Use m32rx specific crt0/crtinit/crtfini files.  */
5136ac495dSmrg #define STARTFILE_CPU_SPEC "%{!shared:crt0.o%s} %{m32rx:m32rx/crtinit.o%s} %{!m32rx:crtinit.o%s}"
5236ac495dSmrg #define ENDFILE_CPU_SPEC "-lgloss %{m32rx:m32rx/crtfini.o%s} %{!m32rx:crtfini.o%s}"
5336ac495dSmrg 
5436ac495dSmrg /* Define this macro as a C expression for the initializer of an array of
5536ac495dSmrg    strings to tell the driver program which options are defaults for this
5636ac495dSmrg    target and thus do not need to be handled specially when using
5736ac495dSmrg    `MULTILIB_OPTIONS'.  */
5836ac495dSmrg #define SUBTARGET_MULTILIB_DEFAULTS , "m32r"
5936ac495dSmrg 
6036ac495dSmrg /* Number of additional registers the subtarget defines.  */
6136ac495dSmrg #define SUBTARGET_NUM_REGISTERS 1
6236ac495dSmrg 
6336ac495dSmrg /* 1 for registers that cannot be allocated.  */
6436ac495dSmrg #define SUBTARGET_FIXED_REGISTERS , 1
6536ac495dSmrg 
6636ac495dSmrg /* 1 for registers that are not available across function calls.  */
6736ac495dSmrg #define SUBTARGET_CALL_USED_REGISTERS , 1
6836ac495dSmrg 
6936ac495dSmrg /* Order to allocate model specific registers.  */
7036ac495dSmrg #define SUBTARGET_REG_ALLOC_ORDER , 19
7136ac495dSmrg 
7236ac495dSmrg /* Registers which are accumulators.  */
7336ac495dSmrg #define SUBTARGET_REG_CLASS_ACCUM 0x80000
7436ac495dSmrg 
7536ac495dSmrg /* All registers added.  */
7636ac495dSmrg #define SUBTARGET_REG_CLASS_ALL SUBTARGET_REG_CLASS_ACCUM
7736ac495dSmrg 
7836ac495dSmrg /* Additional accumulator registers.  */
7936ac495dSmrg #define SUBTARGET_ACCUM_P(REGNO) ((REGNO) == 19)
8036ac495dSmrg 
8136ac495dSmrg /* Define additional register names.  */
8236ac495dSmrg #define SUBTARGET_REGISTER_NAMES , "a1"
8336ac495dSmrg /* end M32R/X overrides.  */
8436ac495dSmrg 
8536ac495dSmrg /* Names to predefine in the preprocessor for this target machine.  */
8636ac495dSmrg /* __M32R__ is defined by the existing compiler so we use that.  */
8736ac495dSmrg #define TARGET_CPU_CPP_BUILTINS()		\
8836ac495dSmrg   do						\
8936ac495dSmrg     {						\
9036ac495dSmrg       builtin_define ("__M32R__");		\
9136ac495dSmrg       builtin_define ("__m32r__");		\
9236ac495dSmrg       builtin_assert ("cpu=m32r");		\
9336ac495dSmrg       builtin_assert ("machine=m32r");		\
9436ac495dSmrg       builtin_define (TARGET_BIG_ENDIAN		\
9536ac495dSmrg                       ? "__BIG_ENDIAN__" : "__LITTLE_ENDIAN__"); \
9636ac495dSmrg     }						\
9736ac495dSmrg   while (0)
9836ac495dSmrg 
9936ac495dSmrg /* This macro defines names of additional specifications to put in the specs
10036ac495dSmrg    that can be used in various specifications like CC1_SPEC.  Its definition
10136ac495dSmrg    is an initializer with a subgrouping for each command option.
10236ac495dSmrg 
10336ac495dSmrg    Each subgrouping contains a string constant, that defines the
10436ac495dSmrg    specification name, and a string constant that used by the GCC driver
10536ac495dSmrg    program.
10636ac495dSmrg 
10736ac495dSmrg    Do not define this macro if it does not need to do anything.  */
10836ac495dSmrg 
10936ac495dSmrg #ifndef SUBTARGET_EXTRA_SPECS
11036ac495dSmrg #define SUBTARGET_EXTRA_SPECS
11136ac495dSmrg #endif
11236ac495dSmrg 
11336ac495dSmrg #ifndef	ASM_CPU_SPEC
11436ac495dSmrg #define	ASM_CPU_SPEC ""
11536ac495dSmrg #endif
11636ac495dSmrg 
11736ac495dSmrg #ifndef	CPP_CPU_SPEC
11836ac495dSmrg #define	CPP_CPU_SPEC ""
11936ac495dSmrg #endif
12036ac495dSmrg 
12136ac495dSmrg #ifndef	CC1_CPU_SPEC
12236ac495dSmrg #define	CC1_CPU_SPEC ""
12336ac495dSmrg #endif
12436ac495dSmrg 
12536ac495dSmrg #ifndef	LINK_CPU_SPEC
12636ac495dSmrg #define	LINK_CPU_SPEC ""
12736ac495dSmrg #endif
12836ac495dSmrg 
12936ac495dSmrg #ifndef STARTFILE_CPU_SPEC
13036ac495dSmrg #define STARTFILE_CPU_SPEC "%{!shared:crt0.o%s} crtinit.o%s"
13136ac495dSmrg #endif
13236ac495dSmrg 
13336ac495dSmrg #ifndef ENDFILE_CPU_SPEC
13436ac495dSmrg #define ENDFILE_CPU_SPEC "-lgloss crtfini.o%s"
13536ac495dSmrg #endif
13636ac495dSmrg 
13736ac495dSmrg #ifndef RELAX_SPEC
13836ac495dSmrg #if 0 /* Not supported yet.  */
13936ac495dSmrg #define RELAX_SPEC "%{mrelax:-relax}"
14036ac495dSmrg #else
14136ac495dSmrg #define RELAX_SPEC ""
14236ac495dSmrg #endif
14336ac495dSmrg #endif
14436ac495dSmrg 
14536ac495dSmrg #define EXTRA_SPECS							\
14636ac495dSmrg   { "asm_cpu",			ASM_CPU_SPEC },				\
14736ac495dSmrg   { "cpp_cpu",			CPP_CPU_SPEC },				\
14836ac495dSmrg   { "cc1_cpu",			CC1_CPU_SPEC },				\
14936ac495dSmrg   { "link_cpu",			LINK_CPU_SPEC },			\
15036ac495dSmrg   { "startfile_cpu",		STARTFILE_CPU_SPEC },			\
15136ac495dSmrg   { "endfile_cpu",		ENDFILE_CPU_SPEC },			\
15236ac495dSmrg   { "relax",			RELAX_SPEC },				\
15336ac495dSmrg   SUBTARGET_EXTRA_SPECS
15436ac495dSmrg 
15536ac495dSmrg #define CPP_SPEC "%(cpp_cpu)"
15636ac495dSmrg 
15736ac495dSmrg #undef  CC1_SPEC
15836ac495dSmrg #define CC1_SPEC "%{G*} %(cc1_cpu)"
15936ac495dSmrg 
16036ac495dSmrg /* Options to pass on to the assembler.  */
16136ac495dSmrg #undef  ASM_SPEC
16236ac495dSmrg #define ASM_SPEC "%(asm_cpu) %(relax) %{" FPIE_OR_FPIC_SPEC ":-K PIC}"
16336ac495dSmrg 
16436ac495dSmrg #define LINK_SPEC "%{v} %(link_cpu) %(relax)"
16536ac495dSmrg 
16636ac495dSmrg #undef  STARTFILE_SPEC
16736ac495dSmrg #define STARTFILE_SPEC "%(startfile_cpu)"
16836ac495dSmrg 
16936ac495dSmrg #undef  ENDFILE_SPEC
17036ac495dSmrg #define ENDFILE_SPEC "%(endfile_cpu)"
17136ac495dSmrg 
17236ac495dSmrg #undef LIB_SPEC
17336ac495dSmrg 
17436ac495dSmrg /* Run-time compilation parameters selecting different hardware subsets.  */
17536ac495dSmrg 
17636ac495dSmrg #define TARGET_M32R             (! TARGET_M32RX && ! TARGET_M32R2)
17736ac495dSmrg 
17836ac495dSmrg #ifndef TARGET_LITTLE_ENDIAN
17936ac495dSmrg #define TARGET_LITTLE_ENDIAN	0
18036ac495dSmrg #endif
18136ac495dSmrg #define TARGET_BIG_ENDIAN       (! TARGET_LITTLE_ENDIAN)
18236ac495dSmrg 
18336ac495dSmrg /* This defaults us to m32r.  */
18436ac495dSmrg #ifndef TARGET_CPU_DEFAULT
18536ac495dSmrg #define TARGET_CPU_DEFAULT 0
18636ac495dSmrg #endif
18736ac495dSmrg 
18836ac495dSmrg #ifndef M32R_OPTS_H
18936ac495dSmrg #include "config/m32r/m32r-opts.h"
19036ac495dSmrg #endif
19136ac495dSmrg 
19236ac495dSmrg /* Define this macro as a C expression for the initializer of an array of
19336ac495dSmrg    strings to tell the driver program which options are defaults for this
19436ac495dSmrg    target and thus do not need to be handled specially when using
19536ac495dSmrg    `MULTILIB_OPTIONS'.  */
19636ac495dSmrg #ifndef SUBTARGET_MULTILIB_DEFAULTS
19736ac495dSmrg #define SUBTARGET_MULTILIB_DEFAULTS
19836ac495dSmrg #endif
19936ac495dSmrg 
20036ac495dSmrg #ifndef MULTILIB_DEFAULTS
20136ac495dSmrg #define MULTILIB_DEFAULTS { "mmodel=small" SUBTARGET_MULTILIB_DEFAULTS }
20236ac495dSmrg #endif
20336ac495dSmrg 
20436ac495dSmrg #ifndef SUBTARGET_OVERRIDE_OPTIONS
20536ac495dSmrg #define SUBTARGET_OVERRIDE_OPTIONS
20636ac495dSmrg #endif
20736ac495dSmrg 
20836ac495dSmrg /* Target machine storage layout.  */
20936ac495dSmrg 
21036ac495dSmrg /* Define this if most significant bit is lowest numbered
21136ac495dSmrg    in instructions that operate on numbered bit-fields.  */
21236ac495dSmrg #define BITS_BIG_ENDIAN 1
21336ac495dSmrg 
21436ac495dSmrg /* Define this if most significant byte of a word is the lowest numbered.  */
21536ac495dSmrg #define BYTES_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0)
21636ac495dSmrg 
21736ac495dSmrg /* Define this if most significant word of a multiword number is the lowest
21836ac495dSmrg    numbered.  */
21936ac495dSmrg #define WORDS_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0)
22036ac495dSmrg 
22136ac495dSmrg /* Width of a word, in units (bytes).  */
22236ac495dSmrg #define UNITS_PER_WORD 4
22336ac495dSmrg 
22436ac495dSmrg /* Define this macro if it is advisable to hold scalars in registers
22536ac495dSmrg    in a wider mode than that declared by the program.  In such cases,
22636ac495dSmrg    the value is constrained to be within the bounds of the declared
22736ac495dSmrg    type, but kept valid in the wider mode.  The signedness of the
22836ac495dSmrg    extension may differ from that of the type.  */
22936ac495dSmrg #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE)	\
23036ac495dSmrg   if (GET_MODE_CLASS (MODE) == MODE_INT		\
23136ac495dSmrg       && GET_MODE_SIZE (MODE) < UNITS_PER_WORD)	\
23236ac495dSmrg     {						\
23336ac495dSmrg       (MODE) = SImode;				\
23436ac495dSmrg     }
23536ac495dSmrg 
23636ac495dSmrg /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
23736ac495dSmrg #define PARM_BOUNDARY 32
23836ac495dSmrg 
23936ac495dSmrg /* Boundary (in *bits*) on which stack pointer should be aligned.  */
24036ac495dSmrg #define STACK_BOUNDARY 32
24136ac495dSmrg 
24236ac495dSmrg /* ALIGN FRAMES on word boundaries */
24336ac495dSmrg #define M32R_STACK_ALIGN(LOC) (((LOC) + 3) & ~ 3)
24436ac495dSmrg 
24536ac495dSmrg /* Allocation boundary (in *bits*) for the code of a function.  */
24636ac495dSmrg #define FUNCTION_BOUNDARY 32
24736ac495dSmrg 
24836ac495dSmrg /* Alignment of field after `int : 0' in a structure.  */
24936ac495dSmrg #define EMPTY_FIELD_BOUNDARY 32
25036ac495dSmrg 
25136ac495dSmrg /* Every structure's size must be a multiple of this.  */
25236ac495dSmrg #define STRUCTURE_SIZE_BOUNDARY 8
25336ac495dSmrg 
25436ac495dSmrg /* A bit-field declared as `int' forces `int' alignment for the struct.  */
25536ac495dSmrg #define PCC_BITFIELD_TYPE_MATTERS 1
25636ac495dSmrg 
25736ac495dSmrg /* No data type wants to be aligned rounder than this.  */
25836ac495dSmrg #define BIGGEST_ALIGNMENT 32
25936ac495dSmrg 
26036ac495dSmrg /* The best alignment to use in cases where we have a choice.  */
26136ac495dSmrg #define FASTEST_ALIGNMENT 32
26236ac495dSmrg 
26336ac495dSmrg /* Make arrays of chars word-aligned for the same reasons.  */
26436ac495dSmrg #define DATA_ALIGNMENT(TYPE, ALIGN)					\
26536ac495dSmrg   (TREE_CODE (TYPE) == ARRAY_TYPE					\
26636ac495dSmrg    && TYPE_MODE (TREE_TYPE (TYPE)) == QImode				\
26736ac495dSmrg    && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
26836ac495dSmrg 
26936ac495dSmrg /* Set this nonzero if move instructions will actually fail to work
27036ac495dSmrg    when given unaligned data.  */
27136ac495dSmrg #define STRICT_ALIGNMENT 1
27236ac495dSmrg 
27336ac495dSmrg /* Define LAVEL_ALIGN to calculate code length of PNOP at labels.  */
27436ac495dSmrg #define LABEL_ALIGN(insn) 2
27536ac495dSmrg 
27636ac495dSmrg /* Layout of source language data types.  */
27736ac495dSmrg 
27836ac495dSmrg #define SHORT_TYPE_SIZE		16
27936ac495dSmrg #define INT_TYPE_SIZE		32
28036ac495dSmrg #define LONG_TYPE_SIZE		32
28136ac495dSmrg #define LONG_LONG_TYPE_SIZE	64
28236ac495dSmrg #define FLOAT_TYPE_SIZE		32
28336ac495dSmrg #define DOUBLE_TYPE_SIZE	64
28436ac495dSmrg #define LONG_DOUBLE_TYPE_SIZE	64
28536ac495dSmrg 
28636ac495dSmrg /* Define this as 1 if `char' should by default be signed; else as 0.  */
28736ac495dSmrg #define DEFAULT_SIGNED_CHAR 1
28836ac495dSmrg 
28936ac495dSmrg #define SIZE_TYPE "long unsigned int"
29036ac495dSmrg #define PTRDIFF_TYPE "long int"
29136ac495dSmrg #define WCHAR_TYPE "short unsigned int"
29236ac495dSmrg #define WCHAR_TYPE_SIZE 16
29336ac495dSmrg 
29436ac495dSmrg /* Standard register usage.  */
29536ac495dSmrg 
29636ac495dSmrg /* Number of actual hardware registers.
29736ac495dSmrg    The hardware registers are assigned numbers for the compiler
29836ac495dSmrg    from 0 to just below FIRST_PSEUDO_REGISTER.
29936ac495dSmrg    All registers that the compiler knows about must be given numbers,
30036ac495dSmrg    even those that are not normally considered general registers.  */
30136ac495dSmrg 
30236ac495dSmrg #define M32R_NUM_REGISTERS 	19
30336ac495dSmrg 
30436ac495dSmrg #ifndef SUBTARGET_NUM_REGISTERS
30536ac495dSmrg #define SUBTARGET_NUM_REGISTERS 0
30636ac495dSmrg #endif
30736ac495dSmrg 
30836ac495dSmrg #define FIRST_PSEUDO_REGISTER (M32R_NUM_REGISTERS + SUBTARGET_NUM_REGISTERS)
30936ac495dSmrg 
31036ac495dSmrg /* 1 for registers that have pervasive standard uses
31136ac495dSmrg    and are not available for the register allocator.
31236ac495dSmrg 
31336ac495dSmrg    0-3   - arguments/results
31436ac495dSmrg    4-5   - call used [4 is used as a tmp during prologue/epilogue generation]
31536ac495dSmrg    6     - call used, gptmp
31636ac495dSmrg    7     - call used, static chain pointer
31736ac495dSmrg    8-11  - call saved
31836ac495dSmrg    12    - call saved [reserved for global pointer]
31936ac495dSmrg    13    - frame pointer
32036ac495dSmrg    14    - subroutine link register
32136ac495dSmrg    15    - stack pointer
32236ac495dSmrg    16    - arg pointer
32336ac495dSmrg    17    - carry flag
32436ac495dSmrg    18	 - accumulator
32536ac495dSmrg    19    - accumulator 1 in the m32r/x
32636ac495dSmrg    By default, the extension registers are not available.  */
32736ac495dSmrg 
32836ac495dSmrg #ifndef SUBTARGET_FIXED_REGISTERS
32936ac495dSmrg #define SUBTARGET_FIXED_REGISTERS
33036ac495dSmrg #endif
33136ac495dSmrg 
33236ac495dSmrg #define FIXED_REGISTERS		\
33336ac495dSmrg {				\
33436ac495dSmrg   0, 0, 0, 0, 0, 0, 0, 0,	\
33536ac495dSmrg   0, 0, 0, 0, 0, 0, 0, 1,	\
33636ac495dSmrg   1, 1, 1			\
33736ac495dSmrg   SUBTARGET_FIXED_REGISTERS	\
33836ac495dSmrg }
33936ac495dSmrg 
34036ac495dSmrg /* 1 for registers not available across function calls.
34136ac495dSmrg    These must include the FIXED_REGISTERS and also any
34236ac495dSmrg    registers that can be used without being saved.
34336ac495dSmrg    The latter must include the registers where values are returned
34436ac495dSmrg    and the register where structure-value addresses are passed.
34536ac495dSmrg    Aside from that, you can include as many other registers as you like.  */
34636ac495dSmrg 
34736ac495dSmrg #ifndef SUBTARGET_CALL_USED_REGISTERS
34836ac495dSmrg #define SUBTARGET_CALL_USED_REGISTERS
34936ac495dSmrg #endif
35036ac495dSmrg 
351*8feb0f0bSmrg #define CALL_REALLY_USED_REGISTERS \
35236ac495dSmrg {				\
35336ac495dSmrg   1, 1, 1, 1, 1, 1, 1, 1,	\
35436ac495dSmrg   0, 0, 0, 0, 0, 0, 1, 1,	\
35536ac495dSmrg   1, 1, 1			\
35636ac495dSmrg   SUBTARGET_CALL_USED_REGISTERS	\
35736ac495dSmrg }
35836ac495dSmrg 
35936ac495dSmrg /* If defined, an initializer for a vector of integers, containing the
36036ac495dSmrg    numbers of hard registers in the order in which GCC should
36136ac495dSmrg    prefer to use them (from most preferred to least).  */
36236ac495dSmrg 
36336ac495dSmrg #ifndef SUBTARGET_REG_ALLOC_ORDER
36436ac495dSmrg #define SUBTARGET_REG_ALLOC_ORDER
36536ac495dSmrg #endif
36636ac495dSmrg 
36736ac495dSmrg #if 1 /* Better for int code.  */
36836ac495dSmrg #define REG_ALLOC_ORDER				\
36936ac495dSmrg {						\
37036ac495dSmrg   4,  5,  6,  7,  2,  3,  8,  9, 10,		\
37136ac495dSmrg   11, 12, 13, 14,  0,  1, 15, 16, 17, 18	\
37236ac495dSmrg   SUBTARGET_REG_ALLOC_ORDER			\
37336ac495dSmrg }
37436ac495dSmrg 
37536ac495dSmrg #else /* Better for fp code at expense of int code.  */
37636ac495dSmrg #define REG_ALLOC_ORDER				\
37736ac495dSmrg {						\
37836ac495dSmrg    0,  1,  2,  3,  4,  5,  6,  7,  8,		\
37936ac495dSmrg    9, 10, 11, 12, 13, 14, 15, 16, 17, 18	\
38036ac495dSmrg   SUBTARGET_REG_ALLOC_ORDER			\
38136ac495dSmrg }
38236ac495dSmrg #endif
38336ac495dSmrg 
38436ac495dSmrg #define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
38536ac495dSmrg   m32r_hard_regno_rename_ok (OLD_REG, NEW_REG)
38636ac495dSmrg 
38736ac495dSmrg /* Register classes and constants.  */
38836ac495dSmrg 
38936ac495dSmrg /* Define the classes of registers for register constraints in the
39036ac495dSmrg    machine description.  Also define ranges of constants.
39136ac495dSmrg 
39236ac495dSmrg    One of the classes must always be named ALL_REGS and include all hard regs.
39336ac495dSmrg    If there is more than one class, another class must be named NO_REGS
39436ac495dSmrg    and contain no registers.
39536ac495dSmrg 
39636ac495dSmrg    The name GENERAL_REGS must be the name of a class (or an alias for
39736ac495dSmrg    another name such as ALL_REGS).  This is the class of registers
39836ac495dSmrg    that is allowed by "g" or "r" in a register constraint.
39936ac495dSmrg    Also, registers outside this class are allocated only when
40036ac495dSmrg    instructions express preferences for them.
40136ac495dSmrg 
40236ac495dSmrg    The classes must be numbered in nondecreasing order; that is,
40336ac495dSmrg    a larger-numbered class must never be contained completely
40436ac495dSmrg    in a smaller-numbered class.
40536ac495dSmrg 
40636ac495dSmrg    For any two classes, it is very desirable that there be another
40736ac495dSmrg    class that represents their union.
40836ac495dSmrg 
40936ac495dSmrg    It is important that any condition codes have class NO_REGS.
41036ac495dSmrg    See `register_operand'.  */
41136ac495dSmrg 
41236ac495dSmrg enum reg_class
41336ac495dSmrg {
41436ac495dSmrg   NO_REGS, CARRY_REG, ACCUM_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
41536ac495dSmrg };
41636ac495dSmrg 
41736ac495dSmrg #define N_REG_CLASSES ((int) LIM_REG_CLASSES)
41836ac495dSmrg 
41936ac495dSmrg /* Give names of register classes as strings for dump file.  */
42036ac495dSmrg #define REG_CLASS_NAMES \
42136ac495dSmrg   { "NO_REGS", "CARRY_REG", "ACCUM_REGS", "GENERAL_REGS", "ALL_REGS" }
42236ac495dSmrg 
42336ac495dSmrg /* Define which registers fit in which classes.
42436ac495dSmrg    This is an initializer for a vector of HARD_REG_SET
42536ac495dSmrg    of length N_REG_CLASSES.  */
42636ac495dSmrg 
42736ac495dSmrg #ifndef SUBTARGET_REG_CLASS_CARRY
42836ac495dSmrg #define SUBTARGET_REG_CLASS_CARRY 0
42936ac495dSmrg #endif
43036ac495dSmrg 
43136ac495dSmrg #ifndef SUBTARGET_REG_CLASS_ACCUM
43236ac495dSmrg #define SUBTARGET_REG_CLASS_ACCUM 0
43336ac495dSmrg #endif
43436ac495dSmrg 
43536ac495dSmrg #ifndef SUBTARGET_REG_CLASS_GENERAL
43636ac495dSmrg #define SUBTARGET_REG_CLASS_GENERAL 0
43736ac495dSmrg #endif
43836ac495dSmrg 
43936ac495dSmrg #ifndef SUBTARGET_REG_CLASS_ALL
44036ac495dSmrg #define SUBTARGET_REG_CLASS_ALL 0
44136ac495dSmrg #endif
44236ac495dSmrg 
44336ac495dSmrg #define REG_CLASS_CONTENTS						\
44436ac495dSmrg {									\
44536ac495dSmrg   { 0x00000 },								\
44636ac495dSmrg   { 0x20000 | SUBTARGET_REG_CLASS_CARRY },				\
44736ac495dSmrg   { 0x40000 | SUBTARGET_REG_CLASS_ACCUM },				\
44836ac495dSmrg   { 0x1ffff | SUBTARGET_REG_CLASS_GENERAL },				\
44936ac495dSmrg   { 0x7ffff | SUBTARGET_REG_CLASS_ALL },				\
45036ac495dSmrg }
45136ac495dSmrg 
45236ac495dSmrg /* The same information, inverted:
45336ac495dSmrg    Return the class number of the smallest class containing
45436ac495dSmrg    reg number REGNO.  This could be a conditional expression
45536ac495dSmrg    or could index an array.  */
45636ac495dSmrg extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
45736ac495dSmrg #define REGNO_REG_CLASS(REGNO) (m32r_regno_reg_class[REGNO])
45836ac495dSmrg 
45936ac495dSmrg /* The class value for index registers, and the one for base regs.  */
46036ac495dSmrg #define INDEX_REG_CLASS GENERAL_REGS
46136ac495dSmrg #define BASE_REG_CLASS GENERAL_REGS
46236ac495dSmrg 
46336ac495dSmrg /* These assume that REGNO is a hard or pseudo reg number.
46436ac495dSmrg    They give nonzero only if REGNO is a hard reg of the suitable class
46536ac495dSmrg    or a pseudo reg currently allocated to a suitable hard reg.
46636ac495dSmrg    Since they use reg_renumber, they are safe only once reg_renumber
46736ac495dSmrg    has been allocated, which happens in reginfo.c during register
46836ac495dSmrg    allocation.  */
46936ac495dSmrg #define REGNO_OK_FOR_BASE_P(REGNO) \
47036ac495dSmrg   ((REGNO) < FIRST_PSEUDO_REGISTER			\
47136ac495dSmrg    ? GPR_P (REGNO) || (REGNO) == ARG_POINTER_REGNUM	\
47236ac495dSmrg    : GPR_P (reg_renumber[REGNO]))
47336ac495dSmrg 
47436ac495dSmrg #define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_BASE_P(REGNO)
47536ac495dSmrg 
47636ac495dSmrg /* Return true if a value is inside a range.  */
47736ac495dSmrg #define IN_RANGE_P(VALUE, LOW, HIGH)			\
47836ac495dSmrg   (((unsigned HOST_WIDE_INT)((VALUE) - (LOW)))		\
47936ac495dSmrg    <= ((unsigned HOST_WIDE_INT)((HIGH) - (LOW))))
48036ac495dSmrg 
48136ac495dSmrg /* Some range macros.  */
48236ac495dSmrg #define INT16_P(X)     ((X) >= - 0x8000 && (X) <= 0x7fff)
48336ac495dSmrg #define CMP_INT16_P(X) ((X) >= - 0x7fff && (X) <= 0x8000)
48436ac495dSmrg #define UINT16_P(X)   (((unsigned HOST_WIDE_INT) (X)) <= 0x0000ffff)
48536ac495dSmrg #define UINT24_P(X)   (((unsigned HOST_WIDE_INT) (X)) <= 0x00ffffff)
48636ac495dSmrg 
48736ac495dSmrg /* Stack layout and stack pointer usage.  */
48836ac495dSmrg 
48936ac495dSmrg /* Define this macro if pushing a word onto the stack moves the stack
49036ac495dSmrg    pointer to a smaller address.  */
49136ac495dSmrg #define STACK_GROWS_DOWNWARD 1
49236ac495dSmrg 
49336ac495dSmrg /* Offset from the stack pointer register to the first location at which
49436ac495dSmrg    outgoing arguments are placed.  */
49536ac495dSmrg #define STACK_POINTER_OFFSET 0
49636ac495dSmrg 
49736ac495dSmrg /* Offset of first parameter from the argument pointer register value.  */
49836ac495dSmrg #define FIRST_PARM_OFFSET(FNDECL) 0
49936ac495dSmrg 
50036ac495dSmrg /* Register to use for pushing function arguments.  */
50136ac495dSmrg #define STACK_POINTER_REGNUM 15
50236ac495dSmrg 
50336ac495dSmrg /* Base register for access to local variables of the function.  */
50436ac495dSmrg #define FRAME_POINTER_REGNUM 13
50536ac495dSmrg 
50636ac495dSmrg /* Base register for access to arguments of the function.  */
50736ac495dSmrg #define ARG_POINTER_REGNUM 16
50836ac495dSmrg 
50936ac495dSmrg /* Register in which static-chain is passed to a function.
51036ac495dSmrg    This must not be a register used by the prologue.  */
51136ac495dSmrg #define STATIC_CHAIN_REGNUM  7
51236ac495dSmrg 
51336ac495dSmrg /* These aren't official macros.  */
51436ac495dSmrg #define PROLOGUE_TMP_REGNUM  4
51536ac495dSmrg #define RETURN_ADDR_REGNUM  14
51636ac495dSmrg /* #define GP_REGNUM        12 */
51736ac495dSmrg #define CARRY_REGNUM        17
51836ac495dSmrg #define ACCUM_REGNUM        18
51936ac495dSmrg #define M32R_MAX_INT_REGS   16
52036ac495dSmrg 
52136ac495dSmrg #ifndef SUBTARGET_GPR_P
52236ac495dSmrg #define SUBTARGET_GPR_P(REGNO) 0
52336ac495dSmrg #endif
52436ac495dSmrg 
52536ac495dSmrg #ifndef SUBTARGET_ACCUM_P
52636ac495dSmrg #define SUBTARGET_ACCUM_P(REGNO) 0
52736ac495dSmrg #endif
52836ac495dSmrg 
52936ac495dSmrg #ifndef SUBTARGET_CARRY_P
53036ac495dSmrg #define SUBTARGET_CARRY_P(REGNO) 0
53136ac495dSmrg #endif
53236ac495dSmrg 
53336ac495dSmrg #define GPR_P(REGNO)   (IN_RANGE_P ((REGNO), 0, 15) || SUBTARGET_GPR_P (REGNO))
53436ac495dSmrg #define ACCUM_P(REGNO) ((REGNO) == ACCUM_REGNUM || SUBTARGET_ACCUM_P (REGNO))
53536ac495dSmrg #define CARRY_P(REGNO) ((REGNO) == CARRY_REGNUM || SUBTARGET_CARRY_P (REGNO))
53636ac495dSmrg 
53736ac495dSmrg /* Eliminating the frame and arg pointers.  */
53836ac495dSmrg 
53936ac495dSmrg /* If defined, this macro specifies a table of register pairs used to
54036ac495dSmrg    eliminate unneeded registers that point into the stack frame.  If
54136ac495dSmrg    it is not defined, the only elimination attempted by the compiler
54236ac495dSmrg    is to replace references to the frame pointer with references to
54336ac495dSmrg    the stack pointer.
54436ac495dSmrg 
54536ac495dSmrg    Note that the elimination of the argument pointer with the stack
54636ac495dSmrg    pointer is specified first since that is the preferred elimination.  */
54736ac495dSmrg 
54836ac495dSmrg #define ELIMINABLE_REGS					\
54936ac495dSmrg {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM },	\
55036ac495dSmrg  { ARG_POINTER_REGNUM,	 STACK_POINTER_REGNUM },	\
55136ac495dSmrg  { ARG_POINTER_REGNUM,   FRAME_POINTER_REGNUM }}
55236ac495dSmrg 
55336ac495dSmrg /* This macro returns the initial difference between the specified pair
55436ac495dSmrg    of registers.  */
55536ac495dSmrg 
55636ac495dSmrg #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)				\
55736ac495dSmrg   do										\
55836ac495dSmrg     {										\
55936ac495dSmrg       int size = m32r_compute_frame_size (get_frame_size ());			\
56036ac495dSmrg 										\
56136ac495dSmrg       if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM)	\
56236ac495dSmrg 	(OFFSET) = 0;								\
56336ac495dSmrg       else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM)	\
56436ac495dSmrg 	(OFFSET) = size - crtl->args.pretend_args_size;			\
56536ac495dSmrg       else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM)	\
56636ac495dSmrg 	(OFFSET) = size - crtl->args.pretend_args_size;			\
56736ac495dSmrg       else									\
56836ac495dSmrg 	gcc_unreachable ();								\
56936ac495dSmrg     }										\
57036ac495dSmrg   while (0)
57136ac495dSmrg 
57236ac495dSmrg /* Function argument passing.  */
57336ac495dSmrg 
57436ac495dSmrg /* If defined, the maximum amount of space required for outgoing
57536ac495dSmrg    arguments will be computed and placed into the variable
57636ac495dSmrg    `crtl->outgoing_args_size'.  No space will be pushed
57736ac495dSmrg    onto the stack for each call; instead, the function prologue should
57836ac495dSmrg    increase the stack frame size by this amount.  */
57936ac495dSmrg #define ACCUMULATE_OUTGOING_ARGS 1
58036ac495dSmrg 
58136ac495dSmrg /* Define a data type for recording info about an argument list
58236ac495dSmrg    during the scan of that argument list.  This data type should
58336ac495dSmrg    hold all necessary information about the function itself
58436ac495dSmrg    and about the args processed so far, enough to enable macros
58536ac495dSmrg    such as FUNCTION_ARG to determine where the next arg should go.  */
58636ac495dSmrg #define CUMULATIVE_ARGS int
58736ac495dSmrg 
58836ac495dSmrg /* Initialize a variable CUM of type CUMULATIVE_ARGS
58936ac495dSmrg    for a call to a function whose data type is FNTYPE.
59036ac495dSmrg    For a library call, FNTYPE is 0.  */
59136ac495dSmrg #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
59236ac495dSmrg   ((CUM) = 0)
59336ac495dSmrg 
59436ac495dSmrg /* The number of registers used for parameter passing.  Local to this file.  */
59536ac495dSmrg #define M32R_MAX_PARM_REGS 4
59636ac495dSmrg 
59736ac495dSmrg /* 1 if N is a possible register number for function argument passing.  */
59836ac495dSmrg #define FUNCTION_ARG_REGNO_P(N) \
59936ac495dSmrg   ((unsigned) (N) < M32R_MAX_PARM_REGS)
60036ac495dSmrg 
60136ac495dSmrg 
60236ac495dSmrg /* Function results.  */
60336ac495dSmrg 
60436ac495dSmrg /* Tell GCC to use TARGET_RETURN_IN_MEMORY.  */
60536ac495dSmrg #define DEFAULT_PCC_STRUCT_RETURN 0
60636ac495dSmrg 
60736ac495dSmrg /* Function entry and exit.  */
60836ac495dSmrg 
60936ac495dSmrg /* Initialize data used by insn expanders.  This is called from
61036ac495dSmrg    init_emit, once for each function, before code is generated.  */
61136ac495dSmrg #define INIT_EXPANDERS m32r_init_expanders ()
61236ac495dSmrg 
61336ac495dSmrg /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
61436ac495dSmrg    the stack pointer does not matter.  The value is tested only in
61536ac495dSmrg    functions that have frame pointers.
61636ac495dSmrg    No definition is equivalent to always zero.  */
61736ac495dSmrg #define EXIT_IGNORE_STACK 1
61836ac495dSmrg 
61936ac495dSmrg /* Output assembler code to FILE to increment profiler label # LABELNO
62036ac495dSmrg    for profiling a function entry.  */
62136ac495dSmrg #undef  FUNCTION_PROFILER
62236ac495dSmrg #define FUNCTION_PROFILER(FILE, LABELNO)			\
62336ac495dSmrg   do								\
62436ac495dSmrg     {								\
62536ac495dSmrg       if (flag_pic)						\
62636ac495dSmrg 	{							\
62736ac495dSmrg 	  fprintf (FILE, "\tld24 r14,#mcount\n");		\
62836ac495dSmrg 	  fprintf (FILE, "\tadd r14,r12\n");			\
62936ac495dSmrg 	  fprintf (FILE, "\tld r14,@r14\n");			\
63036ac495dSmrg 	  fprintf (FILE, "\tjl r14\n");				\
63136ac495dSmrg 	}							\
63236ac495dSmrg       else							\
63336ac495dSmrg 	{							\
63436ac495dSmrg 	  if (TARGET_ADDR24)					\
63536ac495dSmrg 	    fprintf (FILE, "\tbl mcount\n");			\
63636ac495dSmrg 	  else							\
63736ac495dSmrg 	    {							\
63836ac495dSmrg 	      fprintf (FILE, "\tseth r14,#high(mcount)\n");	\
63936ac495dSmrg 	      fprintf (FILE, "\tor3 r14,r14,#low(mcount)\n");	\
64036ac495dSmrg 	      fprintf (FILE, "\tjl r14\n");			\
64136ac495dSmrg 	    }							\
64236ac495dSmrg 	}							\
64336ac495dSmrg       fprintf (FILE, "\taddi sp,#4\n");				\
64436ac495dSmrg     }								\
64536ac495dSmrg   while (0)
64636ac495dSmrg 
64736ac495dSmrg /* Trampolines.  */
64836ac495dSmrg 
64936ac495dSmrg /* On the M32R, the trampoline is:
65036ac495dSmrg 
65136ac495dSmrg         mv      r7, lr   -> bl L1        ; 178e 7e01
65236ac495dSmrg L1:     add3    r6, lr, #L2-L1           ; 86ae 000c (L2 - L1 = 12)
65336ac495dSmrg         mv      lr, r7   -> ld r7,@r6+   ; 1e87 27e6
65436ac495dSmrg         ld      r6, @r6  -> jmp r6       ; 26c6 1fc6
65536ac495dSmrg L2:     .word STATIC
65636ac495dSmrg         .word FUNCTION  */
65736ac495dSmrg 
65836ac495dSmrg #ifndef CACHE_FLUSH_FUNC
65936ac495dSmrg #define CACHE_FLUSH_FUNC "_flush_cache"
66036ac495dSmrg #endif
66136ac495dSmrg #ifndef CACHE_FLUSH_TRAP
66236ac495dSmrg #define CACHE_FLUSH_TRAP 12
66336ac495dSmrg #endif
66436ac495dSmrg 
66536ac495dSmrg /* Length in bytes of the trampoline for entering a nested function.  */
66636ac495dSmrg #define TRAMPOLINE_SIZE 24
66736ac495dSmrg 
66836ac495dSmrg 
66936ac495dSmrg #define RETURN_ADDR_RTX(COUNT, FRAME) m32r_return_addr (COUNT)
67036ac495dSmrg 
67136ac495dSmrg #define INCOMING_RETURN_ADDR_RTX   gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM)
67236ac495dSmrg 
67336ac495dSmrg /* Addressing modes, and classification of registers for them.  */
67436ac495dSmrg 
67536ac495dSmrg /* Maximum number of registers that can appear in a valid memory address.  */
67636ac495dSmrg #define MAX_REGS_PER_ADDRESS 1
67736ac495dSmrg 
67836ac495dSmrg /* We have post-inc load and pre-dec,pre-inc store,
67936ac495dSmrg    but only for 4 byte vals.  */
68036ac495dSmrg #define HAVE_PRE_DECREMENT  1
68136ac495dSmrg #define HAVE_PRE_INCREMENT  1
68236ac495dSmrg #define HAVE_POST_INCREMENT 1
68336ac495dSmrg 
68436ac495dSmrg /* Recognize any constant value that is a valid address.  */
68536ac495dSmrg #define CONSTANT_ADDRESS_P(X)   \
68636ac495dSmrg   (    GET_CODE (X) == LABEL_REF  \
68736ac495dSmrg    ||  GET_CODE (X) == SYMBOL_REF \
68836ac495dSmrg    ||  CONST_INT_P (X)  \
68936ac495dSmrg    || (GET_CODE (X) == CONST      \
69036ac495dSmrg        && ! (flag_pic && ! m32r_legitimate_pic_operand_p (X))))
69136ac495dSmrg 
69236ac495dSmrg /* Condition code usage.  */
69336ac495dSmrg 
69436ac495dSmrg /* Return nonzero if SELECT_CC_MODE will never return MODE for a
69536ac495dSmrg    floating point inequality comparison.  */
69636ac495dSmrg #define REVERSIBLE_CC_MODE(MODE) 1 /*???*/
69736ac495dSmrg 
69836ac495dSmrg /* Costs.  */
69936ac495dSmrg 
70036ac495dSmrg /* The cost of a branch insn.  */
70136ac495dSmrg /* A value of 2 here causes GCC to avoid using branches in comparisons like
70236ac495dSmrg    while (a < N && a).  Branches aren't that expensive on the M32R so
70336ac495dSmrg    we define this as 1.  Defining it as 2 had a heavy hit in fp-bit.c.  */
70436ac495dSmrg #define BRANCH_COST(speed_p, predictable_p) ((TARGET_BRANCH_COST) ? 2 : 1)
70536ac495dSmrg 
70636ac495dSmrg /* Nonzero if access to memory by bytes is slow and undesirable.
70736ac495dSmrg    For RISC chips, it means that access to memory by bytes is no
70836ac495dSmrg    better than access by words when possible, so grab a whole word
70936ac495dSmrg    and maybe make use of that.  */
71036ac495dSmrg #define SLOW_BYTE_ACCESS 1
71136ac495dSmrg 
71236ac495dSmrg /* Define this macro if it is as good or better to call a constant
71336ac495dSmrg    function address than to call an address kept in a register.  */
71436ac495dSmrg #define NO_FUNCTION_CSE 1
71536ac495dSmrg 
71636ac495dSmrg /* Section selection.  */
71736ac495dSmrg 
71836ac495dSmrg #define TEXT_SECTION_ASM_OP	"\t.section .text"
71936ac495dSmrg #define DATA_SECTION_ASM_OP	"\t.section .data"
72036ac495dSmrg #define BSS_SECTION_ASM_OP	"\t.section .bss"
72136ac495dSmrg 
72236ac495dSmrg /* Define this macro if jump tables (for tablejump insns) should be
72336ac495dSmrg    output in the text section, along with the assembler instructions.
72436ac495dSmrg    Otherwise, the readonly data section is used.
72536ac495dSmrg    This macro is irrelevant if there is no separate readonly data section.  */
72636ac495dSmrg #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
72736ac495dSmrg 
72836ac495dSmrg /* Position Independent Code.  */
72936ac495dSmrg 
73036ac495dSmrg /* The register number of the register used to address a table of static
73136ac495dSmrg    data addresses in memory.  In some cases this register is defined by a
73236ac495dSmrg    processor's ``application binary interface'' (ABI).  When this macro
73336ac495dSmrg    is defined, RTL is generated for this register once, as with the stack
73436ac495dSmrg    pointer and frame pointer registers.  If this macro is not defined, it
73536ac495dSmrg    is up to the machine-dependent files to allocate such a register (if
73636ac495dSmrg    necessary).  */
73736ac495dSmrg #define PIC_OFFSET_TABLE_REGNUM 12
73836ac495dSmrg 
73936ac495dSmrg /* Define this macro if the register defined by PIC_OFFSET_TABLE_REGNUM is
74036ac495dSmrg    clobbered by calls.  Do not define this macro if PIC_OFFSET_TABLE_REGNUM
74136ac495dSmrg    is not defined.  */
74236ac495dSmrg /* This register is call-saved on the M32R.  */
74336ac495dSmrg /*#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED*/
74436ac495dSmrg 
74536ac495dSmrg /* A C expression that is nonzero if X is a legitimate immediate
74636ac495dSmrg    operand on the target machine when generating position independent code.
74736ac495dSmrg    You can assume that X satisfies CONSTANT_P, so you need not
74836ac495dSmrg    check this.  You can also assume `flag_pic' is true, so you need not
74936ac495dSmrg    check it either.  You need not define this macro if all constants
75036ac495dSmrg    (including SYMBOL_REF) can be immediate operands when generating
75136ac495dSmrg    position independent code.  */
75236ac495dSmrg #define LEGITIMATE_PIC_OPERAND_P(X) m32r_legitimate_pic_operand_p (X)
75336ac495dSmrg 
75436ac495dSmrg /* Control the assembler format that we output.  */
75536ac495dSmrg 
75636ac495dSmrg /* A C string constant describing how to begin a comment in the target
75736ac495dSmrg    assembler language.  The compiler assumes that the comment will
75836ac495dSmrg    end at the end of the line.  */
75936ac495dSmrg #define ASM_COMMENT_START ";"
76036ac495dSmrg 
76136ac495dSmrg /* Output to assembler file text saying following lines
76236ac495dSmrg    may contain character constants, extra white space, comments, etc.  */
76336ac495dSmrg #define ASM_APP_ON ""
76436ac495dSmrg 
76536ac495dSmrg /* Output to assembler file text saying following lines
76636ac495dSmrg    no longer contain unusual constructs.  */
76736ac495dSmrg #define ASM_APP_OFF ""
76836ac495dSmrg 
76936ac495dSmrg /* Globalizing directive for a label.  */
77036ac495dSmrg #define GLOBAL_ASM_OP "\t.global\t"
77136ac495dSmrg 
77236ac495dSmrg /* We do not use DBX_LINES_FUNCTION_RELATIVE or
77336ac495dSmrg    dbxout_stab_value_internal_label_diff here because
77436ac495dSmrg    we need to use .debugsym for the line label.  */
77536ac495dSmrg 
77636ac495dSmrg #define DBX_OUTPUT_SOURCE_LINE(file, line, counter)			\
77736ac495dSmrg   do									\
77836ac495dSmrg     {									\
77936ac495dSmrg       const char * begin_label =					\
78036ac495dSmrg 	XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);		\
78136ac495dSmrg       char label[64];							\
78236ac495dSmrg       ASM_GENERATE_INTERNAL_LABEL (label, "LM", counter);		\
78336ac495dSmrg 									\
78436ac495dSmrg       dbxout_begin_stabn_sline (line);					\
78536ac495dSmrg       assemble_name (file, label);					\
78636ac495dSmrg       putc ('-', file);							\
78736ac495dSmrg       assemble_name (file, begin_label);				\
78836ac495dSmrg       fputs ("\n\t.debugsym ", file);					\
78936ac495dSmrg       assemble_name (file, label);					\
79036ac495dSmrg       putc ('\n', file);						\
79136ac495dSmrg       counter += 1;							\
79236ac495dSmrg      }									\
79336ac495dSmrg   while (0)
79436ac495dSmrg 
79536ac495dSmrg /* How to refer to registers in assembler output.
79636ac495dSmrg    This sequence is indexed by compiler's hard-register-number (see above).  */
79736ac495dSmrg #ifndef SUBTARGET_REGISTER_NAMES
79836ac495dSmrg #define SUBTARGET_REGISTER_NAMES
79936ac495dSmrg #endif
80036ac495dSmrg 
80136ac495dSmrg #define REGISTER_NAMES					\
80236ac495dSmrg {							\
80336ac495dSmrg   "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",	\
80436ac495dSmrg   "r8", "r9", "r10", "r11", "r12", "fp", "lr", "sp",	\
80536ac495dSmrg   "ap", "cbit", "a0"					\
80636ac495dSmrg   SUBTARGET_REGISTER_NAMES				\
80736ac495dSmrg }
80836ac495dSmrg 
80936ac495dSmrg /* If defined, a C initializer for an array of structures containing
81036ac495dSmrg    a name and a register number.  This macro defines additional names
81136ac495dSmrg    for hard registers, thus allowing the `asm' option in declarations
81236ac495dSmrg    to refer to registers using alternate names.  */
81336ac495dSmrg #ifndef SUBTARGET_ADDITIONAL_REGISTER_NAMES
81436ac495dSmrg #define SUBTARGET_ADDITIONAL_REGISTER_NAMES
81536ac495dSmrg #endif
81636ac495dSmrg 
81736ac495dSmrg #define ADDITIONAL_REGISTER_NAMES	\
81836ac495dSmrg {					\
81936ac495dSmrg   /*{ "gp", GP_REGNUM },*/		\
82036ac495dSmrg   { "r13", FRAME_POINTER_REGNUM },	\
82136ac495dSmrg   { "r14", RETURN_ADDR_REGNUM },	\
82236ac495dSmrg   { "r15", STACK_POINTER_REGNUM },	\
82336ac495dSmrg   SUBTARGET_ADDITIONAL_REGISTER_NAMES	\
82436ac495dSmrg }
82536ac495dSmrg 
82636ac495dSmrg /* If defined, C string expressions to be used for the `%R', `%L',
82736ac495dSmrg    `%U', and `%I' options of `asm_fprintf' (see `final.c').  These
82836ac495dSmrg    are useful when a single `md' file must support multiple assembler
82936ac495dSmrg    formats.  In that case, the various `tm.h' files can define these
83036ac495dSmrg    macros differently.  */
83136ac495dSmrg #define REGISTER_PREFIX		""
83236ac495dSmrg #define LOCAL_LABEL_PREFIX	".L"
83336ac495dSmrg #define USER_LABEL_PREFIX	""
83436ac495dSmrg #define IMMEDIATE_PREFIX	"#"
83536ac495dSmrg 
83636ac495dSmrg /* This is how to output an element of a case-vector that is absolute.  */
83736ac495dSmrg #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)		\
83836ac495dSmrg    do							\
83936ac495dSmrg      {							\
84036ac495dSmrg        char label[30];					\
84136ac495dSmrg        ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE);	\
84236ac495dSmrg        fprintf (FILE, "\t.word\t");			\
84336ac495dSmrg        assemble_name (FILE, label);			\
84436ac495dSmrg        fprintf (FILE, "\n");				\
84536ac495dSmrg      }							\
84636ac495dSmrg   while (0)
84736ac495dSmrg 
84836ac495dSmrg /* This is how to output an element of a case-vector that is relative.  */
84936ac495dSmrg #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL)\
85036ac495dSmrg   do							\
85136ac495dSmrg     {							\
85236ac495dSmrg       char label[30];					\
85336ac495dSmrg       ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE);	\
85436ac495dSmrg       fprintf (FILE, "\t.word\t");			\
85536ac495dSmrg       assemble_name (FILE, label);			\
85636ac495dSmrg       fprintf (FILE, "-");				\
85736ac495dSmrg       ASM_GENERATE_INTERNAL_LABEL (label, "L", REL);	\
85836ac495dSmrg       assemble_name (FILE, label);			\
85936ac495dSmrg       fprintf (FILE, "\n");				\
86036ac495dSmrg     }							\
86136ac495dSmrg   while (0)
86236ac495dSmrg 
86336ac495dSmrg /* The desired alignment for the location counter at the beginning
86436ac495dSmrg    of a loop.  */
86536ac495dSmrg /* On the M32R, align loops to 32 byte boundaries (cache line size)
86636ac495dSmrg    if -malign-loops.  */
867c0a68be4Smrg #define LOOP_ALIGN(LABEL) ((TARGET_ALIGN_LOOPS \
868c0a68be4Smrg 			    ? align_flags (5) : align_flags ()))
86936ac495dSmrg 
87036ac495dSmrg /* Define this to be the maximum number of insns to move around when moving
87136ac495dSmrg    a loop test from the top of a loop to the bottom
87236ac495dSmrg    and seeing whether to duplicate it.  The default is thirty.
87336ac495dSmrg 
87436ac495dSmrg    Loop unrolling currently doesn't like this optimization, so
87536ac495dSmrg    disable doing if we are unrolling loops and saving space.  */
87636ac495dSmrg #define LOOP_TEST_THRESHOLD (optimize_size				\
87736ac495dSmrg 			     && !flag_unroll_loops			\
87836ac495dSmrg 			     && !flag_unroll_all_loops ? 2 : 30)
87936ac495dSmrg 
88036ac495dSmrg /* This is how to output an assembler line
88136ac495dSmrg    that says to advance the location counter
88236ac495dSmrg    to a multiple of 2**LOG bytes.  */
88336ac495dSmrg /* .balign is used to avoid confusion.  */
88436ac495dSmrg #define ASM_OUTPUT_ALIGN(FILE,LOG)			\
88536ac495dSmrg   do							\
88636ac495dSmrg     {							\
88736ac495dSmrg       if ((LOG) != 0)					\
88836ac495dSmrg 	fprintf (FILE, "\t.balign %d\n", 1 << (LOG));	\
88936ac495dSmrg     }							\
89036ac495dSmrg   while (0)
89136ac495dSmrg 
89236ac495dSmrg /* Like `ASM_OUTPUT_COMMON' except takes the required alignment as a
89336ac495dSmrg    separate, explicit argument.  If you define this macro, it is used in
89436ac495dSmrg    place of `ASM_OUTPUT_COMMON', and gives you more flexibility in
89536ac495dSmrg    handling the required alignment of the variable.  The alignment is
89636ac495dSmrg    specified as the number of bits.  */
89736ac495dSmrg 
89836ac495dSmrg #define SCOMMON_ASM_OP "\t.scomm\t"
89936ac495dSmrg 
90036ac495dSmrg #undef  ASM_OUTPUT_ALIGNED_COMMON
90136ac495dSmrg #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
90236ac495dSmrg   do									\
90336ac495dSmrg     {									\
90436ac495dSmrg       if (! TARGET_SDATA_NONE						\
90536ac495dSmrg 	  && (SIZE) > 0							\
90636ac495dSmrg 	  && (SIZE) <= (unsigned HOST_WIDE_INT) g_switch_value)		\
90736ac495dSmrg 	fprintf ((FILE), "%s", SCOMMON_ASM_OP);				\
90836ac495dSmrg       else								\
90936ac495dSmrg 	fprintf ((FILE), "%s", COMMON_ASM_OP);				\
91036ac495dSmrg       assemble_name ((FILE), (NAME));					\
91136ac495dSmrg       fprintf ((FILE), ",%u,%u\n", (int)(SIZE), (ALIGN) / BITS_PER_UNIT);\
91236ac495dSmrg     }									\
91336ac495dSmrg   while (0)
91436ac495dSmrg 
91536ac495dSmrg #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)		\
91636ac495dSmrg   do									\
91736ac495dSmrg     {									\
91836ac495dSmrg       if (! TARGET_SDATA_NONE						\
91936ac495dSmrg           && (SIZE) > 0							\
92036ac495dSmrg 	  && (SIZE) <= (unsigned HOST_WIDE_INT) g_switch_value)		\
92136ac495dSmrg         switch_to_section (get_named_section (NULL, ".sbss", 0));	\
92236ac495dSmrg       else								\
92336ac495dSmrg         switch_to_section (bss_section);				\
92436ac495dSmrg       ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT));	\
92536ac495dSmrg       last_assemble_variable_decl = DECL;				\
92636ac495dSmrg       ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL);			\
92736ac495dSmrg       ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1);				\
92836ac495dSmrg     }									\
92936ac495dSmrg   while (0)
93036ac495dSmrg 
93136ac495dSmrg /* Debugging information.  */
93236ac495dSmrg 
93336ac495dSmrg /* Generate DBX and DWARF debugging information.  */
93436ac495dSmrg #define DBX_DEBUGGING_INFO    1
93536ac495dSmrg #define DWARF2_DEBUGGING_INFO 1
93636ac495dSmrg 
93736ac495dSmrg /* Use DWARF2 debugging info by default.  */
93836ac495dSmrg #undef  PREFERRED_DEBUGGING_TYPE
93936ac495dSmrg #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
94036ac495dSmrg 
94136ac495dSmrg /* Turn off splitting of long stabs.  */
94236ac495dSmrg #define DBX_CONTIN_LENGTH 0
94336ac495dSmrg 
94436ac495dSmrg /* Miscellaneous.  */
94536ac495dSmrg 
94636ac495dSmrg /* Specify the machine mode that this machine uses
94736ac495dSmrg    for the index in the tablejump instruction.  */
94836ac495dSmrg #define CASE_VECTOR_MODE (flag_pic ? SImode : Pmode)
94936ac495dSmrg 
95036ac495dSmrg /* Define if operations between registers always perform the operation
95136ac495dSmrg    on the full register even if a narrower mode is specified.  */
95236ac495dSmrg #define WORD_REGISTER_OPERATIONS 1
95336ac495dSmrg 
95436ac495dSmrg /* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
95536ac495dSmrg    will either zero-extend or sign-extend.  The value of this macro should
95636ac495dSmrg    be the code that says which one of the two operations is implicitly
95736ac495dSmrg    done, UNKNOWN if none.  */
95836ac495dSmrg #define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
95936ac495dSmrg 
96036ac495dSmrg /* Max number of bytes we can move from memory
96136ac495dSmrg    to memory in one reasonably fast instruction.  */
96236ac495dSmrg #define MOVE_MAX 4
96336ac495dSmrg 
96436ac495dSmrg /* Define this to be nonzero if shift instructions ignore all but the low-order
96536ac495dSmrg    few bits.  */
96636ac495dSmrg #define SHIFT_COUNT_TRUNCATED 1
96736ac495dSmrg 
96836ac495dSmrg /* Specify the machine mode that pointers have.
96936ac495dSmrg    After generation of rtl, the compiler makes no further distinction
97036ac495dSmrg    between pointers and any other objects of this machine mode.  */
97136ac495dSmrg /* ??? The M32R doesn't have full 32-bit pointers, but making this PSImode has
97236ac495dSmrg    its own problems (you have to add extendpsisi2 and truncsipsi2).
97336ac495dSmrg    Try to avoid it.  */
97436ac495dSmrg #define Pmode SImode
97536ac495dSmrg 
97636ac495dSmrg /* A function address in a call instruction.  */
97736ac495dSmrg #define FUNCTION_MODE SImode
97836ac495dSmrg 
97936ac495dSmrg /* M32R function types.  */
98036ac495dSmrg enum m32r_function_type
98136ac495dSmrg {
98236ac495dSmrg   M32R_FUNCTION_UNKNOWN, M32R_FUNCTION_NORMAL, M32R_FUNCTION_INTERRUPT
98336ac495dSmrg };
98436ac495dSmrg 
98536ac495dSmrg #define M32R_INTERRUPT_P(TYPE) ((TYPE) == M32R_FUNCTION_INTERRUPT)
98636ac495dSmrg 
98736ac495dSmrg /* The maximum number of bytes to copy using pairs of load/store instructions.
98836ac495dSmrg    If a block is larger than this then a loop will be generated to copy
98936ac495dSmrg    MAX_MOVE_BYTES chunks at a time.  The value of 32 is a semi-arbitrary choice.
99036ac495dSmrg    A customer uses Dhrystome as their benchmark, and Dhrystone has a 31 byte
99136ac495dSmrg    string copy in it.  */
99236ac495dSmrg #define MAX_MOVE_BYTES 32
993