📄 sh.h
字号:
/* Definitions of target machine for GNU compiler for Hitachi Super-H. Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Contributed by Steve Chamberlain (sac@cygnus.com). Improved by Jim Wilson (wilson@cygnus.com).This file is part of GNU CC.GNU CC is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU CC is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU CC; see the file COPYING. If not, write tothe Free Software Foundation, 59 Temple Place - Suite 330,Boston, MA 02111-1307, USA. */#define TARGET_VERSION \ fputs (" (Hitachi SH)", stderr);/* Unfortunately, insn-attrtab.c doesn't include insn-codes.h. We can't include it here, because hconfig.h is also included by gencodes.c . */extern int code_for_indirect_jump_scratch;/* Generate SDB debugging information. */#define SDB_DEBUGGING_INFO/* Output DBX (stabs) debugging information if doing -gstabs. */#include "dbxcoff.h"#define SDB_DELIM ";"#define CPP_SPEC "%{ml:-D__LITTLE_ENDIAN__} \%{m1:-D__sh1__} \%{m2:-D__sh2__} \%{m3:-D__sh3__} \%{m3e:-D__SH3E__} \%{!m1:%{!m2:%{!m3:%{!m3e:-D__sh1__}}}}"#define CPP_PREDEFINES "-D__sh__ -Acpu(sh) -Amachine(sh)"#define ASM_SPEC "%{ml:-little} %{mrelax:-relax}"#define LINK_SPEC "%{ml:-m shl} %{mrelax:-relax}"/* We can not debug without a frame pointer. *//* #define CAN_DEBUG_WITHOUT_FP */#define CONDITIONAL_REGISTER_USAGE \ if (! TARGET_SH3E) \ { \ int regno; \ for (regno = FIRST_FP_REG; regno <= LAST_FP_REG; regno++) \ fixed_regs[regno] = call_used_regs[regno] = 1; \ fixed_regs[FPUL_REG] = call_used_regs[FPUL_REG] = 1; \ } \ /* Hitachi saves and restores mac registers on call. */ \ if (TARGET_HITACHI) \ { \ call_used_regs[MACH_REG] = 0; \ call_used_regs[MACL_REG] = 0; \ }/* ??? Need to write documentation for all SH options and add it to the invoke.texi file. *//* Run-time compilation parameters selecting different hardware subsets. */extern int target_flags;#define ISIZE_BIT (1<<1)#define DALIGN_BIT (1<<6)#define SH1_BIT (1<<8)#define SH2_BIT (1<<9)#define SH3_BIT (1<<10)#define SH3E_BIT (1<<11)#define SPACE_BIT (1<<13)#define BIGTABLE_BIT (1<<14)#define RELAX_BIT (1<<15)#define HITACHI_BIT (1<<22)#define PADSTRUCT_BIT (1<<28)#define LITTLE_ENDIAN_BIT (1<<29)#define IEEE_BIT (1<<30)/* Nonzero if we should dump out instruction size info. */#define TARGET_DUMPISIZE (target_flags & ISIZE_BIT)/* Nonzero to align doubles on 64 bit boundaries. */#define TARGET_ALIGN_DOUBLE (target_flags & DALIGN_BIT)/* Nonzero if we should generate code using type 1 insns. */#define TARGET_SH1 (target_flags & SH1_BIT)/* Nonzero if we should generate code using type 2 insns. */#define TARGET_SH2 (target_flags & SH2_BIT)/* Nonzero if we should generate code using type 3 insns. */#define TARGET_SH3 (target_flags & SH3_BIT)/* Nonzero if we should generate code using type 3E insns. */#define TARGET_SH3E (target_flags & SH3E_BIT)/* Nonzero if we respect NANs. */#define TARGET_IEEE (target_flags & IEEE_BIT)/* Nonzero if we should generate smaller code rather than faster code. */#define TARGET_SMALLCODE (target_flags & SPACE_BIT)/* Nonzero to use long jump tables. */#define TARGET_BIGTABLE (target_flags & BIGTABLE_BIT)/* Nonzero to generate pseudo-ops needed by the assembler and linker to do function call relaxing. */#define TARGET_RELAX (target_flags & RELAX_BIT)/* Nonzero if using Hitachi's calling convention. */#define TARGET_HITACHI (target_flags & HITACHI_BIT)/* Nonzero if padding structures to a multiple of 4 bytes. This is incompatible with Hitachi's compiler, and gives unusual structure layouts which confuse programmers. ??? This option is not useful, but is retained in case there are people who are still relying on it. It may be deleted in the future. */#define TARGET_PADSTRUCT (target_flags & PADSTRUCT_BIT)/* Nonzero if generating code for a little endian SH. */#define TARGET_LITTLE_ENDIAN (target_flags & LITTLE_ENDIAN_BIT)#define TARGET_SWITCHES \{ {"1", SH1_BIT}, \ {"2", SH2_BIT}, \ {"3", SH3_BIT|SH2_BIT}, \ {"3e", SH3E_BIT|SH3_BIT|SH2_BIT}, \ {"b", -LITTLE_ENDIAN_BIT}, \ {"bigtable", BIGTABLE_BIT}, \ {"dalign", DALIGN_BIT}, \ {"hitachi", HITACHI_BIT}, \ {"ieee", IEEE_BIT}, \ {"isize", ISIZE_BIT}, \ {"l", LITTLE_ENDIAN_BIT}, \ {"no-ieee", -IEEE_BIT}, \ {"padstruct", PADSTRUCT_BIT}, \ {"relax", RELAX_BIT}, \ {"space", SPACE_BIT}, \ SUBTARGET_SWITCHES \ {"", TARGET_DEFAULT} \}/* This are meant to be redefined in the host dependent files */#define SUBTARGET_SWITCHES#define TARGET_DEFAULT (0)#define PRESERVE_DEATH_INFO_REGNO_P(regno) (TARGET_RELAX || optimize)#define ASSEMBLER_DIALECT 0 /* will allow to distinguish b[tf].s and b[tf]/s . */#define OVERRIDE_OPTIONS \do { \ sh_cpu = CPU_SH1; \ if (TARGET_SH2) \ sh_cpu = CPU_SH2; \ if (TARGET_SH3) \ sh_cpu = CPU_SH3; \ if (TARGET_SH3E) \ sh_cpu = CPU_SH3E; \ \ /* Never run scheduling before reload, since that can \ break global alloc, and generates slower code anyway due \ to the pressure on R0. */ \ flag_schedule_insns = 0; \ sh_addr_diff_vec_mode = TARGET_BIGTABLE ? SImode : HImode; \} while (0)/* Target machine storage layout. *//* Define to use software floating point emulator for REAL_ARITHMETIC and decimal <-> binary conversion. */#define REAL_ARITHMETIC/* Define this if most significant bit is lowest numbered in instructions that operate on numbered bit-fields. */#define BITS_BIG_ENDIAN 0/* Define this if most significant byte of a word is the lowest numbered. */#define BYTES_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0)/* Define this if most significant word of a multiword number is the lowest numbered. */#define WORDS_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0)/* Define this to set the endianness to use in libgcc2.c, which can not depend on target_flags. */#if defined(__LITTLE_ENDIAN__)#define LIBGCC2_WORDS_BIG_ENDIAN 0#else#define LIBGCC2_WORDS_BIG_ENDIAN 1#endif/* Number of bits in an addressable storage unit. */#define BITS_PER_UNIT 8/* Width in bits of a "word", which is the contents of a machine register. Note that this is not necessarily the width of data type `int'; if using 16-bit ints on a 68000, this would still be 32. But on a machine with 16-bit registers, this would be 16. */#define BITS_PER_WORD 32#define MAX_BITS_PER_WORD 32/* Width of a word, in units (bytes). */#define UNITS_PER_WORD 4/* Width in bits of a pointer. See also the macro `Pmode' defined below. */#define POINTER_SIZE 32/* Allocation boundary (in *bits*) for storing arguments in argument list. */#define PARM_BOUNDARY 32/* Boundary (in *bits*) on which stack pointer should be aligned. */#define STACK_BOUNDARY 32/* The log (base 2) of the cache line size, in bytes. Processors prior to SH3 have no actual cache, but they fetch code in chunks of 4 bytes. */#define CACHE_LOG (TARGET_SH3 ? 4 : 2)/* Allocation boundary (in *bits*) for the code of a function. 32 bit alignment is faster, because instructions are always fetched as a pair from a longword boundary. */#define FUNCTION_BOUNDARY (TARGET_SMALLCODE ? 16 : (1 << CACHE_LOG) * 8)/* Alignment of field after `int : 0' in a structure. */#define EMPTY_FIELD_BOUNDARY 32/* No data type wants to be aligned rounder than this. */#define BIGGEST_ALIGNMENT (TARGET_ALIGN_DOUBLE ? 64 : 32)/* The best alignment to use in cases where we have a choice. */#define FASTEST_ALIGNMENT 32/* Make strings word-aligned so strcpy from constants will be faster. */#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ ((TREE_CODE (EXP) == STRING_CST \ && (ALIGN) < FASTEST_ALIGNMENT) \ ? FASTEST_ALIGNMENT : (ALIGN))/* Make arrays of chars word-aligned for the same reasons. */#define DATA_ALIGNMENT(TYPE, ALIGN) \ (TREE_CODE (TYPE) == ARRAY_TYPE \ && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))/* Number of bits which any structure or union's size must be a multiple of. Each structure or union's size is rounded up to a multiple of this. */#define STRUCTURE_SIZE_BOUNDARY (TARGET_PADSTRUCT ? 32 : 8)/* Set this nonzero if move instructions will actually fail to work when given unaligned data. */#define STRICT_ALIGNMENT 1/* Standard register usage. *//* Register allocation for the Hitachi calling convention: r0 arg return r1..r3 scratch r4..r7 args in r8..r13 call saved r14 frame pointer/call saved r15 stack pointer ap arg pointer (doesn't really exist, always eliminated) pr subroutine return address t t bit mach multiply/accumulate result, high part macl multiply/accumulate result, low part. fpul fp/int communication register rap return address pointer register fr0 fp arg return fr1..fr3 scratch floating point registers fr4..fr11 fp args in fr12..fr15 call saved floating point registers *//* Number of actual hardware registers. The hardware registers are assigned numbers for the compiler from 0 to just below FIRST_PSEUDO_REGISTER. All registers that the compiler knows about must be given numbers, even those that are not normally considered general registers. */#define AP_REG 16#define PR_REG 17#define T_REG 18#define GBR_REG 19#define MACH_REG 20#define MACL_REG 21#define SPECIAL_REG(REGNO) ((REGNO) >= 18 && (REGNO) <= 21)#define FPUL_REG 22#define RAP_REG 23#define FIRST_FP_REG 24#define LAST_FP_REG 39#define FIRST_PSEUDO_REGISTER 40/* 1 for registers that have pervasive standard uses and are not available for the register allocator. Mach register is fixed 'cause it's only 10 bits wide for SH1. It is 32 bits wide for SH2. */#define FIXED_REGISTERS \ { 0, 0, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, 1, \ 1, 1, 1, 1, \ 1, 1, 0, 1, \ 0, 0, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, 0, \}/* 1 for registers not available across function calls. These must include the FIXED_REGISTERS and also any registers that can be used without being saved. The latter must include the registers where values are returned and the register where structure-value addresses are passed. Aside from that, you can include as many other registers as you like. */#define CALL_USED_REGISTERS \ { 1, 1, 1, 1, \ 1, 1, 1, 1, \ 0, 0, 0, 0, \ 0, 0, 0, 1, \ 1, 0, 1, 1, \ 1, 1, 1, 1, \ 1, 1, 1, 1, \ 1, 1, 1, 1, \ 1, 1, 1, 1, \ 0, 0, 0, 0, \}/* Return number of consecutive hard regs needed starting at reg REGNO to hold something of mode MODE. This is ordinarily the length in words of a value of mode MODE but can be less for certain modes in special long registers. On the SH regs are UNITS_PER_WORD bits wide. */#define HARD_REGNO_NREGS(REGNO, MODE) \ (((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. We can allow any mode in any general register. The special registers only allow SImode. Don't allow any mode in the PR. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -