summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/d2c/spec.c32
-rw-r--r--tools/d2c/syntax.c4
-rw-r--r--tools/d2c/syntax.h2
3 files changed, 23 insertions, 15 deletions
diff --git a/tools/d2c/spec.c b/tools/d2c/spec.c
index 7d65cab..cf1a066 100644
--- a/tools/d2c/spec.c
+++ b/tools/d2c/spec.c
@@ -266,7 +266,8 @@ bool write_encoding_spec_disass(const encoding_spec *spec, int fd, const char *a
{
bool result; /* Bilan à retourner */
char *keyword; /* Mot clef appelable en code */
- bool exit; /* Inclusion de sortie rapide ?*/
+ bool quick_exit; /* Inclusion de sortie rapide ?*/
+ bool bad_exit; /* Ajout d'une sortie d'échec ?*/
const char *new_ins; /* Nouvelle définition de nom */
result = true;
@@ -304,13 +305,13 @@ bool write_encoding_spec_disass(const encoding_spec *spec, int fd, const char *a
/* Inclusion des éventuelles règles */
- exit = false;
+ quick_exit = false;
result &= write_decoding_rules(spec->rules, CAT_SEE,
- fd, arch, subarch, spec->bits, spec->conversions, pp, &exit);
+ fd, arch, subarch, spec->bits, spec->conversions, pp, &quick_exit);
result &= write_decoding_rules(spec->rules, CAT_UNPREDICTABLE,
- fd, arch, subarch, spec->bits, spec->conversions, pp, &exit);
+ fd, arch, subarch, spec->bits, spec->conversions, pp, &quick_exit);
/* Création de l'instruction en elle-même */
@@ -325,18 +326,20 @@ bool write_encoding_spec_disass(const encoding_spec *spec, int fd, const char *a
result &= write_hook_functions(spec->hooks, fd);
result &= write_decoding_rules(spec->rules, CAT_CHECKED_CALL,
- fd, arch, subarch, spec->bits, spec->conversions, pp, &exit);
+ fd, arch, subarch, spec->bits, spec->conversions, pp, &quick_exit);
result &= write_decoding_rules(spec->rules, CAT_CALL,
- fd, arch, subarch, spec->bits, spec->conversions, pp, &exit);
+ fd, arch, subarch, spec->bits, spec->conversions, pp, &quick_exit);
/* Création des opérandes */
- result &= define_syntax_items(spec->syntax, fd, arch, spec->bits, spec->conversions, pp);
+ bad_exit = false;
+
+ result &= define_syntax_items(spec->syntax, fd, arch, spec->bits, spec->conversions, pp, &bad_exit);
/* Conclusion de la procédure */
- if (exit)
+ if (quick_exit)
{
dprintf(fd, "\t quick_exit:\n");
dprintf(fd, "\n");
@@ -346,14 +349,17 @@ bool write_encoding_spec_disass(const encoding_spec *spec, int fd, const char *a
dprintf(fd, "\n");
- dprintf(fd, "\t bad_exit:\n");
+ if (bad_exit)
+ {
+ dprintf(fd, "\t bad_exit:\n");
+ dprintf(fd, "\n");
- dprintf(fd, "\n");
+ dprintf(fd, "\t\tg_object_unref(G_OBJECT(instr));\n");
+ dprintf(fd, "\t\treturn NULL;\n");
- dprintf(fd, "\t\tg_object_unref(G_OBJECT(instr));\n");
- dprintf(fd, "\t\treturn NULL;\n");
+ dprintf(fd, "\n");
- dprintf(fd, "\n");
+ }
dprintf(fd, "\t}\n");
diff --git a/tools/d2c/syntax.c b/tools/d2c/syntax.c
index 14d13d9..2dad772 100644
--- a/tools/d2c/syntax.c
+++ b/tools/d2c/syntax.c
@@ -301,6 +301,7 @@ const char *get_new_keyword_from_syntax_items(const asm_syntax *syntax)
* bits = gestionnaire des bits d'encodage. *
* list = liste de l'ensemble des fonctions de conversion. *
* pp = pré-processeur pour les échanges de chaînes. *
+* exit = exprime le besoin d'une voie de sortie. [OUT] *
* *
* Description : Définit les variables C associées aux opérandes de syntaxe. *
* *
@@ -310,7 +311,7 @@ const char *get_new_keyword_from_syntax_items(const asm_syntax *syntax)
* *
******************************************************************************/
-bool define_syntax_items(const asm_syntax *syntax, int fd, const char *arch, const coding_bits *bits, const conv_list *list, const pre_processor *pp)
+bool define_syntax_items(const asm_syntax *syntax, int fd, const char *arch, const coding_bits *bits, const conv_list *list, const pre_processor *pp, bool *exit)
{
bool result; /* Bilan à retourner */
size_t i; /* Boucle de parcours */
@@ -370,6 +371,7 @@ bool define_syntax_items(const asm_syntax *syntax, int fd, const char *arch, con
}
+ *exit = true;
break;
}
diff --git a/tools/d2c/syntax.h b/tools/d2c/syntax.h
index fc7cc6b..70b3609 100644
--- a/tools/d2c/syntax.h
+++ b/tools/d2c/syntax.h
@@ -66,7 +66,7 @@ bool declare_syntax_items(const asm_syntax *, int, const coding_bits *, const co
const char *get_new_keyword_from_syntax_items(const asm_syntax *);
/* Définit les variables C associées aux opérandes de syntaxe. */
-bool define_syntax_items(const asm_syntax *, int, const char *, const coding_bits *, const conv_list *, const pre_processor *);
+bool define_syntax_items(const asm_syntax *, int, const char *, const coding_bits *, const conv_list *, const pre_processor *, bool *);