OSDN Git Service

2005-06-28 Andrew Pinski <pinskia@physics.uc.edu>
[pf3gnuchains/gcc-fork.git] / gcc / genextract.c
index ef53050..75ff6ce 100644 (file)
@@ -1,5 +1,6 @@
 /* Generate code from machine description to extract operands from insn as rtl.
-   Copyright (C) 1987, 1991, 1992, 1993, 1997, 1998, 1999, 2000, 2003
+   Copyright (C) 1987, 1991, 1992, 1993, 1997, 1998, 1999, 2000, 2003,
+   2004, 2005
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -16,8 +17,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"
@@ -129,7 +130,7 @@ gen_insn (rtx insn)
        walk_rtx (XVECEXP (insn, 1, i), path);
       }
 
-  link = (struct code_ptr *) xmalloc (sizeof (struct code_ptr));
+  link = xmalloc (sizeof (struct code_ptr));
   link->insn_code = insn_code_number;
 
   /* See if we find something that already had this extraction method.  */
@@ -164,7 +165,7 @@ gen_insn (rtx insn)
 
   /* Otherwise, make a new extraction method.  */
 
-  p = (struct extraction *) xmalloc (sizeof (struct extraction));
+  p = xmalloc (sizeof (struct extraction));
   p->op_count = op_count;
   p->dup_count = dup_count;
   p->next = extractions;
@@ -220,7 +221,7 @@ walk_rtx (rtx x, const char *path)
       dupnums[dup_count] = XINT (x, 0);
       dup_count++;
 
-      newpath = (char *) xmalloc (depth + 2);
+      newpath = xmalloc (depth + 2);
       strcpy (newpath, path);
       newpath[depth + 1] = 0;
 
@@ -236,7 +237,7 @@ walk_rtx (rtx x, const char *path)
       oplocs[XINT (x, 0)] = xstrdup (path);
       op_count = MAX (op_count, XINT (x, 0) + 1);
 
-      newpath = (char *) xmalloc (depth + 2);
+      newpath = xmalloc (depth + 2);
       strcpy (newpath, path);
       newpath[depth + 1] = 0;
 
@@ -252,7 +253,7 @@ walk_rtx (rtx x, const char *path)
       oplocs[XINT (x, 0)] = xstrdup (path);
       op_count = MAX (op_count, XINT (x, 0) + 1);
 
-      newpath = (char *) xmalloc (depth + 2);
+      newpath = xmalloc (depth + 2);
       strcpy (newpath, path);
       newpath[depth + 1] = 0;
 
@@ -272,7 +273,7 @@ walk_rtx (rtx x, const char *path)
       break;
     }
 
-  newpath = (char *) xmalloc (depth + 2);
+  newpath = xmalloc (depth + 2);
   strcpy (newpath, path);
   newpath[depth + 1] = 0;
 
@@ -326,7 +327,7 @@ print_path (const char *path)
       else if (ISDIGIT(path[i]))
        printf ("XEXP (");
       else
-       abort ();
+       gcc_unreachable ();
     }
 
   printf ("pat");
@@ -338,7 +339,7 @@ print_path (const char *path)
       else if (ISDIGIT(path[i]))
        printf (", %d)", path[i] - '0');
       else
-       abort ();
+       gcc_unreachable ();
     }
 }
 \f
@@ -354,9 +355,6 @@ main (int argc, char **argv)
 
   progname = "genextract";
 
-  if (argc <= 1)
-    fatal ("no input file name");
-
   if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
     return (FATAL_EXIT_CODE);
 
@@ -387,8 +385,10 @@ from the machine description file `md'.  */\n\n");
   printf ("  rtx **ro_loc = recog_data.operand_loc;\n");
   printf ("  rtx pat = PATTERN (insn);\n");
   printf ("  int i ATTRIBUTE_UNUSED;\n\n");
-  printf ("  memset (ro, 0, sizeof (*ro) * MAX_RECOG_OPERANDS);\n");
-  printf ("  memset (ro_loc, 0, sizeof (*ro_loc) * MAX_RECOG_OPERANDS);\n");
+#ifdef ENABLE_CHECKING
+  printf ("  memset (ro, 0xab, sizeof (*ro) * MAX_RECOG_OPERANDS);\n");
+  printf ("  memset (ro_loc, 0xab, sizeof (*ro_loc) * MAX_RECOG_OPERANDS);\n");
+#endif
   printf ("  switch (INSN_CODE (insn))\n");
   printf ("    {\n");
   printf ("    case -1:\n");
@@ -412,8 +412,7 @@ from the machine description file `md'.  */\n\n");
 
       else if (GET_CODE (desc) == DEFINE_PEEPHOLE)
        {
-         struct code_ptr *link
-           = (struct code_ptr *) xmalloc (sizeof (struct code_ptr));
+         struct code_ptr *link = xmalloc (sizeof (struct code_ptr));
 
          link->insn_code = insn_code_number;
          link->next = peepholes;
@@ -477,10 +476,10 @@ from the machine description file `md'.  */\n\n");
       printf ("      break;\n\n");
     }
 
-  /* This should never be reached.  Note that we would also reach this abort
-   if we tried to extract something whose INSN_CODE was a DEFINE_EXPAND or
-   DEFINE_SPLIT, but that is correct.  */
-  printf ("    default:\n      abort ();\n");
+  /* This should never be reached.  Note that we would also reach here
+     if we tried to extract something whose INSN_CODE was a
+     DEFINE_EXPAND or DEFINE_SPLIT, but that is correct.  */
+  printf ("    default:\n      gcc_unreachable ();\n");
 
   printf ("    }\n}\n");
 
@@ -509,8 +508,7 @@ record_insn_name (int code, const char *name)
     {
       int new_size;
       new_size = (insn_name_ptr_size ? insn_name_ptr_size * 2 : 512);
-      insn_name_ptr =
-       (char **) xrealloc (insn_name_ptr, sizeof(char *) * new_size);
+      insn_name_ptr = xrealloc (insn_name_ptr, sizeof(char *) * new_size);
       memset (insn_name_ptr + insn_name_ptr_size, 0,
              sizeof(char *) * (new_size - insn_name_ptr_size));
       insn_name_ptr_size = new_size;