OSDN Git Service

* config/frv/frv.c (frv_frame_access): Do not use reg+reg
[pf3gnuchains/gcc-fork.git] / gcc / config / frv / frv.h
index 39bc176..abe275f 100644 (file)
@@ -1,12 +1,13 @@
 /* Target macros for the FRV port of GCC.
-   Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
+   Free Software Foundation, Inc.
    Contributed by Red Hat 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
+   by 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, but WITHOUT
    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, 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   along with GCC; see the file COPYING3.  If not see
+   <http://www.gnu.org/licenses/>.  */
 
 #ifndef __FRV_H__
 #define __FRV_H__
 
-/* Set up System V.4 (aka ELF) defaults.  */
-#include "svr4.h"
-
-\f
 /* Frv general purpose macros.  */
 /* Align an address.  */
 #define ADDR_ALIGN(addr,align) (((addr) + (align) - 1) & ~((align) - 1))
    Defined in svr4.h.  */
 #undef WORD_SWITCH_TAKES_ARG
 
-/* A C string constant that tells the GNU CC driver program options to pass to
+/* -fpic and -fPIC used to imply the -mlibrary-pic multilib, but with
+    FDPIC which multilib to use depends on whether FDPIC is in use or
+    not.  The trick we use is to introduce -multilib-library-pic as a
+    pseudo-flag that selects the library-pic multilib, and map fpic
+    and fPIC to it only if fdpic is not selected.  Also, if fdpic is
+    selected and no PIC/PIE options are present, we imply -fPIE.
+    Otherwise, if -fpic or -fPIC are enabled and we're optimizing for
+    speed, or if we have -On with n>=3, enable inlining of PLTs.  As
+    for -mgprel-ro, we want to enable it by default, but not for -fpic or
+    -fpie.  */
+
+#define DRIVER_SELF_SPECS SUBTARGET_DRIVER_SELF_SPECS \
+"%{mno-pack:\
+   %{!mhard-float:-msoft-float}\
+   %{!mmedia:-mno-media}}\
+ %{!mfdpic:%{fpic|fPIC: -multilib-library-pic}}\
+ %{mfdpic:%{!fpic:%{!fpie:%{!fPIC:%{!fPIE:\
+           %{!fno-pic:%{!fno-pie:%{!fno-PIC:%{!fno-PIE:-fPIE}}}}}}}} \
+         %{!mno-inline-plt:%{O*:%{!O0:%{!Os:%{fpic|fPIC:-minline-plt} \
+                    %{!fpic:%{!fPIC:%{!O:%{!O1:%{!O2:-minline-plt}}}}}}}}} \
+         %{!mno-gprel-ro:%{!fpic:%{!fpie:-mgprel-ro}}}} \
+"
+#ifndef SUBTARGET_DRIVER_SELF_SPECS
+# define SUBTARGET_DRIVER_SELF_SPECS
+#endif
+
+/* A C string constant that tells the GCC driver program options to pass to
    the assembler.  It can also specify how to translate options you give to GNU
-   CC into options for GNU CC to pass to the assembler.  See the file `sun3.h'
+   CC into options for GCC to pass to the assembler.  See the file `sun3.h'
    for an example of this.
 
    Do not define this macro if it does not need to do anything.
     %{mmedia} %{mno-media} \
     %{mmuladd} %{mno-muladd} \
     %{mpack} %{mno-pack} \
-    %{fpic: -mpic} %{fPIC: -mPIC} %{mlibrary-pic}}"
+    %{mno-fdpic:-mnopic} %{mfdpic} \
+    %{fpic|fpie: -mpic} %{fPIC|fPIE: -mPIC} %{mlibrary-pic}}"
 
 /* Another C string constant used much like `LINK_SPEC'.  The difference
    between the two is that `STARTFILE_SPEC' is used at the very beginning of
 #undef  ENDFILE_SPEC
 #define ENDFILE_SPEC "frvend%O%s"
 
-/* A C string constant that tells the GNU CC driver program options to pass to
-   CPP.  It can also specify how to translate options you give to GNU CC into
-   options for GNU CC to pass to the CPP.
-
-   Do not define this macro if it does not need to do anything.  */
-
-/* The idea here is to use the -mcpu option to define macros based on the
-   processor's features, using the features of the default processor if
-   no -mcpu option is given.  These macros can then be overridden by
-   other -m options.  */
-#define CPP_SPEC "\
-%{mcpu=frv: %(cpp_frv)} \
-%{mcpu=fr500: %(cpp_fr500)} \
-%{mcpu=fr400: %(cpp_fr400)} \
-%{mcpu=fr300: %(cpp_simple)} \
-%{mcpu=tomcat: %(cpp_fr500)} \
-%{mcpu=simple: %(cpp_simple)} \
-%{!mcpu*: %(cpp_cpu_default)} \
-%{mno-media: -D__FRV_ACC__=0 %{msoft-float: -D__FRV_FPR__=0}} \
-%{mhard-float: -D__FRV_HARD_FLOAT__} \
-%{msoft-float: -U__FRV_HARD_FLOAT__} \
-%{mgpr-32: -U__FRV_GPR__ -D__FRV_GPR__=32} \
-%{mgpr-64: -U__FRV_GPR__ -D__FRV_GPR__=64} \
-%{mfpr-32: -U__FRV_FPR__ -D__FRV_FPR__=32} \
-%{mfpr-64: -U__FRV_FPR__ -D__FRV_FPR__=64} \
-%{macc-4: -U__FRV_ACC__ -D__FRV_ACC__=4} \
-%{macc-8: -U__FRV_ACC__ -D__FRV_ACC__=8} \
-%{mdword: -D__FRV_DWORD__} \
-%{mno-dword: -U__FRV_DWORD__} \
-%{mno-pack: -U__FRV_VLIW__} \
-%{fleading-underscore: -D__FRV_UNDERSCORE__}"
-
-/* CPU defaults.  Each CPU has its own CPP spec that defines the default
-   macros for that CPU.  Each CPU also has its own default target mask.
-
-   CPU         GPRs    FPRs    ACCs    FPU     MulAdd  ldd/std  Issue rate
-   ---         ----    ----    ----    ---     ------  -------  ----------
-   FRV         64      64      8       double  yes     yes      4
-   FR500       64      64      8       single  no      yes      4
-   FR400       32      32      4       none    no      yes      2
-   Simple      32      0       0       none    no      no       1 */
-
-
-#define CPP_FRV_SPEC "\
--D__FRV_GPR__=64 \
--D__FRV_FPR__=64 \
--D__FRV_ACC__=8 \
--D__FRV_HARD_FLOAT__ \
--D__FRV_DWORD__ \
--D__FRV_VLIW__=4"
-
-#define CPP_FR500_SPEC "\
--D__FRV_GPR__=64 \
--D__FRV_FPR__=64 \
--D__FRV_ACC__=8 \
--D__FRV_HARD_FLOAT__ \
--D__FRV_DWORD__ \
--D__FRV_VLIW__=4"
-
-#define CPP_FR400_SPEC "\
--D__FRV_GPR__=32 \
--D__FRV_FPR__=32 \
--D__FRV_ACC__=4 \
--D__FRV_DWORD__ \
--D__FRV_VLIW__=2"
-
-#define CPP_SIMPLE_SPEC "\
--D__FRV_GPR__=32 \
--D__FRV_FPR__=0 \
--D__FRV_ACC__=0 \
-%{mmedia: -D__FRV_ACC__=8} \
-%{mhard-float|mmedia: -D__FRV_FPR__=64}"
 
 #define MASK_DEFAULT_FRV       \
   (MASK_MEDIA                  \
 #define MASK_DEFAULT_FR500 \
   (MASK_MEDIA | MASK_DWORD | MASK_PACK)
 
+#define MASK_DEFAULT_FR550 \
+  (MASK_MEDIA | MASK_DWORD | MASK_PACK)
+
+#define MASK_DEFAULT_FR450     \
+  (MASK_GPR_32                 \
+   | MASK_FPR_32               \
+   | MASK_MEDIA                        \
+   | MASK_SOFT_FLOAT           \
+   | MASK_DWORD                        \
+   | MASK_PACK)
+
 #define MASK_DEFAULT_FR400     \
   (MASK_GPR_32                 \
    | MASK_FPR_32               \
 #define MASK_DEFAULT_SIMPLE \
   (MASK_GPR_32 | MASK_SOFT_FLOAT)
 
-/* A C string constant that tells the GNU CC driver program options to pass to
-   `cc1'.  It can also specify how to translate options you give to GNU CC into
-   options for GNU CC to pass to the `cc1'.
+/* A C string constant that tells the GCC driver program options to pass to
+   `cc1'.  It can also specify how to translate options you give to GCC into
+   options for GCC to pass to the `cc1'.
 
    Do not define this macro if it does not need to do anything.  */
 /* For ABI compliance, we need to put bss data into the normal data section.  */
 #define CC1_SPEC "%{G*}"
 
-/* A C string constant that tells the GNU CC driver program options to pass to
-   the linker.  It can also specify how to translate options you give to GNU CC
-   into options for GNU CC to pass to the linker.
+/* A C string constant that tells the GCC driver program options to pass to
+   the linker.  It can also specify how to translate options you give to GCC
+   into options for GCC to pass to the linker.
 
    Do not define this macro if it does not need to do anything.
 
 #undef LINK_SPEC
 #define LINK_SPEC "\
 %{h*} %{v:-V} \
-%{b} %{Wl,*:%*} \
+%{b} \
+%{mfdpic:-melf32frvfd -z text} \
 %{static:-dn -Bstatic} \
 %{shared:-Bdynamic} \
 %{symbolic:-Bsymbolic} \
 #undef  LIB_SPEC
 #define LIB_SPEC "--start-group -lc -lsim --end-group"
 
-/* This macro defines names of additional specifications to put in the specs
-   that can be used in various specifications like CC1_SPEC.  Its definition
-   is an initializer with a subgrouping for each command option.
-
-   Each subgrouping contains a string constant, that defines the
-   specification name, and a string constant that used by the GNU CC driver
-   program.
-
-   Do not define this macro if it does not need to do anything.  */
-
-#ifndef SUBTARGET_EXTRA_SPECS
-#define SUBTARGET_EXTRA_SPECS
-#endif
-
-#define EXTRA_SPECS                                                    \
-  { "cpp_frv",         CPP_FRV_SPEC },                                 \
-  { "cpp_fr500",       CPP_FR500_SPEC },                               \
-  { "cpp_fr400",       CPP_FR400_SPEC },                               \
-  { "cpp_simple",      CPP_SIMPLE_SPEC },                              \
-  { "cpp_cpu_default", CPP_CPU_DEFAULT_SPEC },                         \
-  SUBTARGET_EXTRA_SPECS
-
-#ifndef CPP_CPU_DEFAULT_SPEC
-#define CPP_CPU_DEFAULT_SPEC   CPP_FR500_SPEC
+#ifndef CPU_TYPE
 #define CPU_TYPE               FRV_CPU_FR500
 #endif
 
-/* Allow us to easily change the default for -malloc-cc.  */
-#ifndef        DEFAULT_NO_ALLOC_CC
-#define MASK_DEFAULT_ALLOC_CC  MASK_ALLOC_CC
-#else
-#define MASK_DEFAULT_ALLOC_CC  0
-#endif
-
 /* Run-time target specifications */
 
-#define TARGET_CPU_CPP_BUILTINS()              \
-  do                                           \
-    {                                          \
-      builtin_define ("__frv__");              \
-      builtin_assert ("machine=frv");          \
-    }                                          \
+#define TARGET_CPU_CPP_BUILTINS()                                      \
+  do                                                                   \
+    {                                                                  \
+      int issue_rate;                                                  \
+                                                                       \
+      builtin_define ("__frv__");                                      \
+      builtin_assert ("machine=frv");                                  \
+                                                                       \
+      issue_rate = frv_issue_rate ();                                  \
+      if (issue_rate > 1)                                              \
+       builtin_define_with_int_value ("__FRV_VLIW__", issue_rate);     \
+      builtin_define_with_int_value ("__FRV_GPR__", NUM_GPRS);         \
+      builtin_define_with_int_value ("__FRV_FPR__", NUM_FPRS);         \
+      builtin_define_with_int_value ("__FRV_ACC__", NUM_ACCS);         \
+                                                                       \
+      switch (frv_cpu_type)                                            \
+       {                                                               \
+       case FRV_CPU_GENERIC:                                           \
+         builtin_define ("__CPU_GENERIC__");                           \
+         break;                                                        \
+       case FRV_CPU_FR550:                                             \
+         builtin_define ("__CPU_FR550__");                             \
+         break;                                                        \
+       case FRV_CPU_FR500:                                             \
+       case FRV_CPU_TOMCAT:                                            \
+         builtin_define ("__CPU_FR500__");                             \
+         break;                                                        \
+       case FRV_CPU_FR450:                                             \
+         builtin_define ("__CPU_FR450__");                             \
+         break;                                                        \
+       case FRV_CPU_FR405:                                             \
+         builtin_define ("__CPU_FR405__");                             \
+         break;                                                        \
+       case FRV_CPU_FR400:                                             \
+         builtin_define ("__CPU_FR400__");                             \
+         break;                                                        \
+       case FRV_CPU_FR300:                                             \
+       case FRV_CPU_SIMPLE:                                            \
+         builtin_define ("__CPU_FR300__");                             \
+         break;                                                        \
+       }                                                               \
+                                                                       \
+      if (TARGET_HARD_FLOAT)                                           \
+       builtin_define ("__FRV_HARD_FLOAT__");                          \
+      if (TARGET_DWORD)                                                        \
+       builtin_define ("__FRV_DWORD__");                               \
+      if (TARGET_FDPIC)                                                        \
+       builtin_define ("__FRV_FDPIC__");                               \
+      if (flag_leading_underscore > 0)                                 \
+       builtin_define ("__FRV_UNDERSCORE__");                          \
+    }                                                                  \
   while (0)
 
 \f
-/* This declaration should be present.  */
-extern int target_flags;
-
-/* This series of macros is to allow compiler command arguments to enable or
-   disable the use of optional features of the target machine.  For example,
-   one machine description serves both the 68000 and the 68020; a command
-   argument tells the compiler whether it should use 68020-only instructions or
-   not.  This command argument works by means of a macro `TARGET_68020' that
-   tests a bit in `target_flags'.
-
-   Define a macro `TARGET_FEATURENAME' for each such option.  Its definition
-   should test a bit in `target_flags'; for example:
-
-        #define TARGET_68020 (target_flags & 1)
-
-   One place where these macros are used is in the condition-expressions of
-   instruction patterns.  Note how `TARGET_68020' appears frequently in the
-   68000 machine description file, `m68k.md'.  Another place they are used is
-   in the definitions of the other macros in the `MACHINE.h' file.  */
-
-#define MASK_GPR_32         0x00000001 /* Limit gprs to 32 registers */
-#define MASK_FPR_32         0x00000002 /* Limit fprs to 32 registers */
-#define MASK_SOFT_FLOAT             0x00000004 /* Use software floating point */
-#define MASK_ALLOC_CC       0x00000008 /* Dynamically allocate icc/fcc's */
-#define MASK_DWORD          0x00000010 /* Change ABi to allow dbl word insns*/
-#define MASK_DOUBLE         0x00000020 /* Use double precision instructions */
-#define MASK_MEDIA          0x00000040 /* Use media instructions */
-#define MASK_MULADD         0x00000080 /* Use multiply add/subtract insns */
-#define MASK_LIBPIC         0x00000100 /* -fpic that can be linked w/o pic */
-#define MASK_ACC_4          0x00000200 /* Only use four media accumulators */
-#define MASK_PACK           0x00000400 /* Set to enable packed output */
-
-                                       /* put debug masks up high */
-#define MASK_DEBUG_ARG      0x40000000 /* debug argument handling */
-#define MASK_DEBUG_ADDR             0x20000000 /* debug go_if_legitimate_address */
-#define MASK_DEBUG_STACK     0x10000000        /* debug stack frame */
-#define MASK_DEBUG          0x08000000 /* general debugging switch */
-#define MASK_DEBUG_LOC      0x04000000 /* optimize line # table */
-#define MASK_DEBUG_COND_EXEC 0x02000000        /* debug cond exec code */
-#define MASK_NO_COND_MOVE    0x01000000        /* disable conditional moves */
-#define MASK_NO_SCC         0x00800000 /* disable set conditional codes */
-#define MASK_NO_COND_EXEC    0x00400000        /* disable conditional execution */
-#define MASK_NO_VLIW_BRANCH  0x00200000        /* disable repacking branches */
-#define MASK_NO_MULTI_CE     0x00100000        /* disable multi-level cond exec */
-#define MASK_NO_NESTED_CE    0x00080000        /* disable nested cond exec */
-
-#define MASK_DEFAULT           MASK_DEFAULT_ALLOC_CC
-
-#define TARGET_GPR_32          ((target_flags & MASK_GPR_32) != 0)
-#define TARGET_FPR_32          ((target_flags & MASK_FPR_32) != 0)
-#define TARGET_SOFT_FLOAT      ((target_flags & MASK_SOFT_FLOAT) != 0)
-#define TARGET_ALLOC_CC                ((target_flags & MASK_ALLOC_CC) != 0)
-#define TARGET_DWORD           ((target_flags & MASK_DWORD) != 0)
-#define TARGET_DOUBLE          ((target_flags & MASK_DOUBLE) != 0)
-#define TARGET_MEDIA           ((target_flags & MASK_MEDIA) != 0)
-#define TARGET_MULADD          ((target_flags & MASK_MULADD) != 0)
-#define TARGET_LIBPIC          ((target_flags & MASK_LIBPIC) != 0)
-#define TARGET_ACC_4           ((target_flags & MASK_ACC_4) != 0)
-#define TARGET_DEBUG_ARG       ((target_flags & MASK_DEBUG_ARG) != 0)
-#define TARGET_DEBUG_ADDR      ((target_flags & MASK_DEBUG_ADDR) != 0)
-#define TARGET_DEBUG_STACK     ((target_flags & MASK_DEBUG_STACK) != 0)
-#define TARGET_DEBUG           ((target_flags & MASK_DEBUG) != 0)
-#define TARGET_DEBUG_LOC       ((target_flags & MASK_DEBUG_LOC) != 0)
-#define TARGET_DEBUG_COND_EXEC ((target_flags & MASK_DEBUG_COND_EXEC) != 0)
-#define TARGET_NO_COND_MOVE    ((target_flags & MASK_NO_COND_MOVE) != 0)
-#define TARGET_NO_SCC          ((target_flags & MASK_NO_SCC) != 0)
-#define TARGET_NO_COND_EXEC    ((target_flags & MASK_NO_COND_EXEC) != 0)
-#define TARGET_NO_VLIW_BRANCH  ((target_flags & MASK_NO_VLIW_BRANCH) != 0)
-#define TARGET_NO_MULTI_CE     ((target_flags & MASK_NO_MULTI_CE) != 0)
-#define TARGET_NO_NESTED_CE    ((target_flags & MASK_NO_NESTED_CE) != 0)
-#define TARGET_PACK            ((target_flags & MASK_PACK) != 0)
-
-#define TARGET_GPR_64          (! TARGET_GPR_32)
-#define TARGET_FPR_64          (! TARGET_FPR_32)
-#define TARGET_HARD_FLOAT      (! TARGET_SOFT_FLOAT)
-#define TARGET_FIXED_CC                (! TARGET_ALLOC_CC)
-#define TARGET_COND_MOVE       (! TARGET_NO_COND_MOVE)
-#define TARGET_SCC             (! TARGET_NO_SCC)
-#define TARGET_COND_EXEC       (! TARGET_NO_COND_EXEC)
-#define TARGET_VLIW_BRANCH     (! TARGET_NO_VLIW_BRANCH)
-#define TARGET_MULTI_CE                (! TARGET_NO_MULTI_CE)
-#define TARGET_NESTED_CE       (! TARGET_NO_NESTED_CE)
-#define TARGET_ACC_8           (! TARGET_ACC_4)
-
 #define TARGET_HAS_FPRS                (TARGET_HARD_FLOAT || TARGET_MEDIA)
 
 #define NUM_GPRS               (TARGET_GPR_32? 32 : 64)
 #define NUM_FPRS               (!TARGET_HAS_FPRS? 0 : TARGET_FPR_32? 32 : 64)
 #define NUM_ACCS               (!TARGET_MEDIA? 0 : TARGET_ACC_4? 4 : 8)
 
+/* X is a valid accumulator number if (X & ACC_MASK) == X.  */
+#define ACC_MASK                                               \
+  (!TARGET_MEDIA ? 0                                           \
+   : TARGET_ACC_4 ? 3                                          \
+   : frv_cpu_type == FRV_CPU_FR450 ? 11                                \
+   : 7)
+
 /* Macros to identify the blend of media instructions available.  Revision 1
    is the one found on the FR500.  Revision 2 includes the changes made for
    the FR400.
@@ -392,108 +293,26 @@ extern int target_flags;
        || frv_cpu_type == FRV_CPU_FR500))
 
 #define TARGET_MEDIA_REV2                                      \
-  (TARGET_MEDIA && frv_cpu_type == FRV_CPU_FR400)
-
-/* This macro defines names of command options to set and clear bits in
-   `target_flags'.  Its definition is an initializer with a subgrouping for
-   each command option.
-
-   Each subgrouping contains a string constant, that defines the option name,
-   a number, which contains the bits to set in `target_flags', and an optional
-   second string which is the textual description that will be displayed when
-   the user passes --help on the command line.  If the number entry is negative
-   then the specified bits will be cleared instead of being set.  If the second
-   string entry is present but empty, then no help information will be displayed
-   for that option, but it will not count as an undocumented option.  The actual
-   option name, asseen on the command line is made by appending `-m' to the
-   specified name.
-
-   One of the subgroupings should have a null string.  The number in this
-   grouping is the default value for `target_flags'.  Any target options act
-   starting with that value.
-
-   Here is an example which defines `-m68000' and `-m68020' with opposite
-   meanings, and picks the latter as the default:
-
-        #define TARGET_SWITCHES \
-          { { "68020",  1, ""},      \
-            { "68000", -1, "Compile for the m68000"},     \
-            { "",       1, }}
+  (TARGET_MEDIA                                                        \
+   && (frv_cpu_type == FRV_CPU_FR400                           \
+       || frv_cpu_type == FRV_CPU_FR405                                \
+       || frv_cpu_type == FRV_CPU_FR450                                \
+       || frv_cpu_type == FRV_CPU_FR550))
 
-   This declaration must be present.  */
+#define TARGET_MEDIA_FR450                                     \
+  (frv_cpu_type == FRV_CPU_FR450)
 
-#define TARGET_SWITCHES                                                            \
-{{ "gpr-32",             MASK_GPR_32,          "Only use 32 gprs"},        \
- { "gpr-64",            -MASK_GPR_32,          "Use 64 gprs"},             \
- { "fpr-32",             MASK_FPR_32,          "Only use 32 fprs"},        \
- { "fpr-64",            -MASK_FPR_32,          "Use 64 fprs"},             \
- { "hard-float",        -MASK_SOFT_FLOAT,      "Use hardware floating point" },\
- { "soft-float",         MASK_SOFT_FLOAT,      "Use software floating point" },\
- { "alloc-cc",           MASK_ALLOC_CC,        "Dynamically allocate cc's" }, \
- { "fixed-cc",          -MASK_ALLOC_CC,        "Just use icc0/fcc0" },     \
- { "dword",              MASK_DWORD,           "Change ABI to allow double word insns" }, \
- { "no-dword",          -MASK_DWORD,           "Do not use double word insns" }, \
- { "double",             MASK_DOUBLE,          "Use fp double instructions" }, \
- { "no-double",                 -MASK_DOUBLE,          "Do not use fp double insns" }, \
- { "media",              MASK_MEDIA,           "Use media instructions" }, \
- { "no-media",          -MASK_MEDIA,           "Do not use media insns" }, \
- { "muladd",             MASK_MULADD,          "Use multiply add/subtract instructions" }, \
- { "no-muladd",                 -MASK_MULADD,          "Do not use multiply add/subtract insns" }, \
- { "library-pic",        MASK_LIBPIC,          "PIC support for building libraries" }, \
- { "acc-4",              MASK_ACC_4,           "Use 4 media accumulators" }, \
- { "acc-8",             -MASK_ACC_4,           "Use 8 media accumulators" }, \
- { "pack",               MASK_PACK,            "Pack VLIW instructions" }, \
- { "no-pack",           -MASK_PACK,            "Do not pack VLIW instructions" }, \
- { "no-eflags",                  0,                    "Do not mark ABI switches in e_flags" }, \
- { "debug-arg",                  MASK_DEBUG_ARG,       "Internal debug switch" },  \
- { "debug-addr",         MASK_DEBUG_ADDR,      "Internal debug switch" },  \
- { "debug-stack",        MASK_DEBUG_STACK,     "Internal debug switch" },  \
- { "debug",              MASK_DEBUG,           "Internal debug switch" },  \
- { "debug-cond-exec",    MASK_DEBUG_COND_EXEC, "Internal debug switch" },  \
- { "debug-loc",                  MASK_DEBUG_LOC,       "Internal debug switch" },  \
- { "cond-move",                 -MASK_NO_COND_MOVE,    "Enable conditional moves" },  \
- { "no-cond-move",       MASK_NO_COND_MOVE,    "Disable conditional moves" },  \
- { "scc",               -MASK_NO_SCC,          "Enable setting gprs to the result of comparisons" },  \
- { "no-scc",             MASK_NO_SCC,          "Disable setting gprs to the result of comparisons" },  \
- { "cond-exec",                 -MASK_NO_COND_EXEC,    "Enable conditional execution other than moves/scc" }, \
- { "no-cond-exec",       MASK_NO_COND_EXEC,    "Disable conditional execution other than moves/scc" }, \
- { "vliw-branch",       -MASK_NO_VLIW_BRANCH,  "Run pass to pack branches into VLIW insns" }, \
- { "no-vliw-branch",     MASK_NO_VLIW_BRANCH,  "Do not run pass to pack branches into VLIW insns" }, \
- { "multi-cond-exec",   -MASK_NO_MULTI_CE,     "Disable optimizing &&/|| in conditional execution" }, \
- { "no-multi-cond-exec",  MASK_NO_MULTI_CE,    "Enable optimizing &&/|| in conditional execution" }, \
- { "nested-cond-exec",  -MASK_NO_NESTED_CE,    "Enable nested conditional execution optimizations" }, \
- { "no-nested-cond-exec" ,MASK_NO_NESTED_CE,   "Disable nested conditional execution optimizations" }, \
- { "tomcat-stats",       0,                    "Cause gas to print tomcat statistics" }, \
- { "",                   MASK_DEFAULT,         "" }}                       \
-
-/* 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, the address of a variable, and an optional description string.
-   The variable, of type `char *', is set to the text following the fixed part of
-   the option as it is specified on the command line.  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, \
-        "Specify the size of the short data section"  } }
-
-   This declaration is optional.  */
-#define TARGET_OPTIONS                                                     \
-{                                                                          \
-  { "cpu=",            &frv_cpu_string,         "Set cpu type" },          \
-  { "branch-cost=",    &frv_branch_cost_string, "Internal debug switch" }, \
-  { "cond-exec-insns=", &frv_condexec_insns_str, "Internal debug switch" }, \
-  { "cond-exec-temps=", &frv_condexec_temps_str, "Internal debug switch" }, \
-  { "sched-lookahead=", &frv_sched_lookahead_str,"Internal debug switch" }, \
-}
+#define TARGET_FR500_FR550_BUILTINS                            \
+   (frv_cpu_type == FRV_CPU_FR500                              \
+    || frv_cpu_type == FRV_CPU_FR550)
+
+#define TARGET_FR405_BUILTINS                                  \
+  (frv_cpu_type == FRV_CPU_FR405                               \
+   || frv_cpu_type == FRV_CPU_FR450)
+
+#ifndef HAVE_AS_TLS
+#define HAVE_AS_TLS 0
+#endif
 
 /* This macro is a C statement to print on `stderr' a string describing the
    particular machine description choice.  Every machine description should
@@ -531,7 +350,7 @@ extern int target_flags;
 
    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 machbine-specific
+   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
@@ -540,12 +359,13 @@ extern int target_flags;
 
 
 /* Define this macro if debugging can be performed even without a frame
-   pointer.  If this macro is defined, GNU CC will turn on the
+   pointer.  If this macro is defined, GCC will turn on the
    `-fomit-frame-pointer' option whenever `-O' is specified.  */
-/* Frv needs a specific frame layout that includes the frame pointer */
+/* Frv needs a specific frame layout that includes the frame pointer */
 
 #define CAN_DEBUG_WITHOUT_FP
 
+#define LABEL_ALIGN_AFTER_BARRIER(LABEL) (TARGET_ALIGN_LABELS ? 3 : 0)
 \f
 /* Small Data Area Support.  */
 /* Maximum size of variables that go in .sdata/.sbss.
@@ -554,9 +374,6 @@ extern int target_flags;
 #define SDATA_DEFAULT_SIZE 8
 #endif
 
-extern int g_switch_value;        /* value of the -G xx switch */
-extern int g_switch_set;          /* whether -G xx was passed.  */
-
 
 /* Storage Layout */
 
@@ -577,7 +394,7 @@ extern int g_switch_set;          /* whether -G xx was passed.  */
 
 /* Define this macro to have the value 1 if, in a multiword object, the most
    significant word has the lowest number.  This applies to both memory
-   locations and registers; GNU CC fundamentally assumes that the order of
+   locations and registers; GCC fundamentally assumes that the order of
    words in memory is the same as the order in registers.  This macro need not
    be a constant.  */
 #define WORDS_BIG_ENDIAN 1
@@ -640,7 +457,7 @@ extern int g_switch_set;          /* whether -G xx was passed.  */
 #define BIGGEST_FIELD_ALIGNMENT 64
 #else
 /* An expression for the alignment of a structure field FIELD if the
-   alignment computed in the usual way is COMPUTED.  GNU CC uses this
+   alignment computed in the usual way is COMPUTED.  GCC uses this
    value instead of the value in `BIGGEST_ALIGNMENT' or
    `BIGGEST_FIELD_ALIGNMENT', if defined, for structure fields only.  */
 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED)                            \
@@ -712,7 +529,7 @@ extern int g_switch_set;          /* whether -G xx was passed.  */
    `STRUCTURE_SIZE_BOUNDARY' that way, you must define
    `PCC_BITFIELD_TYPE_MATTERS' to have a nonzero value.
 
-   If your aim is to make GNU CC use the same conventions for laying out
+   If your aim is to make GCC use the same conventions for laying out
    bitfields as are used by another compiler, here is how to investigate what
    the other compiler does.  Compile and run this program:
 
@@ -770,13 +587,18 @@ extern int g_switch_set;          /* whether -G xx was passed.  */
 #define GPR_FP          (GPR_FIRST + 2)         /* Frame pointer */
 #define GPR_SP          (GPR_FIRST + 1)         /* Stack pointer */
                                                /* small data register */
-#define SDA_BASE_REG    ((unsigned)(flag_pic ? PIC_REGNO : (GPR_FIRST+16)))
-#define PIC_REGNO       (GPR_FIRST + 17)        /* PIC register */
+#define SDA_BASE_REG    ((unsigned)(TARGET_FDPIC ? -1 : flag_pic ? PIC_REGNO : (GPR_FIRST + 16)))
+#define PIC_REGNO       (GPR_FIRST + (TARGET_FDPIC?15:17))        /* PIC register.  */
+#define FDPIC_FPTR_REGNO  (GPR_FIRST + 14)        /* uClinux PIC function pointer register.  */
+#define FDPIC_REGNO   (GPR_FIRST + 15)        /* uClinux PIC register.  */
+
+#define HARD_REGNO_RENAME_OK(from,to) (TARGET_FDPIC ? ((to) != FDPIC_REG) : 1)
+
+#define OUR_FDPIC_REG  get_hard_reg_initial_val (SImode, FDPIC_REGNO)
 
 #define FPR_FIRST       64                     /* First FP reg */
 #define FPR_LAST        127                    /* Last  FP reg */
 
-#define DEFAULT_CONDEXEC_TEMPS 4               /* reserve 4 regs by default */
 #define GPR_TEMP_NUM   frv_condexec_temps      /* # gprs to reserve for temps */
 
 /* We reserve the last CR and CCR in each category to be used as a reload
@@ -833,17 +655,19 @@ extern int g_switch_set;          /* whether -G xx was passed.  */
 #define CR_MASK                0x3
 
 #define ACC_FIRST      144                     /* First acc register */
-#define ACC_LAST       151                     /* Last  acc register */
+#define ACC_LAST       155                     /* Last  acc register */
 
-#define ACCG_FIRST     152                     /* First accg register */
-#define ACCG_LAST      159                     /* Last  accg register */
+#define ACCG_FIRST     156                     /* First accg register */
+#define ACCG_LAST      167                     /* Last  accg register */
 
-#define AP_FIRST       160                     /* fake argument pointer */
+#define AP_FIRST       168                     /* fake argument pointer */
 
-#define SPR_FIRST      161
-#define SPR_LAST       162
+#define SPR_FIRST      169
+#define SPR_LAST       172
 #define LR_REGNO       (SPR_FIRST)
 #define LCR_REGNO      (SPR_FIRST + 1)
+#define IACC_FIRST     (SPR_FIRST + 2)
+#define IACC_LAST      (SPR_FIRST + 3)
 
 #define GPR_P(R)       IN_RANGE_P (R, GPR_FIRST, GPR_LAST)
 #define GPR_OR_AP_P(R) (GPR_P (R) || (R) == ARG_POINTER_REGNUM)
@@ -885,7 +709,7 @@ extern int g_switch_set;          /* whether -G xx was passed.  */
 #define LAST_ARG_REGNUM                (FIRST_ARG_REGNUM + FRV_NUM_ARG_REGS - 1)
 
 /* Registers used by the exception handling functions.  These should be
-   registers that are not otherwised used by the calling sequence.  */
+   registers that are not otherwise used by the calling sequence.  */
 #define FIRST_EH_REGNUM                14
 #define LAST_EH_REGNUM         15
 
@@ -913,6 +737,8 @@ extern int g_switch_set;          /* whether -G xx was passed.  */
 #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, STACKADJ_REGNO)
 #define EH_RETURN_HANDLER_RTX   RETURN_ADDR_RTX (0, frame_pointer_rtx)
 
+#define EPILOGUE_USES(REGNO) ((REGNO) == LR_REGNO)
+
 /* An initializer that says which registers are used for fixed purposes all
    throughout the compiled code and are therefore not available for general
    allocation.  These would include the stack pointer, the frame pointer
@@ -968,11 +794,14 @@ extern int g_switch_set;          /* whether -G xx was passed.  */
        0, 0, 0, 0, 0, 0, 0, 1,         /* 136-143, cr0 - cr7 */        \
        /* Accumulators */                                              \
        1, 1, 1, 1, 1, 1, 1, 1,         /* 144-151, acc0  - acc7 */     \
-       1, 1, 1, 1, 1, 1, 1, 1,         /* 152-159, accg0 - accg7 */    \
+       1, 1, 1, 1,                     /* 152-155, acc8  - acc11 */    \
+       1, 1, 1, 1, 1, 1, 1, 1,         /* 156-163, accg0 - accg7 */    \
+       1, 1, 1, 1,                     /* 164-167, accg8 - accg11 */   \
        /* Other registers */                                           \
-       1,                              /* 160, AP   - fake arg ptr */  \
-       0,                              /* 161, LR   - Link register*/  \
-       0,                              /* 162, LCR  - Loop count reg*/ \
+       1,                              /* 168, AP   - fake arg ptr */  \
+       1,                              /* 169, LR   - Link register*/  \
+       0,                              /* 170, LCR  - Loop count reg*/ \
+       1, 1                            /* 171-172, iacc0 */            \
 }
 
 /* Like `FIXED_REGISTERS' but has 1 for each register that is clobbered (in
@@ -1009,11 +838,14 @@ extern int g_switch_set;          /* whether -G xx was passed.  */
        1, 1, 1, 1, 1, 1, 1, 1,         /* 136-143, cr0 - cr7 */        \
        /* Accumulators */                                              \
        1, 1, 1, 1, 1, 1, 1, 1,         /* 144-151, acc0 - acc7 */      \
-       1, 1, 1, 1, 1, 1, 1, 1,         /* 152-159, accg0 - accg7 */    \
+       1, 1, 1, 1,                     /* 152-155, acc8 - acc11 */     \
+       1, 1, 1, 1, 1, 1, 1, 1,         /* 156-163, accg0 - accg7 */    \
+       1, 1, 1, 1,                     /* 164-167, accg8 - accg11 */   \
        /* Other registers */                                           \
-       1,                              /* 160, AP  - fake arg ptr */   \
-       1,                              /* 161, LR  - Link register*/   \
-       1,                              /* 162, LCR - Loop count reg */ \
+       1,                              /* 168, AP  - fake arg ptr */   \
+       1,                              /* 169, LR  - Link register*/   \
+       1,                              /* 170, LCR - Loop count reg */ \
+       1, 1                            /* 171-172, iacc0 */            \
 }
 
 /* Zero or more C statements that may conditionally modify two variables
@@ -1042,7 +874,7 @@ extern int g_switch_set;          /* whether -G xx was passed.  */
 /* Order of allocation of registers.  */
 
 /* If defined, an initializer for a vector of integers, containing the numbers
-   of hard registers in the order in which GNU CC should prefer to use them
+   of hard registers in the order in which GCC should prefer to use them
    (from most preferred to least).
 
    If this macro is not defined, registers are used lowest numbered first (all
@@ -1106,9 +938,12 @@ extern int g_switch_set;          /* whether -G xx was passed.  */
   GPR_FIRST  + 28, GPR_FIRST  + 29, GPR_FIRST  + 30, GPR_FIRST         + 31,   \
   ACC_FIRST  +  0, ACC_FIRST  +  1, ACC_FIRST  +  2, ACC_FIRST         +  3,   \
   ACC_FIRST  +  4, ACC_FIRST  +  5, ACC_FIRST  +  6, ACC_FIRST         +  7,   \
