]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config/bfin/bfin.c
Wrap option names in gcc internal messages with %< and %>.
[thirdparty/gcc.git] / gcc / config / bfin / bfin.c
index 8fb50dadf5491045f62447b22f165c2ac282c264..97c2c12d5ce9f75dc320595a84689ea998463987 100644 (file)
@@ -1,5 +1,5 @@
 /* The Blackfin code generation auxiliary output file.
-   Copyright (C) 2005-2014 Free Software Foundation, Inc.
+   Copyright (C) 2005-2019 Free Software Foundation, Inc.
    Contributed by Analog Devices.
 
    This file is part of GCC.
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define IN_TARGET_CODE 1
+
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
+#include "backend.h"
+#include "target.h"
 #include "rtl.h"
+#include "tree.h"
+#include "stringpool.h"
+#include "attribs.h"
+#include "cfghooks.h"
+#include "df.h"
+#include "memmodel.h"
+#include "tm_p.h"
+#include "optabs.h"
 #include "regs.h"
-#include "hard-reg-set.h"
-#include "insn-config.h"
-#include "insn-codes.h"
-#include "conditions.h"
-#include "insn-flags.h"
+#include "emit-rtl.h"
+#include "recog.h"
+#include "cgraph.h"
+#include "diagnostic-core.h"
 #include "output.h"
 #include "insn-attr.h"
-#include "tree.h"
 #include "varasm.h"
 #include "calls.h"
-#include "flags.h"
-#include "except.h"
-#include "function.h"
-#include "input.h"
-#include "target.h"
-#include "target-def.h"
+#include "explow.h"
 #include "expr.h"
-#include "diagnostic-core.h"
-#include "recog.h"
-#include "optabs.h"
-#include "ggc.h"
-#include "cgraph.h"
+#include "cfgrtl.h"
 #include "langhooks.h"
-#include "bfin-protos.h"
-#include "tm_p.h"
-#include "tm-preds.h"
 #include "tm-constrs.h"
 #include "gt-bfin.h"
-#include "basic-block.h"
-#include "timevar.h"
-#include "df.h"
 #include "sel-sched.h"
 #include "hw-doloop.h"
-#include "opts.h"
 #include "dumpfile.h"
 #include "builtins.h"
 
+/* This file should be included last.  */
+#include "target-def.h"
+
 /* A C structure for machine-specific, per-function data.
    This is added to the cfun structure.  */
 struct GTY(()) machine_function
@@ -369,7 +365,7 @@ expand_prologue_reg_save (rtx spreg, int saveall, bool is_inthandler)
 
       XVECEXP (pat, 0, 0) = gen_rtx_UNSPEC (VOIDmode, gen_rtvec (1, val),
                                            UNSPEC_PUSH_MULTIPLE);
-      XVECEXP (pat, 0, total_consec + 1) = gen_rtx_SET (VOIDmode, spreg,
+      XVECEXP (pat, 0, total_consec + 1) = gen_rtx_SET (spreg,
                                                        gen_rtx_PLUS (Pmode,
                                                                      spreg,
                                                                      val));
@@ -385,14 +381,12 @@ expand_prologue_reg_save (rtx spreg, int saveall, bool is_inthandler)
          rtx subpat;
          if (d_to_save > 0)
            {
-             subpat = gen_rtx_SET (VOIDmode, memref, gen_rtx_REG (word_mode,
-                                                                  dregno++));
+             subpat = gen_rtx_SET (memref, gen_rtx_REG (word_mode, dregno++));
              d_to_save--;
            }
          else
            {
-             subpat = gen_rtx_SET (VOIDmode, memref, gen_rtx_REG (word_mode,
-                                                                  pregno++));
+             subpat = gen_rtx_SET (memref, gen_rtx_REG (word_mode, pregno++));
            }
          XVECEXP (pat, 0, i + 1) = subpat;
          RTX_FRAME_RELATED_P (subpat) = 1;
@@ -499,9 +493,8 @@ expand_epilogue_reg_restore (rtx spreg, bool saveall, bool is_inthandler)
     {
       rtx pat = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (total_consec + 1));
       XVECEXP (pat, 0, 0)
-       = gen_rtx_SET (VOIDmode, spreg,
-                      gen_rtx_PLUS (Pmode, spreg,
-                                    GEN_INT (total_consec * 4)));
+       = gen_rtx_SET (spreg, gen_rtx_PLUS (Pmode, spreg,
+                                           GEN_INT (total_consec * 4)));
 
       if (npregs_consec > 0)
        regno = REG_P5 + 1;
@@ -517,7 +510,7 @@ expand_epilogue_reg_restore (rtx spreg, bool saveall, bool is_inthandler)
 
          regno--;
          XVECEXP (pat, 0, i + 1)
-           = gen_rtx_SET (VOIDmode, gen_rtx_REG (word_mode, regno), memref);
+           = gen_rtx_SET (gen_rtx_REG (word_mode, regno), memref);
 
          if (npregs_consec > 0)
            {
@@ -566,7 +559,7 @@ expand_epilogue_reg_restore (rtx spreg, bool saveall, bool is_inthandler)
 
 static void
 setup_incoming_varargs (cumulative_args_t cum,
-                       enum machine_mode mode ATTRIBUTE_UNUSED,
+                       machine_mode mode ATTRIBUTE_UNUSED,
                        tree type ATTRIBUTE_UNUSED, int *pretend_size,
                        int no_rtl)
 {
@@ -1077,6 +1070,9 @@ bfin_expand_prologue (void)
   tree attrs = TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl));
   bool all = lookup_attribute ("saveall", attrs) != NULL_TREE;
 
+  if (flag_stack_usage_info)
+    current_function_static_stack_size = frame_size;
+
   if (fkind != SUBROUTINE)
     {
       expand_interrupt_handler_prologue (spreg, fkind, all);
@@ -1240,7 +1236,7 @@ bfin_delegitimize_address (rtx orig_x)
    32-bit instruction.  */
 
 int
-effective_address_32bit_p (rtx op, enum machine_mode mode) 
+effective_address_32bit_p (rtx op, machine_mode mode) 
 {
   HOST_WIDE_INT offset;
 
@@ -1294,7 +1290,7 @@ bfin_dsp_memref_p (rtx x)
 
 static int
 bfin_address_cost (rtx addr ATTRIBUTE_UNUSED,
-                  enum machine_mode mode ATTRIBUTE_UNUSED,
+                  machine_mode mode ATTRIBUTE_UNUSED,
                   addr_space_t as ATTRIBUTE_UNUSED,
                   bool speed ATTRIBUTE_UNUSED)
 {
@@ -1309,21 +1305,21 @@ print_address_operand (FILE *file, rtx x)
   switch (GET_CODE (x))
     {
     case PLUS:
-      output_address (XEXP (x, 0));
+      output_address (VOIDmode, XEXP (x, 0));
       fprintf (file, "+");
-      output_address (XEXP (x, 1));
+      output_address (VOIDmode, XEXP (x, 1));
       break;
 
     case PRE_DEC:
       fprintf (file, "--");
-      output_address (XEXP (x, 0));    
+      output_address (VOIDmode, XEXP (x, 0));    
       break;
     case POST_INC:
-      output_address (XEXP (x, 0));
+      output_address (VOIDmode, XEXP (x, 0));
       fprintf (file, "++");
       break;
     case POST_DEC:
-      output_address (XEXP (x, 0));
+      output_address (VOIDmode, XEXP (x, 0));
       fprintf (file, "--");
       break;
 
@@ -1342,7 +1338,7 @@ print_address_operand (FILE *file, rtx x)
 void
 print_operand (FILE *file, rtx x, char code)
 {
-  enum machine_mode mode;
+  machine_mode mode;
 
   if (code == '!')
     {
@@ -1657,7 +1653,7 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype,
    (TYPE is null for libcalls where that information may not be available.)  */
 
 static void
-bfin_function_arg_advance (cumulative_args_t cum_v, enum machine_mode mode,
+bfin_function_arg_advance (cumulative_args_t cum_v, machine_mode mode,
                           const_tree type, bool named ATTRIBUTE_UNUSED)
 {
   CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
@@ -1697,7 +1693,7 @@ bfin_function_arg_advance (cumulative_args_t cum_v, enum machine_mode mode,
     (otherwise it is an extra parameter matching an ellipsis).  */
 
 static rtx
-bfin_function_arg (cumulative_args_t cum_v, enum machine_mode mode,
+bfin_function_arg (cumulative_args_t cum_v, machine_mode mode,
                   const_tree type, bool named ATTRIBUTE_UNUSED)
 {
   CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
@@ -1727,7 +1723,7 @@ bfin_function_arg (cumulative_args_t cum_v, enum machine_mode mode,
    stack.   */
 
 static int
-bfin_arg_partial_bytes (cumulative_args_t cum, enum machine_mode mode,
+bfin_arg_partial_bytes (cumulative_args_t cum, machine_mode mode,
                        tree type ATTRIBUTE_UNUSED,
                        bool named ATTRIBUTE_UNUSED)
 {
@@ -1749,7 +1745,7 @@ bfin_arg_partial_bytes (cumulative_args_t cum, enum machine_mode mode,
 
 static bool
 bfin_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED,
-                       enum machine_mode mode ATTRIBUTE_UNUSED,
+                       machine_mode mode ATTRIBUTE_UNUSED,
                        const_tree type, bool named ATTRIBUTE_UNUSED)
 {
   return type && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST;
@@ -1914,7 +1910,7 @@ bfin_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
 /* Emit insns to move operands[1] into operands[0].  */
 
 void
-emit_pic_move (rtx *operands, enum machine_mode mode ATTRIBUTE_UNUSED)
+emit_pic_move (rtx *operands, machine_mode mode ATTRIBUTE_UNUSED)
 {
   rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
 
@@ -1932,7 +1928,7 @@ emit_pic_move (rtx *operands, enum machine_mode mode ATTRIBUTE_UNUSED)
    should generate an insn to move OPERANDS[1] to OPERANDS[0].  */
 
 bool
-expand_move (rtx *operands, enum machine_mode mode)
+expand_move (rtx *operands, machine_mode mode)
 {
   rtx op = operands[1];
   if ((TARGET_ID_SHARED_LIBRARY || TARGET_FDPIC)
@@ -2103,7 +2099,7 @@ bfin_expand_call (rtx retval, rtx fnaddr, rtx callarg1, rtx cookie, int sibcall)
   call = gen_rtx_CALL (VOIDmode, fnaddr, callarg1);
 
   if (retval)
-    call = gen_rtx_SET (VOIDmode, retval, call);
+    call = gen_rtx_SET (retval, call);
 
   pat = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (nelts));
   n = 0;
@@ -2120,16 +2116,30 @@ bfin_expand_call (rtx retval, rtx fnaddr, rtx callarg1, rtx cookie, int sibcall)
     CALL_INSN_FUNCTION_USAGE (call) = use;
 }
 \f
-/* Return 1 if hard register REGNO can hold a value of machine-mode MODE.  */
+/* Implement TARGET_HARD_REGNO_NREGS.  */
 
-int
-hard_regno_mode_ok (int regno, enum machine_mode mode)
+static unsigned int
+bfin_hard_regno_nregs (unsigned int regno, machine_mode mode)
+{
+  if (mode == PDImode && (regno == REG_A0 || regno == REG_A1))
+    return 1;
+  if (mode == V2PDImode && (regno == REG_A0 || regno == REG_A1))
+    return 2;
+  return CLASS_MAX_NREGS (GENERAL_REGS, mode);
+}
+
+/* Implement TARGET_HARD_REGNO_MODE_OK.
+
+   Do not allow to store a value in REG_CC for any mode.
+   Do not allow to store value in pregs if mode is not SI.  */
+static bool
+bfin_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   /* Allow only dregs to store value of mode HI or QI */
   enum reg_class rclass = REGNO_REG_CLASS (regno);
 
   if (mode == CCmode)
-    return 0;
+    return false;
 
   if (mode == V2HImode)
     return D_REGNO_P (regno);
@@ -2145,15 +2155,30 @@ hard_regno_mode_ok (int regno, enum machine_mode mode)
 
   if (mode == SImode
       && TEST_HARD_REG_BIT (reg_class_contents[PROLOGUE_REGS], regno))
-    return 1;
+    return true;
 
   return TEST_HARD_REG_BIT (reg_class_contents[MOST_REGS], regno);
 }
 
+/* Implement TARGET_MODES_TIEABLE_P.  */
+
+static bool
+bfin_modes_tieable_p (machine_mode mode1, machine_mode mode2)
+{
+  return (mode1 == mode2
+         || ((GET_MODE_CLASS (mode1) == MODE_INT
+              || GET_MODE_CLASS (mode1) == MODE_FLOAT)
+             && (GET_MODE_CLASS (mode2) == MODE_INT
+                 || GET_MODE_CLASS (mode2) == MODE_FLOAT)
+             && mode1 != BImode && mode2 != BImode
+             && GET_MODE_SIZE (mode1) <= UNITS_PER_WORD
+             && GET_MODE_SIZE (mode2) <= UNITS_PER_WORD));
+}
+
 /* Implements target hook vector_mode_supported_p.  */
 
 static bool
-bfin_vector_mode_supported_p (enum machine_mode mode)
+bfin_vector_mode_supported_p (machine_mode mode)
 {
   return mode == V2HImode;
 }
@@ -2161,7 +2186,7 @@ bfin_vector_mode_supported_p (enum machine_mode mode)
 /* Worker function for TARGET_REGISTER_MOVE_COST.  */
 
 static int
-bfin_register_move_cost (enum machine_mode mode,
+bfin_register_move_cost (machine_mode mode,
                         reg_class_t class1, reg_class_t class2)
 {
   /* These need secondary reloads, so they're more expensive.  */
@@ -2192,7 +2217,7 @@ bfin_register_move_cost (enum machine_mode mode,
    program; it'll make the costs more accurate.  */
 
 static int
-bfin_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
+bfin_memory_move_cost (machine_mode mode ATTRIBUTE_UNUSED,
                       reg_class_t rclass,
                       bool in ATTRIBUTE_UNUSED)
 {
@@ -2211,7 +2236,7 @@ bfin_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
 
 static reg_class_t
 bfin_secondary_reload (bool in_p, rtx x, reg_class_t rclass_i,
-                      enum machine_mode mode, secondary_reload_info *sri)
+                      machine_mode mode, secondary_reload_info *sri)
 {
   /* If we have HImode or QImode, we can only use DREGS as secondary registers;
      in most other cases we can also use PREGS.  */
@@ -2354,16 +2379,19 @@ bfin_option_override (void)
 
 #ifdef SUBTARGET_FDPIC_NOT_SUPPORTED
   if (TARGET_FDPIC)
-    error ("-mfdpic is not supported, please use a bfin-linux-uclibc target");
+    error ("%<-mfdpic%> is not supported, please use a bfin-linux-uclibc "
+          "target");
 #endif
 
   /* Library identification */
   if (global_options_set.x_bfin_library_id && ! TARGET_ID_SHARED_LIBRARY)
-    error ("-mshared-library-id= specified without -mid-shared-library");
+    error ("%<-mshared-library-id=%> specified without "
+          "%<-mid-shared-library%>");
 
   if (stack_limit_rtx && TARGET_FDPIC)
     {
-      warning (0, "-fstack-limit- options are ignored with -mfdpic; use -mstack-check-l1");
+      warning (0, "%<-fstack-limit-%> options are ignored with %<-mfdpic%>; "
+              "use %<-mstack-check-l1%>");
       stack_limit_rtx = NULL_RTX;
     }
 
@@ -2376,7 +2404,7 @@ bfin_option_override (void)
   /* Don't allow the user to specify -mid-shared-library and -msep-data
      together, as it makes little sense from a user's point of view...  */
   if (TARGET_SEP_DATA && TARGET_ID_SHARED_LIBRARY)
-    error ("cannot specify both -msep-data and -mid-shared-library");
+    error ("cannot specify both %<-msep-data%> and %<-mid-shared-library%>");
   /* ... internally, however, it's nearly the same.  */
   if (TARGET_SEP_DATA)
     target_flags |= MASK_ID_SHARED_LIBRARY | MASK_LEAF_ID_SHARED_LIBRARY;
@@ -2396,16 +2424,16 @@ bfin_option_override (void)
     flag_pic = 0;
 
   if (TARGET_MULTICORE && bfin_cpu_type != BFIN_CPU_BF561)
-    error ("-mmulticore can only be used with BF561");
+    error ("%<-mmulticore%> can only be used with BF561");
 
   if (TARGET_COREA && !TARGET_MULTICORE)
-    error ("-mcorea should be used with -mmulticore");
+    error ("%<-mcorea%> should be used with %<-mmulticore%>");
 
   if (TARGET_COREB && !TARGET_MULTICORE)
-    error ("-mcoreb should be used with -mmulticore");
+    error ("%<-mcoreb%> should be used with %<-mmulticore%>");
 
   if (TARGET_COREA && TARGET_COREB)
-    error ("-mcorea and -mcoreb can%'t be used together");
+    error ("%<-mcorea%> and %<-mcoreb%> can%'t be used together");
 
   flag_schedule_insns = 0;
 
@@ -2443,9 +2471,8 @@ cbranch_predicted_taken_p (rtx insn)
 
   if (x)
     {
-      int pred_val = XINT (x, 0);
-
-      return pred_val >= REG_BR_PROB_BASE / 2;
+      return profile_probability::from_reg_br_prob_note (XINT (x, 0))
+            >= profile_probability::even ();
     }
 
   return 0;
@@ -2495,7 +2522,7 @@ asm_conditional_branch (rtx_insn *insn, rtx *operands, int n_nops, int predict_t
    stored in bfin_compare_op0 and bfin_compare_op1 already.  */
 
 rtx
-bfin_gen_compare (rtx cmp, enum machine_mode mode ATTRIBUTE_UNUSED)
+bfin_gen_compare (rtx cmp, machine_mode mode ATTRIBUTE_UNUSED)
 {
   enum rtx_code code1, code2;
   rtx op0 = XEXP (cmp, 0), op1 = XEXP (cmp, 1);
@@ -2526,8 +2553,7 @@ bfin_gen_compare (rtx cmp, enum machine_mode mode ATTRIBUTE_UNUSED)
        code2 = EQ;
        break;
       }
-      emit_insn (gen_rtx_SET (VOIDmode, tem,
-                             gen_rtx_fmt_ee (code1, BImode, op0, op1)));
+      emit_insn (gen_rtx_SET (tem, gen_rtx_fmt_ee (code1, BImode, op0, op1)));
     }
 
   return gen_rtx_fmt_ee (code2, BImode, tem, CONST0_RTX (BImode));
@@ -2665,7 +2691,7 @@ split_load_immediate (rtx operands[])
    MODE.  Return false if not.  */
 
 static bool
-bfin_valid_add (enum machine_mode mode, HOST_WIDE_INT value)
+bfin_valid_add (machine_mode mode, HOST_WIDE_INT value)
 {
   unsigned HOST_WIDE_INT v = value > 0 ? value : -value;
   int sz = GET_MODE_SIZE (mode);
@@ -2678,7 +2704,7 @@ bfin_valid_add (enum machine_mode mode, HOST_WIDE_INT value)
 }
 
 static bool
-bfin_valid_reg_p (unsigned int regno, int strict, enum machine_mode mode,
+bfin_valid_reg_p (unsigned int regno, int strict, machine_mode mode,
                  enum rtx_code outer_code)
 {
   if (strict)
@@ -2706,7 +2732,7 @@ bfin_valid_reg_p (unsigned int regno, int strict, enum machine_mode mode,
 */
 
 static bool
-bfin_legitimate_address_p (enum machine_mode mode, rtx x, bool strict)
+bfin_legitimate_address_p (machine_mode mode, rtx x, bool strict)
 {
   switch (GET_CODE (x)) {
   case REG:
@@ -2727,6 +2753,7 @@ bfin_legitimate_address_p (enum machine_mode mode, rtx x, bool strict)
        && REG_P (XEXP (x, 0))
        && bfin_valid_reg_p (REGNO (XEXP (x, 0)), strict, mode, POST_INC))
       return true;
+    break;
   case PRE_DEC:
     if (LEGITIMATE_MODE_FOR_AUTOINC_P (mode)
        && XEXP (x, 0) == stack_pointer_rtx
@@ -2745,7 +2772,7 @@ bfin_legitimate_address_p (enum machine_mode mode, rtx x, bool strict)
    another way.  */
 
 static bool
-bfin_cannot_force_const_mem (enum machine_mode mode ATTRIBUTE_UNUSED,
+bfin_cannot_force_const_mem (machine_mode mode ATTRIBUTE_UNUSED,
                             rtx x ATTRIBUTE_UNUSED)
 {
   /* We have only one class of non-legitimate constants, and our movsi
@@ -2761,7 +2788,7 @@ bfin_cannot_force_const_mem (enum machine_mode mode ATTRIBUTE_UNUSED,
    crossing section boundaries.  */
 
 static bool
-bfin_legitimate_constant_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x)
+bfin_legitimate_constant_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x)
 {
   rtx sym;
   HOST_WIDE_INT offset;
@@ -2789,10 +2816,10 @@ bfin_legitimate_constant_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x)
 }
 
 static bool
-bfin_rtx_costs (rtx x, int code_i, int outer_code_i, int opno, int *total,
-               bool speed)
+bfin_rtx_costs (rtx x, machine_mode mode, int outer_code_i, int opno,
+               int *total, bool speed)
 {
-  enum rtx_code code = (enum rtx_code) code_i;
+  enum rtx_code code = GET_CODE (x);
   enum rtx_code outer_code = (enum rtx_code) outer_code_i;
   int cost2 = COSTS_N_INSNS (1);
   rtx op0, op1;
@@ -2831,7 +2858,7 @@ bfin_rtx_costs (rtx x, int code_i, int outer_code_i, int opno, int *total,
     case PLUS:
       op0 = XEXP (x, 0);
       op1 = XEXP (x, 1);
-      if (GET_MODE (x) == SImode)
+      if (mode == SImode)
        {
          if (GET_CODE (op0) == MULT
              && GET_CODE (XEXP (op0, 1)) == CONST_INT)
@@ -2840,35 +2867,36 @@ bfin_rtx_costs (rtx x, int code_i, int outer_code_i, int opno, int *total,
              if (val == 2 || val == 4)
                {
                  *total = cost2;
-                 *total += rtx_cost (XEXP (op0, 0), outer_code, opno, speed);
-                 *total += rtx_cost (op1, outer_code, opno, speed);
+                 *total += rtx_cost (XEXP (op0, 0), mode, outer_code,
+                                     opno, speed);
+                 *total += rtx_cost (op1, mode, outer_code, opno, speed);
                  return true;
                }
            }
          *total = cost2;
          if (GET_CODE (op0) != REG
              && (GET_CODE (op0) != SUBREG || GET_CODE (SUBREG_REG (op0)) != REG))
-           *total += set_src_cost (op0, speed);
+           *total += set_src_cost (op0, mode, speed);
 #if 0 /* We'd like to do this for accuracy, but it biases the loop optimizer
         towards creating too many induction variables.  */
          if (!reg_or_7bit_operand (op1, SImode))
-           *total += set_src_cost (op1, speed);
+           *total += set_src_cost (op1, mode, speed);
 #endif
        }
-      else if (GET_MODE (x) == DImode)
+      else if (mode == DImode)
        {
          *total = 6 * cost2;
          if (GET_CODE (op1) != CONST_INT
              || !satisfies_constraint_Ks7 (op1))
-           *total += rtx_cost (op1, PLUS, 1, speed);
+           *total += rtx_cost (op1, mode, PLUS, 1, speed);
          if (GET_CODE (op0) != REG
              && (GET_CODE (op0) != SUBREG || GET_CODE (SUBREG_REG (op0)) != REG))
-           *total += rtx_cost (op0, PLUS, 0, speed);
+           *total += rtx_cost (op0, mode, PLUS, 0, speed);
        }
       return true;
 
     case MINUS:
-      if (GET_MODE (x) == DImode)
+      if (mode == DImode)
        *total = 6 * cost2;
       else
        *total = cost2;
@@ -2877,7 +2905,7 @@ bfin_rtx_costs (rtx x, int code_i, int outer_code_i, int opno, int *total,
     case ASHIFT: 
     case ASHIFTRT:
     case LSHIFTRT:
-      if (GET_MODE (x) == DImode)
+      if (mode == DImode)
        *total = 6 * cost2;
       else
        *total = cost2;
@@ -2886,7 +2914,7 @@ bfin_rtx_costs (rtx x, int code_i, int outer_code_i, int opno, int *total,
       op1 = XEXP (x, 1);
       if (GET_CODE (op0) != REG
          && (GET_CODE (op0) != SUBREG || GET_CODE (SUBREG_REG (op0)) != REG))
-       *total += rtx_cost (op0, code, 0, speed);
+       *total += rtx_cost (op0, mode, code, 0, speed);
 
       return true;
          
@@ -2911,26 +2939,26 @@ bfin_rtx_costs (rtx x, int code_i, int outer_code_i, int opno, int *total,
 
       if (GET_CODE (op0) != REG
          && (GET_CODE (op0) != SUBREG || GET_CODE (SUBREG_REG (op0)) != REG))
-       *total += rtx_cost (op0, code, 0, speed);
+       *total += rtx_cost (op0, mode, code, 0, speed);
 
-      if (GET_MODE (x) == DImode)
+      if (mode == DImode)
        {
          *total = 2 * cost2;
          return true;
        }
       *total = cost2;
-      if (GET_MODE (x) != SImode)
+      if (mode != SImode)
        return true;
 
       if (code == AND)
        {
          if (! rhs_andsi3_operand (XEXP (x, 1), SImode))
-           *total += rtx_cost (XEXP (x, 1), code, 1, speed);
+           *total += rtx_cost (XEXP (x, 1), mode, code, 1, speed);
        }
       else
        {
          if (! regorlog2_operand (XEXP (x, 1), SImode))
-           *total += rtx_cost (XEXP (x, 1), code, 1, speed);
+           *total += rtx_cost (XEXP (x, 1), mode, code, 1, speed);
        }
 
       return true;
@@ -2970,10 +2998,10 @@ bfin_rtx_costs (rtx x, int code_i, int outer_code_i, int opno, int *total,
 
          if (GET_CODE (op0) != REG
              && (GET_CODE (op0) != SUBREG || GET_CODE (SUBREG_REG (op0)) != REG))
-           *total += rtx_cost (op0, MULT, 0, speed);
+           *total += rtx_cost (op0, mode, MULT, 0, speed);
          if (GET_CODE (op1) != REG
              && (GET_CODE (op1) != SUBREG || GET_CODE (SUBREG_REG (op1)) != REG))
-           *total += rtx_cost (op1, MULT, 1, speed);
+           *total += rtx_cost (op1, mode, MULT, 1, speed);
        }
       return true;
 
@@ -3180,7 +3208,7 @@ output_pop_multiple (rtx insn, rtx *operands)
 /* Adjust DST and SRC by OFFSET bytes, and generate one move in mode MODE.  */
 
 static void
-single_move_for_movmem (rtx dst, rtx src, enum machine_mode mode, HOST_WIDE_INT offset)
+single_move_for_movmem (rtx dst, rtx src, machine_mode mode, HOST_WIDE_INT offset)
 {
   rtx scratch = gen_reg_rtx (mode);
   rtx srcmem, dstmem;
@@ -3295,7 +3323,7 @@ bfin_local_alignment (tree type, unsigned align)
      memcpy can use 32 bit loads/stores.  */
   if (TYPE_SIZE (type)
       && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
-      && wi::gtu_p (TYPE_SIZE (type), 8)
+      && wi::gtu_p (wi::to_wide (TYPE_SIZE (type)), 8)
       && align < 32)
     return 32;
   return align;
@@ -3310,13 +3338,14 @@ bfin_issue_rate (void)
 }
 
 static int
-bfin_adjust_cost (rtx_insn *insn, rtx link, rtx_insn *dep_insn, int cost)
+bfin_adjust_cost (rtx_insn *insn, int dep_type, rtx_insn *dep_insn, int cost,
+                 unsigned int)
 {
   enum attr_type dep_insn_type;
   int dep_insn_code_number;
 
   /* Anti and output dependencies have zero cost.  */
-  if (REG_NOTE_KIND (link) != 0)
+  if (dep_type != 0)
     return 0;
 
   dep_insn_code_number = recog_memoized (dep_insn);
@@ -3348,8 +3377,8 @@ bfin_adjust_cost (rtx_insn *insn, rtx link, rtx_insn *dep_insn, int cost)
 /* This function acts like NEXT_INSN, but is aware of three-insn bundles and
    skips all subsequent parallel instructions if INSN is the start of such
    a group.  */
-static rtx
-find_next_insn_start (rtx insn)
+static rtx_insn *
+find_next_insn_start (rtx_insn *insn)
 {
   if (GET_MODE (insn) == SImode)
     {
@@ -3362,8 +3391,8 @@ find_next_insn_start (rtx insn)
 /* This function acts like PREV_INSN, but is aware of three-insn bundles and
    skips all subsequent parallel instructions if INSN is the start of such
    a group.  */
-static rtx
-find_prev_insn_start (rtx insn)
+static rtx_insn *
+find_prev_insn_start (rtx_insn *insn)
 {
   insn = PREV_INSN (insn);
   gcc_assert (GET_MODE (insn) != SImode);
@@ -3384,10 +3413,7 @@ bfin_can_use_doloop_p (const widest_int &, const widest_int &iterations_max,
   /* Due to limitations in the hardware (an initial loop count of 0
      does not loop 2^32 times) we must avoid to generate a hardware
      loops when we cannot rule out this case.  */
-  if (!flag_unsafe_loop_optimizations
-      && wi::geu_p (iterations_max, 0xFFFFFFFF))
-    return false;
-  return true;
+  return (wi::ltu_p (iterations_max, 0xFFFFFFFF));
 }
 
 /* Increment the counter for the number of loop instructions in the
@@ -3411,7 +3437,7 @@ bfin_hardware_loop (void)
 /* Estimate the length of INSN conservatively.  */
 
 static int
-length_for_loop (rtx insn)
+length_for_loop (rtx_insn *insn)
 {
   int length = 0;
   if (JUMP_P (insn) && any_condjump_p (insn) && !optimize_size)
@@ -3439,11 +3465,13 @@ static bool
 hwloop_optimize (hwloop_info loop)
 {
   basic_block bb;
-  rtx insn, last_insn;
+  rtx_insn *insn, *last_insn;
   rtx loop_init, start_label, end_label;
-  rtx iter_reg, scratchreg, scratch_init, scratch_init_insn;
+  rtx iter_reg, scratchreg, scratch_init;
+  rtx_insn *scratch_init_insn;
   rtx lc_reg, lt_reg, lb_reg;
-  rtx seq, seq_end;
+  rtx seq_end;
+  rtx_insn *seq;
   int length;
   bool clobber0, clobber1;
 
@@ -3461,7 +3489,7 @@ hwloop_optimize (hwloop_info loop)
 
   scratchreg = NULL_RTX;
   scratch_init = iter_reg;
-  scratch_init_insn = NULL_RTX;
+  scratch_init_insn = NULL;
   if (!PREG_P (iter_reg) && loop->incoming_src)
     {
       basic_block bb_in = loop->incoming_src;
@@ -3614,7 +3642,7 @@ hwloop_optimize (hwloop_info loop)
        }
       else
        {
-         last_insn = NULL_RTX;
+         last_insn = NULL;
          break;
        }
     }
@@ -3657,7 +3685,7 @@ hwloop_optimize (hwloop_info loop)
       last_insn = emit_insn_after (gen_forced_nop (), last_insn);
     }
 
-  loop->last_insn = safe_as_a <rtx_insn *> (last_insn);
+  loop->last_insn = last_insn;
 
   /* The loop is good for replacement.  */
   start_label = loop->start_label;
@@ -3748,7 +3776,7 @@ hwloop_optimize (hwloop_info loop)
      point.  */
   if (!loop->incoming_src && loop->head != loop->incoming_dest)
     {
-      rtx label = BB_HEAD (loop->incoming_dest);
+      rtx_insn *label = BB_HEAD (loop->incoming_dest);
       /* If we're jumping to the final basic block in the loop, and there's
         only one cheap instruction before the end (typically an increment of
         an induction variable), we can just emit a copy here instead of a
@@ -3762,7 +3790,9 @@ hwloop_optimize (hwloop_info loop)
        }
       else
        {
-         emit_jump_insn (gen_jump (label));
+         rtx_insn *ret = emit_jump_insn (gen_jump (label));
+         JUMP_LABEL (ret) = label;
+         LABEL_NUSES (label)++;
          seq_end = emit_barrier ();
        }
     }
@@ -3772,14 +3802,25 @@ hwloop_optimize (hwloop_info loop)
 
   if (loop->incoming_src)
     {
-      rtx prev = BB_END (loop->incoming_src);
+      rtx_insn *prev = BB_END (loop->incoming_src);
       if (vec_safe_length (loop->incoming) > 1
          || !(loop->incoming->last ()->flags & EDGE_FALLTHRU))
        {
          gcc_assert (JUMP_P (prev));
          prev = PREV_INSN (prev);
+         emit_insn_after (seq, prev);
+       }
+      else
+       {
+         emit_insn_after (seq, prev);
+         BB_END (loop->incoming_src) = prev;
+         basic_block new_bb = create_basic_block (seq, seq_end,
+                                                  loop->head->prev_bb);
+         edge e = loop->incoming->last ();
+         gcc_assert (e->flags & EDGE_FALLTHRU);
+         redirect_edge_succ (e, new_bb);
+         make_edge (new_bb, loop->head, 0);
        }
-      emit_insn_after (seq, prev);
     }
   else
     {
@@ -3787,8 +3828,7 @@ hwloop_optimize (hwloop_info loop)
       edge e;
       edge_iterator ei;
 
-#ifdef ENABLE_CHECKING
-      if (loop->head != loop->incoming_dest)
+      if (flag_checking && loop->head != loop->incoming_dest)
        {
          /* We aren't entering the loop at the top.  Since we've established
             that the loop is entered only at one point, this means there
@@ -3798,7 +3838,6 @@ hwloop_optimize (hwloop_info loop)
          FOR_EACH_EDGE (e, ei, loop->head->preds)
            gcc_assert (!(e->flags & EDGE_FALLTHRU));
        }
-#endif
 
       emit_insn_before (seq, BB_HEAD (loop->head));
       seq = emit_label_before (gen_label_rtx (), seq);
@@ -3817,7 +3856,8 @@ hwloop_optimize (hwloop_info loop)
 
   delete_insn (loop->loop_end);
   /* Insert the loop end label before the last instruction of the loop.  */
-  emit_label_before (loop->end_label, loop->last_insn);
+  emit_label_before (as_a <rtx_code_label *> (loop->end_label),
+                    loop->last_insn);
 
   return true;
 }
@@ -3854,7 +3894,7 @@ hwloop_fail (hwloop_info loop)
   else
     {
       splitting_loops = 1;  
-      try_split (PATTERN (insn), insn, 1);
+      try_split (PATTERN (insn), safe_as_a <rtx_insn *> (insn), 1);
       splitting_loops = 0;
     }
 }
@@ -3864,7 +3904,7 @@ hwloop_fail (hwloop_info loop)
    loop counter.  Otherwise, return NULL_RTX.  */
 
 static rtx
-hwloop_pattern_reg (rtx insn)
+hwloop_pattern_reg (rtx_insn *insn)
 {
   rtx reg;
 
@@ -3909,7 +3949,7 @@ gen_one_bundle (rtx_insn *slot[3])
   /* Verify that we really can do the multi-issue.  */
   if (slot[0])
     {
-      rtx t = NEXT_INSN (slot[0]);
+      rtx_insn *t = NEXT_INSN (slot[0]);
       while (t != slot[1])
        {
          if (! NOTE_P (t) || NOTE_KIND (t) != NOTE_INSN_DELETED)
@@ -3973,7 +4013,7 @@ bfin_gen_bundles (void)
       for (insn = BB_HEAD (bb);; insn = next)
        {
          int at_end;
-         rtx delete_this = NULL_RTX;
+         rtx_insn *delete_this = NULL;
 
          if (NONDEBUG_INSN_P (insn))
            {
@@ -4088,7 +4128,7 @@ reorder_var_tracking_notes (void)
 }
 \f
 /* On some silicon revisions, functions shorter than a certain number of cycles
-   can cause unpredictable behaviour.  Work around this by adding NOPs as
+   can cause unpredictable behavior.  Work around this by adding NOPs as
    needed.  */
 static void
 workaround_rts_anomaly (void)
@@ -4175,16 +4215,16 @@ workaround_rts_anomaly (void)
    SEQUENCEs.  */
 
 static enum attr_type
-type_for_anomaly (rtx insn)
+type_for_anomaly (rtx_insn *insn)
 {
   rtx pat = PATTERN (insn);
-  if (GET_CODE (pat) == SEQUENCE)
+  if (rtx_sequence *seq = dyn_cast <rtx_sequence *> (pat))
     {
       enum attr_type t;
-      t = get_attr_type (XVECEXP (pat, 0, 1));
+      t = get_attr_type (seq->insn (1));
       if (t == TYPE_MCLD)
        return t;
-      t = get_attr_type (XVECEXP (pat, 0, 2));
+      t = get_attr_type (seq->insn (2));
       if (t == TYPE_MCLD)
        return t;
       return TYPE_MCST;
@@ -4216,7 +4256,7 @@ harmless_null_pointer_p (rtx mem, int np_reg)
 /* Return nonzero if INSN contains any loads that may trap.  */
 
 static bool
-trapping_loads_p (rtx insn, int np_reg, bool after_np_branch)
+trapping_loads_p (rtx_insn *insn, int np_reg, bool after_np_branch)
 {
   rtx mem = SET_SRC (single_set (insn));
 
@@ -4228,23 +4268,23 @@ trapping_loads_p (rtx insn, int np_reg, bool after_np_branch)
 
 /* Return INSN if it is of TYPE_MCLD.  Alternatively, if INSN is the start of
    a three-insn bundle, see if one of them is a load and return that if so.
-   Return NULL_RTX if the insn does not contain loads.  */
-static rtx
-find_load (rtx insn)
+   Return NULL if the insn does not contain loads.  */
+static rtx_insn *
+find_load (rtx_insn *insn)
 {
   if (!NONDEBUG_INSN_P (insn))
-    return NULL_RTX;
+    return NULL;
   if (get_attr_type (insn) == TYPE_MCLD)
     return insn;
   if (GET_MODE (insn) != SImode)
-    return NULL_RTX;
+    return NULL;
   do {
     insn = NEXT_INSN (insn);
     if ((GET_MODE (insn) == SImode || GET_MODE (insn) == QImode)
        && get_attr_type (insn) == TYPE_MCLD)
       return insn;
   } while (GET_MODE (insn) != QImode);
-  return NULL_RTX;
+  return NULL;
 }
 
 /* Determine whether PAT is an indirect call pattern.  */
@@ -4285,8 +4325,8 @@ note_np_check_stores (rtx x, const_rtx pat ATTRIBUTE_UNUSED,
 static void
 workaround_speculation (void)
 {
-  rtx insn, next;
-  rtx last_condjump = NULL_RTX;
+  rtx_insn *insn, *next;
+  rtx_insn *last_condjump = NULL;
   int cycles_since_jump = INT_MAX;
   int delay_added = 0;
 
@@ -4358,7 +4398,7 @@ workaround_speculation (void)
        }
       else if (NONDEBUG_INSN_P (insn))
        {
-         rtx load_insn = find_load (insn);
+         rtx_insn *load_insn = find_load (insn);
          enum attr_type type = type_for_anomaly (insn);
 
          if (cycles_since_jump < INT_MAX)
@@ -4449,9 +4489,9 @@ workaround_speculation (void)
          && (INSN_CODE (insn) == CODE_FOR_cbranch_predicted_taken
              || cbranch_predicted_taken_p (insn)))
        {
-         rtx target = JUMP_LABEL (insn);
-         rtx label = target;
-         rtx next_tgt;
+         rtx_insn *target = JUMP_LABEL_AS_INSN (insn);
+         rtx_insn *label = target;
+         rtx_insn *next_tgt;
 
          cycles_since_jump = 0;
          for (; target && cycles_since_jump < 3; target = next_tgt)
@@ -4474,7 +4514,7 @@ workaround_speculation (void)
 
              if (NONDEBUG_INSN_P (target))
                {
-                 rtx load_insn = find_load (target);
+                 rtx_insn *load_insn = find_load (target);
                  enum attr_type type = type_for_anomaly (target);
                  int delay_needed = 0;
                  if (cycles_since_jump < INT_MAX)
@@ -4490,7 +4530,7 @@ workaround_speculation (void)
 
                  if (delay_needed > cycles_since_jump)
                    {
-                     rtx prev = prev_real_insn (label);
+                     rtx_insn *prev = prev_real_insn (label);
                      delay_needed -= cycles_since_jump;
                      if (dump_file)
                        fprintf (dump_file, "Adding %d nops after %d\n",
@@ -4556,7 +4596,7 @@ add_sched_insns_for_speculation (void)
          if (any_condjump_p (insn)
              && !cbranch_predicted_taken_p (insn))
            {
-             rtx n = next_real_insn (insn);
+             rtx_insn *n = next_real_insn (insn);
              emit_insn_before (gen_stall (GEN_INT (3)), n);
            }
        }
@@ -4570,8 +4610,8 @@ add_sched_insns_for_speculation (void)
          && any_condjump_p (insn)
          && (cbranch_predicted_taken_p (insn)))
        {
-         rtx target = JUMP_LABEL (insn);
-         rtx next = next_real_insn (target);
+         rtx_insn *target = JUMP_LABEL_AS_INSN (insn);
+         rtx_insn *next = next_real_insn (target);
 
          if (GET_CODE (PATTERN (next)) == UNSPEC_VOLATILE
              && get_attr_type (next) == TYPE_STALL)
@@ -4870,30 +4910,31 @@ bfin_handle_l2_attribute (tree *node, tree ARG_UNUSED (name),
 /* Table of valid machine attributes.  */
 static const struct attribute_spec bfin_attribute_table[] =
 {
-  /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
-       affects_type_identity } */
-  { "interrupt_handler", 0, 0, false, true,  true, handle_int_attribute,
-    false },
-  { "exception_handler", 0, 0, false, true,  true, handle_int_attribute,
-    false },
-  { "nmi_handler", 0, 0, false, true,  true, handle_int_attribute, false },
-  { "nesting", 0, 0, false, true,  true, NULL, false },
-  { "kspisusp", 0, 0, false, true,  true, NULL, false },
-  { "saveall", 0, 0, false, true,  true, NULL, false },
-  { "longcall",  0, 0, false, true,  true,  bfin_handle_longcall_attribute,
-    false },
-  { "shortcall", 0, 0, false, true,  true,  bfin_handle_longcall_attribute,
-    false },
-  { "l1_text", 0, 0, true, false, false,  bfin_handle_l1_text_attribute,
-    false },
-  { "l1_data", 0, 0, true, false, false,  bfin_handle_l1_data_attribute,
-    false },
-  { "l1_data_A", 0, 0, true, false, false, bfin_handle_l1_data_attribute,
-    false },
-  { "l1_data_B", 0, 0, true, false, false,  bfin_handle_l1_data_attribute,
-    false },
-  { "l2", 0, 0, true, false, false,  bfin_handle_l2_attribute, false },
-  { NULL, 0, 0, false, false, false, NULL, false }
+  /* { name, min_len, max_len, decl_req, type_req, fn_type_req,
+       affects_type_identity, handler, exclude } */
+  { "interrupt_handler", 0, 0, false, true,  true, false,
+    handle_int_attribute, NULL },
+  { "exception_handler", 0, 0, false, true,  true, false,
+    handle_int_attribute, NULL },
+  { "nmi_handler", 0, 0, false, true,  true, false, handle_int_attribute,
+    NULL },
+  { "nesting", 0, 0, false, true,  true, false, NULL, NULL },
+  { "kspisusp", 0, 0, false, true,  true, false, NULL, NULL },
+  { "saveall", 0, 0, false, true,  true, false, NULL, NULL },
+  { "longcall",  0, 0, false, true,  true, false,
+    bfin_handle_longcall_attribute, NULL },
+  { "shortcall", 0, 0, false, true,  true, false,
+    bfin_handle_longcall_attribute, NULL },
+  { "l1_text", 0, 0, true, false, false, false,
+    bfin_handle_l1_text_attribute, NULL },
+  { "l1_data", 0, 0, true, false, false, false,
+    bfin_handle_l1_data_attribute, NULL },
+  { "l1_data_A", 0, 0, true, false, false, false,
+    bfin_handle_l1_data_attribute, NULL },
+  { "l1_data_B", 0, 0, true, false, false, false,
+    bfin_handle_l1_data_attribute, NULL },
+  { "l2", 0, 0, true, false, false, false, bfin_handle_l2_attribute, NULL },
+  { NULL, 0, 0, false, false, false, false, NULL, NULL }
 };
 \f
 /* Implementation of TARGET_ASM_INTEGER.  When using FD-PIC, we need to
@@ -5331,7 +5372,7 @@ static const struct builtin_description bdesc_1arg[] =
    where we expect a vector.  To avoid crashing, use one of the vector
    clear instructions.  */
 static rtx
-safe_vector_operand (rtx x, enum machine_mode mode)
+safe_vector_operand (rtx x, machine_mode mode)
 {
   if (x != const0_rtx)
     return x;
@@ -5353,11 +5394,11 @@ bfin_expand_binop_builtin (enum insn_code icode, tree exp, rtx target,
   tree arg1 = CALL_EXPR_ARG (exp, 1);
   rtx op0 = expand_normal (arg0);
   rtx op1 = expand_normal (arg1);
-  enum machine_mode op0mode = GET_MODE (op0);
-  enum machine_mode op1mode = GET_MODE (op1);
-  enum machine_mode tmode = insn_data[icode].operand[0].mode;
-  enum machine_mode mode0 = insn_data[icode].operand[1].mode;
-  enum machine_mode mode1 = insn_data[icode].operand[2].mode;
+  machine_mode op0mode = GET_MODE (op0);
+  machine_mode op1mode = GET_MODE (op1);
+  machine_mode tmode = insn_data[icode].operand[0].mode;
+  machine_mode mode0 = insn_data[icode].operand[1].mode;
+  machine_mode mode1 = insn_data[icode].operand[2].mode;
 
   if (VECTOR_MODE_P (mode0))
     op0 = safe_vector_operand (op0, mode0);
@@ -5409,9 +5450,9 @@ bfin_expand_unop_builtin (enum insn_code icode, tree exp,
   rtx pat;
   tree arg0 = CALL_EXPR_ARG (exp, 0);
   rtx op0 = expand_normal (arg0);
-  enum machine_mode op0mode = GET_MODE (op0);
-  enum machine_mode tmode = insn_data[icode].operand[0].mode;
-  enum machine_mode mode0 = insn_data[icode].operand[1].mode;
+  machine_mode op0mode = GET_MODE (op0);
+  machine_mode tmode = insn_data[icode].operand[0].mode;
+  machine_mode mode0 = insn_data[icode].operand[1].mode;
 
   if (! target
       || GET_MODE (target) != tmode
@@ -5447,7 +5488,7 @@ bfin_expand_unop_builtin (enum insn_code icode, tree exp,
 static rtx
 bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
                     rtx subtarget ATTRIBUTE_UNUSED,
-                    enum machine_mode mode ATTRIBUTE_UNUSED,
+                    machine_mode mode ATTRIBUTE_UNUSED,
                     int ignore ATTRIBUTE_UNUSED)
 {
   size_t i;
@@ -5457,7 +5498,7 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
   unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
   tree arg0, arg1, arg2;
   rtx op0, op1, op2, accvec, pat, tmp1, tmp2, a0reg, a1reg;
-  enum machine_mode tmode, mode0;
+  machine_mode tmode, mode0;
 
   switch (fcode)
     {
@@ -5803,6 +5844,9 @@ bfin_conditional_register_usage (void)
 #undef TARGET_RETURN_IN_MEMORY
 #define TARGET_RETURN_IN_MEMORY bfin_return_in_memory
 
+#undef TARGET_LRA_P
+#define TARGET_LRA_P hook_bool_void_false
+
 #undef TARGET_LEGITIMATE_ADDRESS_P
 #define TARGET_LEGITIMATE_ADDRESS_P    bfin_legitimate_address_p
 
@@ -5836,4 +5880,15 @@ bfin_conditional_register_usage (void)
 #undef TARGET_CAN_USE_DOLOOP_P
 #define TARGET_CAN_USE_DOLOOP_P bfin_can_use_doloop_p
 
+#undef TARGET_HARD_REGNO_NREGS
+#define TARGET_HARD_REGNO_NREGS bfin_hard_regno_nregs
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK bfin_hard_regno_mode_ok
+
+#undef TARGET_MODES_TIEABLE_P
+#define TARGET_MODES_TIEABLE_P bfin_modes_tieable_p
+
+#undef TARGET_CONSTANT_ALIGNMENT
+#define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings
+
 struct gcc_target targetm = TARGET_INITIALIZER;