diff options
author | Richard Henderson <rth@cygnus.com> | 1999-04-01 09:06:09 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 1999-04-01 09:06:09 -0800 |
commit | 0133b7d92c246b7e6fc48a72dc6069700f703281 (patch) | |
tree | 83f67dcf4de9983354cae74f36289575fb39bb5d /gcc/gengenrtl.c | |
parent | 4b97aaeb34b0e0dadbd2eced838111fd77b4c0dc (diff) | |
download | gcc-0133b7d92c246b7e6fc48a72dc6069700f703281.tar.gz |
Move over patch from Bernd Schmidt from GC branch:
* emit-rtl.c (gen_rtx_CONST_DOUBLE): New function.
(gen_rtx): Call it. Tidy cases.
* rtl.h (gen_rtx_CONST_DOUBLE): Prototype it.
* gengenrtl.c: Add commentary.
(special_rtx): Also match CONST_DOUBLE.
(gencode): Emit call to memset instead of bzero.
From-SVN: r26110
Diffstat (limited to 'gcc/gengenrtl.c')
-rw-r--r-- | gcc/gengenrtl.c | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/gcc/gengenrtl.c b/gcc/gengenrtl.c index 8f811fc010e..29cb836df44 100644 --- a/gcc/gengenrtl.c +++ b/gcc/gengenrtl.c @@ -1,5 +1,5 @@ /* Generate code to allocate RTL structures. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of GNU CC. @@ -52,6 +52,8 @@ static void genlegend PROTO((FILE *)); static void genheader PROTO((FILE *)); static void gencode PROTO((FILE *)); +/* Decode a format letter into a C type string. */ + static const char * type_from_format (c) int c; @@ -84,6 +86,8 @@ type_from_format (c) } } +/* Decode a format letter into the proper accessor function. */ + static const char * accessor_from_format (c) int c; @@ -110,6 +114,8 @@ accessor_from_format (c) } } +/* Return true if a format character doesn't need normal processing. */ + static int special_format (fmt) const char *fmt; @@ -120,15 +126,20 @@ special_format (fmt) || strchr (fmt, 'n') != 0); } +/* Return true if an rtx requires special processing. */ + static int special_rtx (idx) int idx; { return (strcmp (defs[idx].enumname, "CONST_INT") == 0 + || strcmp (defs[idx].enumname, "CONST_DOUBLE") == 0 || strcmp (defs[idx].enumname, "REG") == 0 || strcmp (defs[idx].enumname, "MEM") == 0); } +/* Fill `formats' with all unique format strings. */ + static void find_formats () { @@ -142,7 +153,7 @@ find_formats () continue; for (f = formats; *f ; ++f) - if (!strcmp(*f, defs[i].format)) + if (! strcmp (*f, defs[i].format)) break; if (!*f) @@ -150,6 +161,8 @@ find_formats () } } +/* Emit a prototype for the rtx generator for a format. */ + static void gendecl (f, format) FILE *f; @@ -166,6 +179,8 @@ gendecl (f, format) fprintf (f, "));\n"); } +/* Emit a define mapping an rtx code to the generator for its format. */ + static void genmacro (f, idx) FILE *f; @@ -189,6 +204,8 @@ genmacro (f, idx) fprintf (f, ")\n"); } +/* Emit the implementation for the rtx generator for a format. */ + static void gendef (f, format) FILE *f; @@ -225,14 +242,18 @@ gendef (f, format) fprintf (f, "\n return rt;\n}\n\n"); } +/* Emit the `do not edit' banner. */ + static void genlegend (f) FILE *f; { - fprintf (f, "/* Generated automaticaly by the program `gengenrtl'\n"); - fprintf (f, " from the RTL description file `rtl.def' */\n\n"); + fputs ("/* Generated automaticaly by the program `gengenrtl'\n", f); + fputs (" from the RTL description file `rtl.def' */\n\n", f); } +/* Emit "genrtl.h". */ + static void genheader (f) FILE *f; @@ -243,7 +264,7 @@ genheader (f) for (fmt = formats; *fmt; ++fmt) gendecl (f, *fmt); - fprintf(f, "\n"); + fprintf (f, "\n"); for (i = 0; i < NUM_RTX_CODE; i++) { @@ -253,6 +274,8 @@ genheader (f) } } +/* Emit "genrtl.c". */ + static void gencode (f) FILE *f; @@ -268,7 +291,7 @@ gencode (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 (" bzero((char *) rt, sizeof(struct rtx_def) - sizeof(rtunion));\n\n", f); + fputs (" memset(rt, 0, sizeof(struct rtx_def) - sizeof(rtunion));\n\n", f); fputs (" return rt;\n}\n\n", f); for (fmt = formats; *fmt; ++fmt) @@ -308,22 +331,22 @@ main(argc, argv) f = fopen (argv[1], "w"); if (f == NULL) { - perror(argv[1]); + perror (argv[1]); exit (1); } genlegend (f); genheader (f); - fclose(f); + fclose (f); f = fopen (argv[2], "w"); if (f == NULL) { - perror(argv[2]); + perror (argv[2]); exit (1); } genlegend (f); gencode (f); - fclose(f); + fclose (f); exit (0); } |