Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / config / score / score.c
index 28a0265..c25aaa2 100644 (file)
@@ -1,6 +1,5 @@
 /* Output routines for Sunplus S+CORE processor
-   Copyright (C) 2005, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright (C) 2005-2013 Free Software Foundation, Inc.
    Contributed by Sunnorth.
 
    This file is part of GCC.
@@ -45,9 +44,7 @@
 #include "debug.h"
 #include "target.h"
 #include "target-def.h"
-#include "integrate.h"
 #include "langhooks.h"
-#include "cfglayout.h"
 #include "df.h"
 #include "opts.h"
 
@@ -122,9 +119,6 @@ struct extern_list *extern_head = 0;
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE          score_option_override
 
-#undef TARGET_LEGITIMIZE_ADDRESS
-#define TARGET_LEGITIMIZE_ADDRESS      score_legitimize_address
-
 #undef  TARGET_SCHED_ISSUE_RATE
 #define TARGET_SCHED_ISSUE_RATE         score_issue_rate
 
@@ -314,7 +308,7 @@ score_compute_frame_size (HOST_WIDE_INT size)
   f->var_size = SCORE_STACK_ALIGN (size);
   f->args_size = crtl->outgoing_args_size;
   f->cprestore_size = flag_pic ? UNITS_PER_WORD : 0;
-  if (f->var_size == 0 && current_function_is_leaf)
+  if (f->var_size == 0 && crtl->is_leaf)
     f->args_size = f->cprestore_size = 0;
 
   if (f->args_size == 0 && cfun->calls_alloca)
@@ -444,7 +438,7 @@ score_add_offset (rtx reg, HOST_WIDE_INT offset)
       offset &= 0x3fff;
     }
 
-  return plus_constant (reg, offset);
+  return plus_constant (GET_MODE (reg), reg, offset);
 }
 
 /* Implement TARGET_ASM_OUTPUT_MI_THUNK.  Generate rtl rather than asm text
@@ -507,7 +501,6 @@ score_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
   /* Run just enough of rest_of_compilation.  This sequence was
      "borrowed" from alpha.c.  */
   insn = get_insns ();
-  insn_locators_alloc ();
   split_all_insns_noflow ();
   shorten_branches (insn);
   final_start_function (insn, file, 1);
@@ -543,30 +536,6 @@ score_split_symbol (rtx temp, rtx addr)
   return gen_rtx_LO_SUM (Pmode, high, addr);
 }
 
-/* This function is used to implement LEGITIMIZE_ADDRESS.  If X can
-   be legitimized in a way that the generic machinery might not expect,
-   return the new address.  */
-static rtx
-score_legitimize_address (rtx x)
-{
-  enum score_symbol_type symbol_type;
-
-  if (score_symbolic_constant_p (x, &symbol_type)
-      && symbol_type == SYMBOL_GENERAL)
-    return score_split_symbol (0, x);
-
-  if (GET_CODE (x) == PLUS
-      && GET_CODE (XEXP (x, 1)) == CONST_INT)
-    {
-      rtx reg = XEXP (x, 0);
-      if (!score_valid_base_register_p (reg, 0))
-        reg = copy_to_mode_reg (Pmode, reg);
-      return score_add_offset (reg, INTVAL (XEXP (x, 1)));
-    }
-
-  return x;
-}
-
 /* Fill INFO with information about a single argument.  CUM is the
    cumulative state for earlier arguments.  MODE is the mode of this
    argument and TYPE is its type (if known).  NAMED is true if this
@@ -645,7 +614,7 @@ score_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
                 ? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM]),
                tsize,
                reg_names[RA_REGNUM],
-               current_function_is_leaf ? 1 : 0,
+               crtl->is_leaf ? 1 : 0,
                f->var_size,
                f->num_gp,
                f->args_size,
@@ -1234,7 +1203,8 @@ score_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
 
 /* Implement TARGET_ADDRESS_COST macro.  */
 int
-score_address_cost (rtx addr,
+score_address_cost (rtx addr, enum machine_mode mode ATTRIBUTE_UNUSED,
+                   addr_space_t as ATTRIBUTE_UNUSED,
                    bool speed ATTRIBUTE_UNUSED)
 {
   return score_address_insns (addr, SImode);
@@ -1546,8 +1516,8 @@ score_prologue (void)
       REG_NOTES (insn) =
         alloc_EXPR_LIST (REG_FRAME_RELATED_EXPR,
                          gen_rtx_SET (VOIDmode, stack_pointer_rtx,
-                                      plus_constant (stack_pointer_rtx,
-                                                     -size)),
+                                      plus_constant (Pmode, stack_pointer_rtx,
+                                                    -size)),
                                       REG_NOTES (insn));
     }