OSDN Git Service

M68K TLS support.
[pf3gnuchains/gcc-fork.git] / gcc / config / m68k / m68k.h
index 9d7843d..2d3b592 100644 (file)
@@ -1,12 +1,12 @@
 /* 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, 2006 Free Software Foundation, Inc.
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 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)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GCC is distributed in the hope that it will be useful,
@@ -15,9 +15,8 @@ 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.  */
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
 
 /* 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
@@ -48,11 +47,15 @@ Boston, MA 02110-1301, USA.  */
 %{m68060}%{mcpu32}%{m68332}%{m5200}%{m5206e}%{m528x}%{m5307}%{m5407}%{mcfv4e}\
 %{mcpu=*:-mcpu=%*}%{march=*:-march=%*}\
 "
+#define ASM_PCREL_SPEC "%{fPIC|fpic|mpcrel:--pcrel} \
+ %{msep-data|mid-shared-library:--pcrel} \
+"
 
-#define ASM_SPEC "%(asm_cpu_spec)"
+#define ASM_SPEC "%(asm_cpu_spec) %(asm_pcrel_spec)"
 
 #define EXTRA_SPECS                                    \
   { "asm_cpu_spec", ASM_CPU_SPEC },                    \
+  { "asm_pcrel_spec", ASM_PCREL_SPEC },                        \
   SUBTARGET_EXTRA_SPECS
 
 #define SUBTARGET_EXTRA_SPECS
@@ -105,6 +108,10 @@ Boston, MA 02110-1301, USA.  */
          builtin_define_std ("mc68020");                               \
          break;                                                        \
                                                                        \
+       case ucfv1:                                                     \
+         builtin_define ("__mcfv1__");                                 \
+         break;                                                        \
+                                                                       \
        case ucfv2:                                                     \
          builtin_define ("__mcfv2__");                                 \
          break;                                                        \
@@ -187,6 +194,9 @@ Boston, MA 02110-1301, USA.  */
       if (TARGET_CF_HWDIV)                                             \
        builtin_define ("__mcfhwdiv__");                                \
                                                                        \
+      if (TARGET_FIDOA)                                                        \
+       builtin_define ("__mfido__");                                   \
+                                                                       \
       builtin_assert ("cpu=m68k");                                     \
       builtin_assert ("machine=m68k");                                 \
     }                                                                  \
@@ -220,7 +230,9 @@ Boston, MA 02110-1301, USA.  */
 #define FL_ISA_APLUS (1 << 14)
 #define FL_ISA_B     (1 << 15)
 #define FL_ISA_C     (1 << 16)
+#define FL_FIDOA     (1 << 17)
 #define FL_MMU              0   /* Used by multilib machinery.  */
+#define FL_UCLINUX   0   /* Used by multilib machinery.  */
 
 #define TARGET_68010           ((m68k_cpu_flags & FL_ISA_68010) != 0)
 #define TARGET_68020           ((m68k_cpu_flags & FL_ISA_68020) != 0)
@@ -228,6 +240,7 @@ Boston, MA 02110-1301, USA.  */
 #define TARGET_COLDFIRE                ((m68k_cpu_flags & FL_COLDFIRE) != 0)
 #define TARGET_COLDFIRE_FPU    (m68k_fpu == FPUTYPE_COLDFIRE)
 #define TARGET_68881           (m68k_fpu == FPUTYPE_68881)
+#define TARGET_FIDOA           ((m68k_cpu_flags & FL_FIDOA) != 0)
 
 /* Size (in bytes) of FPU registers.  */
 #define TARGET_FP_REG_SIZE     (TARGET_COLDFIRE ? 8 : 12)
@@ -236,6 +249,10 @@ Boston, MA 02110-1301, USA.  */
 #define TARGET_ISAB            ((m68k_cpu_flags & FL_ISA_B) != 0)
 #define TARGET_ISAC            ((m68k_cpu_flags & FL_ISA_C) != 0)
 
+/* Some instructions are common to more than one ISA.  */
+#define ISA_HAS_MVS_MVZ        (TARGET_ISAB || TARGET_ISAC)
+#define ISA_HAS_FF1    (TARGET_ISAAPLUS || TARGET_ISAC)
+
 #define TUNE_68000     (m68k_tune == u68000)
 #define TUNE_68010     (m68k_tune == u68010)
 #define TUNE_68000_10  (TUNE_68000 || TUNE_68010)
@@ -248,7 +265,13 @@ Boston, MA 02110-1301, USA.  */
 #define TUNE_68060     (m68k_tune == u68060 || m68k_tune == u68020_60)
 #define TUNE_68040_60  (TUNE_68040 || TUNE_68060)
 #define TUNE_CPU32     (m68k_tune == ucpu32)
+#define TUNE_CFV1       (m68k_tune == ucfv1)
 #define TUNE_CFV2      (m68k_tune == ucfv2)
+#define TUNE_CFV3       (m68k_tune == ucfv3)
+#define TUNE_CFV4       (m68k_tune == ucfv4 || m68k_tune == ucfv4e)
+
+#define TUNE_MAC       ((m68k_tune_flags & FL_CF_MAC) != 0)
+#define TUNE_EMAC      ((m68k_tune_flags & FL_CF_EMAC) != 0)
 
 #define OVERRIDE_OPTIONS   override_options()
 
@@ -257,13 +280,15 @@ Boston, MA 02110-1301, USA.  */
 \f
 /* target machine storage layout */
 
-/* "long double" is the same as "double" on ColdFire targets.  */
+/* "long double" is the same as "double" on ColdFire and fido
+   targets.  */
 
-#define LONG_DOUBLE_TYPE_SIZE (TARGET_COLDFIRE ? 64 : 80)
+#define LONG_DOUBLE_TYPE_SIZE                  \
+  ((TARGET_COLDFIRE || TARGET_FIDOA) ? 64 : 80)
 
 /* We need to know the size of long double at compile-time in libgcc2.  */
 
-#ifdef __mcoldfire__
+#if defined(__mcoldfire__) || defined(__mfido__)
 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
 #else
 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 80
@@ -284,17 +309,20 @@ Boston, MA 02110-1301, USA.  */
 #define STACK_BOUNDARY 16
 #define FUNCTION_BOUNDARY 16
 #define EMPTY_FIELD_BOUNDARY 16
-/* ColdFire strongly prefers a 32-bit aligned stack.  */
-#define PREFERRED_STACK_BOUNDARY (TARGET_COLDFIRE ? 32 : 16)
+/* ColdFire and fido strongly prefer a 32-bit aligned stack.  */
+#define PREFERRED_STACK_BOUNDARY \
+  ((TARGET_COLDFIRE || TARGET_FIDOA) ? 32 : 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.  */
+   aligned on 32-bit boundaries.  */
 #define BIGGEST_ALIGNMENT (TARGET_ALIGN_INT ? 32 : 16)
 
 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGNMENT)
+#define M68K_HONOR_TARGET_STRICT_ALIGNMENT 1
+
+#define DWARF_CIE_DATA_ALIGNMENT -2
 
 #define INT_TYPE_SIZE (TARGET_SHORT ? 16 : 32)
 
@@ -316,7 +344,10 @@ Boston, MA 02110-1301, USA.  */
 #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)
+#define PIC_OFFSET_TABLE_REGNUM                                \
+  (!flag_pic ? INVALID_REGNUM                          \
+   : reload_completed ? REGNO (pic_offset_table_rtx)   \
+   : PIC_REG)
 
 /* 1 for registers that have pervasive standard uses
    and are not available for the register allocator.
@@ -383,9 +414,8 @@ Boston, MA 02110-1301, USA.  */
         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;           \
+  if (flag_pic)                                                        \
+    fixed_regs[PIC_REG] = call_used_regs[PIC_REG] = 1;         \
 }
 
 /* On the m68k, ordinary registers hold 32 bits worth;
@@ -417,14 +447,12 @@ Boston, MA 02110-1301, USA.  */
 /* Specify the registers used for certain standard purposes.
    The values of these macros are register numbers.  */
 
