mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 09:58:19 +08:00
AArch64: Refactor err_type.
Previously the ERR_ values were defined as different constants, to make this a bit more type safe and so they can be more easily re-used I'm changing them into an actual enum and updating any usages. include/ * opcode/aarch64.h (enum err_type): New. (aarch64_decode_insn): Use it. opcodes/ * aarch64-dis.c (ERR_OK, ERR_UND, ERR_UNP, ERR_NYI): Remove. (aarch64_decode_insn, print_insn_aarch64_word): Use err_type.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2018-10-03 Tamar Christina <tamar.christina@arm.com>
|
||||||
|
|
||||||
|
* opcode/aarch64.h (enum err_type): New.
|
||||||
|
(aarch64_decode_insn): Use it.
|
||||||
|
|
||||||
2018-10-03 Tamar Christina <tamar.christina@arm.com>
|
2018-10-03 Tamar Christina <tamar.christina@arm.com>
|
||||||
|
|
||||||
* opcode/aarch64.h (struct aarch64_instr_sequence): New.
|
* opcode/aarch64.h (struct aarch64_instr_sequence): New.
|
||||||
|
@ -641,6 +641,16 @@ enum aarch64_op
|
|||||||
OP_TOTAL_NUM, /* Pseudo. */
|
OP_TOTAL_NUM, /* Pseudo. */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Error types. */
|
||||||
|
enum err_type
|
||||||
|
{
|
||||||
|
ERR_OK,
|
||||||
|
ERR_UND,
|
||||||
|
ERR_UNP,
|
||||||
|
ERR_NYI,
|
||||||
|
ERR_NR_ENTRIES
|
||||||
|
};
|
||||||
|
|
||||||
/* Maximum number of operands an instruction can have. */
|
/* Maximum number of operands an instruction can have. */
|
||||||
#define AARCH64_MAX_OPND_NUM 6
|
#define AARCH64_MAX_OPND_NUM 6
|
||||||
/* Maximum number of qualifier sequences an instruction can have. */
|
/* Maximum number of qualifier sequences an instruction can have. */
|
||||||
@ -1187,7 +1197,7 @@ aarch64_stack_pointer_p (const aarch64_opnd_info *);
|
|||||||
extern int
|
extern int
|
||||||
aarch64_zero_register_p (const aarch64_opnd_info *);
|
aarch64_zero_register_p (const aarch64_opnd_info *);
|
||||||
|
|
||||||
extern int
|
extern enum err_type
|
||||||
aarch64_decode_insn (aarch64_insn, aarch64_inst *, bfd_boolean,
|
aarch64_decode_insn (aarch64_insn, aarch64_inst *, bfd_boolean,
|
||||||
aarch64_operand_error *errors);
|
aarch64_operand_error *errors);
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2018-10-03 Tamar Christina <tamar.christina@arm.com>
|
||||||
|
|
||||||
|
* aarch64-dis.c (ERR_OK, ERR_UND, ERR_UNP, ERR_NYI): Remove.
|
||||||
|
(aarch64_decode_insn, print_insn_aarch64_word): Use err_type.
|
||||||
|
|
||||||
2018-10-03 Tamar Christina <tamar.christina@arm.com>
|
2018-10-03 Tamar Christina <tamar.christina@arm.com>
|
||||||
|
|
||||||
* aarch64-asm.c (aarch64_opcode_encode): Add insn_sequence.
|
* aarch64-asm.c (aarch64_opcode_encode): Add insn_sequence.
|
||||||
|
@ -26,11 +26,6 @@
|
|||||||
#include "aarch64-dis.h"
|
#include "aarch64-dis.h"
|
||||||
#include "elf-bfd.h"
|
#include "elf-bfd.h"
|
||||||
|
|
||||||
#define ERR_OK 0
|
|
||||||
#define ERR_UND -1
|
|
||||||
#define ERR_UNP -3
|
|
||||||
#define ERR_NYI -5
|
|
||||||
|
|
||||||
#define INSNLEN 4
|
#define INSNLEN 4
|
||||||
|
|
||||||
/* Cached mapping symbol state. */
|
/* Cached mapping symbol state. */
|
||||||
@ -2945,7 +2940,7 @@ user_friendly_fixup (aarch64_inst *inst)
|
|||||||
opcode may be filled in *INSN if NOALIASES_P is FALSE. Return zero on
|
opcode may be filled in *INSN if NOALIASES_P is FALSE. Return zero on
|
||||||
success. */
|
success. */
|
||||||
|
|
||||||
int
|
enum err_type
|
||||||
aarch64_decode_insn (aarch64_insn insn, aarch64_inst *inst,
|
aarch64_decode_insn (aarch64_insn insn, aarch64_inst *inst,
|
||||||
bfd_boolean noaliases_p,
|
bfd_boolean noaliases_p,
|
||||||
aarch64_operand_error *errors)
|
aarch64_operand_error *errors)
|
||||||
@ -3097,15 +3092,15 @@ print_insn_aarch64_word (bfd_vma pc,
|
|||||||
struct disassemble_info *info,
|
struct disassemble_info *info,
|
||||||
aarch64_operand_error *errors)
|
aarch64_operand_error *errors)
|
||||||
{
|
{
|
||||||
static const char *err_msg[6] =
|
static const char *err_msg[ERR_NR_ENTRIES+1] =
|
||||||
{
|
{
|
||||||
[ERR_OK] = "_",
|
[ERR_OK] = "_",
|
||||||
[-ERR_UND] = "undefined",
|
[ERR_UND] = "undefined",
|
||||||
[-ERR_UNP] = "unpredictable",
|
[ERR_UNP] = "unpredictable",
|
||||||
[-ERR_NYI] = "NYI"
|
[ERR_NYI] = "NYI"
|
||||||
};
|
};
|
||||||
|
|
||||||
int ret;
|
enum err_type ret;
|
||||||
aarch64_inst inst;
|
aarch64_inst inst;
|
||||||
|
|
||||||
info->insn_info_valid = 1;
|
info->insn_info_valid = 1;
|
||||||
@ -3139,7 +3134,7 @@ print_insn_aarch64_word (bfd_vma pc,
|
|||||||
/* Handle undefined instructions. */
|
/* Handle undefined instructions. */
|
||||||
info->insn_type = dis_noninsn;
|
info->insn_type = dis_noninsn;
|
||||||
(*info->fprintf_func) (info->stream,".inst\t0x%08x ; %s",
|
(*info->fprintf_func) (info->stream,".inst\t0x%08x ; %s",
|
||||||
word, err_msg[-ret]);
|
word, err_msg[ret]);
|
||||||
break;
|
break;
|
||||||
case ERR_OK:
|
case ERR_OK:
|
||||||
user_friendly_fixup (&inst);
|
user_friendly_fixup (&inst);
|
||||||
|
Reference in New Issue
Block a user