aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>1999-01-19 12:24:22 -0800
committerRichard Henderson <rth@gcc.gnu.org>1999-01-19 12:24:22 -0800
commit8aeba9094aba42d127aaeb130fd5c5585abe2546 (patch)
tree7f380dcbcd21e0f2b8a59a6b0b459bcd22438961
parent67e5db2c3947db5c50d6f7a80dd71795df7d2c4a (diff)
downloadgcc-8aeba9094aba42d127aaeb130fd5c5585abe2546.zip
gcc-8aeba9094aba42d127aaeb130fd5c5585abe2546.tar.gz
gcc-8aeba9094aba42d127aaeb130fd5c5585abe2546.tar.bz2
genoutput.c (name_for_index): New function.
* 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. From-SVN: r24770
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/genoutput.c52
-rw-r--r--gcc/genrecog.c40
3 files changed, 84 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4b51d91..4574634 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+Tue Jan 19 16:56:03 1999 Richard Henderson <rth@cygnus.com>
+
+ * 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.
+
Tue Jan 19 16:37:36 1999 Richard Henderson <rth@cygnus.com>
* i386/isc.h (TARGET_DEFAULT): Define symbolicly.
diff --git a/gcc/genoutput.c b/gcc/genoutput.c
index eaa4461..04667fe 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;
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index e25c3dc..da2a0cf 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -60,8 +60,9 @@ struct obstack *rtl_obstack = &obstack;
#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
@@ -210,6 +211,37 @@ make_insn_sequence (insn, type)
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
@@ -896,7 +928,11 @@ merge_trees (oldh, addh)
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)