📄 sh.h
字号:
|| (REGNO) == FRAME_POINTER_REGNUM \ || (TARGET_SH1 && (SPECIAL_REGISTER_P (REGNO) || (REGNO) == PR_REG)) \ || (TARGET_SH2E && (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 154/* Don't count soft frame pointer. */#define DWARF_FRAME_REGISTERS (FIRST_PSEUDO_REGISTER - 1)/* 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", "sfp" */ \ 1, 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, 1, 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, 1, 1, 1, 1, 1, 1, \/*"rap", "sfp" */ \ 1, 1, \}/* CONDITIONAL_REGISTER_USAGE might want to make a register call-used, yet fixed, like PIC_OFFSET_TABLE_REGNUM. */#define CALL_REALLY_USED_REGISTERS CALL_USED_REGISTERS/* 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 + 15) \ || TARGET_REGISTER_P (REGNO) \ || (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 - 1)) / (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. *//* We want to allow TImode FP regs so that when V4SFmode is loaded as TImode, it won't be ferried through GP registers first. */#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) \ || GENERAL_REGISTER_P (REGNO)) \ : (MODE) == V4SFmode \ ? ((FP_REGISTER_P (REGNO) && ((REGNO) - FIRST_FP_REG) % 4 == 0) \ || GENERAL_REGISTER_P (REGNO)) \ : (MODE) == V16SFmode \ ? (TARGET_SHMEDIA \ ? (FP_REGISTER_P (REGNO) && ((REGNO) - FIRST_FP_REG) % 16 == 0) \ : (REGNO) == FIRST_XD_REG) \ : FP_REGISTER_P (REGNO) \ ? ((MODE) == SFmode || (MODE) == SImode \ || ((TARGET_SH2E || TARGET_SHMEDIA) && (MODE) == SCmode) \ || ((((TARGET_SH4 || TARGET_SH2A_DOUBLE) && (MODE) == DFmode) || (MODE) == DCmode \ || (TARGET_SHMEDIA && ((MODE) == DFmode || (MODE) == DImode \ || (MODE) == V2SFmode || (MODE) == TImode))) \ && (((REGNO) - FIRST_FP_REG) & 1) == 0) \ || ((TARGET_SH4 || TARGET_SHMEDIA) \ && (MODE) == TImode \ && (((REGNO) - FIRST_FP_REG) & 3) == 0)) \ : XD_REGISTER_P (REGNO) \ ? (MODE) == DFmode \ : TARGET_REGISTER_P (REGNO) \ ? ((MODE) == DImode || (MODE) == SImode || (MODE) == PDImode) \ : (REGNO) == PR_REG ? (MODE) == SImode \ : (REGNO) == FPSCR_REG ? (MODE) == PSImode \ : 1)/* 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) \ || (TARGET_SHMEDIA \ && GET_MODE_SIZE (MODE1) == GET_MODE_SIZE (MODE2) \ && INTEGRAL_MODE_P (MODE1) && INTEGRAL_MODE_P (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))))/* A C expression that is nonzero if hard register NEW_REG can be considered for use as a rename register for OLD_REG register */#define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \ sh_hard_regno_rename_ok (OLD_REG, NEW_REG)/* 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 HARD_FRAME_POINTER_REGNUM FP_REG/* Base register for access to local variables of the function. */#define FRAME_POINTER_REGNUM 153/* 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 (flag_pic ? PIC_REG : INVALID_REGNUM)#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 \{{ HARD_FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ { RETURN_ADDRESS_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { RETURN_ADDRESS_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM},}/* Given FROM and TO register numbers, say whether this elimination is allowed. */#define CAN_ELIMINATE(FROM, TO) \ (!((FROM) == HARD_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)/* Don't default to pcc-struct-return, because we have already specified exactly how to return structures in the TARGET_RETURN_IN_MEMORY target hook. */#define DEFAULT_PCC_STRUCT_RETURN 0#define SHMEDIA_REGS_STACK_ADJUST() \ (TARGET_SHCOMPACT && current_function_has_nonlocal_label \ ? (8 * (/* r28-r35 */ 8 + /* r44-r59 */ 16 + /* tr5-tr7 */ 3) \ + (TARGET_FPU_ANY ? 4 * (/* fr36 - fr63 */ 28) : 0)) \ : 0)/* Define the classes of registers for register constraints in the machine description. Also define ranges of constants. One of the classes must always be named ALL_REGS and include all hard regs. If there is more than one class, another class must be named NO_REGS and contain no registers. The name GENERAL_REGS must be the name of a class (or an alias for another name such as ALL_REGS). This is the class of registers that is allowed by "g" or "r" in a register constraint. Also, registers outside this class are allocated only when instructions express preferences for them. The classes must be numbered in nondecreasing order; that is, a larger-numbered class must never be contained completely in a smaller-numbered class. For any two classes, it is very desirable that there be another class that represents their union. *//* The SH has two sorts of general registers, R0 and the rest. R0 can be used as the destination of some of the arithmetic ops. There are also some special purpose registers; the T bit register, the Procedure Return Register and the Multiply Accumulate Registers. *//* Place GENERAL_REGS after FPUL_REGS so that it will be preferred by reg_class_subunion. We don't want to have an actual union class of these, because it would only be used when both classes are calculated to give the same cost, but there is only one FPUL register. Besides, regclass fails to notice the different REGISTER_MOVE_COSTS applying to the actual instruction alternative considered. E.g., the y/r alternative of movsi_ie is considered to have no more cost that the r/r alternative, which is patently untrue. */enum reg_class{ NO_REGS, R0_REGS, PR_REGS, T_REGS, MAC_REGS, FPUL_REGS, SIBCALL_REGS, GENERAL_REGS, FP0_REGS, FP_REGS, DF_HI_REGS, DF_REGS,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -