📄 sh.h
字号:
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. *//* There are many other relevant definitions in sh.md's md_constants. */#define FIRST_GENERAL_REG R0_REG#define LAST_GENERAL_REG (FIRST_GENERAL_REG + (TARGET_SHMEDIA ? 63 : 15))#define FIRST_FP_REG DR0_REG#define LAST_FP_REG (FIRST_FP_REG + \ (TARGET_SHMEDIA_FPU ? 63 : TARGET_SH3E ? 15 : -1))#define FIRST_XD_REG XD0_REG#define LAST_XD_REG (FIRST_XD_REG + ((TARGET_SH4 && TARGET_FMOVD) ? 7 : -1))#define FIRST_TARGET_REG TR0_REG#define LAST_TARGET_REG (FIRST_TARGET_REG + (TARGET_SHMEDIA ? 7 : -1))#define GENERAL_REGISTER_P(REGNO) \ IN_RANGE ((REGNO), FIRST_GENERAL_REG, LAST_GENERAL_REG)#define GENERAL_OR_AP_REGISTER_P(REGNO) \ (GENERAL_REGISTER_P (REGNO) || ((REGNO) == AP_REG))#define FP_REGISTER_P(REGNO) \ ((REGNO) >= FIRST_FP_REG && (REGNO) <= LAST_FP_REG)#define XD_REGISTER_P(REGNO) \ ((REGNO) >= FIRST_XD_REG && (REGNO) <= LAST_XD_REG)#define FP_OR_XD_REGISTER_P(REGNO) \ (FP_REGISTER_P (REGNO) || XD_REGISTER_P (REGNO))#define FP_ANY_REGISTER_P(REGNO) \ (FP_REGISTER_P (REGNO) || XD_REGISTER_P (REGNO) || (REGNO) == FPUL_REG)#define SPECIAL_REGISTER_P(REGNO) \ ((REGNO) == GBR_REG || (REGNO) == T_REG \ || (REGNO) == MACH_REG || (REGNO) == MACL_REG)#define TARGET_REGISTER_P(REGNO) \ ((REGNO) >= FIRST_TARGET_REG && (REGNO) <= LAST_TARGET_REG)#define SHMEDIA_REGISTER_P(REGNO) \ (GENERAL_REGISTER_P (REGNO) || FP_REGISTER_P (REGNO) \ || TARGET_REGISTER_P (REGNO))/* This is to be used in CONDITIONAL_REGISTER_USAGE, to mark registers that should be fixed. */#define VALID_REGISTER_P(REGNO) \ (SHMEDIA_REGISTER_P (REGNO) || XD_REGISTER_P (REGNO) \ || (REGNO) == AP_REG || (REGNO) == RAP_REG \ || (TARGET_SH1 && (SPECIAL_REGISTER_P (REGNO) || (REGNO) == PR_REG)) \ || (TARGET_SH3E && (REGNO) == FPUL_REG))/* The mode that should be generally used to store a register by itself in the stack, or to load it back. */#define REGISTER_NATURAL_MODE(REGNO) \ (FP_REGISTER_P (REGNO) ? SFmode \ : XD_REGISTER_P (REGNO) ? DFmode \ : TARGET_SHMEDIA && ! HARD_REGNO_CALL_PART_CLOBBERED ((REGNO), DImode) \ ? DImode \ : SImode)#define FIRST_PSEUDO_REGISTER 153/* 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 \{ \/* Regular registers. */ \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 1, \ /* r16 is reserved, r18 is the former pr. */ \ 1, 0, 0, 0, 0, 0, 0, 0, \ /* r24 is reserved for the OS; r25, for the assembler or linker. */ \ /* r26 is a global variable data pointer; r27 is for constants. */ \ 1, 1, 1, 1, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 1, \/* FP registers. */ \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \/* Branch target registers. */ \ 0, 0, 0, 0, 0, 0, 0, 0, \/* XD registers. */ \ 0, 0, 0, 0, 0, 0, 0, 0, \/*"gbr", "ap", "pr", "t", "mach", "macl", "fpul", "fpscr", */ \ 1, 1, 1, 1, 1, 1, 0, 1, \/*"rap" */ \ 1, \}/* 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 \{ \/* Regular registers. */ \ 1, 1, 1, 1, 1, 1, 1, 1, \ /* R8 and R9 are call-clobbered on SH5, but not on earlier SH ABIs. \ Only the lower 32bits of R10-R14 are guaranteed to be preserved \ across SH5 function calls. */ \ 0, 0, 0, 0, 0, 0, 0, 1, \ 1, 1, 0, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 0, 0, 0, 0, \ 0, 0, 0, 0, 1, 1, 1, 1, \ 1, 1, 1, 1, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 1, 1, 1, 1, \/* FP registers. */ \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 0, 0, 0, 0, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \/* Branch target registers. */ \ 1, 1, 1, 1, 1, 0, 0, 0, \/* XD registers. */ \ 1, 1, 1, 1, 1, 1, 0, 0, \/*"gbr", "ap", "pr", "t", "mach", "macl", "fpul", "fpscr", */ \ 1, 1, 0, 1, 1, 1, 1, 1, \/*"rap" */ \ 1, \}/* Only the lower 32-bits of R10-R14 are guaranteed to be preserved across SHcompact function calls. We can't tell whether a called function is SHmedia or SHcompact, so we assume it may be when compiling SHmedia code with the 32-bit ABI, since that's the only ABI that can be linked with SHcompact code. */#define HARD_REGNO_CALL_PART_CLOBBERED(REGNO,MODE) \ (TARGET_SHMEDIA32 \ && GET_MODE_SIZE (MODE) > 4 \ && (((REGNO) >= FIRST_GENERAL_REG + 10 \ && (REGNO) <= FIRST_GENERAL_REG + 14) \ || (REGNO) == PR_MEDIA_REG))/* 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 all but the XD regs are UNITS_PER_WORD bits wide. */#define HARD_REGNO_NREGS(REGNO, MODE) \ (XD_REGISTER_P (REGNO) \ ? (GET_MODE_SIZE (MODE) / (2 * UNITS_PER_WORD)) \ : (TARGET_SHMEDIA && FP_REGISTER_P (REGNO)) \ ? ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD/2 - 1) / (UNITS_PER_WORD/2)) \ : ((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. *//* We cannot hold DCmode values in the XD registers because alter_reg handles subregs of them incorrectly. We could work around this by spacing the XD registers like the DR registers, but this would require additional memory in every compilation to hold larger register vectors. We could hold SFmode / SCmode values in XD registers, but that would require a tertiary reload when reloading from / to memory, and a secondary reload to reload from / to general regs; that seems to be a loosing proposition. */#define HARD_REGNO_MODE_OK(REGNO, MODE) \ (SPECIAL_REGISTER_P (REGNO) ? (MODE) == SImode \ : (REGNO) == FPUL_REG ? (MODE) == SImode || (MODE) == SFmode \ : FP_REGISTER_P (REGNO) && (MODE) == SFmode \ ? 1 \ : (MODE) == V2SFmode \ ? (FP_REGISTER_P (REGNO) && ((REGNO) - FIRST_FP_REG) % 2 == 0) \ : (MODE) == V4SFmode \ ? (FP_REGISTER_P (REGNO) && ((REGNO) - FIRST_FP_REG) % 4 == 0) \ : (MODE) == V16SFmode \ ? (TARGET_SHMEDIA \ ? (FP_REGISTER_P (REGNO) && ((REGNO) - FIRST_FP_REG) % 16 == 0) \ : (REGNO) == FIRST_XD_REG) \ : FP_REGISTER_P (REGNO) \ ? ((MODE) == SFmode \ || (TARGET_SHMEDIA && (MODE) == SImode) \ || ((TARGET_SH3E || TARGET_SHMEDIA) && (MODE) == SCmode) \ || (((TARGET_SH4 && (MODE) == DFmode) || (MODE) == DCmode \ || (TARGET_SHMEDIA && ((MODE) == DFmode || (MODE) == DImode \ || (MODE) == V2SFmode))) \ && (((REGNO) - FIRST_FP_REG) & 1) == 0)) \ : XD_REGISTER_P (REGNO) \ ? (MODE) == DFmode \ : TARGET_REGISTER_P (REGNO) \ ? ((MODE) == DImode || (MODE) == SImode) \ : (REGNO) == PR_REG ? 0 \ : (REGNO) == FPSCR_REG ? (MODE) == PSImode \ : 1)/* Value is 1 if MODE is a supported vector mode. */#define VECTOR_MODE_SUPPORTED_P(MODE) \ (TARGET_FPU_ANY \ && ((MODE) == V2SFmode || (MODE) == V4SFmode || (MODE) == V16SFmode))/* Value is 1 if it is a good idea to tie two pseudo registers when one has mode MODE1 and one has mode MODE2. If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, for any hard reg, then this must be 0 for correct output. That's the case for xd registers: we don't hold SFmode values in them, so we can't tie an SFmode pseudos with one in another floating-point mode. */#define MODES_TIEABLE_P(MODE1, MODE2) \ ((MODE1) == (MODE2) \ || (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2) \ && (TARGET_SHMEDIA ? ((GET_MODE_SIZE (MODE1) <= 4) \ && (GET_MODE_SIZE (MODE2) <= 4)) \ : ((MODE1) != SFmode && (MODE2) != SFmode))))/* Specify the registers used for certain standard purposes. The values of these macros are register numbers. *//* Define this if the program counter is overloaded on a register. *//* #define PC_REGNUM 15*//* Register to use for pushing function arguments. */#define STACK_POINTER_REGNUM SP_REG/* Base register for access to local variables of the function. */#define FRAME_POINTER_REGNUM FP_REG/* Fake register that holds the address on the stack of the current function's return address. */#define RETURN_ADDRESS_POINTER_REGNUM RAP_REG/* Register to hold the addressing base for position independent code access to data items. */#define PIC_OFFSET_TABLE_REGNUM PIC_REG#define GOT_SYMBOL_NAME "*_GLOBAL_OFFSET_TABLE_"/* Value should be nonzero if functions must have frame pointers. Zero means the frame pointer need not be set up (and parms may be accessed via the stack pointer) in functions that seem suitable. */#define FRAME_POINTER_REQUIRED 0/* Definitions for register eliminations. We have three registers that can be eliminated on the SH. First, the frame pointer register can often be eliminated in favor of the stack pointer register. Secondly, the argument pointer register can always be eliminated; it is replaced with either the stack or frame pointer. Third, there is the return address pointer, which can also be replaced with either the stack or the frame pointer. *//* This is an array of structures. Each structure initializes one pair of eliminable registers. The "from" register number is given first, followed by "to". Eliminations of the same "from" register are listed in order of preference. *//* If you add any registers here that are not actually hard registers, and that have any alternative of elimination that doesn't always apply, you need to amend calc_live_regs to exclude it, because reload spills all eliminable registers where it sees an can_eliminate == 0 entry, thus making them 'live' . If you add any hard registers that can be eliminated in different ways, you have to patch reload to spill them only when all alternatives of elimination fail. */#define ELIMINABLE_REGS \{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { RETURN_ADDRESS_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { RETURN_ADDRESS_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM},}/* Given FROM and TO register numbers, say whether this elimination is allowed. */#define CAN_ELIMINATE(FROM, TO) \ (!((FROM) == FRAME_POINTER_REGNUM && FRAME_POINTER_REQUIRED))/* Define the offset between two registers, one to be eliminated, and the other its replacement, at the start of a routine. */#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ OFFSET = initial_elimination_offset ((FROM), (TO))/* Base register for access to arguments of the function. */#define ARG_POINTER_REGNUM AP_REG/* Register in which the static-chain is passed to a function. */#define STATIC_CHAIN_REGNUM (TARGET_SH5 ? 1 : 3)/* The register in which a struct value address is passed. */#define STRUCT_VALUE_REGNUM 2/* If the structure value address is not passed in a register, define `STRUCT_VALUE' as an expression returning an RTX for the place where the address is passed. If it returns 0, the address is passed as an "invisible" first argument. *//* The Hitachi calling convention doesn't quite fit into this scheme since the address is passed like an invisible argument, but one that is always passed in memory. */#define STRUCT_VALUE \ (TARGET_HITACHI ? 0 : gen_rtx_REG (Pmode, STRUCT_VALUE_REGNUM))#define RETURN_IN_MEMORY(TYPE) \ (TARGET_SH5 \ ? ((TYPE_MODE (TYPE) == BLKmode \ ? int_size_in_bytes (TYPE) \ : GET_MODE_SIZE (TYPE_MODE (TYPE))) > 8) \ : (TYPE_MODE (TYPE) == BLKmode \ || TARGET_HITACHI && TREE_CODE (TYPE) == RECORD_TYPE))/* Don't default to pcc-struct-return, because we have already specified exactly how to return structures in the RETURN_IN_MEMORY macro. */#define DEFAULT_PCC_STRUCT_RETURN 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -