📄 i386.h
字号:
/* Put float CONST_DOUBLE in the constant pool instead of fp regs. QImode must go into class Q_REGS. Narrow ALL_REGS to GENERAL_REGS. This supports allowing movsf and movdf to do mem-to-mem moves through integer regs. */#define PREFERRED_RELOAD_CLASS(X,CLASS) \ (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode ? NO_REGS \ : GET_MODE (X) == QImode && ! reg_class_subset_p (CLASS, Q_REGS) ? Q_REGS \ : ((CLASS) == ALL_REGS \ && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) ? GENERAL_REGS \ : (CLASS))/* If we are copying between general and FP registers, we need a memory location. */#define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \ ((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \ || (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2)))/* Return the maximum number of consecutive registers needed to represent mode MODE in a register of class CLASS. *//* On the 80386, this is the size of MODE in words, except in the FP regs, where a single reg is always enough. */#define CLASS_MAX_NREGS(CLASS, MODE) \ (FLOAT_CLASS_P (CLASS) ? 1 : \ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))/* A C expression whose value is nonzero if pseudos that have been assigned to registers of class CLASS would likely be spilled because registers of CLASS are needed for spill registers. The default value of this macro returns 1 if CLASS has exactly one register and zero otherwise. On most machines, this default should be used. Only define this macro to some other expression if pseudo allocated by `local-alloc.c' end up in memory because their hard registers were needed for spill registers. If this macro returns nonzero for those classes, those pseudos will only be allocated by `global.c', which knows how to reallocate the pseudo to another register. If there would not be another register available for reallocation, you should not change the definition of this macro since the only effect of such a definition would be to slow down register allocation. */#define CLASS_LIKELY_SPILLED_P(CLASS) \ (((CLASS) == AREG) \ || ((CLASS) == DREG) \ || ((CLASS) == CREG) \ || ((CLASS) == BREG) \ || ((CLASS) == AD_REGS) \ || ((CLASS) == SIREG) \ || ((CLASS) == DIREG))/* Stack layout; function entry, exit and calling. *//* 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. */#define STARTING_FRAME_OFFSET 0/* If we generate an insn to push BYTES bytes, this says how many the stack pointer really advances by. On 386 pushw decrements by exactly 2 no matter what the position was. On the 386 there is no pushb; we use pushw instead, and this has the effect of rounding up to 2. */#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & (-2))/* Offset of first parameter from the argument pointer register value. */#define FIRST_PARM_OFFSET(FNDECL) 0/* 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. On the 80386, the RTD insn may be used to pop them if the number of args is fixed, but if the number is variable then the caller must pop them all. RTD can't be used for library calls now because the library is compiled with the Unix compiler. Use of RTD is a selectable option, since it is incompatible with standard Unix calling sequences. If the option is not selected, the caller must always pop the args. The attribute stdcall is equivalent to RTD on a per module basis. */#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \ (i386_return_pops_args (FUNDECL, FUNTYPE, SIZE))/* 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. */#define FUNCTION_VALUE(VALTYPE, FUNC) \ gen_rtx (REG, TYPE_MODE (VALTYPE), \ VALUE_REGNO (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, VALUE_REGNO (MODE))/* Define the size of the result block used for communication between untyped_call and untyped_return. The block contains a DImode value followed by the block used by fnsave and frstor. */#define APPLY_RESULT_SIZE (8+108)/* 1 if N is a possible register number for function argument passing. */#define FUNCTION_ARG_REGNO_P(N) ((N) >= 0 && (N) < REGPARM_MAX)/* 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. */typedef struct i386_args { int words; /* # words passed so far */ int nregs; /* # registers available for passing */ int regno; /* next available register number */} CUMULATIVE_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. */#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME) \ (init_cumulative_args (&CUM, FNTYPE, LIBNAME))/* 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))/* Define where to put the arguments 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). */#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))/* 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) \ function_prologue (FILE, SIZE)/* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. */#define FUNCTION_PROFILER(FILE, LABELNO) \{ \ if (flag_pic) \ { \ fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \ LPREFIX, (LABELNO)); \ fprintf (FILE, "\tcall *_mcount@GOT(%%ebx)\n"); \ } \ else \ { \ fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \ fprintf (FILE, "\tcall _mcount\n"); \ } \}/* A C statement or compound statement to output to FILE some assembler code to initialize basic-block profiling for the current object module. This code should call the subroutine `__bb_init_func' once per object module, passing it as its sole argument the address of a block allocated in the object module. The name of the block is a local symbol made with this statement: ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); Of course, since you are writing the definition of `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you can take a short cut in the definition of this macro and use the name that you know will result. The first word of this block is a flag which will be nonzero if the object module has already been initialized. So test this word first, and do not call `__bb_init_func' if the flag is nonzero. */#undef FUNCTION_BLOCK_PROFILER#define FUNCTION_BLOCK_PROFILER(STREAM, LABELNO) \do \ { \ static int num_func = 0; \ rtx xops[8]; \ char block_table[80], false_label[80]; \ \ ASM_GENERATE_INTERNAL_LABEL (block_table, "LPBX", 0); \ ASM_GENERATE_INTERNAL_LABEL (false_label, "LPBZ", num_func); \ \ xops[0] = const0_rtx; \ xops[1] = gen_rtx (SYMBOL_REF, VOIDmode, block_table); \ xops[2] = gen_rtx (MEM, Pmode, gen_rtx (SYMBOL_REF, VOIDmode, false_label)); \ xops[3] = gen_rtx (MEM, Pmode, gen_rtx (SYMBOL_REF, VOIDmode, "__bb_init_func")); \ xops[4] = gen_rtx (MEM, Pmode, xops[1]); \ xops[5] = stack_pointer_rtx; \ xops[6] = GEN_INT (4); \ xops[7] = gen_rtx (REG, Pmode, 0); /* eax */ \ \ CONSTANT_POOL_ADDRESS_P (xops[1]) = TRUE; \ CONSTANT_POOL_ADDRESS_P (xops[2]) = TRUE; \ \ output_asm_insn (AS2(cmp%L4,%0,%4), xops); \ output_asm_insn (AS1(jne,%2), xops); \ \ if (!flag_pic) \ output_asm_insn (AS1(push%L1,%1), xops); \ else \ { \ output_asm_insn (AS2 (lea%L7,%a1,%7), xops); \ output_asm_insn (AS1 (push%L7,%7), xops); \ } \ \ output_asm_insn (AS1(call,%P3), xops); \ output_asm_insn (AS2(add%L0,%6,%5), xops); \ ASM_OUTPUT_INTERNAL_LABEL (STREAM, "LPBZ", num_func); \ num_func++; \ } \while (0)/* A C statement or compound statement to increment the count associated with the basic block number BLOCKNO. Basic blocks are numbered separately from zero within each compilation. The count associated with block number BLOCKNO is at index BLOCKNO in a vector of words; the name of this array is a local symbol made with this statement: ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2); Of course, since you are writing the definition of `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you can take a short cut in the definition of this macro and use the name that you know will result. */#define BLOCK_PROFILER(STREAM, BLOCKNO) \do \ { \ rtx xops[1], cnt_rtx; \ char counts[80]; \ \ ASM_GENERATE_INTERNAL_LABEL (counts, "LPBX", 2); \ cnt_rtx = gen_rtx (SYMBOL_REF, VOIDmode, counts); \ SYMBOL_REF_FLAG (cnt_rtx) = TRUE; \ \ if (BLOCKNO) \ cnt_rtx = plus_constant (cnt_rtx, (BLOCKNO)*4); \ \ if (flag_pic) \ cnt_rtx = gen_rtx (PLUS, Pmode, pic_offset_table_rtx, cnt_rtx); \ \ xops[0] = gen_rtx (MEM, SImode, cnt_rtx); \ output_asm_insn (AS1(inc%L0,%0), xops); \ } \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. *//* Note on the 386 it might be more efficient not to define this since we have to restore it ourselves from the frame pointer, in order to use pop */#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. If the last non-note insn in the function is a BARRIER, then there is no need to emit a function prologue, because control does not fall off the end. This happens if the function ends in an "exit" call, or if a `return' insn is emitted directly into the function. */#define FUNCTION_EPILOGUE(FILE, SIZE) \do { \ rtx last = get_last_insn (); \ if (last && GET_CODE (last) == NOTE) \ last = prev_nonnote_insn (last); \ if (! last || GET_CODE (last) != BARRIER) \ function_epilogue (FILE, SIZE); \} while (0)/* Output assembler code for a block containing the constant parts of a trampoline, leaving space for the variable parts. *//* On the 386, the trampoline contains three instructions: mov #STATIC,ecx mov #FUNCTION,eax jmp @eax */#define TRAMPOLINE_TEMPLATE(FILE) \{ \ ASM_OUTPUT_CHAR (FILE, GEN_INT (0xb9)); \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -