diff gcc/config/score/score7.c @ 67:f6334be47118

update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Mar 2011 17:18:12 +0900
parents b7f97abdc517
children
line wrap: on
line diff
--- a/gcc/config/score/score7.c	Tue May 25 18:58:51 2010 +0900
+++ b/gcc/config/score/score7.c	Tue Mar 22 17:18:12 2011 +0900
@@ -1,5 +1,5 @@
 /* score7.c for Sunplus S+CORE processor
-   Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    Contributed by Sunnorth
 
    This file is part of GCC.
@@ -29,7 +29,7 @@
 #include "conditions.h"
 #include "insn-attr.h"
 #include "recog.h"
-#include "toplev.h"
+#include "diagnostic-core.h"
 #include "output.h"
 #include "tree.h"
 #include "function.h"
@@ -289,7 +289,7 @@
 }
 
 bool
-score7_return_in_memory (tree type, tree fndecl ATTRIBUTE_UNUSED)
+score7_return_in_memory (const_tree type, const_tree fndecl ATTRIBUTE_UNUSED)
 {
     return ((TYPE_MODE (type) == BLKmode)
             || (int_size_in_bytes (type) > 2 * UNITS_PER_WORD)
@@ -340,7 +340,7 @@
   if (delta != 0)
     {
       rtx offset = GEN_INT (delta);
-      if (!CONST_OK_FOR_LETTER_P (delta, 'L'))
+      if (!(delta >= -32768 && delta <= 32767))
         {
           emit_move_insn (temp1, offset);
           offset = temp1;
@@ -438,7 +438,7 @@
    is a named (fixed) argument rather than a variable one.  */
 static void
 score7_classify_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode,
-                     tree type, int named, struct score7_arg_info *info)
+                     const_tree type, bool named, struct score7_arg_info *info)
 {
   int even_reg_p;
   unsigned int num_words, max_regs;
@@ -574,7 +574,7 @@
 
 /* Implement TARGET_IN_SMALL_DATA_P.  */
 bool
-score7_in_small_data_p (tree decl)
+score7_in_small_data_p (const_tree decl)
 {
   HOST_WIDE_INT size;
 
@@ -633,34 +633,13 @@
     }
 }
 
-/* Implement OVERRIDE_OPTIONS macro.  */
+/* Implement TARGET_OPTION_OVERRIDE hook.  */
 void
-score7_override_options (void)
+score7_option_override (void)
 {
   flag_pic = false;
-  if (!flag_pic)
-    score7_sdata_max = g_switch_set ? g_switch_value : SCORE7_DEFAULT_SDATA_MAX;
-  else
-    {
-      score7_sdata_max = 0;
-      if (g_switch_set && (g_switch_value != 0))
-        warning (0, "-fPIC and -G are incompatible");
-    }
+  score7_sdata_max = SCORE7_DEFAULT_SDATA_MAX;
 
-  score_char_to_class['d'] = G32_REGS;
-  score_char_to_class['e'] = G16_REGS;
-  score_char_to_class['t'] = T32_REGS;
-
-  score_char_to_class['h'] = HI_REG;
-  score_char_to_class['l'] = LO_REG;
-  score_char_to_class['x'] = CE_REGS;
-
-  score_char_to_class['q'] = CN_REG;
-  score_char_to_class['y'] = LC_REG;
-  score_char_to_class['z'] = SC_REG;
-  score_char_to_class['a'] = SP_REGS;
-
-  score_char_to_class['c'] = CR_REGS;
 }
 
 /* Implement REGNO_REG_CLASS macro.  */
@@ -708,42 +687,6 @@
   return NO_REGS;
 }
 
-/* Implement CONST_OK_FOR_LETTER_P macro.  */
-/* imm constraints
-   I        imm16 << 16
-   J        uimm5
-   K        uimm16
-   L        simm16
-   M        uimm14
-   N        simm14  */
-int
-score7_const_ok_for_letter_p (HOST_WIDE_INT value, char c)
-{
-  switch (c)
-    {
-    case 'I': return ((value & 0xffff) == 0);
-    case 'J': return IMM_IN_RANGE (value, 5, 0);
-    case 'K': return IMM_IN_RANGE (value, 16, 0);
-    case 'L': return IMM_IN_RANGE (value, 16, 1);
-    case 'M': return IMM_IN_RANGE (value, 14, 0);
-    case 'N': return IMM_IN_RANGE (value, 14, 1);
-    default : return 0;
-    }
-}
-
-/* Implement EXTRA_CONSTRAINT macro.  */
-/* Z        symbol_ref  */
-int
-score7_extra_constraint (rtx op, char c)
-{
-  switch (c)
-    {
-    case 'Z':
-      return GET_CODE (op) == SYMBOL_REF;
-    default:
-      gcc_unreachable ();
-    }
-}
 
 /* Return truth value on whether or not a given hard register
    can support a given mode.  */
@@ -788,10 +731,10 @@
     }
 }
 
-/* Implement FUNCTION_ARG_ADVANCE macro.  */
+/* Implement TARGET_FUNCTION_ARG_ADVANCE hook.  */
 void
 score7_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
-                             tree type, int named)
+                             const_tree type, bool named)
 {
   struct score7_arg_info info;
   score7_classify_arg (cum, mode, type, named, &info);
@@ -811,10 +754,10 @@
   return info.stack_words > 0 ? info.reg_words * UNITS_PER_WORD : 0;
 }
 
-/* Implement FUNCTION_ARG macro.  */
+/* Implement TARGET_FUNCTION_ARG hook.  */
 rtx
 score7_function_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode,
-                     tree type, int named)
+                     const_tree type, bool named)
 {
   struct score7_arg_info info;
 
@@ -848,7 +791,8 @@
    VALTYPE is the return type and MODE is VOIDmode.  For libcalls,
    VALTYPE is null and MODE is the mode of the return value.  */
 rtx
-score7_function_value (tree valtype, tree func, enum machine_mode mode)
+score7_function_value (const_tree valtype, const_tree func,
+		       enum machine_mode mode)
 {
   if (valtype)
     {
@@ -881,7 +825,6 @@
 void
 score7_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
 {
-#define FFCACHE          "_flush_cache"
 #define CODE_SIZE        (TRAMPOLINE_INSNS * UNITS_PER_WORD)
 
   rtx fnaddr = XEXP (DECL_RTL (fndecl), 0);
@@ -896,11 +839,6 @@
   mem = adjust_address (m_tramp, SImode, CODE_SIZE + GET_MODE_SIZE (SImode));
   emit_move_insn (mem, chain_value);
 
-  emit_library_call (gen_rtx_SYMBOL_REF (Pmode, FFCACHE),
-                     0, VOIDmode, 2,
-                     addr, Pmode,
-                     GEN_INT (TRAMPOLINE_SIZE), SImode);
-#undef FFCACHE
 #undef CODE_SIZE
 }
 
@@ -1015,28 +953,28 @@
     case CONST_INT:
       if (outer_code == SET)
         {
-          if (CONST_OK_FOR_LETTER_P (INTVAL (x), 'I')
-              || CONST_OK_FOR_LETTER_P (INTVAL (x), 'L'))
+          if (((INTVAL (x) & 0xffff) == 0) 
+              || (INTVAL (x) >= -32768 && INTVAL (x) <= 32767))
             *total = COSTS_N_INSNS (1);
           else
             *total = COSTS_N_INSNS (2);
         }
       else if (outer_code == PLUS || outer_code == MINUS)
         {
-          if (CONST_OK_FOR_LETTER_P (INTVAL (x), 'N'))
+          if (INTVAL (x) >= -8192 && INTVAL (x) <= 8191)
             *total = 0;
-          else if (CONST_OK_FOR_LETTER_P (INTVAL (x), 'I')
-                   || CONST_OK_FOR_LETTER_P (INTVAL (x), 'L'))
+          else if (((INTVAL (x) & 0xffff) == 0)
+                   || (INTVAL (x) >= -32768 && INTVAL (x) <= 32767))
             *total = 1;
           else
             *total = COSTS_N_INSNS (2);
         }
       else if (outer_code == AND || outer_code == IOR)
         {
-          if (CONST_OK_FOR_LETTER_P (INTVAL (x), 'M'))
+          if (INTVAL (x) >= 0 && INTVAL (x) <= 16383)
             *total = 0;
-          else if (CONST_OK_FOR_LETTER_P (INTVAL (x), 'I')
-                   || CONST_OK_FOR_LETTER_P (INTVAL (x), 'K'))
+          else if (((INTVAL (x) & 0xffff) == 0)
+                   || (INTVAL (x) >= 0 && INTVAL (x) <= 65535))
             *total = 1;
           else
             *total = COSTS_N_INSNS (2);
@@ -1174,7 +1112,7 @@
 
   if (score7_in_small_data_p (decl))
     {
-      p = (struct extern_list *) ggc_alloc (sizeof (struct extern_list));
+      p = ggc_alloc_extern_list ();
       p->next = extern_head;
       p->name = name;
       p->size = int_size_in_bytes (TREE_TYPE (decl));
@@ -1209,7 +1147,7 @@
 void
 score7_print_operand (FILE *file, rtx op, int c)
 {
-  enum rtx_code code = -1;
+  enum rtx_code code = UNKNOWN;
   if (!PRINT_OPERAND_PUNCT_VALID_P (c))
     code = GET_CODE (op);
 
@@ -1453,7 +1391,7 @@
     {
       rtx insn;
 
-      if (CONST_OK_FOR_LETTER_P (-size, 'L'))
+      if (size >= -32768 && size <= 32767)
         EMIT_PL (emit_insn (gen_add3_insn (stack_pointer_rtx,
                                            stack_pointer_rtx,
                                            GEN_INT (-size))));
@@ -1508,7 +1446,7 @@
 
   if (size)
     {
-      if (CONST_OK_FOR_LETTER_P (size, 'L'))
+      if (size >= -32768 && size <= 32767)
         emit_insn (gen_add3_insn (base, base, GEN_INT (size)));
       else
         {
@@ -1711,7 +1649,7 @@
         {
           HOST_WIDE_INT offset = INTVAL (ai.offset);
           if (SCORE_ALIGN_UNIT (offset, unit)
-              && CONST_OK_FOR_LETTER_P (offset >> unit, 'J'))
+              && (((offset >> unit) >= 0) && ((offset >> unit) <= 31)))
             {
               ops[iaddr] = ai.offset;
               return snprintf (ip, INS_BUF_SZ,