📄 mcore.h
字号:
/* Definitions of target machine for GNU compiler, for Motorola M*CORE Processor. Copyright (C) 1993, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 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_MCORE_H#define GCC_MCORE_H/* RBE: need to move these elsewhere. */#undef LIKE_PPC_ABI #define MCORE_STRUCT_ARGS/* RBE: end of "move elsewhere". *//* Run-time Target Specification. */#define TARGET_MCORE/* Get tree.c to declare a target-specific specialization of merge_decl_attributes. */#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1#define TARGET_CPU_CPP_BUILTINS() \ do \ { \ builtin_define ("__mcore__"); \ builtin_define ("__MCORE__"); \ if (TARGET_LITTLE_END) \ builtin_define ("__MCORELE__"); \ else \ builtin_define ("__MCOREBE__"); \ if (TARGET_M340) \ builtin_define ("__M340__"); \ else \ builtin_define ("__M210__"); \ } \ while (0)/* If -m4align is ever re-enabled then add this line to the definition of CPP_SPEC %{!m4align:-D__MCORE_ALIGN_8__} %{m4align:-D__MCORE__ALIGN_4__}. */#undef CPP_SPEC#define CPP_SPEC "%{m210:%{mlittle-endian:%ethe m210 does not have little endian support}}"/* We don't have a -lg library, so don't put it in the list. */#undef LIB_SPEC#define LIB_SPEC "%{!shared: %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}"#undef ASM_SPEC#define ASM_SPEC "%{mbig-endian:-EB} %{m210:-cpu=210 -EB}"#undef LINK_SPEC#define LINK_SPEC "%{mbig-endian:-EB} %{m210:-EB} -X"#define TARGET_DEFAULT \ (MASK_HARDLIT \ | MASK_8ALIGN \ | MASK_DIV \ | MASK_RELAX_IMM \ | MASK_M340 \ | MASK_LITTLE_END)#ifndef MULTILIB_DEFAULTS#define MULTILIB_DEFAULTS { "mlittle-endian", "m340" }#endif/* The ability to have 4 byte alignment is being suppressed for now. If this ability is reenabled, you must disable the definition below *and* edit t-mcore to enable multilibs for 4 byte alignment code. */#undef TARGET_8ALIGN#define TARGET_8ALIGN 1extern char * mcore_current_function_name; /* The MCore ABI says that bitfields are unsigned by default. */#define CC1_SPEC "-funsigned-bitfields"/* What options are we going to default to specific settings when -O* happens; the user can subsequently override these settings. Omitting the frame pointer is a very good idea on the MCore. Scheduling isn't worth anything on the current MCore implementation. */#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \{ \ if (LEVEL) \ { \ flag_no_function_cse = 1; \ flag_omit_frame_pointer = 1; \ \ if (LEVEL >= 2) \ { \ flag_caller_saves = 0; \ flag_schedule_insns = 0; \ flag_schedule_insns_after_reload = 0; \ } \ } \ if (SIZE) \ { \ target_flags &= ~MASK_HARDLIT; \ } \}/* What options are we going to force to specific settings, regardless of what the user thought he wanted. We also use this for some post-processing of options. */#define OVERRIDE_OPTIONS mcore_override_options ()/* Target machine storage Layout. */#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \ if (GET_MODE_CLASS (MODE) == MODE_INT \ && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \ { \ (MODE) = SImode; \ (UNSIGNEDP) = 1; \ }/* Define this if most significant bit is lowest numbered in instructions that operate on numbered bit-fields. */#define BITS_BIG_ENDIAN 0/* Define this if most significant byte of a word is the lowest numbered. */#define BYTES_BIG_ENDIAN (! TARGET_LITTLE_END)/* Define this if most significant word of a multiword number is the lowest numbered. */#define WORDS_BIG_ENDIAN (! TARGET_LITTLE_END)#define LIBGCC2_WORDS_BIG_ENDIAN 1#ifdef __MCORELE__#undef LIBGCC2_WORDS_BIG_ENDIAN#define LIBGCC2_WORDS_BIG_ENDIAN 0#endif#define MAX_BITS_PER_WORD 32/* Width of a word, in units (bytes). */#define UNITS_PER_WORD 4/* A C expression for the size in bits of the type `long long' on the target machine. If you don't define this, the default is two words. */#define LONG_LONG_TYPE_SIZE 64/* Allocation boundary (in *bits*) for storing arguments in argument list. */#define PARM_BOUNDARY 32/* Doubles must be aligned to an 8 byte boundary. */#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \ ((MODE != BLKmode && (GET_MODE_SIZE (MODE) == 8)) \ ? BIGGEST_ALIGNMENT : PARM_BOUNDARY) /* Boundary (in *bits*) on which stack pointer should be aligned. */#define STACK_BOUNDARY (TARGET_8ALIGN ? 64 : 32)/* Largest increment in UNITS we allow the stack to grow in a single operation. */extern int mcore_stack_increment;#define STACK_UNITS_MAXSTEP 4096/* Allocation boundary (in *bits*) for the code of a function. */#define FUNCTION_BOUNDARY ((TARGET_OVERALIGN_FUNC) ? 32 : 16)/* Alignment of field after `int : 0' in a structure. */#define EMPTY_FIELD_BOUNDARY 32/* No data type wants to be aligned rounder than this. */#define BIGGEST_ALIGNMENT (TARGET_8ALIGN ? 64 : 32)/* The best alignment to use in cases where we have a choice. */#define FASTEST_ALIGNMENT 32/* Every structures size must be a multiple of 8 bits. */#define STRUCTURE_SIZE_BOUNDARY 8/* Look at the fundamental type that is used for a bit-field and use that to impose alignment on the enclosing structure. struct s {int a:8}; should have same alignment as "int", not "char". */#define PCC_BITFIELD_TYPE_MATTERS 1/* Largest integer machine mode for structures. If undefined, the default is GET_MODE_SIZE(DImode). */#define MAX_FIXED_MODE_SIZE 32/* Make strings word-aligned so strcpy from constants will be faster. */#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ ((TREE_CODE (EXP) == STRING_CST \ && (ALIGN) < FASTEST_ALIGNMENT) \ ? FASTEST_ALIGNMENT : (ALIGN))/* Make arrays of chars word-aligned for the same reasons. */#define DATA_ALIGNMENT(TYPE, ALIGN) \ (TREE_CODE (TYPE) == ARRAY_TYPE \ && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN)) /* Set this nonzero if move instructions will actually fail to work when given unaligned data. */#define STRICT_ALIGNMENT 1/* Standard register usage. *//* Register allocation for our first guess r0 stack pointer r1 scratch, target reg for xtrb? r2-r7 arguments. r8-r14 call saved r15 link register ap arg pointer (doesn't really exist, always eliminated) c c bit fp frame pointer (doesn't really exist, always eliminated) x19 two control registers. *//* 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. MCore has 16 integer registers and 2 control registers + the arg pointer. */#define FIRST_PSEUDO_REGISTER 20#define R1_REG 1 /* Where literals are forced. */#define LK_REG 15 /* Overloaded on general register. */#define AP_REG 16 /* Fake arg pointer register. *//* RBE: mcore.md depends on CC_REG being set to 17. */#define CC_REG 17 /* Can't name it C_REG. */#define FP_REG 18 /* Fake frame pointer register. *//* Specify the registers used for certain standard purposes. The values of these macros are register numbers. */#undef PC_REGNUM /* Define this if the program counter is overloaded on a register. */#define STACK_POINTER_REGNUM 0 /* Register to use for pushing function arguments. */#define FRAME_POINTER_REGNUM 8 /* When we need FP, use r8. *//* The assembler's names for the registers. RFP need not always be used as the Real framepointer; it can also be used as a normal general register. Note that the name `fp' is horribly misleading since `fp' is in fact only the argument-and-return-context pointer. */#define REGISTER_NAMES \{ \ "sp", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ "apvirtual", "c", "fpvirtual", "x19" \}/* 1 for registers that have pervasive standard uses and are not available for the register allocator. */#define FIXED_REGISTERS \ /* r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 ap c fp x19 */ \ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 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. *//* RBE: r15 {link register} not available across calls, But we don't mark it that way here.... */#define CALL_USED_REGISTERS \ /* r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 ap c fp x19 */ \ { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}/* The order in which register should be allocated. */#define REG_ALLOC_ORDER \ /* r7 r6 r5 r4 r3 r2 r15 r14 r13 r12 r11 r10 r9 r8 r1 r0 ap c fp x19*/ \ { 7, 6, 5, 4, 3, 2, 15, 14, 13, 12, 11, 10, 9, 8, 1, 0, 16, 17, 18, 19}/* 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. On the MCore regs are UNITS_PER_WORD bits wide; */#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. We may keep double values in even registers. */#define HARD_REGNO_MODE_OK(REGNO, MODE) \ ((TARGET_8ALIGN && GET_MODE_SIZE (MODE) > UNITS_PER_WORD) ? (((REGNO) & 1) == 0) : (REGNO < 18))/* 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_CLASS (MODE1) == GET_MODE_CLASS (MODE2))/* Value should be nonzero if functions must have frame pointers. Zero means the frame pointer need not be set up (and parms may be accessed via the stack pointer) in functions that seem suitable. */#define FRAME_POINTER_REQUIRED 0/* Definitions for register eliminations. We have two registers that can be eliminated on the MCore. First, the frame pointer register can often be eliminated in favor of the stack pointer register. Secondly, the argument pointer register can always be eliminated; it is replaced with either the stack or frame pointer. *//* Base register for access to arguments of the function. */#define ARG_POINTER_REGNUM 16/* Register in which the static-chain is passed to a function. */#define STATIC_CHAIN_REGNUM 1/* This is an array of structures. Each structure initializes one pair of eliminable registers. The "from" register number is given first, followed by "to". Eliminations of the same "from" register are listed in order of preference. */#define ELIMINABLE_REGS \{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM},}/* Given FROM and TO register numbers, say whether this elimination is allowed. */#define CAN_ELIMINATE(FROM, TO) \ (!((FROM) == FRAME_POINTER_REGNUM && FRAME_POINTER_REQUIRED))/* Define the offset between two registers, one to be eliminated, and the other its replacement, at the start of a routine. */#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ OFFSET = mcore_initial_elimination_offset (FROM, TO)/* 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.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -