From f8a83ee3a90a5da4bbb83dd424e54028b033efb7 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Fri, 9 Jun 2000 21:47:40 +0000 Subject: ggc-none.c, [...] (ggc_alloc_obj): Rename it ggc_alloc, drop second argument, never clear returned memory. toplevel: * ggc-none.c, ggc-simple.c, ggc-page.c (ggc_alloc_obj): Rename it ggc_alloc, drop second argument, never clear returned memory. * ggc-common.c (ggc_alloc_string): Use ggc_alloc. (ggc_alloc_cleared): New. * ggc.h: Prototype ggc_alloc and ggc_alloc_cleared, not ggc_alloc_obj. Remove ggc_alloc macro. (ggc_alloc_rtx, ggc_alloc_rtvec, ggc_alloc_tree): Use ggc_alloc. * rtl.c (rtvec_alloc): Clear the vector always. (rtx_alloc): Clear the first word always. Remove dirty obstack tricks (this routine is no longer a bottleneck). * tree.c (make_node): Clear the new node always. (make_tree_vec): Likewise. (tree_cons): Clear the common structure always. (build1): Likewise; also, clear TREE_COMPLEXITY. * gengenrtl.c: Use puts wherever possible. Remove extra newlines. (gendef): Clear the first word of an RTX in the generator function, irrespective of ggc_p. Initialize '0' slots to NULL. (genlegend): Don't generate obstack_alloc_rtx routine, just a thin wrapper macro around obstack_alloc. * stmt.c (expand_fixup): Use ggc_alloc. * c-typeck.c (add_pending_init): Use ggc_alloc. * emit-rtl.c (init_emit_once): Clear CONST_DOUBLE_CHAIN(tem). * varasm.c (immed_double_const): Set CONST_DOUBLE_MEM(r) to const0_rtx when it is created. (immed_real_const_1): Set CONST_DOUBLE_CHAIN(r) to NULL_RTX if we are not in a function. * tree.c (tree_class_check_failed): Make second arg an int. * tree.h: Update prototype. cp: * call.c (add_candidate): Use ggc_alloc_cleared. * decl.c (lookup_label): Likewise. * lex.c (retrofit_lang_decl): Likewise. From-SVN: r34478 --- gcc/gengenrtl.c | 57 +++++++++++++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 30 deletions(-) (limited to 'gcc/gengenrtl.c') diff --git a/gcc/gengenrtl.c b/gcc/gengenrtl.c index 26450a9..54dccf1 100644 --- a/gcc/gengenrtl.c +++ b/gcc/gengenrtl.c @@ -272,7 +272,7 @@ genmacro (idx) if (*p != '0') printf (", (ARG%d)", i++); - printf (")\n"); + puts (")"); } /* Generate the code for the function to generate RTL whose @@ -293,30 +293,31 @@ gendef (format) if (*p != '0') printf (", arg%d", i++); - printf (")\n RTX_CODE code;\n enum machine_mode mode;\n"); + puts (")\n RTX_CODE code;\n enum machine_mode mode;"); for (p = format, i = 0; *p != 0; p++) if (*p != '0') printf (" %sarg%d;\n", type_from_format (*p), i++); /* Now write out the body of the function itself, which allocates the memory and initializes it. */ - printf ("{\n"); - printf (" rtx rt;\n"); - printf (" if (ggc_p)\n"); - printf (" rt = ggc_alloc_rtx (%d);\n", - (int) strlen (format)); - printf (" else\n"); - printf (" rt = obstack_alloc_rtx (sizeof (struct rtx_def) + %d * sizeof (rtunion));\n", - (int) strlen (format) - 1); - - printf (" PUT_CODE (rt, code);\n"); - printf (" PUT_MODE (rt, mode);\n"); + puts ("{"); + puts (" rtx rt;"); + puts (" if (ggc_p)"); + printf (" rt = ggc_alloc_rtx (%d);\n", (int) strlen (format)); + puts (" else"); + printf (" rt = obstack_alloc_rtx (%d);\n", (int) strlen (format)); + + puts (" memset (rt, 0, sizeof (struct rtx_def) - sizeof (rtunion));\n"); + puts (" PUT_CODE (rt, code);"); + puts (" PUT_MODE (rt, mode);"); for (p = format, i = j = 0; *p ; ++p, ++i) if (*p != '0') printf (" %s (rt, %d) = arg%d;\n", accessor_from_format (*p), i, j++); + else + printf (" X0EXP (rt, %d) = NULL_RTX;\n", i); - printf ("\n return rt;\n}\n\n"); + puts ("\n return rt;\n}\n"); } /* Generate the documentation header for files we write. */ @@ -324,8 +325,7 @@ gendef (format) static void genlegend () { - printf ("/* Generated automatically by the program `gengenrtl'\n"); - printf (" from the RTL description file `rtl.def' */\n\n"); + puts ("/* Generated automatically by gengenrtl from rtl.def. */\n"); } /* Generate the text of the header file we make, genrtl.h. */ @@ -339,7 +339,7 @@ genheader () for (fmt = formats; *fmt; ++fmt) gendecl (*fmt); - printf ("\n"); + putchar ('\n'); for (i = 0; i < NUM_RTX_CODE; i++) if (! special_format (defs[i].format)) @@ -353,19 +353,16 @@ gencode () { const char **fmt; - puts ("#include \"config.h\"\n"); - puts ("#include \"system.h\"\n"); - puts ("#include \"obstack.h\"\n"); - puts ("#include \"rtl.h\"\n"); - puts ("#include \"ggc.h\"\n\n"); - puts ("extern struct obstack *rtl_obstack;\n\n"); - puts ("static rtx obstack_alloc_rtx PARAMS ((int length));\n"); - puts ("static rtx\n"); - puts ("obstack_alloc_rtx (length)\n"); - puts (" register int length;\n{\n"); - puts (" rtx rt = (rtx) obstack_alloc (rtl_obstack, length);\n\n"); - puts (" memset(rt, 0, sizeof(struct rtx_def) - sizeof(rtunion));\n\n"); - puts (" return rt;\n}\n\n"); + puts ("#include \"config.h\""); + puts ("#include \"system.h\""); + puts ("#include \"obstack.h\""); + puts ("#include \"rtl.h\""); + puts ("#include \"ggc.h\"\n"); + puts ("extern struct obstack *rtl_obstack;\n"); + puts ("#define obstack_alloc_rtx(n) \\"); + puts (" ((rtx) obstack_alloc (rtl_obstack, \\"); + puts (" sizeof (struct rtx_def) \\"); + puts (" + ((n) - 2) * sizeof (rtunion)))\n"); for (fmt = formats; *fmt != 0; fmt++) gendef (*fmt); -- cgit v1.1