sparc.h

来自「GCC编译器源代码」· C头文件 代码 · 共 1,699 行 · 第 1/5 页

H
1,699
字号
		  || !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_FLAT ? 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_ARCH64 ? 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: unions <= 32 bytes in size are returned in int regs,   structures up to 32 bytes are returned in int and fp regs.   FIXME: wip */#define RETURN_IN_MEMORY(TYPE)				\(TARGET_ARCH32						\ ? (TYPE_MODE (TYPE) == BLKmode				\    || TYPE_MODE (TYPE) == TFmode			\    || TYPE_MODE (TYPE) == TCmode)			\ : TYPE_MODE (TYPE) == BLKmode)/* 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,				\	      gen_rtx (PLUS, Pmode, stack_pointer_rtx,	\		       gen_rtx (CONST_INT, VOIDmode, STRUCT_VALUE_OFFSET))))#define STRUCT_VALUE_INCOMING \  (TARGET_ARCH64					\   ? 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 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, 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", "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}, {0, 0, 0, 0xf}, \   {-1, 0, 0, 0}, {0, -1, 0, 0}, {0, -1, -1, 0}, \   {-1, -1, 0, 0}, {-1, -1, -1, 0}, {-1, -1, -1, 0x1f}}/* 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[];#define REGNO_REG_CLASS(REGNO) sparc_regno_reg_class[(REGNO)]/* 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.  */#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,		/* %f2-%f7 */   \  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 */ \  32, 33,				/* %f0,%f1 */   \  96, 97, 98, 99, 100,			/* %fcc0-3, %icc */ \  1, 4, 5, 6, 7, 0, 14, 30}/* 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.  */#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,	\  64, 65, 66, 67, 68, 69, 70, 71,	\  72, 73, 74, 75, 76, 77, 78, 79,	\  80, 81, 82, 83, 84, 85, 86, 87,	\  88, 89, 90, 91, 92, 93, 94, 95,	\  32, 33,				\  96, 97, 98, 99, 100,			\  1, 4, 5, 6, 7, 0, 14, 30, 31}#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.  */#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, 1}extern 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.  */#define REG_CLASS_FROM_LETTER(C) \(TARGET_V9			\ ? ((C) == 'f' ? FP_REGS	\    : (C) == 'e' ? EXTRA_FP_REGS \    : (C) == 'c' ? FPCC_REGS	\    : NO_REGS)			\ : ((C) == 'f' ? FP_REGS	\    : (C) == 'e' ? FP_REGS	\    : (C) == 'c' ? FPCC_REGS	\    : NO_REGS))/* The letters I, J, K, L and M in a register constraint string   can be used to stand for particular ranges of immediate operands.   This macro defines what the ranges are.   C is the letter, and VALUE is a constant value.   Return 1 if VALUE is in the range specified by C.   `I' is used for the range of constants an insn can actually contain.   `J' is used for the range which is just zero (since that is R0).   `K' is used for constants which can be loaded with a single sethi insn.   `L' is used for the range of constants supported by the movcc insns.   `M' is used for the range of constants supported by the movrcc insns.  */#define SPARC_SIMM10_P(X) ((unsigned HOST_WIDE_INT) (X) + 0x200 < 0x400)#define SPARC_SIMM11_P(X) ((unsigned HOST_WIDE_INT) (X) + 0x400 < 0x800)#define SPARC_SIMM13_P(X) ((unsigned HOST_WIDE_INT) (X) + 0x1000 < 0x2000)/* 10 and 11 bit immediates are only used for a few specific insns.   SMALL_INT is used throughout the port so we continue to use it.  */#define SMALL_INT(X) (SPARC_SIMM13_P (INTVAL (X)))#define SPARC_SETHI_P(X) \(((unsigned HOST_WIDE_INT) (X) & ~(unsigned HOST_WIDE_INT) 0xfffffc00) == 0)#define CONST_OK_FOR_LETTER_P(VALUE, C)  \  ((C) == 'I' ? SPARC_SIMM13_P (VALUE)			\   : (C) == 'J' ? (VALUE) == 0				\   : (C) == 'K' ? SPARC_SETHI_P (VALUE)			\   : (C) == 'L' ? SPARC_SIMM11_P (VALUE)		\   : (C) == 'M' ? SPARC_SIMM10_P (VALUE)		\   : 0)/* Similar, but for floating constants, and defining letters G and H.   Here VALUE is the CONST_DOUBLE rtx itself.  */#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)	\  ((C) == 'G' ? fp_zero_operand (VALUE)			\   : (C) == 'H' ? arith_double_operand (VALUE, DImode)	\   : 0)/* Given an rtx X being reloaded into a reg required to be   in class CLASS, return the class of reg to actually use.   In general this is just CLASS; but on some machines   in some cases it is preferable to use a more restrictive class.  *//* We can't load constants into FP registers.  We can't load any FP constant   if an 'E' constraint fails to match it.  */#define PREFERRED_RELOAD_CLASS(X,CLASS)			\  (CONSTANT_P (X)					\   && (FP_REG_CLASS_P (CLASS)				\       || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT	\	   && (HOST_FLOAT_FORMAT != IEEE_FLOAT_FORMAT	\	       || HOST_BITS_PER_INT != BITS_PER_WORD)))	\   ? NO_REGS : (CLASS))/* Return the register class of a scratch register needed to load IN into   a register of class CLASS in MODE.   On the SPARC, when PIC, we need a temporary when loading some addresses   into a register.   Also, we need a temporary when loading/storing a HImode/QImode value   between memory and the FPU registers.  This can happen when combine puts   a paradoxical subreg in a float/fix conversion insn.  */#define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, IN)		\  ((FP_REG_CLASS_P (CLASS) && ((MODE) == HImode || (MODE) == QImode) \    && (GET_CODE (IN) == MEM					\	|| ((GET_CODE (IN) == REG || GET_CODE (IN) == SUBREG)	\	    && true_regnum (IN) == -1))) ? GENERAL_REGS : NO_REGS)#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, IN)		\  ((FP_REG_CLASS_P (CLASS) && ((MODE) == HImode || (MODE) == QImode) \    && (GET_CODE (IN) == MEM					\	|| ((GET_CODE (IN) == REG || GET_CODE (IN) == SUBREG)	\	    && true_regnum (IN) == -1))) ? GENERAL_REGS : NO_REGS)/* On SPARC it is not possible to directly move data between    GENERAL_REGS and FP_REGS.  */#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \  (FP_REG_CLASS_P (CLASS1) != FP_REG_CLASS_P (CLASS2))/* Return the stack location to use for secondary memory needed reloads.   We want to use the reserved location just below the frame pointer.   However, we must ensure that there is a frame, so use assign_stack_local   if the frame size is zero.  */#define SECONDARY_MEMORY_NEEDED_RTX(MODE) \  (get_frame_size () == 0						\   ? assign_stack_local (MODE, GET_MODE_SIZE (MODE), 0)			\   : gen_rtx (MEM, MODE, gen_rtx (PLUS, Pmode, frame_pointer_rtx,	\				  GEN_INT (STARTING_FRAME_OFFSET))))/* Get_secondary_mem widens it's argument to BITS_PER_WORD which loses on v9   because the movsi and movsf patterns don't handle r/f moves.   For v8 we copy the default definition.  */#define SECONDARY_MEMORY_NEEDED_MODE(MODE) \  (TARGET_ARCH64						\   ? (GET_MODE_BITSIZE (MODE) < 32				\      ? mode_for_size (32, GET_MODE_CLASS (MODE), 0)		\      : MODE)							\   : (GET_MODE_BITSIZE (MODE) < BITS_PER_WORD			\      ? mode_for_size (BITS_PER_WORD, GET_MODE_CLASS (MODE), 0)	\      : MODE))/* Return the maximum number of consecutive registers   needed to represent mode MODE in a register of class CLASS.  *//* On SPARC, this is the size of MODE in words.  */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?