📄 rs6000.h
字号:
function descriptors */ ABI_V4, /* System V.4/eabi */ ABI_DARWIN /* Apple's Darwin (OS X kernel) */};extern enum rs6000_abi rs6000_current_abi; /* available for use by subtarget *//* Structure used to define the rs6000 stack */typedef struct rs6000_stack { int first_gp_reg_save; /* first callee saved GP register used */ int first_fp_reg_save; /* first callee saved FP register used */ int first_altivec_reg_save; /* first callee saved AltiVec register used */ int lr_save_p; /* true if the link reg needs to be saved */ int cr_save_p; /* true if the CR reg needs to be saved */ unsigned int vrsave_mask; /* mask of vec registers to save */ int toc_save_p; /* true if the TOC needs to be saved */ int push_p; /* true if we need to allocate stack space */ int calls_p; /* true if the function makes any calls */ enum rs6000_abi abi; /* which ABI to use */ int gp_save_offset; /* offset to save GP regs from initial SP */ int fp_save_offset; /* offset to save FP regs from initial SP */ int altivec_save_offset; /* offset to save AltiVec regs from inital SP */ int lr_save_offset; /* offset to save LR from initial SP */ int cr_save_offset; /* offset to save CR from initial SP */ int vrsave_save_offset; /* offset to save VRSAVE from initial SP */ int spe_gp_save_offset; /* offset to save spe 64-bit gprs */ int toc_save_offset; /* offset to save the TOC pointer */ int varargs_save_offset; /* offset to save the varargs registers */ int ehrd_offset; /* offset to EH return data */ int reg_size; /* register size (4 or 8) */ int varargs_size; /* size to hold V.4 args passed in regs */ int vars_size; /* variable save area size */ int parm_size; /* outgoing parameter size */ int save_size; /* save area size */ int fixed_size; /* fixed size of stack frame */ int gp_size; /* size of saved GP registers */ int fp_size; /* size of saved FP registers */ int altivec_size; /* size of saved AltiVec registers */ int cr_size; /* size to hold CR if not in save_size */ int lr_size; /* size to hold LR if not in save_size */ int vrsave_size; /* size to hold VRSAVE if not in save_size */ int altivec_padding_size; /* size of altivec alignment padding if not in save_size */ int spe_gp_size; /* size of 64-bit GPR save size for SPE */ int spe_padding_size; int toc_size; /* size to hold TOC if not in save_size */ int total_size; /* total bytes allocated for stack */} rs6000_stack_t;/* 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. On the RS/6000, we grow upwards, from the area after the outgoing arguments. *//* #define FRAME_GROWS_DOWNWARD *//* Size of the outgoing register save area */#define RS6000_REG_SAVE ((DEFAULT_ABI == ABI_AIX \ || DEFAULT_ABI == ABI_AIX_NODESC \ || DEFAULT_ABI == ABI_DARWIN) \ ? (TARGET_64BIT ? 64 : 32) \ : 0)/* Size of the fixed area on the stack */#define RS6000_SAVE_AREA \ (((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_DARWIN) ? 24 : 8) \ << (TARGET_64BIT ? 1 : 0))/* MEM representing address to save the TOC register */#define RS6000_SAVE_TOC gen_rtx_MEM (Pmode, \ plus_constant (stack_pointer_rtx, \ (TARGET_32BIT ? 20 : 40)))/* Size of the V.4 varargs area if needed */#define RS6000_VARARGS_AREA 0/* Align an address */#define RS6000_ALIGN(n,a) (((n) + (a) - 1) & ~((a) - 1))/* Size of V.4 varargs area in bytes */#define RS6000_VARARGS_SIZE \ ((GP_ARG_NUM_REG * (TARGET_32BIT ? 4 : 8)) + (FP_ARG_NUM_REG * 8) + 8)/* 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. On the RS/6000, the frame pointer is the same as the stack pointer, except for dynamic allocations. So we start after the fixed area and outgoing parameter area. */#define STARTING_FRAME_OFFSET \ (RS6000_ALIGN (current_function_outgoing_args_size, \ TARGET_ALTIVEC ? 16 : 8) \ + RS6000_VARARGS_AREA \ + RS6000_SAVE_AREA)/* Offset from the stack pointer register to an item dynamically allocated on the stack, e.g., by `alloca'. The default value for this macro is `STACK_POINTER_OFFSET' plus the length of the outgoing arguments. The default is correct for most machines. See `function.c' for details. */#define STACK_DYNAMIC_OFFSET(FUNDECL) \ (RS6000_ALIGN (current_function_outgoing_args_size, \ TARGET_ALTIVEC ? 16 : 8) \ + (STACK_POINTER_OFFSET))/* If we generate an insn to push BYTES bytes, this says how many the stack pointer really advances by. On RS/6000, don't define this because there are no push insns. *//* #define PUSH_ROUNDING(BYTES) *//* Offset of first parameter from the argument pointer register value. On the RS/6000, we define the argument pointer to the start of the fixed area. */#define FIRST_PARM_OFFSET(FNDECL) RS6000_SAVE_AREA/* Offset from the argument pointer register value to the top of stack. This is different from FIRST_PARM_OFFSET because of the register save area. */#define ARG_POINTER_CFA_OFFSET(FNDECL) 0/* Define this if stack space is still allocated for a parameter passed in a register. The value is the number of bytes allocated to this area. */#define REG_PARM_STACK_SPACE(FNDECL) RS6000_REG_SAVE/* Define this if the above stack space is to be considered part of the space allocated by the caller. */#define OUTGOING_REG_PARM_STACK_SPACE/* This is the difference between the logical top of stack and the actual sp. For the RS/6000, sp points past the fixed area. */#define STACK_POINTER_OFFSET RS6000_SAVE_AREA/* Define this if the maximum size of all the outgoing args is to be accumulated and pushed during the prologue. The amount can be found in the variable current_function_outgoing_args_size. */#define ACCUMULATE_OUTGOING_ARGS 1/* 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/* 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 the SPE, both FPs and vectors are returned in r3. On RS/6000 an integer value is in r3 and a floating-point value is in fp1, unless -msoft-float. */#define FUNCTION_VALUE(VALTYPE, FUNC) \ gen_rtx_REG ((INTEGRAL_TYPE_P (VALTYPE) \ && TYPE_PRECISION (VALTYPE) < BITS_PER_WORD) \ || POINTER_TYPE_P (VALTYPE) \ ? word_mode : TYPE_MODE (VALTYPE), \ TREE_CODE (VALTYPE) == VECTOR_TYPE \ && TARGET_ALTIVEC ? ALTIVEC_ARG_RETURN \ : TREE_CODE (VALTYPE) == REAL_TYPE \ && TARGET_SPE_ABI && !TARGET_FPRS \ ? GP_ARG_RETURN \ : TREE_CODE (VALTYPE) == REAL_TYPE \ && TARGET_HARD_FLOAT && TARGET_FPRS \ ? FP_ARG_RETURN : GP_ARG_RETURN)/* 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, ALTIVEC_VECTOR_MODE (MODE) ? ALTIVEC_ARG_RETURN \ : GET_MODE_CLASS (MODE) == MODE_FLOAT \ && TARGET_HARD_FLOAT && TARGET_FPRS \ ? FP_ARG_RETURN : GP_ARG_RETURN)/* The AIX ABI for the RS/6000 specifies that all structures are returned in memory. The Darwin ABI does the same. The SVR4 ABI specifies that structures <= 8 bytes are returned in r3/r4, but a draft put them in memory, and GCC used to implement the draft instead of the final standard. Therefore, TARGET_AIX_STRUCT_RET controls this instead of DEFAULT_ABI; V.4 targets needing backward compatibility can change DRAFT_V4_STRUCT_RET to override the default, and -m switches get the final word. See rs6000_override_options for more details. The PPC32 SVR4 ABI uses IEEE double extended for long double, if 128-bit long double support is enabled. These values are returned in memory. int_size_in_bytes returns -1 for variable size objects, which go in memory always. The cast to unsigned makes -1 > 8. */#define RETURN_IN_MEMORY(TYPE) \ ((AGGREGATE_TYPE_P (TYPE) \ && (TARGET_AIX_STRUCT_RET \ || (unsigned HOST_WIDE_INT) int_size_in_bytes (TYPE) > 8)) \ || (DEFAULT_ABI == ABI_V4 && TYPE_MODE (TYPE) == TFmode))/* DRAFT_V4_STRUCT_RET defaults off. */#define DRAFT_V4_STRUCT_RET 0/* Let RETURN_IN_MEMORY control what happens. */#define DEFAULT_PCC_STRUCT_RETURN 0/* Mode of stack savearea. FUNCTION is VOIDmode because calling convention maintains SP. BLOCK needs Pmode for SP. NONLOCAL needs twice Pmode to maintain both backchain and SP. */#define STACK_SAVEAREA_MODE(LEVEL) \ (LEVEL == SAVE_FUNCTION ? VOIDmode \ : LEVEL == SAVE_NONLOCAL ? (TARGET_32BIT ? DImode : TImode) : Pmode)/* Minimum and maximum general purpose registers used to hold arguments. */#define GP_ARG_MIN_REG 3#define GP_ARG_MAX_REG 10#define GP_ARG_NUM_REG (GP_ARG_MAX_REG - GP_ARG_MIN_REG + 1)/* Minimum and maximum floating point registers used to hold arguments. */#define FP_ARG_MIN_REG 33#define FP_ARG_AIX_MAX_REG 45#define FP_ARG_V4_MAX_REG 40#define FP_ARG_MAX_REG ((DEFAULT_ABI == ABI_AIX \ || DEFAULT_ABI == ABI_AIX_NODESC \ || DEFAULT_ABI == ABI_DARWIN) \ ? FP_ARG_AIX_MAX_REG : FP_ARG_V4_MAX_REG)#define FP_ARG_NUM_REG (FP_ARG_MAX_REG - FP_ARG_MIN_REG + 1)/* Minimum and maximum AltiVec registers used to hold arguments. */#define ALTIVEC_ARG_MIN_REG (FIRST_ALTIVEC_REGNO + 2)#define ALTIVEC_ARG_MAX_REG (ALTIVEC_ARG_MIN_REG + 11)#define ALTIVEC_ARG_NUM_REG (ALTIVEC_ARG_MAX_REG - ALTIVEC_ARG_MIN_REG + 1)/* Return registers */#define GP_ARG_RETURN GP_ARG_MIN_REG#define FP_ARG_RETURN FP_ARG_MIN_REG#define ALTIVEC_ARG_RETURN (FIRST_ALTIVEC_REGNO + 2)/* Flags for the call/call_value rtl operations set up by function_arg */#define CALL_NORMAL 0x00000000 /* no special processing *//* Bits in 0x00000001 are unused. */#define CALL_V4_CLEAR_FP_ARGS 0x00000002 /* V.4, no FP args passed */#define CALL_V4_SET_FP_ARGS 0x00000004 /* V.4, FP args were passed */#define CALL_LONG 0x00000008 /* always call indirect */#define CALL_LIBCALL 0x00000010 /* libcall *//* 1 if N is a possible register number for a function value as seen by the caller. On RS/6000, this is r3, fp1, and v2 (for AltiVec). */#define FUNCTION_VALUE_REGNO_P(N) \ ((N) == GP_ARG_RETURN \ || ((N) == FP_ARG_RETURN && TARGET_HARD_FLOAT) \ || ((N) == ALTIVEC_ARG_RETURN && TARGET_ALTIVEC))/* 1 if N is a possible register number for function argument passing. On RS/6000, these are r3-r10 and fp1-fp13. On AltiVec, v2 - v13 are used for passing vectors. */#define FUNCTION_ARG_REGNO_P(N) \ ((unsigned) (N) - GP_ARG_MIN_REG < GP_ARG_NUM_REG \ || ((unsigned) (N) - ALTIVEC_ARG_MIN_REG < ALTIVEC_ARG_NUM_REG \ && TARGET_ALTIVEC) \ || ((unsigned) (N) - FP_ARG_MIN_REG < FP_ARG_NUM_REG \ && TARGET_HARD_FLOAT))/* A C structure for machine-specific, per-function data. This is added to the cfun structure. */typedef struct machine_function GTY(()){ /* Whether a System V.4 varargs area was created. */ int sysv_varargs_p; /* Flags if __builtin_return_address (n) with n >= 1 was used. */ int ra_needs_full_frame;} machine_function;/* 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 the RS/6000, this is a structure. The first element is the number of total argument words, the second is used to store the next floating-point register number, and the third says how many more args we have prototype types for. For ABI_V4, we treat these slightly differently -- `sysv_gregno' is the next availible GP register, `fregno' is the next available FP register, and `words' is the number of words used on the stack. The varargs/stdarg support requires that this structure's size be a multiple of sizeof(int). */typedef struct rs6000_args{ int words; /* # words used for passing GP registers */ int fregno; /* next available FP register */ int vregno; /* next available AltiVec register */ int nargs_prototype; /* # args left in the current prototype */ int orig_nargs; /* Original value of nargs_prototype */ int prototype; /* Whether a prototype was defined */ int call_cookie; /* Do special things for this call */ int sysv_gregno; /* next available GP register */} CUMULATIVE_ARGS;/* Define intermediate macro to compute the size (in registers) of an argument for the RS/6000. */#define RS6000_ARG_SIZE(MODE, TYPE) \((MODE) != BLKmode \ ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \ : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)/* 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. */#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \ init_cumulative_args (&CUM, FNTYPE, LIBNAME, FALSE, FALSE)/* Similar, but when scanning the definition of a procedure. We always set NARGS_PROTOTYPE large so we never return an EXPR_LIST.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -