+2004-08-13 Richard Sandiford <rsandifo@redhat.com>
+
+ * genattrtab.c (insn_ent): Replace insn_code, insn_index and lineno
+ fields with a pointer to the instruction definition.
+ (get_attr_value, fill_attr, make_length_attrs, remove_insn_ent)
+ (insert_insn_ent, simplify_test_exp, optimize_attrs, write_attr_get)
+ (write_attr_case, write_const_num_delay_slots): Update accordingly.
+ (write_attr_case, write_const_num_delay_slots): Write the name of
+ an insn next to its case statement.
+ * genoutput.c (data): Add a filename field.
+ (gen_insn, gen_peephole, gen_expand, gen_split): Set it.
+ (output_insn_data): Print the location of each insn definition.
+ * genrecog.c (write_action): Print the name of an insn above
+ the statement that returns its code.
+
2004-08-12 Andrew Pinski <pinskia@physics.uc.edu>
* config/darwin-c.c (find_subframework_file): Fix spelling of cannot.
struct insn_ent
{
struct insn_ent *next; /* Next in chain. */
- int insn_code; /* Instruction number. */
- int insn_index; /* Index of definition in file */
- int lineno; /* Line number. */
+ struct insn_def *def; /* Instruction definition. */
};
/* Each value of an attribute (either constant or computed) is assigned a
for (av = attr->first_value; av; av = av->next)
if (rtx_equal_p (value, av->value)
&& (num_alt == 0 || av->first_insn == NULL
- || insn_alternatives[av->first_insn->insn_code]))
+ || insn_alternatives[av->first_insn->def->insn_code]))
return av;
av = oballoc (sizeof (struct attr_value));
av = get_attr_value (value, attr, id->insn_code);
ie = oballoc (sizeof (struct insn_ent));
- ie->insn_code = id->insn_code;
- ie->insn_index = id->insn_code;
+ ie->def = id;
insert_insn_ent (av, ie);
}
}
new_av = get_attr_value (substitute_address (av->value,
no_address_fn[i],
address_fn[i]),
- new_attr, ie->insn_code);
+ new_attr, ie->def->insn_code);
new_ie = oballoc (sizeof (struct insn_ent));
- new_ie->insn_code = ie->insn_code;
- new_ie->insn_index = ie->insn_index;
+ new_ie->def = ie->def;
insert_insn_ent (new_av, new_ie);
}
}
}
av->num_insns--;
- if (ie->insn_code == -1)
+ if (ie->def->insn_code == -1)
av->has_asm_insn = 0;
num_insn_ents--;
ie->next = av->first_insn;
av->first_insn = ie;
av->num_insns++;
- if (ie->insn_code == -1)
+ if (ie->def->insn_code == -1)
av->has_asm_insn = 1;
num_insn_ents++;
&& (attr = find_attr (&XSTR (exp, 0), 0)) != NULL)
for (av = attr->first_value; av; av = av->next)
for (ie = av->first_insn; ie; ie = ie->next)
- if (ie->insn_code == insn_code)
+ if (ie->def->insn_code == insn_code)
{
rtx x;
x = evaluate_eq_attr (exp, av->value, insn_code, insn_index);
iv->attr = attr;
iv->av = av;
iv->ie = ie;
- iv->next = insn_code_values[ie->insn_code];
- insn_code_values[ie->insn_code] = iv;
+ iv->next = insn_code_values[ie->def->insn_code];
+ insn_code_values[ie->def->insn_code] = iv;
iv++;
}
newexp = av->value;
while (GET_CODE (newexp) == COND)
{
- rtx newexp2 = simplify_cond (newexp, ie->insn_code,
- ie->insn_index);
+ rtx newexp2 = simplify_cond (newexp, ie->def->insn_code,
+ ie->def->insn_index);
if (newexp2 == newexp)
break;
newexp = newexp2;
{
newexp = attr_copy_rtx (newexp);
remove_insn_ent (av, ie);
- av = get_attr_value (newexp, attr, ie->insn_code);
+ av = get_attr_value (newexp, attr, ie->def->insn_code);
iv->av = av;
insert_insn_ent (av, ie);
}
for (av = attr->first_value; av; av = av->next)
if (av->num_insns != 0)
write_attr_set (attr, 2, av->value, "return", ";",
- true_rtx, av->first_insn->insn_code,
- av->first_insn->insn_index);
+ true_rtx, av->first_insn->def->insn_code,
+ av->first_insn->def->insn_index);
printf ("}\n\n");
return;
if (write_case_lines)
{
for (ie = av->first_insn; ie; ie = ie->next)
- if (ie->insn_code != -1)
+ if (ie->def->insn_code != -1)
{
write_indent (indent);
- printf ("case %d:\n", ie->insn_code);
+ printf ("case %d: /* %s */\n",
+ ie->def->insn_code, XSTR (ie->def->def, 0));
}
}
else
}
write_attr_set (attr, indent + 2, av->value, prefix, suffix,
- known_true, av->first_insn->insn_code,
- av->first_insn->insn_index);
+ known_true, av->first_insn->def->insn_code,
+ av->first_insn->def->insn_index);
if (strncmp (prefix, "return", 6))
{
if (length_used)
{
for (ie = av->first_insn; ie; ie = ie->next)
- if (ie->insn_code != -1)
- printf (" case %d:\n", ie->insn_code);
+ if (ie->def->insn_code != -1)
+ printf (" case %d: /* %s */\n",
+ ie->def->insn_code, XSTR (ie->def->def, 0));
printf (" return 0;\n");
}
}
const char *template;
int code_number;
int index_number;
+ const char *filename;
int lineno;
int n_operands; /* Number of operands this insn recognizes */
int n_dups; /* Number times match_dup appears in pattern */
for (d = idata; d; d = d->next)
{
+ printf (" /* %s:%d */\n", d->filename, d->lineno);
printf (" {\n");
if (d->name)
d->code_number = next_code_number;
d->index_number = next_index_number;
+ d->filename = read_rtx_filename;
d->lineno = lineno;
if (XSTR (insn, 0)[0])
d->name = XSTR (insn, 0);
d->code_number = next_code_number;
d->index_number = next_index_number;
+ d->filename = read_rtx_filename;
d->lineno = lineno;
d->name = 0;
d->code_number = next_code_number;
d->index_number = next_index_number;
+ d->filename = read_rtx_filename;
d->lineno = lineno;
if (XSTR (insn, 0)[0])
d->name = XSTR (insn, 0);
d->code_number = next_code_number;
d->index_number = next_index_number;
+ d->filename = read_rtx_filename;
d->lineno = lineno;
d->name = 0;