📄 m68hc11.h
字号:
/* Definitions of target machine for GNU compiler. Motorola 68HC11 and 68HC12. Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Stephane Carrez (stcarrez@nerim.fr)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.Note: A first 68HC11 port was made by Otto Lind (otto@coactive.com) on gcc 2.6.3. I have used it as a starting point for this port. However, this new port is a complete re-write. Its internal design is completely different. The generated code is not compatible with the gcc 2.6.3 port. The gcc 2.6.3 port is available at: ftp.unina.it/pub/electronics/motorola/68hc11/gcc/gcc-6811-fsf.tar.gz*//********************************************************************************* Controlling the Compilation Driver, `gcc'*******************************************************************************/#undef ENDFILE_SPEC/* Compile and assemble for a 68hc11 unless there is a -m68hc12 option. */#ifndef ASM_SPEC#define ASM_SPEC \"%{m68hc12:-m68hc12}" \"%{m68hcs12:-m68hcs12}" \"%{!m68hc12:%{!m68hcs12:-m68hc11}} " \"%{mshort:-mshort}%{!mshort:-mlong} " \"%{fshort-double:-mshort-double}%{!fshort-double:-mlong-double}"#endif/* We need to tell the linker the target elf format. Just pass an emulation option. This can be overriden by -Wl option of gcc. */#ifndef LINK_SPEC#define LINK_SPEC \"%{m68hc12:-m m68hc12elf}" \"%{m68hcs12:-m m68hc12elf}" \"%{!m68hc12:%{!m68hcs12:-m m68hc11elf}} " \"%{!mnorelax:%{!m68hc12:%{!m68hcs12:-relax}}}"#endif#ifndef LIB_SPEC#define LIB_SPEC ""#endif#ifndef CC1_SPEC#define CC1_SPEC ""#endif#ifndef CPP_SPEC#define CPP_SPEC \"%{mshort:-D__HAVE_SHORT_INT__ -D__INT__=16}\ %{!mshort:-D__INT__=32}\ %{m68hc12:-Dmc6812 -DMC6812 -Dmc68hc12}\ %{m68hcs12:-Dmc6812 -DMC6812 -Dmc68hcs12}\ %{!m68hc12:%{!m68hcs12:-Dmc6811 -DMC6811 -Dmc68hc11}}\ %{fshort-double:-D__HAVE_SHORT_DOUBLE__}\ %{mlong-calls:-D__USE_RTC__}"#endif#undef STARTFILE_SPEC#define STARTFILE_SPEC "crt1%O%s"/* Names to predefine in the preprocessor for this target machine. */#define CPP_PREDEFINES "-Dmc68hc1x"/* As an embedded target, we have no libc. */#define inhibit_libc/* Forward type declaration for prototypes definitions. rtx_ptr is equivalent to rtx. Can't use the same name. */struct rtx_def;typedef struct rtx_def *rtx_ptr;union tree_node;typedef union tree_node *tree_ptr;/* We can't declare enum machine_mode forward nor include 'machmode.h' here. Prototypes defined here will use an int instead. It's better than no prototype at all. */typedef int enum_machine_mode;/********************************************************************************* Run-time Target Specification*******************************************************************************//* Run-time compilation parameters selecting different hardware subsets. */extern int target_flags;extern short *reg_renumber; /* def in local_alloc.c *//* Macros used in the machine description to test the flags. *//* 6811 specific options * * For 68HC12, the auto inc/dec mode is disabled by default. The reason * is that for most programs, the reload pass will fail because it needs * more registers to save the value of the indexed register after the * memory access. For simple programs, you can enable this * with -mauto-incdec. */#define MASK_SHORT 0002 /* Compile with 16-bit `int' */#define MASK_AUTO_INC_DEC 0004#define MASK_M6811 0010#define MASK_M6812 0020#define MASK_M68S12 0040#define MASK_NO_DIRECT_MODE 0100#define MASK_MIN_MAX 0200#define MASK_LONG_CALLS 0400#define TARGET_OP_TIME (optimize && optimize_size == 0)#define TARGET_SHORT (target_flags & MASK_SHORT)#define TARGET_M6811 (target_flags & MASK_M6811)#define TARGET_M6812 (target_flags & MASK_M6812)#define TARGET_M68S12 (target_flags & MASK_M68S12)#define TARGET_AUTO_INC_DEC (target_flags & MASK_AUTO_INC_DEC)#define TARGET_MIN_MAX (target_flags & MASK_MIN_MAX)#define TARGET_NO_DIRECT_MODE (target_flags & MASK_NO_DIRECT_MODE)#define TARGET_RELAX (TARGET_NO_DIRECT_MODE)#define TARGET_LONG_CALLS (target_flags & MASK_LONG_CALLS)/* Default target_flags if no switches specified. */#ifndef TARGET_DEFAULT# define TARGET_DEFAULT (MASK_M6811)#endif/* Define this macro as a C expression for the initializer of an array of string to tell the driver program which options are defaults for this target and thus do not need to be handled specially when using `MULTILIB_OPTIONS'. */#ifndef MULTILIB_DEFAULTS# if TARGET_DEFAULT & MASK_M6811# define MULTILIB_DEFAULTS { "m68hc11" }# else# define MULTILIB_DEFAULTS { "m68hc12" }# endif#endif/* 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 \{ { "short", MASK_SHORT, \ N_("Compile with 16-bit integer mode")}, \ { "noshort", - MASK_SHORT, \ N_("Compile with 32-bit integer mode")}, \ { "auto-incdec", MASK_AUTO_INC_DEC, \ N_("Auto pre/post decrement increment allowed")}, \ { "noauto-incdec", - MASK_AUTO_INC_DEC, \ N_("Auto pre/post decrement increment not allowed")}, \ { "inmax", MASK_MIN_MAX, \ N_("Min/max instructions allowed")}, \ { "nominmax", - MASK_MIN_MAX, \ N_("Min/max instructions not allowed")}, \ { "long-calls", MASK_LONG_CALLS, \ N_("Use call and rtc for function calls and returns")}, \ { "nolong-calls", - MASK_LONG_CALLS, \ N_("Use jsr and rts for function calls and returns")}, \ { "relax", MASK_NO_DIRECT_MODE, \ N_("Do not use direct addressing mode for soft registers")},\ { "norelax", -MASK_NO_DIRECT_MODE, \ N_("Use direct addressing mode for soft registers")}, \ { "68hc11", MASK_M6811, \ N_("Compile for a 68HC11")}, \ { "68hc12", MASK_M6812, \ N_("Compile for a 68HC12")}, \ { "68hcs12", MASK_M6812 | MASK_M68S12, \ N_("Compile for a 68HCS12")}, \ { "6811", MASK_M6811, \ N_("Compile for a 68HC11")}, \ { "6812", MASK_M6812, \ N_("Compile for a 68HC12")}, \ { "68S12", MASK_M6812 | MASK_M68S12, \ N_("Compile for a 68HCS12")}, \ { "", TARGET_DEFAULT, 0 }}/* 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. */#define TARGET_OPTIONS \{ { "reg-alloc=", &m68hc11_reg_alloc_order, \ N_("Specify the register allocation order")}, \ { "soft-reg-count=", &m68hc11_soft_reg_count, \ N_("Indicate the number of soft registers available") }, \ SUBTARGET_OPTIONS \}/* These are meant to be redefined in the host dependent files */#define SUBTARGET_SWITCHES#define SUBTARGET_OPTIONSextern const char *m68hc11_regparm_string;extern const char *m68hc11_reg_alloc_order;extern const char *m68hc11_soft_reg_count;#ifndef TARGET_M68HC12# define TARGET_M68HC11 1#endif/* Print subsidiary information on the compiler version in use. */#define TARGET_VERSION fprintf (stderr, " (MC68HC11/MC68HC12/MC68HCS12)")/* 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 m68hc11_override_options ();/* Define cost parameters for a given processor variant. */struct processor_costs { const int add; /* cost of an add instruction */ const int logical; /* cost of a logical instruction */ const int shift_var; const int shiftQI_const[8]; const int shiftHI_const[16]; const int multQI; const int multHI; const int multSI; const int divQI; const int divHI; const int divSI;};/* Costs for the current processor. */extern const struct processor_costs *m68hc11_cost;/* target machine storage layout *//* Define this if most significant byte of a word is the lowest numbered. */#define BYTES_BIG_ENDIAN 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 word of a multiword number is numbered. */#define WORDS_BIG_ENDIAN 1/* Width of a word, in units (bytes). */#define UNITS_PER_WORD 2/* Definition of size_t. This is really an unsigned short as the 68hc11 only handles a 64K address space. */#define SIZE_TYPE "short unsigned int"/* A C expression for a string describing the name of the data type to use for the result of subtracting two pointers. The typedef name `ptrdiff_t' is defined using the contents of the string. The 68hc11 only has a 64K address space. */#define PTRDIFF_TYPE "short int"/* Allocation boundary (bits) for storing pointers in memory. */#define POINTER_BOUNDARY 8/* Normal alignment required for function parameters on the stack, in bits. This can't be less than BITS_PER_WORD */#define PARM_BOUNDARY (BITS_PER_WORD)/* Boundary (bits) on which stack pointer should be aligned. */#define STACK_BOUNDARY 8/* Allocation boundary (bits) for the code of a function. */#define FUNCTION_BOUNDARY 8#define BIGGEST_ALIGNMENT 8/* Alignment of field after `int : 0' in a structure. */#define EMPTY_FIELD_BOUNDARY 8/* Every structure's size must be a multiple of this. */#define STRUCTURE_SIZE_BOUNDARY 8/* Define this if instructions will fail to work if given data not on the nominal alignment. If instructions will merely go slower in that case, do not define this macro. */#define STRICT_ALIGNMENT 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -