⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sh.h

📁 GCC编译器源代码
💻 H
📖 第 1 页 / 共 5 页
字号:
     /* Define how to find the value returned by a library function   assuming the value has mode MODE.  */#define LIBCALL_VALUE(MODE) \  gen_rtx (REG, (MODE), BASE_RETURN_VALUE_REG (MODE));/* 1 if N is a possible register number for a function value. */#define FUNCTION_VALUE_REGNO_P(REGNO) \  ((REGNO) == FIRST_RET_REG || (TARGET_SH3E && (REGNO) == FIRST_FP_RET_REG))/* 1 if N is a possible register number for function argument passing.  */#define FUNCTION_ARG_REGNO_P(REGNO) \  (((REGNO) >= FIRST_PARM_REG && (REGNO) < (FIRST_PARM_REG + 4))        \   || (TARGET_SH3E                                                      \       && (REGNO) >= FIRST_FP_PARM_REG && (REGNO) < (FIRST_FP_PARM_REG + 8)))/* Define a data type for recording info about an argument list   during the scan of that argument list.  This data type should   hold all necessary information about the function itself   and about the args processed so far, enough to enable macros   such as FUNCTION_ARG to determine where the next arg should go.   On SH, this is a single integer, which is a number of words   of arguments scanned so far (including the invisible argument,   if any, which holds the structure-value-address).   Thus NARGREGS or more means all following args should go on the stack.  */enum sh_arg_class { SH_ARG_INT = 0, SH_ARG_FLOAT = 1 };struct sh_args {    int arg_count[2];};#define CUMULATIVE_ARGS  struct sh_args#define GET_SH_ARG_CLASS(MODE) \  ((TARGET_SH3E && ((MODE) == SFmode)) ? SH_ARG_FLOAT : SH_ARG_INT)#define ROUND_ADVANCE(SIZE) \  (((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)/* Round a register number up to a proper boundary for an arg of mode   MODE.   The SH doesn't care about double alignment, so we only   round doubles to even regs when asked to explicitly.  */#define ROUND_REG(CUM, MODE) \   ((TARGET_ALIGN_DOUBLE					\     && GET_MODE_UNIT_SIZE ((MODE)) > UNITS_PER_WORD)		\    ? ((CUM).arg_count[(int) GET_SH_ARG_CLASS (MODE)]		\       + ((CUM).arg_count[(int) GET_SH_ARG_CLASS (MODE)] & 1))	\    : (CUM).arg_count[(int) GET_SH_ARG_CLASS (MODE)])/* Initialize a variable CUM of type CUMULATIVE_ARGS   for a call to a function whose data type is FNTYPE.   For a library call, FNTYPE is 0.   On SH, the offset always starts at 0: the first parm reg is always   the same reg for a given argument class.  */#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \  do {								\    (CUM).arg_count[(int) SH_ARG_INT] = 0;			\    (CUM).arg_count[(int) SH_ARG_FLOAT] = 0;			\  } while (0)/* Update the data in CUM to advance over an argument   of mode MODE and data type TYPE.   (TYPE is null for libcalls where that information may not be   available.)  */#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)	\ ((CUM).arg_count[(int) GET_SH_ARG_CLASS (MODE)] =	\	  (ROUND_REG ((CUM), (MODE))			\	   + ((MODE) != BLKmode				\	      ? ROUND_ADVANCE (GET_MODE_SIZE (MODE))	\	      : ROUND_ADVANCE (int_size_in_bytes (TYPE)))))/* Return boolean indicating arg of mode MODE will be passed in a reg.   This macro is only used in this file. */#define PASS_IN_REG_P(CUM, MODE, TYPE) \  (((TYPE) == 0 || ! TREE_ADDRESSABLE ((tree)(TYPE))) \   && (TARGET_SH3E \       ? ((MODE) == BLKmode \	  ? (((CUM).arg_count[(int) SH_ARG_INT] * UNITS_PER_WORD \	      + int_size_in_bytes (TYPE)) \	     <= NPARM_REGS (SImode) * UNITS_PER_WORD) \	  : ((ROUND_REG((CUM), (MODE)) \	      + HARD_REGNO_NREGS (BASE_ARG_REG (MODE), (MODE))) \	     <= NPARM_REGS (MODE))) \       : ROUND_REG ((CUM), (MODE)) < NPARM_REGS (MODE)))/* Define where to put the arguments to a function.   Value is zero to push the argument on the stack,   or a hard register in which to store the argument.   MODE is the argument's machine mode.   TYPE is the data type of the argument (as a tree).    This is null for libcalls where that information may    not be available.   CUM is a variable of type CUMULATIVE_ARGS which gives info about    the preceding args and about the function being called.   NAMED is nonzero if this argument is a named parameter    (otherwise it is an extra parameter matching an ellipsis).   On SH the first args are normally in registers   and the rest are pushed.  Any arg that starts within the first   NPARM_REGS words is at least partially passed in a register unless   its data type forbids.  */#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \  ((PASS_IN_REG_P ((CUM), (MODE), (TYPE))				\    && ((NAMED) || TARGET_SH3E))					\   ? gen_rtx (REG, (MODE),						\	      (BASE_ARG_REG (MODE) + ROUND_REG ((CUM), (MODE)))) \   : 0)/* For an arg passed partly in registers and partly in memory,   this is the number of registers used.   For args passed entirely in registers or entirely in memory, zero.   We sometimes split args.  */#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \  ((PASS_IN_REG_P ((CUM), (MODE), (TYPE))			\    && ((NAMED) || TARGET_SH3E)					\    && (ROUND_REG ((CUM), (MODE))				\	+ (MODE != BLKmode					\	   ? ROUND_ADVANCE (GET_MODE_SIZE (MODE))		\	   : ROUND_ADVANCE (int_size_in_bytes (TYPE)))		\	- NPARM_REGS (MODE) > 0))				\   ? NPARM_REGS (MODE) - ROUND_REG ((CUM), (MODE))		\   : 0)extern int current_function_anonymous_args;/* Perform any needed actions needed for a function that is receiving a   variable number of arguments.  */#define SETUP_INCOMING_VARARGS(ASF, MODE, TYPE, PAS, ST) \  current_function_anonymous_args = 1;/* Call the function profiler with a given profile label.   We use two .aligns, so as to make sure that both the .long is aligned   on a 4 byte boundary, and that the .long is a fixed distance (2 bytes)   from the trapa instruction.  */#define FUNCTION_PROFILER(STREAM,LABELNO)			\{								\	fprintf((STREAM), "\t.align\t2\n");			\	fprintf((STREAM), "\ttrapa\t#33\n");			\ 	fprintf((STREAM), "\t.align\t2\n");			\	asm_fprintf((STREAM), "\t.long\t%LLP%d\n", (LABELNO));	\}/* Define this macro if the code for function profiling should come   before the function prologue.  Normally, the profiling code comes   after.  */#define PROFILE_BEFORE_PROLOGUE/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,   the stack pointer does not matter.  The value is tested only in   functions that have frame pointers.   No definition is equivalent to always zero.  */#define EXIT_IGNORE_STACK 1/* Generate the assembly code for function exit   Just dump out any accumulated constant table.  */#define FUNCTION_EPILOGUE(STREAM, SIZE)  function_epilogue ((STREAM), (SIZE))/*    On the SH, the trampoline looks like   2 0002 DD02     	   	mov.l	l2,r13   1 0000 D301     		mov.l	l1,r3   3 0004 4D2B     		jmp	@r13   4 0006 0009     		nop   5 0008 00000000 	l1:  	.long   function   6 000c 00000000 	l2:	.long   area  *//* Length in units of the trampoline for entering a nested function.  */#define TRAMPOLINE_SIZE  16/* Alignment required for a trampoline in bits .  */#define TRAMPOLINE_ALIGNMENT \  ((CACHE_LOG < 3 || TARGET_SMALLCODE) ? 32 : 64) \/* Emit RTL insns to initialize the variable parts of a trampoline.   FNADDR is an RTX for the address of the function's pure code.   CXT is an RTX for the static chain value for the function.  */#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT)			\{									\  emit_move_insn (gen_rtx (MEM, SImode, (TRAMP)),			\		  GEN_INT (TARGET_LITTLE_ENDIAN ? 0xd301dd02 : 0xdd02d301));\  emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 4)),	\		  GEN_INT (TARGET_LITTLE_ENDIAN ? 0x00094d2b : 0x4d2b0009));\  emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 8)),	\		  (CXT));						\  emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 12)),	\		  (FNADDR));						\}/* A C expression whose value is RTL representing the value of the return   address for the frame COUNT steps up from the current frame.   FRAMEADDR is already the frame pointer of the COUNT frame, so we   can ignore COUNT.  */#define RETURN_ADDR_RTX(COUNT, FRAME)	\  (((COUNT) == 0)				\   ? gen_rtx (MEM, Pmode, gen_rtx (REG, Pmode, RETURN_ADDRESS_POINTER_REGNUM)) \   : (rtx) 0)/* Generate necessary RTL for __builtin_saveregs().   ARGLIST is the argument list; see expr.c.  */extern struct rtx_def *sh_builtin_saveregs ();#define EXPAND_BUILTIN_SAVEREGS(ARGLIST) sh_builtin_saveregs (ARGLIST)/* Addressing modes, and classification of registers for them.  */#define HAVE_POST_INCREMENT  1/*#define HAVE_PRE_INCREMENT   1*//*#define HAVE_POST_DECREMENT  1*/#define HAVE_PRE_DECREMENT   1/* Macros to check register numbers against specific register classes.  *//* These assume that REGNO is a hard or pseudo reg number.   They give nonzero only if REGNO is a hard reg of the suitable class   or a pseudo reg currently allocated to a suitable hard reg.   Since they use reg_renumber, they are safe only once reg_renumber   has been allocated, which happens in local-alloc.c.  */#define REGNO_OK_FOR_BASE_P(REGNO) \  ((REGNO) < PR_REG || (unsigned) reg_renumber[(REGNO)] < PR_REG)#define REGNO_OK_FOR_INDEX_P(REGNO) \  ((REGNO) == 0 || (unsigned) reg_renumber[(REGNO)] == 0)/* Maximum number of registers that can appear in a valid memory   address.  */#define MAX_REGS_PER_ADDRESS 2/* Recognize any constant value that is a valid address.  */#define CONSTANT_ADDRESS_P(X)	(GET_CODE (X) == LABEL_REF)/* Nonzero if the constant value X is a legitimate general operand.  */#define LEGITIMATE_CONSTANT_P(X) \  (GET_CODE (X) != CONST_DOUBLE						\   || GET_MODE (X) == DFmode || GET_MODE (X) == SFmode			\   || (TARGET_SH3E && (fp_zero_operand (X) || fp_one_operand (X))))/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx   and check its validity for a certain class.   We have two alternate definitions for each of them.   The usual definition accepts all pseudo regs; the other rejects   them unless they have been allocated suitable hard regs.   The symbol REG_OK_STRICT causes the latter definition to be used.  */#ifndef REG_OK_STRICT/* Nonzero if X is a hard reg that can be used as a base reg   or if it is a pseudo reg.  */#define REG_OK_FOR_BASE_P(X) \  (REGNO (X) <= 16 || REGNO (X) >= FIRST_PSEUDO_REGISTER)/* Nonzero if X is a hard reg that can be used as an index   or if it is a pseudo reg.  */#define REG_OK_FOR_INDEX_P(X) \  (REGNO (X) == 0 || REGNO (X) >= FIRST_PSEUDO_REGISTER)/* Nonzero if X/OFFSET is a hard reg that can be used as an index   or if X is a pseudo reg.  */#define SUBREG_OK_FOR_INDEX_P(X, OFFSET) \  ((REGNO (X) == 0 && OFFSET == 0) || REGNO (X) >= FIRST_PSEUDO_REGISTER)#else/* Nonzero if X is a hard reg that can be used as a base reg.  */#define REG_OK_FOR_BASE_P(X) \  REGNO_OK_FOR_BASE_P (REGNO (X))/* Nonzero if X is a hard reg that can be used as an index.  */#define REG_OK_FOR_INDEX_P(X) \  REGNO_OK_FOR_INDEX_P (REGNO (X))/* Nonzero if X/OFFSET is a hard reg that can be used as an index.  */#define SUBREG_OK_FOR_INDEX_P(X, OFFSET) \  (REGNO_OK_FOR_INDEX_P (REGNO (X)) && (OFFSET) == 0)#endif/* The 'Q' constraint is a pc relative load operand.  */#define EXTRA_CONSTRAINT_Q(OP)                          		\  (GET_CODE (OP) == MEM && 						\   ((GET_CODE (XEXP ((OP), 0)) == LABEL_REF)				\    || (GET_CODE (XEXP ((OP), 0)) == CONST                		\	&& GET_CODE (XEXP (XEXP ((OP), 0), 0)) == PLUS 			\	&& GET_CODE (XEXP (XEXP (XEXP ((OP), 0), 0), 0)) == LABEL_REF	\	&& GET_CODE (XEXP (XEXP (XEXP ((OP), 0), 0), 1)) == CONST_INT)))#define EXTRA_CONSTRAINT(OP, C)		\  ((C) == 'Q' ? EXTRA_CONSTRAINT_Q (OP)	\   : 0)/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression   that is a valid memory address for an instruction.   The MODE argument is the machine mode for the MEM expression   that wants to use this address.   The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS.  */#define MODE_DISP_OK_4(X,MODE) \(GET_MODE_SIZE (MODE) == 4 && (unsigned) INTVAL (X) < 64	\ && ! (INTVAL (X) & 3) && ! (TARGET_SH3E && (MODE) == SFmode))#define MODE_DISP_OK_8(X,MODE) ((GET_MODE_SIZE(MODE)==8) && ((unsigned)INTVAL(X)<60) && (!(INTVAL(X) &3)))#define BASE_REGISTER_RTX_P(X)				\  ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))	\   || (GET_CODE (X) == SUBREG				\       && GET_CODE (SUBREG_REG (X)) == REG		\       && REG_OK_FOR_BASE_P (SUBREG_REG (X))))/* Since this must be r0, which is a single register class, we must check   SUBREGs more carefully, to be sure that we don't accept one that extends   outside the class.  */#define INDEX_REGISTER_RTX_P(X)				\  ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X))	\   || (GET_CODE (X) == SUBREG				\       && GET_CODE (SUBREG_REG (X)) == REG		\       && SUBREG_OK_FOR_INDEX_P (SUBREG_REG (X), SUBREG_WORD (X))))/* Jump to LABEL if X is a valid address RTX.  This must also take   REG_OK_STRICT into account when deciding about valid registers, but it uses   the above macros so we are in luck.   Allow  REG	  REG+disp	  REG+r0	  REG++	  --REG  *//* ??? The SH3e does not have the REG+disp addressing mode when loading values   into the FRx registers.  We implement this by setting the maximum offset   to zero when the value is SFmode.  This also restricts loading of SFmode   values into the integer registers, but that can't be helped.  *//* The SH allows a displacement in a QI or HI amode, but only when the   other operand is R0. GCC doesn't handle this very well, so we forgo   all of that.   A legitimate index for a QI or HI is 0, SI can be any number 0..63,   DI can be any number 0..60.  */#define GO_IF_LEGITIMATE_INDEX(MODE, OP, LABEL)  			\  do {									\    if (GET_CODE (OP) == CONST_INT) 					\      {									\

⌨️ 快捷键说明

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