From: Richard Sandiford Date: Fri, 13 Aug 2004 16:43:04 +0000 (+0000) Subject: genattrtab.c (insn_ent): Replace insn_code... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1e9c84051f28ba061d23b640940eda3e01863ee4;p=gcc.git genattrtab.c (insn_ent): Replace insn_code... * 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. From-SVN: r85947 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6ef44ff2e88..ec30892263c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2004-08-13 Richard Sandiford + + * 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 * config/darwin-c.c (find_subframework_file): Fix spelling of cannot. diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c index fde4933c3b0..f8f3277d76f 100644 --- a/gcc/genattrtab.c +++ b/gcc/genattrtab.c @@ -160,9 +160,7 @@ struct insn_def 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 @@ -1377,7 +1375,7 @@ get_attr_value (rtx value, struct attr_desc *attr, int insn_code) 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)); @@ -1524,8 +1522,7 @@ fill_attr (struct attr_desc *attr) 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); } } @@ -1651,10 +1648,9 @@ make_length_attrs (void) 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); } } @@ -1854,7 +1850,7 @@ remove_insn_ent (struct attr_value *av, struct insn_ent *ie) } av->num_insns--; - if (ie->insn_code == -1) + if (ie->def->insn_code == -1) av->has_asm_insn = 0; num_insn_ents--; @@ -1868,7 +1864,7 @@ insert_insn_ent (struct attr_value *av, struct insn_ent *ie) 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++; @@ -2826,7 +2822,7 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index) && (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); @@ -2896,8 +2892,8 @@ optimize_attrs (void) 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++; } @@ -2927,8 +2923,8 @@ optimize_attrs (void) 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; @@ -2939,7 +2935,7 @@ optimize_attrs (void) { 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); } @@ -3739,8 +3735,8 @@ write_attr_get (struct attr_desc *attr) 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; @@ -3905,10 +3901,11 @@ write_attr_case (struct attr_desc *attr, struct attr_value *av, 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 @@ -3933,8 +3930,8 @@ write_attr_case (struct attr_desc *attr, struct attr_value *av, } 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)) { @@ -4384,8 +4381,9 @@ write_const_num_delay_slots (void) 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"); } } diff --git a/gcc/genoutput.c b/gcc/genoutput.c index 112017d8cbd..e21fc7fd86d 100644 --- a/gcc/genoutput.c +++ b/gcc/genoutput.c @@ -160,6 +160,7 @@ struct data 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 */ @@ -291,6 +292,7 @@ output_insn_data (void) for (d = idata; d; d = d->next) { + printf (" /* %s:%d */\n", d->filename, d->lineno); printf (" {\n"); if (d->name) @@ -823,6 +825,7 @@ gen_insn (rtx insn, int lineno) 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); @@ -864,6 +867,7 @@ gen_peephole (rtx peep, int lineno) d->code_number = next_code_number; d->index_number = next_index_number; + d->filename = read_rtx_filename; d->lineno = lineno; d->name = 0; @@ -902,6 +906,7 @@ gen_expand (rtx insn, int lineno) 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); @@ -945,6 +950,7 @@ gen_split (rtx split, int lineno) d->code_number = next_code_number; d->index_number = next_index_number; + d->filename = read_rtx_filename; d->lineno = lineno; d->name = 0; diff --git a/gcc/genrecog.c b/gcc/genrecog.c index c1d559ffe74..097faefe8c2 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -2168,7 +2168,9 @@ write_action (struct decision *p, struct decision_test *test, if (test->u.insn.num_clobbers_to_add != 0) printf ("%s*pnum_clobbers = %d;\n", indent, test->u.insn.num_clobbers_to_add); - printf ("%sreturn %d;\n", indent, test->u.insn.code_number); + printf ("%sreturn %d; /* %s */\n", indent, + test->u.insn.code_number, + insn_name_ptr[test->u.insn.code_number]); break; case SPLIT: