OSDN Git Service

PR middle-end/24998
[pf3gnuchains/gcc-fork.git] / gcc / genmodes.c
index fc5dc9b..142dde4 100644 (file)
@@ -1,5 +1,5 @@
 /* Generate the machine mode enumeration and associated tables.
-   Copyright (C) 2003
+   Copyright (C) 2003, 2004
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -16,8 +16,8 @@ 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.  */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
 
 #include "bconfig.h"
 #include "system.h"
@@ -64,6 +64,7 @@ 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.  */
@@ -80,7 +81,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
 };
 
@@ -364,7 +365,7 @@ complete_mode (struct mode_data *m)
       break;
 
     default:
-      abort ();
+      gcc_unreachable ();
     }
 
   /* If not already specified, the mode alignment defaults to the largest
@@ -619,7 +620,7 @@ make_vector_mode (enum mode_class bclass,
                        ncomponents, base) >= sizeof namebuf)
     {
       error ("%s:%d: mode name \"%s\" is too long",
-            base, file, line);
+            file, line, base);
       return;
     }
 
@@ -717,6 +718,7 @@ 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;
@@ -951,6 +953,39 @@ emit_mode_wider (void)
                   m->name);
 
   print_closer ();
+  print_decl ("unsigned char", "mode_2xwider", "NUM_MACHINE_MODES");
+
+  for_all_modes (c, m)
+    {
+      struct mode_data * m2;
+
+      for (m2 = m;
+          m2 && m2 != void_mode;
+          m2 = m2->wider)
+       {
+         if (m2->bytesize < 2 * m->bytesize)
+           continue;
+         if (m->precision != (unsigned int) -1)
+           {
+             if (m2->precision != 2 * m->precision)
+               continue;
+           }
+         else
+           {
+             if (m2->precision != (unsigned int) -1)
+               continue;
+           }
+
+         break;
+       }
+      if (m2 == void_mode)
+       m2 = 0;
+      tagged_printf ("%smode",
+                    m2 ? m2->name : void_mode->name,
+                    m->name);
+    }
+
+  print_closer ();
 }
 
 static void