📄 tm-sparc.h
字号:
/* Definitions of target machine for GNU compiler, for Sun SPARC. Copyright (C) 1988 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@mcc.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 1, 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- files include this one and then override many of the definitions that relate to assembler syntax. *//* Specify library to handle `-a' basic block profiling. */#define LIB_SPEC "%{a:/usr/lib/bb_link.o} \%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} "/* Provide required defaults for linker -e and -d switches. Also, it is hard to debug with shared libraries, so don't use them if going to debug. */#define LINK_SPEC "%{!e*:-e start} -dc -dp %{static:-Bstatic} %{Bstatic} \ %{assert*}"/* Special flags to the Sun-4 assembler when using pipe for input. */#define ASM_SPEC " %{pipe:-} "/* Prevent error on `-dalign', `-sun4' and `-target sun4' options. */#define CC1_SPEC "%{dalign:} %{sun4:} %{target:}"/* These compiler options take an argument. We ignore -target for now. */#define WORD_SWITCH_TAKES_ARG(STR) \ (!strcmp (STR, "target") || !strcmp (STR, "Tdata") \ || !strcmp (STR, "assert"))/* 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 if we expect to be passed through the Sun optimizing assembler. This requires us to generate code which we otherwise would not. For example, calls via pointers-to-functions must be output specially because Sun assemble does not do proper flow analysis for this case. */#define TARGET_SUN_ASM (target_flags & 4)/* Nonzero if we should do eager peepholes for conditional branch scheduling. */#define TARGET_EAGER (target_flags & 8)/* 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}, \ {"sun-asm", 4}, \ {"eager", 8}, \ { "", 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/* Define this if most significant byte of a word is the lowest numbered. *//* This is true on the SPARC. */#define BYTES_BIG_ENDIAN/* Define this if most significant word of a multiword number is numbered. *//* For SPARC we can decide arbitrarily since there are no machine instructions for them. *//* #define WORDS_BIG_ENDIAN *//* number of bits in an addressible 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/* 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 pointers in memory. */#define POINTER_BOUNDARY 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/* 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/* Define this if move instructions will actually fail to work when given unaligned data. */#define STRICT_ALIGNMENT/* 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) \{ \ if (TREE_CODE (T) == VAR_DECL) \ { \ if (TREE_READONLY (T) && ! TREE_VOLATILE (T) \ && DECL_ALIGN (T) <= MAX_TEXT_ALIGN) \ text_section (); \ else \ data_section (); \ } \ 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)\ 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 fullword 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. On SPARC, this includes all the global registers (registers r[0] through r[7]) and the callee return address register, r[15]. */#define FIXED_REGISTERS \ {1, 1, 1, 1, 1, 1, 1, 1, \ 0, 0, 0, 0, 0, 0, 1, 1, \ 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 1, 1, \ \ 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}/* 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. */#define HARD_REGNO_NREGS(REGNO, MODE) \ ((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 SPARC, the cpu registers can hold any mode but the float registers can only hold SFmode or DFmode. */#define HARD_REGNO_MODE_OK(REGNO, MODE) \ ((REGNO) < 32 ? ((GET_MODE_SIZE (MODE) <= 4) ? 1 : ((REGNO) & 1) == 0) : \ ((MODE) == SFmode ? 1 : (MODE) == DFmode && ((REGNO) & 1) == 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) == SFmode || (MODE1) == DFmode) \ == ((MODE2) == SFmode || (MODE2) == DFmode))/* 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. */#define STACK_POINTER_OFFSET 92/* Base register for access to local variables of the function. */#define FRAME_POINTER_REGNUM 30/* 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 1/* Base register for access to arguments of the function. */#define ARG_POINTER_REGNUM 30/* Register in which static-chain is passed to a function. *//* ??? */#define STATIC_CHAIN_REGNUM 1 /* Functions which return large structures get the address to place the wanted value at offset 64 from the frame. */#define STRUCT_VALUE_OFFSET 64 /* Used only in other #defines in this file. */#define STRUCT_VALUE \ gen_rtx (MEM, Pmode, \ gen_rtx (PLUS, SImode, stack_pointer_rtx, \ gen_rtx (CONST_INT, VOIDmode, STRUCT_VALUE_OFFSET)))#define STRUCT_VALUE_INCOMING \ gen_rtx (MEM, Pmode, \ gen_rtx (PLUS, SImode, frame_pointer_rtx, \ gen_rtx (CONST_INT, VOIDmode, STRUCT_VALUE_OFFSET)))/* 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. */ /* The SPARC has two kinds of registers, general and floating point. */enum reg_class { NO_REGS, GENERAL_REGS, FP_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 \ {"NO_REGS", "GENERAL_REGS", "FP_REGS", "ALL_REGS" }/* Define which registers fit in which classes. This is an initializer for a vector of HARD_REG_SET of length N_REG_CLASSES. */#define REG_CLASS_CONTENTS {{0, 0}, {-1, 0}, {0, -1}, {-1, -1}}/* The same information, inverted: Return the class number of the smallest class containing reg number REGNO. This could be a conditional expression or could index an array. */#define REGNO_REG_CLASS(REGNO) \ ((REGNO) >= 32 ? FP_REGS : GENERAL_REGS)/* The class value for index registers, and the one for base regs. */#define INDEX_REG_CLASS GENERAL_REGS#define BASE_REG_CLASS GENERAL_REGS/* Get reg_class from a letter such as appears in the machine description. */#define REG_CLASS_FROM_LETTER(C) \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -