summaryrefslogtreecommitdiff
path: root/gcc/genoutput.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1999-01-19 20:24:22 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1999-01-19 20:24:22 +0000
commit36aaf757dd4aeb59ec103647724c65e0c0fc8679 (patch)
tree7f380dcbcd21e0f2b8a59a6b0b459bcd22438961 /gcc/genoutput.c
parentdaf672063270480be6e8cb94f9b1b8c6c2fc9bfd (diff)
downloadgcc-36aaf757dd4aeb59ec103647724c65e0c0fc8679.tar.gz
* genoutput.c (name_for_index): New function.
(scan_operands, validate_insn_alternatives): Use it. * genrecog.c (insn_name_ptr_size): New variable. (make_insn_sequence): Fill in insn_name_ptr. (merge_trees): Use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24770 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genoutput.c')
-rw-r--r--gcc/genoutput.c52
1 files changed, 38 insertions, 14 deletions
diff --git a/gcc/genoutput.c b/gcc/genoutput.c
index eaa4461c304..04667fee0ee 100644
--- a/gcc/genoutput.c
+++ b/gcc/genoutput.c
@@ -170,6 +170,7 @@ int have_constraints;
static int have_error;
+static char * name_for_index PROTO((int));
static void output_prologue PROTO((void));
static void output_epilogue PROTO((void));
static void scan_operands PROTO((rtx, int, int));
@@ -181,6 +182,29 @@ static void gen_expand PROTO((rtx));
static void gen_split PROTO((rtx));
static int n_occurrences PROTO((int, char *));
+static char *
+name_for_index (index)
+ int index;
+{
+ static char buf[100];
+
+ struct data *i, *last_named = NULL;
+ for (i = insn_data; i ; i = i->next)
+ {
+ if (i->index_number == index)
+ return i->name;
+ if (i->name)
+ last_named = i;
+ }
+
+ if (last_named)
+ sprintf(buf, "%s+%d", last_named->name, index - last_named->index_number);
+ else
+ sprintf(buf, "insn %d", index);
+
+ return buf;
+}
+
static void
output_prologue ()
{
@@ -440,13 +464,13 @@ scan_operands (part, this_address_p, this_strict_low)
max_opno = opno;
if (max_opno >= MAX_MAX_OPERANDS)
{
- error ("Too many operands (%d) in definition %d.\n",
- max_opno + 1, next_index_number);
+ error ("Too many operands (%d) in definition %s.\n",
+ max_opno + 1, name_for_index (next_index_number));
return;
}
if (seen[opno])
- error ("Definition %d specified operand number %d more than once.\n",
- next_index_number, opno);
+ error ("Definition %s specified operand number %d more than once.\n",
+ name_for_index (next_index_number), opno);
seen[opno] = 1;
modes[opno] = GET_MODE (part);
strict_low[opno] = this_strict_low;
@@ -466,13 +490,13 @@ scan_operands (part, this_address_p, this_strict_low)
max_opno = opno;
if (max_opno >= MAX_MAX_OPERANDS)
{
- error ("Too many operands (%d) in definition %d.\n",
- max_opno + 1, next_index_number);
+ error ("Too many operands (%d) in definition %s.\n",
+ max_opno + 1, name_for_index (next_index_number));
return;
}
if (seen[opno])
- error ("Definition %d specified operand number %d more than once.\n",
- next_index_number, opno);
+ error ("Definition %s specified operand number %d more than once.\n",
+ name_for_index (next_index_number), opno);
seen[opno] = 1;
modes[opno] = GET_MODE (part);
strict_low[opno] = 0;
@@ -493,13 +517,13 @@ scan_operands (part, this_address_p, this_strict_low)
max_opno = opno;
if (max_opno >= MAX_MAX_OPERANDS)
{
- error ("Too many operands (%d) in definition %d.\n",
- max_opno + 1, next_index_number);
+ error ("Too many operands (%d) in definition %s.\n",
+ max_opno + 1, name_for_index (next_index_number));
return;
}
if (seen[opno])
- error ("Definition %d specified operand number %d more than once.\n",
- next_index_number, opno);
+ error ("Definition %s specified operand number %d more than once.\n",
+ name_for_index (next_index_number), opno);
seen[opno] = 1;
modes[opno] = GET_MODE (part);
strict_low[opno] = 0;
@@ -644,8 +668,8 @@ validate_insn_alternatives (d)
if (n == 0)
n = d->op_n_alternatives[start];
else if (n != d->op_n_alternatives[start])
- error ("wrong number of alternatives in operand %d of insn number %d",
- start, d->index_number);
+ error ("wrong number of alternatives in operand %d of insn %s",
+ start, name_for_index (d->index_number));
}
/* Record the insn's overall number of alternatives. */
d->n_alternatives = n;