diff options
Diffstat (limited to 'gcc/genattr.c')
-rw-r--r-- | gcc/genattr.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/gcc/genattr.c b/gcc/genattr.c index 30160a4..36a37b1 100644 --- a/gcc/genattr.c +++ b/gcc/genattr.c @@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA. */ #include "rtl.h" #include "obstack.h" #include "errors.h" +#include "gensupport.h" static struct obstack obstack; struct obstack *rtl_obstack = &obstack; @@ -222,8 +223,6 @@ main (argc, argv) char **argv; { rtx desc; - FILE *infile; - register int c; int have_delay = 0; int have_annul_true = 0; int have_annul_false = 0; @@ -245,13 +244,8 @@ main (argc, argv) if (argc <= 1) fatal ("No input file name."); - infile = fopen (argv[1], "r"); - if (infile == 0) - { - perror (argv[1]); - return (FATAL_EXIT_CODE); - } - read_rtx_filename = argv[1]; + if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE) + return (FATAL_EXIT_CODE); printf ("/* Generated automatically by the program `genattr'\n\ from the machine description file `md'. */\n\n"); @@ -266,12 +260,12 @@ from the machine description file `md'. */\n\n"); while (1) { - c = read_skip_spaces (infile); - if (c == EOF) + int line_no, insn_code_number; + + desc = read_md_rtx (&line_no, &insn_code_number); + if (desc == NULL) break; - ungetc (c, infile); - desc = read_rtx (infile); if (GET_CODE (desc) == DEFINE_ATTR) gen_attr (desc); |