gengenrtl.c (gencode): Emit new function obstack_alloc_rtx to allocate rtx.
authorJohn Carr <jfc@mit.edu>
Tue, 13 Jan 1998 09:06:31 +0000 (09:06 +0000)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 13 Jan 1998 09:06:31 +0000 (01:06 -0800)
* gengenrtl.c (gencode): Emit new function obstack_alloc_rtx
to allocate rtx.
(gendef): Call obstack_alloc_rtx.

From-SVN: r17327

gcc/ChangeLog
gcc/gengenrtl.c

index 4bf713343847f5852f89a42a9de4c19af0825a25..eac46089b9c629b82985d52db4f3a69263c501c7 100644 (file)
@@ -1,3 +1,9 @@
+Tue Jan 13 09:07:44 1998  John Carr  <jfc@mit.edu>
+
+       * gengenrtl.c (gencode): Emit new function obstack_alloc_rtx
+       to allocate rtx.
+       (gendef): Call obstack_alloc_rtx.
+
 Tue Jan 13 01:16:36 1998   Robert Lipe (robertl@dgii.com)
 
        * configure.in: (i[3456]86-UnixWare7-sysv5): Treat much like SVR4
index 977305d9a826150733c4d10604f55a9137e46eab..b929f67e3075c39642ea33514178849fe4c8417f 100644 (file)
@@ -184,16 +184,8 @@ gendef (f, format)
 
   /* See rtx_alloc in rtl.c for comments.  */
   fprintf (f, "{\n");
-  fprintf (f, "  register int length = sizeof (struct rtx_def)");
-  fprintf (f, " + %d * sizeof (rtunion);\n", strlen (format) - 1);
-  fprintf (f, "  rtx rt = (rtx)obstack_alloc (rtl_obstack, length);\n");
-
-  fprintf (f, "  if (sizeof(struct rtx_def) - sizeof(rtunion) == sizeof(int))\n");
-  fprintf (f, "    *(int *)rt = 0;\n");
-  fprintf (f, "  else if (sizeof(struct rtx_def) - sizeof(rtunion) == sizeof(HOST_WIDE_INT))\n");
-  fprintf (f, "    *(HOST_WIDE_INT *)rt = 0;\n");
-  fprintf (f, "  else\n");
-  fprintf (f, "    bzero(rt, sizeof(struct rtx_def) - sizeof(rtunion));\n\n");
+  fprintf (f, "  rtx rt = obstack_alloc_rtx (sizeof (struct rtx_def) + %d * sizeof (rtunion));\n",
+          (int) strlen (format) - 1);
 
   fprintf (f, "  PUT_CODE (rt, code);\n");
   fprintf (f, "  PUT_MODE (rt, mode);\n");
@@ -242,10 +234,21 @@ gencode (f)
 {
   const char **fmt;
 
-  fprintf(f, "#include \"config.h\"\n");
-  fprintf(f, "#include \"obstack.h\"\n");
-  fprintf(f, "#include \"rtl.h\"\n\n");
-  fprintf(f, "extern struct obstack *rtl_obstack;\n\n");
+  fputs ("#include \"config.h\"\n", f);
+  fputs ("#include \"obstack.h\"\n", f);
+  fputs ("#include \"rtl.h\"\n\n", f);
+  fputs ("extern struct obstack *rtl_obstack;\n\n", f);
+  fputs ("static rtx obstack_alloc_rtx PROTO((int length));\n", f);
+  fputs ("static rtx obstack_alloc_rtx (length)\n", f);
+  fputs ("     register int length;\n{\n", f);
+  fputs ("  rtx rt = (rtx) obstack_alloc (rtl_obstack, length);\n\n", f);
+  fputs ("  if (sizeof(struct rtx_def) - sizeof(rtunion) == sizeof(int))\n", f);
+  fputs ("    *(int *)rt = 0;\n", f);
+  fputs ("  else if (sizeof(struct rtx_def) - sizeof(rtunion) == sizeof(HOST_WIDE_INT))\n", f);
+  fputs ("    *(HOST_WIDE_INT *)rt = 0;\n", f);
+  fputs ("  else\n", f);
+  fputs ("    bzero(rt, sizeof(struct rtx_def) - sizeof(rtunion));\n\n", f);
+  fputs ("  return rt;\n}\n\n", f);
 
   for (fmt = formats; *fmt; ++fmt)
     gendef (f, *fmt);