-#define STACK_POINTER_REGNUM 15
+#define STACK_POINTER_REGNUM SP_REG
 
 /* 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
+#define FRAME_POINTER_REGNUM A6_REG
 
 /* Base register for access to arguments of the function.
  * This isn't a hardware register. It will be eliminated to the
@@ -432,12 +460,12 @@ Boston, MA 02110-1301, USA.  */
  */
 #define ARG_POINTER_REGNUM 24
 
-#define STATIC_CHAIN_REGNUM 8
+#define STATIC_CHAIN_REGNUM A0_REG
 #define M68K_STATIC_CHAIN_REG_NAME REGISTER_PREFIX "a0"
 
 /* Register in which address to store a structure value
    is passed to a function.  */
-#define M68K_STRUCT_VALUE_REGNUM 9
+#define M68K_STRUCT_VALUE_REGNUM A1_REG
 
 \f
 
@@ -475,74 +503,6 @@ extern enum reg_class regno_reg_class[];
 #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_HARD_FLOAT ?         \
-                  FP_REGS : NO_REGS) :         \
-     NO_REGS)))
-
-/* For the m68k, `I' is used for the range 1 to 8
-   allowed as immediate shift counts and in addq.
-   `J' is used for the range of signed numbers that fit in 16 bits.
-   `K' is for numbers that moveq can't handle.
-   `L' is for range -8 to -1, range of values that can be added with subq.
-   `M' is for numbers that moveq+notb can't handle.
-   'N' is for range 24 to 31, rotatert:SI 8 to 1 expressed as rotate.
-   'O' is for 16 (for rotate using swap).
-   'P' is for range 8 to 15, rotatert:HI 8 to 1 expressed as rotate.
-   'R' is for numbers that mov3q can handle.  */
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
-  ((C) == 'I' ? (VALUE) > 0 && (VALUE) <= 8 : \
-   (C) == 'J' ? (VALUE) >= -0x8000 && (VALUE) <= 0x7FFF : \
-   (C) == 'K' ? (VALUE) < -0x80 || (VALUE) >= 0x80 : \
-   (C) == 'L' ? (VALUE) < 0 && (VALUE) >= -8 : \
-   (C) == 'M' ? (VALUE) < -0x100 || (VALUE) >= 0x100 : \
-   (C) == 'N' ? (VALUE) >= 24 && (VALUE) <= 31 : \
-   (C) == 'O' ? (VALUE) == 16 : \
-   (C) == 'P' ? (VALUE) >= 8 && (VALUE) <= 15 : \
-   (C) == 'R' ? valid_mov3q_const (VALUE) : 0)
-
-/* "G" defines all of the floating constants that are *NOT* 68881
-   constants.  This is so 68881 constants get reloaded and the
-   fpmovecr is used.  */
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)  \
-  ((C) == 'G' ? ! (TARGET_68881 && standard_68881_constant_p (VALUE)) : 0 )
-
-/* `Q' means address register indirect addressing mode.
-   `S' is for operands that satisfy 'm' when -mpcrel is in effect.
-   `T' is for operands that satisfy 's' when -mpcrel is not in effect.
-   `U' is for register offset addressing.
-   `W' is for const_call_operands.  */
-#define EXTRA_CONSTRAINT(OP,CODE)                      \
-  ((CODE) == 'S'                                       \
-   ? (TARGET_PCREL                                     \
-      && GET_CODE (OP) == MEM                          \
-      && (GET_CODE (XEXP (OP, 0)) == SYMBOL_REF                \
-         || GET_CODE (XEXP (OP, 0)) == LABEL_REF       \
-         || GET_CODE (XEXP (OP, 0)) == CONST))         \
-   :                                                   \
-   (CODE) == 'T'                                       \
-   ? (!flag_pic                                                \
-      && (GET_CODE (OP) == SYMBOL_REF                  \
-         || GET_CODE (OP) == LABEL_REF                 \
-         || GET_CODE (OP) == CONST))                   \
-   :                                                   \
-   (CODE) == 'Q'                                       \
-   ? m68k_matches_q_p (OP)                             \
-   :                                                   \
-   (CODE) == 'U'                                       \
-   ? m68k_matches_u_p (OP)                             \
-   :                                                   \
-   (CODE) == 'W'                                       \
-   ? const_call_operand (OP, VOIDmode)                 \
-   : 0)
-
 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
   m68k_preferred_reload_class (X, CLASS)
 