+  ACC_FIRST  +  8, ACC_FIRST  +  9, ACC_FIRST  + 10, ACC_FIRST         + 11,   \
   ACCG_FIRST +  0, ACCG_FIRST +  1, ACCG_FIRST +  2, ACCG_FIRST        +  3,   \
   ACCG_FIRST +  4, ACCG_FIRST +  5, ACCG_FIRST +  6, ACCG_FIRST        +  7,   \
-  AP_FIRST,       LR_REGNO,       LCR_REGNO                            \
+  ACCG_FIRST +  8, ACCG_FIRST +  9, ACCG_FIRST + 10, ACCG_FIRST        + 11,   \
+  AP_FIRST,       LR_REGNO,       LCR_REGNO,                           \
+  IACC_FIRST +  0, IACC_FIRST +  1                                     \
 }
 
 \f
@@ -1219,6 +1054,12 @@ enum reg_class
   CR_REGS,
   LCR_REG,
   LR_REG,
+  GR8_REGS,
+  GR9_REGS,
+  GR89_REGS,
+  FDPIC_REGS,
+  FDPIC_FPTR_REGS,
+  FDPIC_CALL_REGS,
   SPR_REGS,
   QUAD_ACC_REGS,
   EVEN_ACC_REGS,
@@ -1253,6 +1094,12 @@ enum reg_class
    "CR_REGS",                                                          \
    "LCR_REG",                                                          \
    "LR_REG",                                                           \
+   "GR8_REGS",                                                          \
+   "GR9_REGS",                                                          \
+   "GR89_REGS",                                                         \
+   "FDPIC_REGS",                                                       \
+   "FDPIC_FPTR_REGS",                                                  \
+   "FDPIC_CALL_REGS",                                                  \
    "SPR_REGS",                                                         \
    "QUAD_ACC_REGS",                                                    \
    "EVEN_ACC_REGS",                                                    \
@@ -1286,20 +1133,41 @@ enum reg_class
   { 0x00000000,0x00000000,0x00000000,0x00000000,0x0000f000,0x0}, /* ICR_REGS */\
   { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000f00,0x0}, /* FCR_REGS */\
   { 0x00000000,0x00000000,0x00000000,0x00000000,0x0000ff00,0x0}, /* CR_REGS  */\
-  { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x4}, /* LCR_REGS */\
-  { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x2}, /* LR_REGS  */\
-  { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x6}, /* SPR_REGS */\
-  { 0x00000000,0x00000000,0x00000000,0x00000000,0x00ff0000,0x0}, /* QUAD_ACC */\
-  { 0x00000000,0x00000000,0x00000000,0x00000000,0x00ff0000,0x0}, /* EVEN_ACC */\
-  { 0x00000000,0x00000000,0x00000000,0x00000000,0x00ff0000,0x0}, /* ACC_REGS */\
-  { 0x00000000,0x00000000,0x00000000,0x00000000,0xff000000,0x0}, /* ACCG_REGS*/\
+  { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x400}, /* LCR_REGS */\
+  { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x200}, /* LR_REGS  */\
+  { 0x00000100,0x00000000,0x00000000,0x00000000,0x00000000,0x0}, /* GR8_REGS */\
+  { 0x00000200,0x00000000,0x00000000,0x00000000,0x00000000,0x0}, /* GR9_REGS */\
+  { 0x00000300,0x00000000,0x00000000,0x00000000,0x00000000,0x0}, /* GR89_REGS */\
+  { 0x00008000,0x00000000,0x00000000,0x00000000,0x00000000,0x0}, /* FDPIC_REGS */\
+  { 0x00004000,0x00000000,0x00000000,0x00000000,0x00000000,0x0}, /* FDPIC_FPTR_REGS */\
+  { 0x0000c000,0x00000000,0x00000000,0x00000000,0x00000000,0x0}, /* FDPIC_CALL_REGS */\
+  { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x1e00}, /* SPR_REGS */\
+  { 0x00000000,0x00000000,0x00000000,0x00000000,0x0fff0000,0x0}, /* QUAD_ACC */\
+  { 0x00000000,0x00000000,0x00000000,0x00000000,0x0fff0000,0x0}, /* EVEN_ACC */\
+  { 0x00000000,0x00000000,0x00000000,0x00000000,0x0fff0000,0x0}, /* ACC_REGS */\
+  { 0x00000000,0x00000000,0x00000000,0x00000000,0xf0000000,0xff}, /* ACCG_REGS*/\
   { 0x00000000,0x00000000,0xffffffff,0xffffffff,0x00000000,0x0}, /* QUAD_FPR */\
   { 0x00000000,0x00000000,0xffffffff,0xffffffff,0x00000000,0x0}, /* FEVEN_REG*/\
   { 0x00000000,0x00000000,0xffffffff,0xffffffff,0x00000000,0x0}, /* FPR_REGS */\
   { 0x0ffffffc,0xffffffff,0x00000000,0x00000000,0x00000000,0x0}, /* QUAD_REGS*/\
   { 0xfffffffc,0xffffffff,0x00000000,0x00000000,0x00000000,0x0}, /* EVEN_REGS*/\
-  { 0xffffffff,0xffffffff,0x00000000,0x00000000,0x00000000,0x1}, /* GPR_REGS */\
-  { 0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0x7}, /* ALL_REGS */\
+  { 0xffffffff,0xffffffff,0x00000000,0x00000000,0x00000000,0x100}, /* GPR_REGS */\
+  { 0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0x1fff}, /* ALL_REGS */\
+}
+
+/* The following macro defines cover classes for Integrated Register
+   Allocator.  Cover classes is a set of non-intersected register
+   classes covering all hard registers used for register allocation
+   purpose.  Any move between two registers of a cover class should be
+   cheaper than load or store of the registers.  The macro value is
+   array of register classes with LIM_REG_CLASSES used as the end
+   marker.  */
+
+#define IRA_COVER_CLASSES                                              \
+{                                                                      \
+  GPR_REGS, FPR_REGS, ACC_REGS, ICR_REGS, FCR_REGS, ICC_REGS, FCC_REGS, \
+  ACCG_REGS, SPR_REGS,                                                 \
+  LIM_REG_CLASSES                                                      \
 }
 
 /* A C expression whose value is a register class containing hard register
@@ -1384,10 +1252,10 @@ extern enum reg_class reg_class_from_letter[];
 #define PREFERRED_RELOAD_CLASS(X, CLASS) CLASS
 
 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \
-  frv_secondary_reload_class (CLASS, MODE, X, TRUE)
+  frv_secondary_reload_class (CLASS, MODE, X)
 
 #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \
-  frv_secondary_reload_class (CLASS, MODE, X, FALSE)
+  frv_secondary_reload_class (CLASS, MODE, X)
 
 /* A C expression whose value is nonzero if pseudos that have been assigned to
    registers of class CLASS would likely be spilled because registers of CLASS
@@ -1420,21 +1288,21 @@ extern enum reg_class reg_class_from_letter[];
 
 #define ZERO_P(x) (x == CONST0_RTX (GET_MODE (x)))
 
-/* 6 bit signed immediate.  */
+/* 6-bit signed immediate.  */
 #define CONST_OK_FOR_I(VALUE) IN_RANGE_P(VALUE, -32, 31)
-/* 10 bit signed immediate.  */
+/* 10-bit signed immediate.  */
 #define CONST_OK_FOR_J(VALUE) IN_RANGE_P(VALUE, -512, 511)
 /* Unused */
 #define CONST_OK_FOR_K(VALUE)  0
-/* 16 bit signed immediate.  */
+/* 16-bit signed immediate.  */
 #define CONST_OK_FOR_L(VALUE) IN_RANGE_P(VALUE, -32768, 32767)
-/* 16 bit unsigned immediate.  */
+/* 16-bit unsigned immediate.  */
 #define CONST_OK_FOR_M(VALUE)  IN_RANGE_P (VALUE, 0, 65535)
-/* 12 bit signed immediate that is negative.  */
+/* 12-bit signed immediate that is negative.  */
 #define CONST_OK_FOR_N(VALUE) IN_RANGE_P(VALUE, -2048, -1)
 /* Zero */
 #define CONST_OK_FOR_O(VALUE) ((VALUE) == 0)
-/* 12 bit signed immediate that is negative.  */
+/* 12-bit signed immediate that is negative.  */
 #define CONST_OK_FOR_P(VALUE) IN_RANGE_P(VALUE, 1, 2047)
 
 /* A C expression that defines the machine-dependent operand constraint letters
@@ -1496,16 +1364,17 @@ extern enum reg_class reg_class_from_letter[];
    input and `r' on the output.  The next alternative specifies `m' on the
    input and a register class that does not include r0 on the output.  */
 
-/* Small data references */
+/* 12-bit relocations.  */
 #define EXTRA_CONSTRAINT_FOR_Q(VALUE)                                  \
-  (small_data_symbolic_operand (VALUE, GET_MODE (VALUE)))
+  (got12_operand (VALUE, GET_MODE (VALUE)))
 
 /* Double word memory ops that take one instruction.  */
 #define EXTRA_CONSTRAINT_FOR_R(VALUE)                                  \
   (dbl_memory_one_insn_operand (VALUE, GET_MODE (VALUE)))
 
 /* SYMBOL_REF */
-#define EXTRA_CONSTRAINT_FOR_S(VALUE) (GET_CODE (VALUE) == SYMBOL_REF)
+#define EXTRA_CONSTRAINT_FOR_S(VALUE) \
+  (CONSTANT_P (VALUE) && call_operand (VALUE, VOIDmode))
 
 /* Double word memory ops that take two instructions.  */
 #define EXTRA_CONSTRAINT_FOR_T(VALUE)                                  \
@@ -1523,6 +1392,20 @@ extern enum reg_class reg_class_from_letter[];
    : (C) == 'U' ? EXTRA_CONSTRAINT_FOR_U (VALUE)                       \
    : 0)
 
+#define EXTRA_MEMORY_CONSTRAINT(C,STR) \
+  ((C) == 'U' || (C) == 'R' || (C) == 'T')
+
+#define CONSTRAINT_LEN(C, STR) \
+  ((C) == 'D' ? 3 : DEFAULT_CONSTRAINT_LEN ((C), (STR)))
+
+#define REG_CLASS_FROM_CONSTRAINT(C, STR) \
+  (((C) == 'D' && (STR)[1] == '8' && (STR)[2] == '9') ? GR89_REGS : \
+   ((C) == 'D' && (STR)[1] == '0' && (STR)[2] == '9') ? GR9_REGS : \
+   ((C) == 'D' && (STR)[1] == '0' && (STR)[2] == '8') ? GR8_REGS : \
+   ((C) == 'D' && (STR)[1] == '1' && (STR)[2] == '4') ? FDPIC_FPTR_REGS : \
+   ((C) == 'D' && (STR)[1] == '1' && (STR)[2] == '5') ? FDPIC_REGS : \
+   REG_CLASS_FROM_LETTER ((C)))
+
 \f
 /* Basic Stack Layout.  */
 
@@ -1581,9 +1464,9 @@ typedef struct frv_stack {
    to a smaller address.  */
 #define STACK_GROWS_DOWNWARD 1
 
-/* Define this macro if the addresses of local variable slots are at negative
-   offsets from the frame pointer.  */
-#define FRAME_GROWS_DOWNWARD
+/* Define this macro to nonzero if the addresses of local variable slots
+   are at negative offsets from the frame pointer.  */
+#define FRAME_GROWS_DOWNWARD 1
 
 /* Offset from the frame pointer to the first local variable slot to be
    allocated.
@@ -1628,13 +1511,6 @@ typedef struct frv_stack {
    address of other frames.  */
 #define RETURN_ADDR_RTX(COUNT, FRAMEADDR) frv_return_addr_rtx (COUNT, FRAMEADDR)
 
-/* This function contains machine specific function data.  */
-struct machine_function GTY(())
-{
-  /* True if we have created an rtx that relies on the stack frame.  */
-  int frame_needed;
-};
-
 #define RETURN_POINTER_REGNUM LR_REGNO
 
 /* A C expression whose value is RTL representing the location of the incoming
@@ -1761,7 +1637,7 @@ struct machine_function GTY(())
 
 /* If defined, the maximum amount of space required for outgoing arguments will
    be computed and placed into the variable
-   `current_function_outgoing_args_size'.  No space will be pushed onto the
+   `crtl->outgoing_args_size'.  No space will be pushed onto the
    stack for each call; instead, the function prologue should increase the
    stack frame size by this amount.
 
@@ -1805,58 +1681,10 @@ struct machine_function GTY(())
 #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
 
 \f
-/* Function Arguments in Registers.  */
-
-/* Nonzero if we do not know how to pass TYPE solely in registers.
-   We cannot do so in the following cases:
-
-   - if the type has variable size
-   - if the type is marked as addressable (it is required to be constructed
-     into the stack)
-   - if the type is a structure or union.  */
-
-#define MUST_PASS_IN_STACK(MODE,TYPE)                           \
-   (((MODE) == BLKmode)                                         \
-    || ((TYPE) != 0                                             \
-         && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST        \
-             || TREE_CODE (TYPE) == RECORD_TYPE                 \
-             || TREE_CODE (TYPE) == UNION_TYPE                  \
-             || TREE_CODE (TYPE) == QUAL_UNION_TYPE             \
-             || TREE_ADDRESSABLE (TYPE))))
-
 /* The number of register assigned to holding function arguments.  */
 
 #define FRV_NUM_ARG_REGS        6
 
-/* A C expression that controls whether a function argument is passed in a
-   register, and which register.
-
-   The arguments are CUM, of type CUMULATIVE_ARGS, which summarizes (in a way
-   defined by INIT_CUMULATIVE_ARGS and FUNCTION_ARG_ADVANCE) all of the previous
-   arguments so far passed in registers; MODE, the machine mode of the argument;
-   TYPE, the data type of the argument as a tree node or 0 if that is not known
-   (which happens for C support library functions); and NAMED, which is 1 for an
-   ordinary argument and 0 for nameless arguments that correspond to `...' in the
-   called function's prototype.
-
-   The value of the expression should either be a `reg' RTX for the hard
-   register in which to pass the argument, or zero to pass the argument on the
-   stack.
-
-   For machines like the VAX and 68000, where normally all arguments are
-   pushed, zero suffices as a definition.
-
-   The usual way to make the ANSI library `stdarg.h' work on a machine where
-   some arguments are usually passed in registers, is to cause nameless
-   arguments to be passed on the stack instead.  This is done by making
-   `FUNCTION_ARG' return 0 whenever NAMED is 0.
-
-   You may use the macro `MUST_PASS_IN_STACK (MODE, TYPE)' in the definition of
-   this macro to determine if this argument is of a type that must be passed in
-   the stack.  If `REG_PARM_STACK_SPACE' is not defined and `FUNCTION_ARG'
-   returns nonzero for such an argument, the compiler will abort.  If
-   `REG_PARM_STACK_SPACE' is defined, the argument will be computed in the
-   stack and then loaded into a register.  */
 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED)                    \
   frv_function_arg (&CUM, MODE, TYPE, NAMED, FALSE)
 
@@ -1874,56 +1702,6 @@ struct machine_function GTY(())
 #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED)                  \
   frv_function_arg (&CUM, MODE, TYPE, NAMED, TRUE)
 
-/* A C expression for the number of words, at the beginning of an argument,
-   must be put in registers.  The value must be zero for arguments that are
-   passed entirely in registers or that are entirely pushed on the stack.
-
-   On some machines, certain arguments must be passed partially in registers
-   and partially in memory.  On these machines, typically the first N words of
-   arguments are passed in registers, and the rest on the stack.  If a
-   multi-word argument (a `double' or a structure) crosses that boundary, its
-   first few words must be passed in registers and the rest must be pushed.
-   This macro tells the compiler when this occurs, and how many of the words
-   should go in registers.
-
-   `FUNCTION_ARG' for these arguments should return the first register to be
-   used by the caller for this argument; likewise `FUNCTION_INCOMING_ARG', for
-   the called function.  */
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED)             \
-  frv_function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
-
-/* extern int frv_function_arg_partial_nregs PARAMS ((CUMULATIVE_ARGS, int, Tree, int));  */
-
-/* A C expression that indicates when an argument must be passed by reference.
-   If nonzero for an argument, a copy of that argument is made in memory and a
-   pointer to the argument is passed instead of the argument itself.  The
-   pointer is passed in whatever way is appropriate for passing a pointer to
-   that type.
-
-   On machines where `REG_PARM_STACK_SPACE' is not defined, a suitable
-   definition of this macro might be
-        #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED)  \
-          MUST_PASS_IN_STACK (MODE, TYPE)  */
-#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED)         \
-  frv_function_arg_pass_by_reference (&CUM, MODE, TYPE, NAMED)
-
-/* If defined, a C expression that indicates when it is the called function's
-   responsibility to make a copy of arguments passed by invisible reference.
-   Normally, the caller makes a copy and passes the address of the copy to the
-   routine being called.  When FUNCTION_ARG_CALLEE_COPIES is defined and is
-   nonzero, the caller does not make a copy.  Instead, it passes a pointer to
-   the "live" value.  The called function must not modify this value.  If it
-   can be determined that the value won't be modified, it need not make a copy;
-   otherwise a copy must be made.  */
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED)             \
-  frv_function_arg_callee_copies (&CUM, MODE, TYPE, NAMED)
-
-/* If defined, a C expression that indicates when it is more desirable to keep
-   an argument passed by invisible reference as a reference, rather than
-   copying it to a pseudo register.  */
-#define FUNCTION_ARG_KEEP_AS_REFERENCE(CUM, MODE, TYPE, NAMED)         \
-  frv_function_arg_keep_as_reference (&CUM, MODE, TYPE, NAMED)
-
 /* A C type for declaring a variable that is used as the first argument of
    `FUNCTION_ARG' and other related values.  For some target machines, the type
    `int' suffices and can hold the number of bytes of argument so far.
@@ -1952,7 +1730,7 @@ struct machine_function GTY(())
    being processed.  Thus, each time this macro is called, either LIBNAME or
    FNTYPE is nonzero, but never both of them at once.  */
 
-#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL) \
+#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
   frv_init_cumulative_args (&CUM, FNTYPE, LIBNAME, FNDECL, FALSE)
 
 /* Like `INIT_CUMULATIVE_ARGS' but overrides it for the purposes of finding the
@@ -1960,7 +1738,7 @@ struct machine_function GTY(())
    `INIT_CUMULATIVE_ARGS' is used instead.
 
    The value passed for LIBNAME is always 0, since library routines with
-   special calling conventions are never compiled with GNU CC.  The argument
+   special calling conventions are never compiled with GCC.  The argument
    LIBNAME exists for symmetry with `INIT_CUMULATIVE_ARGS'.  */
 
 #define INIT_CUMULATIVE_INCOMING_ARGS(CUM, FNTYPE, LIBNAME) \
@@ -2006,8 +1784,9 @@ struct machine_function GTY(())
    (Actually, on most machines, scalar values are returned in the same place
    regardless of mode).
 
-   If `PROMOTE_FUNCTION_RETURN' is defined, you must apply the same promotion
-   rules specified in `PROMOTE_MODE' if VALTYPE is a scalar type.
+   If `TARGET_PROMOTE_FUNCTION_RETURN' is defined to return true, you
+   must apply the same promotion rules specified in `PROMOTE_MODE' if
+   VALTYPE is a scalar type.
 
    If the precise function being called is known, FUNC is a tree node
    (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer.  This makes it
@@ -2015,10 +1794,10 @@ struct machine_function GTY(())
    functions when all their calls are known.
 
    `FUNCTION_VALUE' is not used for return vales with aggregate data types,
-   because these are returned in another way.  See `STRUCT_VALUE_REGNUM' and
-   related macros, below.  */
+   because these are returned in another way.  See
+   `TARGET_STRUCT_VALUE_RTX' and related macros, below.  */
 #define FUNCTION_VALUE(VALTYPE, FUNC) \
-  gen_rtx (REG, TYPE_MODE (VALTYPE), RETURN_VALUE_REGNUM)
+  gen_rtx_REG (TYPE_MODE (VALTYPE), RETURN_VALUE_REGNUM)
 
 /* A C expression to create an RTX representing the place where a library
    function returns a value of mode MODE.
@@ -2029,7 +1808,7 @@ struct machine_function GTY(())
 
    The definition of `LIBRARY_VALUE' need not be concerned aggregate data
    types, because none of the library functions returns such types.  */
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, RETURN_VALUE_REGNUM)
+#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, RETURN_VALUE_REGNUM)
 
 /* A C expression that is nonzero if REGNO is the number of a hard register in
    which the values of called function may come back.
@@ -2048,9 +1827,9 @@ struct machine_function GTY(())
 \f
 /* How Large Values are Returned.  */
 
-/* If the structure value address is passed in a register, then
-   `STRUCT_VALUE_REGNUM' should be the number of that register.  */
-#define STRUCT_VALUE_REGNUM (GPR_FIRST + 3)
+/* The number of the register that is used to pass the structure
+   value address.  */
+#define FRV_STRUCT_VALUE_REGNUM (GPR_FIRST + 3)
 
 \f
 /* Function Entry and Exit.  */
@@ -2076,77 +1855,15 @@ struct machine_function GTY(())
    `fprintf'.
 
    The details of how the address should be passed to `mcount' are determined
-   by your operating system environment, not by GNU CC.  To figure them out,
+   by your operating system environment, not by GCC.  To figure them out,
    compile a small program for profiling using the system's installed C
    compiler and look at the assembler code that results.
 
    This declaration must be present, but it can be an abort if profiling is
    not implemented.  */
 
-#define FUNCTION_PROFILER(FILE, LABELNO) abort ()
+#define FUNCTION_PROFILER(FILE, LABELNO)
 
-\f
-/* Implementing the Varargs Macros.  */
-
-/* If defined, is a C expression that produces the machine-specific code for a
-   call to `__builtin_saveregs'.  This code will be moved to the very beginning
-   of the function, before any parameter access are made.  The return value of
-   this function should be an RTX that contains the value to use as the return
-   of `__builtin_saveregs'.
-
-   If this macro is not defined, the compiler will output an ordinary call to
-   the library function `__builtin_saveregs'.  */
-
-#define EXPAND_BUILTIN_SAVEREGS() frv_expand_builtin_saveregs ()
-
-/* This macro offers an alternative to using `__builtin_saveregs' and defining
-   the macro `EXPAND_BUILTIN_SAVEREGS'.  Use it to store the anonymous register
-   arguments into the stack so that all the arguments appear to have been
-   passed consecutively on the stack.  Once this is done, you can use the
-   standard implementation of varargs that works for machines that pass all
-   their arguments on the stack.
-
-   The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure, containing
-   the values that obtain after processing of the named arguments.  The
-   arguments MODE and TYPE describe the last named argument--its machine mode
-   and its data type as a tree node.
-
-   The macro implementation should do two things: first, push onto the stack
-   all the argument registers *not* used for the named arguments, and second,
-   store the size of the data thus pushed into the `int'-valued variable whose
-   name is supplied as the argument PRETEND_ARGS_SIZE.  The value that you
-   store here will serve as additional offset for setting up the stack frame.
-
-   Because you must generate code to push the anonymous arguments at compile
-   time without knowing their data types, `SETUP_INCOMING_VARARGS' is only
-   useful on machines that have just a single category of argument register and
-   use it uniformly for all data types.
-
-   If the argument SECOND_TIME is nonzero, it means that the arguments of the
-   function are being analyzed for the second time.  This happens for an inline
-   function, which is not actually compiled until the end of the source file.
-   The macro `SETUP_INCOMING_VARARGS' should not generate any instructions in
-   this case.  */
-#define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_ARGS_SIZE, SECOND_TIME) \
-  frv_setup_incoming_varargs (& ARGS_SO_FAR, (int) MODE, TYPE,         \
-                             & PRETEND_ARGS_SIZE, SECOND_TIME)
-
-/* Implement the stdarg/varargs va_start macro.  STDARG_P is nonzero if this
-   is stdarg.h instead of varargs.h.  VALIST is the tree of the va_list
-   variable to initialize.  NEXTARG is the machine independent notion of the
-   'next' argument after the variable arguments.  If not defined, a standard
-   implementation will be defined that works for arguments passed on the stack.  */
-
-#define EXPAND_BUILTIN_VA_START(VALIST, NEXTARG)               \
-  (frv_expand_builtin_va_start(VALIST, NEXTARG))
-
-/* Implement the stdarg/varargs va_arg macro.  VALIST is the variable of type
-   va_list as a tree, TYPE is the type passed to va_arg.  */
-
-#define EXPAND_BUILTIN_VA_ARG(VALIST, TYPE)                            \
-  (frv_expand_builtin_va_arg (VALIST, TYPE))
-
-\f
 /* Trampolines for Nested Functions.  */
 
 /* A C expression for the size in bytes of the trampoline, as an integer.  */
@@ -2156,7 +1873,7 @@ struct machine_function GTY(())
 
    If you don't define this macro, the value of `BIGGEST_ALIGNMENT' is used for
    aligning trampolines.  */
-#define TRAMPOLINE_ALIGNMENT 32
+#define TRAMPOLINE_ALIGNMENT (TARGET_FDPIC ? 64 : 32)
 
 /* A C statement to initialize the variable parts of a trampoline.  ADDR is an
    RTX for the address of the trampoline; FNADDR is an RTX for the address of
@@ -2167,7 +1884,7 @@ struct machine_function GTY(())
 
 /* Define this macro if trampolines need a special subroutine to do their work.
    The macro should expand to a series of `asm' statements which will be
-   compiled with GNU CC.  They go in a library function named
+   compiled with GCC.  They go in a library function named
    `__transfer_from_trampoline'.
 
    If you need to avoid executing the ordinary prologue code of a compiled C
@@ -2183,15 +1900,14 @@ struct machine_function GTY(())
 #define TRAMPOLINE_TEMPLATE_NAME "__trampoline_template"
 #endif
 
+#define Twrite _write
+
+#if ! __FRV_FDPIC__
 #define TRANSFER_FROM_TRAMPOLINE                                       \
-extern int _write (int, const void *, unsigned);                       \
+extern int Twrite (int, const void *, unsigned);                       \
                                                                        \
 void                                                                   \
-__trampoline_setup (addr, size, fnaddr, sc)                            \
-     short * addr;                                                     \
-     int size;                                                         \
-     int fnaddr;                                                       \
-     int sc;                                                           \
+__trampoline_setup (short * addr, int size, int fnaddr, int sc)                \
 {                                                                      \
   extern short __trampoline_template[];                                        \
   short * to = addr;                                                   \
@@ -2200,7 +1916,7 @@ __trampoline_setup (addr, size, fnaddr, sc)                               \
                                                                        \
   if (size < 20)                                                       \
     {                                                                  \
-      _write (2, "__trampoline_setup bad size\n",                      \
+      Twrite (2, "__trampoline_setup bad size\n",                      \
              sizeof ("__trampoline_setup bad size\n") - 1);            \
       exit (-1);                                                       \
     }                                                                  \
@@ -2229,101 +1945,67 @@ __asm__("\n"                                                           \
        "\tsethi #0, gr6\n"                                             \
        "\tsethi #0, gr7\n"                                             \
        "\tjmpl @(gr0,gr6)\n");
-
-\f
-/* Implicit Calls to Library Routines.  */
-
-/* A C string constant giving the name of the function to call for the
-   remainder in division of one signed full-word by another.  If you do not
-   define this macro, the default name is used, which is `__modsi3', a function
-   defined in `libgcc.a'.  */
-#define MODSI3_LIBCALL "__modi"
-
-/* A C string constant giving the name of the function to call for the
-   remainder in division of one unsigned full-word by another.  If you do not
-   define this macro, the default name is used, which is `__umodsi3', a
-   function defined in `libgcc.a'.  */
-#define UMODSI3_LIBCALL "__umodi"
-
-/* A C string constant giving the name of the function to call for
-   multiplication of one signed double-word by another.  If you do not define
-   this macro, the default name is used, which is `__muldi3', a function
-   defined in `libgcc.a'.  */
-#define MULDI3_LIBCALL "__mulll"
-
-/* A C string constant giving the name of the function to call for division of
-   one signed double-word by another.  If you do not define this macro, the
-   default name is used, which is `__divdi3', a function defined in `libgcc.a'.  */
-#define DIVDI3_LIBCALL "__divll"
-
-/* A C string constant giving the name of the function to call for division of
-   one unsigned full-word by another.  If you do not define this macro, the
-   default name is used, which is `__udivdi3', a function defined in
-   `libgcc.a'.  */
-#define UDIVDI3_LIBCALL "__udivll"
-
-/* A C string constant giving the name of the function to call for the
-   remainder in division of one signed double-word by another.  If you do not
-   define this macro, the default name is used, which is `__moddi3', a function
-   defined in `libgcc.a'.  */
-#define MODDI3_LIBCALL "__modll"
-
-/* A C string constant giving the name of the function to call for the
-   remainder in division of one unsigned full-word by another.  If you do not
-   define this macro, the default name is used, which is `__umoddi3', a
-   function defined in `libgcc.a'.  */
-#define UMODDI3_LIBCALL "__umodll"
-
-/* Define this macro as a C statement that declares additional library routines
-   renames existing ones. `init_optabs' calls this macro after initializing all
-   the normal library routines.  */
-#define INIT_TARGET_OPTABS                                     \
-  do                                                           \
-    {                                                          \
-      add_optab->handlers [(int) DImode].libfunc               \
-       = init_one_libfunc ("__addll");                         \
-      sub_optab->handlers [(int) DImode].libfunc               \
-       = init_one_libfunc ("__subll");                         \
-      and_optab->handlers [(int) DImode].libfunc               \
-       = init_one_libfunc ("__andll");                         \
-      ior_optab->handlers [(int) DImode].libfunc               \
-       = init_one_libfunc ("__orll");                          \
-      xor_optab->handlers [(int) DImode].libfunc               \
-       = init_one_libfunc ("__xorll");                         \
-      one_cmpl_optab->handlers [(int) DImode].libfunc          \
-       = init_one_libfunc ("__notll");                         \
-      add_optab->handlers [(int) SFmode].libfunc               \
-       = init_one_libfunc ("__addf");                          \
-      sub_optab->handlers [(int) SFmode].libfunc               \
-       = init_one_libfunc ("__subf");                          \
-      smul_optab->handlers [(int) SFmode].libfunc              \
-       = init_one_libfunc ("__mulf");                          \
-      sdiv_optab->handlers [(int) SFmode].libfunc              \
-       = init_one_libfunc ("__divf");                          \
-      add_optab->handlers [(int) DFmode].libfunc               \
-       = init_one_libfunc ("__addd");                          \
-      sub_optab->handlers [(int) DFmode].libfunc               \
-       = init_one_libfunc ("__subd");                          \
-      smul_optab->handlers [(int) DFmode].libfunc              \
-       = init_one_libfunc ("__muld");                          \
-      sdiv_optab->handlers [(int) DFmode].libfunc              \
-       = init_one_libfunc ("__divd");                          \
-      fixsfsi_libfunc = init_one_libfunc ("__ftoi");           \
-      fixunssfsi_libfunc = init_one_libfunc ("__ftoui");       \
-      fixsfdi_libfunc = init_one_libfunc ("__ftoll");          \
-      fixunssfdi_libfunc = init_one_libfunc ("__ftoull");      \
-      fixdfsi_libfunc = init_one_libfunc ("__dtoi");           \
-      fixunsdfsi_libfunc = init_one_libfunc ("__dtoui");       \
-      fixdfdi_libfunc = init_one_libfunc ("__dtoll");          \
-      fixunsdfdi_libfunc = init_one_libfunc ("__dtoull");      \
-      floatsisf_libfunc = init_one_libfunc ("__itof");         \
-      floatdisf_libfunc = init_one_libfunc ("__lltof");                \
-      floatsidf_libfunc = init_one_libfunc ("__itod");         \
-      floatdidf_libfunc = init_one_libfunc ("__lltod");                \
-      extendsfdf2_libfunc = init_one_libfunc ("__ftod");       \
-      truncdfsf2_libfunc = init_one_libfunc ("__dtof");                \
-    }                                                          \
-  while (0)
+#else
+#define TRANSFER_FROM_TRAMPOLINE                                       \
+extern int Twrite (int, const void *, unsigned);                       \
+                                                                       \
+void                                                                   \
+__trampoline_setup (addr, size, fnaddr, sc)                            \
+     short * addr;                                                     \
+     int size;                                                         \
+     int fnaddr;                                                       \
+     int sc;                                                           \
+{                                                                      \
+  extern short __trampoline_template[];                                        \
+  short * from = &__trampoline_template[0];                            \
+  int i;                                                               \
+  short **desc = (short **)addr;                                       \
+  short * to = addr + 4;                                               \
+                                                                       \
+  if (size != 32)                                                      \
+    {                                                                  \
+      Twrite (2, "__trampoline_setup bad size\n",                      \
+             sizeof ("__trampoline_setup bad size\n") - 1);            \
+      exit (-1);                                                       \
+    }                                                                  \
+                                                                       \
+  /* Create a function descriptor with the address of the code below
+     and NULL as the FDPIC value.  We don't need the real GOT value
+     here, since we don't use it, so we use NULL, that is just as
+     good.  */                                                         \
+  desc[0] = to;                                                                \
+  desc[1] = NULL;                                                      \
+  size -= 8;                                                           \
+                                                                       \
+  to[0] = from[0];                                                     \
+  to[1] = (short)(fnaddr);                                             \
+  to[2] = from[2];                                                     \
+  to[3] = (short)(sc);                                                 \
+  to[4] = from[4];                                                     \
+  to[5] = (short)(fnaddr >> 16);                                       \
+  to[6] = from[6];                                                     \
+  to[7] = (short)(sc >> 16);                                           \
+  to[8] = from[8];                                                     \
+  to[9] = from[9];                                                     \
+  to[10] = from[10];                                                   \
+  to[11] = from[11];                                                   \
+                                                                       \
+  for (i = 0; i < size; i++)                                           \
+    __asm__ volatile ("dcf @(%0,%1)\n\tici @(%0,%1)" :: "r" (to), "r" (i)); \
+}                                                                      \
+                                                                       \
+__asm__("\n"                                                           \
+       "\t.globl " TRAMPOLINE_TEMPLATE_NAME "\n"                       \
+       "\t.text\n"                                                     \
+       TRAMPOLINE_TEMPLATE_NAME ":\n"                                  \
+       "\tsetlos #0, gr6\n"    /* Jump register.  */                   \
+       "\tsetlos #0, gr7\n"    /* Static chain.  */                    \
+       "\tsethi #0, gr6\n"                                             \
+       "\tsethi #0, gr7\n"                                             \
+       "\tldd @(gr6,gr0),gr14\n"                                       \
+       "\tjmpl @(gr14,gr0)\n"                                          \
+       );
+#endif
 
 \f
 /* Addressing Modes.  */
@@ -2408,7 +2090,8 @@ __asm__("\n"                                                              \
 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL)                       \
   do                                                                   \
     {                                                                  \
-      if (frv_legitimate_address_p (MODE, X, REG_OK_STRICT_P, FALSE))  \
+      if (frv_legitimate_address_p (MODE, X, REG_OK_STRICT_P,          \
+                                   FALSE, FALSE))                      \
        goto LABEL;                                                     \
     }                                                                  \
   while (0)
@@ -2437,53 +2120,17 @@ __asm__("\n"                                                            \
    will reload one or both registers only if neither labeling works.  */
 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
 
-/* A C compound statement that attempts to replace X with a valid memory
-   address for an operand of mode MODE.  WIN will be a C statement label
-   elsewhere in the code; the macro definition may use
-
-        GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN);
-
-   to avoid further processing if the address has become legitimate.
-
-   X will always be the result of a call to `break_out_memory_refs', and OLDX
-   will be the operand that was given to that function to produce X.
-
-   The code generated by this macro should not alter the substructure of X.  If
-   it transforms X into a more legitimate form, it should assign X (which will
-   always be a C variable) a new value.
-
-   It is not necessary for this macro to come up with a legitimate address.
-   The compiler has standard ways of doing so in all cases.  In fact, it is
-   safe for this macro to do nothing.  But often a machine-dependent strategy
-   can generate better code.  */
-
-/* On the FRV, we use it to convert small data and pic references into using
-   the appropriate pointer in the address.  */
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)                 \
-  do                                                           \
-    {                                                          \
-      rtx newx = frv_legitimize_address (X, OLDX, MODE);       \
-                                                               \
-      if (newx)                                                        \
-       {                                                       \
-         (X) = newx;                                           \
-         goto WIN;                                             \
-       }                                                       \
-    }                                                          \
-  while (0)
-
-/* A C statement or compound statement with a conditional `goto LABEL;'
-   executed if memory address X (an RTX) can have different meanings depending
-   on the machine mode of the memory reference it is used for or if the address
-   is valid for some modes but not others.
-
-   Autoincrement and autodecrement addresses typically have mode-dependent
-   effects because the amount of the increment or decrement is the size of the
-   operand being addressed.  Some machines have other mode-dependent addresses.
-   Many RISC machines have no mode-dependent addresses.
+#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)         \
+do {                                                   \
+  rtx new_x = frv_legitimize_address (X, OLDX, MODE);  \
+  if (new_x)                                           \
+    {                                                  \
+      (X) = new_x;                                     \
+      goto WIN;                                        \
+    }                                                  \
+} while (0)
 
-   You may assume that ADDR is a valid address for the machine.  */
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)
+#define FIND_BASE_TERM frv_find_base_term
 
 /* A C expression that is nonzero if X is a legitimate constant for an
    immediate operand on the target machine.  You can assume that X satisfies
@@ -2496,25 +2143,9 @@ __asm__("\n"                                                             \
 #define HAVE_PRE_MODIFY_REG 1
 
 \f
-/* Returns a mode from class `MODE_CC' to be used when comparison operation
-   code OP is applied to rtx X and Y.  For example, on the SPARC,
-   `SELECT_CC_MODE' is defined as (see *note Jump Patterns::.  for a
-   description of the reason for this definition)
-
-        #define SELECT_CC_MODE(OP,X,Y) \
-          (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT          \
-           ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode)    \
-           : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS    \
-               || GET_CODE (X) == NEG) \
-              ? CC_NOOVmode : CCmode))
-
-   You need not define this macro if `EXTRA_CC_MODES' is not defined.  */
-#define SELECT_CC_MODE(OP, X, Y)                                       \
-  (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT                         \
-   ? CC_FPmode                                                         \
-   : (((OP) == LEU || (OP) == GTU || (OP) == LTU || (OP) == GEU)       \
-      ? CC_UNSmode                                                     \
-      : CCmode))
+/* We define extra CC modes in frv-modes.def so we need a selector.  */
+
+#define SELECT_CC_MODE frv_select_cc_mode
 
 /* A C expression whose value is one if it is always safe to reverse a
    comparison whose mode is MODE.  If `SELECT_CC_MODE' can ever return MODE for
@@ -2529,8 +2160,9 @@ __asm__("\n"                                                              \
         #define REVERSIBLE_CC_MODE(MODE)  ((MODE) != CCFPEmode)  */
 
 /* On frv, don't consider floating point comparisons to be reversible.  In
-   theory, fp equality comparisons can be reversible */
-#define REVERSIBLE_CC_MODE(MODE) ((MODE) == CCmode || (MODE) == CC_UNSmode)
+   theory, fp equality comparisons can be reversible.  */
+#define REVERSIBLE_CC_MODE(MODE) \
+  ((MODE) == CCmode || (MODE) == CC_UNSmode || (MODE) == CC_NZmode)
 
 /* Frv CCR_MODE's are not reversible.  */
 #define REVERSE_CONDEXEC_PREDICATES_P(x,y)      0
