This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Committed, sim/igen: print field conditionals in format strings in output
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 8 Jul 2011 10:38:01 +0200
- Subject: Committed, sim/igen: print field conditionals in format strings in output
I noticed that the format-strings in comments in the generated
semantics and the format field in the itable vector did not have
the conditionals printed, which somewhat reduces the usefulness
of those emitted strings for simulator machine descriptions
where most differences are in the field conditionals! This is
better. Committed after checking that intended changes (and
none other, AFAICS) *are* in the code generated for mips-elf
mn10300-elf v850-elf powerpc-eabisim mips64vrel-elf
mipsisa32r2-elf. I think this concludes my "upstream fallout"
from local changes for this time.
* ld-insn.c (print_insn_words): For fields, print conditionals.
Index: ld-insn.c
===================================================================
RCS file: /cvs/src/src/sim/igen/ld-insn.c,v
retrieving revision 1.10
diff -p -u -r1.10 ld-insn.c
--- ld-insn.c 8 Jul 2011 02:27:18 -0000 1.10
+++ ld-insn.c 8 Jul 2011 08:32:12 -0000
@@ -1289,6 +1289,8 @@ print_insn_words (lf *file, insn_entry *
insn_field_entry *field = word->first;
while (1)
{
+ insn_field_cond *cond;
+
if (options.insn_specifying_widths)
lf_printf (file, "%d.", field->width);
else
@@ -1310,6 +1312,34 @@ print_insn_words (lf *file, insn_entry *
break;
case insn_field_string:
lf_printf (file, "%s", field->val_string);
+
+ if (field->conditions == NULL)
+ break;
+
+ if (field->conditions->test == insn_field_cond_eq)
+ {
+ if (field->conditions->type == insn_field_cond_value)
+ lf_printf (file, "=%ld",
+ (long) field->conditions->value);
+ else
+ lf_printf (file, "=%s", field->conditions->string);
+
+ /* There can be only one equality condition. */
+ ASSERT (field->conditions->next == NULL);
+ break;
+ }
+
+ for (cond = field->conditions;
+ cond != NULL;
+ cond = cond->next)
+ {
+ ASSERT (cond->test == insn_field_cond_ne);
+
+ if (cond->type == insn_field_cond_value)
+ lf_printf (file, "!%ld", (long) cond->value);
+ else
+ lf_printf (file, "!%s", cond->string);
+ }
break;
}
if (field == word->last)
brgds, H-P