25 #ifndef OPCODE_AARCH64_H
26 #define OPCODE_AARCH64_H
38 #define AARCH64_PCREL_OFFSET 0
43 #define AARCH64_FEATURE_SHA2 0x200000000ULL
44 #define AARCH64_FEATURE_AES 0x800000000ULL
45 #define AARCH64_FEATURE_V8_4 0x000000800ULL
46 #define AARCH64_FEATURE_SM4 0x100000000ULL
47 #define AARCH64_FEATURE_SHA3 0x400000000ULL
48 #define AARCH64_FEATURE_V8 0x00000001
49 #define AARCH64_FEATURE_V8_2 0x00000020
50 #define AARCH64_FEATURE_V8_3 0x00000040
51 #define AARCH64_FEATURE_CRYPTO 0x00010000
52 #define AARCH64_FEATURE_FP 0x00020000
53 #define AARCH64_FEATURE_SIMD 0x00040000
54 #define AARCH64_FEATURE_CRC 0x00080000
55 #define AARCH64_FEATURE_LSE 0x00100000
56 #define AARCH64_FEATURE_PAN 0x00200000
57 #define AARCH64_FEATURE_LOR 0x00400000
58 #define AARCH64_FEATURE_RDMA 0x00800000
59 #define AARCH64_FEATURE_V8_1 0x01000000
60 #define AARCH64_FEATURE_F16 0x02000000
61 #define AARCH64_FEATURE_RAS 0x04000000
62 #define AARCH64_FEATURE_PROFILE 0x08000000
63 #define AARCH64_FEATURE_SVE 0x10000000
64 #define AARCH64_FEATURE_RCPC 0x20000000
65 #define AARCH64_FEATURE_COMPNUM 0x40000000
66 #define AARCH64_FEATURE_DOTPROD 0x080000000
67 #define AARCH64_FEATURE_F16_FML 0x1000000000ULL
70 #define AARCH64_ARCH_V8 AARCH64_FEATURE (AARCH64_FEATURE_V8, \
72 | AARCH64_FEATURE_SIMD)
73 #define AARCH64_ARCH_V8_1 AARCH64_FEATURE (AARCH64_ARCH_V8, \
75 | AARCH64_FEATURE_V8_1 \
76 | AARCH64_FEATURE_LSE \
77 | AARCH64_FEATURE_PAN \
78 | AARCH64_FEATURE_LOR \
79 | AARCH64_FEATURE_RDMA)
80 #define AARCH64_ARCH_V8_2 AARCH64_FEATURE (AARCH64_ARCH_V8_1, \
81 AARCH64_FEATURE_V8_2 \
82 | AARCH64_FEATURE_RAS)
83 #define AARCH64_ARCH_V8_3 AARCH64_FEATURE (AARCH64_ARCH_V8_2, \
84 AARCH64_FEATURE_V8_3 \
85 | AARCH64_FEATURE_RCPC \
86 | AARCH64_FEATURE_COMPNUM)
87 #define AARCH64_ARCH_V8_4 AARCH64_FEATURE (AARCH64_ARCH_V8_3, \
88 AARCH64_FEATURE_V8_4 \
89 | AARCH64_FEATURE_DOTPROD \
90 | AARCH64_FEATURE_F16_FML)
92 #define AARCH64_ARCH_NONE AARCH64_FEATURE (0, 0)
93 #define AARCH64_ANY AARCH64_FEATURE (-1, 0)
98 #define AARCH64_CPU_HAS_ALL_FEATURES(CPU,FEAT) \
99 ((~(CPU) & (FEAT)) == 0)
101 #define AARCH64_CPU_HAS_ANY_FEATURES(CPU,FEAT) \
102 (((CPU) & (FEAT)) != 0)
104 #define AARCH64_CPU_HAS_FEATURE(CPU,FEAT) \
105 AARCH64_CPU_HAS_ALL_FEATURES (CPU,FEAT)
107 #define AARCH64_MERGE_FEATURE_SETS(TARG,F1,F2) \
110 (TARG) = (F1) | (F2); \
114 #define AARCH64_CLEAR_FEATURE(TARG,F1,F2) \
117 (TARG) = (F1) &~ (F2); \
121 #define AARCH64_FEATURE(core,coproc) ((core) | (coproc))
648 #define AARCH64_MAX_OPND_NUM 6
650 #define AARCH64_MAX_QLF_SEQ_NUM 10
654 typedef aarch64_opnd_qualifier_t \
722 #define F_ALIAS (1 << 0)
723 #define F_HAS_ALIAS (1 << 1)
726 #define F_P1 (1 << 2)
727 #define F_P2 (2 << 2)
728 #define F_P3 (3 << 2)
730 #define F_COND (1 << 4)
732 #define F_SF (1 << 5)
734 #define F_SIZEQ (1 << 6)
736 #define F_FPTYPE (1 << 7)
738 #define F_SSIZE (1 << 8)
742 #define F_GPRSIZE_IN_Q (1 << 10)
744 #define F_LDS_SIZE (1 << 11)
746 #define F_OPD0_OPT (1 << 12)
747 #define F_OPD1_OPT (2 << 12)
748 #define F_OPD2_OPT (3 << 12)
749 #define F_OPD3_OPT (4 << 12)
750 #define F_OPD4_OPT (5 << 12)
752 #define F_DEFAULT(X) (((X) & 0x1f) << 15)
758 #define F_CONV (1 << 20)
762 #define F_PSEUDO (1 << 21)
764 #define F_MISC (1 << 22)
766 #define F_N (1 << 23)
768 #define F_OD(X) (((X) & 0x7) << 24)
770 #define F_LSE_SZ (1 << 27)
772 #define F_STRICT (1ULL << 28)
774 #define F_SYS_READ (1ULL << 29)
776 #define F_SYS_WRITE (1ULL << 30)
795 return (
opcode->flags >> 2) & 0x3;
807 return (((
opcode->flags >> 12) & 0x7) ==
idx + 1)
814 return (
opcode->flags >> 15) & 0x1f;
817 static inline unsigned int
820 return (
opcode->flags >> 24) & 0x7;
1165 extern unsigned char
1180 #ifdef DEBUG_AARCH64
1181 extern int debug_dump;
1186 #define DEBUG_TRACE(M, ...) \
1189 aarch64_verbose ("%s: " M ".", __func__, ##__VA_ARGS__); \
1192 #define DEBUG_TRACE_IF(C, M, ...) \
1194 if (debug_dump && (C)) \
1195 aarch64_verbose ("%s: " M ".", __func__, ##__VA_ARGS__); \
1198 #define DEBUG_TRACE(M, ...) ;
1199 #define DEBUG_TRACE_IF(C, M, ...) ;
bfd_boolean aarch64_sys_ins_reg_has_xt(const aarch64_sys_ins_reg *)
unsigned char aarch64_opnd_qualifier_t
static bfd_boolean pseudo_opcode_p(const aarch64_opcode *opcode)
@ AARCH64_OPND_QLF_RETRIEVE
@ AARCH64_OPND_QLF_imm_0_7
@ AARCH64_OPND_QLF_imm_1_64
@ AARCH64_OPND_QLF_imm_1_32
@ AARCH64_OPND_QLF_imm_0_31
@ AARCH64_OPND_QLF_imm_0_15
@ AARCH64_OPND_QLF_imm_0_63
bfd_boolean aarch64_sys_ins_reg_supported_p(const aarch64_feature_set, const aarch64_sys_ins_reg *)
aarch64_opnd_qualifier_t aarch64_get_expected_qualifier(const aarch64_opnd_qualifier_seq_t *, int, const aarch64_opnd_qualifier_t, int)
const aarch64_sys_ins_reg aarch64_sys_regs_ic[]
#define AARCH64_MAX_QLF_SEQ_NUM
enum aarch64_operand_class aarch64_get_operand_class(enum aarch64_opnd)
const aarch64_sys_ins_reg aarch64_sys_regs_at[]
static bfd_boolean optional_operand_p(const aarch64_opcode *opcode, unsigned int idx)
const aarch64_cond aarch64_conds[16]
void aarch64_print_operand(char *, size_t, bfd_vma, const aarch64_opcode *, const aarch64_opnd_info *, int, int *, bfd_vma *, char **)
const char * aarch64_get_operand_desc(enum aarch64_opnd)
const aarch64_sys_reg aarch64_sys_regs[]
@ AARCH64_OPND_CLASS_MODIFIED_REG
@ AARCH64_OPND_CLASS_SYSTEM
@ AARCH64_OPND_CLASS_INT_REG
@ AARCH64_OPND_CLASS_IMMEDIATE
@ AARCH64_OPND_CLASS_SVE_REG
@ AARCH64_OPND_CLASS_ADDRESS
@ AARCH64_OPND_CLASS_COND
@ AARCH64_OPND_CLASS_SIMD_REGLIST
@ AARCH64_OPND_CLASS_SIMD_REG
@ AARCH64_OPND_CLASS_FP_REG
@ AARCH64_OPND_CLASS_SISD_REG
@ AARCH64_OPND_CLASS_PRED_REG
@ AARCH64_OPND_CLASS_SIMD_ELEMENT
const struct aarch64_name_value_pair aarch64_prfops[32]
static unsigned int get_opcode_dependent_value(const aarch64_opcode *opcode)
const char *const aarch64_sve_pattern_array[32]
bfd_boolean aarch64_sve_dupm_mov_immediate_p(uint64_t, int)
int aarch64_stack_pointer_p(const aarch64_opnd_info *)
static bfd_boolean opcode_has_alias(const aarch64_opcode *opcode)
static aarch64_insn get_optional_operand_default_value(const aarch64_opcode *opcode)
bfd_boolean aarch64_extend_operator_p(enum aarch64_modifier_kind)
int aarch64_num_of_operands(const aarch64_opcode *)
const aarch64_sys_reg aarch64_pstatefields[]
aarch64_opcode aarch64_opcode_table[]
const aarch64_sys_ins_reg aarch64_sys_regs_dc[]
static bfd_boolean empty_qualifier_sequence_p(const aarch64_opnd_qualifier_t *qualifiers)
const aarch64_sys_ins_reg aarch64_sys_regs_tlbi[]
unsigned char aarch64_get_qualifier_esize(aarch64_opnd_qualifier_t)
const struct aarch64_name_value_pair aarch64_operand_modifiers[]
aarch64_opnd_qualifier_t aarch64_opnd_qualifier_seq_t[AARCH64_MAX_OPND_NUM]
#define AARCH64_MAX_OPND_NUM
static int opcode_priority(const aarch64_opcode *opcode)
int aarch64_opcode_encode(const aarch64_opcode *, const aarch64_inst *, aarch64_insn *, aarch64_opnd_qualifier_t *, aarch64_operand_error *)
static bfd_boolean alias_opcode_p(const aarch64_opcode *opcode)
int aarch64_operand_index(const enum aarch64_opnd *, enum aarch64_opnd)
aarch64_operand_error_kind
@ AARCH64_OPDE_OUT_OF_RANGE
@ AARCH64_OPDE_INVALID_VARIANT
@ AARCH64_OPDE_UNTIED_OPERAND
@ AARCH64_OPDE_RECOVERABLE
@ AARCH64_OPDE_FATAL_SYNTAX_ERROR
@ AARCH64_OPDE_SYNTAX_ERROR
@ AARCH64_OPDE_OTHER_ERROR
@ AARCH64_OPND_ADDR_SIMM10
@ AARCH64_OPND_SVE_UIMM8_53
@ AARCH64_OPND_SVE_ADDR_ZI_U5
@ AARCH64_OPND_SVE_ADDR_RI_S4x16
@ AARCH64_OPND_SVE_Pg4_16
@ AARCH64_OPND_SVE_IMM_ROT1
@ AARCH64_OPND_SVE_ADDR_RX_LSL2
@ AARCH64_OPND_SVE_SHRIMM_PRED
@ AARCH64_OPND_SVE_ADDR_RI_U6x2
@ AARCH64_OPND_SVE_ADDR_RI_S4x4xVL
@ AARCH64_OPND_ADDR_SIMM9_2
@ AARCH64_OPND_SVE_ADDR_RR_LSL3
@ AARCH64_OPND_SVE_Zm3_22_INDEX
@ AARCH64_OPND_SVE_ADDR_RR_LSL2
@ AARCH64_OPND_SIMD_FPIMM
@ AARCH64_OPND_SVE_SHRIMM_UNPRED
@ AARCH64_OPND_SVE_ADDR_ZZ_LSL
@ AARCH64_OPND_SVE_ADDR_RZ_XTW3_14
@ AARCH64_OPND_BARRIER_PSB
@ AARCH64_OPND_SVE_Zm3_INDEX
@ AARCH64_OPND_SVE_ADDR_RZ_XTW1_22
@ AARCH64_OPND_SVE_ADDR_RZ_XTW_14
@ AARCH64_OPND_ADDR_UIMM12
@ AARCH64_OPND_SVE_SHLIMM_PRED
@ AARCH64_OPND_SVE_ADDR_RX_LSL3
@ AARCH64_OPND_ADDR_SIMM9
@ AARCH64_OPND_PSTATEFIELD
@ AARCH64_OPND_SVE_ADDR_RZ_LSL3
@ AARCH64_OPND_SVE_ADDR_RI_S4x3xVL
@ AARCH64_OPND_SVE_ADDR_RX_LSL1
@ AARCH64_OPND_SVE_ADDR_RR
@ AARCH64_OPND_SVE_LIMM_MOV
@ AARCH64_OPND_SVE_I1_HALF_ONE
@ AARCH64_OPND_ADDR_PCREL26
@ AARCH64_OPND_SVE_Pg4_10
@ AARCH64_OPND_SIMD_IMM_SFT
@ AARCH64_OPND_ADDR_PCREL19
@ AARCH64_OPND_SVE_ADDR_RI_S9xVL
@ AARCH64_OPND_BARRIER_ISB
@ AARCH64_OPND_SIMD_ADDR_SIMPLE
@ AARCH64_OPND_SVE_ADDR_RI_S6xVL
@ AARCH64_OPND_SVE_ADDR_RZ_XTW2_22
@ AARCH64_OPND_SVE_ADDR_RZ_XTW1_14
@ AARCH64_OPND_SVE_ADDR_RI_U6
@ AARCH64_OPND_SVE_SIMM5B
@ AARCH64_OPND_SVE_ADDR_RI_U6x8
@ AARCH64_OPND_SVE_PATTERN
@ AARCH64_OPND_SVE_ADDR_RZ_LSL2
@ AARCH64_OPND_SVE_FPIMM8
@ AARCH64_OPND_SVE_ADDR_RX
@ AARCH64_OPND_ADDR_SIMM7
@ AARCH64_OPND_SVE_ADDR_RZ_LSL1
@ AARCH64_OPND_ADDR_PCREL21
@ AARCH64_OPND_ADDR_REGOFF
@ AARCH64_OPND_SVE_ADDR_RI_S4xVL
@ AARCH64_OPND_SVE_ADDR_RZ
@ AARCH64_OPND_ADDR_OFFSET
@ AARCH64_OPND_SVE_I1_HALF_TWO
@ AARCH64_OPND_SVE_ADDR_RI_S4x2xVL
@ AARCH64_OPND_SVE_Zm4_INDEX
@ AARCH64_OPND_SVE_I1_ZERO_ONE
@ AARCH64_OPND_SVE_PATTERN_SCALED
@ AARCH64_OPND_SVE_ADDR_ZI_U5x8
@ AARCH64_OPND_SVE_ADDR_RZ_XTW_22
@ AARCH64_OPND_SVE_SHLIMM_UNPRED
@ AARCH64_OPND_SIMD_ADDR_POST
@ AARCH64_OPND_SVE_ADDR_ZI_U5x4
@ AARCH64_OPND_SVE_IMM_ROT2
@ AARCH64_OPND_SVE_ADDR_ZZ_UXTW
@ AARCH64_OPND_SVE_Zn_INDEX
@ AARCH64_OPND_SVE_ADDR_RR_LSL1
@ AARCH64_OPND_SVE_ADDR_ZZ_SXTW
@ AARCH64_OPND_ADDR_PCREL14
@ AARCH64_OPND_SVE_ADDR_R
@ AARCH64_OPND_SVE_ADDR_RZ_XTW3_22
@ AARCH64_OPND_ADDR_SIMPLE
@ AARCH64_OPND_SVE_ADDR_RI_U6x4
@ AARCH64_OPND_SYSREG_TLBI
@ AARCH64_OPND_SVE_ADDR_ZI_U5x2
@ AARCH64_OPND_SVE_ADDR_RZ_XTW2_14
@ AARCH64_OPND_SVE_INV_LIMM
unsigned long long aarch64_feature_set
int aarch64_zero_register_p(const aarch64_opnd_info *)
bfd_boolean aarch64_sys_reg_deprecated_p(const aarch64_sys_reg *)
const char *const aarch64_sve_prfop_array[16]
const struct aarch64_name_value_pair aarch64_hint_options[]
const aarch64_opcode * aarch64_get_opcode(enum aarch64_op)
const aarch64_cond * get_inverted_cond(const aarch64_cond *cond)
bfd_boolean aarch64_sys_reg_supported_p(const aarch64_feature_set, const aarch64_sys_reg *)
enum aarch64_modifier_kind aarch64_get_operand_modifier(const struct aarch64_name_value_pair *)
static bfd_boolean opcode_has_special_coder(const aarch64_opcode *opcode)
const char * aarch64_get_operand_name(enum aarch64_opnd)
const aarch64_cond * get_cond_from_value(aarch64_insn value)
const aarch64_opcode * aarch64_replace_opcode(struct aarch64_inst *, const aarch64_opcode *)
const struct aarch64_name_value_pair aarch64_barrier_options[16]
bfd_boolean aarch64_pstatefield_supported_p(const aarch64_feature_set, const aarch64_sys_reg *)
int aarch64_decode_insn(aarch64_insn, aarch64_inst *, bfd_boolean, aarch64_operand_error *errors)
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
BFD_HOST_U_64_BIT bfd_vma
#define cond(bop, top, mask, flags)
const aarch64_opcode * opcode
const aarch64_cond * cond
aarch64_opnd_qualifier_seq_t qualifiers_list[AARCH64_MAX_QLF_SEQ_NUM]
bfd_boolean(* verifier)(const struct aarch64_opcode *, const aarch64_insn)
enum aarch64_insn_class iclass
unsigned char tied_operand
const aarch64_feature_set * avariant
enum aarch64_operand_error_kind kind
const aarch64_cond * cond
aarch64_opnd_qualifier_t qualifier
struct aarch64_opnd_info::@37 shifter
struct aarch64_opnd_info::@35::@43 sysreg
struct aarch64_opnd_info::@35::@42 addr
const struct aarch64_name_value_pair * prfop
unsigned operator_present
const struct aarch64_name_value_pair * barrier
struct aarch64_opnd_info::@35::@39 reglane
enum aarch64_modifier_kind kind
struct aarch64_opnd_info::@35::@38 reg
const aarch64_sys_ins_reg * sysins_op
struct aarch64_opnd_info::@35::@41 imm
struct aarch64_opnd_info::@35::@42::@44 offset
struct aarch64_opnd_info::@35::@40 reglist
const struct aarch64_name_value_pair * hint_option