sparc.h
来自「早期freebsd实现」· C头文件 代码 · 共 1,732 行 · 第 1/5 页
H
1,732 行
/* Definitions of target machine for GNU compiler, for Sun SPARC. Copyright (C) 1987, 1988, 1989, 1992 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com).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. *//* Note that some other tm.h files include this one and then override many of the definitions that relate to assembler syntax. */#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{g:-lg}"/* Provide required defaults for linker -e and -d switches. */#define LINK_SPEC \ "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"/* Special flags to the Sun-4 assembler when using pipe for input. */#define ASM_SPEC " %{pipe:-} %{fpic:-k} %{fPIC:-k}"/* Define macros to distinguish architectures. */#define CPP_SPEC "%{msparclite:-D__sparclite__} %{mv8:-D__sparc_v8__}"/* Prevent error on `-sun4' and `-target sun4' options. *//* This used to translate -dalign to -malign, but that is no good because it can't turn off the usual meaning of making debugging dumps. */#define CC1_SPEC "%{sun4:} %{target:}"#if 0/* Sparc ABI says that long double is 4 words. ??? This doesn't work yet. */#define LONG_DOUBLE_TYPE_SIZE 128#endif#define PTRDIFF_TYPE "int"#define SIZE_TYPE "int"#define WCHAR_TYPE "short unsigned int"#define WCHAR_TYPE_SIZE 16/* Omit frame pointer at high optimization levels. */ #define OPTIMIZATION_OPTIONS(OPTIMIZE) \{ \ if (OPTIMIZE >= 2) \ { \ flag_omit_frame_pointer = 1; \ } \}/* These compiler options take an argument. We ignore -target for now. */#define WORD_SWITCH_TAKES_ARG(STR) \ (!strcmp (STR, "Tdata") || !strcmp (STR, "Ttext") \ || !strcmp (STR, "Tbss") || !strcmp (STR, "include") \ || !strcmp (STR, "imacros") || !strcmp (STR, "target") \ || !strcmp (STR, "assert") || !strcmp (STR, "aux-info"))/* Names to predefine in the preprocessor for this target machine. */#define CPP_PREDEFINES "-Dsparc -Dsun -Dunix"/* Print subsidiary information on the compiler version in use. */#define TARGET_VERSION fprintf (stderr, " (sparc)");/* Generate DBX debugging information. */#define DBX_DEBUGGING_INFO/* Run-time compilation parameters selecting different hardware subsets. */extern int target_flags;/* Nonzero if we should generate code to use the fpu. */#define TARGET_FPU (target_flags & 1)/* Nonzero if we should use FUNCTION_EPILOGUE. Otherwise, we use fast return insns, but lose some generality. */#define TARGET_EPILOGUE (target_flags & 2)/* Nonzero means that reference doublewords as if they were guaranteed to be aligned...if they aren't, too bad for the user! Like -dalign in Sun cc. */#define TARGET_HOPE_ALIGN (target_flags & 16)/* Nonzero means make sure all doubles are on 8-byte boundaries. This option results in a calling convention that is incompatible with every other sparc compiler in the world, and thus should only ever be used for experimenting. Also, varargs won't work with it, but it doesn't seem worth trying to fix. */#define TARGET_FORCE_ALIGN (target_flags & 32)/* Nonzero means that we should generate code for a v8 sparc. */#define TARGET_V8 (target_flags & 64)/* Nonzero means that we should generate code for a sparclite. */#define TARGET_SPARCLITE (target_flags & 128)/* 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 \ { {"fpu", 1}, \ {"soft-float", -1}, \ {"epilogue", 2}, \ {"no-epilogue", -2}, \ {"hope-align", 16}, \ {"force-align", 48}, \ {"v8", 64}, \ {"no-v8", -64}, \ {"sparclite", 128}, \ {"no-sparclite", -128}, \ { "", TARGET_DEFAULT}}#define TARGET_DEFAULT 3/* target machine storage layout *//* Define this if most significant bit is lowest numbered in instructions that operate on numbered bit-fields. */#define BITS_BIG_ENDIAN 1/* Define this if most significant byte of a word is the lowest numbered. *//* This is true on the SPARC. */#define BYTES_BIG_ENDIAN 1/* Define this if most significant word of a multiword number is the lowest numbered. *//* Doubles are stored in memory with the high order word first. This matters when cross-compiling. */#define WORDS_BIG_ENDIAN 1/* 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 68000, this would still be 32. But on a machine with 16-bit registers, this would be 16. */#define BITS_PER_WORD 32#define MAX_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 64/* ALIGN FRAMES on double word boundaries */#define SPARC_STACK_ALIGN(LOC) (((LOC)+7) & 0xfffffff8)/* Allocation boundary (in *bits*) for the code of a function. */#define FUNCTION_BOUNDARY 32/* Alignment of field after `int : 0' in a structure. */#define EMPTY_FIELD_BOUNDARY 32/* Every structure's size must be a multiple of this. */#define STRUCTURE_SIZE_BOUNDARY 8/* A bitfield declared as `int' forces `int' alignment for the struct. */#define PCC_BITFIELD_TYPE_MATTERS 1/* No data type wants to be aligned rounder than this. */#define BIGGEST_ALIGNMENT 64/* The best alignment to use in cases where we have a choice. */#define FASTEST_ALIGNMENT 64/* Make strings word-aligned so strcpy from constants will be faster. */#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ ((TREE_CODE (EXP) == STRING_CST \ && (ALIGN) < FASTEST_ALIGNMENT) \ ? FASTEST_ALIGNMENT : (ALIGN))/* Make arrays of chars word-aligned for the same reasons. */#define DATA_ALIGNMENT(TYPE, ALIGN) \ (TREE_CODE (TYPE) == ARRAY_TYPE \ && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))/* Set this nonzero if move instructions will actually fail to work when given unaligned data. */#define STRICT_ALIGNMENT 1/* Things that must be doubleword aligned cannot go in the text section, because the linker fails to align the text section enough! Put them in the data section. */#define MAX_TEXT_ALIGN 32#define SELECT_SECTION(T,RELOC) \{ \ if (TREE_CODE (T) == VAR_DECL) \ { \ if (TREE_READONLY (T) && ! TREE_SIDE_EFFECTS (T) \ && DECL_ALIGN (T) <= MAX_TEXT_ALIGN \ && ! (flag_pic && (RELOC))) \ text_section (); \ else \ data_section (); \ } \ else if (TREE_CODE (T) == CONSTRUCTOR) \ { \ if (flag_pic != 0 && (RELOC) != 0) \ data_section (); \ } \ else if (*tree_code_type[(int) TREE_CODE (T)] == 'c') \ { \ if ((TREE_CODE (T) == STRING_CST && flag_writable_strings) \ || TYPE_ALIGN (TREE_TYPE (T)) > MAX_TEXT_ALIGN) \ data_section (); \ else \ text_section (); \ } \}/* Use text section for a constant unless we need more alignment than that offers. */#define SELECT_RTX_SECTION(MODE, X) \{ \ if (GET_MODE_BITSIZE (MODE) <= MAX_TEXT_ALIGN \ && ! (flag_pic && symbolic_operand (X))) \ text_section (); \ else \ data_section (); \}/* Standard register usage. *//* 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. SPARC has 32 integer registers and 32 floating point registers. */#define FIRST_PSEUDO_REGISTER 64/* 1 for registers that have pervasive standard uses and are not available for the register allocator. 0 is used for the condition code and not to represent %g0, which is hardwired to 0, so reg 0 is *not* fixed. g1 through g4 are free to use as temporaries. g5 through g7 are reserved for the operating system. */#define FIXED_REGISTERS \ {0, 0, 0, 0, 0, 1, 1, 1, \ 0, 0, 0, 0, 0, 0, 1, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 1, 1, \ \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0}/* 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 \ {1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 1, 1, \ \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 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. On SPARC, ordinary registers hold 32 bits worth; this means both integer and floating point registers. We use vectors to keep this information about registers. *//* How many hard registers it takes to make a register of this mode. */extern int hard_regno_nregs[];#define HARD_REGNO_NREGS(REGNO, MODE) \ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)/* Value is 1 if register/mode pair is acceptable on sparc. */extern int hard_regno_mode_ok[FIRST_PSEUDO_REGISTER];/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. On SPARC, the cpu registers can hold any mode but the float registers can only hold SFmode or DFmode. See sparc.c for how we initialize this. */#define HARD_REGNO_MODE_OK(REGNO, MODE) \ ((hard_regno_mode_ok[REGNO] & (1<<(int)(MODE))) != 0)/* 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) || GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))/* Specify the registers used for certain standard purposes. The values of these macros are register numbers. *//* SPARC pc isn't overloaded on a register that the compiler knows about. *//* #define PC_REGNUM *//* Register to use for pushing function arguments. */#define STACK_POINTER_REGNUM 14/* Actual top-of-stack address is 92 greater than the contents of the stack pointer register. 92 = 68 + 24. 64 bytes reserving space for the ins and local registers, 4 byte for structure return address, and 24 bytes for the 6 register parameters. */#define STACK_POINTER_OFFSET FIRST_PARM_OFFSET(0)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?