@@ -555,6 +515,11 @@ extern enum reg_class regno_reg_class[];
 /* Moves between fp regs and other regs are two insns.  */
 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2)       \
   ((((CLASS1) == FP_REGS) != ((CLASS2) == FP_REGS)) ? 4 : 2)
+
+#define IRA_COVER_CLASSES                                              \
+{                                                                      \
+  ALL_REGS, LIM_REG_CLASSES                                            \
+}
 \f
 /* Stack layout; function entry, exit and calling.  */
 
@@ -585,13 +550,13 @@ extern enum reg_class regno_reg_class[];
 
 /* On the m68k the return value defaults to D0.  */
 #define FUNCTION_VALUE(VALTYPE, FUNC)  \
-  gen_rtx_REG (TYPE_MODE (VALTYPE), 0)
+  gen_rtx_REG (TYPE_MODE (VALTYPE), D0_REG)
 
 /* On the m68k the return value defaults to D0.  */
-#define LIBCALL_VALUE(MODE)  gen_rtx_REG (MODE, 0)
+#define LIBCALL_VALUE(MODE)  gen_rtx_REG (MODE, D0_REG)
 
 /* On the m68k, D0 is usually the only register used.  */
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
+#define FUNCTION_VALUE_REGNO_P(N) ((N) == D0_REG)
 
 /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
    more than one register.
@@ -712,16 +677,16 @@ __transfer_from_trampoline ()                                     \
 /* Macros to check register numbers against specific register classes.  */
 
 /* True for data registers, D0 through D7.  */
-#define DATA_REGNO_P(REGNO) ((unsigned int) (REGNO) < 8)
+#define DATA_REGNO_P(REGNO)    IN_RANGE (REGNO, 0, 7)
 
 /* True for address registers, A0 through A7.  */
-#define ADDRESS_REGNO_P(REGNO) (((unsigned int) (REGNO) - 8) < 8)
+#define ADDRESS_REGNO_P(REGNO) IN_RANGE (REGNO, 8, 15)
 
 /* True for integer registers, D0 through D7 and A0 through A7.  */
-#define INT_REGNO_P(REGNO) ((unsigned int) (REGNO) < 16)
+#define INT_REGNO_P(REGNO)     IN_RANGE (REGNO, 0, 15)
 
 /* True for floating point registers, FP0 through FP7.  */
-#define FP_REGNO_P(REGNO) (((unsigned int) (REGNO) - 16) < 8)
+#define FP_REGNO_P(REGNO)      IN_RANGE (REGNO, 16, 23)
 
 #define REGNO_OK_FOR_INDEX_P(REGNO)                    \
   (INT_REGNO_P (REGNO)                                 \
@@ -731,13 +696,15 @@ __transfer_from_trampoline ()                                     \
   (ADDRESS_REGNO_P (REGNO)                             \
    || ADDRESS_REGNO_P (reg_renumber[REGNO]))
 
-#define REGNO_OK_FOR_DATA_P(REGNO)                     \
-  (DATA_REGNO_P (REGNO)                                        \
-   || DATA_REGNO_P (reg_renumber[REGNO]))
+#define REGNO_OK_FOR_INDEX_NONSTRICT_P(REGNO)          \
+  (INT_REGNO_P (REGNO)                                 \
+   || REGNO == ARG_POINTER_REGNUM                      \
+   || REGNO >= FIRST_PSEUDO_REGISTER)
 
-#define REGNO_OK_FOR_FP_P(REGNO)                       \
-  (FP_REGNO_P (REGNO)                                  \
-   || FP_REGNO_P (reg_renumber[REGNO]))
+#define REGNO_OK_FOR_BASE_NONSTRICT_P(REGNO)           \
+  (ADDRESS_REGNO_P (REGNO)                             \
+   || REGNO == ARG_POINTER_REGNUM                      \
+   || REGNO >= FIRST_PSEUDO_REGISTER)
 
 /* Now macros that check whether X is a register and also,
    strictly, whether it is in a specified class.
@@ -747,13 +714,13 @@ __transfer_from_trampoline ()                                     \
    define_optimization.  */
 
 /* 1 if X is a data register.  */
-#define DATA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_DATA_P (REGNO (X)))
+#define DATA_REG_P(X)  (REG_P (X) && DATA_REGNO_P (REGNO (X)))
 
 /* 1 if X is an fp register.  */
-#define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
+#define FP_REG_P(X)    (REG_P (X) && FP_REGNO_P (REGNO (X)))
 
 /* 1 if X is an address register  */
-#define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))
+#define ADDRESS_REG_P(X) (REG_P (X) && ADDRESS_REGNO_P (REGNO (X)))
 \f
 /* True if SYMBOL + OFFSET constants must refer to something within
    SYMBOL's section.  */
@@ -783,7 +750,8 @@ __transfer_from_trampoline ()                                       \
 
 #define LEGITIMATE_PIC_OPERAND_P(X)                            \
   (!symbolic_operand (X, VOIDmode)                             \
-   || (TARGET_PCREL && REG_STRICT_P))
+   || (TARGET_PCREL && REG_STRICT_P)                           \
+   || m68k_tls_reference_p (X, true))
 
 #define REG_OK_FOR_BASE_P(X) \
   m68k_legitimate_base_reg_p (X, REG_STRICT_P)
@@ -791,71 +759,9 @@ __transfer_from_trampoline ()                                      \
 #define REG_OK_FOR_INDEX_P(X) \
   m68k_legitimate_index_reg_p (X, REG_STRICT_P)
 
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)                                \
-  do                                                                   \
-    {                                                                  \
-      if (m68k_legitimate_address_p (MODE, X, REG_STRICT_P))           \
-        goto ADDR;                                                     \
-    }                                                                  \
-  while (0)
-
-/* Don't call memory_address_noforce for the address to fetch
-   the switch offset.  This address is ok as it stands,
-   but memory_address_noforce would alter it.  */
-#define PIC_CASE_VECTOR_ADDRESS(index) index
-\f
-/* For the 68000, we handle X+REG by loading X into a register R and
-   using R+REG.  R will go in an address reg and indexing will be used.
-   However, if REG is a broken-out memory address or multiplication,
-   nothing needs to be done because REG can certainly go in an address reg.  */
-#define COPY_ONCE(Y) if (!copied) { Y = copy_rtx (Y); copied = ch = 1; }
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)   \
-{ register int ch = (X) != (OLDX);                                     \
-  if (GET_CODE (X) == PLUS)                                            \
-    { int copied = 0;                                                  \
-      if (GET_CODE (XEXP (X, 0)) == MULT)                              \
-       { COPY_ONCE (X); XEXP (X, 0) = force_operand (XEXP (X, 0), 0);} \
-      if (GET_CODE (XEXP (X, 1)) == MULT)                              \
-       { COPY_ONCE (X); XEXP (X, 1) = force_operand (XEXP (X, 1), 0);} \
-      if (ch && GET_CODE (XEXP (X, 1)) == REG                          \
-         && GET_CODE (XEXP (X, 0)) == REG)                             \
-       { if (TARGET_COLDFIRE_FPU                                       \
-             && GET_MODE_CLASS (MODE) == MODE_FLOAT)                   \
-           { COPY_ONCE (X); X = force_operand (X, 0);}                 \
-         goto WIN; }                                                   \
-      if (ch) { GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN); }             \
-      if (GET_CODE (XEXP (X, 0)) == REG                                        \
-              || (GET_CODE (XEXP (X, 0)) == SIGN_EXTEND                \
-                  && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG           \
-                  && GET_MODE (XEXP (XEXP (X, 0), 0)) == HImode))      \
-       { register rtx temp = gen_reg_rtx (Pmode);                      \
-         register rtx val = force_operand (XEXP (X, 1), 0);            \
-         emit_move_insn (temp, val);                                   \
-         COPY_ONCE (X);                                                \
-         XEXP (X, 1) = temp;                                           \
-         if (TARGET_COLDFIRE_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT \
-             && GET_CODE (XEXP (X, 0)) == REG)                         \
-           X = force_operand (X, 0);                                   \
-         goto WIN; }                                                   \
-      else if (GET_CODE (XEXP (X, 1)) == REG                           \
-              || (GET_CODE (XEXP (X, 1)) == SIGN_EXTEND                \
-                  && GET_CODE (XEXP (XEXP (X, 1), 0)) == REG           \
-                  && GET_MODE (XEXP (XEXP (X, 1), 0)) == HImode))      \
-       { register rtx temp = gen_reg_rtx (Pmode);                      \
-         register rtx val = force_operand (XEXP (X, 0), 0);            \
-         emit_move_insn (temp, val);                                   \
-         COPY_ONCE (X);                                                \
-         XEXP (X, 0) = temp;                                           \
-         if (TARGET_COLDFIRE_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT \
-             && GET_CODE (XEXP (X, 1)) == REG)                         \
-           X = force_operand (X, 0);                                   \
-         goto WIN; }}}
-
-/* On the 68000, only predecrement and postincrement address depend thus
-   (the amount of decrement or increment being the length of the operand).
-   These are now treated generically in recog.c.  */
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
 \f
