📄 sparc.h
字号:
: (GET_MODE_SIZE (MODE) + 3) / 4) \ : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))/* Due to the ARCH64 descrepancy above we must override this next macro too. */#define REGMODE_NATURAL_SIZE(MODE) \ ((TARGET_ARCH64 && FLOAT_MODE_P (MODE)) ? 4 : UNITS_PER_WORD)/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. See sparc.c for how we initialize this. */extern const int *hard_regno_mode_classes;extern int sparc_mode_class[];/* ??? Because of the funny way we pass parameters we should allow certain ??? types of float/complex values to be in integer registers during ??? RTL generation. This only matters on arch32. */#define HARD_REGNO_MODE_OK(REGNO, MODE) \ ((hard_regno_mode_classes[REGNO] & sparc_mode_class[MODE]) != 0)/* 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. 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/* The stack bias (amount by which the hardware register is offset by). */#define SPARC_STACK_BIAS ((TARGET_ARCH64 && TARGET_STACK_BIAS) ? 2047 : 0)/* Actual top-of-stack address is 92/176 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 6*4 bytes for the 6 register parameters. - v9: 128 bytes for the in and local registers + 6*8 bytes for the integer parameter regs. */#define STACK_POINTER_OFFSET (FIRST_PARM_OFFSET(0) + SPARC_STACK_BIAS)/* Base register for access to local variables of the function. */#define HARD_FRAME_POINTER_REGNUM 30/* The soft frame pointer does not have the stack bias applied. */#define FRAME_POINTER_REGNUM 101/* Given the stack bias, the stack pointer isn't actually aligned. */#define INIT_EXPANDERS \ do { \ if (cfun && cfun->emit->regno_pointer_align && SPARC_STACK_BIAS) \ { \ REGNO_POINTER_ALIGN (STACK_POINTER_REGNUM) = BITS_PER_UNIT; \ REGNO_POINTER_ALIGN (HARD_FRAME_POINTER_REGNUM) = BITS_PER_UNIT; \ } \ } while (0)/* 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_FLAT \ ? (current_function_calls_alloca \ || !leaf_function_p ()) \ : ! (leaf_function_p () && only_leaf_regs_used ()))/* 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_ARCH64 ? 5 : 2)/* Register which holds offset table for position-independent data references. */#define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 23 : INVALID_REGNUM)/* Pick a default value we can notice from override_options: !v9: Default is on. v9: Default is off. */#define DEFAULT_PCC_STRUCT_RETURN -1/* SPARC ABI says that quad-precision floats and all structures are returned in memory. For v9: unions <= 32 bytes in size are returned in int regs, structures up to 32 bytes are returned in int and fp regs. */#define RETURN_IN_MEMORY(TYPE) \(TARGET_ARCH32 \ ? (TYPE_MODE (TYPE) == BLKmode \ || TYPE_MODE (TYPE) == TFmode \ || TYPE_MODE (TYPE) == TCmode) \ : (TYPE_MODE (TYPE) == BLKmode \ && (unsigned HOST_WIDE_INT) int_size_in_bytes (TYPE) > 32))/* 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_ARCH64 \ ? 0 \ : gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, \ STRUCT_VALUE_OFFSET)))#define STRUCT_VALUE_INCOMING \ (TARGET_ARCH64 \ ? 0 \ : gen_rtx_MEM (Pmode, plus_constant (frame_pointer_rtx, \ 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 various kinds of registers: general, floating point, and condition codes [well, it has others as well, but none that we care directly about]. 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. It is important that SPARC_ICC_REG have class NO_REGS. Otherwise combine may try to use it to hold an SImode value. See register_operand. ??? Should %fcc[0123] be handled similarly?*/enum reg_class { NO_REGS, FPCC_REGS, I64_REGS, GENERAL_REGS, FP_REGS, EXTRA_FP_REGS, GENERAL_OR_FP_REGS, GENERAL_OR_EXTRA_FP_REGS, ALL_REGS, LIM_REG_CLASSES };#define N_REG_CLASSES (int) LIM_REG_CLASSES/* Give names of register classes as strings for dump file. */#define REG_CLASS_NAMES \ { "NO_REGS", "FPCC_REGS", "I64_REGS", "GENERAL_REGS", "FP_REGS", \ "EXTRA_FP_REGS", "GENERAL_OR_FP_REGS", "GENERAL_OR_EXTRA_FP_REGS", \ "ALL_REGS" }/* Define which registers fit in which classes. This is an initializer for a vector of HARD_REG_SET of length N_REG_CLASSES. */#define REG_CLASS_CONTENTS \ {{0, 0, 0, 0}, /* NO_REGS */ \ {0, 0, 0, 0xf}, /* FPCC_REGS */ \ {0xffff, 0, 0, 0}, /* I64_REGS */ \ {-1, 0, 0, 0x20}, /* GENERAL_REGS */ \ {0, -1, 0, 0}, /* FP_REGS */ \ {0, -1, -1, 0}, /* EXTRA_FP_REGS */ \ {-1, -1, 0, 0x20}, /* GENERAL_OR_FP_REGS */ \ {-1, -1, -1, 0x20}, /* GENERAL_OR_EXTRA_FP_REGS */ \ {-1, -1, -1, 0x3f}} /* ALL_REGS *//* Defines invalid mode changes. Borrowed from pa64-regs.h. SImode loads to floating-point registers are not zero-extended. The definition for LOAD_EXTEND_OP specifies that integer loads narrower than BITS_PER_WORD will be zero-extended. As a result, we inhibit changes from SImode unless they are to a mode that is identical in size. */#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \ (TARGET_ARCH64 \ && (FROM) == SImode \ && GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \ ? reg_classes_intersect_p (CLASS, FP_REGS) : 0)/* 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. */extern enum reg_class sparc_regno_reg_class[FIRST_PSEUDO_REGISTER];#define REGNO_REG_CLASS(REGNO) sparc_regno_reg_class[(REGNO)]/* This is the order in which to allocate registers normally. We put %f0-%f7 last among the float registers, so as to make it more likely that a pseudo-register which dies in the float return register area will get allocated to the float return register, thus saving a move instruction at the end of the function. Similarly for integer return value registers. We know in this case that we will not end up with a leaf function. The register allocater is given the global and out registers first because these registers are call clobbered and thus less useful to global register allocation. Next we list the local and in registers. They are not call clobbered and thus very useful for global register allocation. We list the input registers before the locals so that it is more likely the incoming arguments received in those registers can just stay there and not be reloaded. */#define REG_ALLOC_ORDER \{ 1, 2, 3, 4, 5, 6, 7, /* %g1-%g7 */ \ 13, 12, 11, 10, 9, 8, /* %o5-%o0 */ \ 15, /* %o7 */ \ 16, 17, 18, 19, 20, 21, 22, 23, /* %l0-%l7 */ \ 29, 28, 27, 26, 25, 24, 31, /* %i5-%i0,%i7 */\ 40, 41, 42, 43, 44, 45, 46, 47, /* %f8-%f15 */ \ 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 */ \ 80, 81, 82, 83, 84, 85, 86, 87, /* %f48-%f55 */ \ 88, 89, 90, 91, 92, 93, 94, 95, /* %f56-%f63 */ \ 39, 38, 37, 36, 35, 34, 33, 32, /* %f7-%f0 */ \ 96, 97, 98, 99, /* %fcc0-3 */ \ 100, 0, 14, 30, 101} /* %icc, %g0, %o6, %i6, %sfp *//* This is the order in which to allocate registers for leaf functions. If all registers can fit in the global and output registers, then we have the possibility of having a leaf function. The macro actually mentioned the input registers first, because they get renumbered into the output registers once we know really do have a leaf function. To be more precise, this register allocation order is used when %o7 is found to not be clobbered right before register allocation. Normally, the reason %o7 would be clobbered is due to a call which could not be transformed into a sibling call. As a consequence, it is possible to use the leaf register allocation order and not end up with a leaf function. We will not get suboptimal register allocation in that case because by definition of being potentially leaf, there were no function calls. Therefore, allocation order within the local register window is not critical like it is when we do have function calls. */#define REG_LEAF_ALLOC_ORDER \{ 1, 2, 3, 4, 5, 6, 7, /* %g1-%g7 */ \ 29, 28, 27, 26, 25, 24, /* %i5-%i0 */ \ 15, /* %o7 */ \ 13, 12, 11, 10, 9, 8, /* %o5-%o0 */ \ 16, 17, 18, 19, 20, 21, 22, 23, /* %l0-%l7 */ \ 40, 41, 42, 43, 44, 45, 46, 47, /* %f8-%f15 */ \ 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 */ \ 80, 81, 82, 83, 84, 85, 86, 87, /* %f48-%f55 */ \ 88, 89, 90, 91, 92, 93, 94, 95, /* %f56-%f63 */ \ 39, 38, 37, 36, 35, 34, 33, 32, /* %f7-%f0 */ \ 96, 97, 98, 99, /* %fcc0-3 */ \ 100, 0, 14, 30, 31, 101} /* %icc, %g0, %o6, %i6, %i7, %sfp */#define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()extern char sparc_leaf_regs[];#define LEAF_REGISTERS sparc_leaf_regsextern 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. */#define FP_REG_CLASS_P(CLASS) ((CLASS) == FP_REGS || (CLASS) == EXTRA_FP_REGS)/* Get reg_class from a letter such as appears in the machine description. In the not-v9 case, coerce v9's 'e' class to 'f', so we can use 'e' in the .md file for v8 and v9. 'd' and 'b' are used for single and double precision VIS operations, if TARGET_VIS. 'h' is used for V8+ 64 bit global and out registers. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -