📄 rs6000.h
字号:
#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 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 ? ALTIVEC_ARG_RETURN \ : TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_HARD_FLOAT \ ? 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 \ ? 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. 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_WIDEST_INT) int_size_in_bytes (TYPE) > 8))/* 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 *//* 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_ALTIVEC && \ (N) == ALTIVEC_ARG_RETURN))/* 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) < (unsigned)(GP_ARG_NUM_REG)) \ || (TARGET_ALTIVEC && \ (unsigned)((N) - ALTIVEC_ARG_MIN_REG) < (unsigned)(ALTIVEC_ARG_NUM_REG)) \ || ((unsigned)((N) - FP_ARG_MIN_REG) < (unsigned)(FP_ARG_NUM_REG)))/* A C structure for machine-specific, per-function data. This is added to the cfun structure. */typedef struct machine_function{ /* 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)/* Similar, but when scanning the definition of a procedure. We always set NARGS_PROTOTYPE large so we never return an EXPR_LIST. */#define INIT_CUMULATIVE_INCOMING_ARGS(CUM,FNTYPE,LIBNAME) \ init_cumulative_args (&CUM, FNTYPE, LIBNAME, TRUE)/* 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) \ function_arg_advance (&CUM, MODE, TYPE, NAMED)/* Non-zero if we can use a floating-point register to pass this arg. */#define USE_FP_FOR_ARG_P(CUM,MODE,TYPE) \ (GET_MODE_CLASS (MODE) == MODE_FLOAT \ && (CUM).fregno <= FP_ARG_MAX_REG \ && TARGET_HARD_FLOAT)/* Non-zero if we can use an AltiVec register to pass this arg. */#define USE_ALTIVEC_FOR_ARG_P(CUM,MODE,TYPE) \ (ALTIVEC_VECTOR_MODE (MODE) \ && (CUM).vregno <= ALTIVEC_ARG_MAX_REG \ && TARGET_ALTIVEC_ABI)/* 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). On RS/6000 the first eight words of non-FP are normally in registers and the rest are pushed. The first 13 FP args are in registers. If this is floating-point and no prototype is specified, we use both an FP and integer register (or possibly FP reg and stack). Library functions (when TYPE is zero) always have the proper types for args, so we can pass the FP value just in one register. emit_library_function doesn't support EXPR_LIST anyway. */#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ function_arg (&CUM, MODE, TYPE, NAMED)/* 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. */#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. */#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. */#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. */#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \ function_arg_boundary (MODE, TYPE)/* Perform any needed actions needed for a function that is receiving a variable number of arguments. CUM is as above. MODE and TYPE are the mode and type of the current parameter. PRETEND_SIZE is a variable that should be set to the amount of stack that must be pushed by the prolog to pretend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -