diff options
Diffstat (limited to 'tools/d2c/syntax')
-rw-r--r-- | tools/d2c/syntax/manager.c | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/tools/d2c/syntax/manager.c b/tools/d2c/syntax/manager.c index ae2a71b..02d9813 100644 --- a/tools/d2c/syntax/manager.c +++ b/tools/d2c/syntax/manager.c @@ -201,7 +201,7 @@ bool mark_syntax_items(const asm_syntax *syntax, const coding_bits *bits, const result = false; } - result = mark_conv_func(func, bits, list); + result = mark_conv_func(func, false, bits, list); } @@ -232,7 +232,6 @@ bool declare_syntax_items(const asm_syntax *syntax, int fd, const coding_bits *b bool has_operand; /* Présence d'un opérande */ size_t i; /* Boucle de parcours */ syntax_item *item; /* Lien vers un opérande */ - conv_func *func; /* Fonction de conversion */ result = true; @@ -245,15 +244,6 @@ bool declare_syntax_items(const asm_syntax *syntax, int fd, const coding_bits *b has_operand |= (item->impact == SIT_EXT_OPERAND); - func = find_named_conv_in_list(list, item->name); - if (func == NULL) - { - fprintf(stderr, "Error: expected conversion for '%s'.\n", item->name); - result = false; - } - - result &= declare_conv_func(func, fd, bits, list, wide); - } if (has_operand) @@ -329,14 +319,22 @@ bool define_syntax_items(const asm_syntax *syntax, int fd, const char *arch, con { case SIT_KEYWORD: + /** + * TODO : à faire évoluer vers extend... + */ + //_exit(123); + + // rev_A88146 + /* if (i > 0) dprintf(fd, "\t\tg_arch_instruction_append_suffix(instr, \"%s\");\n", item->name); else continue; + */ break; - case SIT_INT_OPERAND: + case SIT_INT_OPERAND: // A supprimer case SIT_EXT_OPERAND: internal = (item->impact == SIT_INT_OPERAND); @@ -350,17 +348,9 @@ bool define_syntax_items(const asm_syntax *syntax, int fd, const char *arch, con /* Appel proprement dit */ - result &= define_conv_func(func, true, internal, fd, arch, bits, list, pp); - if (!result) break; - - /* Raccordement : propriété ou opérande ? */ - - if (internal) - dprintf(fd, "\t\t\tgoto bad_exit;\n"); - - else + if (is_conv_func_already_defined(func)) { - dprintf(fd, "\t\tif (op == NULL) goto bad_exit;\n"); + dprintf(fd, "\t\top = val_%s;\n", item->name); dprintf(fd, "\n"); @@ -371,6 +361,35 @@ bool define_syntax_items(const asm_syntax *syntax, int fd, const char *arch, con } + else + { + result &= define_conv_func(func, true, internal, fd, arch, bits, list, pp, exit); + if (!result) break; + + /* Raccordement : propriété ou opérande ? */ + + if (internal) + { + dprintf(fd, "\t\t\tgoto bad_exit;\n"); + *exit = true; + } + + else + { + dprintf(fd, "\t\tif (op == NULL) goto bad_exit;\n"); + *exit = true; + + dprintf(fd, "\n"); + + if (item->flags & SIF_DECIMAL) + dprintf(fd, "\t\tg_imm_operand_set_default_display(G_IMM_OPERAND(op), IOD_DEC);\n"); + + dprintf(fd, "\t\tg_arch_instruction_attach_extra_operand(instr, op);\n"); + + } + + } + *exit = true; break; |