📄 sparc.h
字号:
for any hard reg, then this must be 0 for correct output. For V9: SFmode can't be combined with other float modes, because they can't be allocated to the %d registers. Also, DFmode won't fit in odd %f registers, but SFmode will. */#define MODES_TIEABLE_P(MODE1, MODE2) \ ((MODE1) == (MODE2) \ || (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2) \ && (! TARGET_V9 \ || (GET_MODE_CLASS (MODE1) != MODE_FLOAT \ || (MODE1 != SFmode && MODE2 != SFmode)))))/* Specify the registers used for certain standard purposes. The values of these macros are register numbers. *//* SPARC pc isn't overloaded on a register that the compiler knows about. *//* #define PC_REGNUM *//* Register to use for pushing function arguments. */#define STACK_POINTER_REGNUM 14/* Actual top-of-stack address is 92/136 greater than the contents of the stack pointer register for !v9/v9. That is: - !v9: 64 bytes for the in and local registers, 4 bytes for structure return address, and 24 bytes for the 6 register parameters. - v9: 128 bytes for the in and local registers + 8 bytes reserved. */#define STACK_POINTER_OFFSET FIRST_PARM_OFFSET(0)/* The stack bias (amount by which the hardware register is offset by). */#define SPARC_STACK_BIAS (TARGET_STACK_BIAS ? 2047 : 0)/* Base register for access to local variables of the function. */#define FRAME_POINTER_REGNUM 30#if 0/* Register that is used for the return address. */#define RETURN_ADDR_REGNUM 15#endif/* 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. This is computed in `reload', in reload1.c. Used in flow.c, global.c, and reload1.c. Being a non-leaf function does not mean a frame pointer is needed in the flat window model. However, the debugger won't be able to backtrace through us with out it. */#define FRAME_POINTER_REQUIRED \ (TARGET_FRW ? (current_function_calls_alloca || current_function_varargs \ || !leaf_function_p ()) \ : ! (leaf_function_p () && only_leaf_regs_used ()))/* C statement to store the difference between the frame pointer and the stack pointer values immediately after the function prologue. Note, we always pretend that this is a leaf function because if it's not, there's no point in trying to eliminate the frame pointer. If it is a leaf function, we guessed right! */#define INITIAL_FRAME_POINTER_OFFSET(VAR) \ ((VAR) = (TARGET_FRW ? sparc_flat_compute_frame_size (get_frame_size ()) \ : compute_frame_size (get_frame_size (), 1)))/* Base register for access to arguments of the function. */#define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM/* Register in which static-chain is passed to a function. This must not be a register used by the prologue. */#define STATIC_CHAIN_REGNUM (TARGET_V9 ? 5 : 2)/* Register which holds offset table for position-independent data references. */#define PIC_OFFSET_TABLE_REGNUM 23#define INITIALIZE_PIC initialize_pic ()#define FINALIZE_PIC finalize_pic ()/* Sparc ABI says that quad-precision floats and all structures are returned in memory. For v9, all aggregates are returned in memory. */#define RETURN_IN_MEMORY(TYPE) \ (TYPE_MODE (TYPE) == BLKmode \ || (! TARGET_V9 && (TYPE_MODE (TYPE) == TFmode \ || TYPE_MODE (TYPE) == TCmode)))/* Functions which return large structures get the address to place the wanted value at offset 64 from the frame. Must reserve 64 bytes for the in and local registers. v9: Functions which return large structures get the address to place the wanted value from an invisible first argument. *//* Used only in other #defines in this file. */#define STRUCT_VALUE_OFFSET 64#define STRUCT_VALUE \ (TARGET_V9 \ ? 0 \ : gen_rtx (MEM, Pmode, \ gen_rtx (PLUS, Pmode, stack_pointer_rtx, \ gen_rtx (CONST_INT, VOIDmode, STRUCT_VALUE_OFFSET))))#define STRUCT_VALUE_INCOMING \ (TARGET_V9 \ ? 0 \ : gen_rtx (MEM, Pmode, \ gen_rtx (PLUS, Pmode, frame_pointer_rtx, \ gen_rtx (CONST_INT, VOIDmode, STRUCT_VALUE_OFFSET))))/* 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 SPARC has two kinds of registers, general and floating point. For v9 we must distinguish between the upper and lower floating point registers because the upper ones can't hold SFmode values. HARD_REGNO_MODE_OK won't help here because reload assumes that register(s) satisfying a group need for a class will also satisfy a single need for that class. EXTRA_FP_REGS is a bit of a misnomer as it covers all 64 fp regs. It is important that one class contains all the general and all the standard fp regs. Otherwise find_reg() won't properly allocate int regs for moves, because reg_class_record() will bias the selection in favor of fp regs, because reg_class_subunion[GENERAL_REGS][FP_REGS] will yield FP_REGS, because FP_REGS > GENERAL_REGS. It is also important that one class contain all the general and all the fp regs. Otherwise when spilling a DFmode reg, it may be from EXTRA_FP_REGS but find_reloads() may use class GENERAL_OR_FP_REGS. This will cause allocate_reload_reg() to bypass it causing an abort because the compiler thinks it doesn't have a spill reg when in fact it does. v9 also has 4 floating point condition code registers. Since we don't have a class that is the union of FPCC_REGS with either of the others, it is important that it appear first. Otherwise the compiler will die trying to compile _fixunsdfsi because fix_truncdfsi2 won't match its constraints. */#ifdef SPARCV9enum reg_class { NO_REGS, FPCC_REGS, GENERAL_REGS, FP_REGS, EXTRA_FP_REGS, GENERAL_OR_FP_REGS, GENERAL_OR_EXTRA_FP_REGS, ALL_REGS, LIM_REG_CLASSES };#elseenum reg_class { NO_REGS, GENERAL_REGS, FP_REGS, ALL_REGS, LIM_REG_CLASSES };#endif#define N_REG_CLASSES (int) LIM_REG_CLASSES/* Give names of register classes as strings for dump file. */#ifdef SPARCV9#define REG_CLASS_NAMES \ { "NO_REGS", "FPCC_REGS", "GENERAL_REGS", "FP_REGS", "EXTRA_FP_REGS", \ "GENERAL_OR_FP_REGS", "GENERAL_OR_EXTRA_FP_REGS", "ALL_REGS" }#else#define REG_CLASS_NAMES \ { "NO_REGS", "GENERAL_REGS", "FP_REGS", "ALL_REGS" }#endif/* Define which registers fit in which classes. This is an initializer for a vector of HARD_REG_SET of length N_REG_CLASSES. */#ifdef SPARCV9#define REG_CLASS_CONTENTS \ {{0, 0, 0, 0}, {0, 0, 0, 0xf}, {-2, 0, 0, 0}, \ {0, -1, 0, 0}, {0, -1, -1, 0}, {-2, -1, 0, 0}, {-2, -1, -1, 0}, \ {-2, -1, -1, 0xf}}#else#if 0 && defined (__GNUC__)#define REG_CLASS_CONTENTS {0LL, 0xfffffffeLL, 0xffffffff00000000LL, 0xfffffffffffffffeLL}#else#define REG_CLASS_CONTENTS {{0, 0}, {-2, 0}, {0, -1}, {-2, -1}}#endif#endif/* The same information, inverted: Return the class number of the smallest class containing reg number REGNO. This could be a conditional expression or could index an array. */#ifdef SPARCV9#define REGNO_REG_CLASS(REGNO) \ ((REGNO) == 0 ? NO_REGS \ : (REGNO) < 32 ? GENERAL_REGS \ : (REGNO) < 64 ? FP_REGS \ : (REGNO) < 96 ? EXTRA_FP_REGS \ : FPCC_REGS)#else#define REGNO_REG_CLASS(REGNO) \ ((REGNO) >= 32 ? FP_REGS : (REGNO) == 0 ? NO_REGS : GENERAL_REGS)#endif/* This is the order in which to allocate registers normally. We put %f0/%f1 last among the float registers, so as to make it more likely that a pseudo-register which dies in the float return register will get allocated to the float return register, thus saving a move instruction at the end of the function. On v9, the float registers are ordered a little "funny" because some of them (%f16-%f47) are call-preserved. */#ifdef SPARCV9#define REG_ALLOC_ORDER \{ 8, 9, 10, 11, 12, 13, \ 15, 16, 17, 18, 19, 20, 21, 22, \ 23, 24, 25, 26, 27, 28, 29, 31, \ 34, 35, 36, 37, 38, 39, /* %f2-%f7 */ \ 40, 41, 42, 43, 44, 45, 46, 47, /* %f8-%f15 */ \ 80, 81, 82, 83, 84, 85, 86, 87, /* %f48-%f55 */ \ 88, 89, 90, 91, 92, 93, 94, 95, /* %f56-%f63 */ \ 48, 49, 50, 51, 52, 53, 54, 55, /* %f16-%f23 */ \ 56, 57, 58, 59, 60, 61, 62, 63, /* %f24-%f31 */ \ 64, 65, 66, 67, 68, 69, 70, 71, /* %f32-%f39 */ \ 72, 73, 74, 75, 76, 77, 78, 79, /* %f40-%f47 */ \ 32, 33, /* %f0,%f1 */ \ 96, 97, 98, 99, /* %fcc0-3 */ \ 1, 5, 2, 3, 4, 6, 7, 0, 14, 30}#else#define REG_ALLOC_ORDER \{ 8, 9, 10, 11, 12, 13, 2, 3, \ 15, 16, 17, 18, 19, 20, 21, 22, \ 23, 24, 25, 26, 27, 28, 29, 31, \ 34, 35, 36, 37, 38, 39, \ 40, 41, 42, 43, 44, 45, 46, 47, \ 48, 49, 50, 51, 52, 53, 54, 55, \ 56, 57, 58, 59, 60, 61, 62, 63, \ 32, 33, \ 1, 4, 5, 6, 7, 0, 14, 30}#endif/* This is the order in which to allocate registers for leaf functions. If all registers can fit in the "i" registers, then we have the possibility of having a leaf function. v9: The floating point registers are ordered a little "funny" because some of them (%f16-%f47) are call-preserved. */#ifdef SPARCV9#define REG_LEAF_ALLOC_ORDER \{ 24, 25, 26, 27, 28, 29, \ 15, 8, 9, 10, 11, 12, 13, \ 16, 17, 18, 19, 20, 21, 22, 23, \ 34, 35, 36, 37, 38, 39, \ 40, 41, 42, 43, 44, 45, 46, 47, \ 80, 81, 82, 83, 84, 85, 86, 87, \ 88, 89, 90, 91, 92, 93, 94, 95, \ 48, 49, 50, 51, 52, 53, 54, 55, \ 56, 57, 58, 59, 60, 61, 62, 63, \ 64, 65, 66, 67, 68, 69, 70, 71, \ 72, 73, 74, 75, 76, 77, 78, 79, \ 32, 33, \ 96, 97, 98, 99, \ 1, 5, 2, 3, 4, 6, 7, 0, 14, 30, 31}#else#define REG_LEAF_ALLOC_ORDER \{ 2, 3, 24, 25, 26, 27, 28, 29, \ 15, 8, 9, 10, 11, 12, 13, \ 16, 17, 18, 19, 20, 21, 22, 23, \ 34, 35, 36, 37, 38, 39, \ 40, 41, 42, 43, 44, 45, 46, 47, \ 48, 49, 50, 51, 52, 53, 54, 55, \ 56, 57, 58, 59, 60, 61, 62, 63, \ 32, 33, \ 1, 4, 5, 6, 7, 0, 14, 30, 31}#endif#define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()/* ??? %g7 is not a leaf register to effectively #undef LEAF_REGISTERS when -mflat is used. Function only_leaf_regs_used will return 0 if a global register is used and is not permitted in a leaf function. We make %g7 a global reg if -mflat and voila. Since %g7 is a system register and is fixed it won't be used by gcc anyway. */#ifdef SPARCV9#define LEAF_REGISTERS \{ 1, 1, 1, 1, 1, 1, 1, 0, \ 0, 0, 0, 0, 0, 0, 1, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 1, 1, 1, 1, 1, 1, 0, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1}#else#define LEAF_REGISTERS \{ 1, 1, 1, 1, 1, 1, 1, 0, \ 0, 0, 0, 0, 0, 0, 1, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 1, 1, 1, 1, 1, 1, 0, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1}#endifextern char leaf_reg_remap[];#define LEAF_REG_REMAP(REGNO) (leaf_reg_remap[REGNO])/* The class value for index registers, and the one for base regs. */#define INDEX_REG_CLASS GENERAL_REGS#define BASE_REG_CLASS GENERAL_REGS/* Local macro to handle the two v9 classes of FP regs. */#ifdef SPARCV9#define FP_REG_CLASS_P(CLASS) ((CLASS) == FP_REGS || (CLASS) == EXTRA_FP_REGS)#else#define FP_REG_CLASS_P(CLASS) ((CLASS) == FP_REGS)#endif/* Get reg_class from a letter such as appears in the machine description. */#ifdef SPARCV9#define REG_CLASS_FROM_LETTER(C) \ ((C) == 'f' ? FP_REGS \ : (C) == 'e' ? EXTRA_FP_REGS \ : (C) == 'c' ? FPCC_REGS \ : NO_REGS)#else/* Coerce v9's 'e' class to 'f', so we can use 'e' in the .md file for v8 and v9. */#define REG_CLASS_FROM_LETTER(C) \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -