aboutsummaryrefslogtreecommitdiff
path: root/target/xtensa/helper.c
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2019-02-09 23:39:10 -0800
committerMax Filippov <jcmvbkbc@gmail.com>2019-02-18 21:29:08 -0800
commitd863fcf7f5b4f363e7ba2f95ce622f93dd4e866d (patch)
treed33f8e0e230d8a68a980be5e6d3ea06470e79547 /target/xtensa/helper.c
parent759039737504c3f11098f7240c6048c6279e2215 (diff)
target/xtensa: allow multiple names for single opcode
There are opcodes that differ only in encoding or possible range of immediate arguments. Allow multiple names for single opcode translation table entry to reduce code duplication in that case. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'target/xtensa/helper.c')
-rw-r--r--target/xtensa/helper.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c
index 57709fc20c..7008c6390d 100644
--- a/target/xtensa/helper.c
+++ b/target/xtensa/helper.c
@@ -51,9 +51,19 @@ static GHashTable *hash_opcode_translators(const XtensaOpcodeTranslators *t)
GHashTable *translator = g_hash_table_new(g_str_hash, g_str_equal);
for (i = 0; i < t->num_opcodes; ++i) {
- add_translator_to_hash(translator,
- (void *)t->opcode[i].name,
- (void *)(t->opcode + i));
+ if (t->opcode[i].op_flags & XTENSA_OP_NAME_ARRAY) {
+ const char * const *name = t->opcode[i].name;
+
+ for (j = 0; name[j]; ++j) {
+ add_translator_to_hash(translator,
+ (void *)name[j],
+ (void *)(t->opcode + i));
+ }
+ } else {
+ add_translator_to_hash(translator,
+ (void *)t->opcode[i].name,
+ (void *)(t->opcode + i));
+ }
}
return translator;
}