Commit d96a2fcd by Richard Henderson Committed by Richard Henderson

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
parent 5401747e
2000-05-27 Richard Henderson <rth@cygnus.com> 2000-05-27 Richard Henderson <rth@cygnus.com>
* 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 <rth@cygnus.com>
* config/d30v/d30v.c (d30v_print_operand): Handle ':'. * config/d30v/d30v.c (d30v_print_operand): Handle ':'.
* config/d30v/d30v.h (PRINT_OPERAND_PUNCT_VALID_P): Accept ':'. * config/d30v/d30v.h (PRINT_OPERAND_PUNCT_VALID_P): Accept ':'.
* config/d30v/d30v.md (attr predicable): New. * config/d30v/d30v.md (attr predicable): New.
...@@ -88,7 +88,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -88,7 +88,6 @@ Boston, MA 02111-1307, USA. */
#include "hconfig.h" #include "hconfig.h"
#include "system.h" #include "system.h"
#include "rtl.h" #include "rtl.h"
#include "errors.h"
#include "gensupport.h" #include "gensupport.h"
/* No instruction can have more operands than this. Sorry for this /* No instruction can have more operands than this. Sorry for this
...@@ -158,6 +157,7 @@ struct data ...@@ -158,6 +157,7 @@ struct data
const char *template; const char *template;
int code_number; int code_number;
int index_number; int index_number;
int lineno;
int n_operands; /* Number of operands this insn recognizes */ int n_operands; /* Number of operands this insn recognizes */
int n_dups; /* Number times match_dup appears in pattern */ int n_dups; /* Number times match_dup appears in pattern */
int n_alternatives; /* Number of alternatives in each constraint */ int n_alternatives; /* Number of alternatives in each constraint */
...@@ -169,6 +169,8 @@ struct data ...@@ -169,6 +169,8 @@ struct data
/* This variable points to the first link in the insn chain. */ /* This variable points to the first link in the insn chain. */
static struct data *idata, **idata_end = &idata; static struct data *idata, **idata_end = &idata;
static int have_error;
static void output_prologue PARAMS ((void)); static void output_prologue PARAMS ((void));
static void output_predicate_decls PARAMS ((void)); static void output_predicate_decls PARAMS ((void));
...@@ -181,10 +183,10 @@ static int compare_operands PARAMS ((struct operand_data *, ...@@ -181,10 +183,10 @@ static int compare_operands PARAMS ((struct operand_data *,
static void place_operands PARAMS ((struct data *)); static void place_operands PARAMS ((struct data *));
static void process_template PARAMS ((struct data *, const char *)); static void process_template PARAMS ((struct data *, const char *));
static void validate_insn_alternatives PARAMS ((struct data *)); static void validate_insn_alternatives PARAMS ((struct data *));
static void gen_insn PARAMS ((rtx)); static void gen_insn PARAMS ((rtx, int));
static void gen_peephole PARAMS ((rtx)); static void gen_peephole PARAMS ((rtx, int));
static void gen_expand PARAMS ((rtx)); static void gen_expand PARAMS ((rtx, int));
static void gen_split PARAMS ((rtx)); static void gen_split PARAMS ((rtx, int));
const char * const char *
get_insn_name (index) get_insn_name (index)
...@@ -213,7 +215,7 @@ static void ...@@ -213,7 +215,7 @@ static void
output_prologue () output_prologue ()
{ {
printf ("/* Generated automatically by the program `genoutput'\n\ 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 \"config.h\"\n");
printf ("#include \"system.h\"\n"); printf ("#include \"system.h\"\n");
...@@ -421,13 +423,18 @@ scan_operands (d, part, this_address_p, this_strict_low) ...@@ -421,13 +423,18 @@ scan_operands (d, part, this_address_p, this_strict_low)
max_opno = opno; max_opno = opno;
if (max_opno >= MAX_MAX_OPERANDS) if (max_opno >= MAX_MAX_OPERANDS)
{ {
error ("Too many operands (%d) in definition %s.\n", message_with_line (d->lineno,
max_opno + 1, get_insn_name (next_index_number)); "maximum number of operands exceeded");
have_error = 1;
return; return;
} }
if (d->operand[opno].seen) 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].seen = 1;
d->operand[opno].mode = GET_MODE (part); d->operand[opno].mode = GET_MODE (part);
d->operand[opno].strict_low = this_strict_low; d->operand[opno].strict_low = this_strict_low;
...@@ -445,13 +452,18 @@ scan_operands (d, part, this_address_p, this_strict_low) ...@@ -445,13 +452,18 @@ scan_operands (d, part, this_address_p, this_strict_low)
max_opno = opno; max_opno = opno;
if (max_opno >= MAX_MAX_OPERANDS) if (max_opno >= MAX_MAX_OPERANDS)
{ {
error ("Too many operands (%d) in definition %s.\n", message_with_line (d->lineno,
max_opno + 1, get_insn_name (next_index_number)); "maximum number of operands exceeded");
have_error = 1;
return; return;
} }
if (d->operand[opno].seen) 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].seen = 1;
d->operand[opno].mode = GET_MODE (part); d->operand[opno].mode = GET_MODE (part);
d->operand[opno].strict_low = 0; d->operand[opno].strict_low = 0;
...@@ -470,13 +482,18 @@ scan_operands (d, part, this_address_p, this_strict_low) ...@@ -470,13 +482,18 @@ scan_operands (d, part, this_address_p, this_strict_low)
max_opno = opno; max_opno = opno;
if (max_opno >= MAX_MAX_OPERANDS) if (max_opno >= MAX_MAX_OPERANDS)
{ {
error ("Too many operands (%d) in definition %s.\n", message_with_line (d->lineno,
max_opno + 1, get_insn_name (next_index_number)); "maximum number of operands exceeded");
have_error = 1;
return; return;
} }
if (d->operand[opno].seen) 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].seen = 1;
d->operand[opno].mode = GET_MODE (part); d->operand[opno].mode = GET_MODE (part);
d->operand[opno].strict_low = 0; d->operand[opno].strict_low = 0;
...@@ -695,8 +712,12 @@ validate_insn_alternatives (d) ...@@ -695,8 +712,12 @@ validate_insn_alternatives (d)
if (n == 0) if (n == 0)
n = d->operand[start].n_alternatives; n = d->operand[start].n_alternatives;
else if (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. */ /* Record the insn's overall number of alternatives. */
...@@ -708,14 +729,16 @@ validate_insn_alternatives (d) ...@@ -708,14 +729,16 @@ validate_insn_alternatives (d)
a hairy output action, output a function for now. */ a hairy output action, output a function for now. */
static void static void
gen_insn (insn) gen_insn (insn, lineno)
rtx insn; rtx insn;
int lineno;
{ {
register struct data *d = (struct data *) xmalloc (sizeof (struct data)); register struct data *d = (struct data *) xmalloc (sizeof (struct data));
register int i; register int i;
d->code_number = next_code_number; d->code_number = next_code_number;
d->index_number = next_index_number; d->index_number = next_index_number;
d->lineno = lineno;
if (XSTR (insn, 0)[0]) if (XSTR (insn, 0)[0])
d->name = XSTR (insn, 0); d->name = XSTR (insn, 0);
else else
...@@ -747,14 +770,16 @@ gen_insn (insn) ...@@ -747,14 +770,16 @@ gen_insn (insn)
If the insn has a hairy output action, output it now. */ If the insn has a hairy output action, output it now. */
static void static void
gen_peephole (peep) gen_peephole (peep, lineno)
rtx peep; rtx peep;
int lineno;
{ {
register struct data *d = (struct data *) xmalloc (sizeof (struct data)); register struct data *d = (struct data *) xmalloc (sizeof (struct data));
register int i; register int i;
d->code_number = next_code_number; d->code_number = next_code_number;
d->index_number = next_index_number; d->index_number = next_index_number;
d->lineno = lineno;
d->name = 0; d->name = 0;
/* Build up the list in the same order as the insns are seen /* Build up the list in the same order as the insns are seen
...@@ -785,14 +810,16 @@ gen_peephole (peep) ...@@ -785,14 +810,16 @@ gen_peephole (peep)
only for the purposes of `insn_gen_function'. */ only for the purposes of `insn_gen_function'. */
static void static void
gen_expand (insn) gen_expand (insn, lineno)
rtx insn; rtx insn;
int lineno;
{ {
register struct data *d = (struct data *) xmalloc (sizeof (struct data)); register struct data *d = (struct data *) xmalloc (sizeof (struct data));
register int i; register int i;
d->code_number = next_code_number; d->code_number = next_code_number;
d->index_number = next_index_number; d->index_number = next_index_number;
d->lineno = lineno;
if (XSTR (insn, 0)[0]) if (XSTR (insn, 0)[0])
d->name = XSTR (insn, 0); d->name = XSTR (insn, 0);
else else
...@@ -828,14 +855,16 @@ gen_expand (insn) ...@@ -828,14 +855,16 @@ gen_expand (insn)
only for reasons of consistency and to simplify genrecog. */ only for reasons of consistency and to simplify genrecog. */
static void static void
gen_split (split) gen_split (split, lineno)
rtx split; rtx split;
int lineno;
{ {
register struct data *d = (struct data *) xmalloc (sizeof (struct data)); register struct data *d = (struct data *) xmalloc (sizeof (struct data));
register int i; register int i;
d->code_number = next_code_number; d->code_number = next_code_number;
d->index_number = next_index_number; d->index_number = next_index_number;
d->lineno = lineno;
d->name = 0; d->name = 0;
/* Build up the list in the same order as the insns are seen /* Build up the list in the same order as the insns are seen
...@@ -872,8 +901,6 @@ main (argc, argv) ...@@ -872,8 +901,6 @@ main (argc, argv)
{ {
rtx desc; rtx desc;
progname = "genoutput";
if (argc <= 1) if (argc <= 1)
fatal ("No input file name."); fatal ("No input file name.");
...@@ -895,14 +922,14 @@ main (argc, argv) ...@@ -895,14 +922,14 @@ main (argc, argv)
break; break;
if (GET_CODE (desc) == DEFINE_INSN) if (GET_CODE (desc) == DEFINE_INSN)
gen_insn (desc); gen_insn (desc, line_no);
if (GET_CODE (desc) == DEFINE_PEEPHOLE) if (GET_CODE (desc) == DEFINE_PEEPHOLE)
gen_peephole (desc); gen_peephole (desc, line_no);
if (GET_CODE (desc) == DEFINE_EXPAND) if (GET_CODE (desc) == DEFINE_EXPAND)
gen_expand (desc); gen_expand (desc, line_no);
if (GET_CODE (desc) == DEFINE_SPLIT if (GET_CODE (desc) == DEFINE_SPLIT
|| GET_CODE (desc) == DEFINE_PEEPHOLE2) || GET_CODE (desc) == DEFINE_PEEPHOLE2)
gen_split (desc); gen_split (desc, line_no);
next_index_number++; next_index_number++;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment