diff options
author | Hans-Peter Nilsson <hp@axis.com> | 2011-07-08 06:24:11 +0000 |
---|---|---|
committer | Hans-Peter Nilsson <hp@axis.com> | 2011-07-08 06:24:11 +0000 |
commit | a950b351ac34fd4eb1e737d33239f4719efbaa84 (patch) | |
tree | fa8f6138fe2dea20a05567a75ea9afaa28e8de67 /sim/igen/gen.c | |
parent | 27d1cc7cca74da1ad194ffb8249b371e650f68a9 (diff) | |
download | gdb-a950b351ac34fd4eb1e737d33239f4719efbaa84.tar.gz |
Correct handling of constant fields.
* gen.c (insn_field_cmp): Tweak comment about neither field
being an insn_field_string with a cond_eq-to-value condition.
(insns_bit_useless) <case insn_field_string, case
decode_find_mixed>: Handle cond_eq-to-value fields as
insn_field_int.
* gen-idecode.c (print_idecode_validate): Handle
insn_field_string cond-equal-to-value fields as insn_field_int.
* gen-icache.c (print_icache_body): Add comment why constant
string fields are handled.
Diffstat (limited to 'sim/igen/gen.c')
-rw-r--r-- | sim/igen/gen.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sim/igen/gen.c b/sim/igen/gen.c index 5c1b4be52d0..9b767117207 100644 --- a/sim/igen/gen.c +++ b/sim/igen/gen.c @@ -151,7 +151,9 @@ insn_field_cmp (insn_word_entry *l, insn_word_entry *r) return -1; /* The case of both fields having constant values should have already have been handled because such fields are converted - into normal constant fields. */ + into normal constant fields, but we must not make this + an assert, as we wouldn't gracefully handle an (invalid) + duplicate insn description. */ continue; } if (l->bit[bit_nr]->field->conditions->test == insn_field_cond_eq) @@ -611,6 +613,18 @@ insns_bit_useless (insn_list *insns, decode_table *rule, int bit_nr) bit->field->val_string)) /* a string field forced to constant? */ is_useless = 0; + else if (bit->field->conditions != NULL + && bit->field->conditions->test == insn_field_cond_eq + && bit->field->conditions->type == insn_field_cond_value) + { + int shift = bit->field->last - bit_nr; + int bitvalue = (bit->field->conditions->value >> shift) & 1; + + if (value < 0) + value = bitvalue; + else if (value != bitvalue) + is_useless = 0; + } else if (rule->search == decode_find_constants) /* the string field isn't constant */ return 1; |