diff options
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 10 | ||||
-rw-r--r-- | opcodes/aarch64-dis.c | 49 | ||||
-rw-r--r-- | opcodes/aarch64-opc.c | 33 |
3 files changed, 72 insertions, 20 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 1380def..cb610be 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,5 +1,15 @@ 2016-09-21 Richard Sandiford <richard.sandiford@arm.com> + * aarch64-dis.c (remove_dot_suffix): New function, split out from... + (print_mnemonic_name): ...here. + (print_comment): New function. + (print_aarch64_insn): Call it. + * aarch64-opc.c (aarch64_conds): Add SVE names. + (aarch64_print_operand): Print alternative condition names in + a comment. + +2016-09-21 Richard Sandiford <richard.sandiford@arm.com> + * aarch64-tbl.h (OP_SVE_B, OP_SVE_BB, OP_SVE_BBBU, OP_SVE_BMB) (OP_SVE_BPB, OP_SVE_BUB, OP_SVE_BUBB, OP_SVE_BUU, OP_SVE_BZ) (OP_SVE_BZB, OP_SVE_BZBB, OP_SVE_BZU, OP_SVE_DD, OP_SVE_DDD) diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c index 673d6e5..82afe8b 100644 --- a/opcodes/aarch64-dis.c +++ b/opcodes/aarch64-dis.c @@ -2787,6 +2787,22 @@ print_operands (bfd_vma pc, const aarch64_opcode *opcode, } } +/* Set NAME to a copy of INST's mnemonic with the "." suffix removed. */ + +static void +remove_dot_suffix (char *name, const aarch64_inst *inst) +{ + char *ptr; + size_t len; + + ptr = strchr (inst->opcode->name, '.'); + assert (ptr && inst->cond); + len = ptr - inst->opcode->name; + assert (len < 8); + strncpy (name, inst->opcode->name, len); + name[len] = '\0'; +} + /* Print the instruction mnemonic name. */ static void @@ -2797,21 +2813,35 @@ print_mnemonic_name (const aarch64_inst *inst, struct disassemble_info *info) /* For instructions that are truly conditionally executed, e.g. b.cond, prepare the full mnemonic name with the corresponding condition suffix. */ - char name[8], *ptr; - size_t len; - - ptr = strchr (inst->opcode->name, '.'); - assert (ptr && inst->cond); - len = ptr - inst->opcode->name; - assert (len < 8); - strncpy (name, inst->opcode->name, len); - name [len] = '\0'; + char name[8]; + + remove_dot_suffix (name, inst); (*info->fprintf_func) (info->stream, "%s.%s", name, inst->cond->names[0]); } else (*info->fprintf_func) (info->stream, "%s", inst->opcode->name); } +/* Decide whether we need to print a comment after the operands of + instruction INST. */ + +static void +print_comment (const aarch64_inst *inst, struct disassemble_info *info) +{ + if (inst->opcode->flags & F_COND) + { + char name[8]; + unsigned int i, num_conds; + + remove_dot_suffix (name, inst); + num_conds = ARRAY_SIZE (inst->cond->names); + for (i = 1; i < num_conds && inst->cond->names[i]; ++i) + (*info->fprintf_func) (info->stream, "%s %s.%s", + i == 1 ? " //" : ",", + name, inst->cond->names[i]); + } +} + /* Print the instruction according to *INST. */ static void @@ -2820,6 +2850,7 @@ print_aarch64_insn (bfd_vma pc, const aarch64_inst *inst, { print_mnemonic_name (inst, info); print_operands (pc, inst->opcode, inst->operands, info); + print_comment (inst, info); } /* Entry-point of the instruction disassembler and printer. */ diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c index d22e419..b07429d 100644 --- a/opcodes/aarch64-opc.c +++ b/opcodes/aarch64-opc.c @@ -334,18 +334,18 @@ aarch64_get_operand_desc (enum aarch64_opnd type) /* Table of all conditional affixes. */ const aarch64_cond aarch64_conds[16] = { - {{"eq"}, 0x0}, - {{"ne"}, 0x1}, - {{"cs", "hs"}, 0x2}, - {{"cc", "lo", "ul"}, 0x3}, - {{"mi"}, 0x4}, - {{"pl"}, 0x5}, + {{"eq", "none"}, 0x0}, + {{"ne", "any"}, 0x1}, + {{"cs", "hs", "nlast"}, 0x2}, + {{"cc", "lo", "ul", "last"}, 0x3}, + {{"mi", "first"}, 0x4}, + {{"pl", "nfrst"}, 0x5}, {{"vs"}, 0x6}, {{"vc"}, 0x7}, - {{"hi"}, 0x8}, - {{"ls"}, 0x9}, - {{"ge"}, 0xa}, - {{"lt"}, 0xb}, + {{"hi", "pmore"}, 0x8}, + {{"ls", "plast"}, 0x9}, + {{"ge", "tcont"}, 0xa}, + {{"lt", "tstop"}, 0xb}, {{"gt"}, 0xc}, {{"le"}, 0xd}, {{"al"}, 0xe}, @@ -2940,7 +2940,7 @@ aarch64_print_operand (char *buf, size_t size, bfd_vma pc, const aarch64_opnd_info *opnds, int idx, int *pcrel_p, bfd_vma *address) { - int i; + unsigned int i, num_conds; const char *name = NULL; const aarch64_opnd_info *opnd = opnds + idx; enum aarch64_modifier_kind kind; @@ -3306,6 +3306,17 @@ aarch64_print_operand (char *buf, size_t size, bfd_vma pc, case AARCH64_OPND_COND: case AARCH64_OPND_COND1: snprintf (buf, size, "%s", opnd->cond->names[0]); + num_conds = ARRAY_SIZE (opnd->cond->names); + for (i = 1; i < num_conds && opnd->cond->names[i]; ++i) + { + size_t len = strlen (buf); + if (i == 1) + snprintf (buf + len, size - len, " // %s = %s", + opnd->cond->names[0], opnd->cond->names[i]); + else + snprintf (buf + len, size - len, ", %s", + opnd->cond->names[i]); + } break; case AARCH64_OPND_ADDR_ADRP: |