OSDN Git Service

PR rtl-optimization/53908
[pf3gnuchains/gcc-fork.git] / gcc / genmodes.c
index 0a2e6f3..8b6f5bc 100644 (file)
@@ -1,12 +1,12 @@
 /* Generate the machine mode enumeration and associated tables.
-   Copyright (C) 2003, 2004, 2005, 2006, 2007
+   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010
    Free Software Foundation, Inc.
 
 This file is part of GCC.
 
 GCC is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
+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 ANY
@@ -15,9 +15,8 @@ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 for more details.
 
 You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.  */
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
 
 #include "bconfig.h"
 #include "system.h"
@@ -64,7 +63,6 @@ struct mode_data
 
   struct mode_data *component; /* mode of components */
   struct mode_data *wider;     /* next wider mode */
-  struct mode_data *wider_2x;  /* 2x wider mode */
 
   struct mode_data *contained;  /* Pointer to list of modes that have
                                   this mode as a component.  */
@@ -84,7 +82,7 @@ static struct mode_data *void_mode;
 static const struct mode_data blank_mode = {
   0, "<unknown>", MAX_MODE_CLASS,
   -1U, -1U, -1U, -1U,
-  0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0,
   "<unknown>", 0, 0, 0, 0
 };
 
@@ -180,7 +178,7 @@ new_mode (enum mode_class cl, const char *name,
   n_modes[cl]++;
 
   *htab_find_slot (modes_by_name, m, INSERT) = m;
-  
+
   return m;
 }
 
@@ -231,7 +229,7 @@ new_adjust (const char *name,
             mode_class_names[required_class_to] + 5);
       return;
     }
-  
+
   for (a = *category; a; a = a->next)
     if (a->mode == mode)
       {
@@ -740,8 +738,8 @@ create_modes (void)
 static int
 cmp_modes (const void *a, const void *b)
 {
-  struct mode_data *m = *(struct mode_data **)a;
-  struct mode_data *n = *(struct mode_data **)b;
+  const struct mode_data *const m = *(const struct mode_data *const*)a;
+  const struct mode_data *const n = *(const struct mode_data *const*)b;
 
   if (m->bytesize > n->bytesize)
     return 1;
@@ -791,7 +789,7 @@ calc_wider_mode (void)
 
   /* Allocate max_n_modes + 1 entries to leave room for the extra null
      pointer assigned after the qsort call below.  */
-  sortbuf = (struct mode_data **) alloca ((max_n_modes + 1) * sizeof (struct mode_data *));
+  sortbuf = XALLOCAVEC (struct mode_data *, max_n_modes + 1);
 
   for (c = 0; c < MAX_MODE_CLASS; c++)
     {
@@ -805,7 +803,6 @@ calc_wider_mode (void)
          for (prev = 0, m = modes[c]; m; m = next)
            {
              m->wider = void_mode;
-             m->wider_2x = void_mode;
 
              /* this is nreverse */
              next = m->next;
@@ -828,7 +825,6 @@ calc_wider_mode (void)
          for (j = 0; j < i; j++)
            sortbuf[j]->next = sortbuf[j]->wider = sortbuf[j + 1];
 
-
          modes[c] = sortbuf[0];
        }
     }
@@ -1063,6 +1059,21 @@ emit_mode_wider (void)
                continue;
            }
 
+         /* For vectors we want twice the number of components,
+            with the same element type.  */
+         if (m->cl == MODE_VECTOR_INT
+             || m->cl == MODE_VECTOR_FLOAT
+             || m->cl == MODE_VECTOR_FRACT
+             || m->cl == MODE_VECTOR_UFRACT
+             || m->cl == MODE_VECTOR_ACCUM
+             || m->cl == MODE_VECTOR_UACCUM)
+           {
+             if (m2->ncomponents != 2 * m->ncomponents)
+               continue;
+             if (m->component != m2->component)
+               continue;
+           }
+
          break;
        }
       if (m2 == void_mode)
@@ -1148,7 +1159,7 @@ emit_class_narrowest_mode (void)
                         ? modes[c]->next->name
                         : void_mode->name))
                   : void_mode->name);
-  
+
   print_closer ();
 }
 
@@ -1161,7 +1172,7 @@ emit_real_format_for_mode (void)
      or not the table itself is constant.
 
      For backward compatibility this table is always writable
-     (several targets modify it in OVERRIDE_OPTIONS).   FIXME:
+     (several targets modify it in TARGET_OPTION_OVERRIDE).   FIXME:
      convert all said targets to use ADJUST_FORMAT instead.  */
 #if 0
   print_maybe_const_decl ("const struct real_format *%s",
@@ -1296,7 +1307,7 @@ emit_mode_adjustments (void)
              a->file, a->line, a->adjustment);
       printf ("  mode_fbit[%smode] = s;\n", a->mode->name);
     }
-      
+
   /* Real mode formats don't have to propagate anywhere.  */
   for (a = adj_format; a; a = a->next)
     printf ("\n  /* %s:%d */\n  REAL_MODE_FORMAT (%smode) = %s;\n",
@@ -1398,7 +1409,7 @@ main (int argc, char **argv)
 
   if (have_error)
     return FATAL_EXIT_CODE;
-  
+
   calc_wider_mode ();
 
   if (gen_header)