static int have_error;
\f
+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));
static void gen_split PROTO((rtx));
static int n_occurrences PROTO((int, char *));
\f
+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 ()
{
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;
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;
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;
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;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-/* Define this so we can link with print-rtl.o to get debug_rtx function. */
+/* Holds an array of names indexed by insn_code_number. */
char **insn_name_ptr = 0;
+int insn_name_ptr_size = 0;
/* Data structure for a listhead of decision trees. The alternatives
to a node are kept in a doublely-linked list so we can easily add nodes
struct decision *last;
struct decision_head head;
+ {
+ static char *last_real_name = "insn";
+ static int last_real_code = 0;
+ char *name;
+
+ if (insn_name_ptr_size <= next_insn_code)
+ {
+ int new_size;
+ new_size = (insn_name_ptr_size ? insn_name_ptr_size * 2 : 512);
+ insn_name_ptr = xrealloc (insn_name_ptr, sizeof(char *) * new_size);
+ bzero (insn_name_ptr + insn_name_ptr_size,
+ sizeof(char *) * (new_size - insn_name_ptr_size));
+ insn_name_ptr_size = new_size;
+ }
+
+ name = XSTR (insn, 0);
+ if (!name || name[0] == '\0')
+ {
+ name = xmalloc (strlen (last_real_name) + 10);
+ sprintf (name, "%s+%d", last_real_name,
+ next_insn_code - last_real_code);
+ }
+ else
+ {
+ last_real_name = name;
+ last_real_code = next_insn_code;
+ }
+
+ insn_name_ptr[next_insn_code] = name;
+ }
+
if (XVECLEN (insn, type == RECOG) == 1)
x = XVECEXP (insn, type == RECOG, 0);
else
old->num_clobbers_to_add = 0;
}
else
- fatal ("Two actions at one point in tree");
+ fatal ("Two actions at one point in tree for insns \"%s\" (%d) and \"%s\" (%d)",
+ insn_name_ptr[old->insn_code_number],
+ old->insn_code_number,
+ insn_name_ptr[add->insn_code_number],
+ add->insn_code_number);
}
if (old->insn_code_number == -1)