📄 cris.h
字号:
/* Definitions for GCC. Part of the machine description for CRIS. Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 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, 59 Temple Place - Suite 330,Boston, MA 02111-1307, 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. *//* 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/* Other convenience definitions. */#define CRIS_PC_REGNUM 15#define CRIS_SRP_REGNUM 16/* Most of the time, we need the index into the register-names array. When passing debug-info, we need the real register number. */#define CRIS_CANONICAL_SRP_REGNUM (16 + 11)#define CRIS_CANONICAL_MOF_REGNUM (16 + 7)/* 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"/* If you tweak this, don't forget to check cris_expand_builtin_va_arg. */#define CRIS_FUNCTION_ARG_SIZE(MODE, TYPE) \ ((MODE) != BLKmode ? GET_MODE_SIZE (MODE) \ : (unsigned) int_size_in_bytes (TYPE))/* Check for max allowed stackframe. A "const char *" to be parsed. */extern const char *cris_max_stackframe_str;/* Which CPU version this is. A "const char *" to be parsed. */extern const char *cris_cpu_str;/* Which CPU version this is. The parsed and adjusted cris_cpu_str. */extern int cris_cpu_version;/* Which CPU version to tune for. A "const char *" to be parsed. */extern const char *cris_tune_str;/* The argument to "-melinux-stacksize=". We don't parse it currently; it's just passed on to the linker. We might want to do something here someday. */extern const char *cris_elinux_stacksize_str;/* 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 ""/* Override previous definitions (linux.h). */#undef ASM_SPEC#define ASM_SPEC \ "%{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 only difference from the default is to get libsc.a if -sim is given to the driver. Repeat -lc -lsysX {X=sim,linux}, because libsysX needs (at least) errno from libc, and then we want to resolve new unknowns in libc against libsysX, not libnosys. *//* Override previous definitions (linux.h). */#undef LIB_SPEC#define LIB_SPEC \ "%{sim*:-lc -lsyssim -lc -lsyssim}\ %{!sim*:%{g*:-lg}\ %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} -lbsp}\ -lnosys"/* Linker startfile options; crt0 flavors. At the moment there are no gcrt0.o or mcrt0.o, but keep them here and link them to crt0.o to be prepared. Use scrt0.c if running the simulator, linear style, or s2crt0.c if fixed style. *//* We need to remove any previous definition (elfos.h). */#undef STARTFILE_SPEC#define STARTFILE_SPEC \ "%{sim2:s2crt0.o%s}\ %{!sim2:%{sim:scrt0.o%s}\ %{!sim:%{pg:gcrt0.o%s}\ %{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\ crtbegin.o%s"#undef ENDFILE_SPEC#define ENDFILE_SPEC "crtend.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"); \ } \ while (0)#define TARGET_OS_CPP_BUILTINS() \ do \ { \ builtin_define ("__ELF__"); \ } \ while (0)/* This needs to be at least 32 bits. */extern int target_flags;/* Currently this just affects aligment. FIXME: Redundant with TARGET_ALIGN_BY_32, or put machine stuff here? */#define TARGET_MASK_SVINTO 1#define TARGET_SVINTO (target_flags & TARGET_MASK_SVINTO)/* If to use condition-codes generated by insns other than the immediately preceding compare/test insn. Used to check for errors in notice_update_cc. */#define TARGET_MASK_CCINIT 2#define TARGET_CCINIT (target_flags & TARGET_MASK_CCINIT)/* Debug option. */#define TARGET_MASK_PDEBUG 4#define TARGET_PDEBUG (target_flags & TARGET_MASK_PDEBUG)/* If to use side-effect patterns. Used to debug the [rx=ry+i] type patterns. */#define TARGET_MASK_SIDE_EFFECT_PREFIXES 8#define TARGET_SIDE_EFFECT_PREFIXES \ (target_flags & TARGET_MASK_SIDE_EFFECT_PREFIXES)/* If to expand mul into mstep. Only used when making libc.a. */#define TARGET_MASK_EXPAND_MUL 16#define TARGET_EXPAND_MUL (target_flags & TARGET_MASK_EXPAND_MUL)/* If to *keep* (not force) alignment of stack at 16 bits. */#define TARGET_MASK_STACK_ALIGN 32#define TARGET_STACK_ALIGN (target_flags & TARGET_MASK_STACK_ALIGN)/* If to do alignment on individual non-modifiable objects. */#define TARGET_MASK_CONST_ALIGN 64#define TARGET_CONST_ALIGN (target_flags & TARGET_MASK_CONST_ALIGN)/* If to do alignment on individual modifiable objects. */#define TARGET_MASK_DATA_ALIGN 128#define TARGET_DATA_ALIGN (target_flags & TARGET_MASK_DATA_ALIGN)/* If not to omit function prologue and epilogue. */#define TARGET_MASK_PROLOGUE_EPILOGUE 256#define TARGET_PROLOGUE_EPILOGUE (target_flags & TARGET_MASK_PROLOGUE_EPILOGUE)/* Instructions additions from Etrax 4 and up. (Just "lz", which we don't really generate from GCC -- yet). */#define TARGET_MASK_ETRAX4_ADD 512#define TARGET_ETRAX4_ADD (target_flags & TARGET_MASK_ETRAX4_ADD)/* Say that all alignment specifications say to prefer 32 rather than 16 bits. */#define TARGET_MASK_ALIGN_BY_32 1024#define TARGET_ALIGN_BY_32 (target_flags & TARGET_MASK_ALIGN_BY_32)/* This condition is of limited use, as gcc is riddled with #ifdef:s controlling this, rather than if (...):s. */#define TARGET_MASK_ELF 2048#define TARGET_ELF (target_flags & TARGET_MASK_ELF)/* Currently just used to error-check other options. Note that this is *not* set for -melinux. */#define TARGET_MASK_LINUX 4096#define TARGET_LINUX (target_flags & TARGET_MASK_LINUX)/* There's a small setup cost with using GOTPLT references, but should in total be a win both in code-size and execution-time. */#define TARGET_MASK_AVOID_GOTPLT 8192#define TARGET_AVOID_GOTPLT (target_flags & TARGET_MASK_AVOID_GOTPLT)#define TARGET_SWITCHES \ { \ /* No "no-etrax" as it does not really imply any model. \ On the other hand, "etrax" implies the common (and large) \ subset matching all models. */ \ {"etrax4", TARGET_MASK_ETRAX4_ADD, \ N_("Compile for ETRAX 4 (CRIS v3)")}, \ {"no-etrax4", -TARGET_MASK_ETRAX4_ADD, ""}, \ {"etrax100", (TARGET_MASK_SVINTO \ + TARGET_MASK_ETRAX4_ADD \ + TARGET_MASK_ALIGN_BY_32), \ N_("Compile for ETRAX 100 (CRIS v8)")}, \ {"no-etrax100", -(TARGET_MASK_SVINTO \ + TARGET_MASK_ETRAX4_ADD), ""}, \ {"pdebug", TARGET_MASK_PDEBUG, \ N_("Emit verbose debug information in assembly code")}, \ {"no-pdebug", -TARGET_MASK_PDEBUG, ""}, \ {"cc-init", TARGET_MASK_CCINIT, \ N_("Do not use condition codes from normal instructions")}, \ {"no-cc-init", -TARGET_MASK_CCINIT, ""}, \ {"side-effects", TARGET_MASK_SIDE_EFFECT_PREFIXES, ""}, \ {"no-side-effects", -TARGET_MASK_SIDE_EFFECT_PREFIXES, \ N_("Do not emit addressing modes with side-effect assignment")}, \ {"stack-align", TARGET_MASK_STACK_ALIGN, ""}, \ {"no-stack-align", -TARGET_MASK_STACK_ALIGN, \ N_("Do not tune stack alignment")}, \ {"data-align", TARGET_MASK_DATA_ALIGN, ""}, \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -