sparc.h

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

H
1,699
字号
#define CLASS_MAX_NREGS(CLASS, MODE)	\  (FP_REG_CLASS_P (CLASS) ? (GET_MODE_SIZE (MODE) + 3) / 4 \   : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)/* Stack layout; function entry, exit and calling.  *//* Define the number of register that can hold parameters.   This macro is only used in other macro definitions below and in sparc.c.   MODE is the mode of the argument.   !v9: All args are passed in %o0-%o5.   v9: %o0-%o5 and %f0-%f31 are cumulatively used to pass values.   See the description in sparc.c.  */#define NPARM_REGS(MODE) \(TARGET_ARCH64 \ ? (GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 : 6) \ : 6)/* Define this if pushing a word on the stack   makes the stack pointer a smaller address.  */#define STACK_GROWS_DOWNWARD/* Define this if the nominal address of the stack frame   is at the high-address end of the local variables;   that is, each additional local variable allocated   goes at a more negative offset in the frame.  */#define FRAME_GROWS_DOWNWARD/* Offset within stack frame to start allocating local variables at.   If FRAME_GROWS_DOWNWARD, this is the offset to the END of the   first local allocated.  Otherwise, it is the offset to the BEGINNING   of the first local allocated.  *//* This allows space for one TFmode floating point value.  */#define STARTING_FRAME_OFFSET \  (TARGET_ARCH64 ? (SPARC_STACK_BIAS - 16) \   : (-SPARC_STACK_ALIGN (LONG_DOUBLE_TYPE_SIZE / BITS_PER_UNIT)))/* If we generate an insn to push BYTES bytes,   this says how many the stack pointer really advances by.   On SPARC, don't define this because there are no push insns.  *//*  #define PUSH_ROUNDING(BYTES) *//* Offset of first parameter from the argument pointer register value.   !v9: This is 64 for the ins and locals, plus 4 for the struct-return reg   even if this function isn't going to use it.   v9: This is 128 for the ins and locals.  */#define FIRST_PARM_OFFSET(FNDECL) \  (TARGET_ARCH64 ? (SPARC_STACK_BIAS + 16 * UNITS_PER_WORD) \   : (STRUCT_VALUE_OFFSET + UNITS_PER_WORD))/* When a parameter is passed in a register, stack space is still   allocated for it.  *//* This only takes into account the int regs.   fp regs are handled elsewhere.  */#define REG_PARM_STACK_SPACE(DECL) (6 * UNITS_PER_WORD)/* Keep the stack pointer constant throughout the function.   This is both an optimization and a necessity: longjmp   doesn't behave itself when the stack pointer moves within   the function!  */#define ACCUMULATE_OUTGOING_ARGS/* Value is the number of bytes of arguments automatically   popped when returning from a subroutine call.   FUNDECL is the declaration node of the function (as a tree),   FUNTYPE is the data type of the function (as a tree),   or for a library call it is an identifier node for the subroutine name.   SIZE is the number of bytes of arguments passed on the stack.  */#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0/* Some subroutine macros specific to this machine.   When !TARGET_FPU, put float return values in the general registers,   since we don't have any fp registers.  */#define BASE_RETURN_VALUE_REG(MODE) \  (TARGET_ARCH64 \   ? (TARGET_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 : 8) \   : (((MODE) == SFmode || (MODE) == DFmode) && TARGET_FPU ? 32 : 8))#define BASE_OUTGOING_VALUE_REG(MODE) \  (TARGET_ARCH64 \   ? (TARGET_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 \      : TARGET_FLAT ? 8 : 24) \   : (((MODE) == SFmode || (MODE) == DFmode) && TARGET_FPU ? 32	\      : (TARGET_FLAT ? 8 : 24)))#define BASE_PASSING_ARG_REG(MODE) \  (TARGET_ARCH64 \   ? (TARGET_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 : 8) \   : 8)#define BASE_INCOMING_ARG_REG(MODE) \  (TARGET_ARCH64 \   ? (TARGET_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 \      : TARGET_FLAT ? 8 : 24) \   : (TARGET_FLAT ? 8 : 24))/* Define this macro if the target machine has "register windows".  This   C expression returns the register number as seen by the called function   corresponding to register number OUT as seen by the calling function.   Return OUT if register number OUT is not an outbound register.  */#define INCOMING_REGNO(OUT) \ ((TARGET_FLAT || (OUT) < 8 || (OUT) > 15) ? (OUT) : (OUT) + 16)/* Define this macro if the target machine has "register windows".  This   C expression returns the register number as seen by the calling function   corresponding to register number IN as seen by the called function.   Return IN if register number IN is not an inbound register.  */#define OUTGOING_REGNO(IN) \ ((TARGET_FLAT || (IN) < 24 || (IN) > 31) ? (IN) : (IN) - 16)/* Define how to find the value returned by a function.   VALTYPE is the data type of the value (as a tree).   If the precise function being called is known, FUNC is its FUNCTION_DECL;   otherwise, FUNC is 0.  *//* On SPARC the value is found in the first "output" register.  */#define FUNCTION_VALUE(VALTYPE, FUNC)  \  gen_rtx (REG, TYPE_MODE (VALTYPE), BASE_RETURN_VALUE_REG (TYPE_MODE (VALTYPE)))/* But the called function leaves it in the first "input" register.  */#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC)  \  gen_rtx (REG, TYPE_MODE (VALTYPE), BASE_OUTGOING_VALUE_REG (TYPE_MODE (VALTYPE)))/* 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   as seen by the caller.   On SPARC, the first "output" reg is used for integer values,   and the first floating point register is used for floating point values.  */#define FUNCTION_VALUE_REGNO_P(N) ((N) == 8 || (N) == 32)/* Define the size of space to allocate for the return value of an   untyped_call.  */#define APPLY_RESULT_SIZE 16/* 1 if N is a possible register number for function argument passing.   On SPARC, these are the "output" registers.  v9 also uses %f0-%f31.  */#define FUNCTION_ARG_REGNO_P(N) \(TARGET_ARCH64 \ ? (((N) >= 8 && (N) <= 13) || ((N) >= 32 && (N) <= 63)) \ : ((N) >= 8 && (N) <= 13))/* 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 SPARC (!v9), 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 7 or more means all following args should go on the stack.   For v9, we also need to know whether a prototype is present.  */struct sparc_args {  int words;       /* number of words passed so far */  int prototype_p; /* non-zero if a prototype is present */  int libcall_p;   /* non-zero if a library call */};#define CUMULATIVE_ARGS struct sparc_args/* 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.  */extern void init_cumulative_args ();#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \init_cumulative_args (& (CUM), (FNTYPE), (LIBNAME), (INDIRECT));/* 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.  */extern void function_arg_advance ();#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \function_arg_advance (& (CUM), (MODE), (TYPE), (NAMED))/* Determine where to put an argument 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).  */extern struct rtx_def *function_arg ();#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \function_arg (& (CUM), (MODE), (TYPE), (NAMED), 0)/* Define where a function finds its arguments.   This is different from FUNCTION_ARG because of register windows.  */#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \function_arg (& (CUM), (MODE), (TYPE), (NAMED), 1)/* 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.  */extern int function_arg_partial_nregs ();#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \function_arg_partial_nregs (& (CUM), (MODE), (TYPE), (NAMED))/* A C expression that indicates when an argument must be passed by reference.   If nonzero for an argument, a copy of that argument is made in memory and a   pointer to the argument is passed instead of the argument itself.   The pointer is passed in whatever way is appropriate for passing a pointer   to that type.  */extern int function_arg_pass_by_reference ();#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \function_arg_pass_by_reference (& (CUM), (MODE), (TYPE), (NAMED))/* If defined, a C expression which determines whether, and in which direction,   to pad out an argument with extra space.  The value should be of type   `enum direction': either `upward' to pad above the argument,   `downward' to pad below, or `none' to inhibit padding.  */extern enum direction function_arg_padding ();#define FUNCTION_ARG_PADDING(MODE, TYPE) \function_arg_padding ((MODE), (TYPE))/* If defined, a C expression that gives the alignment boundary, in bits,   of an argument with the specified mode and type.  If it is not defined,   PARM_BOUNDARY is used for all arguments.   For sparc64, objects requiring 16 byte alignment are passed that way.  */#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \((TARGET_ARCH64					\  && (GET_MODE_ALIGNMENT (MODE) == 128		\      || ((TYPE) && TYPE_ALIGN (TYPE) == 128)))	\ ? 128 : PARM_BOUNDARY)/* Initialize data used by insn expanders.  This is called from   init_emit, once for each function, before code is generated.   For v9, clear the temp slot used by float/int DImode conversions.   ??? There is the 16 bytes at [%fp-16], however we'd like to delete this   space at some point.   ??? Use assign_stack_temp?  */extern void sparc_init_expanders ();extern struct rtx_def *sparc64_fpconv_stack_temp ();#define INIT_EXPANDERS sparc_init_expanders ()/* Define the information needed to generate branch and scc insns.  This is   stored from the compare operation.  Note that we can't use "rtx" here   since it hasn't been defined!  */extern struct rtx_def *sparc_compare_op0, *sparc_compare_op1;/* Define the function that build the compare insn for scc and bcc.  */extern struct rtx_def *gen_compare_reg ();/* This function handles all v9 scc insns */extern int gen_v9_scc ();/* Generate the special assembly code needed to tell the assembler whatever   it might need to know about the return value of a function.   For Sparc assemblers, we need to output a .proc pseudo-op which conveys   information to the assembler relating to peephole optimization (done in   the assembler).  */#define ASM_DECLARE_RESULT(FILE, RESULT) \  fprintf ((FILE), "\t.proc\t0%o\n", sparc_type_code (TREE_TYPE (RESULT)))/* Output the label for a function definition.  */#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\do {									\  ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));			\  ASM_OUTPUT_LABEL (FILE, NAME);					\} while (0)/* This macro generates the assembly code for function entry.   FILE is a stdio stream to output the code to.   SIZE is an int: how many units of temporary storage to allocate.   Refer to the array `regs_ever_live' to determine which registers   to save; `regs_ever_live[I]' is nonzero if register number I   is ever used in the function.  This macro is responsible for   knowing which registers should not be saved even if used.  *//* On SPARC, move-double insns between fpu and cpu need an 8-byte block   of memory.  If any fpu reg is used in the function, we allocate   such a block here, at the bottom of the frame, just in case it's needed.   If this function is a leaf procedure, then we may choose not   to do a "save" insn.  The decision about whether or not   to do this is made in regclass.c.  */extern int leaf_function;#define FUNCTION_PROLOGUE(FILE, SIZE) \  (TARGET_FLAT ? sparc_flat_output_function_prologue (FILE, SIZE) \   : output_function_prologue (FILE, SIZE, leaf_function))/* Output assembler code to FILE to increment profiler label # LABELNO   for profiling a function entry.   32 bit sparc uses %g2 as the STATIC_CHAIN_REGNUM which gets clobbered   during profiling so we need to save/restore it around the call to mcount.   We're guaranteed that a save has just been done, and we use the space   allocated for intreg/fpreg value passing.  */#define FUNCTION_PROFILER(FILE, LABELNO)  			\  do {								\    char buf[20];						\    ASM_GENERATE_INTERNAL_LABEL (buf, "LP", (LABELNO));		\    if (! TARGET_ARCH64)					\      fputs ("\tst %g2,[%fp-4]\n", FILE);			\    fputs ("\tsethi %hi(", FILE);				\    assemble_name (FILE, buf);					\    fputs ("),%o0\n", FILE);					\    fputs ("\tcall mcount\n\tadd %o0,%lo(", FILE);		\    assemble_name (FILE, buf);					\    fputs ("),%o0\n", FILE);					\    if (! TARGET_ARCH64)					\      fputs ("\tld [%fp-4],%g2\n", FILE);			\  } while (0)/* There are three profiling modes for basic blocks available.   The modes are selected at compile time by using the options   -a or -ax of the gnu compiler.   The variable `profile_block_flag' will be set according to the   selected option.

⌨️ 快捷键说明

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