📄 i386.h
字号:
|| ((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,INDIRECT) \ (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 is invoked just before the start of a function. It is used here to output code for -fpic that will load the return address into %ebx. */#undef ASM_OUTPUT_FUNCTION_PREFIX#define ASM_OUTPUT_FUNCTION_PREFIX(FILE, FNNAME) \ asm_output_function_prefix (FILE, FNNAME)/* 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"); \ } \}/* There are three profiling modes for basic blocks available. The modes are selected at compile time by using the options -a or -ax of the gnu compiler. The variable `profile_block_flag' will be set according to the selected option. profile_block_flag == 0, no option used: No profiling done. profile_block_flag == 1, -a option used. Count frequency of execution of every basic block. profile_block_flag == 2, -ax option used. Generate code to allow several different profiling modes at run time. Available modes are: Produce a trace of all basic blocks. Count frequency of jump instructions executed. In every mode it is possible to start profiling upon entering certain functions and to disable profiling of some other functions. The result of basic-block profiling will be written to a file `bb.out'. If the -ax option is used parameters for the profiling will be read from file `bb.in'.*//* The following macro shall output assembler code to FILE to initialize basic-block profiling. If profile_block_flag == 2 Output code to call the subroutine `__bb_init_trace_func' and pass two parameters to it. The first parameter is the address of a block allocated in the object module. The second parameter is the number of the first basic block of the function. 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 number of the first basic block of the function is passed to the macro in BLOCK_OR_LABEL. If described in a virtual assembler language the code to be output looks like: parameter1 <- LPBX0 parameter2 <- BLOCK_OR_LABEL call __bb_init_trace_func else if profile_block_flag != 0 Output code to call the subroutine `__bb_init_func' and pass one single parameter to it, which is the same as the first parameter to `__bb_init_trace_func'. The first word of this parameter 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. Note: When profile_block_flag == 2 the test need not be done but `__bb_init_trace_func' *must* be called. BLOCK_OR_LABEL may be used to generate a label number as a branch destination in case `__bb_init_func' will not be called. If described in a virtual assembler language the code to be output looks like: cmp (LPBX0),0 jne local_label parameter1 <- LPBX0 call __bb_init_funclocal_label:*/#undef FUNCTION_BLOCK_PROFILER#define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \do \ { \ static int num_func = 0; \ rtx xops[8]; \ char block_table[80], false_label[80]; \ \ ASM_GENERATE_INTERNAL_LABEL (block_table, "LPBX", 0); \ \ xops[1] = gen_rtx_SYMBOL_REF (VOIDmode, block_table); \ xops[5] = stack_pointer_rtx; \ xops[7] = gen_rtx_REG (Pmode, 0); /* eax */ \ \ CONSTANT_POOL_ADDRESS_P (xops[1]) = TRUE; \ \ switch (profile_block_flag) \ { \ \ case 2: \ \ xops[2] = GEN_INT ((BLOCK_OR_LABEL)); \ xops[3] = gen_rtx_MEM (Pmode, gen_rtx_SYMBOL_REF (VOIDmode, "__bb_init_trace_func")); \ xops[6] = GEN_INT (8); \ \ output_asm_insn (AS1(push%L2,%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); \ \ break; \ \ default: \ \ ASM_GENERATE_INTERNAL_LABEL (false_label, "LPBZ", num_func); \ \ xops[0] = const0_rtx; \ 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[6] = GEN_INT (4); \ \ 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 (FILE, "LPBZ", num_func); \ num_func++; \ \ break; \ \ } \ } \while (0)/* The following macro shall output assembler code to FILE to increment a counter associated with basic block number BLOCKNO. If profile_block_flag == 2 Output code to initialize the global structure `__bb' and call the function `__bb_trace_func' which will increment the counter. `__bb' consists of two words. In the first word the number of the basic block has to be stored. In the second word the address of a block allocated in the object module
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -