OSDN Git Service

* g++.dg/other/debug1.C: Fix typos.
[pf3gnuchains/gcc-fork.git] / gcc / genextract.c
index fea0492..80602d7 100644 (file)
@@ -2,37 +2,31 @@
    Copyright (C) 1987, 1991, 1992, 1993, 1997, 1998,
    1999, 2000 Free Software Foundation, Inc.
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC 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 version.
+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
+version.
 
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+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 GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+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.  */
 
 
 #include "hconfig.h"
 #include "system.h"
 #include "rtl.h"
-#include "obstack.h"
 #include "errors.h"
 #include "insn-config.h"
 #include "gensupport.h"
 
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
 
 /* This structure contains all the information needed to describe one
    set of extractions methods.  Each method may be used by more than 
@@ -108,9 +102,9 @@ static void
 gen_insn (insn)
      rtx insn;
 {
-  register int i;
-  register struct extraction *p;
-  register struct code_ptr *link;
+  int i;
+  struct extraction *p;
+  struct code_ptr *link;
 
   op_count = 0;
   dup_count = 0;
@@ -126,7 +120,7 @@ gen_insn (insn)
   else
     for (i = XVECLEN (insn, 1) - 1; i >= 0; i--)
       {
-       char *path = (char *) alloca (2);
+       char path[2];
 
        path[0] = 'a' + i;
        path[1] = 0;
@@ -189,10 +183,10 @@ walk_rtx (x, path)
      rtx x;
      const char *path;
 {
-  register RTX_CODE code;
-  register int i;
-  register int len;
-  register const char *fmt;
+  RTX_CODE code;
+  int i;
+  int len;
+  const char *fmt;
   int depth = strlen (path);
   char *newpath;
 
@@ -227,7 +221,7 @@ walk_rtx (x, path)
       dupnums[dup_count] = XINT (x, 0);
       dup_count++;
       
-      newpath = (char *) alloca (depth + 2);
+      newpath = (char *) xmalloc (depth + 2);
       strcpy (newpath, path);
       newpath[depth + 1] = 0;
       
@@ -236,13 +230,14 @@ walk_rtx (x, path)
          newpath[depth] = '0' + i;
          walk_rtx (XVECEXP (x, 1, i), newpath);
         }
+      free (newpath);
       return;
       
     case MATCH_OPERATOR:
       oplocs[XINT (x, 0)] = xstrdup (path);
       op_count = MAX (op_count, XINT (x, 0) + 1);
 
-      newpath = (char *) alloca (depth + 2);
+      newpath = (char *) xmalloc (depth + 2);
       strcpy (newpath, path);
       newpath[depth + 1] = 0;
 
@@ -251,13 +246,14 @@ walk_rtx (x, path)
          newpath[depth] = '0' + i;
          walk_rtx (XVECEXP (x, 2, i), newpath);
        }
+      free (newpath);
       return;
 
     case MATCH_PARALLEL:
       oplocs[XINT (x, 0)] = xstrdup (path);
       op_count = MAX (op_count, XINT (x, 0) + 1);
 
-      newpath = (char *) alloca (depth + 2);
+      newpath = (char *) xmalloc (depth + 2);
       strcpy (newpath, path);
       newpath[depth + 1] = 0;
 
@@ -266,6 +262,7 @@ walk_rtx (x, path)
          newpath[depth] = 'a' + i;
          walk_rtx (XVECEXP (x, 2, i), newpath);
        }
+      free (newpath);
       return;
 
     case ADDRESS:
@@ -276,7 +273,7 @@ walk_rtx (x, path)
       break;
     }
 
-  newpath = (char *) alloca (depth + 2);
+  newpath = (char *) xmalloc (depth + 2);
   strcpy (newpath, path);
   newpath[depth + 1] = 0;
 
@@ -299,6 +296,7 @@ walk_rtx (x, path)
            }
        }
     }
+  free (newpath);
 }
 
 /* Given a PATH, representing a path down the instruction's
@@ -309,8 +307,8 @@ static void
 print_path (path)
      const char *path;
 {
-  register int len = strlen (path);
-  register int i;
+  int len = strlen (path);
+  int i;
 
   if (len == 0)
     {
@@ -346,42 +344,6 @@ print_path (path)
     }
 }
 \f
-PTR
-xmalloc (size)
-  size_t size;
-{
-  register PTR val = (PTR) malloc (size);
-
-  if (val == 0)
-    fatal ("virtual memory exhausted");
-  return val;
-}
-
-PTR
-xrealloc (old, size)
-  PTR old;
-  size_t size;
-{
-  register PTR ptr;
-  if (old)
-    ptr = (PTR) realloc (old, size);
-  else
-    ptr = (PTR) malloc (size);
-  if (!ptr)
-    fatal ("virtual memory exhausted");
-  return ptr;
-}
-
-char *
-xstrdup (input)
-  const char *input;
-{
-  register size_t len = strlen (input) + 1;
-  register char *output = xmalloc (len);
-  memcpy (output, input, len);
-  return output;
-}
-\f
 extern int main PARAMS ((int, char **));
 
 int
@@ -396,7 +358,6 @@ main (argc, argv)
   const char *name;
 
   progname = "genextract";
-  obstack_init (rtl_obstack);
 
   if (argc <= 1)
     fatal ("No input file name.");
@@ -426,8 +387,8 @@ from the machine description file `md'.  */\n\n");
   printf ("void\ninsn_extract (insn)\n");
   printf ("     rtx insn;\n");
   printf ("{\n");
-  printf ("  register rtx *ro = recog_data.operand;\n");
-  printf ("  register rtx **ro_loc = recog_data.operand_loc;\n");
+  printf ("  rtx *ro = recog_data.operand;\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");