cris.h

来自「linux下编程用 编译软件」· C头文件 代码 · 共 1,435 行 · 第 1/4 页

H
1,435
字号
/* Definitions for GCC.  Part of the machine description for CRIS.   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005   Free Software Foundation, Inc.   Contributed by Axis Communications.  Written by Hans-Peter Nilsson.This file is part of GCC.GCC 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.GCC 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 GCC; see the file COPYING.  If not, write tothe Free Software Foundation, 51 Franklin Street, Fifth Floor,Boston, MA 02110-1301, USA.  *//* After the first "Node:" comment comes all preprocessor directives and   attached declarations described in the info files, the "Using and   Porting GCC" manual (uapgcc), in the same order as found in the "Target   macros" section in the gcc-2.9x CVS edition of 2000-03-17.  FIXME: Not   really, but needs an update anyway.   There is no generic copy-of-uapgcc comment, you'll have to see uapgcc   for that.  If applicable, there is a CRIS-specific comment.  The order   of macro definitions follow the order in the manual.  Every section in   the manual (node in the info pages) has an introductory `Node:   <subchapter>' comment.  If no macros are defined for a section, only   the section-comment is present.  *//* Note that other header files (e.g. config/elfos.h, config/linux.h,   config/cris/linux.h and config/cris/aout.h) are responsible for lots of   settings not repeated below.  This file contains general CRIS   definitions and definitions for the cris-*-elf subtarget.  *//* We don't want to use gcc_assert for everything, as that can be   compiled out.  */#define CRIS_ASSERT(x) \ do { if (!(x)) internal_error ("CRIS-port assertion failed: " #x); } while (0)/* Replacement for REG_P since it does not match SUBREGs.  Happens for   testcase Axis-20000320 with gcc-2.9x.  */#define REG_S_P(x) \ (REG_P (x) || (GET_CODE (x) == SUBREG && REG_P (XEXP (x, 0))))/* Last register in main register bank r0..r15.  */#define CRIS_LAST_GENERAL_REGISTER 15/* Descriptions of registers used for arguments.  */#define CRIS_FIRST_ARG_REG 10#define CRIS_MAX_ARGS_IN_REGS 4/* See also *_REGNUM constants in cris.md.  *//* Most of the time, we need the index into the register-names array.   When passing debug-info, we need the real hardware register number.  */#define CRIS_CANONICAL_SRP_REGNUM (16 + 11)#define CRIS_CANONICAL_MOF_REGNUM (16 + 7)/* We have CCR in all models including v10, but that's 16 bits, so let's   prefer the DCCR number, which is a DMA pointer in pre-v8, so we'll   never clash with it for GCC purposes.  */#define CRIS_CANONICAL_CC0_REGNUM (16 + 13)/* When generating PIC, these suffixes are added to the names of non-local   functions when being output.  Contrary to other ports, we have offsets   relative to the GOT, not the PC.  We might implement PC-relative PLT   semantics later for the general case; they are used in some cases right   now, such as MI thunks.  */#define CRIS_GOTPLT_SUFFIX ":GOTPLT"#define CRIS_PLT_GOTOFFSET_SUFFIX ":PLTG"#define CRIS_PLT_PCOFFSET_SUFFIX ":PLT"#define CRIS_FUNCTION_ARG_SIZE(MODE, TYPE)	\  ((MODE) != BLKmode ? GET_MODE_SIZE (MODE)	\   : (unsigned) int_size_in_bytes (TYPE))/* Which CPU version this is.  The parsed and adjusted cris_cpu_str.  */extern int cris_cpu_version;/* Changing the order used to be necessary to put the fourth __make_dp   argument (a DImode parameter) in registers, to fit with the libfunc   parameter passing scheme used for intrinsic functions.  FIXME: Check   performance and maybe remove definition from TARGET_LIBGCC2_CFLAGS now   that it isn't strictly necessary.  We used to do this through   TARGET_LIBGCC2_CFLAGS, but that became increasingly difficult as the   parenthesis (that needed quoting) travels through several layers of   make and shell invocations.  */#ifdef IN_LIBGCC2#define __make_dp(a,b,c,d) __cris_make_dp(d,a,b,c)#endif/* Node: Driver *//* When using make with defaults.mak for Sun this will handily remove   any "-target sun*" switches.  *//* We need to override any previous definitions (linux.h) */#undef WORD_SWITCH_TAKES_ARG#define WORD_SWITCH_TAKES_ARG(STR)		\ (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)		\  || !strcmp (STR, "target"))/* Also provide canonical vN definitions when user specifies an alias.   Note that -melf overrides -maout.  */#define CPP_SPEC \ "%{mtune=*:-D__tune_%* %{mtune=v*:-D__CRIS_arch_tune=%*}\   %{mtune=etrax4:-D__tune_v3 -D__CRIS_arch_tune=3}\   %{mtune=etrax100:-D__tune_v8 -D__CRIS_arch_tune=8}\   %{mtune=svinto:-D__tune_v8 -D__CRIS_arch_tune=8}\   %{mtune=etrax100lx:-D__tune_v10 -D__CRIS_arch_tune=10}\   %{mtune=ng:-D__tune_v10 -D__CRIS_arch_tune=10}}\  %{mcpu=*:-D__arch_%* %{mcpu=v*:-D__CRIS_arch_version=%*}\   %{mcpu=etrax4:-D__arch_v3 -D__CRIS_arch_version=3}\   %{mcpu=etrax100:-D__arch_v8 -D__CRIS_arch_version=8}\   %{mcpu=svinto:-D__arch_v8 -D__CRIS_arch_version=8}\   %{mcpu=etrax100lx:-D__arch_v10 -D__CRIS_arch_version=10}\   %{mcpu=ng:-D__arch_v10 -D__CRIS_arch_version=10}}\  %{march=*:-D__arch_%* %{march=v*:-D__CRIS_arch_version=%*}\   %{march=etrax4:-D__arch_v3 -D__CRIS_arch_version=3}\   %{march=etrax100:-D__arch_v8 -D__CRIS_arch_version=8}\   %{march=svinto:-D__arch_v8 -D__CRIS_arch_version=8}\   %{march=etrax100lx:-D__arch_v10 -D__CRIS_arch_version=10}\   %{march=ng:-D__arch_v10 -D__CRIS_arch_version=10}}\  %{metrax100:-D__arch__v8 -D__CRIS_arch_version=8}\  %{metrax4:-D__arch__v3 -D__CRIS_arch_version=3}\  %(cpp_subtarget)"/* For the cris-*-elf subtarget.  */#define CRIS_CPP_SUBTARGET_SPEC \ "%{mbest-lib-options:\   %{!moverride-best-lib-options:\    %{!march=*:%{!metrax*:%{!mcpu=*:-D__tune_v10 -D__CRIS_arch_tune=10}}}}}"/* Remove those Sun-make "target" switches.  *//* Override previous definitions (linux.h).  */#undef CC1_SPEC#define CC1_SPEC \ "%{target*:}\  %{metrax4:-march=v3}\  %{metrax100:-march=v8}\  %(cc1_subtarget)"/* For the cris-*-elf subtarget.  */#define CRIS_CC1_SUBTARGET_SPEC \ "-melf\  %{mbest-lib-options:\   %{!moverride-best-lib-options:\    %{!march=*:%{!mcpu=*:-mtune=v10 -D__CRIS_arch_tune=10}}\    %{!finhibit-size-directive:\      %{!fno-function-sections: -ffunction-sections}\      %{!fno-data-sections: -fdata-sections}}}}"/* This adds to CC1_SPEC.  When bugs are removed from -fvtable-gc   (-fforce-addr causes invalid .vtable_entry asm in tinfo.cc and   nothing at all works in GCC 3.0-pre), add this line:   "%{mbest-lib-options:%{!moverride-best-lib-options:\   %{!melinux:%{!maout|melf:%{!fno-vtable-gc:-fvtable-gc}}}}}".  */#define CC1PLUS_SPEC ""#ifdef HAVE_AS_NO_MUL_BUG_ABORT_OPTION#define MAYBE_AS_NO_MUL_BUG_ABORT \ "%{mno-mul-bug-workaround:-no-mul-bug-abort} "#else#define MAYBE_AS_NO_MUL_BUG_ABORT#endif/* Override previous definitions (linux.h).  */#undef ASM_SPEC#define ASM_SPEC \ MAYBE_AS_NO_MUL_BUG_ABORT \ "%{v:-v}\  %(asm_subtarget)"/* For the cris-*-elf subtarget.  */#define CRIS_ASM_SUBTARGET_SPEC "--em=criself"/* FIXME: We should propagate the -melf option to make the criself   "emulation" unless a linker script is provided (-T*), but I don't know   how to do that if either of -Ttext, -Tdata or -Tbss is given but no   linker script, as is usually the case.  Leave it to the user for the   time being.   Note that -melf overrides -maout except that a.out-compiled libraries   are linked in (multilibbing).  The somewhat cryptic -rpath-link pair is   to avoid *only* picking up the linux multilib subdir from the "-B./"   option during build, while still giving it preference.  We'd need some   %s-variant that checked for existence of some specific file.  *//* Override previous definitions (svr4.h).  */#undef LINK_SPEC#define LINK_SPEC \ "%{v:--verbose}\  %(link_subtarget)"/* For the cris-*-elf subtarget.  */#define CRIS_LINK_SUBTARGET_SPEC \ "-mcriself\  %{sim2:%{!T*:-Tdata 0x4000000 -Tbss 0x8000000}}\  %{!r:%{O2|O3: --gc-sections}}"/* Which library to get.  The simulator uses a different library for   the low-level syscalls (implementing the Linux syscall ABI instead   of direct-iron accesses).  Default everything with the stub "nosys"   library.  *//* Override previous definitions (linux.h).  */#undef LIB_SPEC#define LIB_SPEC \ "%{sim*:--start-group -lc -lsyslinux --end-group}\  %{!sim*:%{g*:-lg}\    %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} -lbsp}\  -lnosys"/* Linker startfile options; crt0 flavors.   We need to remove any previous definition (elfos.h).  */#undef STARTFILE_SPEC#define STARTFILE_SPEC \ "%{sim*:crt1.o%s}%{!sim*:crt0.o%s}\  crti.o%s crtbegin.o%s"#undef ENDFILE_SPEC#define ENDFILE_SPEC "crtend.o%s crtn.o%s"#define EXTRA_SPECS				\  {"cpp_subtarget", CRIS_CPP_SUBTARGET_SPEC},	\  {"cc1_subtarget", CRIS_CC1_SUBTARGET_SPEC},	\  {"asm_subtarget", CRIS_ASM_SUBTARGET_SPEC},	\  {"link_subtarget", CRIS_LINK_SUBTARGET_SPEC},	\  CRIS_SUBTARGET_EXTRA_SPECS#define CRIS_SUBTARGET_EXTRA_SPECS/* Node: Run-time Target */#define TARGET_CPU_CPP_BUILTINS()		\  do						\    {						\      builtin_define_std ("cris");		\      builtin_define_std ("CRIS");		\      builtin_define_std ("GNU_CRIS");		\      builtin_define ("__CRIS_ABI_version=2");	\      builtin_assert ("cpu=cris");		\      builtin_assert ("machine=cris");		\    }						\  while (0)/* This needs to be at least 32 bits.  */extern int target_flags;/* Previously controlled by target_flags.  */#define TARGET_ELF 1/* Previously controlled by target_flags.  Note that this is *not* set   for -melinux.  */#define TARGET_LINUX 0/* Default target_flags if no switches specified.  */#ifndef TARGET_DEFAULT# define TARGET_DEFAULT \ (MASK_SIDE_EFFECT_PREFIXES + MASK_STACK_ALIGN \  + MASK_CONST_ALIGN + MASK_DATA_ALIGN \  + MASK_PROLOGUE_EPILOGUE + MASK_MUL_BUG)#endif/* For the cris-*-elf subtarget.  */#define CRIS_SUBTARGET_DEFAULT 0#define CRIS_CPU_BASE 0#define CRIS_CPU_ETRAX4 3	/* Just lz added.  */#define CRIS_CPU_SVINTO 8	/* Added swap, jsrc & Co., 32-bit accesses.  */#define CRIS_CPU_NG 10		/* Added mul[su].  *//* Local, providing a default for cris_cpu_version.  */#define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_BASE#define TARGET_HAS_MUL_INSNS (cris_cpu_version >= CRIS_CPU_NG)#define CRIS_SUBTARGET_HANDLE_OPTION(x, y, z)/* Print subsidiary information on the compiler version in use.   Do not use VD.D syntax (D=digit), since this will cause confusion   with the base gcc version among users, when we ask which version of   gcc-cris they are using.  Please use some flavor of "R<number>" for   the version (no need for major.minor versions, I believe).  */#define TARGET_VERSION \ fprintf (stderr, " [Axis CRIS%s]", CRIS_SUBTARGET_VERSION)/* For the cris-*-elf subtarget.  */#define CRIS_SUBTARGET_VERSION " - generic ELF"#define OVERRIDE_OPTIONS cris_override_options ()/* The following gives optimal code for gcc-2.7.2, but *may* be subject   to change.  Omitting flag_force_addr gives .1-.7% faster code for gcc   *only*, but 1.3% larger code.  On ipps it gives 5.3-10.6% slower   code(!) and 0.3% larger code.  For products, images gets .1-1.8%   larger.  Do not set strict aliasing from optimization options.  */#define OPTIMIZATION_OPTIONS(OPTIMIZE, SIZE)	\  do						\    {						\      if ((OPTIMIZE) >= 2 || (SIZE))		\	{					\	  flag_force_addr = 1;			\	  flag_omit_frame_pointer = 1;		\	}					\    }						\  while (0)/* Node: Storage Layout */#define BITS_BIG_ENDIAN 0#define BYTES_BIG_ENDIAN 0/* WORDS_BIG_ENDIAN is not defined in the hardware, but for consistency,   we use little-endianness, and we may also be able to use   post-increment on DImode indirect.  */#define WORDS_BIG_ENDIAN 0#define UNITS_PER_WORD 4/* A combination of defining PROMOTE_FUNCTION_MODE,   TARGET_PROMOTE_FUNCTION_ARGS that always returns true   and *not* defining TARGET_PROMOTE_PROTOTYPES or PROMOTE_MODE gives the   best code size and speed for gcc, ipps and products in gcc-2.7.2.  */#define CRIS_PROMOTED_MODE(MODE, UNSIGNEDP, TYPE) \ (GET_MODE_CLASS (MODE) == MODE_INT && GET_MODE_SIZE (MODE) < 4) \  ? SImode : MODE#define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE)  \  (MODE) = CRIS_PROMOTED_MODE (MODE, UNSIGNEDP, TYPE)/* Defining PROMOTE_FUNCTION_RETURN in gcc-2.7.2 uncovers bug 981110 (even   if defining FUNCTION_VALUE with MODE as PROMOTED_MODE ;-)   FIXME: Report this when cris.h is part of GCC, so others can easily   see the problem.  Maybe check other systems that define   TARGET_PROMOTE_FUNCTION_RETURN that always returns true.  *//* We will be using prototype promotion, so they will be 32 bit.  */#define PARM_BOUNDARY 32/* Stack boundary is guided by -mstack-align, -mno-stack-align,   -malign.   Old comment: (2.1: still valid in 2.7.2?)    Note that to make this macro affect the alignment of stack   locals, a fix was required, and special precautions when handling   the stack pointer in various other macros (TARGET_ASM_FUNCTION_PROLOGUE   et al) were required.  See file "function.c".  If you would just define   this macro, it would only affect the builtin alloca and variable   local data (non-ANSI, non-K&R, Gnu C extension).  */#define STACK_BOUNDARY \ (TARGET_STACK_ALIGN ? (TARGET_ALIGN_BY_32 ? 32 : 16) : 8)

⌨️ 快捷键说明

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