summaryrefslogtreecommitdiff
path: root/gcc/genoutput.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/genoutput.c')
-rw-r--r--gcc/genoutput.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/gcc/genoutput.c b/gcc/genoutput.c
index d581da2adad..922359dbc6d 100644
--- a/gcc/genoutput.c
+++ b/gcc/genoutput.c
@@ -90,6 +90,7 @@ Boston, MA 02111-1307, USA. */
#include "rtl.h"
#include "obstack.h"
#include "errors.h"
+#include "gensupport.h"
/* No instruction can have more operands than this. Sorry for this
arbitrary limit, but what machine will have an instruction with
@@ -720,7 +721,7 @@ gen_insn (insn)
register struct data *d = (struct data *) xmalloc (sizeof (struct data));
register int i;
- d->code_number = next_code_number++;
+ d->code_number = next_code_number;
d->index_number = next_index_number;
if (XSTR (insn, 0)[0])
d->name = XSTR (insn, 0);
@@ -759,7 +760,7 @@ gen_peephole (peep)
register struct data *d = (struct data *) xmalloc (sizeof (struct data));
register int i;
- d->code_number = next_code_number++;
+ d->code_number = next_code_number;
d->index_number = next_index_number;
d->name = 0;
@@ -797,7 +798,7 @@ gen_expand (insn)
register struct data *d = (struct data *) xmalloc (sizeof (struct data));
register int i;
- d->code_number = next_code_number++;
+ d->code_number = next_code_number;
d->index_number = next_index_number;
if (XSTR (insn, 0)[0])
d->name = XSTR (insn, 0);
@@ -840,7 +841,7 @@ gen_split (split)
register struct data *d = (struct data *) xmalloc (sizeof (struct data));
register int i;
- d->code_number = next_code_number++;
+ d->code_number = next_code_number;
d->index_number = next_index_number;
d->name = 0;
@@ -903,8 +904,6 @@ main (argc, argv)
char **argv;
{
rtx desc;
- FILE *infile;
- register int c;
progname = "genoutput";
obstack_init (rtl_obstack);
@@ -912,13 +911,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);
output_prologue ();
next_code_number = 0;
@@ -928,12 +922,12 @@ main (argc, argv)
while (1)
{
- c = read_skip_spaces (infile);
- if (c == EOF)
+ int line_no;
+
+ desc = read_md_rtx (&line_no, &next_code_number);
+ if (desc == NULL)
break;
- ungetc (c, infile);
- desc = read_rtx (infile);
if (GET_CODE (desc) == DEFINE_INSN)
gen_insn (desc);
if (GET_CODE (desc) == DEFINE_PEEPHOLE)