+/* This address is OK as it stands.  */
+#define PIC_CASE_VECTOR_ADDRESS(index) index
 #define CASE_VECTOR_MODE HImode
 #define CASE_VECTOR_PC_RELATIVE 1
 
@@ -889,6 +795,14 @@ __transfer_from_trampoline ()                                      \
    some or all of the saved cc's so they won't be used.  */
 #define NOTICE_UPDATE_CC(EXP,INSN) notice_update_cc (EXP, INSN)
 
+/* The shift instructions always clear the overflow bit.  */
+#define CC_OVERFLOW_UNUSABLE 01000
+
+/* The shift instructions use the carry bit in a way not compatible with
+   conditional branches.  conditions.h uses CC_NO_OVERFLOW for this purpose.
+   Rename it to something more understandable.  */
+#define CC_NO_CARRY CC_NO_OVERFLOW
+
 #define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV)  \
 do { if (cc_prev_status.flags & CC_IN_68881)                   \
     return FLOAT;                                              \
@@ -925,7 +839,7 @@ do { if (cc_prev_status.flags & CC_IN_68881)                        \
    We don't replace %fp for targets that don't map it to %a6
    since it may confuse GAS.  */
 #define M68K_REGNAME(r) ( \
-  ((FRAME_POINTER_REGNUM == 14) \
+  ((FRAME_POINTER_REGNUM == A6_REG) \
     && ((r) == FRAME_POINTER_REGNUM) \
     && frame_pointer_needed) ? \
     M68K_FP_REG_NAME : reg_names[(r)])
@@ -961,8 +875,10 @@ do { if (cc_prev_status.flags & CC_IN_68881)                       \
 #define INCOMING_FRAME_SP_OFFSET 4
 
 /* All registers are live on exit from an interrupt routine.  */
-#define EPILOGUE_USES(REGNO) \
-  (reload_completed && m68k_interrupt_function_p (current_function_decl))
+#define EPILOGUE_USES(REGNO)                                   \
+  (reload_completed                                            \
+   && (m68k_get_function_kind (current_function_decl)  \
+       == m68k_fk_interrupt_handler))
 
 /* Describe how we implement __builtin_eh_return.  */
 #define EH_RETURN_DATA_REGNO(N) \
@@ -1052,39 +968,8 @@ do { if (cc_prev_status.flags & CC_IN_68881)                      \
   assemble_name ((FILE), (NAME)),              \
   fprintf ((FILE), ",%u\n", (int)(ROUNDED)))
 
-/* Output a float value (represented as a C double) as an immediate operand.
-   This macro is m68k-specific.  */
-#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE)              \
- do {                                                          \
-      if (CODE == 'f')                                         \
-        {                                                      \
-          char dstr[30];                                       \
-         real_to_decimal (dstr, &(VALUE), sizeof (dstr), 9, 0); \
-          asm_fprintf ((FILE), "%I0r%s", dstr);                        \
-        }                                                      \
-      else                                                     \
-        {                                                      \
-          long l;                                              \
-          REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);              \
-          asm_fprintf ((FILE), "%I0x%lx", l);                  \
-        }                                                      \
-     } while (0)
-
-/* Output a double value (represented as a C double) as an immediate operand.
-   This macro is m68k-specific.  */
-#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                          \
- do { char dstr[30];                                                   \
-      real_to_decimal (dstr, &(VALUE), sizeof (dstr), 0, 1);           \
-      asm_fprintf (FILE, "%I0r%s", dstr);                              \
-    } while (0)
-
-/* Note, long double immediate operands are not actually
-   generated by m68k.md.  */
-#define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE)                     \
- do { char dstr[30];                                                   \
-      real_to_decimal (dstr, &(VALUE), sizeof (dstr), 0, 1);           \
-      asm_fprintf (FILE, "%I0r%s", dstr);                              \
-    } while (0)
+#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
+  m68k_final_prescan_insn (INSN, OPVEC, NOPERANDS)
 
 /* On the 68000, we use several CODE characters:
    '.' for dot needed in Motorola-style opcode names.
@@ -1119,6 +1004,12 @@ do { if (cc_prev_status.flags & CC_IN_68881)                     \
 
 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
 
+#define OUTPUT_ADDR_CONST_EXTRA(FILE, X, FAIL)         \
+do {                                                   \
+  if (! m68k_output_addr_const_extra (FILE, (X)))      \
+    goto FAIL;                                         \
+} while (0);
+
 /* Values used in the MICROARCH argument to M68K_DEVICE.  */
 enum uarch_type
 {
@@ -1131,6 +1022,7 @@ enum uarch_type
   u68040,
   u68060,
   ucpu32,
+  ucfv1,
   ucfv2,
   ucfv3,
   ucfv4,
@@ -1156,12 +1048,40 @@ enum fpu_type
   FPUTYPE_COLDFIRE
 };
 
+enum m68k_function_kind
+{
+  m68k_fk_normal_function,
+  m68k_fk_interrupt_handler,
+  m68k_fk_interrupt_thread
+};
+
 /* Variables in m68k.c; see there for details.  */
 extern const char *m68k_library_id_string;
-extern int m68k_last_compare_had_fp_operands;
 extern enum target_device m68k_cpu;
 extern enum uarch_type m68k_tune;
 extern enum fpu_type m68k_fpu;
 extern unsigned int m68k_cpu_flags;
+extern unsigned int m68k_tune_flags;
 extern const char *m68k_symbolic_call;
 extern const char *m68k_symbolic_jump;
+
+enum M68K_SYMBOLIC_CALL { M68K_SYMBOLIC_CALL_NONE, M68K_SYMBOLIC_CALL_JSR,
+                         M68K_SYMBOLIC_CALL_BSR_C, M68K_SYMBOLIC_CALL_BSR_P };
+
+extern enum M68K_SYMBOLIC_CALL m68k_symbolic_call_var;
+
+/* ??? HOST_WIDE_INT is not being defined for auto-generated files.
+   Workaround that.  */
+#ifdef HOST_WIDE_INT
+typedef enum { MOVL, SWAP, NEGW, NOTW, NOTB, MOVQ, MVS, MVZ }
+  M68K_CONST_METHOD;
+
+extern M68K_CONST_METHOD m68k_const_method (HOST_WIDE_INT);
+#endif
+
+extern void m68k_emit_move_double (rtx [2]);
+
+extern int m68k_sched_address_bypass_p (rtx, rtx);
+extern int m68k_sched_indexed_address_bypass_p (rtx, rtx);
+
+#define CPU_UNITS_QUERY 1