📄 m68k.h
字号:
/* Definitions of target machine for GCC for Motorola 680x0/ColdFire. Copyright (C) 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, 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 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. *//* We need to have MOTOROLA always defined (either 0 or 1) because we use if-statements and ?: on it. This way we have compile-time error checking for both the MOTOROLA and MIT code paths. We do rely on the host compiler to optimize away all constant tests. */#ifdef MOTOROLA# undef MOTOROLA# define MOTOROLA 1 /* Use the Motorola assembly syntax. */# define TARGET_VERSION fprintf (stderr, " (68k, Motorola syntax)")#else# define TARGET_VERSION fprintf (stderr, " (68k, MIT syntax)")# define MOTOROLA 0 /* Use the MIT assembly syntax. */#endif/* Note that some other tm.h files include this one and then override many of the definitions that relate to assembler syntax. */#define TARGET_CPU_CPP_BUILTINS() \ do \ { \ builtin_define ("__m68k__"); \ builtin_define_std ("mc68000"); \ if (TARGET_68040_ONLY) \ { \ if (TARGET_68060) \ builtin_define_std ("mc68060"); \ else \ builtin_define_std ("mc68040"); \ } \ else if (TARGET_68060) /* -m68020-60 */ \ { \ builtin_define_std ("mc68060"); \ builtin_define_std ("mc68040"); \ builtin_define_std ("mc68030"); \ builtin_define_std ("mc68020"); \ } \ else if (TARGET_68040) /* -m68020-40 */ \ { \ builtin_define_std ("mc68040"); \ builtin_define_std ("mc68030"); \ builtin_define_std ("mc68020"); \ } \ else if (TARGET_68030) \ builtin_define_std ("mc68030"); \ else if (TARGET_68020) \ builtin_define_std ("mc68020"); \ if (TARGET_68881) \ builtin_define ("__HAVE_68881__"); \ if (TARGET_CPU32) \ { \ builtin_define_std ("mc68332"); \ builtin_define_std ("mcpu32"); \ } \ if (TARGET_COLDFIRE) \ builtin_define ("__mcoldfire__"); \ if (TARGET_5200) \ builtin_define ("__mcf5200__"); \ if (TARGET_528x) \ { \ builtin_define ("__mcf528x__"); \ builtin_define ("__mcf5200__"); \ } \ if (TARGET_CFV3) \ { \ builtin_define ("__mcf5300__"); \ builtin_define ("__mcf5307__"); \ } \ if (TARGET_CFV4) \ { \ builtin_define ("__mcf5400__"); \ builtin_define ("__mcf5407__"); \ } \ if (TARGET_CF_HWDIV) \ builtin_define ("__mcfhwdiv__"); \ if (flag_pic) \ { \ builtin_define ("__pic__"); \ if (flag_pic > 1) \ builtin_define ("__PIC__"); \ } \ builtin_assert ("cpu=m68k"); \ builtin_assert ("machine=m68k"); \ } \ while (0)/* Classify the groups of pseudo-ops used to assemble QI, HI and SI quantities. */#define INT_OP_STANDARD 0 /* .byte, .short, .long */#define INT_OP_DOT_WORD 1 /* .byte, .word, .long */#define INT_OP_NO_DOT 2 /* byte, short, long */#define INT_OP_DC 3 /* dc.b, dc.w, dc.l *//* Set the default. */#define INT_OP_GROUP INT_OP_DOT_WORD/* Compile for a CPU32. A 68020 without bitfields is a good heuristic for a CPU32. */#define TARGET_CPU32 (TARGET_68020 && !TARGET_BITFIELD)/* Is the target a ColdFire? */#define MASK_COLDFIRE (MASK_5200 | MASK_528x | MASK_CFV3 | MASK_CFV4)#define TARGET_COLDFIRE ((target_flags & MASK_COLDFIRE) != 0)#define OVERRIDE_OPTIONS override_options()/* These are meant to be redefined in the host dependent files */#define SUBTARGET_OVERRIDE_OPTIONS/* target machine storage layout */#define LONG_DOUBLE_TYPE_SIZE 80/* Set the value of FLT_EVAL_METHOD in float.h. When using 68040 fp instructions, we get proper intermediate rounding, otherwise we get extended precision results. */#define TARGET_FLT_EVAL_METHOD ((TARGET_68040_ONLY || ! TARGET_68881) ? 0 : 2)#define BITS_BIG_ENDIAN 1#define BYTES_BIG_ENDIAN 1#define WORDS_BIG_ENDIAN 1#define UNITS_PER_WORD 4#define PARM_BOUNDARY (TARGET_SHORT ? 16 : 32)#define STACK_BOUNDARY 16#define FUNCTION_BOUNDARY 16#define EMPTY_FIELD_BOUNDARY 16/* No data type wants to be aligned rounder than this. Most published ABIs say that ints should be aligned on 16 bit boundaries, but CPUs with 32-bit busses get better performance aligned on 32-bit boundaries. ColdFires without a misalignment module require 32-bit alignment. */#define BIGGEST_ALIGNMENT (TARGET_ALIGN_INT ? 32 : 16)#define STRICT_ALIGNMENT (TARGET_STRICT_ALIGNMENT)#define INT_TYPE_SIZE (TARGET_SHORT ? 16 : 32)/* Define these to avoid dependence on meaning of `int'. */#define WCHAR_TYPE "long int"#define WCHAR_TYPE_SIZE 32/* Maximum number of library IDs we permit with -mid-shared-library. */#define MAX_LIBRARY_ID 255/* Standard register usage. *//* For the m68k, we give the data registers numbers 0-7, the address registers numbers 010-017 (8-15), and the 68881 floating point registers numbers 020-027 (16-24). We also have a fake `arg-pointer' register 030 (25) used for register elimination. */#define FIRST_PSEUDO_REGISTER 25/* All m68k targets (except AmigaOS) use %a5 as the PIC register */#define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 13 : INVALID_REGNUM)/* 1 for registers that have pervasive standard uses and are not available for the register allocator. On the m68k, only the stack pointer is such. Our fake arg-pointer is obviously fixed as well. */#define FIXED_REGISTERS \ {/* Data registers. */ \ 0, 0, 0, 0, 0, 0, 0, 0, \ \ /* Address registers. */ \ 0, 0, 0, 0, 0, 0, 0, 1, \ \ /* Floating point registers \ (if available). */ \ 0, 0, 0, 0, 0, 0, 0, 0, \ \ /* Arg pointer. */ \ 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 \ {/* Data registers. */ \ 1, 1, 0, 0, 0, 0, 0, 0, \ \ /* Address registers. */ \ 1, 1, 0, 0, 0, 0, 0, 1, \ \ /* Floating point registers \ (if available). */ \ 1, 1, 0, 0, 0, 0, 0, 0, \ \ /* Arg pointer. */ \ 1 }#define REG_ALLOC_ORDER \{ /* d0/d1/a0/a1 */ \ 0, 1, 8, 9, \ /* d2-d7 */ \ 2, 3, 4, 5, 6, 7, \ /* a2-a7/arg */ \ 10, 11, 12, 13, 14, 15, 24, \ /* fp0-fp7 */ \ 16, 17, 18, 19, 20, 21, 22, 23\}/* Make sure everything's fine if we *don't* have a given processor. This assumes that putting a register in fixed_regs will keep the compiler's mitts completely off it. We don't bother to zero it out of register classes. */#define CONDITIONAL_REGISTER_USAGE \{ \ int i; \ HARD_REG_SET x; \ if (! TARGET_68881) \ { \ COPY_HARD_REG_SET (x, reg_class_contents[(int)FP_REGS]); \ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) \ if (TEST_HARD_REG_BIT (x, i)) \ fixed_regs[i] = call_used_regs[i] = 1; \ } \ if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) \ fixed_regs[PIC_OFFSET_TABLE_REGNUM] \ = call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \}/* On the m68k, ordinary registers hold 32 bits worth; for the 68881 registers, a single register is always enough for anything that can be stored in them at all. */#define HARD_REGNO_NREGS(REGNO, MODE) \ ((REGNO) >= 16 ? GET_MODE_NUNITS (MODE) \ : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))/* A C expression that is nonzero if hard register NEW_REG can be considered for use as a rename register for OLD_REG register. */#define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \ m68k_hard_regno_rename_ok (OLD_REG, NEW_REG)/* Value is true if hard register REGNO can hold a value of machine-mode MODE. On the 68000, the cpu registers can hold any mode except bytes in address registers, the 68881 registers can hold only SFmode or DFmode. */#define HARD_REGNO_MODE_OK(REGNO, MODE) \ m68k_regno_mode_ok ((REGNO), (MODE))#define MODES_TIEABLE_P(MODE1, MODE2) \ (! TARGET_68881 \ || ((GET_MODE_CLASS (MODE1) == MODE_FLOAT \ || GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \ == (GET_MODE_CLASS (MODE2) == MODE_FLOAT \ || GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT)))/* Specify the registers used for certain standard purposes. The values of these macros are register numbers. */#define STACK_POINTER_REGNUM 15/* Most m68k targets use %a6 as a frame pointer. The AmigaOS ABI uses %a6 for shared library calls, therefore the frame pointer is shifted to %a5 on this target. */#define FRAME_POINTER_REGNUM 14#define FRAME_POINTER_REQUIRED 0/* Base register for access to arguments of the function. * This isn't a hardware register. It will be eliminated to the * stack pointer or frame pointer. */#define ARG_POINTER_REGNUM 24#define STATIC_CHAIN_REGNUM 8/* Register in which address to store a structure value is passed to a function. */#define M68K_STRUCT_VALUE_REGNUM 9/* The m68k has three kinds of registers, so eight classes would be a complete set. One of them is not needed. */enum reg_class { NO_REGS, DATA_REGS, ADDR_REGS, FP_REGS, GENERAL_REGS, DATA_OR_FP_REGS, ADDR_OR_FP_REGS, ALL_REGS, LIM_REG_CLASSES };#define N_REG_CLASSES (int) LIM_REG_CLASSES#define REG_CLASS_NAMES \ { "NO_REGS", "DATA_REGS", \ "ADDR_REGS", "FP_REGS", \ "GENERAL_REGS", "DATA_OR_FP_REGS", \ "ADDR_OR_FP_REGS", "ALL_REGS" }#define REG_CLASS_CONTENTS \{ \ {0x00000000}, /* NO_REGS */ \ {0x000000ff}, /* DATA_REGS */ \ {0x0100ff00}, /* ADDR_REGS */ \ {0x00ff0000}, /* FP_REGS */ \ {0x0100ffff}, /* GENERAL_REGS */ \ {0x00ff00ff}, /* DATA_OR_FP_REGS */ \ {0x01ffff00}, /* ADDR_OR_FP_REGS */ \ {0x01ffffff}, /* ALL_REGS */ \}extern enum reg_class regno_reg_class[];#define REGNO_REG_CLASS(REGNO) (regno_reg_class[(REGNO)])#define INDEX_REG_CLASS GENERAL_REGS#define BASE_REG_CLASS ADDR_REGS/* We do a trick here to modify the effective constraints on the machine description; we zorch the constraint letters that aren't appropriate for a specific target. This allows us to guarantee that a specific kind of register will not be used for a given target without fiddling with the register classes above. */#define REG_CLASS_FROM_LETTER(C) \ ((C) == 'a' ? ADDR_REGS : \ ((C) == 'd' ? DATA_REGS : \ ((C) == 'f' ? (TARGET_68881 ? FP_REGS : \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -