📄 rs6000.h
字号:
For the RS/6000, any structure or union type is returned in memory, except for Solaris, which returns structures <= 8 bytes in registers. */#define RETURN_IN_MEMORY(TYPE) \ (TYPE_MODE (TYPE) == BLKmode \ && (DEFAULT_ABI != ABI_SOLARIS || int_size_in_bytes (TYPE) > 8))/* 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 FP_ARG_AIX_MAX_REG#define FP_ARG_NUM_REG (FP_ARG_MAX_REG - FP_ARG_MIN_REG + 1)/* Return registers */#define GP_ARG_RETURN GP_ARG_MIN_REG#define FP_ARG_RETURN FP_ARG_MIN_REG/* Flags for the call/call_value rtl operations set up by function_arg */#define CALL_NORMAL 0x00000000 /* no special processing */#define CALL_NT_DLLIMPORT 0x00000001 /* NT, this is a DLL import call */#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 cutoff for using external functions to save floating point */#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)/* 1 if N is a possible register number for a function value as seen by the caller. On RS/6000, this is r3 and fp1. */#define FUNCTION_VALUE_REGNO_P(N) ((N) == GP_ARG_RETURN || ((N) == FP_ARG_RETURN))/* 1 if N is a possible register number for function argument passing. On RS/6000, these are r3-r10 and fp1-fp13. */#define FUNCTION_ARG_REGNO_P(N) \ (((unsigned)((N) - GP_ARG_MIN_REG) < (unsigned)(GP_ARG_NUM_REG)) \ || ((unsigned)((N) - FP_ARG_MIN_REG) < (unsigned)(FP_ARG_NUM_REG)))/* 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 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, NAMED) \(! (NAMED) ? 0 \ : (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)/* 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) \ (enum direction) 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 that our caller pushed it. Normally, this macro will push all remaining incoming registers on the stack and set PRETEND_SIZE to the length of the registers pushed. */#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \ setup_incoming_varargs (&CUM, MODE, TYPE, &PRETEND_SIZE, NO_RTL)/* If defined, is a C expression that produces the machine-specific code for a call to `__builtin_saveregs'. This code will be moved to the very beginning of the function, before any parameter access are made. The return value of this function should be an RTX that contains the value to use as the return of `__builtin_saveregs'. The argument ARGS is a `tree_list' containing the arguments that were passed to `__builtin_saveregs'. If this macro is not defined, the compiler will output an ordinary call to the library function `__builtin_saveregs'. */#define EXPAND_BUILTIN_SAVEREGS(ARGS) \ expand_builtin_saveregs (ARGS)/* 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. */#define FUNCTION_PROLOGUE(FILE, SIZE) output_prolog (FILE, SIZE)/* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. */#define FUNCTION_PROFILER(FILE, LABELNO) \ output_function_profiler ((FILE), (LABELNO));/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, the stack pointer does not matter. No definition is equivalent to always zero. On the RS/6000, this is non-zero because we can restore the stack from its backpointer, which we maintain. */#define EXIT_IGNORE_STACK 1/* This macro generates the assembly code for function exit, on machines that need it. If FUNCTION_EPILOGUE is not defined then individual return instructions are generated for each return statement. Args are same as for FUNCTION_PROLOGUE. The function epilogue should not depend on the current stack pointer! It should use the frame pointer only. This is mandatory because of alloca; we also take advantage of it to omit stack adjustments before returning. */#define FUNCTION_EPILOGUE(FILE, SIZE) output_epilog (FILE, SIZE)/* A C compound statement that outputs the assembler code for a thunk function, used to implement C++ virtual function calls with multiple inheritance. The thunk acts as a wrapper around a virtual function, adjusting the implicit object parameter before handing control off to the real function. First, emit code to add the integer DELTA to the location that contains the incoming first argument. Assume that this argument contains a pointer, and is the one used to pass the `this' pointer in C++. This is the incoming argument *before* the function prologue, e.g. `%o0' on a sparc. The addition must preserve the values of all other incoming arguments. After the addition, emit code to jump to FUNCTION, which is a `FUNCTION_DECL'. This is a direct pure jump, not a call, and does not touch the return address. Hence returning from FUNCTION will return to whoever called the current `thunk'. The effect must be as if FUNCTION had been called directly with the adjusted first argument. This macro is responsible for emitting all of the code for a thunk function; `FUNCTION_PROLOGUE' and `FUNCTION_EPILOGUE' are not invoked. The THUNK_FNDECL is redundant. (DELTA and FUNCTION have already been extracted from it.) It might possibly be useful on some targets, but probably not. If you do not define this macro, the target-independent code in the C++ frontend will generate a less efficient heavyweight thunk that calls FUNCTION instead of jumping to it. The generic approach does not support varargs. */#if TARGET_ELF#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ output_mi_thunk (FILE, THUNK_FNDECL, DELTA, FUNCTION)#endif/* TRAMPOLINE_TEMPLATE deleted *//* Length in units of the trampoline for entering a nested function. */#define TRAMPOLINE_SIZE rs6000_trampoline_size ()/* 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(ADDR, FNADDR, CXT) \ rs6000_initialize_trampoline (ADDR, FNADDR, CXT)/* If defined, a C expression whose value is nonzero if IDENTIFIER with arguments ARGS is a valid machine specific attribute for DECL. The attributes in ATTRIBUTES have previously been assigned to DECL. */#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \ (rs6000_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))/* If defined, a C expression whose value is nonzero if IDENTIFIER with arguments ARGS is a valid machine specific attribute for TYPE. The attributes in ATTRIBUTES have previously been assigned to TYPE. */#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \ (rs6000_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))/* If defined, a C expression whose value is zero if the attributes on TYPE1 and TYPE2 are incompatible, one if they are compatible, and two if they are nearly compatible (which causes a warning to be generated). */#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \ (rs6000_comp_type_attributes (TYPE1, TYPE2))/* If defined, a C statement that assigns default attributes to newly defined TYPE. */#define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \ (rs6000_set_default_type_attributes (TYPE))/* Definitions for __builtin_return_address and __builtin_frame_address. __builtin_return_address (0) should give link register (65), enable this. *//* This should be uncommented, so that the link register is used, but currently this would result in unmatched insns and spilling fixed registers so we'll leave it for another day. When these problems are taken care of one additional fetch will be necessary in RETURN_ADDR_RTX. (mrs) *//* #define RETURN_ADDR_IN_PREVIOUS_FRAME *//* Number of bytes into the frame return addresses can be found. See rs6000_stack_info in rs6000.c for more information on how the different abi's store the return address. */#define RETURN_ADDRESS_OFFSET \ ((DEFAULT_ABI == ABI_AIX \ || DEFAULT_ABI == ABI_AIX_NODESC) ? 8 : \ (DEFAULT_ABI == ABI_V4 \ || DEFAULT_ABI == ABI_SOLARIS) ? (TARGET_32BIT ? 4 : 8) : \ (DEFAULT_ABI == ABI_NT) ? -4 : \ (fatal ("RETURN_ADDR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -