summaryrefslogtreecommitdiff
path: root/tools/d2c/coder.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-12-03 22:41:29 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-12-03 22:41:29 (GMT)
commit172fce9bab61de1ffa89f731b5d10f96e209afc1 (patch)
tree31aee5a141979fa99bbf88cbf2b7990de0ec3832 /tools/d2c/coder.c
parentf7ef27195f8c9dc35e5e210a333b74fcfae5ad71 (diff)
Begun to support more than the only 'ARMv7' architecture for ARM (ARM / Thumb16 / Thumb32).
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@433 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'tools/d2c/coder.c')
-rw-r--r--tools/d2c/coder.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/tools/d2c/coder.c b/tools/d2c/coder.c
index 5856d80..b4bf21f 100644
--- a/tools/d2c/coder.c
+++ b/tools/d2c/coder.c
@@ -455,6 +455,7 @@ bool dump_all_routines_using_coder(const rented_coder *coder)
const string_exch *encoding; /* Type d'encodage visé */
bool exist; /* Présence du fichier visé ? */
int header_fd; /* Fichier de déclarations */
+ char *uname; /* Nom en majuscule */
char *dash; /* Présence d'un tiret ? */
char *filename; /* Nom de fichier commun */
int code_fd; /* Fichier de définitions */
@@ -472,8 +473,12 @@ bool dump_all_routines_using_coder(const rented_coder *coder)
if (!exist)
{
- dprintf(header_fd, "#ifndef %s_OPCODES_OPCODES_H\n", coder->header);
- dprintf(header_fd, "#define %s_OPCODES_OPCODES_H\n", coder->header);
+ uname = make_string_upper(strdup(encoding->dest));
+
+ dprintf(header_fd, "#ifndef %s_%sOPCODES_OPCODES_H\n", coder->header, uname);
+ dprintf(header_fd, "#define %s_%sOPCODES_OPCODES_H\n", coder->header, uname);
+
+ free(uname);
dprintf(header_fd, "\n");
dprintf(header_fd, "\n");
@@ -506,7 +511,7 @@ bool dump_all_routines_using_coder(const rented_coder *coder)
if (!exist)
{
- dprintf(code_fd, "#include \"opcodes.h\"\n");
+ dprintf(code_fd, "#include \"%sopcodes.h\"\n", encoding->dest);
dprintf(code_fd, "\n");
dprintf(code_fd, "##INCLUDES##\n");
@@ -584,7 +589,8 @@ static bool dump_all_matching_specs_in_coder(const rented_coder *coder, const st
/* Désassemblage : déclaration */
dprintf(hfd, "/* Décode une instruction de type '%s'. */\n", coder->ins);
- dprintf(hfd, "GArchInstruction *%s_read_instr_%s%s(uint%u_t);\n", coder->arch, keyword, coder->details, wide);
+ dprintf(hfd, "GArchInstruction *%s_read_%sinstr_%s%s(uint%u_t);\n",
+ coder->arch, encoding->dest, keyword, coder->details, wide);
dprintf(hfd, "\n");
/* Désassemblage : définitions */
@@ -613,7 +619,8 @@ static bool dump_all_matching_specs_in_coder(const rented_coder *coder, const st
dprintf(cfd, "\n");
- dprintf(cfd, "GArchInstruction *%s_read_instr_%s%s(uint%u_t raw)", coder->arch, keyword, coder->details, wide);
+ dprintf(cfd, "GArchInstruction *%s_read_%sinstr_%s%s(uint%u_t raw)",
+ coder->arch, encoding->dest, keyword, coder->details, wide);
dprintf(cfd, "\n");
dprintf(cfd, "{");
dprintf(cfd, "\n");
@@ -631,7 +638,8 @@ static bool dump_all_matching_specs_in_coder(const rented_coder *coder, const st
if (!has_encoding_spec_prefix(spec, encoding->src))
continue;
- result = write_encoding_spec_disass(spec, cfd, coder->arch, coder->ins, coder->details, wide, coder->pp);
+ result = write_encoding_spec_disass(spec, cfd, coder->arch, encoding->dest,
+ coder->ins, coder->details, wide, coder->pp);
}