⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 i386.h

📁 早期freebsd实现
💻 H
📖 第 1 页 / 共 4 页
字号:
/* Definitions of target machine for GNU compiler for Intel 80386.   Copyright (C) 1988, 1992 Free Software Foundation, Inc.This file is part of GNU CC.GNU CC is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU CC is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU CC; see the file COPYING.  If not, write tothe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  *//* The purpose of this file is to define the characteristics of the i386,   independent of assembler syntax or operating system.   Three other files build on this one to describe a specific assembler syntax:   bsd386.h, att386.h, and sun386.h.   The actual tm.h file for a particular system should include   this file, and then the file for the appropriate assembler syntax.   Many macros that specify assembler syntax are omitted entirely from   this file because they really belong in the files for particular   assemblers.  These include AS1, AS2, AS3, RP, IP, LPREFIX, L_SIZE,   PUT_OP_SIZE, USE_STAR, ADDR_BEG, ADDR_END, PRINT_IREG, PRINT_SCALE,   PRINT_B_I_S, and many that start with ASM_ or end in ASM_OP.  *//* Names to predefine in the preprocessor for this target machine.  */#define I386 1/* Stubs for half-pic support if not OSF/1 reference platform.  */#ifndef HALF_PIC_P#define HALF_PIC_P() 0#define HALF_PIC_NUMBER_PTRS 0#define HALF_PIC_NUMBER_REFS 0#define HALF_PIC_ENCODE(DECL)#define HALF_PIC_DECLARE(NAME)#define HALF_PIC_INIT()	error ("half-pic init called on systems that don't support it.")#define HALF_PIC_ADDRESS_P(X) 0#define HALF_PIC_PTR(X) X#define HALF_PIC_FINISH(STREAM)#endif/* Run-time compilation parameters selecting different hardware subsets.  */extern int target_flags;/* Macros used in the machine description to test the flags.  *//* configure can arrage to make this 2, to force a 486.  */#ifndef TARGET_CPU_DEFAULT#define TARGET_CPU_DEFAULT 0#endif/* Compile 80387 insns for floating point (not library calls).  */#define TARGET_80387 (target_flags & 1)/* Compile code for an i486. */#define TARGET_486 (target_flags & 2)/* Compile using ret insn that pops args.   This will not work unless you use prototypes at least   for all functions that can take varying numbers of args.  */  #define TARGET_RTD (target_flags & 8)/* Compile passing first two args in regs 0 and 1.   This exists only to test compiler features that will   be needed for RISC chips.  It is not usable   and is not intended to be usable on this cpu.  */#define TARGET_REGPARM (target_flags & 020)/* Put uninitialized locals into bss, not data.   Meaningful only on svr3.  */#define TARGET_SVR3_SHLIB (target_flags & 040)/* Use IEEE floating point comparisons.  These handle correctly the cases   where the result of a comparison is unordered.  Normally SIGFPE is   generated in such cases, in which case this isn't needed.  */#define TARGET_IEEE_FP (target_flags & 0100)/* Functions that return a floating point value may return that value   in the 387 FPU or in 386 integer registers.  If set, this flag causes   the 387 to be used, which is compatible with most calling conventions. */#define TARGET_FLOAT_RETURNS_IN_80387 (target_flags & 0200)/* Macro to define tables used to set the flags.   This is a list in braces of pairs in braces,   each pair being { "NAME", VALUE }   where VALUE is the bits to set or minus the bits to clear.   An empty string NAME is used to identify the default VALUE.  */#define TARGET_SWITCHES  \  { { "80387", 1},				\    { "no-80387", -1},				\    { "soft-float", -1},			\    { "no-soft-float", 1},			\    { "486", 2},				\    { "no-486", -2},				\    { "386", -2},				\    { "rtd", 8},				\    { "no-rtd", -8},				\    { "regparm", 020},				\    { "no-regparm", -020},			\    { "svr3-shlib", 040},			\    { "no-svr3-shlib", -040},			\    { "ieee-fp", 0100},				\    { "no-ieee-fp", -0100},			\    { "fp-ret-in-387", 0200},			\    { "no-fp-ret-in-387", -0200},		\    SUBTARGET_SWITCHES                          \    { "", TARGET_DEFAULT | TARGET_CPU_DEFAULT}}/* This is meant to be redefined in the host dependent files */#define SUBTARGET_SWITCHES/* target machine storage layout *//* Define this if most significant byte of a word is the lowest numbered.  *//* That is true on the 80386.  */#define BITS_BIG_ENDIAN 0/* Define this if most significant byte of a word is the lowest numbered.  *//* That is not true on the 80386.  */#define BYTES_BIG_ENDIAN 0/* Define this if most significant word of a multiword number is the lowest   numbered.  *//* Not true for 80386 */#define WORDS_BIG_ENDIAN 0/* number of bits in an addressable storage unit */#define BITS_PER_UNIT 8/* Width in bits of a "word", which is the contents of a machine register.   Note that this is not necessarily the width of data type `int';   if using 16-bit ints on a 80386, this would still be 32.   But on a machine with 16-bit registers, this would be 16.  */#define BITS_PER_WORD 32/* Width of a word, in units (bytes).  */#define UNITS_PER_WORD 4/* Width in bits of a pointer.   See also the macro `Pmode' defined below.  */#define POINTER_SIZE 32/* Allocation boundary (in *bits*) for storing arguments in argument list.  */#define PARM_BOUNDARY 32/* Boundary (in *bits*) on which stack pointer should be aligned.  */#define STACK_BOUNDARY 32/* Allocation boundary (in *bits*) for the code of a function.   For i486, we get better performance by aligning to a cache   line (i.e. 16 byte) boundary.  */#define FUNCTION_BOUNDARY (TARGET_486 ? 128 : 32)/* Alignment of field after `int : 0' in a structure. */#define EMPTY_FIELD_BOUNDARY 32/* Minimum size in bits of the largest boundary to which any   and all fundamental data types supported by the hardware   might need to be aligned. No data type wants to be aligned   rounder than this.  The i386 supports 64-bit floating point   quantities, but these can be aligned on any 32-bit boundary.  */#define BIGGEST_ALIGNMENT 32/* Set this non-zero if move instructions will actually fail to work   when given unaligned data.  */#define STRICT_ALIGNMENT 0/* If bit field type is int, don't let it cross an int,   and give entire struct the alignment of an int.  *//* Required on the 386 since it doesn't have bitfield insns.  */#define PCC_BITFIELD_TYPE_MATTERS 1/* Align loop starts for optimal branching.  */#define ASM_OUTPUT_LOOP_ALIGN(FILE) \  ASM_OUTPUT_ALIGN (FILE, 2)/* This is how to align an instruction for optimal branching.   On i486 we'll get better performance by aligning on a   cache line (i.e. 16 byte) boundary.  */#define ASM_OUTPUT_ALIGN_CODE(FILE)	\  ASM_OUTPUT_ALIGN ((FILE), (TARGET_486 ? 4 : 2))/* Standard register usage.  *//* This processor has special stack-like registers.  See reg-stack.c   for details. */#define STACK_REGS/* Number of actual hardware registers.   The hardware registers are assigned numbers for the compiler   from 0 to just below FIRST_PSEUDO_REGISTER.   All registers that the compiler knows about must be given numbers,   even those that are not normally considered general registers.   In the 80386 we give the 8 general purpose registers the numbers 0-7.   We number the floating point registers 8-15.   Note that registers 0-7 can be accessed as a  short or int,   while only 0-3 may be used with byte `mov' instructions.   Reg 16 does not correspond to any hardware register, but instead   appears in the RTL as an argument pointer prior to reload, and is   eliminated during reloading in favor of either the stack or frame   pointer. */#define FIRST_PSEUDO_REGISTER 17/* 1 for registers that have pervasive standard uses   and are not available for the register allocator.   On the 80386, the stack pointer is such, as is the arg pointer. */#define FIXED_REGISTERS \/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/       \{  0, 0, 0, 0, 0, 0, 0, 1, 0,  0,  0,  0,  0,  0,  0,  0,  1 }/* 1 for registers not available across function calls.   These must include the FIXED_REGISTERS and also any   registers that can be used without being saved.   The latter must include the registers where values are returned   and the register where structure-value addresses are passed.   Aside from that, you can include as many other registers as you like.  */#define CALL_USED_REGISTERS \/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \{  1, 1, 1, 0, 0, 0, 0, 1, 1,  1,  1,  1,  1,  1,  1,  1,  1 }/* Macro to conditionally modify fixed_regs/call_used_regs.  */#define CONDITIONAL_REGISTER_USAGE			\  {							\    if (flag_pic)					\      {							\	fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;	\	call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1;	\      }							\    if (! TARGET_80387 && ! TARGET_FLOAT_RETURNS_IN_80387) \      { 						\	int i; 						\	HARD_REG_SET x;					\        COPY_HARD_REG_SET (x, reg_class_contents[(int)FLOAT_REGS]); \        for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ )	\         if (TEST_HARD_REG_BIT (x, i)) 			\	  fixed_regs[i] = call_used_regs[i] = 1; 	\      }							\  }/* Return number of consecutive hard regs needed starting at reg REGNO   to hold something of mode MODE.   This is ordinarily the length in words of a value of mode MODE   but can be less for certain modes in special long registers.   Actually there are no two word move instructions for consecutive    registers.  And only registers 0-3 may have mov byte instructions   applied to them.   */#define HARD_REGNO_NREGS(REGNO, MODE)   \  (FP_REGNO_P (REGNO) ? 1 \   : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.   On the 80386, the first 4 cpu registers can hold any mode   while the floating point registers may hold only floating point.   Make it clear that the fp regs could not hold a 16-byte float.  */#define HARD_REGNO_MODE_OK(REGNO, MODE) \  ((REGNO) < 2 ? 1						\   : (REGNO) < 4 ? 1						\   : FP_REGNO_P ((REGNO))					\   ? ((GET_MODE_CLASS (MODE) == MODE_FLOAT			\       || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)		\      && GET_MODE_UNIT_SIZE (MODE) <= 8)			\   : (MODE) != QImode)/* Value is 1 if it is a good idea to tie two pseudo registers   when one has mode MODE1 and one has mode MODE2.   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,   for any hard reg, then this must be 0 for correct output.  */#define MODES_TIEABLE_P(MODE1, MODE2) ((MODE1) == (MODE2))/* A C expression returning the cost of moving data from a register of class   CLASS1 to one of CLASS2.   On the i386, copying between floating-point and fixed-point   registers is expensive.  */#define REGISTER_MOVE_COST(CLASS1, CLASS2)		\  ((((CLASS1) == FLOAT_REGS && (CLASS2) != FLOAT_REGS)	\    || ((CLASS2) == FLOAT_REGS && (CLASS1) != FLOAT_REGS))	\   ? 10 : 2)/* Specify the registers used for certain standard purposes.   The values of these macros are register numbers.  *//* on the 386 the pc register is %eip, and is not usable as a general   register.  The ordinary mov instructions won't work *//* #define PC_REGNUM  *//* Register to use for pushing function arguments.  */#define STACK_POINTER_REGNUM 7/* Base register for access to local variables of the function.  */#define FRAME_POINTER_REGNUM 6/* First floating point reg */#define FIRST_FLOAT_REG 8/* First & last stack-like regs */#define FIRST_STACK_REG FIRST_FLOAT_REG#define LAST_STACK_REG (FIRST_FLOAT_REG + 7)/* Value should be nonzero if functions must have frame pointers.   Zero means the frame pointer need not be set up (and parms   may be accessed via the stack pointer) in functions that seem suitable.   This is computed in `reload', in reload1.c.  */#define FRAME_POINTER_REQUIRED 0/* Base register for access to arguments of the function.  */#define ARG_POINTER_REGNUM 16/* Register in which static-chain is passed to a function.  */#define STATIC_CHAIN_REGNUM 2/* Register to hold the addressing base for position independent   code access to data items.  */#define PIC_OFFSET_TABLE_REGNUM 3/* Register in which address to store a structure value   arrives in the function.  On the 386, the prologue   copies this from the stack to register %eax.  */#define STRUCT_VALUE_INCOMING 0/* Place in which caller passes the structure value address.   0 means push the value on the stack like an argument.  */#define STRUCT_VALUE 0/* Define the classes of registers for register constraints in the   machine description.  Also define ranges of constants.   One of the classes must always be named ALL_REGS and include all hard regs.   If there is more than one class, another class must be named NO_REGS   and contain no registers.   The name GENERAL_REGS must be the name of a class (or an alias for   another name such as ALL_REGS).  This is the class of registers   that is allowed by "g" or "r" in a register constraint.   Also, registers outside this class are allocated only when   instructions express preferences for them.   The classes must be numbered in nondecreasing order; that is,   a larger-numbered class must never be contained completely   in a smaller-numbered class.   For any two classes, it is very desirable that there be another   class that represents their union.   It might seem that class BREG is unnecessary, since no useful 386   opcode needs reg %ebx.  But some systems pass args to the OS in ebx,   and the "b" register constraint is useful in asms for syscalls.  */enum reg_class{  NO_REGS,  AREG, DREG, CREG, BREG,  Q_REGS,			/* %eax %ebx %ecx %edx */  SIREG, DIREG,  INDEX_REGS,			/* %eax %ebx %ecx %edx %esi %edi %ebp */  GENERAL_REGS,			/* %eax %ebx %ecx %edx %esi %edi %ebp %esp */  FP_TOP_REG, FP_SECOND_REG,	/* %st(0) %st(1) */  FLOAT_REGS,  ALL_REGS, LIM_REG_CLASSES};#define N_REG_CLASSES (int) LIM_REG_CLASSES/* Give names of register classes as strings for dump file.   */#define REG_CLASS_NAMES \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -