aboutsummaryrefslogtreecommitdiff
path: root/opcodes/aarch64-gen.c
diff options
context:
space:
mode:
authorJiong Wang <jiong.wang@arm.com>2017-07-24 11:26:58 +0100
committerJiong Wang <jiong.wang@arm.com>2017-07-24 14:59:06 +0100
commit7684e58062af4886aceb05ecd83a956bfcd14aaf (patch)
treeb4dcb4e52ff68cd9c92b860649632709b189e4fc /opcodes/aarch64-gen.c
parent8a2df5e2df374289e00ecd8f099eb46d76ef982e (diff)
downloadgdb-7684e58062af4886aceb05ecd83a956bfcd14aaf.zip
gdb-7684e58062af4886aceb05ecd83a956bfcd14aaf.tar.gz
gdb-7684e58062af4886aceb05ecd83a956bfcd14aaf.tar.bz2
[AArch64] Fix the bit pattern order in the comments in auto-generated file
The bit pattern comment in "aarch64_opcode_lookup_1" is reversed. This patch fixed this. opcode/ * aarch64-gen.c (print_decision_tree_1): Reverse the index of PATTERN to correct the print. * aarch64-dis-2.c: Regenerated.
Diffstat (limited to 'opcodes/aarch64-gen.c')
-rw-r--r--opcodes/aarch64-gen.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/opcodes/aarch64-gen.c b/opcodes/aarch64-gen.c
index d2685dc..229da21 100644
--- a/opcodes/aarch64-gen.c
+++ b/opcodes/aarch64-gen.c
@@ -393,6 +393,9 @@ print_decision_tree_1 (unsigned int indent, struct bittree* bittree)
{
/* PATTERN is only used to generate comment in the code. */
static char pattern[33] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+ /* Low bits in PATTERN will be printed first which then look as the high
+ bits in comment. We need to reverse the index to get correct print. */
+ unsigned int msb = sizeof (pattern) - 2;
assert (bittree != NULL);
/* Leaf node located. */
@@ -412,15 +415,15 @@ print_decision_tree_1 (unsigned int indent, struct bittree* bittree)
/* Walk down the decoder tree. */
indented_print (indent, "if (((word >> %d) & 0x1) == 0)\n", bittree->bitno);
indented_print (indent, " {\n");
- pattern[bittree->bitno] = '0';
+ pattern[msb - bittree->bitno] = '0';
print_decision_tree_1 (indent + 4, bittree->bits[0]);
indented_print (indent, " }\n");
indented_print (indent, "else\n");
indented_print (indent, " {\n");
- pattern[bittree->bitno] = '1';
+ pattern[msb - bittree->bitno] = '1';
print_decision_tree_1 (indent + 4, bittree->bits[1]);
indented_print (indent, " }\n");
- pattern[bittree->bitno] = 'x';
+ pattern[msb - bittree->bitno] = 'x';
}
/* Generate aarch64_opcode_lookup in C code to the standard output. */