diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/d2c/syntax/manager.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tools/d2c/syntax/manager.c b/tools/d2c/syntax/manager.c index cfbf826..6857e9a 100644 --- a/tools/d2c/syntax/manager.c +++ b/tools/d2c/syntax/manager.c @@ -230,12 +230,14 @@ bool declare_syntax_items(const asm_syntax *syntax, int fd, const coding_bits *b { bool result; /* Bilan à retourner */ bool has_operand; /* Présence d'un opérande */ + bool has_immediate; /* Présence d'une conversion */ size_t i; /* Boucle de parcours */ syntax_item *item; /* Lien vers un opérande */ result = true; has_operand = false; + has_immediate = false; for (i = 0; i < syntax->items_count && result; i++) { @@ -244,11 +246,17 @@ bool declare_syntax_items(const asm_syntax *syntax, int fd, const coding_bits *b has_operand |= (item->impact == SIT_EXT_OPERAND); + if (has_operand) + has_immediate = (item->flags & SIF_DECIMAL); + } if (has_operand) dprintf(fd, "\t\tGArchOperand *op;\n"); + if (has_immediate) + dprintf(fd, "\t\tGImmOperand *imm;\n"); + return result; } @@ -355,7 +363,11 @@ bool define_syntax_items(const asm_syntax *syntax, int fd, const char *arch, con 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\timm = G_IMM_OPERAND(op)\n"); + dprintf(fd, "\t\tg_imm_operand_set_default_display(&imm, IOD_DEC, NULL);\n"); + dprintf(fd, "\t\timm = G_IMM_OPERAND(op)\n"); + } dprintf(fd, "\t\tg_arch_instruction_attach_extra_operand(instr, op);\n"); @@ -382,7 +394,11 @@ bool define_syntax_items(const asm_syntax *syntax, int fd, const char *arch, con 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\timm = G_IMM_OPERAND(op)\n"); + dprintf(fd, "\t\tg_imm_operand_set_default_display(&imm, IOD_DEC, NULL);\n"); + dprintf(fd, "\t\timm = G_IMM_OPERAND(op)\n"); + } dprintf(fd, "\t\tg_arch_instruction_attach_extra_operand(instr, op);\n"); |