From d96a2fcdf0ae6ce1a758179a6ec72ec51877420c Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 27 May 2000 13:01:10 -0700 Subject: [PATCH] genoutput.c: Don't include errors.h. * genoutput.c: Don't include errors.h. (struct data): Add lineno member. (have_error): New. (scan_operands): Use message_with_line instead of error. (validate_insn_alternatives): Likewise. (gen_insn): Accept and store the pattern's line number. (gen_peephole, gen_expand, gen_split): Likewise. (main): Don't set progname. Pass line_no to gen_foo. From-SVN: r34205 --- gcc/ChangeLog | 11 +++++++ gcc/genoutput.c | 87 ++++++++++++++++++++++++++++++++----------------- 2 files changed, 68 insertions(+), 30 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f1a3d98d139..99e865bcd1a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2000-05-27 Richard Henderson + + * genoutput.c: Don't include errors.h. + (struct data): Add lineno member. + (have_error): New. + (scan_operands): Use message_with_line instead of error. + (validate_insn_alternatives): Likewise. + (gen_insn): Accept and store the pattern's line number. + (gen_peephole, gen_expand, gen_split): Likewise. + (main): Don't set progname. Pass line_no to gen_foo. + 2000-05-27 Richard Henderson * config/d30v/d30v.c (d30v_print_operand): Handle ':'. diff --git a/gcc/genoutput.c b/gcc/genoutput.c index 0d0ae351a7a..e9a257fdcd3 100644 --- a/gcc/genoutput.c +++ b/gcc/genoutput.c @@ -88,7 +88,6 @@ Boston, MA 02111-1307, USA. */ #include "hconfig.h" #include "system.h" #include "rtl.h" -#include "errors.h" #include "gensupport.h" /* No instruction can have more operands than this. Sorry for this @@ -158,6 +157,7 @@ struct data const char *template; int code_number; int index_number; + int lineno; int n_operands; /* Number of operands this insn recognizes */ int n_dups; /* Number times match_dup appears in pattern */ int n_alternatives; /* Number of alternatives in each constraint */ @@ -169,6 +169,8 @@ struct data /* This variable points to the first link in the insn chain. */ static struct data *idata, **idata_end = &idata; + +static int have_error; static void output_prologue PARAMS ((void)); static void output_predicate_decls PARAMS ((void)); @@ -181,10 +183,10 @@ static int compare_operands PARAMS ((struct operand_data *, static void place_operands PARAMS ((struct data *)); static void process_template PARAMS ((struct data *, const char *)); static void validate_insn_alternatives PARAMS ((struct data *)); -static void gen_insn PARAMS ((rtx)); -static void gen_peephole PARAMS ((rtx)); -static void gen_expand PARAMS ((rtx)); -static void gen_split PARAMS ((rtx)); +static void gen_insn PARAMS ((rtx, int)); +static void gen_peephole PARAMS ((rtx, int)); +static void gen_expand PARAMS ((rtx, int)); +static void gen_split PARAMS ((rtx, int)); const char * get_insn_name (index) @@ -213,7 +215,7 @@ static void output_prologue () { printf ("/* Generated automatically by the program `genoutput'\n\ -from the machine description file `md'. */\n\n"); + from the machine description file `md'. */\n\n"); printf ("#include \"config.h\"\n"); printf ("#include \"system.h\"\n"); @@ -421,13 +423,18 @@ scan_operands (d, part, this_address_p, this_strict_low) max_opno = opno; if (max_opno >= MAX_MAX_OPERANDS) { - error ("Too many operands (%d) in definition %s.\n", - max_opno + 1, get_insn_name (next_index_number)); + message_with_line (d->lineno, + "maximum number of operands exceeded"); + have_error = 1; return; } if (d->operand[opno].seen) - error ("Definition %s specified operand number %d more than once.\n", - get_insn_name (next_index_number), opno); + { + message_with_line (d->lineno, + "repeated operand number %d\n", opno); + have_error = 1; + } + d->operand[opno].seen = 1; d->operand[opno].mode = GET_MODE (part); d->operand[opno].strict_low = this_strict_low; @@ -445,13 +452,18 @@ scan_operands (d, part, this_address_p, this_strict_low) max_opno = opno; if (max_opno >= MAX_MAX_OPERANDS) { - error ("Too many operands (%d) in definition %s.\n", - max_opno + 1, get_insn_name (next_index_number)); + message_with_line (d->lineno, + "maximum number of operands exceeded"); + have_error = 1; return; } if (d->operand[opno].seen) - error ("Definition %s specified operand number %d more than once.\n", - get_insn_name (next_index_number), opno); + { + message_with_line (d->lineno, + "repeated operand number %d\n", opno); + have_error = 1; + } + d->operand[opno].seen = 1; d->operand[opno].mode = GET_MODE (part); d->operand[opno].strict_low = 0; @@ -470,13 +482,18 @@ scan_operands (d, part, this_address_p, this_strict_low) max_opno = opno; if (max_opno >= MAX_MAX_OPERANDS) { - error ("Too many operands (%d) in definition %s.\n", - max_opno + 1, get_insn_name (next_index_number)); + message_with_line (d->lineno, + "maximum number of operands exceeded"); + have_error = 1; return; } if (d->operand[opno].seen) - error ("Definition %s specified operand number %d more than once.\n", - get_insn_name (next_index_number), opno); + { + message_with_line (d->lineno, + "repeated operand number %d\n", opno); + have_error = 1; + } + d->operand[opno].seen = 1; d->operand[opno].mode = GET_MODE (part); d->operand[opno].strict_low = 0; @@ -695,8 +712,12 @@ validate_insn_alternatives (d) if (n == 0) n = d->operand[start].n_alternatives; else if (n != d->operand[start].n_alternatives) - error ("wrong number of alternatives in operand %d of insn %s", - start, get_insn_name (d->index_number)); + { + message_with_line (d->lineno, + "wrong number of alternatives in operand %d", + start); + have_error = 1; + } } /* Record the insn's overall number of alternatives. */ @@ -708,14 +729,16 @@ validate_insn_alternatives (d) a hairy output action, output a function for now. */ static void -gen_insn (insn) +gen_insn (insn, lineno) rtx insn; + int lineno; { register struct data *d = (struct data *) xmalloc (sizeof (struct data)); register int i; d->code_number = next_code_number; d->index_number = next_index_number; + d->lineno = lineno; if (XSTR (insn, 0)[0]) d->name = XSTR (insn, 0); else @@ -747,14 +770,16 @@ gen_insn (insn) If the insn has a hairy output action, output it now. */ static void -gen_peephole (peep) +gen_peephole (peep, lineno) rtx peep; + int lineno; { register struct data *d = (struct data *) xmalloc (sizeof (struct data)); register int i; d->code_number = next_code_number; d->index_number = next_index_number; + d->lineno = lineno; d->name = 0; /* Build up the list in the same order as the insns are seen @@ -785,14 +810,16 @@ gen_peephole (peep) only for the purposes of `insn_gen_function'. */ static void -gen_expand (insn) +gen_expand (insn, lineno) rtx insn; + int lineno; { register struct data *d = (struct data *) xmalloc (sizeof (struct data)); register int i; d->code_number = next_code_number; d->index_number = next_index_number; + d->lineno = lineno; if (XSTR (insn, 0)[0]) d->name = XSTR (insn, 0); else @@ -828,14 +855,16 @@ gen_expand (insn) only for reasons of consistency and to simplify genrecog. */ static void -gen_split (split) +gen_split (split, lineno) rtx split; + int lineno; { register struct data *d = (struct data *) xmalloc (sizeof (struct data)); register int i; d->code_number = next_code_number; d->index_number = next_index_number; + d->lineno = lineno; d->name = 0; /* Build up the list in the same order as the insns are seen @@ -872,8 +901,6 @@ main (argc, argv) { rtx desc; - progname = "genoutput"; - if (argc <= 1) fatal ("No input file name."); @@ -895,14 +922,14 @@ main (argc, argv) break; if (GET_CODE (desc) == DEFINE_INSN) - gen_insn (desc); + gen_insn (desc, line_no); if (GET_CODE (desc) == DEFINE_PEEPHOLE) - gen_peephole (desc); + gen_peephole (desc, line_no); if (GET_CODE (desc) == DEFINE_EXPAND) - gen_expand (desc); + gen_expand (desc, line_no); if (GET_CODE (desc) == DEFINE_SPLIT || GET_CODE (desc) == DEFINE_PEEPHOLE2) - gen_split (desc); + gen_split (desc, line_no); next_index_number++; } -- 2.30.2