@@ -2565,19 +2197,7 @@ __asm__("\n"                                                             \
 
 /* A C expression for the cost of a branch instruction.  A value of 1 is the
    default; other values are interpreted relative to that.  */
-
-/* Here are additional macros which do not specify precise relative costs, but
-   only that certain actions are more expensive than GNU CC would ordinarily
-   expect.  */
-
-/* We used to default the branch cost to 2, but I changed it to 1, to avoid
-   generating SCC instructions and or/and-ing them together, and then doing the
-   branch on the result, which collectively generate much worse code.  */
-#ifndef DEFAULT_BRANCH_COST
-#define DEFAULT_BRANCH_COST 1
-#endif
-
-#define BRANCH_COST frv_branch_cost_int
+#define BRANCH_COST(speed_p, predictable_p) frv_branch_cost_int
 
 /* Define this macro as a C expression which is nonzero if accessing less than
    a word of memory (i.e. a `char' or a `short') is no faster than accessing a
@@ -2596,10 +2216,6 @@ __asm__("\n"                                                             \
    address than to call an address kept in a register.  */
 #define NO_FUNCTION_CSE
 
-/* Define this macro if it is as good or better for a function to call itself
-   with an explicit address than to call an address kept in a register.  */
-#define NO_RECURSIVE_FUNCTION_CSE
-
 \f
 /* Dividing the output into sections.  */
 
@@ -2624,7 +2240,6 @@ __asm__("\n"                                                              \
 
 /* Short Data Support */
 #define SDATA_SECTION_ASM_OP   "\t.section .sdata,\"aw\""
-#define SBSS_SECTION_ASM_OP    "\t.section .sbss,\"aw\""
 
 /* On svr4, we *do* have support for the .init and .fini sections, and we
    can put stuff in there to be executed before and after `main'.  We let
@@ -2640,65 +2255,16 @@ __asm__("\n"                                                            \
 #define INIT_SECTION_ASM_OP    "\t.section .init,\"ax\""
 #define FINI_SECTION_ASM_OP    "\t.section .fini,\"ax\""
 
+#undef CTORS_SECTION_ASM_OP
+#undef DTORS_SECTION_ASM_OP
+#define CTORS_SECTION_ASM_OP   "\t.section\t.ctors,\"a\""
+#define DTORS_SECTION_ASM_OP   "\t.section\t.dtors,\"a\""
+
 /* A C expression whose value is a string containing the assembler operation to
    switch to the fixup section that records all initialized pointers in a -fpic
    program so they can be changed program startup time if the program is loaded
    at a different address than linked for.  */
 #define FIXUP_SECTION_ASM_OP   "\t.section .rofixup,\"a\""
-
-/* A list of names for sections other than the standard two, which are
-   `in_text' and `in_data'.  You need not define this macro
-   on a system with no other sections (that GCC needs to use).  */
-#undef  EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_sdata, in_sbss, in_const, in_fixup
-
-/* One or more functions to be defined in "varasm.c".  These
-   functions should do jobs analogous to those of `text_section' and
-   `data_section', for your additional sections.  Do not define this
-   macro if you do not define `EXTRA_SECTIONS'.  */
-#undef  EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS                                         \
-SDATA_SECTION_FUNCTION                                                  \
-SBSS_SECTION_FUNCTION                                                  \
-FIXUP_SECTION_FUNCTION
-
-
-#define SDATA_SECTION_FUNCTION                                         \
-void                                                                   \
-sdata_section ()                                                       \
-{                                                                      \
-  if (in_section != in_sdata)                                          \
-    {                                                                  \
-      fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP);            \
-      in_section = in_sdata;                                           \
-    }                                                                  \
-}                                                                      \
-
-#define SBSS_SECTION_FUNCTION                                          \
-void                                                                   \
-sbss_section ()                                                                \
-{                                                                      \
-  if (in_section != in_sbss)                                           \
-    {                                                                  \
-      fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP);             \
-      in_section = in_sbss;                                            \
-    }                                                                  \
-}                                                                      \
-
-#define FIXUP_SECTION_FUNCTION                                         \
-void                                                                   \
-fixup_section ()                                                       \
-{                                                                      \
-  if (in_section != in_fixup)                                          \
-    {                                                                  \
-      fprintf (asm_out_file, "%s\n", FIXUP_SECTION_ASM_OP);            \
-      in_section = in_fixup;                                           \
-    }                                                                  \
-}                                                                      \
-
-#define SDATA_FLAG_CHAR '@'
-
-#define SDATA_NAME_P(NAME) (*(NAME) == SDATA_FLAG_CHAR)
 \f
 /* Position Independent Code.  */
 
@@ -2712,7 +2278,7 @@ fixup_section ()                                                  \
   (   GET_CODE (X) == CONST_INT                                                \
    || GET_CODE (X) == CONST_DOUBLE                                     \
    || (GET_CODE (X) == HIGH && GET_CODE (XEXP (X, 0)) == CONST_INT)    \
-   || GET_CODE (X) == CONSTANT_P_RTX)
+   || got12_operand (X, VOIDmode))                                     \
 
 \f
 /* The Overall Framework of an Assembler File.  */
@@ -2783,10 +2349,10 @@ extern int size_directive_output;
 #undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGN) \
 do {                                                                           \
-  if (SDATA_NAME_P (NAME))                                                     \
-    sbss_section ();                                                   \
+  if ((SIZE) > 0 && (SIZE) <= g_switch_value)                          \
+    switch_to_section (get_named_section (NULL, ".sbss", 0));           \
   else                                                                         \
-     bss_section ();                                                   \
+    switch_to_section (bss_section);                                   \
   ASM_OUTPUT_ALIGN (STREAM, floor_log2 ((ALIGN) / BITS_PER_UNIT));             \
   ASM_DECLARE_OBJECT_NAME (STREAM, NAME, DECL);                                \
   ASM_OUTPUT_SKIP (STREAM, (SIZE) ? (SIZE) : 1);                               \
@@ -2809,19 +2375,6 @@ do {                                                                     \
 /* Globalizing directive for a label.  */
 #define GLOBAL_ASM_OP "\t.globl "
 
-/* A C statement (sans semicolon) to output to the stdio stream STREAM a
-   reference in assembler syntax to a label named NAME.  This should add `_' to
-   the front of the name, if that is customary on your operating system, as it
-   is in most Berkeley Unix systems.  This macro is used in `assemble_name'.  */
-#undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(STREAM, NAME)                              \
-do {                                                                   \
-  const char *_name = (NAME);                                          \
-  while (*_name == '*' || *_name == SDATA_FLAG_CHAR)                   \
-    _name++;                                                           \
-  asm_fprintf (STREAM, "%U%s", _name);                                 \
-} while (0)
-
 /* A C statement to store into the string STRING a label whose name is made
    from the string PREFIX and the number NUM.
 
@@ -2847,7 +2400,7 @@ do {                                                                      \
 /* Macros Controlling Initialization Routines.  */
 
 /* If defined, a C string constant for the assembler operation to identify the
-   following data as initialization code.  If not defined, GNU CC will assume
+   following data as initialization code.  If not defined, GCC will assume
    such a section does not exist.  When you are using special sections for
    initialization and termination functions, this macro also controls how
    `crtstuff.c' and `libgcc2.c' arrange to run the initialization functions.
@@ -2860,27 +2413,6 @@ do {                                                                     \
    init section is not actually run automatically, but is still useful for
    collecting the lists of constructors and destructors.  */
 #define INVOKE__main
-
-/* Output appropriate code tp call a static constructor.  */
-#undef  ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(STREAM,NAME)                            \
-do {                                                                   \
-  ctors_section ();                                                    \
-  fprintf (STREAM, "\t.picptr\t");                                     \
-  assemble_name (STREAM, NAME);                                                \
-  fprintf (STREAM, "\n");                                                      \
-} while (0)
-
-/* Output appropriate code tp call a static destructor.  */
-#undef  ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(STREAM,NAME)                             \
-do {                                                                   \
-  dtors_section ();                                                    \
-  fprintf (STREAM, "\t.picptr\t");                                     \
-  assemble_name (STREAM, NAME);                                                \
-  fprintf (STREAM, "\n");                                                      \
-} while (0)
-
 \f
 /* Output of Assembler Instructions.  */
 
@@ -2910,8 +2442,10 @@ do {                                                                     \
   "fcc0", "fcc1", "fcc2", "fcc3", "icc0", "icc1", "icc2", "icc3",      \
   "cc0",  "cc1",  "cc2",  "cc3",  "cc4",  "cc5",  "cc6",  "cc7",       \
   "acc0", "acc1", "acc2", "acc3", "acc4", "acc5", "acc6", "acc7",      \
+  "acc8", "acc9", "acc10", "acc11",                                    \
   "accg0","accg1","accg2","accg3","accg4","accg5","accg6","accg7",     \
-  "ap",   "lr",   "lcr"                                                        \
+  "accg8", "accg9", "accg10", "accg11",                                        \
+  "ap",   "lr",   "lcr",  "iacc0h", "iacc0l"                           \
 }
 
 /* Define this macro if you are using an unusual assembler that
@@ -2996,7 +2530,7 @@ do {                                                                      \
    * == temporary integer CCR register (cr3)
    & == temporary integer ICC register (icc3)  */
 #define PRINT_OPERAND_PUNCT_VALID_P(CODE)                              \
-((CODE) == '.' || (CODE) == '#' || (CODE) == SDATA_FLAG_CHAR || (CODE) == '~'  \
+((CODE) == '.' || (CODE) == '#' || (CODE) == '@' || (CODE) == '~'      \
  || (CODE) == '*' || (CODE) == '&')
 
 /* A C compound statement to output to stdio stream STREAM the assembler syntax
@@ -3051,38 +2585,7 @@ fprintf (STREAM, "\t.word .L%d-.L%d\n", VALUE, REL)
 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
 fprintf (STREAM, "\t.word .L%d\n", VALUE)
 
-/* Define this if the label before a jump-table needs to be output specially.
-   The first three arguments are the same as for `(*targetm.asm_out.internal_label)';
-   the fourth argument is the jump-table which follows (a `jump_insn'
-   containing an `addr_vec' or `addr_diff_vec').
-
-   This feature is used on system V to output a `swbeg' statement for the
-   table.
-
-   If this macro is not defined, these labels are output with
-   `(*targetm.asm_out.internal_label)'.
-
-   Defined in svr4.h.  */
-/* When generating embedded PIC or mips16 code we want to put the jump
-   table in the .text section.  In all other cases, we want to put the
-   jump table in the .rdata section.  Unfortunately, we can't use
-   JUMP_TABLES_IN_TEXT_SECTION, because it is not conditional.
-   Instead, we use ASM_OUTPUT_CASE_LABEL to switch back to the .text
-   section if appropriate.  */
-
-#undef  ASM_OUTPUT_CASE_LABEL
-#define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE)               \
-do {                                                                    \
-  if (flag_pic)                                                         \
-    function_section (current_function_decl);                           \
-  (*targetm.asm_out.internal_label) (STREAM, PREFIX, NUM);                      \
-} while (0)
-
-/* Define this to determine whether case statement labels are relative to
-   the start of the case statement or not.  */
-
-#define CASE_VECTOR_PC_RELATIVE (flag_pic)
-
+#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
 \f
 /* Assembler Commands for Exception Regions.  */
 
@@ -3111,7 +2614,7 @@ do {                                                                    \
    Defined in svr4.h.  */
 #undef  ASM_OUTPUT_SKIP
 #define ASM_OUTPUT_SKIP(STREAM, NBYTES) \
-  fprintf (STREAM, "\t.zero\t%u\n", (NBYTES))
+  fprintf (STREAM, "\t.zero\t%u\n", (int)(NBYTES))
 
 /* A C statement to output to the stdio stream STREAM an assembler command to
    advance the location counter to a multiple of 2 to the POWER bytes.  POWER
@@ -3119,6 +2622,9 @@ do {                                                                    \
 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
   fprintf ((STREAM), "\t.p2align %d\n", (POWER))
 
+/* Inside the text section, align with unpacked nops rather than zeros.  */
+#define ASM_OUTPUT_ALIGN_WITH_NOP(STREAM, POWER) \
+  fprintf ((STREAM), "\t.p2alignl %d,0x80880000\n", (POWER))
 \f
 /* Macros Affecting all Debug Formats.  */
 
@@ -3128,7 +2634,7 @@ do {                                                                    \
    knows about and DBX does not, or vice versa.  In such cases, some register
    may need to have one number in the compiler and another for DBX.
 
-   If two registers have consecutive numbers inside GNU CC, and they can be
+   If two registers have consecutive numbers inside GCC, and they can be
    used as a pair to hold a multiword value, then they *must* have consecutive
    numbers after renumbering with `DBX_REGISTER_NUMBER'.  Otherwise, debuggers
    will be unable to access such a pair, because they expect register pairs to
@@ -3141,9 +2647,9 @@ do {                                                                    \
    This declaration is required.  */
 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
 
-/* A C expression that returns the type of debugging output GNU CC produces
+/* A C expression that returns the type of debugging output GCC produces
    when the user specifies `-g' or `-ggdb'.  Define this if you have arranged
-   for GNU CC to support more than one format of debugging output.  Currently,
+   for GCC to support more than one format of debugging output.  Currently,
    the allowable values are `DBX_DEBUG', `SDB_DEBUG', `DWARF_DEBUG',
    `DWARF2_DEBUG', and `XCOFF_DEBUG'.
 
@@ -3157,99 +2663,6 @@ do {                                                                    \
 \f
 /* Miscellaneous Parameters.  */
 
-/* Define this if you have defined special-purpose predicates in the file
-   `MACHINE.c'.  This macro is called within an initializer of an array of
-   structures.  The first field in the structure is the name of a predicate and
-   the second field is an array of rtl codes.  For each predicate, list all rtl
-   codes that can be in expressions matched by the predicate.  The list should
-   have a trailing comma.  Here is an example of two entries in the list for a
-   typical RISC machine:
-
-        #define PREDICATE_CODES \
-          {"gen_reg_rtx_operand", {SUBREG, REG}},  \
-          {"reg_or_short_cint_operand", {SUBREG, REG, CONST_INT}},
-
-   Defining this macro does not affect the generated code (however, incorrect
-   definitions that omit an rtl code that may be matched by the predicate can
-   cause the compiler to malfunction).  Instead, it allows the table built by
-   `genrecog' to be more compact and efficient, thus speeding up the compiler.
-   The most important predicates to include in the list specified by this macro
-   are thoses used in the most insn patterns.  */
-#define PREDICATE_CODES                                                        \
-  { "integer_register_operand",                { REG, SUBREG }},               \
-  { "frv_load_operand",                        { REG, SUBREG, MEM }},          \
-  { "gpr_no_subreg_operand",           { REG }},                       \
-  { "gpr_or_fpr_operand",              { REG, SUBREG }},               \
-  { "gpr_or_int12_operand",            { REG, SUBREG, CONST_INT }},    \
-  { "gpr_fpr_or_int12_operand",                { REG, SUBREG, CONST_INT }},    \
-  { "gpr_or_int10_operand",            { REG, SUBREG, CONST_INT }},    \
-  { "gpr_or_int_operand",              { REG, SUBREG, CONST_INT }},    \
-  { "move_source_operand",             { REG, SUBREG, CONST_INT, MEM,  \
-                                         CONST_DOUBLE, CONST,          \
-                                         SYMBOL_REF, LABEL_REF }},     \
-  { "move_destination_operand",                { REG, SUBREG, MEM }},          \
-  { "condexec_source_operand",         { REG, SUBREG, CONST_INT, MEM,  \
-                                         CONST_DOUBLE }},              \
-  { "condexec_dest_operand",           { REG, SUBREG, MEM }},          \
-  { "reg_or_0_operand",                        { REG, SUBREG, CONST_INT }},    \
-  { "lr_operand",                      { REG }},                       \
-  { "gpr_or_memory_operand",           { REG, SUBREG, MEM }},          \
-  { "fpr_or_memory_operand",           { REG, SUBREG, MEM }},          \
-  { "int12_operand",                   { CONST_INT }},                 \
-  { "int_2word_operand",               { CONST_INT, CONST_DOUBLE,      \
-                                         SYMBOL_REF, LABEL_REF, CONST }}, \
-  { "pic_register_operand",            { REG }},                       \
-  { "pic_symbolic_operand",            { SYMBOL_REF, LABEL_REF, CONST }}, \
-  { "small_data_register_operand",     { REG }},                       \
-  { "small_data_symbolic_operand",     { SYMBOL_REF, CONST }},         \
-  { "icc_operand",                     { REG }},                       \
-  { "fcc_operand",                     { REG }},                       \
-  { "cc_operand",                      { REG }},                       \
-  { "icr_operand",                     { REG }},                       \
-  { "fcr_operand",                     { REG }},                       \
-  { "cr_operand",                      { REG }},                       \
-  { "fpr_operand",                     { REG, SUBREG }},               \
-  { "even_reg_operand",                        { REG, SUBREG }},               \
-  { "odd_reg_operand",                 { REG, SUBREG }},               \
-  { "even_gpr_operand",                        { REG, SUBREG }},               \
-  { "odd_gpr_operand",                 { REG, SUBREG }},               \
-  { "quad_fpr_operand",                        { REG, SUBREG }},               \
-  { "even_fpr_operand",                        { REG, SUBREG }},               \
-  { "odd_fpr_operand",                 { REG, SUBREG }},               \
-  { "dbl_memory_one_insn_operand",     { MEM }},                       \
-  { "dbl_memory_two_insn_operand",     { MEM }},                       \
-  { "call_operand",                    { REG, SUBREG, PLUS, CONST_INT, \
-                                         SYMBOL_REF, LABEL_REF, CONST }}, \
-  { "upper_int16_operand",             { CONST_INT }},                 \
-  { "uint16_operand",                  { CONST_INT }},                 \
-  { "relational_operator",             { EQ, NE, LE, LT, GE, GT,       \
-                                         LEU, LTU, GEU, GTU }},        \
-  { "signed_relational_operator",      { EQ, NE, LE, LT, GE, GT }},    \
-  { "unsigned_relational_operator",    { LEU, LTU, GEU, GTU }},        \
-  { "float_relational_operator",       { EQ, NE, LE, LT, GE, GT }},    \
-  { "ccr_eqne_operator",               { EQ, NE }},                    \
-  { "minmax_operator",                 { SMIN, SMAX, UMIN, UMAX }},    \
-  { "condexec_si_binary_operator",     { PLUS, MINUS, AND, IOR, XOR,   \
-                                         ASHIFT, ASHIFTRT, LSHIFTRT }}, \
-  { "condexec_si_divide_operator",     { DIV, UDIV }},                 \
-  { "condexec_si_unary_operator",      { NOT, NEG }},                  \
-  { "condexec_sf_binary_operator",     { PLUS, MINUS, MULT, DIV }},    \
-  { "condexec_sf_unary_operator",      { ABS, NEG, SQRT }},            \
-  { "intop_compare_operator",          { PLUS, MINUS, AND, IOR, XOR,   \
-                                         ASHIFT, ASHIFTRT, LSHIFTRT }}, \
-  { "condexec_intop_cmp_operator",     { PLUS, MINUS, AND, IOR, XOR,   \
-                                         ASHIFT, ASHIFTRT, LSHIFTRT }}, \
-  { "fpr_or_int6_operand",             { REG, SUBREG, CONST_INT }},    \
-  { "int6_operand",                    { CONST_INT }},                 \
-  { "int5_operand",                    { CONST_INT }},                 \
-  { "uint5_operand",                   { CONST_INT }},                 \
-  { "uint4_operand",                   { CONST_INT }},                 \
-  { "uint1_operand",                   { CONST_INT }},                 \
-  { "acc_operand",                     { REG, SUBREG }},               \
-  { "even_acc_operand",                        { REG, SUBREG }},               \
-  { "quad_acc_operand",                        { REG, SUBREG }},               \
-  { "accg_operand",                    { REG, SUBREG }},
-
 /* An alias for a machine mode name.  This is the machine mode that elements of
    a jump-table should have.  */
 #define CASE_VECTOR_MODE SImode
@@ -3263,12 +2676,12 @@ do {                                                                    \
    memory in MODE, an integral mode narrower than a word, set the bits outside
    of MODE to be either the sign-extension or the zero-extension of the data
    read.  Return `SIGN_EXTEND' for values of MODE for which the insn
-   sign-extends, `ZERO_EXTEND' for which it zero-extends, and `NIL' for other
+   sign-extends, `ZERO_EXTEND' for which it zero-extends, and `UNKNOWN' for other
    modes.
 
    This macro is not called with MODE non-integral or with a width greater than
    or equal to `BITS_PER_WORD', so you may return any value in this case.  Do
-   not define this macro if it would always return `NIL'.  On machines where
+   not define this macro if it would always return `UNKNOWN'.  On machines where
    this macro is defined, you will normally define it as the constant
    `SIGN_EXTEND' or `ZERO_EXTEND'.  */
 #define LOAD_EXTEND_OP(MODE) SIGN_EXTEND
@@ -3321,9 +2734,6 @@ do {                                                                    \
    cc0, and 1 if it does use cc0.  */
 #define MAX_CONDITIONAL_EXECUTE frv_condexec_insns
 
-/* Default value of MAX_CONDITIONAL_EXECUTE if no -mcond-exec-insns= */
-#define DEFAULT_CONDEXEC_INSNS 8
-
 /* A C expression to modify the code described by the conditional if
    information CE_INFO, possibly updating the tests in TRUE_EXPR, and
    FALSE_EXPR for converting if-then and if-then-else code to conditional
@@ -3361,18 +2771,6 @@ frv_ifcvt_modify_multiple_tests (CE_INFO, BB, &TRUE_EXPR, &FALSE_EXPR)
 /* Initialize the extra fields provided by IFCVT_EXTRA_FIELDS.  */
 #define IFCVT_INIT_EXTRA_FIELDS(CE_INFO) frv_ifcvt_init_extra_fields (CE_INFO)
 
-/* Indicate how many instructions can be issued at the same time.  */
-#define ISSUE_RATE                                                     \
-(! TARGET_PACK ? 1                                                     \
- : (frv_cpu_type == FRV_CPU_GENERIC                                    \
-    || frv_cpu_type == FRV_CPU_FR500                                   \
-    || frv_cpu_type == FRV_CPU_TOMCAT) ? 4                             \
- : frv_cpu_type == FRV_CPU_FR400 ? 2 : 1)
-
-/* Set and clear whether this insn begins a VLIW insn.  */
-#define CLEAR_VLIW_START(INSN) PUT_MODE (INSN, VOIDmode)
-#define SET_VLIW_START(INSN) PUT_MODE (INSN, TImode)
-
 /* The definition of the following macro results in that the 2nd jump
    optimization (after the 2nd insn scheduling) is minimal.  It is
    necessary to define when start cycle marks of insns (TImode is used
@@ -3386,10 +2784,6 @@ frv_ifcvt_modify_multiple_tests (CE_INFO, BB, &TRUE_EXPR, &FALSE_EXPR)
 
 #define MINIMAL_SECOND_JUMP_OPTIMIZATION
 
-/* Return true if parallel operations are expected to be emitted via the
-   packing flag.  */
-#define PACKING_FLAG_USED_P() \
-(optimize && flag_schedule_insns_after_reload && ISSUE_RATE > 1)
 
 /* If the following macro is defined and nonzero and deterministic
    finite state automata are used for pipeline hazard recognition, the
@@ -3489,13 +2883,42 @@ enum frv_builtins
   FRV_BUILTIN_MCPLI,
   FRV_BUILTIN_MDCUTSSI,
   FRV_BUILTIN_MQSATHS,
+  FRV_BUILTIN_MQLCLRHS,
+  FRV_BUILTIN_MQLMTHS,
+  FRV_BUILTIN_MQSLLHI,
+  FRV_BUILTIN_MQSRAHI,
   FRV_BUILTIN_MHSETLOS,
   FRV_BUILTIN_MHSETLOH,
   FRV_BUILTIN_MHSETHIS,
   FRV_BUILTIN_MHSETHIH,
   FRV_BUILTIN_MHDSETS,
-  FRV_BUILTIN_MHDSETH
+  FRV_BUILTIN_MHDSETH,
+  FRV_BUILTIN_SMUL,
+  FRV_BUILTIN_UMUL,
+  FRV_BUILTIN_PREFETCH0,
+  FRV_BUILTIN_PREFETCH,
+  FRV_BUILTIN_SMASS,
+  FRV_BUILTIN_SMSSS,
+  FRV_BUILTIN_SMU,
+  FRV_BUILTIN_SCUTSS,
+  FRV_BUILTIN_ADDSS,
+  FRV_BUILTIN_SUBSS,
+  FRV_BUILTIN_SLASS,
+  FRV_BUILTIN_IACCreadll,
+  FRV_BUILTIN_IACCreadl,
+  FRV_BUILTIN_IACCsetll,
+  FRV_BUILTIN_IACCsetl,
+  FRV_BUILTIN_SCAN,
+  FRV_BUILTIN_READ8,
+  FRV_BUILTIN_READ16,
+  FRV_BUILTIN_READ32,
+  FRV_BUILTIN_READ64,
+  FRV_BUILTIN_WRITE8,
+  FRV_BUILTIN_WRITE16,
+  FRV_BUILTIN_WRITE32,
+  FRV_BUILTIN_WRITE64
 };
+#define FRV_BUILTIN_FIRST_NONMEDIA FRV_BUILTIN_SMUL
 
 /* Enable prototypes on the call rtl functions.  */
 #define MD_CALL_PROTOTYPES 1
@@ -3503,4 +2926,11 @@ enum frv_builtins
 extern GTY(()) rtx frv_compare_op0;                    /* operand save for */
 extern GTY(()) rtx frv_compare_op1;                    /* comparison generation */
 
+#define CPU_UNITS_QUERY 1
+
+#ifdef __FRV_FDPIC__
+#define CRT_GET_RFIB_DATA(dbase) \
+  ({ extern void *_GLOBAL_OFFSET_TABLE_; (dbase) = &_GLOBAL_OFFSET_TABLE_; })
+#endif
+
 #endif /* __FRV_H__ */