sparc.h

来自「GCC编译器源代码」· C头文件 代码 · 共 1,699 行 · 第 1/5 页

H
1,699
字号
/* Definitions of target machine for GNU compiler, for Sun SPARC.   Copyright (C) 1987, 88, 89, 92, 94-6, 1997 Free Software Foundation, Inc.   Contributed by Michael Tiemann (tiemann@cygnus.com).   64 bit SPARC V9 support by Michael Tiemann, Jim Wilson, and Doug Evans,   at Cygnus Support.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, 59 Temple Place - Suite 330,Boston, MA 02111-1307, USA.  *//* Note that some other tm.h files include this one and then override   whatever definitions are necessary.  *//* Specify this in a cover file to provide bi-architecture (32/64) support.  *//* #define SPARC_BI_ARCH *//* Macro used later in this file to determine default architecture.  */#define DEFAULT_ARCH32_P ((TARGET_DEFAULT & MASK_64BIT) == 0)/* TARGET_ARCH{32,64} are the main macros to decide which of the two   architectures to compile for.  We allow targets to choose compile time or   runtime selection.  */#ifdef SPARC_BI_ARCH#define TARGET_ARCH32 (! TARGET_64BIT)#else#define TARGET_ARCH32 (DEFAULT_ARCH32_P)#endif#define TARGET_ARCH64 (! TARGET_ARCH32)/* Code model selection.   -mcmodel is used to select the v9 code model.   Different code models aren't supported for v8 code.   TARGET_CM_32:     32 bit address space, top 32 bits = 0,		     pointers are 32 bits.  Note that this isn't intended                     to imply a v8 abi.   TARGET_CM_MEDLOW: 32 bit address space, top 32 bits = 0,                     avoid generating %uhi and %ulo terms,		     pointers are 64 bits.   TARGET_CM_MEDMID: 64 bit address space.                     The executable must be in the low 16 TB of memory.                     This corresponds to the low 44 bits, and the %[hml]44                     relocs are used.   TARGET_CM_MEDANY: 64 bit address space.                     The text and data segments have a maximum size of 31                     bits and may be located anywhere.  The maximum offset                     from any instruction to the label _GLOBAL_OFFSET_TABLE_                     is 31 bits.   TARGET_CM_EMBMEDANY: 64 bit address space.                     The text and data segments have a maximum size of 31 bits                     and may be located anywhere.  Register %g4 contains                     the start address of the data segment.*/enum cmodel {  CM_32,  CM_MEDLOW,  CM_MEDMID,  CM_MEDANY,  CM_EMBMEDANY};/* Value of -mcmodel specified by user.  */extern char *sparc_cmodel_string;/* One of CM_FOO.  */extern enum cmodel sparc_cmodel;/* V9 code model selection.  */#define TARGET_CM_MEDLOW    (sparc_cmodel == CM_MEDLOW)#define TARGET_CM_MEDMID    (sparc_cmodel == CM_MEDMID)#define TARGET_CM_MEDANY    (sparc_cmodel == CM_MEDANY)#define TARGET_CM_EMBMEDANY (sparc_cmodel == CM_EMBMEDANY)#define SPARC_DEFAULT_CMODEL CM_MEDLOW/* This is call-clobbered in the normal ABI, but is reserved in the   home grown (aka upward compatible) embedded ABI.  */#define EMBMEDANY_BASE_REG "%g4"/* Values of TARGET_CPU_DEFAULT, set via -D in the Makefile,   and specified by the user via --with-cpu=foo.   This specifies the cpu implementation, not the architecture size.  */#define TARGET_CPU_sparc	0#define TARGET_CPU_v7		0	/* alias for previous */#define TARGET_CPU_sparclet	1#define TARGET_CPU_sparclite	2#define TARGET_CPU_v8		3	/* generic v8 implementation */#define TARGET_CPU_supersparc	4#define TARGET_CPU_v9		5	/* generic v9 implementation */#define TARGET_CPU_sparc64	5	/* alias */#define TARGET_CPU_ultrasparc	6#if TARGET_CPU_DEFAULT == TARGET_CPU_sparc || TARGET_CPU_DEFAULT == TARGET_CPU_v8 || TARGET_CPU_DEFAULT == TARGET_CPU_supersparc#define CPP_CPU_DEFAULT_SPEC ""#define ASM_CPU_DEFAULT_SPEC ""#endif#if TARGET_CPU_DEFAULT == TARGET_CPU_sparclet#define CPP_CPU_DEFAULT_SPEC "-D__sparclet__"#define ASM_CPU_DEFAULT_SPEC "-Asparclet"#endif#if TARGET_CPU_DEFAULT == TARGET_CPU_sparclite#define CPP_CPU_DEFAULT_SPEC "-D__sparclite__"#define ASM_CPU_DEFAULT_SPEC "-Asparclite"#endif#if TARGET_CPU_DEFAULT == TARGET_CPU_v9/* ??? What does Sun's CC pass?  */#define CPP_CPU_DEFAULT_SPEC "-D__sparc_v9__"/* ??? It's not clear how other assemblers will handle this, so by default   use GAS.  Sun's Solaris assembler recognizes -xarch=v8plus, but this case   is handled in sol2.h.  */#define ASM_CPU_DEFAULT_SPEC "-Av9"#endif#if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc#define CPP_CPU_DEFAULT_SPEC "-D__sparc_v9__"#define ASM_CPU_DEFAULT_SPEC "-Av9a"#endif#ifndef CPP_CPU_DEFAULT_SPECUnrecognized value in TARGET_CPU_DEFAULT.#endif/* Names to predefine in the preprocessor for this target machine.   ??? It would be nice to not include any subtarget specific values here,   however there's no way to portably provide subtarget values to   CPP_PREFINES.  Also, -D values in CPP_SUBTARGET_SPEC don't get turned into   into foo, __foo and __foo__.  */#define CPP_PREDEFINES "-Dsparc -Dsun -Dunix -Asystem(unix) -Asystem(bsd)"/* Define macros to distinguish architectures.  *//* Common CPP definitions used by CPP_SPEC amongst the various targets   for handling -mcpu=xxx switches.  */#define CPP_CPU_SPEC "\%{mcypress:} \%{msparclite:-D__sparclite__} \%{mf930:-D__sparclite__} %{mf934:-D__sparclite__} \%{mv8:-D__sparc_v8__} \%{msupersparc:-D__supersparc__ -D__sparc_v8__} \%{mcpu=sparclet:-D__sparclet__} %{mcpu=tsc701:-D__sparclet__} \%{mcpu=sparclite:-D__sparclite__} \%{mcpu=f930:-D__sparclite__} %{mcpu=f934:-D__sparclite__} \%{mcpu=v8:-D__sparc_v8__} \%{mcpu=supersparc:-D__supersparc__ -D__sparc_v8__} \%{mcpu=v8plus:-D__sparc_v9__} \%{mcpu=v9:-D__sparc_v9__} \%{mcpu=ultrasparc:-D__sparc_v9__} \%{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \"/* ??? The GCC_NEW_VARARGS macro is now obsolete, because gcc always uses   the right varags.h file when bootstrapping.  *//* ??? It's not clear what value we want to use for -Acpu/machine for   sparc64 in 32 bit environments, so for now we only use `sparc64' in   64 bit environments.  */#define CPP_ARCH32_SPEC "-D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc)"#define CPP_ARCH64_SPEC "-D__arch64__ -Acpu(sparc64) -Amachine(sparc64)"#define CPP_ARCH_DEFAULT_SPEC \(DEFAULT_ARCH32_P ? CPP_ARCH32_SPEC : CPP_ARCH64_SPEC)#define CPP_ARCH_SPEC "\%{m32:%(cpp_arch32)} \%{m64:%(cpp_arch64)} \%{!m32:%{!m64:%(cpp_arch_default)}} \"/* Macros to distinguish endianness.  */#define CPP_ENDIAN_SPEC "%{mlittle-endian:-D__LITTLE_ENDIAN__}"/* Macros to distinguish the particular subtarget.  */#define CPP_SUBTARGET_SPEC ""#define CPP_SPEC "%(cpp_cpu) %(cpp_arch) %(cpp_endian) %(cpp_subtarget)"/* 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.  *//* Translate old style -m<cpu> into new style -mcpu=<cpu>.   ??? Delete support for -m<cpu> for 2.9.  */#define CC1_SPEC "\%{sun4:} %{target:} \%{mcypress:-mcpu=cypress} \%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \"/* Override in target specific files.  */#define ASM_CPU_SPEC "\%{mcpu=sparclet:-Asparclet} %{mcpu=tsc701:-Asparclet} \%{msparclite:-Asparclite} \%{mf930:-Asparclite} %{mf934:-Asparclite} \%{mcpu=sparclite:-Asparclite} \%{mcpu=f930:-Asparclite} %{mcpu=f934:-Asparclite} \%{mcpu=v8plus:-Av8plus} \%{mcpu=v9:-Av9} \%{mcpu=ultrasparc:-Av9a} \%{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(asm_cpu_default)}}}}}}} \"/* Word size selection, among other things.   This is what GAS uses.  Add %(asm_arch) to ASM_SPEC to enable.  */#define ASM_ARCH32_SPEC "-32"#define ASM_ARCH64_SPEC "-64"#define ASM_ARCH_DEFAULT_SPEC \(DEFAULT_ARCH32_P ? ASM_ARCH32_SPEC : ASM_ARCH64_SPEC)#define ASM_ARCH_SPEC "\%{m32:%(asm_arch32)} \%{m64:%(asm_arch64)} \%{!m32:%{!m64:%(asm_arch_default)}} \"/* Special flags to the Sun-4 assembler when using pipe for input.  */#define ASM_SPEC "\%| %{R} %{!pg:%{!p:%{fpic:-k} %{fPIC:-k}}} %{keep-local-as-symbols:-L} \%(asm_cpu) \"#define LIB_SPEC "%{!shared:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{g:-lg}}"/* Provide required defaults for linker -e and -d switches.  */#define LINK_SPEC \ "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp} %{static:-Bstatic} \  %{assert*} %{shared:%{!mimpure-text:-assert pure-text}}"/* This macro defines names of additional specifications to put in the specs   that can be used in various specifications like CC1_SPEC.  Its definition   is an initializer with a subgrouping for each command option.   Each subgrouping contains a string constant, that defines the   specification name, and a string constant that used by the GNU CC driver   program.   Do not define this macro if it does not need to do anything.  */#define EXTRA_SPECS \  { "cpp_cpu",		CPP_CPU_SPEC },			\  { "cpp_cpu_default",	CPP_CPU_DEFAULT_SPEC },		\  { "cpp_arch32",	CPP_ARCH32_SPEC },		\  { "cpp_arch64",	CPP_ARCH64_SPEC },		\  { "cpp_arch_default",	CPP_ARCH_DEFAULT_SPEC },	\  { "cpp_arch",		CPP_ARCH_SPEC },		\  { "cpp_endian",	CPP_ENDIAN_SPEC },		\  { "cpp_subtarget",	CPP_SUBTARGET_SPEC },		\  { "asm_cpu",		ASM_CPU_SPEC },			\  { "asm_cpu_default",	ASM_CPU_DEFAULT_SPEC },		\  { "asm_arch32",	ASM_ARCH32_SPEC },		\  { "asm_arch64",	ASM_ARCH64_SPEC },		\  { "asm_arch_default",	ASM_ARCH_DEFAULT_SPEC },	\  { "asm_arch",		ASM_ARCH_SPEC },		\  SUBTARGET_EXTRA_SPECS#define SUBTARGET_EXTRA_SPECS#ifdef SPARC_BI_ARCH#define NO_BUILTIN_PTRDIFF_TYPE#define NO_BUILTIN_SIZE_TYPE#endif#define PTRDIFF_TYPE (TARGET_ARCH64 ? "long long int" : "int")#define SIZE_TYPE (TARGET_ARCH64 ? "long long unsigned int" : "unsigned int")/* ??? This should be 32 bits for v9 but what can we do?  */#define WCHAR_TYPE "short unsigned int"#define WCHAR_TYPE_SIZE 16#define MAX_WCHAR_TYPE_SIZE 16/* Show we can debug even without a frame pointer.  */#define CAN_DEBUG_WITHOUT_FP/* To make profiling work with -f{pic,PIC}, we need to emit the profiling   code into the rtl.  Also, if we are profiling, we cannot eliminate   the frame pointer (because the return address will get smashed).  */void sparc_override_options ();#define OVERRIDE_OPTIONS \  do {									\    if (profile_flag || profile_block_flag || profile_arc_flag)		\      {									\	if (flag_pic)							\	  {								\	    char *pic_string = (flag_pic == 1) ? "-fpic" : "-fPIC";	\	    warning ("%s and profiling conflict: disabling %s",		\		     pic_string, pic_string);				\	    flag_pic = 0;						\	  }								\	flag_omit_frame_pointer = 0;					\      }									\    sparc_override_options ();						\    SUBTARGET_OVERRIDE_OPTIONS;						\  } while (0)/* This is meant to be redefined in the host dependent files.  */#define SUBTARGET_OVERRIDE_OPTIONS/* These compiler options take an argument.  We ignore -target for now.  */#define WORD_SWITCH_TAKES_ARG(STR)				\ (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)				\  || !strcmp (STR, "target") || !strcmp (STR, "assert"))/* 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 MASK_FPU 1#define TARGET_FPU (target_flags & MASK_FPU)/* Nonzero if we should use FUNCTION_EPILOGUE.  Otherwise, we   use fast return insns, but lose some generality.  */

⌨️ 快捷键说明

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