📄 v850.h
字号:
/* Definitions of target machine for GNU compiler. NEC V850 series Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. Contributed by Jeff Law (law@cygnus.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 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. */#include "svr4.h" /* Automatically does #undef CPP_PREDEFINES */#undef ASM_SPEC#define ASM_SPEC "%{mv*:-mv%*}"#ifndef CPP_SPEC#define CPP_SPEC "-D__v850__"#endif#undef ASM_FINAL_SPEC#undef LIB_SPEC#undef ENDFILE_SPEC#undef LINK_SPEC#undef STARTFILE_SPEC/* Names to predefine in the preprocessor for this target machine. */#define CPP_PREDEFINES "-D__v851__ -D__v850"/* Print subsidiary information on the compiler version in use. */#ifndef TARGET_VERSION#define TARGET_VERSION fprintf (stderr, " (NEC V850)");#endif/* Run-time compilation parameters selecting different hardware subsets. */extern int target_flags;/* Target flags bits, see below for an explanation of the bits. */#define MASK_GHS 0x00000001#define MASK_LONG_CALLS 0x00000002#define MASK_EP 0x00000004#define MASK_PROLOG_FUNCTION 0x00000008#define MASK_DEBUG 0x40000000#define MASK_CPU 0x00000030#define MASK_V850 0x00000010#define MASK_BIG_SWITCH 0x00000100#ifndef MASK_DEFAULT#define MASK_DEFAULT MASK_V850#endif#define TARGET_V850 ((target_flags & MASK_CPU) == MASK_V850)/* Macros used in the machine description to test the flags. *//* The GHS calling convention support doesn't really work, mostly due to a lack of documentation. Outstanding issues: * How do varargs & stdarg really work. How to they handle passing structures (if at all). * Doubles are normally 4 byte aligned, except in argument lists where they are 8 byte aligned. Is the alignment in the argument list based on the first parameter, first stack parameter, etc etc. * Passing/returning of large structures probably isn't the same as GHS. We don't have enough documentation on their conventions to be compatible. * Tests of SETUP_INCOMING_VARARGS need to be made runtime checks since it depends on TARGET_GHS. */#define TARGET_GHS (target_flags & MASK_GHS) /* Don't do PC-relative calls, instead load the address of the target function into a register and perform a register indirect call. */#define TARGET_LONG_CALLS (target_flags & MASK_LONG_CALLS)/* Whether to optimize space by using ep (r30) for pointers with small offsets in basic blocks. */#define TARGET_EP (target_flags & MASK_EP)/* Whether to call out-of-line functions to save registers or not. */#define TARGET_PROLOG_FUNCTION (target_flags & MASK_PROLOG_FUNCTION)/* Whether to emit 2 byte per entry or 4 byte per entry switch tables. */#define TARGET_BIG_SWITCH (target_flags & MASK_BIG_SWITCH)/* General debug flag */#define TARGET_DEBUG (target_flags & MASK_DEBUG)/* 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 \ {{ "ghs", MASK_GHS, "Support Green Hills ABI" }, \ { "no-ghs", -MASK_GHS, "" }, \ { "long-calls", MASK_LONG_CALLS, \ "Prohibit PC relative function calls" },\ { "no-long-calls", -MASK_LONG_CALLS, "" }, \ { "ep", MASK_EP, \ "Reuse r30 on a per function basis" }, \ { "no-ep", -MASK_EP, "" }, \ { "prolog-function", MASK_PROLOG_FUNCTION, \ "Use stubs for function prologues" }, \ { "no-prolog-function", -MASK_PROLOG_FUNCTION, "" }, \ { "space", MASK_EP | MASK_PROLOG_FUNCTION, \ "Same as: -mep -mprolog-function" }, \ { "debug", MASK_DEBUG, "Enable backend debugging" }, \ { "v850", MASK_V850, \ "Compile for the v850 processor" }, \ { "v850", -(MASK_V850 ^ MASK_CPU), "" }, \ { "big-switch", MASK_BIG_SWITCH, \ "Use 4 byte entries in switch tables" },\ EXTRA_SWITCHES \ { "", TARGET_DEFAULT, ""}}#ifndef EXTRA_SWITCHES#define EXTRA_SWITCHES#endif#ifndef TARGET_DEFAULT#define TARGET_DEFAULT MASK_DEFAULT#endif/* Information about the various small memory areas. */struct small_memory_info { char *name; char *value; 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];/* This macro is similar to `TARGET_SWITCHES' but defines names of command options that have values. Its definition is an initializer with a subgrouping for each command option. Each subgrouping contains a string constant, that defines the fixed part of the option name, and the address of a variable. The variable, type `char *', is set to the variable part of the given option if the fixed part matches. The actual option name is made by appending `-m' to the specified name. Here is an example which defines `-mshort-data-NUMBER'. If the given option is `-mshort-data-512', the variable `m88k_short_data' will be set to the string `"512"'. extern char *m88k_short_data; #define TARGET_OPTIONS \ { { "short-data-", &m88k_short_data } } */#define TARGET_OPTIONS \{ \ { "tda=", &small_memory[ (int)SMALL_MEMORY_TDA ].value, \ "Set the max size of data eligible for the TDA area" }, \ { "tda-", &small_memory[ (int)SMALL_MEMORY_TDA ].value, "" }, \ { "sda=", &small_memory[ (int)SMALL_MEMORY_SDA ].value, \ "Set the max size of data eligible for the SDA area" }, \ { "sda-", &small_memory[ (int)SMALL_MEMORY_SDA ].value, "" }, \ { "zda=", &small_memory[ (int)SMALL_MEMORY_ZDA ].value, \ "Set the max size of data eligible for the ZDA area" }, \ { "zda-", &small_memory[ (int)SMALL_MEMORY_ZDA ].value, "" }, \}/* Sometimes certain combinations of command options do not make sense on a particular target machine. You can define a macro `OVERRIDE_OPTIONS' to take account of this. This macro, if defined, is executed once just after all the command options have been parsed. Don't use this macro to turn on various extra optimizations for `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */#define OVERRIDE_OPTIONS override_options ()/* 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 non-zero 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) \{ \ if (LEVEL) \ target_flags |= (MASK_EP | 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/* Number of bits in an addressable 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/* 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 1/* 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/* Define results of standard character escape sequences. */#define TARGET_BELL 007#define TARGET_BS 010#define TARGET_TAB 011#define TARGET_NEWLINE 012#define TARGET_VT 013#define TARGET_FF 014#define TARGET_CR 015/* 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 */ \}/* 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{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -