📄 alpha.h
字号:
Frame pointer elimination is automatically handled. All eliminations are valid since the cases where FP can't be eliminated are already handled. */#define CAN_ELIMINATE(FROM, TO) 1/* Round up to a multiple of 16 bytes. */#define ALPHA_ROUND(X) (((X) + 15) & ~ 15)/* Define the offset between two registers, one to be eliminated, and the other its replacement, at the start of a routine. */#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \{ if ((FROM) == FRAME_POINTER_REGNUM) \ (OFFSET) = (ALPHA_ROUND (current_function_outgoing_args_size) \ + alpha_sa_size ()); \ else if ((FROM) == ARG_POINTER_REGNUM) \ (OFFSET) = (ALPHA_ROUND (current_function_outgoing_args_size) \ + alpha_sa_size () \ + (ALPHA_ROUND (get_frame_size () \ + current_function_pretend_args_size) \ - current_function_pretend_args_size)); \}/* Define this if stack space is still allocated for a parameter passed in a register. *//* #define REG_PARM_STACK_SPACE *//* 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 Alpha the value is found in $0 for integer functions and $f0 for floating-point functions. */#define FUNCTION_VALUE(VALTYPE, FUNC) \ gen_rtx (REG, \ (INTEGRAL_MODE_P (TYPE_MODE (VALTYPE)) \ && TYPE_PRECISION (VALTYPE) < BITS_PER_WORD) \ ? word_mode : TYPE_MODE (VALTYPE), \ TARGET_FPREGS && TREE_CODE (VALTYPE) == REAL_TYPE ? 32 : 0)/* 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, \ TARGET_FPREGS && GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 : 0)/* The definition of this macro implies that there are cases where a scalar value cannot be returned in registers. For the Alpha, any structure or union type is returned in memory, as are integers whose size is larger than 64 bits. */#define RETURN_IN_MEMORY(TYPE) \ (TYPE_MODE (TYPE) == BLKmode \ || (TREE_CODE (TYPE) == INTEGER_TYPE && TYPE_PRECISION (TYPE) > 64))/* 1 if N is a possible register number for a function value as seen by the caller. */#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N) == 32)/* 1 if N is a possible register number for function argument passing. On Alpha, these are $16-$21 and $f16-$f21. */#define FUNCTION_ARG_REGNO_P(N) \ (((N) >= 16 && (N) <= 21) || ((N) >= 16 + 32 && (N) <= 21 + 32))/* 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 Alpha, this is a single integer, which is a number of words of arguments scanned so far. Thus 6 or more means all following args should go on the stack. */#define CUMULATIVE_ARGS int/* 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) (CUM) = 0/* Define intermediate macro to compute the size (in registers) of an argument for the Alpha. */#define ALPHA_ARG_SIZE(MODE, TYPE, NAMED) \((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)/* 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) \ if (MUST_PASS_IN_STACK (MODE, TYPE)) \ (CUM) = 6; \ else \ (CUM) += ALPHA_ARG_SIZE (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). On Alpha the first 6 words of args are normally in registers and the rest are pushed. */#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \((CUM) < 6 && ! MUST_PASS_IN_STACK (MODE, TYPE) \ ? gen_rtx(REG, (MODE), \ (CUM) + 16 + ((TARGET_FPREGS \ && (GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \ || GET_MODE_CLASS (MODE) == MODE_FLOAT)) \ * 32)) \ : 0)/* Specify the padding direction of arguments. On the Alpha, we must pad upwards in order to be able to pass args in registers. */#define FUNCTION_ARG_PADDING(MODE, TYPE) upward/* 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) \((CUM) < 6 && 6 < (CUM) + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \ ? 6 - (CUM) : 0)/* 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. On the Alpha, we allocate space for all 12 arg registers, but only push those that are remaining. However, if NO registers need to be saved, don't allocate any space. This is not only because we won't need the space, but because AP includes the current_pretend_args_size and we don't want to mess up any ap-relative addresses already made. If we are not to use the floating-point registers, save the integer registers where we would put the floating-point registers. This is not the most efficient way to implement varargs with just one register class, but it isn't worth doing anything more efficient in this rare case. */ #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \{ if ((CUM) < 6) \ { \ if (! (NO_RTL)) \ { \ move_block_from_reg \ (16 + CUM, \ gen_rtx (MEM, BLKmode, \ plus_constant (virtual_incoming_args_rtx, \ ((CUM) + 6)* UNITS_PER_WORD)), \ 6 - (CUM), (6 - (CUM)) * UNITS_PER_WORD); \ move_block_from_reg \ (16 + (TARGET_FPREGS ? 32 : 0) + CUM, \ gen_rtx (MEM, BLKmode, \ plus_constant (virtual_incoming_args_rtx, \ (CUM) * UNITS_PER_WORD)), \ 6 - (CUM), (6 - (CUM)) * UNITS_PER_WORD); \ } \ PRETEND_SIZE = 12 * UNITS_PER_WORD; \ } \}/* Try to output insns to set TARGET equal to the constant C if it can be done in less than N insns. Do all computations in MODE. Returns the place where the output has been placed if it can be done and the insns have been emitted. If it would take more than N insns, zero is returned and no insns and emitted. */extern struct rtx_def *alpha_emit_set_const ();/* Generate necessary RTL for __builtin_saveregs(). ARGLIST is the argument list; see expr.c. */extern struct rtx_def *alpha_builtin_saveregs ();#define EXPAND_BUILTIN_SAVEREGS(ARGLIST) alpha_builtin_saveregs (ARGLIST)/* 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 *alpha_compare_op0, *alpha_compare_op1;extern int alpha_compare_fp_p;/* This macro produces the initial definition of a function name. On the Alpha, we need to save the function name for the prologue and epilogue. */extern char *alpha_function_name;#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \{ \ alpha_function_name = NAME; \} /* 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. Under OSF/1, profiling is enabled by simply passing -pg to the assembler and linker. */#define FUNCTION_PROFILER(FILE, LABELNO)/* Output assembler code to FILE to initialize this source file's basic block profiling info, if that has not already been done. This assumes that __bb_init_func doesn't garble a1-a5. */#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \ do { \ ASM_OUTPUT_REG_PUSH (FILE, 16); \ fputs ("\tlda $16,$PBX32\n", (FILE)); \ fputs ("\tldq $26,0($16)\n", (FILE)); \ fputs ("\tbne $26,1f\n", (FILE)); \ fputs ("\tlda $27,__bb_init_func\n", (FILE)); \ fputs ("\tjsr $26,($27),__bb_init_func\n", (FILE)); \ fputs ("\tldgp $29,0($26)\n", (FILE)); \ fputs ("1:\n", (FILE)); \ ASM_OUTPUT_REG_POP (FILE, 16); \ } while (0);/* Output assembler code to FILE to increment the entry-count for the BLOCKNO'th basic block in this source file. */#define BLOCK_PROFILER(FILE, BLOCKNO) \ do { \ int blockn = (BLOCKNO); \ fputs ("\tsubq $30,16,$30\n", (FILE)); \ fputs ("\tstq $26,0($30)\n", (FILE)); \ fputs ("\tstq $27,8($30)\n", (FILE)); \ fputs ("\tlda $26,$PBX34\n", (FILE)); \ fprintf ((FILE), "\tldq $27,%d($26)\n", 8*blockn); \ fputs ("\taddq $27,1,$27\n", (FILE)); \ fprintf ((FILE), "\tstq $27,%d($26)\n", 8*blockn); \ fputs ("\tldq $26,0($30)\n", (FILE)); \ fputs ("\tldq $27,8($30)\n", (FILE)); \ fputs ("\taddq $30,16,$30\n", (FILE)); \ } while (0)/* 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/* 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)/* Output assembler code for a block containing the constant parts of a trampoline, leaving space for the variable parts. The trampoline should set the static chain pointer to value placed into the trampoline and should branch to the specified routine. Note that $27 has been set to the address of the trampoline, so we can use it for addressability of the two data items. Trampolines are always aligned to FUNCTION_BOUNDARY, which is 64 bits. */#define TRAMPOLINE_TEMPLATE(FILE) \{ \ fprintf (FILE, "\tldq $1,24($27)\n"); \ fprintf (FILE, "\tldq $27,16($27)\n"); \ fprintf (FILE, "\tjmp $31,($27),0\n"); \ fprintf (FILE, "\tnop\n"); \ fprintf (FILE, "\t.quad 0,0\n"); \}/* Section in which to place the trampoline. On Alpha, instructions may only be placed in a text segment. */#define TRAMPOLINE_SECTION text_section/* Length in units of the trampoline for entering a nested function. */#define TRAMPOLINE_SIZE 32/* 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. We assume here that a function will be called many more times than its address is taken (e.g., it might be passed to qsort), so we take the trouble to initialize the "hint" field in the JMP insn. Note that the hint field is PC (new) + 4 * bits 13:0. */#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \{ \ rtx _temp, _temp1, _addr; \ \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -