📄 v850.h
字号:
/* Definitions of target machine for GNU compiler. NEC V850 series Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Jeff Law (law@cygnus.com). This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the 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 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */#ifndef GCC_V850_H#define GCC_V850_H/* These are defined in svr4.h but we want to override them. */#undef LIB_SPEC#undef ENDFILE_SPEC#undef LINK_SPEC#undef STARTFILE_SPEC#undef ASM_SPEC#define TARGET_CPU_generic 1#define TARGET_CPU_v850e 2#define TARGET_CPU_v850e1 3#ifndef TARGET_CPU_DEFAULT#define TARGET_CPU_DEFAULT TARGET_CPU_generic#endif#define MASK_DEFAULT MASK_V850#define SUBTARGET_ASM_SPEC "%{!mv*:-mv850}"#define SUBTARGET_CPP_SPEC "%{!mv*:-D__v850__}"#define TARGET_VERSION fprintf (stderr, " (NEC V850)");/* Choose which processor will be the default. We must pass a -mv850xx option to the assembler if no explicit -mv* option is given, because the assembler's processor default may not be correct. */#if TARGET_CPU_DEFAULT == TARGET_CPU_v850e#undef MASK_DEFAULT#define MASK_DEFAULT MASK_V850E#undef SUBTARGET_ASM_SPEC#define SUBTARGET_ASM_SPEC "%{!mv*:-mv850e}"#undef SUBTARGET_CPP_SPEC#define SUBTARGET_CPP_SPEC "%{!mv*:-D__v850e__}"#undef TARGET_VERSION#define TARGET_VERSION fprintf (stderr, " (NEC V850E)");#endif#if TARGET_CPU_DEFAULT == TARGET_CPU_v850e1#undef MASK_DEFAULT#define MASK_DEFAULT MASK_V850E /* No practical difference. */#undef SUBTARGET_ASM_SPEC#define SUBTARGET_ASM_SPEC "%{!mv*:-mv850e1}"#undef SUBTARGET_CPP_SPEC#define SUBTARGET_CPP_SPEC "%{!mv*:-D__v850e1__} %{mv850e1:-D__v850e1__}"#undef TARGET_VERSION#define TARGET_VERSION fprintf (stderr, " (NEC V850E1)");#endif#define ASM_SPEC "%{mv*:-mv%*}"#define CPP_SPEC "%{mv850e:-D__v850e__} %{mv850:-D__v850__} %(subtarget_cpp_spec)"#define EXTRA_SPECS \ { "subtarget_asm_spec", SUBTARGET_ASM_SPEC }, \ { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC } /* Names to predefine in the preprocessor for this target machine. */#define TARGET_CPU_CPP_BUILTINS() do { \ builtin_define( "__v851__" ); \ builtin_define( "__v850" ); \ builtin_assert( "machine=v850" ); \ builtin_assert( "cpu=v850" ); \ if (TARGET_EP) \ builtin_define ("__EP__"); \} while(0)#define MASK_CPU (MASK_V850 | MASK_V850E)/* Information about the various small memory areas. */struct small_memory_info { const char *name; long max; long physical_max;};enum small_memory_type { /* tiny data area, using EP as base register */ SMALL_MEMORY_TDA = 0, /* small data area using dp as base register */ SMALL_MEMORY_SDA, /* zero data area using r0 as base register */ SMALL_MEMORY_ZDA, SMALL_MEMORY_max};extern struct small_memory_info small_memory[(int)SMALL_MEMORY_max];/* Show we can debug even without a frame pointer. */#define CAN_DEBUG_WITHOUT_FP/* Some machines may desire to change what optimizations are performed for various optimization levels. This macro, if defined, is executed once just after the optimization level is determined and before the remainder of the command options have been parsed. Values set in this macro are used as the default values for the other command line options. LEVEL is the optimization level specified; 2 if `-O2' is specified, 1 if `-O' is specified, and 0 if neither is specified. SIZE is nonzero if `-Os' is specified, 0 otherwise. You should not use this macro to change options that are not machine-specific. These should uniformly selected by the same optimization level on all supported machines. Use this macro to enable machine-specific optimizations. *Do not examine `write_symbols' in this macro!* The debugging options are not supposed to alter the generated code. */#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \{ \ target_flags |= MASK_STRICT_ALIGN; \ if (LEVEL) \ /* Note - we no longer enable MASK_EP when optimizing. This is \ because of a hardware bug which stops the SLD and SST instructions\ from correctly detecting some hazards. If the user is sure that \ their hardware is fixed or that their program will not encounter \ the conditions that trigger the bug then they can enable -mep by \ hand. */ \ target_flags |= MASK_PROLOG_FUNCTION; \}/* Target machine storage layout *//* Define this if most significant bit is lowest numbered in instructions that operate on numbered bit-fields. This is not true on the NEC V850. */#define BITS_BIG_ENDIAN 0/* Define this if most significant byte of a word is the lowest numbered. *//* This is not true on the NEC V850. */#define BYTES_BIG_ENDIAN 0/* Define this if most significant word of a multiword number is lowest numbered. This is not true on the NEC V850. */#define WORDS_BIG_ENDIAN 0/* Width of a word, in units (bytes). */#define UNITS_PER_WORD 4/* Define this macro if it is advisable to hold scalars in registers in a wider mode than that declared by the program. In such cases, the value is constrained to be within the bounds of the declared type, but kept valid in the wider mode. The signedness of the extension may differ from that of the type. Some simple experiments have shown that leaving UNSIGNEDP alone generates the best overall code. */#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \ if (GET_MODE_CLASS (MODE) == MODE_INT \ && GET_MODE_SIZE (MODE) < 4) \ { (MODE) = SImode; }/* Allocation boundary (in *bits*) for storing arguments in argument list. */#define PARM_BOUNDARY 32/* The stack goes in 32 bit lumps. */#define STACK_BOUNDARY 32/* Allocation boundary (in *bits*) for the code of a function. 16 is the minimum boundary; 32 would give better performance. */#define FUNCTION_BOUNDARY 16/* No data type wants to be aligned rounder than this. */#define BIGGEST_ALIGNMENT 32/* Alignment of field after `int : 0' in a structure. */#define EMPTY_FIELD_BOUNDARY 32/* No structure field wants to be aligned rounder than this. */#define BIGGEST_FIELD_ALIGNMENT 32/* Define this if move instructions will actually fail to work when given unaligned data. */#define STRICT_ALIGNMENT TARGET_STRICT_ALIGN/* Define this as 1 if `char' should by default be signed; else as 0. On the NEC V850, loads do sign extension, so make this default. */#define DEFAULT_SIGNED_CHAR 1/* 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. */#define FIRST_PSEUDO_REGISTER 34/* 1 for registers that have pervasive standard uses and are not available for the register allocator. */#define FIXED_REGISTERS \ { 1, 1, 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, 1, 0, \ 1, 1}/* 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, 0, 1, 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, 1, 1, \ 1, 1}/* List the order in which to allocate registers. Each register must be listed once, even those in FIXED_REGISTERS. On the 850, we make the return registers first, then all of the volatile registers, then the saved registers in reverse order to better save the registers with an out of line function, and finally the fixed registers. */#define REG_ALLOC_ORDER \{ \ 10, 11, /* return registers */ \ 12, 13, 14, 15, 16, 17, 18, 19, /* scratch registers */ \ 6, 7, 8, 9, 31, /* argument registers */ \ 29, 28, 27, 26, 25, 24, 23, 22, /* saved registers */ \ 21, 20, 2, \ 0, 1, 3, 4, 5, 30, 32, 33 /* fixed registers */ \}/* If TARGET_APP_REGS is not defined then add r2 and r5 to the pool of fixed registers. See PR 14505. */#define CONDITIONAL_REGISTER_USAGE \{ \ if (!TARGET_APP_REGS) \ { \ fixed_regs[2] = 1; call_used_regs[2] = 1; \ fixed_regs[5] = 1; call_used_regs[5] = 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. */#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. */#define HARD_REGNO_MODE_OK(REGNO, MODE) \ ((((REGNO) & 1) == 0) || (GET_MODE_SIZE (MODE) <= 4))/* 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_SIZE (MODE1) <= 4 && GET_MODE_SIZE (MODE2) <= 4))/* 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. */ enum reg_class{ NO_REGS, GENERAL_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", "ALL_REGS", "LIM_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 \{ \ { 0x00000000 }, /* NO_REGS */ \ { 0xffffffff }, /* GENERAL_REGS */ \ { 0xffffffff }, /* ALL_REGS */ \}/* 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) GENERAL_REGS/* The class value for index registers, and the one for base regs. */#define INDEX_REG_CLASS NO_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) (NO_REGS)/* Macros to check register numbers against specific register classes. *//* These assume that REGNO is a hard or pseudo reg number. They give nonzero only if REGNO is a hard reg of the suitable class or a pseudo reg currently allocated to a suitable hard reg. Since they use reg_renumber, they are safe only once reg_renumber has been allocated, which happens in local-alloc.c. */ #define REGNO_OK_FOR_BASE_P(regno) \ ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)#define REGNO_OK_FOR_INDEX_P(regno) 0/* Given an rtx X being reloaded into a reg required to be in class CLASS, return the class of reg to actually use. In general this is just CLASS; but on some machines in some cases it is preferable to use a more restrictive class. */#define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)/* Return the maximum number of consecutive registers needed to represent mode MODE in a register of class CLASS. */#define CLASS_MAX_NREGS(CLASS, MODE) \ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)/* The letters I, J, K, L, M, N, O, P in a register constraint string can be used to stand for particular ranges of immediate operands. This macro defines what the ranges are. C is the letter, and VALUE is a constant value. Return 1 if VALUE is in the range specified by C. */#define INT_7_BITS(VALUE) ((unsigned) (VALUE) + 0x40 < 0x80)#define INT_8_BITS(VALUE) ((unsigned) (VALUE) + 0x80 < 0x100)/* zero */#define CONST_OK_FOR_I(VALUE) ((VALUE) == 0)/* 5 bit signed immediate */#define CONST_OK_FOR_J(VALUE) ((unsigned) (VALUE) + 0x10 < 0x20)/* 16 bit signed immediate */#define CONST_OK_FOR_K(VALUE) ((unsigned) (VALUE) + 0x8000 < 0x10000)/* valid constant for movhi instruction. */#define CONST_OK_FOR_L(VALUE) \ (((unsigned) ((int) (VALUE) >> 16) + 0x8000 < 0x10000) \ && CONST_OK_FOR_I ((VALUE & 0xffff)))/* 16 bit unsigned immediate */#define CONST_OK_FOR_M(VALUE) ((unsigned)(VALUE) < 0x10000)/* 5 bit unsigned immediate in shift instructions */#define CONST_OK_FOR_N(VALUE) ((unsigned) (VALUE) <= 31)/* 9 bit signed immediate for word multiply instruction. */#define CONST_OK_FOR_O(VALUE) ((unsigned) (VALUE) + 0x100 < 0x200)#define CONST_OK_FOR_P(VALUE) 0#define CONST_OK_FOR_LETTER_P(VALUE, C) \ ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \ (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \ (C) == 'K' ? CONST_OK_FOR_K (VALUE) : \ (C) == 'L' ? CONST_OK_FOR_L (VALUE) : \ (C) == 'M' ? CONST_OK_FOR_M (VALUE) : \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -