Rizin
unix-like reverse engineering framework and cli tools
aarch64-opc.c File Reference
#include "sysdep.h"
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
#include <inttypes.h>
#include "opintl.h"
#include "libiberty.h"
#include "aarch64-opc.h"
#include "aarch64-tbl.h"

Go to the source code of this file.

Classes

struct  operand_qualifier_data
 
struct  simd_imm_encoding
 
union  double_conv_t
 
union  single_conv_t
 
union  half_conv_t
 

Macros

#define B(op, l, t)   (((op) << 3) | (((l) - 1) << 1) | (t))
 
#define TOTAL_IMM_NB   5334
 
#define BANK(R, FOR31)
 
#define R32(X)   "w" #X
 
#define R64(X)   "x" #X
 
#define ZS(X)   "z" #X ".s"
 
#define ZD(X)   "z" #X ".d"
 
#define CPENC(op0, op1, crn, crm, op2)    ((((op0) << 19) | ((op1) << 16) | ((crn) << 12) | ((crm) << 8) | ((op2) << 5)) >> 5)
 
#define CPEN_(op1, crm, op2)   CPENC(3,(op1),4,(crm),(op2))
 
#define CPENS(op1, crn, crm, op2)   CPENC(1,(op1),(crn),(crm),(op2))
 
#define C0   0
 
#define C1   1
 
#define C2   2
 
#define C3   3
 
#define C4   4
 
#define C5   5
 
#define C6   6
 
#define C7   7
 
#define C8   8
 
#define C9   9
 
#define C10   10
 
#define C11   11
 
#define C12   12
 
#define C13   13
 
#define C14   14
 
#define C15   15
 
#define BIT(INSN, BT)   (((INSN) >> (BT)) & 1)
 
#define BITS(INSN, HI, LO)   (((INSN) >> (LO)) & ((1 << (((HI) - (LO)) + 1)) - 1))
 
#define VERIFIER(x)   verify_##x
 

Enumerations

enum  data_pattern {
  DP_UNKNOWN , DP_VECTOR_3SAME , DP_VECTOR_LONG , DP_VECTOR_WIDE ,
  DP_VECTOR_ACROSS_LANES
}
 
enum  operand_qualifier_kind { OQK_NIL , OQK_OPD_VARIANT , OQK_VALUE_IN_RANGE , OQK_MISC }
 

Functions

static bfd_boolean vector_qualifier_p (enum aarch64_opnd_qualifier qualifier)
 
static bfd_boolean fp_qualifier_p (enum aarch64_opnd_qualifier qualifier)
 
static enum data_pattern get_data_pattern (const aarch64_opnd_qualifier_seq_t qualifiers)
 
int aarch64_select_operand_for_sizeq_field_coding (const aarch64_opcode *opcode)
 
enum aarch64_operand_class aarch64_get_operand_class (enum aarch64_opnd type)
 
const char * aarch64_get_operand_name (enum aarch64_opnd type)
 
const char * aarch64_get_operand_desc (enum aarch64_opnd type)
 
const aarch64_condget_cond_from_value (aarch64_insn value)
 
const aarch64_condget_inverted_cond (const aarch64_cond *cond)
 
enum aarch64_modifier_kind aarch64_get_operand_modifier (const struct aarch64_name_value_pair *desc)
 
aarch64_insn aarch64_get_operand_modifier_value (enum aarch64_modifier_kind kind)
 
enum aarch64_modifier_kind aarch64_get_operand_modifier_from_value (aarch64_insn value, bfd_boolean extend_p)
 
bfd_boolean aarch64_extend_operator_p (enum aarch64_modifier_kind kind)
 
static bfd_boolean aarch64_shift_operator_p (enum aarch64_modifier_kind kind)
 
static int value_in_range_p (int64_t value, int low, int high)
 
static int value_aligned_p (int64_t value, int align)
 
static int value_fit_signed_field_p (int64_t value, unsigned width)
 
static int value_fit_unsigned_field_p (int64_t value, unsigned width)
 
int aarch64_stack_pointer_p (const aarch64_opnd_info *operand)
 
int aarch64_zero_register_p (const aarch64_opnd_info *operand)
 
static int operand_also_qualified_p (const struct aarch64_opnd_info *operand, aarch64_opnd_qualifier_t target)
 
aarch64_opnd_qualifier_t aarch64_get_expected_qualifier (const aarch64_opnd_qualifier_seq_t *qseq_list, int idx, const aarch64_opnd_qualifier_t known_qlf, int known_idx)
 
static bfd_boolean operand_variant_qualifier_p (aarch64_opnd_qualifier_t qualifier)
 
static bfd_boolean qualifier_value_in_range_constraint_p (aarch64_opnd_qualifier_t qualifier)
 
const char * aarch64_get_qualifier_name (aarch64_opnd_qualifier_t qualifier)
 
unsigned char aarch64_get_qualifier_esize (aarch64_opnd_qualifier_t qualifier)
 
unsigned char aarch64_get_qualifier_nelem (aarch64_opnd_qualifier_t qualifier)
 
aarch64_insn aarch64_get_qualifier_standard_value (aarch64_opnd_qualifier_t qualifier)
 
static int get_lower_bound (aarch64_opnd_qualifier_t qualifier)
 
static int get_upper_bound (aarch64_opnd_qualifier_t qualifier)
 
int aarch64_num_of_operands (const aarch64_opcode *opcode)
 
int aarch64_find_best_match (const aarch64_inst *inst, const aarch64_opnd_qualifier_seq_t *qualifiers_list, int stop_at, aarch64_opnd_qualifier_t *ret)
 
static int match_operands_qualifier (aarch64_inst *inst, bfd_boolean update_p)
 
bfd_boolean aarch64_wide_constant_p (int64_t value, int is32, unsigned int *shift_amount)
 
static int simd_imm_encoding_cmp (const void *i1, const void *i2)
 
static int encode_immediate_bitfield (int is64, uint32_t s, uint32_t r)
 
static void build_immediate_table (void)
 
bfd_boolean aarch64_logical_immediate_p (uint64_t value, int esize, aarch64_insn *encoding)
 
int aarch64_shrink_expanded_imm8 (uint64_t imm)
 
static void set_error (aarch64_operand_error *mismatch_detail, enum aarch64_operand_error_kind kind, int idx, const char *error)
 
static void set_syntax_error (aarch64_operand_error *mismatch_detail, int idx, const char *error)
 
static void set_out_of_range_error (aarch64_operand_error *mismatch_detail, int idx, int lower_bound, int upper_bound, const char *error)
 
static void set_imm_out_of_range_error (aarch64_operand_error *mismatch_detail, int idx, int lower_bound, int upper_bound)
 
static void set_offset_out_of_range_error (aarch64_operand_error *mismatch_detail, int idx, int lower_bound, int upper_bound)
 
static void set_regno_out_of_range_error (aarch64_operand_error *mismatch_detail, int idx, int lower_bound, int upper_bound)
 
static void set_elem_idx_out_of_range_error (aarch64_operand_error *mismatch_detail, int idx, int lower_bound, int upper_bound)
 
static void set_sft_amount_out_of_range_error (aarch64_operand_error *mismatch_detail, int idx, int lower_bound, int upper_bound)
 
static void set_multiplier_out_of_range_error (aarch64_operand_error *mismatch_detail, int idx, int lower_bound, int upper_bound)
 
static void set_unaligned_error (aarch64_operand_error *mismatch_detail, int idx, int alignment)
 
static void set_reg_list_error (aarch64_operand_error *mismatch_detail, int idx, int expected_num)
 
static void set_other_error (aarch64_operand_error *mismatch_detail, int idx, const char *error)
 
static int operand_general_constraint_met_p (const aarch64_opnd_info *opnds, int idx, enum aarch64_opnd type, const aarch64_opcode *opcode, aarch64_operand_error *mismatch_detail)
 
int aarch64_match_operands_constraint (aarch64_inst *inst, aarch64_operand_error *mismatch_detail)
 
const aarch64_opcodeaarch64_replace_opcode (aarch64_inst *inst, const aarch64_opcode *opcode)
 
int aarch64_operand_index (const enum aarch64_opnd *operands, enum aarch64_opnd operand)
 
static const char * get_int_reg_name (int regno, aarch64_opnd_qualifier_t qualifier, int sp_reg_p)
 
static const char * get_64bit_int_reg_name (int regno, int sp_reg_p)
 
static const char * get_offset_int_reg_name (const aarch64_opnd_info *opnd)
 
static const char * get_addr_sve_reg_name (int regno, aarch64_opnd_qualifier_t qualifier)
 
static uint64_t expand_fp_imm (int size, uint32_t imm8)
 
static void print_register_list (char *buf, size_t size, const aarch64_opnd_info *opnd, const char *prefix)
 
static void print_immediate_offset_address (char *buf, size_t size, const aarch64_opnd_info *opnd, const char *base)
 
static void print_register_offset_address (char *buf, size_t size, const aarch64_opnd_info *opnd, const char *base, const char *offset)
 
void aarch64_print_operand (char *buf, size_t size, bfd_vma pc, const aarch64_opcode *opcode, const aarch64_opnd_info *opnds, int idx, int *pcrel_p, bfd_vma *address, char **notes ATTRIBUTE_UNUSED)
 
bfd_boolean aarch64_sys_reg_deprecated_p (const aarch64_sys_reg *reg)
 
bfd_boolean aarch64_sys_reg_supported_p (const aarch64_feature_set features, const aarch64_sys_reg *reg)
 
bfd_boolean aarch64_pstatefield_supported_p (const aarch64_feature_set features, const aarch64_sys_reg *reg)
 
bfd_boolean aarch64_sys_ins_reg_has_xt (const aarch64_sys_ins_reg *sys_ins_reg)
 
bfd_boolean aarch64_sys_ins_reg_supported_p (const aarch64_feature_set features, const aarch64_sys_ins_reg *reg)
 
static bfd_boolean verify_ldpsw (const struct aarch64_opcode *opcode ATTRIBUTE_UNUSED, const aarch64_insn insn)
 
bfd_boolean aarch64_sve_dupm_mov_immediate_p (uint64_t uvalue, int esize)
 

Variables

const char *const aarch64_sve_pattern_array [32]
 
const char *const aarch64_sve_prfop_array [16]
 
static const char significant_operand_index []
 
const aarch64_field fields []
 
const aarch64_cond aarch64_conds [16]
 
const struct aarch64_name_value_pair aarch64_operand_modifiers []
 
const struct aarch64_name_value_pair aarch64_barrier_options [16]
 
const struct aarch64_name_value_pair aarch64_hint_options []
 
const struct aarch64_name_value_pair aarch64_prfops [32]
 
struct operand_qualifier_data aarch64_opnd_qualifiers []
 
static simd_imm_encoding simd_immediates [TOTAL_IMM_NB]
 
static const char * int_reg [2][2][32]
 
static const char * sve_reg [2][32]
 
const aarch64_sys_reg aarch64_sys_regs []
 
const aarch64_sys_reg aarch64_pstatefields []
 
const aarch64_sys_ins_reg aarch64_sys_regs_ic []
 
const aarch64_sys_ins_reg aarch64_sys_regs_dc []
 
const aarch64_sys_ins_reg aarch64_sys_regs_at []
 
const aarch64_sys_ins_reg aarch64_sys_regs_tlbi []
 

Macro Definition Documentation

◆ B

#define B (   op,
  l,
 
)    (((op) << 3) | (((l) - 1) << 1) | (t))

Definition at line 479 of file aarch64-opc.c.

◆ BANK

#define BANK (   R,
  FOR31 
)
Value:
{ R (0), R (1), R (2), R (3), R (4), R (5), R (6), R (7), \
R (8), R (9), R (10), R (11), R (12), R (13), R (14), R (15), \
R (16), R (17), R (18), R (19), R (20), R (21), R (22), R (23), \
R (24), R (25), R (26), R (27), R (28), R (29), R (30), FOR31 }
#define R(x, b, m)
Definition: arc.h:168

Definition at line 2748 of file aarch64-opc.c.

◆ BIT

#define BIT (   INSN,
  BT 
)    (((INSN) >> (BT)) & 1)

Definition at line 4488 of file aarch64-opc.c.

◆ BITS

#define BITS (   INSN,
  HI,
  LO 
)    (((INSN) >> (LO)) & ((1 << (((HI) - (LO)) + 1)) - 1))

Definition at line 4489 of file aarch64-opc.c.

◆ C0

#define C0   0

Definition at line 3654 of file aarch64-opc.c.

◆ C1

#define C1   1

Definition at line 3655 of file aarch64-opc.c.

◆ C10

#define C10   10

Definition at line 3664 of file aarch64-opc.c.

◆ C11

#define C11   11

Definition at line 3665 of file aarch64-opc.c.

◆ C12

#define C12   12

Definition at line 3666 of file aarch64-opc.c.

◆ C13

#define C13   13

Definition at line 3667 of file aarch64-opc.c.

◆ C14

#define C14   14

Definition at line 3668 of file aarch64-opc.c.

◆ C15

#define C15   15

Definition at line 3669 of file aarch64-opc.c.

◆ C2

#define C2   2

Definition at line 3656 of file aarch64-opc.c.

◆ C3

#define C3   3

Definition at line 3657 of file aarch64-opc.c.

◆ C4

#define C4   4

Definition at line 3658 of file aarch64-opc.c.

◆ C5

#define C5   5

Definition at line 3659 of file aarch64-opc.c.

◆ C6

#define C6   6

Definition at line 3660 of file aarch64-opc.c.

◆ C7

#define C7   7

Definition at line 3661 of file aarch64-opc.c.

◆ C8

#define C8   8

Definition at line 3662 of file aarch64-opc.c.

◆ C9

#define C9   9

Definition at line 3663 of file aarch64-opc.c.

◆ CPEN_

#define CPEN_ (   op1,
  crm,
  op2 
)    CPENC(3,(op1),4,(crm),(op2))

Definition at line 3650 of file aarch64-opc.c.

◆ CPENC

#define CPENC (   op0,
  op1,
  crn,
  crm,
  op2 
)     ((((op0) << 19) | ((op1) << 16) | ((crn) << 12) | ((crm) << 8) | ((op2) << 5)) >> 5)

Definition at line 3647 of file aarch64-opc.c.

◆ CPENS

#define CPENS (   op1,
  crn,
  crm,
  op2 
)    CPENC(1,(op1),(crn),(crm),(op2))

Definition at line 3652 of file aarch64-opc.c.

◆ R32

#define R32 (   X)    "w" #X

◆ R64

#define R64 (   X)    "x" #X

◆ TOTAL_IMM_NB

#define TOTAL_IMM_NB   5334

Definition at line 1095 of file aarch64-opc.c.

◆ VERIFIER

#define VERIFIER (   x)    verify_##x

Definition at line 4545 of file aarch64-opc.c.

◆ ZD

#define ZD (   X)    "z" #X ".d"

◆ ZS

#define ZS (   X)    "z" #X ".s"

Enumeration Type Documentation

◆ data_pattern

Enumerator
DP_UNKNOWN 
DP_VECTOR_3SAME 
DP_VECTOR_LONG 
DP_VECTOR_WIDE 
DP_VECTOR_ACROSS_LANES 

Definition at line 124 of file aarch64-opc.c.

125 {
126  DP_UNKNOWN,
131 };
@ DP_VECTOR_3SAME
Definition: aarch64-opc.c:127
@ DP_UNKNOWN
Definition: aarch64-opc.c:126
@ DP_VECTOR_WIDE
Definition: aarch64-opc.c:129
@ DP_VECTOR_ACROSS_LANES
Definition: aarch64-opc.c:130
@ DP_VECTOR_LONG
Definition: aarch64-opc.c:128

◆ operand_qualifier_kind

Enumerator
OQK_NIL 
OQK_OPD_VARIANT 
OQK_VALUE_IN_RANGE 
OQK_MISC 

Definition at line 664 of file aarch64-opc.c.

665 {
666  OQK_NIL,
669  OQK_MISC,
670 };
@ OQK_OPD_VARIANT
Definition: aarch64-opc.c:667
@ OQK_VALUE_IN_RANGE
Definition: aarch64-opc.c:668
@ OQK_NIL
Definition: aarch64-opc.c:666
@ OQK_MISC
Definition: aarch64-opc.c:669

Function Documentation

◆ aarch64_extend_operator_p()

bfd_boolean aarch64_extend_operator_p ( enum aarch64_modifier_kind  kind)

Definition at line 430 of file aarch64-opc.c.

431 {
432  return (kind > AARCH64_MOD_LSL && kind <= AARCH64_MOD_SXTX)
433  ? TRUE : FALSE;
434 }
@ AARCH64_MOD_SXTX
Definition: aarch64.h:891
@ AARCH64_MOD_LSL
Definition: aarch64.h:883
#define TRUE
Definition: mybfd.h:103
#define FALSE
Definition: mybfd.h:102

References AARCH64_MOD_LSL, AARCH64_MOD_SXTX, FALSE, and TRUE.

Referenced by operand_general_constraint_met_p().

◆ aarch64_find_best_match()

int aarch64_find_best_match ( const aarch64_inst inst,
const aarch64_opnd_qualifier_seq_t qualifiers_list,
int  stop_at,
aarch64_opnd_qualifier_t ret 
)

Definition at line 876 of file aarch64-opc.c.

879 {
880  int found = 0;
881  int i, num_opnds;
882  const aarch64_opnd_qualifier_t *qualifiers;
883 
884  num_opnds = aarch64_num_of_operands (inst->opcode);
885  if (num_opnds == 0)
886  {
887  DEBUG_TRACE ("SUCCEED: no operand");
888  return 1;
889  }
890 
891  if (stop_at < 0 || stop_at >= num_opnds)
892  stop_at = num_opnds - 1;
893 
894  /* For each pattern. */
895  for (i = 0; i < AARCH64_MAX_QLF_SEQ_NUM; ++i, ++qualifiers_list)
896  {
897  int j;
898  qualifiers = *qualifiers_list;
899 
900  /* Start as positive. */
901  found = 1;
902 
903  DEBUG_TRACE ("%d", i);
904 #ifdef DEBUG_AARCH64
905  if (debug_dump)
906  dump_match_qualifiers (inst->operands, qualifiers);
907 #endif
908 
909  /* Most opcodes has much fewer patterns in the list.
910  First NIL qualifier indicates the end in the list. */
911  if (empty_qualifier_sequence_p (qualifiers) == TRUE)
912  {
913  DEBUG_TRACE_IF (i == 0, "SUCCEED: empty qualifier list");
914  if (i)
915  found = 0;
916  break;
917  }
918 
919  for (j = 0; j < num_opnds && j <= stop_at; ++j, ++qualifiers)
920  {
921  if (inst->operands[j].qualifier == AARCH64_OPND_QLF_NIL)
922  {
923  /* Either the operand does not have qualifier, or the qualifier
924  for the operand needs to be deduced from the qualifier
925  sequence.
926  In the latter case, any constraint checking related with
927  the obtained qualifier should be done later in
928  operand_general_constraint_met_p. */
929  continue;
930  }
931  else if (*qualifiers != inst->operands[j].qualifier)
932  {
933  /* Unless the target qualifier can also qualify the operand
934  (which has already had a non-nil qualifier), non-equal
935  qualifiers are generally un-matched. */
936  if (operand_also_qualified_p (inst->operands + j, *qualifiers))
937  continue;
938  else
939  {
940  found = 0;
941  break;
942  }
943  }
944  else
945  continue; /* Equal qualifiers are certainly matched. */
946  }
947 
948  /* Qualifiers established. */
949  if (found == 1)
950  break;
951  }
952 
953  if (found == 1)
954  {
955  /* Fill the result in *RET. */
956  int j;
957  qualifiers = *qualifiers_list;
958 
959  DEBUG_TRACE ("complete qualifiers using list %d", i);
960 #ifdef DEBUG_AARCH64
961  if (debug_dump)
962  dump_qualifier_sequence (qualifiers);
963 #endif
964 
965  for (j = 0; j <= stop_at; ++j, ++qualifiers)
966  ret[j] = *qualifiers;
967  for (; j < AARCH64_MAX_OPND_NUM; ++j)
968  ret[j] = AARCH64_OPND_QLF_NIL;
969 
970  DEBUG_TRACE ("SUCCESS");
971  return 1;
972  }
973 
974  DEBUG_TRACE ("FAIL");
975  return 0;
976 }
static int operand_also_qualified_p(const struct aarch64_opnd_info *operand, aarch64_opnd_qualifier_t target)
Definition: aarch64-opc.c:585
int aarch64_num_of_operands(const aarch64_opcode *opcode)
Definition: aarch64-opc.c:842
#define DEBUG_TRACE(M,...)
Definition: aarch64.h:1198
#define DEBUG_TRACE_IF(C, M,...)
Definition: aarch64.h:1199
unsigned char aarch64_opnd_qualifier_t
Definition: aarch64.h:652
@ AARCH64_OPND_QLF_NIL
Definition: aarch64.h:380
#define AARCH64_MAX_QLF_SEQ_NUM
Definition: aarch64.h:650
static bfd_boolean empty_qualifier_sequence_p(const aarch64_opnd_qualifier_t *qualifiers)
Definition: aarch64.h:659
#define AARCH64_MAX_OPND_NUM
Definition: aarch64.h:648
lzma_index ** i
Definition: index.h:629
RZ_API const KEY_TYPE bool * found
Definition: ht_inc.h:130
aarch64_opnd_info operands[AARCH64_MAX_OPND_NUM]
Definition: aarch64.h:1035
const aarch64_opcode * opcode
Definition: aarch64.h:1029
aarch64_opnd_qualifier_t qualifier
Definition: aarch64.h:921

References AARCH64_MAX_OPND_NUM, AARCH64_MAX_QLF_SEQ_NUM, aarch64_num_of_operands(), AARCH64_OPND_QLF_NIL, DEBUG_TRACE, DEBUG_TRACE_IF, empty_qualifier_sequence_p(), found, i, aarch64_inst::opcode, operand_also_qualified_p(), aarch64_inst::operands, aarch64_opnd_info::qualifier, and TRUE.

Referenced by get_expected_qualifier(), and match_operands_qualifier().

◆ aarch64_get_expected_qualifier()

aarch64_opnd_qualifier_t aarch64_get_expected_qualifier ( const aarch64_opnd_qualifier_seq_t qseq_list,
int  idx,
const aarch64_opnd_qualifier_t  known_qlf,
int  known_idx 
)

Definition at line 621 of file aarch64-opc.c.

625 {
626  int i, saved_i;
627 
628  /* Special case.
629 
630  When the known qualifier is NIL, we have to assume that there is only
631  one qualifier sequence in the *QSEQ_LIST and return the corresponding
632  qualifier directly. One scenario is that for instruction
633  PRFM <prfop>, [<Xn|SP>, #:lo12:<symbol>]
634  which has only one possible valid qualifier sequence
635  NIL, S_D
636  the caller may pass NIL in KNOWN_QLF to obtain S_D so that it can
637  determine the correct relocation type (i.e. LDST64_LO12) for PRFM.
638 
639  Because the qualifier NIL has dual roles in the qualifier sequence:
640  it can mean no qualifier for the operand, or the qualifer sequence is
641  not in use (when all qualifiers in the sequence are NILs), we have to
642  handle this special case here. */
643  if (known_qlf == AARCH64_OPND_NIL)
644  {
645  assert (qseq_list[0][known_idx] == AARCH64_OPND_NIL);
646  return qseq_list[0][idx];
647  }
648 
649  for (i = 0, saved_i = -1; i < AARCH64_MAX_QLF_SEQ_NUM; i++)
650  {
651  if (qseq_list[i][known_idx] == known_qlf)
652  {
653  if (saved_i != -1)
654  /* More than one sequences are found to have KNOWN_QLF at
655  KNOWN_IDX. */
656  return AARCH64_OPND_NIL;
657  saved_i = i;
658  }
659  }
660 
661  return qseq_list[saved_i][idx];
662 }
@ AARCH64_OPND_NIL
Definition: aarch64.h:146
assert(limit<=UINT32_MAX/2)
int idx
Definition: setup.py:197

References AARCH64_MAX_QLF_SEQ_NUM, AARCH64_OPND_NIL, assert(), i, and setup::idx.

◆ aarch64_get_operand_class()

◆ aarch64_get_operand_desc()

const char* aarch64_get_operand_desc ( enum aarch64_opnd  type)

Definition at line 342 of file aarch64-opc.c.

343 {
344  return aarch64_operands[type].desc;
345 }
const char * desc
Definition: aarch64-opc.h:183

References aarch64_operands, aarch64_operand::desc, and type.

◆ aarch64_get_operand_modifier()

enum aarch64_modifier_kind aarch64_get_operand_modifier ( const struct aarch64_name_value_pair desc)

Definition at line 376 of file aarch64-opc.c.

409 {
411 }
const struct aarch64_name_value_pair aarch64_operand_modifiers[]
Definition: aarch64-opc.c:386
const char * desc
Definition: bin_vsf.c:19

References aarch64_conds, and cond.

◆ aarch64_get_operand_modifier_from_value()

enum aarch64_modifier_kind aarch64_get_operand_modifier_from_value ( aarch64_insn  value,
bfd_boolean  extend_p 
)

Definition at line 414 of file aarch64-opc.c.

422 {
423  if (extend_p == TRUE)
424  return AARCH64_MOD_UXTB + value;
425  else
426  return AARCH64_MOD_LSL - value;
427 }
@ AARCH64_MOD_UXTB
Definition: aarch64.h:884
static int value
Definition: cmd_api.c:93

References aarch64_operand_modifiers, and aarch64_name_value_pair::value.

Referenced by aarch64_ext_addr_regoff(), aarch64_ext_reg_extended(), and aarch64_ext_reg_shifted().

◆ aarch64_get_operand_modifier_value()

aarch64_insn aarch64_get_operand_modifier_value ( enum aarch64_modifier_kind  kind)

Definition at line 414 of file aarch64-opc.c.

415 {
416  return aarch64_operand_modifiers[kind].value;
417 }
aarch64_insn value
Definition: aarch64.h:834

◆ aarch64_get_operand_name()

const char* aarch64_get_operand_name ( enum aarch64_opnd  type)

Definition at line 334 of file aarch64-opc.c.

335 {
336  return aarch64_operands[type].name;
337 }
const char * name
Definition: aarch64-opc.h:174

References aarch64_operands, aarch64_operand::name, and type.

◆ aarch64_get_qualifier_esize()

◆ aarch64_get_qualifier_name()

const char* aarch64_get_qualifier_name ( aarch64_opnd_qualifier_t  qualifier)

◆ aarch64_get_qualifier_nelem()

unsigned char aarch64_get_qualifier_nelem ( aarch64_opnd_qualifier_t  qualifier)

◆ aarch64_get_qualifier_standard_value()

aarch64_insn aarch64_get_qualifier_standard_value ( aarch64_opnd_qualifier_t  qualifier)

◆ aarch64_logical_immediate_p()

bfd_boolean aarch64_logical_immediate_p ( uint64_t  value,
int  esize,
aarch64_insn encoding 
)

Definition at line 1207 of file aarch64-opc.c.

1208 {
1209  simd_imm_encoding imm_enc;
1210  const simd_imm_encoding *imm_encoding;
1211  static bfd_boolean initialized = FALSE;
1212  uint64_t upper;
1213  int i;
1214 
1215  DEBUG_TRACE ("enter with 0x%" PRIx64 "(%" PRIi64 "), esize: %d", value,
1216  value, esize);
1217 
1218  if (!initialized)
1219  {
1221  initialized = TRUE;
1222  }
1223 
1224  /* Allow all zeros or all ones in top bits, so that
1225  constant expressions like ~1 are permitted. */
1226  upper = (uint64_t) -1 << (esize * 4) << (esize * 4);
1227  if ((value & ~upper) != value && (value | upper) != value)
1228  return FALSE;
1229 
1230  /* Replicate to a full 64-bit value. */
1231  value &= ~upper;
1232  for (i = esize * 8; i < 64; i *= 2)
1233  value |= (value << i);
1234 
1235  imm_enc.imm = value;
1236  imm_encoding = (const simd_imm_encoding *)
1237  bsearch(&imm_enc, simd_immediates, TOTAL_IMM_NB,
1239  if (imm_encoding == NULL)
1240  {
1241  DEBUG_TRACE ("exit with FALSE");
1242  return FALSE;
1243  }
1244  if (encoding != NULL)
1245  *encoding = imm_encoding->encoding;
1246  DEBUG_TRACE ("exit with TRUE");
1247  return TRUE;
1248 }
static simd_imm_encoding simd_immediates[TOTAL_IMM_NB]
Definition: aarch64-opc.c:1103
static void build_immediate_table(void)
Definition: aarch64-opc.c:1133
static int simd_imm_encoding_cmp(const void *i1, const void *i2)
Definition: aarch64-opc.c:1106
#define TOTAL_IMM_NB
Definition: aarch64-opc.c:1095
#define NULL
Definition: cris-opc.c:27
int bfd_boolean
Definition: mybfd.h:98
unsigned long uint64_t
Definition: sftypes.h:28
aarch64_insn encoding
Definition: aarch64-opc.c:1100
#define PRIx64
Definition: sysdefs.h:94
static int initialized
Definition: tricore-dis.c:96

References build_immediate_table(), DEBUG_TRACE, simd_imm_encoding::encoding, cmd_descs_generate::encoding, FALSE, i, simd_imm_encoding::imm, initialized, NULL, PRIx64, simd_imm_encoding_cmp(), simd_immediates, TOTAL_IMM_NB, TRUE, and value.

Referenced by operand_general_constraint_met_p().

◆ aarch64_match_operands_constraint()

int aarch64_match_operands_constraint ( aarch64_inst inst,
aarch64_operand_error mismatch_detail 
)

Definition at line 2632 of file aarch64-opc.c.

2634 {
2635  int i;
2636 
2637  DEBUG_TRACE ("enter");
2638 
2639  /* Check for cases where a source register needs to be the same as the
2640  destination register. Do this before matching qualifiers since if
2641  an instruction has both invalid tying and invalid qualifiers,
2642  the error about qualifiers would suggest several alternative
2643  instructions that also have invalid tying. */
2644  i = inst->opcode->tied_operand;
2645  if (i > 0 && (inst->operands[0].reg.regno != inst->operands[i].reg.regno))
2646  {
2647  if (mismatch_detail)
2648  {
2649  mismatch_detail->kind = AARCH64_OPDE_UNTIED_OPERAND;
2650  mismatch_detail->index = i;
2651  mismatch_detail->error = NULL;
2652  }
2653  return 0;
2654  }
2655 
2656  /* Match operands' qualifier.
2657  *INST has already had qualifier establish for some, if not all, of
2658  its operands; we need to find out whether these established
2659  qualifiers match one of the qualifier sequence in
2660  INST->OPCODE->QUALIFIERS_LIST. If yes, we will assign each operand
2661  with the corresponding qualifier in such a sequence.
2662  Only basic operand constraint checking is done here; the more thorough
2663  constraint checking will carried out by operand_general_constraint_met_p,
2664  which has be to called after this in order to get all of the operands'
2665  qualifiers established. */
2666  if (match_operands_qualifier (inst, TRUE /* update_p */) == 0)
2667  {
2668  DEBUG_TRACE ("FAIL on operand qualifier matching");
2669  if (mismatch_detail)
2670  {
2671  /* Return an error type to indicate that it is the qualifier
2672  matching failure; we don't care about which operand as there
2673  are enough information in the opcode table to reproduce it. */
2674  mismatch_detail->kind = AARCH64_OPDE_INVALID_VARIANT;
2675  mismatch_detail->index = -1;
2676  mismatch_detail->error = NULL;
2677  }
2678  return 0;
2679  }
2680 
2681  /* Match operands' constraint. */
2682  for (i = 0; i < AARCH64_MAX_OPND_NUM; ++i)
2683  {
2684  enum aarch64_opnd type = inst->opcode->operands[i];
2685  if (type == AARCH64_OPND_NIL)
2686  break;
2687  if (inst->operands[i].skip)
2688  {
2689  DEBUG_TRACE ("skip the incomplete operand %d", i);
2690  continue;
2691  }
2693  inst->opcode, mismatch_detail) == 0)
2694  {
2695  DEBUG_TRACE ("FAIL on operand %d", i);
2696  return 0;
2697  }
2698  }
2699 
2700  DEBUG_TRACE ("PASS");
2701 
2702  return 1;
2703 }
static int match_operands_qualifier(aarch64_inst *inst, bfd_boolean update_p)
Definition: aarch64-opc.c:987
static int operand_general_constraint_met_p(const aarch64_opnd_info *opnds, int idx, enum aarch64_opnd type, const aarch64_opcode *opcode, aarch64_operand_error *mismatch_detail)
Definition: aarch64-opc.c:1415
@ AARCH64_OPDE_INVALID_VARIANT
Definition: aarch64.h:1098
@ AARCH64_OPDE_UNTIED_OPERAND
Definition: aarch64.h:1099
aarch64_opnd
Definition: aarch64.h:145
unsigned char tied_operand
Definition: aarch64.h:710
enum aarch64_opnd operands[AARCH64_MAX_OPND_NUM]
Definition: aarch64.h:697
enum aarch64_operand_error_kind kind
Definition: aarch64.h:1109
const char * error
Definition: aarch64.h:1111
struct aarch64_opnd_info::@35::@38 reg
unsigned skip
Definition: aarch64.h:999

References AARCH64_MAX_OPND_NUM, AARCH64_OPDE_INVALID_VARIANT, AARCH64_OPDE_UNTIED_OPERAND, AARCH64_OPND_NIL, DEBUG_TRACE, aarch64_operand_error::error, i, aarch64_operand_error::index, aarch64_operand_error::kind, match_operands_qualifier(), NULL, aarch64_inst::opcode, operand_general_constraint_met_p(), aarch64_opcode::operands, aarch64_inst::operands, aarch64_opnd_info::reg, aarch64_opnd_info::skip, aarch64_opcode::tied_operand, TRUE, and type.

Referenced by aarch64_opcode_decode(), and determine_disassembling_preference().

◆ aarch64_num_of_operands()

int aarch64_num_of_operands ( const aarch64_opcode opcode)

Definition at line 842 of file aarch64-opc.c.

843 {
844  int i = 0;
845  const enum aarch64_opnd *opnds = opcode->operands;
846  while (opnds[i++] != AARCH64_OPND_NIL)
847  ;
848  --i;
849  assert (i >= 0 && i <= AARCH64_MAX_OPND_NUM);
850  return i;
851 }

References AARCH64_MAX_OPND_NUM, AARCH64_OPND_NIL, assert(), i, and aarch64_opcode::operands.

Referenced by aarch64_find_best_match(), determine_disassembling_preference(), and match_operands_qualifier().

◆ aarch64_operand_index()

int aarch64_operand_index ( const enum aarch64_opnd operands,
enum aarch64_opnd  operand 
)

Definition at line 2736 of file aarch64-opc.c.

2737 {
2738  int i;
2739  for (i = 0; i < AARCH64_MAX_OPND_NUM; ++i)
2740  if (operands[i] == operand)
2741  return i;
2742  else if (operands[i] == AARCH64_OPND_NIL)
2743  break;
2744  return -1;
2745 }
operand
Definition: arc-opc.c:39

References AARCH64_MAX_OPND_NUM, AARCH64_OPND_NIL, and i.

Referenced by do_special_decoding().

◆ aarch64_print_operand()

void aarch64_print_operand ( char *  buf,
size_t  size,
bfd_vma  pc,
const aarch64_opcode opcode,
const aarch64_opnd_info opnds,
int  idx,
int pcrel_p,
bfd_vma address,
char **notes  ATTRIBUTE_UNUSED 
)

Definition at line 3036 of file aarch64-opc.c.

3040 {
3041  unsigned int i, num_conds;
3042  const char *name = NULL;
3043  const aarch64_opnd_info *opnd = opnds + idx;
3044  enum aarch64_modifier_kind kind;
3045  uint64_t addr, enum_value;
3046 
3047  buf[0] = '\0';
3048  if (pcrel_p)
3049  *pcrel_p = 0;
3050 
3051  switch (opnd->type)
3052  {
3053  case AARCH64_OPND_Rd:
3054  case AARCH64_OPND_Rn:
3055  case AARCH64_OPND_Rm:
3056  case AARCH64_OPND_Rt:
3057  case AARCH64_OPND_Rt2:
3058  case AARCH64_OPND_Rs:
3059  case AARCH64_OPND_Ra:
3060  case AARCH64_OPND_Rt_SYS:
3061  case AARCH64_OPND_PAIRREG:
3062  case AARCH64_OPND_SVE_Rm:
3063  /* The optional-ness of <Xt> in e.g. IC <ic_op>{, <Xt>} is determined by
3064  the <ic_op>, therefore we use opnd->present to override the
3065  generic optional-ness information. */
3066  if (opnd->type == AARCH64_OPND_Rt_SYS)
3067  {
3068  if (!opnd->present)
3069  break;
3070  }
3071  /* Omit the operand, e.g. RET. */
3072  else if (optional_operand_p (opcode, idx)
3073  && (opnd->reg.regno
3075  break;
3077  || opnd->qualifier == AARCH64_OPND_QLF_X);
3078  snprintf (buf, size, "%s",
3079  get_int_reg_name (opnd->reg.regno, opnd->qualifier, 0));
3080  break;
3081 
3082  case AARCH64_OPND_Rd_SP:
3083  case AARCH64_OPND_Rn_SP:
3085  case AARCH64_OPND_Rm_SP:
3087  || opnd->qualifier == AARCH64_OPND_QLF_WSP
3088  || opnd->qualifier == AARCH64_OPND_QLF_X
3089  || opnd->qualifier == AARCH64_OPND_QLF_SP);
3090  snprintf (buf, size, "%s",
3091  get_int_reg_name (opnd->reg.regno, opnd->qualifier, 1));
3092  break;
3093 
3094  case AARCH64_OPND_Rm_EXT:
3095  kind = opnd->shifter.kind;
3096  assert (idx == 1 || idx == 2);
3097  if ((aarch64_stack_pointer_p (opnds)
3098  || (idx == 2 && aarch64_stack_pointer_p (opnds + 1)))
3099  && ((opnd->qualifier == AARCH64_OPND_QLF_W
3100  && opnds[0].qualifier == AARCH64_OPND_QLF_W
3101  && kind == AARCH64_MOD_UXTW)
3102  || (opnd->qualifier == AARCH64_OPND_QLF_X
3103  && kind == AARCH64_MOD_UXTX)))
3104  {
3105  /* 'LSL' is the preferred form in this case. */
3106  kind = AARCH64_MOD_LSL;
3107  if (opnd->shifter.amount == 0)
3108  {
3109  /* Shifter omitted. */
3110  snprintf (buf, size, "%s",
3111  get_int_reg_name (opnd->reg.regno, opnd->qualifier, 0));
3112  break;
3113  }
3114  }
3115  if (opnd->shifter.amount)
3116  snprintf (buf, size, "%s, %s #%" PRIi64,
3117  get_int_reg_name (opnd->reg.regno, opnd->qualifier, 0),
3119  opnd->shifter.amount);
3120  else
3121  snprintf (buf, size, "%s, %s",
3122  get_int_reg_name (opnd->reg.regno, opnd->qualifier, 0),
3124  break;
3125 
3126  case AARCH64_OPND_Rm_SFT:
3128  || opnd->qualifier == AARCH64_OPND_QLF_X);
3129  if (opnd->shifter.amount == 0 && opnd->shifter.kind == AARCH64_MOD_LSL)
3130  snprintf (buf, size, "%s",
3131  get_int_reg_name (opnd->reg.regno, opnd->qualifier, 0));
3132  else
3133  snprintf (buf, size, "%s, %s #%" PRIi64,
3134  get_int_reg_name (opnd->reg.regno, opnd->qualifier, 0),
3136  opnd->shifter.amount);
3137  break;
3138 
3139  case AARCH64_OPND_Fd:
3140  case AARCH64_OPND_Fn:
3141  case AARCH64_OPND_Fm:
3142  case AARCH64_OPND_Fa:
3143  case AARCH64_OPND_Ft:
3144  case AARCH64_OPND_Ft2:
3145  case AARCH64_OPND_Sd:
3146  case AARCH64_OPND_Sn:
3147  case AARCH64_OPND_Sm:
3148  case AARCH64_OPND_SVE_VZn:
3149  case AARCH64_OPND_SVE_Vd:
3150  case AARCH64_OPND_SVE_Vm:
3151  case AARCH64_OPND_SVE_Vn:
3153  opnd->reg.regno);
3154  break;
3155 
3156  case AARCH64_OPND_Va:
3157  case AARCH64_OPND_Vd:
3158  case AARCH64_OPND_Vn:
3159  case AARCH64_OPND_Vm:
3160  snprintf (buf, size, "v%d.%s", opnd->reg.regno,
3162  break;
3163 
3164  case AARCH64_OPND_Ed:
3165  case AARCH64_OPND_En:
3166  case AARCH64_OPND_Em:
3167  case AARCH64_OPND_Em16:
3168  case AARCH64_OPND_SM3_IMM2:
3169  snprintf (buf, size, "v%d.%s[%" PRIi64 "]", opnd->reglane.regno,
3171  opnd->reglane.index);
3172  break;
3173 
3174  case AARCH64_OPND_VdD1:
3175  case AARCH64_OPND_VnD1:
3176  snprintf (buf, size, "v%d.d[1]", opnd->reg.regno);
3177  break;
3178 
3179  case AARCH64_OPND_LVn:
3180  case AARCH64_OPND_LVt:
3181  case AARCH64_OPND_LVt_AL:
3182  case AARCH64_OPND_LEt:
3183  print_register_list (buf, size, opnd, "v");
3184  break;
3185 
3186  case AARCH64_OPND_SVE_Pd:
3187  case AARCH64_OPND_SVE_Pg3:
3191  case AARCH64_OPND_SVE_Pm:
3192  case AARCH64_OPND_SVE_Pn:
3193  case AARCH64_OPND_SVE_Pt:
3194  if (opnd->qualifier == AARCH64_OPND_QLF_NIL)
3195  snprintf (buf, size, "p%d", opnd->reg.regno);
3196  else if (opnd->qualifier == AARCH64_OPND_QLF_P_Z
3197  || opnd->qualifier == AARCH64_OPND_QLF_P_M)
3198  snprintf (buf, size, "p%d/%s", opnd->reg.regno,
3200  else
3201  snprintf (buf, size, "p%d.%s", opnd->reg.regno,
3203  break;
3204 
3205  case AARCH64_OPND_SVE_Za_5:
3207  case AARCH64_OPND_SVE_Zd:
3208  case AARCH64_OPND_SVE_Zm_5:
3210  case AARCH64_OPND_SVE_Zn:
3211  case AARCH64_OPND_SVE_Zt:
3212  if (opnd->qualifier == AARCH64_OPND_QLF_NIL)
3213  snprintf (buf, size, "z%d", opnd->reg.regno);
3214  else
3215  snprintf (buf, size, "z%d.%s", opnd->reg.regno,
3217  break;
3218 
3219  case AARCH64_OPND_SVE_ZnxN:
3220  case AARCH64_OPND_SVE_ZtxN:
3221  print_register_list (buf, size, opnd, "z");
3222  break;
3223 
3228  snprintf (buf, size, "z%d.%s[%" PRIi64 "]", opnd->reglane.regno,
3230  opnd->reglane.index);
3231  break;
3232 
3233  case AARCH64_OPND_CRn:
3234  case AARCH64_OPND_CRm:
3235  snprintf (buf, size, "C%" PRIi64, opnd->imm.value);
3236  break;
3237 
3238  case AARCH64_OPND_IDX:
3239  case AARCH64_OPND_MASK:
3240  case AARCH64_OPND_IMM:
3241  case AARCH64_OPND_IMM_2:
3242  case AARCH64_OPND_WIDTH:
3245  case AARCH64_OPND_BIT_NUM:
3246  case AARCH64_OPND_IMM_VLSL:
3247  case AARCH64_OPND_IMM_VLSR:
3248  case AARCH64_OPND_SHLL_IMM:
3249  case AARCH64_OPND_IMM0:
3250  case AARCH64_OPND_IMMR:
3251  case AARCH64_OPND_IMMS:
3252  case AARCH64_OPND_FBITS:
3253  case AARCH64_OPND_SIMM5:
3266  case AARCH64_OPND_IMM_ROT1:
3267  case AARCH64_OPND_IMM_ROT2:
3268  case AARCH64_OPND_IMM_ROT3:
3271  snprintf (buf, size, "#%" PRIi64, opnd->imm.value);
3272  break;
3273 
3277  {
3278  single_conv_t c;
3279  c.i = opnd->imm.value;
3280  snprintf (buf, size, "#%.1f", c.f);
3281  break;
3282  }
3283 
3285  if (optional_operand_p (opcode, idx)
3286  && opnd->imm.value == get_optional_operand_default_value (opcode))
3287  break;
3288  enum_value = opnd->imm.value;
3289  assert (enum_value < ARRAY_SIZE (aarch64_sve_pattern_array));
3290  if (aarch64_sve_pattern_array[enum_value])
3291  snprintf (buf, size, "%s", aarch64_sve_pattern_array[enum_value]);
3292  else
3293  snprintf (buf, size, "#%" PRIi64, opnd->imm.value);
3294  break;
3295 
3297  if (optional_operand_p (opcode, idx)
3298  && !opnd->shifter.operator_present
3299  && opnd->imm.value == get_optional_operand_default_value (opcode))
3300  break;
3301  enum_value = opnd->imm.value;
3302  assert (enum_value < ARRAY_SIZE (aarch64_sve_pattern_array));
3303  if (aarch64_sve_pattern_array[opnd->imm.value])
3304  snprintf (buf, size, "%s", aarch64_sve_pattern_array[opnd->imm.value]);
3305  else
3306  snprintf (buf, size, "#%" PRIi64, opnd->imm.value);
3307  if (opnd->shifter.operator_present)
3308  {
3309  size_t len = strlen (buf);
3310  snprintf (buf + len, size - len, ", %s #%" PRIi64,
3312  opnd->shifter.amount);
3313  }
3314  break;
3315 
3317  enum_value = opnd->imm.value;
3318  assert (enum_value < ARRAY_SIZE (aarch64_sve_prfop_array));
3319  if (aarch64_sve_prfop_array[enum_value])
3320  snprintf (buf, size, "%s", aarch64_sve_prfop_array[enum_value]);
3321  else
3322  snprintf (buf, size, "#%" PRIi64, opnd->imm.value);
3323  break;
3324 
3325  case AARCH64_OPND_IMM_MOV:
3326  switch (aarch64_get_qualifier_esize (opnds[0].qualifier))
3327  {
3328  case 4: /* e.g. MOV Wd, #<imm32>. */
3329  {
3330  int imm32 = opnd->imm.value;
3331  snprintf (buf, size, "0x%x", imm32);
3332  }
3333  break;
3334  case 8: /* e.g. MOV Xd, #<imm64>. */
3335  snprintf (buf, size, "0x%" PRIx64, opnd->imm.value);
3336  break;
3337  default: assert (0);
3338  }
3339  break;
3340 
3341  case AARCH64_OPND_FPIMM0:
3342  snprintf (buf, size, "0.0");
3343  break;
3344 
3345  case AARCH64_OPND_LIMM:
3346  case AARCH64_OPND_AIMM:
3347  case AARCH64_OPND_HALF:
3349  case AARCH64_OPND_SVE_LIMM:
3351  if (opnd->shifter.amount)
3352  snprintf (buf, size, "0x%" PRIx64 ", lsl #%" PRIi64, opnd->imm.value,
3353  opnd->shifter.amount);
3354  else
3355  snprintf (buf, size, "0x%" PRIx64, opnd->imm.value);
3356  break;
3357 
3358  case AARCH64_OPND_SIMD_IMM:
3360  if ((! opnd->shifter.amount && opnd->shifter.kind == AARCH64_MOD_LSL)
3361  || opnd->shifter.kind == AARCH64_MOD_NONE)
3362  snprintf (buf, size, "0x%" PRIx64, opnd->imm.value);
3363  else
3364  snprintf (buf, size, "0x%" PRIx64 ", %s #%" PRIi64, opnd->imm.value,
3366  opnd->shifter.amount);
3367  break;
3368 
3369  case AARCH64_OPND_SVE_AIMM:
3371  if (opnd->shifter.amount)
3372  snprintf (buf, size, "#%" PRIi64 ", lsl #%" PRIi64, opnd->imm.value,
3373  opnd->shifter.amount);
3374  else
3375  snprintf (buf, size, "#%" PRIi64, opnd->imm.value);
3376  break;
3377 
3378  case AARCH64_OPND_FPIMM:
3381  switch (aarch64_get_qualifier_esize (opnds[0].qualifier))
3382  {
3383  case 2: /* e.g. FMOV <Hd>, #<imm>. */
3384  {
3385  half_conv_t c;
3386  c.i = expand_fp_imm (2, opnd->imm.value);
3387  snprintf (buf, size, "#%.18e", c.f);
3388  }
3389  break;
3390  case 4: /* e.g. FMOV <Vd>.4S, #<imm>. */
3391  {
3392  single_conv_t c;
3393  c.i = expand_fp_imm (4, opnd->imm.value);
3394  snprintf (buf, size, "#%.18e", c.f);
3395  }
3396  break;
3397  case 8: /* e.g. FMOV <Sd>, #<imm>. */
3398  {
3399  double_conv_t c;
3400  c.i = expand_fp_imm (8, opnd->imm.value);
3401  snprintf (buf, size, "#%.18e", c.d);
3402  }
3403  break;
3404  default: assert (0);
3405  }
3406  break;
3407 
3408  case AARCH64_OPND_CCMP_IMM:
3409  case AARCH64_OPND_NZCV:
3411  case AARCH64_OPND_UIMM4:
3412  case AARCH64_OPND_UIMM7:
3413  if (optional_operand_p (opcode, idx) == TRUE
3414  && (opnd->imm.value ==
3416  /* Omit the operand, e.g. DCPS1. */
3417  break;
3418  snprintf (buf, size, "0x%x", (unsigned int)opnd->imm.value);
3419  break;
3420 
3421  case AARCH64_OPND_COND:
3422  case AARCH64_OPND_COND1:
3423  snprintf (buf, size, "%s", opnd->cond->names[0]);
3424  num_conds = ARRAY_SIZE (opnd->cond->names);
3425  for (i = 1; i < num_conds && opnd->cond->names[i]; ++i)
3426  {
3427  size_t len = strlen (buf);
3428  if (i == 1)
3429  snprintf (buf + len, size - len, " // %s = %s",
3430  opnd->cond->names[0], opnd->cond->names[i]);
3431  else
3432  snprintf (buf + len, size - len, ", %s",
3433  opnd->cond->names[i]);
3434  }
3435  break;
3436 
3438  addr = ((pc + AARCH64_PCREL_OFFSET) & ~(uint64_t)0xfff)
3439  + opnd->imm.value;
3440  if (pcrel_p)
3441  *pcrel_p = 1;
3442  if (address)
3443  *address = addr;
3444  /* This is not necessary during the disassembling, as print_address_func
3445  in the disassemble_info will take care of the printing. But some
3446  other callers may be still interested in getting the string in *STR,
3447  so here we do snprintf regardless. */
3448  snprintf (buf, size, "0x%" PRIx64, addr);
3449  break;
3450 
3455  addr = pc + AARCH64_PCREL_OFFSET + opnd->imm.value;
3456  if (pcrel_p)
3457  *pcrel_p = 1;
3458  if (address)
3459  *address = addr;
3460  /* This is not necessary during the disassembling, as print_address_func
3461  in the disassemble_info will take care of the printing. But some
3462  other callers may be still interested in getting the string in *STR,
3463  so here we do snprintf regardless. */
3464  snprintf (buf, size, "0x%" PRIx64, addr);
3465  break;
3466 
3470  name = get_64bit_int_reg_name (opnd->addr.base_regno, 1);
3471  if (opnd->type == AARCH64_OPND_SIMD_ADDR_POST)
3472  {
3473  if (opnd->addr.offset.is_reg)
3474  snprintf (buf, size, "[%s], x%d", name, opnd->addr.offset.regno);
3475  else
3476  snprintf (buf, size, "[%s], #%d", name, opnd->addr.offset.imm);
3477  }
3478  else
3479  snprintf (buf, size, "[%s]", name);
3480  break;
3481 
3493  (buf, size, opnd, get_64bit_int_reg_name (opnd->addr.base_regno, 1),
3494  get_offset_int_reg_name (opnd));
3495  break;
3496 
3510  (buf, size, opnd, get_64bit_int_reg_name (opnd->addr.base_regno, 1),
3511  get_addr_sve_reg_name (opnd->addr.offset.regno, opnd->qualifier));
3512  break;
3513 
3531  (buf, size, opnd, get_64bit_int_reg_name (opnd->addr.base_regno, 1));
3532  break;
3533 
3539  (buf, size, opnd,
3540  get_addr_sve_reg_name (opnd->addr.base_regno, opnd->qualifier));
3541  break;
3542 
3547  (buf, size, opnd,
3548  get_addr_sve_reg_name (opnd->addr.base_regno, opnd->qualifier),
3549  get_addr_sve_reg_name (opnd->addr.offset.regno, opnd->qualifier));
3550  break;
3551 
3553  name = get_64bit_int_reg_name (opnd->addr.base_regno, 1);
3554  if (opnd->addr.offset.imm)
3555  snprintf (buf, size, "[%s, #%d]", name, opnd->addr.offset.imm);
3556  else
3557  snprintf (buf, size, "[%s]", name);
3558  break;
3559 
3560  case AARCH64_OPND_SYSREG:
3561  for (i = 0; aarch64_sys_regs[i].name; ++i)
3562  {
3563  bfd_boolean exact_match
3564  = (aarch64_sys_regs[i].flags & opnd->sysreg.flags)
3565  == opnd->sysreg.flags;
3566 
3567  /* Try and find an exact match, But if that fails, return the first
3568  partial match that was found. */
3569  if (aarch64_sys_regs[i].value == opnd->sysreg.value
3571  && (name == NULL || exact_match))
3572  {
3574  if (exact_match)
3575  {
3576  if (notes)
3577  *notes = NULL;
3578  break;
3579  }
3580 
3581  /* If we didn't match exactly, that means the presense of a flag
3582  indicates what we didn't want for this instruction. e.g. If
3583  F_REG_READ is there, that means we were looking for a write
3584  register. See aarch64_ext_sysreg. */
3586  *notes = _("reading from a write-only register.");
3587  else if (aarch64_sys_regs[i].flags & F_REG_READ)
3588  *notes = _("writing to a read-only register.");
3589  }
3590  }
3591 
3592  if (name)
3593  snprintf (buf, size, "%s", name);
3594  else
3595  {
3596  /* Implementation defined system register. */
3597  unsigned int value = opnd->sysreg.value;
3598  snprintf (buf, size, "s%u_%u_c%u_c%u_%u", (value >> 14) & 0x3,
3599  (value >> 11) & 0x7, (value >> 7) & 0xf, (value >> 3) & 0xf,
3600  value & 0x7);
3601  }
3602  break;
3603 
3605  for (i = 0; aarch64_pstatefields[i].name; ++i)
3606  if (aarch64_pstatefields[i].value == opnd->pstatefield)
3607  break;
3610  break;
3611 
3616  snprintf (buf, size, "%s", opnd->sysins_op->name);
3617  break;
3618 
3619  case AARCH64_OPND_BARRIER:
3620  snprintf (buf, size, "%s", opnd->barrier->name);
3621  break;
3622 
3624  /* Operand can be omitted, e.g. in DCPS1. */
3625  if (! optional_operand_p (opcode, idx)
3626  || (opnd->barrier->value
3628  snprintf (buf, size, "0x%x", opnd->barrier->value);
3629  break;
3630 
3631  case AARCH64_OPND_PRFOP:
3632  if (opnd->prfop->name != NULL)
3633  snprintf (buf, size, "%s", opnd->prfop->name);
3634  else
3635  snprintf (buf, size, "0x%02x", opnd->prfop->value);
3636  break;
3637 
3639  snprintf (buf, size, "%s", opnd->hint_option->name);
3640  break;
3641 
3642  default:
3643  assert (0);
3644  }
3645 }
size_t len
Definition: 6502dis.c:15
unsigned char aarch64_get_qualifier_esize(aarch64_opnd_qualifier_t qualifier)
Definition: aarch64-opc.c:766
bfd_boolean aarch64_sys_reg_deprecated_p(const aarch64_sys_reg *reg)
Definition: aarch64-opc.c:4067
const aarch64_sys_reg aarch64_sys_regs[]
Definition: aarch64-opc.c:3673
const char *const aarch64_sve_pattern_array[32]
Definition: aarch64-opc.c:43
const aarch64_sys_reg aarch64_pstatefields[]
Definition: aarch64-opc.c:4281
static void print_register_offset_address(char *buf, size_t size, const aarch64_opnd_info *opnd, const char *base, const char *offset)
Definition: aarch64-opc.c:2987
int aarch64_stack_pointer_p(const aarch64_opnd_info *operand)
Definition: aarch64-opc.c:562
static const char * get_int_reg_name(int regno, aarch64_opnd_qualifier_t qualifier, int sp_reg_p)
Definition: aarch64-opc.c:2782
static const char * get_offset_int_reg_name(const aarch64_opnd_info *opnd)
Definition: aarch64-opc.c:2802
static const char * get_64bit_int_reg_name(int regno, int sp_reg_p)
Definition: aarch64-opc.c:2792
const char *const aarch64_sve_prfop_array[16]
Definition: aarch64-opc.c:84
const char * aarch64_get_qualifier_name(aarch64_opnd_qualifier_t qualifier)
Definition: aarch64-opc.c:758
static const char * get_addr_sve_reg_name(int regno, aarch64_opnd_qualifier_t qualifier)
Definition: aarch64-opc.c:2823
static void print_immediate_offset_address(char *buf, size_t size, const aarch64_opnd_info *opnd, const char *base)
Definition: aarch64-opc.c:2957
static void print_register_list(char *buf, size_t size, const aarch64_opnd_info *opnd, const char *prefix)
Definition: aarch64-opc.c:2898
static uint64_t expand_fp_imm(int size, uint32_t imm8)
Definition: aarch64-opc.c:2859
#define F_REG_READ
Definition: aarch64-opc.h:213
#define F_REG_WRITE
Definition: aarch64-opc.h:216
aarch64_modifier_kind
Definition: aarch64.h:877
@ AARCH64_MOD_NONE
Definition: aarch64.h:878
@ AARCH64_MOD_UXTW
Definition: aarch64.h:886
@ AARCH64_MOD_UXTX
Definition: aarch64.h:887
@ AARCH64_OPND_QLF_W
Definition: aarch64.h:384
@ AARCH64_OPND_QLF_SP
Definition: aarch64.h:387
@ AARCH64_OPND_QLF_P_M
Definition: aarch64.h:430
@ AARCH64_OPND_QLF_WSP
Definition: aarch64.h:386
@ AARCH64_OPND_QLF_X
Definition: aarch64.h:385
@ AARCH64_OPND_QLF_P_Z
Definition: aarch64.h:429
static bfd_boolean optional_operand_p(const aarch64_opcode *opcode, unsigned int idx)
Definition: aarch64.h:805
static aarch64_insn get_optional_operand_default_value(const aarch64_opcode *opcode)
Definition: aarch64.h:812
@ AARCH64_OPND_ADDR_SIMM10
Definition: aarch64.h:252
@ AARCH64_OPND_SVE_UIMM8_53
Definition: aarch64.h:351
@ AARCH64_OPND_Rm_SFT
Definition: aarch64.h:162
@ AARCH64_OPND_SVE_Rn_SP
Definition: aarch64.h:339
@ AARCH64_OPND_Sm
Definition: aarch64.h:173
@ AARCH64_OPND_FPIMM
Definition: aarch64.h:206
@ AARCH64_OPND_SVE_UIMM3
Definition: aarch64.h:348
@ AARCH64_OPND_UIMM3_OP1
Definition: aarch64.h:212
@ AARCH64_OPND_SVE_Vm
Definition: aarch64.h:354
@ AARCH64_OPND_SVE_ADDR_ZI_U5
Definition: aarch64.h:309
@ AARCH64_OPND_SVE_Pg4_5
Definition: aarch64.h:332
@ AARCH64_OPND_PRFOP
Definition: aarch64.h:266
@ AARCH64_OPND_SM3_IMM2
Definition: aarch64.h:369
@ AARCH64_OPND_FBITS
Definition: aarch64.h:226
@ AARCH64_OPND_SIMD_IMM
Definition: aarch64.h:199
@ AARCH64_OPND_SVE_Pg3
Definition: aarch64.h:331
@ AARCH64_OPND_SVE_ADDR_RI_S4x16
Definition: aarch64.h:269
@ AARCH64_OPND_CRm
Definition: aarch64.h:193
@ AARCH64_OPND_SVE_Pg4_16
Definition: aarch64.h:334
@ AARCH64_OPND_SVE_SIMM6
Definition: aarch64.h:346
@ AARCH64_OPND_IMM_2
Definition: aarch64.h:211
@ AARCH64_OPND_SVE_LIMM
Definition: aarch64.h:325
@ AARCH64_OPND_SIMM5
Definition: aarch64.h:219
@ AARCH64_OPND_SVE_IMM_ROT1
Definition: aarch64.h:322
@ AARCH64_OPND_BIT_NUM
Definition: aarch64.h:216
@ AARCH64_OPND_Va
Definition: aarch64.h:175
@ AARCH64_OPND_SVE_ADDR_RX_LSL2
Definition: aarch64.h:287
@ AARCH64_OPND_Fa
Definition: aarch64.h:167
@ AARCH64_OPND_LEt
Definition: aarch64.h:190
@ AARCH64_OPND_SVE_SHRIMM_PRED
Definition: aarch64.h:342
@ AARCH64_OPND_SVE_ADDR_RI_U6x2
Definition: aarch64.h:277
@ AARCH64_OPND_SVE_ADDR_RI_S4x4xVL
Definition: aarch64.h:273
@ AARCH64_OPND_ADDR_SIMM9_2
Definition: aarch64.h:245
@ AARCH64_OPND_IMM_VLSL
Definition: aarch64.h:197
@ AARCH64_OPND_SVE_ADDR_RR_LSL3
Definition: aarch64.h:284
@ AARCH64_OPND_SVE_Zm3_22_INDEX
Definition: aarch64.h:362
@ AARCH64_OPND_SVE_ADDR_RR_LSL2
Definition: aarch64.h:283
@ AARCH64_OPND_SIMD_FPIMM
Definition: aarch64.h:201
@ AARCH64_OPND_SVE_SHRIMM_UNPRED
Definition: aarch64.h:343
@ AARCH64_OPND_IMM_VLSR
Definition: aarch64.h:198
@ AARCH64_OPND_SVE_ADDR_ZZ_LSL
Definition: aarch64.h:313
@ AARCH64_OPND_SYSREG_IC
Definition: aarch64.h:262
@ AARCH64_OPND_SVE_ADDR_RZ_XTW3_14
Definition: aarch64.h:305
@ AARCH64_OPND_LIMM
Definition: aarch64.h:223
@ AARCH64_OPND_COND1
Definition: aarch64.h:233
@ AARCH64_OPND_BARRIER_PSB
Definition: aarch64.h:267
@ AARCH64_OPND_SVE_Zm3_INDEX
Definition: aarch64.h:361
@ AARCH64_OPND_SVE_Rm
Definition: aarch64.h:338
@ AARCH64_OPND_SVE_ADDR_RZ_XTW1_22
Definition: aarch64.h:299
@ AARCH64_OPND_SVE_Zd
Definition: aarch64.h:358
@ AARCH64_OPND_SVE_ADDR_RZ_XTW_14
Definition: aarch64.h:293
@ AARCH64_OPND_ADDR_UIMM12
Definition: aarch64.h:253
@ AARCH64_OPND_SVE_SHLIMM_PRED
Definition: aarch64.h:340
@ AARCH64_OPND_Em16
Definition: aarch64.h:184
@ AARCH64_OPND_SVE_SIMM8
Definition: aarch64.h:347
@ AARCH64_OPND_SVE_Pn
Definition: aarch64.h:336
@ AARCH64_OPND_LVt
Definition: aarch64.h:187
@ AARCH64_OPND_SVE_ADDR_RX_LSL3
Definition: aarch64.h:288
@ AARCH64_OPND_ADDR_SIMM9
Definition: aarch64.h:244
@ AARCH64_OPND_UIMM3_OP2
Definition: aarch64.h:213
@ AARCH64_OPND_SYSREG
Definition: aarch64.h:258
@ AARCH64_OPND_Ft2
Definition: aarch64.h:169
@ AARCH64_OPND_PSTATEFIELD
Definition: aarch64.h:259
@ AARCH64_OPND_SVE_ADDR_RZ_LSL3
Definition: aarch64.h:292
@ AARCH64_OPND_SVE_Pt
Definition: aarch64.h:337
@ AARCH64_OPND_Sd
Definition: aarch64.h:171
@ AARCH64_OPND_SVE_ADDR_RI_S4x3xVL
Definition: aarch64.h:272
@ AARCH64_OPND_SVE_ADDR_RX_LSL1
Definition: aarch64.h:286
@ AARCH64_OPND_SVE_ADDR_RR
Definition: aarch64.h:281
@ AARCH64_OPND_SVE_Zm_5
Definition: aarch64.h:359
@ AARCH64_OPND_SYSREG_AT
Definition: aarch64.h:260
@ AARCH64_OPND_SVE_LIMM_MOV
Definition: aarch64.h:326
@ AARCH64_OPND_IDX
Definition: aarch64.h:195
@ AARCH64_OPND_SVE_ZnxN
Definition: aarch64.h:366
@ AARCH64_OPND_SVE_I1_HALF_ONE
Definition: aarch64.h:319
@ AARCH64_OPND_ADDR_PCREL26
Definition: aarch64.h:239
@ AARCH64_OPND_Rn_SP
Definition: aarch64.h:158
@ AARCH64_OPND_SVE_VZn
Definition: aarch64.h:352
@ AARCH64_OPND_SVE_Pg4_10
Definition: aarch64.h:333
@ AARCH64_OPND_SIMD_IMM_SFT
Definition: aarch64.h:200
@ AARCH64_OPND_IMM_ROT2
Definition: aarch64.h:229
@ AARCH64_OPND_HALF
Definition: aarch64.h:225
@ AARCH64_OPND_ADDR_PCREL19
Definition: aarch64.h:237
@ AARCH64_OPND_IMMS
Definition: aarch64.h:208
@ AARCH64_OPND_SYSREG_DC
Definition: aarch64.h:261
@ AARCH64_OPND_SVE_ADDR_RI_S9xVL
Definition: aarch64.h:275
@ AARCH64_OPND_LVt_AL
Definition: aarch64.h:188
@ AARCH64_OPND_Fn
Definition: aarch64.h:165
@ AARCH64_OPND_BARRIER_ISB
Definition: aarch64.h:265
@ AARCH64_OPND_SIMD_ADDR_SIMPLE
Definition: aarch64.h:254
@ AARCH64_OPND_IMM_MOV
Definition: aarch64.h:227
@ AARCH64_OPND_Rd
Definition: aarch64.h:148
@ AARCH64_OPND_Em
Definition: aarch64.h:183
@ AARCH64_OPND_SVE_ADDR_RI_S6xVL
Definition: aarch64.h:274
@ AARCH64_OPND_Ft
Definition: aarch64.h:168
@ AARCH64_OPND_SVE_PRFOP
Definition: aarch64.h:329
@ AARCH64_OPND_ADDR_ADRP
Definition: aarch64.h:235
@ AARCH64_OPND_SVE_ADDR_RZ_XTW2_22
Definition: aarch64.h:303
@ AARCH64_OPND_SVE_UIMM7
Definition: aarch64.h:349
@ AARCH64_OPND_SVE_ADDR_RZ_XTW1_14
Definition: aarch64.h:297
@ AARCH64_OPND_SVE_ADDR_RI_U6
Definition: aarch64.h:276
@ AARCH64_OPND_SVE_AIMM
Definition: aarch64.h:316
@ AARCH64_OPND_SVE_SIMM5B
Definition: aarch64.h:345
@ AARCH64_OPND_SHLL_IMM
Definition: aarch64.h:202
@ AARCH64_OPND_SVE_ADDR_RI_U6x8
Definition: aarch64.h:279
@ AARCH64_OPND_SVE_PATTERN
Definition: aarch64.h:327
@ AARCH64_OPND_SVE_ADDR_RZ_LSL2
Definition: aarch64.h:291
@ AARCH64_OPND_SVE_FPIMM8
Definition: aarch64.h:318
@ AARCH64_OPND_SVE_Za_16
Definition: aarch64.h:357
@ AARCH64_OPND_SVE_ADDR_RX
Definition: aarch64.h:285
@ AARCH64_OPND_ADDR_SIMM7
Definition: aarch64.h:243
@ AARCH64_OPND_NZCV
Definition: aarch64.h:220
@ AARCH64_OPND_LVn
Definition: aarch64.h:186
@ AARCH64_OPND_SVE_ADDR_RZ_LSL1
Definition: aarch64.h:290
@ AARCH64_OPND_SVE_UIMM8
Definition: aarch64.h:350
@ AARCH64_OPND_ADDR_PCREL21
Definition: aarch64.h:238
@ AARCH64_OPND_Rd_SP
Definition: aarch64.h:157
@ AARCH64_OPND_VdD1
Definition: aarch64.h:179
@ AARCH64_OPND_SVE_ZtxN
Definition: aarch64.h:368
@ AARCH64_OPND_ADDR_REGOFF
Definition: aarch64.h:242
@ AARCH64_OPND_AIMM
Definition: aarch64.h:224
@ AARCH64_OPND_IMMR
Definition: aarch64.h:207
@ AARCH64_OPND_VnD1
Definition: aarch64.h:180
@ AARCH64_OPND_SVE_SIMM5
Definition: aarch64.h:344
@ AARCH64_OPND_SVE_ADDR_RI_S4xVL
Definition: aarch64.h:270
@ AARCH64_OPND_UIMM4
Definition: aarch64.h:214
@ AARCH64_OPND_Rs
Definition: aarch64.h:153
@ AARCH64_OPND_SVE_ADDR_RZ
Definition: aarch64.h:289
@ AARCH64_OPND_SVE_Pd
Definition: aarch64.h:330
@ AARCH64_OPND_Rt2
Definition: aarch64.h:152
@ AARCH64_OPND_ADDR_OFFSET
Definition: aarch64.h:255
@ AARCH64_OPND_SVE_I1_HALF_TWO
Definition: aarch64.h:320
@ AARCH64_OPND_SVE_ADDR_RI_S4x2xVL
Definition: aarch64.h:271
@ AARCH64_OPND_SVE_Zm4_INDEX
Definition: aarch64.h:363
@ AARCH64_OPND_EXCEPTION
Definition: aarch64.h:217
@ AARCH64_OPND_Vd
Definition: aarch64.h:176
@ AARCH64_OPND_SVE_I1_ZERO_ONE
Definition: aarch64.h:321
@ AARCH64_OPND_SVE_ASIMM
Definition: aarch64.h:317
@ AARCH64_OPND_SVE_Za_5
Definition: aarch64.h:356
@ AARCH64_OPND_SVE_PATTERN_SCALED
Definition: aarch64.h:328
@ AARCH64_OPND_SVE_Pm
Definition: aarch64.h:335
@ AARCH64_OPND_SVE_ADDR_ZI_U5x8
Definition: aarch64.h:312
@ AARCH64_OPND_SVE_ADDR_RZ_XTW_22
Definition: aarch64.h:295
@ AARCH64_OPND_Fd
Definition: aarch64.h:164
@ AARCH64_OPND_SVE_SHLIMM_UNPRED
Definition: aarch64.h:341
@ AARCH64_OPND_SIMD_ADDR_POST
Definition: aarch64.h:256
@ AARCH64_OPND_SVE_ADDR_ZI_U5x4
Definition: aarch64.h:311
@ AARCH64_OPND_SVE_IMM_ROT2
Definition: aarch64.h:323
@ AARCH64_OPND_Vm
Definition: aarch64.h:178
@ AARCH64_OPND_IMM
Definition: aarch64.h:210
@ AARCH64_OPND_CCMP_IMM
Definition: aarch64.h:218
@ AARCH64_OPND_Rt
Definition: aarch64.h:151
@ AARCH64_OPND_IMM_ROT1
Definition: aarch64.h:228
@ AARCH64_OPND_Rt_SYS
Definition: aarch64.h:155
@ AARCH64_OPND_Rm
Definition: aarch64.h:150
@ AARCH64_OPND_SVE_Zn
Definition: aarch64.h:364
@ AARCH64_OPND_BARRIER
Definition: aarch64.h:264
@ AARCH64_OPND_SVE_ADDR_ZZ_UXTW
Definition: aarch64.h:315
@ AARCH64_OPND_Rm_SP
Definition: aarch64.h:159
@ AARCH64_OPND_SVE_Zt
Definition: aarch64.h:367
@ AARCH64_OPND_SVE_Zn_INDEX
Definition: aarch64.h:365
@ AARCH64_OPND_SVE_ADDR_RR_LSL1
Definition: aarch64.h:282
@ AARCH64_OPND_Rn
Definition: aarch64.h:149
@ AARCH64_OPND_SVE_Vd
Definition: aarch64.h:353
@ AARCH64_OPND_En
Definition: aarch64.h:182
@ AARCH64_OPND_MASK
Definition: aarch64.h:196
@ AARCH64_OPND_Rm_EXT
Definition: aarch64.h:161
@ AARCH64_OPND_SVE_ADDR_ZZ_SXTW
Definition: aarch64.h:314
@ AARCH64_OPND_SVE_Zm_16
Definition: aarch64.h:360
@ AARCH64_OPND_COND
Definition: aarch64.h:232
@ AARCH64_OPND_Ed
Definition: aarch64.h:181
@ AARCH64_OPND_IMM0
Definition: aarch64.h:204
@ AARCH64_OPND_ADDR_PCREL14
Definition: aarch64.h:236
@ AARCH64_OPND_SVE_ADDR_R
Definition: aarch64.h:280
@ AARCH64_OPND_SVE_ADDR_RZ_XTW3_22
Definition: aarch64.h:307
@ AARCH64_OPND_ADDR_SIMPLE
Definition: aarch64.h:241
@ AARCH64_OPND_Ra
Definition: aarch64.h:154
@ AARCH64_OPND_Sn
Definition: aarch64.h:172
@ AARCH64_OPND_FPIMM0
Definition: aarch64.h:205
@ AARCH64_OPND_SVE_ADDR_RI_U6x4
Definition: aarch64.h:278
@ AARCH64_OPND_SYSREG_TLBI
Definition: aarch64.h:263
@ AARCH64_OPND_SVE_ADDR_ZI_U5x2
Definition: aarch64.h:310
@ AARCH64_OPND_CRn
Definition: aarch64.h:192
@ AARCH64_OPND_Fm
Definition: aarch64.h:166
@ AARCH64_OPND_IMM_ROT3
Definition: aarch64.h:230
@ AARCH64_OPND_WIDTH
Definition: aarch64.h:209
@ AARCH64_OPND_SVE_Vn
Definition: aarch64.h:355
@ AARCH64_OPND_SVE_ADDR_RZ_XTW2_14
Definition: aarch64.h:301
@ AARCH64_OPND_UIMM7
Definition: aarch64.h:215
@ AARCH64_OPND_Vn
Definition: aarch64.h:177
@ AARCH64_OPND_PAIRREG
Definition: aarch64.h:160
@ AARCH64_OPND_SVE_INV_LIMM
Definition: aarch64.h:324
#define AARCH64_PCREL_OFFSET
Definition: aarch64.h:38
#define ARRAY_SIZE(a)
voidpf void uLong size
Definition: ioapi.h:138
voidpf void * buf
Definition: ioapi.h:138
snprintf
Definition: kernel.h:364
#define _(String)
Definition: opintl.h:53
static struct sockaddr static addrlen static backlog const void static flags void flags
Definition: sfsocketcall.h:123
long int64_t
Definition: sftypes.h:32
#define c(i)
Definition: sha256.c:43
const char * names[4]
Definition: aarch64.h:907
const char * name
Definition: aarch64.h:833
aarch64_insn pstatefield
Definition: aarch64.h:981
const aarch64_cond * cond
Definition: aarch64.h:979
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
Definition: aarch64.h:985
int64_t amount
Definition: aarch64.h:996
unsigned operator_present
Definition: aarch64.h:993
unsigned present
Definition: aarch64.h:1007
const struct aarch64_name_value_pair * barrier
Definition: aarch64.h:983
struct aarch64_opnd_info::@35::@39 reglane
enum aarch64_modifier_kind kind
Definition: aarch64.h:992
const aarch64_sys_ins_reg * sysins_op
Definition: aarch64.h:982
struct aarch64_opnd_info::@35::@41 imm
enum aarch64_opnd type
Definition: aarch64.h:920
const struct aarch64_name_value_pair * hint_option
Definition: aarch64.h:984
const char * name
Definition: aarch64.h:859
uint32_t flags
Definition: aarch64.h:846
const char * name
Definition: aarch64.h:844
Definition: z80asm.h:102
if(dbg->bits==RZ_SYS_BITS_64)
Definition: windows-arm64.h:4
static int addr
Definition: z80asm.c:58

References _, aarch64_get_qualifier_esize(), aarch64_get_qualifier_name(), AARCH64_MOD_LSL, AARCH64_MOD_NONE, AARCH64_MOD_UXTW, AARCH64_MOD_UXTX, aarch64_operand_modifiers, AARCH64_OPND_ADDR_ADRP, AARCH64_OPND_ADDR_OFFSET, AARCH64_OPND_ADDR_PCREL14, AARCH64_OPND_ADDR_PCREL19, AARCH64_OPND_ADDR_PCREL21, AARCH64_OPND_ADDR_PCREL26, AARCH64_OPND_ADDR_REGOFF, AARCH64_OPND_ADDR_SIMM10, AARCH64_OPND_ADDR_SIMM7, AARCH64_OPND_ADDR_SIMM9, AARCH64_OPND_ADDR_SIMM9_2, AARCH64_OPND_ADDR_SIMPLE, AARCH64_OPND_ADDR_UIMM12, AARCH64_OPND_AIMM, AARCH64_OPND_BARRIER, AARCH64_OPND_BARRIER_ISB, AARCH64_OPND_BARRIER_PSB, AARCH64_OPND_BIT_NUM, AARCH64_OPND_CCMP_IMM, AARCH64_OPND_COND, AARCH64_OPND_COND1, AARCH64_OPND_CRm, AARCH64_OPND_CRn, AARCH64_OPND_Ed, AARCH64_OPND_Em, AARCH64_OPND_Em16, AARCH64_OPND_En, AARCH64_OPND_EXCEPTION, AARCH64_OPND_Fa, AARCH64_OPND_FBITS, AARCH64_OPND_Fd, AARCH64_OPND_Fm, AARCH64_OPND_Fn, AARCH64_OPND_FPIMM, AARCH64_OPND_FPIMM0, AARCH64_OPND_Ft, AARCH64_OPND_Ft2, AARCH64_OPND_HALF, AARCH64_OPND_IDX, AARCH64_OPND_IMM, AARCH64_OPND_IMM0, AARCH64_OPND_IMM_2, AARCH64_OPND_IMM_MOV, AARCH64_OPND_IMM_ROT1, AARCH64_OPND_IMM_ROT2, AARCH64_OPND_IMM_ROT3, AARCH64_OPND_IMM_VLSL, AARCH64_OPND_IMM_VLSR, AARCH64_OPND_IMMR, AARCH64_OPND_IMMS, AARCH64_OPND_LEt, AARCH64_OPND_LIMM, AARCH64_OPND_LVn, AARCH64_OPND_LVt, AARCH64_OPND_LVt_AL, AARCH64_OPND_MASK, AARCH64_OPND_NZCV, AARCH64_OPND_PAIRREG, AARCH64_OPND_PRFOP, AARCH64_OPND_PSTATEFIELD, AARCH64_OPND_QLF_NIL, AARCH64_OPND_QLF_P_M, AARCH64_OPND_QLF_P_Z, AARCH64_OPND_QLF_SP, AARCH64_OPND_QLF_W, AARCH64_OPND_QLF_WSP, AARCH64_OPND_QLF_X, AARCH64_OPND_Ra, AARCH64_OPND_Rd, AARCH64_OPND_Rd_SP, AARCH64_OPND_Rm, AARCH64_OPND_Rm_EXT, AARCH64_OPND_Rm_SFT, AARCH64_OPND_Rm_SP, AARCH64_OPND_Rn, AARCH64_OPND_Rn_SP, AARCH64_OPND_Rs, AARCH64_OPND_Rt, AARCH64_OPND_Rt2, AARCH64_OPND_Rt_SYS, AARCH64_OPND_Sd, AARCH64_OPND_SHLL_IMM, AARCH64_OPND_SIMD_ADDR_POST, AARCH64_OPND_SIMD_ADDR_SIMPLE, AARCH64_OPND_SIMD_FPIMM, AARCH64_OPND_SIMD_IMM, AARCH64_OPND_SIMD_IMM_SFT, AARCH64_OPND_SIMM5, AARCH64_OPND_Sm, AARCH64_OPND_SM3_IMM2, AARCH64_OPND_Sn, AARCH64_OPND_SVE_ADDR_R, AARCH64_OPND_SVE_ADDR_RI_S4x16, AARCH64_OPND_SVE_ADDR_RI_S4x2xVL, AARCH64_OPND_SVE_ADDR_RI_S4x3xVL, AARCH64_OPND_SVE_ADDR_RI_S4x4xVL, AARCH64_OPND_SVE_ADDR_RI_S4xVL, AARCH64_OPND_SVE_ADDR_RI_S6xVL, AARCH64_OPND_SVE_ADDR_RI_S9xVL, AARCH64_OPND_SVE_ADDR_RI_U6, AARCH64_OPND_SVE_ADDR_RI_U6x2, AARCH64_OPND_SVE_ADDR_RI_U6x4, AARCH64_OPND_SVE_ADDR_RI_U6x8, AARCH64_OPND_SVE_ADDR_RR, AARCH64_OPND_SVE_ADDR_RR_LSL1, AARCH64_OPND_SVE_ADDR_RR_LSL2, AARCH64_OPND_SVE_ADDR_RR_LSL3, AARCH64_OPND_SVE_ADDR_RX, AARCH64_OPND_SVE_ADDR_RX_LSL1, AARCH64_OPND_SVE_ADDR_RX_LSL2, AARCH64_OPND_SVE_ADDR_RX_LSL3, AARCH64_OPND_SVE_ADDR_RZ, AARCH64_OPND_SVE_ADDR_RZ_LSL1, AARCH64_OPND_SVE_ADDR_RZ_LSL2, AARCH64_OPND_SVE_ADDR_RZ_LSL3, AARCH64_OPND_SVE_ADDR_RZ_XTW1_14, AARCH64_OPND_SVE_ADDR_RZ_XTW1_22, AARCH64_OPND_SVE_ADDR_RZ_XTW2_14, AARCH64_OPND_SVE_ADDR_RZ_XTW2_22, AARCH64_OPND_SVE_ADDR_RZ_XTW3_14, AARCH64_OPND_SVE_ADDR_RZ_XTW3_22, AARCH64_OPND_SVE_ADDR_RZ_XTW_14, AARCH64_OPND_SVE_ADDR_RZ_XTW_22, AARCH64_OPND_SVE_ADDR_ZI_U5, AARCH64_OPND_SVE_ADDR_ZI_U5x2, AARCH64_OPND_SVE_ADDR_ZI_U5x4, AARCH64_OPND_SVE_ADDR_ZI_U5x8, AARCH64_OPND_SVE_ADDR_ZZ_LSL, AARCH64_OPND_SVE_ADDR_ZZ_SXTW, AARCH64_OPND_SVE_ADDR_ZZ_UXTW, AARCH64_OPND_SVE_AIMM, AARCH64_OPND_SVE_ASIMM, AARCH64_OPND_SVE_FPIMM8, AARCH64_OPND_SVE_I1_HALF_ONE, AARCH64_OPND_SVE_I1_HALF_TWO, AARCH64_OPND_SVE_I1_ZERO_ONE, AARCH64_OPND_SVE_IMM_ROT1, AARCH64_OPND_SVE_IMM_ROT2, AARCH64_OPND_SVE_INV_LIMM, AARCH64_OPND_SVE_LIMM, AARCH64_OPND_SVE_LIMM_MOV, AARCH64_OPND_SVE_PATTERN, AARCH64_OPND_SVE_PATTERN_SCALED, AARCH64_OPND_SVE_Pd, AARCH64_OPND_SVE_Pg3, AARCH64_OPND_SVE_Pg4_10, AARCH64_OPND_SVE_Pg4_16, AARCH64_OPND_SVE_Pg4_5, AARCH64_OPND_SVE_Pm, AARCH64_OPND_SVE_Pn, AARCH64_OPND_SVE_PRFOP, AARCH64_OPND_SVE_Pt, AARCH64_OPND_SVE_Rm, AARCH64_OPND_SVE_Rn_SP, AARCH64_OPND_SVE_SHLIMM_PRED, AARCH64_OPND_SVE_SHLIMM_UNPRED, AARCH64_OPND_SVE_SHRIMM_PRED, AARCH64_OPND_SVE_SHRIMM_UNPRED, AARCH64_OPND_SVE_SIMM5, AARCH64_OPND_SVE_SIMM5B, AARCH64_OPND_SVE_SIMM6, AARCH64_OPND_SVE_SIMM8, AARCH64_OPND_SVE_UIMM3, AARCH64_OPND_SVE_UIMM7, AARCH64_OPND_SVE_UIMM8, AARCH64_OPND_SVE_UIMM8_53, AARCH64_OPND_SVE_Vd, AARCH64_OPND_SVE_Vm, AARCH64_OPND_SVE_Vn, AARCH64_OPND_SVE_VZn, AARCH64_OPND_SVE_Za_16, AARCH64_OPND_SVE_Za_5, AARCH64_OPND_SVE_Zd, AARCH64_OPND_SVE_Zm3_22_INDEX, AARCH64_OPND_SVE_Zm3_INDEX, AARCH64_OPND_SVE_Zm4_INDEX, AARCH64_OPND_SVE_Zm_16, AARCH64_OPND_SVE_Zm_5, AARCH64_OPND_SVE_Zn, AARCH64_OPND_SVE_Zn_INDEX, AARCH64_OPND_SVE_ZnxN, AARCH64_OPND_SVE_Zt, AARCH64_OPND_SVE_ZtxN, AARCH64_OPND_SYSREG, AARCH64_OPND_SYSREG_AT, AARCH64_OPND_SYSREG_DC, AARCH64_OPND_SYSREG_IC, AARCH64_OPND_SYSREG_TLBI, AARCH64_OPND_UIMM3_OP1, AARCH64_OPND_UIMM3_OP2, AARCH64_OPND_UIMM4, AARCH64_OPND_UIMM7, AARCH64_OPND_Va, AARCH64_OPND_Vd, AARCH64_OPND_VdD1, AARCH64_OPND_Vm, AARCH64_OPND_Vn, AARCH64_OPND_VnD1, AARCH64_OPND_WIDTH, AARCH64_PCREL_OFFSET, aarch64_pstatefields, aarch64_stack_pointer_p(), aarch64_sve_pattern_array, aarch64_sve_prfop_array, aarch64_sys_reg_deprecated_p(), aarch64_sys_regs, aarch64_opnd_info::addr, addr, aarch64_opnd_info::amount, ARRAY_SIZE, assert(), aarch64_opnd_info::barrier, c, aarch64_opnd_info::cond, expand_fp_imm(), F_REG_READ, F_REG_WRITE, aarch64_sys_reg::flags, flags, get_64bit_int_reg_name(), get_addr_sve_reg_name(), get_int_reg_name(), get_offset_int_reg_name(), get_optional_operand_default_value(), aarch64_opnd_info::hint_option, i, setup::idx, if(), aarch64_opnd_info::imm, operand_qualifier_data::kind, aarch64_opnd_info::kind, len, aarch64_name_value_pair::name, aarch64_sys_reg::name, aarch64_sys_ins_reg::name, aarch64_cond::names, NULL, aarch64_opnd_info::operator_present, optional_operand_p(), pc, aarch64_opnd_info::present, aarch64_opnd_info::prfop, print_immediate_offset_address(), print_register_list(), print_register_offset_address(), PRIx64, aarch64_opnd_info::pstatefield, aarch64_opnd_info::qualifier, aarch64_opnd_info::reg, aarch64_opnd_info::reglane, aarch64_opnd_info::shifter, snprintf, aarch64_opnd_info::sysins_op, aarch64_opnd_info::sysreg, TRUE, aarch64_opnd_info::type, aarch64_name_value_pair::value, and value.

Referenced by print_operands().

◆ aarch64_pstatefield_supported_p()

bfd_boolean aarch64_pstatefield_supported_p ( const aarch64_feature_set  features,
const aarch64_sys_reg reg 
)

Definition at line 4293 of file aarch64-opc.c.

4295 {
4296  if (!(reg->flags & F_ARCHEXT))
4297  return TRUE;
4298 
4299  /* PAN. Values are from aarch64_pstatefields. */
4300  if (reg->value == 0x04
4302  return FALSE;
4303 
4304  /* UAO. Values are from aarch64_pstatefields. */
4305  if (reg->value == 0x03
4307  return FALSE;
4308 
4309  /* DIT. Values are from aarch64_pstatefields. */
4310  if (reg->value == 0x1a
4312  return FALSE;
4313 
4314  return TRUE;
4315 }
#define F_ARCHEXT
Definition: aarch64-opc.h:207
#define AARCH64_FEATURE_PAN
Definition: aarch64.h:56
#define AARCH64_FEATURE_V8_2
Definition: aarch64.h:49
#define AARCH64_FEATURE_V8_4
Definition: aarch64.h:45
#define AARCH64_CPU_HAS_FEATURE(CPU, FEAT)
Definition: aarch64.h:104
static const struct @646 features[]
#define reg(n)

References AARCH64_CPU_HAS_FEATURE, AARCH64_FEATURE_PAN, AARCH64_FEATURE_V8_2, AARCH64_FEATURE_V8_4, F_ARCHEXT, FALSE, features, reg, and TRUE.

◆ aarch64_replace_opcode()

const aarch64_opcode* aarch64_replace_opcode ( aarch64_inst inst,
const aarch64_opcode opcode 
)

Definition at line 2715 of file aarch64-opc.c.

2716 {
2717  int i;
2718  const aarch64_opcode *old = inst->opcode;
2719 
2720  inst->opcode = opcode;
2721 
2722  /* Update the operand types. */
2723  for (i = 0; i < AARCH64_MAX_OPND_NUM; ++i)
2724  {
2725  inst->operands[i].type = opcode->operands[i];
2726  if (opcode->operands[i] == AARCH64_OPND_NIL)
2727  break;
2728  }
2729 
2730  DEBUG_TRACE ("replace %s with %s", old->name, opcode->name);
2731 
2732  return old;
2733 }
const char * name
Definition: aarch64.h:673

References AARCH64_MAX_OPND_NUM, AARCH64_OPND_NIL, DEBUG_TRACE, i, aarch64_opcode::name, aarch64_inst::opcode, aarch64_opcode::operands, aarch64_inst::operands, and aarch64_opnd_info::type.

Referenced by determine_disassembling_preference().

◆ aarch64_select_operand_for_sizeq_field_coding()

int aarch64_select_operand_for_sizeq_field_coding ( const aarch64_opcode opcode)

Definition at line 199 of file aarch64-opc.c.

200 {
201  return
203 }
static const char significant_operand_index[]
Definition: aarch64-opc.c:133
static enum data_pattern get_data_pattern(const aarch64_opnd_qualifier_seq_t qualifiers)
Definition: aarch64-opc.c:148
aarch64_opnd_qualifier_seq_t qualifiers_list[AARCH64_MAX_QLF_SEQ_NUM]
Definition: aarch64.h:703

References get_data_pattern(), aarch64_opcode::qualifiers_list, and significant_operand_index.

Referenced by decode_sizeq().

◆ aarch64_shift_operator_p()

static bfd_boolean aarch64_shift_operator_p ( enum aarch64_modifier_kind  kind)
inlinestatic

Definition at line 437 of file aarch64-opc.c.

438 {
439  return (kind >= AARCH64_MOD_ROR && kind <= AARCH64_MOD_LSL)
440  ? TRUE : FALSE;
441 }
@ AARCH64_MOD_ROR
Definition: aarch64.h:880

Referenced by operand_general_constraint_met_p().

◆ aarch64_shrink_expanded_imm8()

int aarch64_shrink_expanded_imm8 ( uint64_t  imm)

Definition at line 1255 of file aarch64-opc.c.

1256 {
1257  int i, ret;
1258  uint32_t byte;
1259 
1260  ret = 0;
1261  for (i = 0; i < 8; i++)
1262  {
1263  byte = (imm >> (8 * i)) & 0xff;
1264  if (byte == 0xff)
1265  ret |= 1 << i;
1266  else if (byte != 0x00)
1267  return -1;
1268  }
1269  return ret;
1270 }
#define imm
unsigned int uint32_t
Definition: sftypes.h:29

References i, and imm.

Referenced by operand_general_constraint_met_p().

◆ aarch64_stack_pointer_p()

int aarch64_stack_pointer_p ( const aarch64_opnd_info operand)

Definition at line 562 of file aarch64-opc.c.

563 {
564  return ((aarch64_get_operand_class (operand->type)
567  && operand->reg.regno == 31);
568 }
enum aarch64_operand_class aarch64_get_operand_class(enum aarch64_opnd type)
Definition: aarch64-opc.c:328
static bfd_boolean operand_maybe_stack_pointer(const aarch64_operand *operand)
Definition: aarch64-opc.h:243
@ AARCH64_OPND_CLASS_INT_REG
Definition: aarch64.h:126

References aarch64_get_operand_class(), aarch64_operands, AARCH64_OPND_CLASS_INT_REG, and operand_maybe_stack_pointer().

Referenced by aarch64_print_operand(), operand_also_qualified_p(), and operand_general_constraint_met_p().

◆ aarch64_sve_dupm_mov_immediate_p()

bfd_boolean aarch64_sve_dupm_mov_immediate_p ( uint64_t  uvalue,
int  esize 
)

Definition at line 4521 of file aarch64-opc.c.

4522 {
4523  int64_t svalue = uvalue;
4524  uint64_t upper = (uint64_t) -1 << (esize * 4) << (esize * 4);
4525 
4526  if ((uvalue & ~upper) != uvalue && (uvalue | upper) != uvalue)
4527  return FALSE;
4528  if (esize <= 4 || (uint32_t) uvalue == (uint32_t) (uvalue >> 32))
4529  {
4530  svalue = (int32_t) uvalue;
4531  if (esize <= 2 || (uint16_t) uvalue == (uint16_t) (uvalue >> 16))
4532  {
4533  svalue = (int16_t) uvalue;
4534  if (esize == 1 || (uint8_t) uvalue == (uint8_t) (uvalue >> 8))
4535  return FALSE;
4536  }
4537  }
4538  if ((svalue & 0xff) == 0)
4539  svalue /= 256;
4540  return svalue < -128 || svalue >= 128;
4541 }
unsigned short uint16_t
Definition: sftypes.h:30
int int32_t
Definition: sftypes.h:33
short int16_t
Definition: sftypes.h:34
unsigned char uint8_t
Definition: sftypes.h:31

References FALSE.

Referenced by aarch64_ext_sve_limm_mov(), and operand_general_constraint_met_p().

◆ aarch64_sys_ins_reg_has_xt()

bfd_boolean aarch64_sys_ins_reg_has_xt ( const aarch64_sys_ins_reg sys_ins_reg)

Definition at line 4445 of file aarch64-opc.c.

4446 {
4447  return (sys_ins_reg->flags & F_HASXT) != 0;
4448 }
#define F_HASXT
Definition: aarch64-opc.h:210
uint32_t flags
Definition: aarch64.h:861

References F_HASXT, and aarch64_sys_ins_reg::flags.

Referenced by aarch64_ext_regrt_sysins(), aarch64_ext_sysins_op(), and operand_general_constraint_met_p().

◆ aarch64_sys_ins_reg_supported_p()

bfd_boolean aarch64_sys_ins_reg_supported_p ( const aarch64_feature_set  features,
const aarch64_sys_ins_reg reg 
)

Definition at line 4451 of file aarch64-opc.c.

4453 {
4454  if (!(reg->flags & F_ARCHEXT))
4455  return TRUE;
4456 
4457  /* DC CVAP. Values are from aarch64_sys_regs_dc. */
4458  if (reg->value == CPENS (3, C7, C12, 1)
4460  return FALSE;
4461 
4462  /* AT S1E1RP, AT S1E1WP. Values are from aarch64_sys_regs_at. */
4463  if ((reg->value == CPENS (0, C7, C9, 0)
4464  || reg->value == CPENS (0, C7, C9, 1))
4466  return FALSE;
4467 
4468  return TRUE;
4469 }
#define C9
Definition: aarch64-opc.c:3663
#define CPENS(op1, crn, crm, op2)
Definition: aarch64-opc.c:3652
#define C12
Definition: aarch64-opc.c:3666
#define C7
Definition: aarch64-opc.c:3661

References AARCH64_CPU_HAS_FEATURE, AARCH64_FEATURE_V8_2, C12, C7, C9, CPENS, F_ARCHEXT, FALSE, features, reg, and TRUE.

◆ aarch64_sys_reg_deprecated_p()

bfd_boolean aarch64_sys_reg_deprecated_p ( const aarch64_sys_reg reg)

Definition at line 4067 of file aarch64-opc.c.

4068 {
4069  return (reg->flags & F_DEPRECATED) != 0;
4070 }
#define F_DEPRECATED
Definition: aarch64-opc.h:204

References F_DEPRECATED, and reg.

Referenced by aarch64_print_operand().

◆ aarch64_sys_reg_supported_p()

bfd_boolean aarch64_sys_reg_supported_p ( const aarch64_feature_set  features,
const aarch64_sys_reg reg 
)

Definition at line 4073 of file aarch64-opc.c.

4075 {
4076  if (!(reg->flags & F_ARCHEXT))
4077  return TRUE;
4078 
4079  /* PAN. Values are from aarch64_sys_regs. */
4080  if (reg->value == CPEN_(0,C2,3)
4082  return FALSE;
4083 
4084  /* Virtualization host extensions: system registers. */
4085  if ((reg->value == CPENC (3, 4, C2, C0, 1)
4086  || reg->value == CPENC (3, 4, C13, C0, 1)
4087  || reg->value == CPENC (3, 4, C14, C3, 0)
4088  || reg->value == CPENC (3, 4, C14, C3, 1)
4089  || reg->value == CPENC (3, 4, C14, C3, 2))
4091  return FALSE;
4092 
4093  /* Virtualization host extensions: *_el12 names of *_el1 registers. */
4094  if ((reg->value == CPEN_ (5, C0, 0)
4095  || reg->value == CPEN_ (5, C0, 1)
4096  || reg->value == CPENC (3, 5, C1, C0, 0)
4097  || reg->value == CPENC (3, 5, C1, C0, 2)
4098  || reg->value == CPENC (3, 5, C2, C0, 0)
4099  || reg->value == CPENC (3, 5, C2, C0, 1)
4100  || reg->value == CPENC (3, 5, C2, C0, 2)
4101  || reg->value == CPENC (3, 5, C5, C1, 0)
4102  || reg->value == CPENC (3, 5, C5, C1, 1)
4103  || reg->value == CPENC (3, 5, C5, C2, 0)
4104  || reg->value == CPENC (3, 5, C6, C0, 0)
4105  || reg->value == CPENC (3, 5, C10, C2, 0)
4106  || reg->value == CPENC (3, 5, C10, C3, 0)
4107  || reg->value == CPENC (3, 5, C12, C0, 0)
4108  || reg->value == CPENC (3, 5, C13, C0, 1)
4109  || reg->value == CPENC (3, 5, C14, C1, 0))
4111  return FALSE;
4112 
4113  /* Virtualization host extensions: *_el02 names of *_el0 registers. */
4114  if ((reg->value == CPENC (3, 5, C14, C2, 0)
4115  || reg->value == CPENC (3, 5, C14, C2, 1)
4116  || reg->value == CPENC (3, 5, C14, C2, 2)
4117  || reg->value == CPENC (3, 5, C14, C3, 0)
4118  || reg->value == CPENC (3, 5, C14, C3, 1)
4119  || reg->value == CPENC (3, 5, C14, C3, 2))
4121  return FALSE;
4122 
4123  /* ARMv8.2 features. */
4124 
4125  /* ID_AA64MMFR2_EL1. */
4126  if (reg->value == CPENC (3, 0, C0, C7, 2)
4128  return FALSE;
4129 
4130  /* PSTATE.UAO. */
4131  if (reg->value == CPEN_ (0, C2, 4)
4133  return FALSE;
4134 
4135  /* RAS extension. */
4136 
4137  /* ERRIDR_EL1, ERRSELR_EL1, ERXFR_EL1, ERXCTLR_EL1, ERXSTATUS_EL, ERXADDR_EL1,
4138  ERXMISC0_EL1 AND ERXMISC1_EL1. */
4139  if ((reg->value == CPENC (3, 0, C5, C3, 0)
4140  || reg->value == CPENC (3, 0, C5, C3, 1)
4141  || reg->value == CPENC (3, 0, C5, C3, 2)
4142  || reg->value == CPENC (3, 0, C5, C3, 3)
4143  || reg->value == CPENC (3, 0, C5, C4, 0)
4144  || reg->value == CPENC (3, 0, C5, C4, 1)
4145  || reg->value == CPENC (3, 0, C5, C4, 2)
4146  || reg->value == CPENC (3, 0, C5, C4, 3)
4147  || reg->value == CPENC (3, 0, C5, C5, 0)
4148  || reg->value == CPENC (3, 0, C5, C5, 1))
4150  return FALSE;
4151 
4152  /* VSESR_EL2, DISR_EL1 and VDISR_EL2. */
4153  if ((reg->value == CPENC (3, 4, C5, C2, 3)
4154  || reg->value == CPENC (3, 0, C12, C1, 1)
4155  || reg->value == CPENC (3, 4, C12, C1, 1))
4157  return FALSE;
4158 
4159  /* Statistical Profiling extension. */
4160  if ((reg->value == CPENC (3, 0, C9, C10, 0)
4161  || reg->value == CPENC (3, 0, C9, C10, 1)
4162  || reg->value == CPENC (3, 0, C9, C10, 3)
4163  || reg->value == CPENC (3, 0, C9, C10, 7)
4164  || reg->value == CPENC (3, 0, C9, C9, 0)
4165  || reg->value == CPENC (3, 0, C9, C9, 2)
4166  || reg->value == CPENC (3, 0, C9, C9, 3)
4167  || reg->value == CPENC (3, 0, C9, C9, 4)
4168  || reg->value == CPENC (3, 0, C9, C9, 5)
4169  || reg->value == CPENC (3, 0, C9, C9, 6)
4170  || reg->value == CPENC (3, 0, C9, C9, 7)
4171  || reg->value == CPENC (3, 4, C9, C9, 0)
4172  || reg->value == CPENC (3, 5, C9, C9, 0))
4174  return FALSE;
4175 
4176  /* ARMv8.3 Pointer authentication keys. */
4177  if ((reg->value == CPENC (3, 0, C2, C1, 0)
4178  || reg->value == CPENC (3, 0, C2, C1, 1)
4179  || reg->value == CPENC (3, 0, C2, C1, 2)
4180  || reg->value == CPENC (3, 0, C2, C1, 3)
4181  || reg->value == CPENC (3, 0, C2, C2, 0)
4182  || reg->value == CPENC (3, 0, C2, C2, 1)
4183  || reg->value == CPENC (3, 0, C2, C2, 2)
4184  || reg->value == CPENC (3, 0, C2, C2, 3)
4185  || reg->value == CPENC (3, 0, C2, C3, 0)
4186  || reg->value == CPENC (3, 0, C2, C3, 1))
4188  return FALSE;
4189 
4190  /* SVE. */
4191  if ((reg->value == CPENC (3, 0, C0, C4, 4)
4192  || reg->value == CPENC (3, 0, C1, C2, 0)
4193  || reg->value == CPENC (3, 4, C1, C2, 0)
4194  || reg->value == CPENC (3, 6, C1, C2, 0)
4195  || reg->value == CPENC (3, 5, C1, C2, 0)
4196  || reg->value == CPENC (3, 0, C0, C0, 7))
4198  return FALSE;
4199 
4200  /* ARMv8.4 features. */
4201 
4202  /* PSTATE.DIT. */
4203  if (reg->value == CPEN_ (3, C2, 5)
4205  return FALSE;
4206 
4207  /* Virtualization extensions. */
4208  if ((reg->value == CPENC(3, 4, C2, C6, 2)
4209  || reg->value == CPENC(3, 4, C2, C6, 0)
4210  || reg->value == CPENC(3, 4, C14, C4, 0)
4211  || reg->value == CPENC(3, 4, C14, C4, 2)
4212  || reg->value == CPENC(3, 4, C14, C4, 1)
4213  || reg->value == CPENC(3, 4, C14, C5, 0)
4214  || reg->value == CPENC(3, 4, C14, C5, 2)
4215  || reg->value == CPENC(3, 4, C14, C5, 1)
4216  || reg->value == CPENC(3, 4, C1, C3, 1)
4217  || reg->value == CPENC(3, 4, C2, C2, 0))
4219  return FALSE;
4220 
4221  /* ARMv8.4 TLB instructions. */
4222  if ((reg->value == CPENS (0, C8, C1, 0)
4223  || reg->value == CPENS (0, C8, C1, 1)
4224  || reg->value == CPENS (0, C8, C1, 2)
4225  || reg->value == CPENS (0, C8, C1, 3)
4226  || reg->value == CPENS (0, C8, C1, 5)
4227  || reg->value == CPENS (0, C8, C1, 7)
4228  || reg->value == CPENS (4, C8, C4, 0)
4229  || reg->value == CPENS (4, C8, C4, 4)
4230  || reg->value == CPENS (4, C8, C1, 1)
4231  || reg->value == CPENS (4, C8, C1, 5)
4232  || reg->value == CPENS (4, C8, C1, 6)
4233  || reg->value == CPENS (6, C8, C1, 1)
4234  || reg->value == CPENS (6, C8, C1, 5)
4235  || reg->value == CPENS (4, C8, C1, 0)
4236  || reg->value == CPENS (4, C8, C1, 4)
4237  || reg->value == CPENS (6, C8, C1, 0)
4238  || reg->value == CPENS (0, C8, C6, 1)
4239  || reg->value == CPENS (0, C8, C6, 3)
4240  || reg->value == CPENS (0, C8, C6, 5)
4241  || reg->value == CPENS (0, C8, C6, 7)
4242  || reg->value == CPENS (0, C8, C2, 1)
4243  || reg->value == CPENS (0, C8, C2, 3)
4244  || reg->value == CPENS (0, C8, C2, 5)
4245  || reg->value == CPENS (0, C8, C2, 7)
4246  || reg->value == CPENS (0, C8, C5, 1)
4247  || reg->value == CPENS (0, C8, C5, 3)
4248  || reg->value == CPENS (0, C8, C5, 5)
4249  || reg->value == CPENS (0, C8, C5, 7)
4250  || reg->value == CPENS (4, C8, C0, 2)
4251  || reg->value == CPENS (4, C8, C0, 6)
4252  || reg->value == CPENS (4, C8, C4, 2)
4253  || reg->value == CPENS (4, C8, C4, 6)
4254  || reg->value == CPENS (4, C8, C4, 3)
4255  || reg->value == CPENS (4, C8, C4, 7)
4256  || reg->value == CPENS (4, C8, C6, 1)
4257  || reg->value == CPENS (4, C8, C6, 5)
4258  || reg->value == CPENS (4, C8, C2, 1)
4259  || reg->value == CPENS (4, C8, C2, 5)
4260  || reg->value == CPENS (4, C8, C5, 1)
4261  || reg->value == CPENS (4, C8, C5, 5)
4262  || reg->value == CPENS (6, C8, C6, 1)
4263  || reg->value == CPENS (6, C8, C6, 5)
4264  || reg->value == CPENS (6, C8, C2, 1)
4265  || reg->value == CPENS (6, C8, C2, 5)
4266  || reg->value == CPENS (6, C8, C5, 1)
4267  || reg->value == CPENS (6, C8, C5, 5))
4269  return FALSE;
4270 
4271  return TRUE;
4272 }
#define CPENC(op0, op1, crn, crm, op2)
Definition: aarch64-opc.c:3647
#define C5
Definition: aarch64-opc.c:3659
#define C6
Definition: aarch64-opc.c:3660
#define C1
Definition: aarch64-opc.c:3655
#define C3
Definition: aarch64-opc.c:3657
#define C8
Definition: aarch64-opc.c:3662
#define C10
Definition: aarch64-opc.c:3664
#define C13
Definition: aarch64-opc.c:3667
#define CPEN_(op1, crm, op2)
Definition: aarch64-opc.c:3650
#define C0
Definition: aarch64-opc.c:3654
#define C14
Definition: aarch64-opc.c:3668
#define C4
Definition: aarch64-opc.c:3658
#define C2
Definition: aarch64-opc.c:3656
#define AARCH64_FEATURE_V8_3
Definition: aarch64.h:50
#define AARCH64_FEATURE_SVE
Definition: aarch64.h:63
#define AARCH64_FEATURE_PROFILE
Definition: aarch64.h:62
#define AARCH64_FEATURE_RAS
Definition: aarch64.h:61
#define AARCH64_FEATURE_V8_1
Definition: aarch64.h:59

References AARCH64_CPU_HAS_FEATURE, AARCH64_FEATURE_PAN, AARCH64_FEATURE_PROFILE, AARCH64_FEATURE_RAS, AARCH64_FEATURE_SVE, AARCH64_FEATURE_V8_1, AARCH64_FEATURE_V8_2, AARCH64_FEATURE_V8_3, AARCH64_FEATURE_V8_4, C0, C1, C10, C12, C13, C14, C2, C3, C4, C5, C6, C7, C8, C9, CPEN_, CPENC, CPENS, F_ARCHEXT, FALSE, features, reg, and TRUE.

◆ aarch64_wide_constant_p()

bfd_boolean aarch64_wide_constant_p ( int64_t  value,
int  is32,
unsigned int shift_amount 
)

Definition at line 1033 of file aarch64-opc.c.

1034 {
1035  int amount;
1036 
1037  DEBUG_TRACE ("enter with 0x%" PRIx64 "(%" PRIi64 ")", value, value);
1038 
1039  if (is32)
1040  {
1041  /* Allow all zeros or all ones in top 32-bits, so that
1042  32-bit constant expressions like ~0x80000000 are
1043  permitted. */
1044  uint64_t ext = value;
1045  if (ext >> 32 != 0 && ext >> 32 != (uint64_t) 0xffffffff)
1046  /* Immediate out of range. */
1047  return FALSE;
1048  value &= (int64_t) 0xffffffff;
1049  }
1050 
1051  /* first, try movz then movn */
1052  amount = -1;
1053  if ((value & ((int64_t) 0xffff << 0)) == value)
1054  amount = 0;
1055  else if ((value & ((int64_t) 0xffff << 16)) == value)
1056  amount = 16;
1057  else if (!is32 && (value & ((int64_t) 0xffff << 32)) == value)
1058  amount = 32;
1059  else if (!is32 && (value & ((int64_t) 0xffff << 48)) == value)
1060  amount = 48;
1061 
1062  if (amount == -1)
1063  {
1064  DEBUG_TRACE ("exit FALSE with 0x%" PRIx64 "(%" PRIi64 ")", value, value);
1065  return FALSE;
1066  }
1067 
1068  if (shift_amount != NULL)
1069  *shift_amount = amount;
1070 
1071  DEBUG_TRACE ("exit TRUE with amount %d", amount);
1072 
1073  return TRUE;
1074 }
static const char ext[]
Definition: apprentice.c:1981

References DEBUG_TRACE, ext, FALSE, NULL, PRIx64, TRUE, and value.

Referenced by convert_movebitmask_to_mov(), convert_movewide_to_mov(), and operand_general_constraint_met_p().

◆ aarch64_zero_register_p()

int aarch64_zero_register_p ( const aarch64_opnd_info operand)

Definition at line 572 of file aarch64-opc.c.

573 {
574  return ((aarch64_get_operand_class (operand->type)
577  && operand->reg.regno == 31);
578 }

References aarch64_get_operand_class(), aarch64_operands, AARCH64_OPND_CLASS_INT_REG, and operand_maybe_stack_pointer().

◆ build_immediate_table()

static void build_immediate_table ( void  )
static

Definition at line 1133 of file aarch64-opc.c.

1134 {
1135  uint32_t log_e, e, s, r, s_mask;
1136  uint64_t mask, imm;
1137  int nb_imms;
1138  int is64;
1139 
1140  nb_imms = 0;
1141  for (log_e = 1; log_e <= 6; log_e++)
1142  {
1143  /* Get element size. */
1144  e = 1u << log_e;
1145  if (log_e == 6)
1146  {
1147  is64 = 1;
1148  mask = 0xffffffffffffffffull;
1149  s_mask = 0;
1150  }
1151  else
1152  {
1153  is64 = 0;
1154  mask = (1ull << e) - 1;
1155  /* log_e s_mask
1156  1 ((1 << 4) - 1) << 2 = 111100
1157  2 ((1 << 3) - 1) << 3 = 111000
1158  3 ((1 << 2) - 1) << 4 = 110000
1159  4 ((1 << 1) - 1) << 5 = 100000
1160  5 ((1 << 0) - 1) << 6 = 000000 */
1161  s_mask = ((1u << (5 - log_e)) - 1) << (log_e + 1);
1162  }
1163  for (s = 0; s < e - 1; s++)
1164  for (r = 0; r < e; r++)
1165  {
1166  /* s+1 consecutive bits to 1 (s < 63) */
1167  imm = (1ull << (s + 1)) - 1;
1168  /* rotate right by r */
1169  if (r != 0)
1170  imm = (imm >> r) | ((imm << (e - r)) & mask);
1171  /* replicate the constant depending on SIMD size */
1172  switch (log_e)
1173  {
1174  case 1: imm = (imm << 2) | imm;
1175  /* Fall through. */
1176  case 2: imm = (imm << 4) | imm;
1177  /* Fall through. */
1178  case 3: imm = (imm << 8) | imm;
1179  /* Fall through. */
1180  case 4: imm = (imm << 16) | imm;
1181  /* Fall through. */
1182  case 5: imm = (imm << 32) | imm;
1183  /* Fall through. */
1184  case 6: break;
1185  default: abort ();
1186  }
1187  simd_immediates[nb_imms].imm = imm;
1188  simd_immediates[nb_imms].encoding =
1189  encode_immediate_bitfield(is64, s | s_mask, r);
1190  nb_imms++;
1191  }
1192  }
1193  assert (nb_imms == TOTAL_IMM_NB);
1194  qsort(simd_immediates, nb_imms,
1196 }
static int encode_immediate_bitfield(int is64, uint32_t s, uint32_t r)
Definition: aarch64-opc.c:1127
#define e(frag)
#define mask()
#define r
Definition: crypto_rc6.c:12
void qsort(void *a, size_t n, size_t es, int(*cmp)(const void *, const void *))
Definition: qsort.h:130
static RzSocket * s
Definition: rtr.c:28

References assert(), e, encode_immediate_bitfield(), simd_imm_encoding::encoding, imm, simd_imm_encoding::imm, mask, qsort(), r, s, simd_imm_encoding_cmp(), simd_immediates, and TOTAL_IMM_NB.

Referenced by aarch64_logical_immediate_p().

◆ encode_immediate_bitfield()

static int encode_immediate_bitfield ( int  is64,
uint32_t  s,
uint32_t  r 
)
inlinestatic

Definition at line 1127 of file aarch64-opc.c.

1128 {
1129  return (is64 << 12) | (r << 6) | s;
1130 }

References r, and s.

Referenced by build_immediate_table().

◆ expand_fp_imm()

static uint64_t expand_fp_imm ( int  size,
uint32_t  imm8 
)
static

Definition at line 2859 of file aarch64-opc.c.

2860 {
2861  uint64_t imm = 0;
2862  uint32_t imm8_7, imm8_6_0, imm8_6, imm8_6_repl4;
2863 
2864  imm8_7 = (imm8 >> 7) & 0x01; /* imm8<7> */
2865  imm8_6_0 = imm8 & 0x7f; /* imm8<6:0> */
2866  imm8_6 = imm8_6_0 >> 6; /* imm8<6> */
2867  imm8_6_repl4 = (imm8_6 << 3) | (imm8_6 << 2)
2868  | (imm8_6 << 1) | imm8_6; /* Replicate(imm8<6>,4) */
2869  if (size == 8)
2870  {
2871  imm = (imm8_7 << (63-32)) /* imm8<7> */
2872  | ((imm8_6 ^ 1) << (62-32)) /* NOT(imm8<6) */
2873  | (imm8_6_repl4 << (58-32)) | (imm8_6 << (57-32))
2874  | (imm8_6 << (56-32)) | (imm8_6 << (55-32)) /* Replicate(imm8<6>,7) */
2875  | (imm8_6_0 << (48-32)); /* imm8<6>:imm8<5:0> */
2876  imm <<= 32;
2877  }
2878  else if (size == 4 || size == 2)
2879  {
2880  imm = (imm8_7 << 31) /* imm8<7> */
2881  | ((imm8_6 ^ 1) << 30) /* NOT(imm8<6>) */
2882  | (imm8_6_repl4 << 26) /* Replicate(imm8<6>,4) */
2883  | (imm8_6_0 << 19); /* imm8<6>:imm8<5:0> */
2884  }
2885  else
2886  {
2887  /* An unsupported size. */
2888  assert (0);
2889  }
2890 
2891  return imm;
2892 }

References assert(), and imm.

Referenced by aarch64_print_operand().

◆ fp_qualifier_p()

static bfd_boolean fp_qualifier_p ( enum aarch64_opnd_qualifier  qualifier)
inlinestatic

Definition at line 117 of file aarch64-opc.c.

118 {
119  return ((qualifier >= AARCH64_OPND_QLF_S_B
120  && qualifier <= AARCH64_OPND_QLF_S_Q) ? TRUE
121  : FALSE);
122 }
@ AARCH64_OPND_QLF_S_Q
Definition: aarch64.h:404
@ AARCH64_OPND_QLF_S_B
Definition: aarch64.h:400

References AARCH64_OPND_QLF_S_B, AARCH64_OPND_QLF_S_Q, FALSE, and TRUE.

◆ get_64bit_int_reg_name()

static const char* get_64bit_int_reg_name ( int  regno,
int  sp_reg_p 
)
inlinestatic

Definition at line 2792 of file aarch64-opc.c.

2793 {
2794  const int has_zr = sp_reg_p ? 0 : 1;
2795  return int_reg[has_zr][1][regno];
2796 }
static const char * int_reg[2][2][32]
Definition: aarch64-opc.c:2757

References int_reg.

Referenced by aarch64_print_operand().

◆ get_addr_sve_reg_name()

static const char* get_addr_sve_reg_name ( int  regno,
aarch64_opnd_qualifier_t  qualifier 
)
inlinestatic

Definition at line 2823 of file aarch64-opc.c.

2824 {
2825  assert (qualifier == AARCH64_OPND_QLF_S_S
2826  || qualifier == AARCH64_OPND_QLF_S_D);
2827  return sve_reg[qualifier == AARCH64_OPND_QLF_S_D][regno];
2828 }
static const char * sve_reg[2][32]
Definition: aarch64-opc.c:2769
@ AARCH64_OPND_QLF_S_D
Definition: aarch64.h:403
@ AARCH64_OPND_QLF_S_S
Definition: aarch64.h:402

References AARCH64_OPND_QLF_S_D, AARCH64_OPND_QLF_S_S, assert(), and sve_reg.

Referenced by aarch64_print_operand().

◆ get_cond_from_value()

const aarch64_cond* get_cond_from_value ( aarch64_insn  value)

Definition at line 369 of file aarch64-opc.c.

370 {
371  assert (value < 16);
372  return &aarch64_conds[(unsigned int) value];
373 }
const aarch64_cond aarch64_conds[16]
Definition: aarch64-opc.c:348
static int
Definition: sfsocketcall.h:114

References aarch64_conds, assert(), int, and value.

Referenced by aarch64_ext_cond(), and do_special_decoding().

◆ get_data_pattern()

static enum data_pattern get_data_pattern ( const aarch64_opnd_qualifier_seq_t  qualifiers)
static

Definition at line 133 of file aarch64-opc.c.

149 {
150  if (vector_qualifier_p (qualifiers[0]) == TRUE)
151  {
152  /* e.g. v.4s, v.4s, v.4s
153  or v.4h, v.4h, v.h[3]. */
154  if (qualifiers[0] == qualifiers[1]
155  && vector_qualifier_p (qualifiers[2]) == TRUE
156  && (aarch64_get_qualifier_esize (qualifiers[0])
157  == aarch64_get_qualifier_esize (qualifiers[1]))
158  && (aarch64_get_qualifier_esize (qualifiers[0])
159  == aarch64_get_qualifier_esize (qualifiers[2])))
160  return DP_VECTOR_3SAME;
161  /* e.g. v.8h, v.8b, v.8b.
162  or v.4s, v.4h, v.h[2].
163  or v.8h, v.16b. */
164  if (vector_qualifier_p (qualifiers[1]) == TRUE
165  && aarch64_get_qualifier_esize (qualifiers[0]) != 0
166  && (aarch64_get_qualifier_esize (qualifiers[0])
167  == aarch64_get_qualifier_esize (qualifiers[1]) << 1))
168  return DP_VECTOR_LONG;
169  /* e.g. v.8h, v.8h, v.8b. */
170  if (qualifiers[0] == qualifiers[1]
171  && vector_qualifier_p (qualifiers[2]) == TRUE
172  && aarch64_get_qualifier_esize (qualifiers[0]) != 0
173  && (aarch64_get_qualifier_esize (qualifiers[0])
174  == aarch64_get_qualifier_esize (qualifiers[2]) << 1)
175  && (aarch64_get_qualifier_esize (qualifiers[0])
176  == aarch64_get_qualifier_esize (qualifiers[1])))
177  return DP_VECTOR_WIDE;
178  }
179  else if (fp_qualifier_p (qualifiers[0]) == TRUE)
180  {
181  /* e.g. SADDLV <V><d>, <Vn>.<T>. */
182  if (vector_qualifier_p (qualifiers[1]) == TRUE
183  && qualifiers[2] == AARCH64_OPND_QLF_NIL)
184  return DP_VECTOR_ACROSS_LANES;
185  }
186 
187  return DP_UNKNOWN;
188 }
static bfd_boolean vector_qualifier_p(enum aarch64_opnd_qualifier qualifier)
Definition: aarch64-opc.c:109
static bfd_boolean fp_qualifier_p(enum aarch64_opnd_qualifier qualifier)
Definition: aarch64-opc.c:117

Referenced by aarch64_select_operand_for_sizeq_field_coding().

◆ get_int_reg_name()

static const char* get_int_reg_name ( int  regno,
aarch64_opnd_qualifier_t  qualifier,
int  sp_reg_p 
)
inlinestatic

Definition at line 2782 of file aarch64-opc.c.

2783 {
2784  const int has_zr = sp_reg_p ? 0 : 1;
2785  const int is_64 = aarch64_get_qualifier_esize (qualifier) == 4 ? 0 : 1;
2786  return int_reg[has_zr][is_64][regno];
2787 }

References aarch64_get_qualifier_esize(), and int_reg.

Referenced by aarch64_print_operand(), and get_offset_int_reg_name().

◆ get_inverted_cond()

const aarch64_cond* get_inverted_cond ( const aarch64_cond cond)

Definition at line 376 of file aarch64-opc.c.

377 {
378  return &aarch64_conds[cond->value ^ 0x1];
379 }
#define cond(bop, top, mask, flags)

Referenced by convert_csinc_to_cset(), and convert_from_csel().

◆ get_lower_bound()

static int get_lower_bound ( aarch64_opnd_qualifier_t  qualifier)
static

Definition at line 787 of file aarch64-opc.c.

788 {
790  return aarch64_opnd_qualifiers[qualifier].data0;
791 }
static bfd_boolean qualifier_value_in_range_constraint_p(aarch64_opnd_qualifier_t qualifier)
Definition: aarch64-opc.c:751

References aarch64_opnd_qualifiers, assert(), operand_qualifier_data::data0, qualifier_value_in_range_constraint_p(), and TRUE.

Referenced by operand_general_constraint_met_p().

◆ get_offset_int_reg_name()

static const char* get_offset_int_reg_name ( const aarch64_opnd_info opnd)
inlinestatic

Definition at line 2802 of file aarch64-opc.c.

2803 {
2804  switch (opnd->shifter.kind)
2805  {
2806  case AARCH64_MOD_UXTW:
2807  case AARCH64_MOD_SXTW:
2808  return get_int_reg_name (opnd->addr.offset.regno, AARCH64_OPND_QLF_W, 0);
2809 
2810  case AARCH64_MOD_LSL:
2811  case AARCH64_MOD_SXTX:
2812  return get_int_reg_name (opnd->addr.offset.regno, AARCH64_OPND_QLF_X, 0);
2813 
2814  default:
2815  abort ();
2816  }
2817 }
@ AARCH64_MOD_SXTW
Definition: aarch64.h:890

References AARCH64_MOD_LSL, AARCH64_MOD_SXTW, AARCH64_MOD_SXTX, AARCH64_MOD_UXTW, AARCH64_OPND_QLF_W, AARCH64_OPND_QLF_X, aarch64_opnd_info::addr, get_int_reg_name(), aarch64_opnd_info::kind, and aarch64_opnd_info::shifter.

Referenced by aarch64_print_operand().

◆ get_upper_bound()

static int get_upper_bound ( aarch64_opnd_qualifier_t  qualifier)
static

◆ match_operands_qualifier()

static int match_operands_qualifier ( aarch64_inst inst,
bfd_boolean  update_p 
)
static

Definition at line 987 of file aarch64-opc.c.

988 {
989  int i, nops;
990  aarch64_opnd_qualifier_seq_t qualifiers = {0};
991 
992  if (!aarch64_find_best_match (inst, inst->opcode->qualifiers_list, -1,
993  qualifiers))
994  {
995  DEBUG_TRACE ("matching FAIL");
996  return 0;
997  }
998 
999  if (inst->opcode->flags & F_STRICT)
1000  {
1001  /* Require an exact qualifier match, even for NIL qualifiers. */
1002  nops = aarch64_num_of_operands (inst->opcode);
1003  for (i = 0; i < nops; ++i)
1004  if (inst->operands[i].qualifier != qualifiers[i])
1005  return FALSE;
1006  }
1007 
1008  /* Update the qualifiers. */
1009  if (update_p == TRUE)
1010  for (i = 0; i < AARCH64_MAX_OPND_NUM; ++i)
1011  {
1012  if (inst->opcode->operands[i] == AARCH64_OPND_NIL)
1013  break;
1014  DEBUG_TRACE_IF (inst->operands[i].qualifier != qualifiers[i],
1015  "update %s with %s for operand %d",
1017  aarch64_get_qualifier_name (qualifiers[i]), i);
1018  inst->operands[i].qualifier = qualifiers[i];
1019  }
1020 
1021  DEBUG_TRACE ("matching SUCCESS");
1022  return 1;
1023 }
int aarch64_find_best_match(const aarch64_inst *inst, const aarch64_opnd_qualifier_seq_t *qualifiers_list, int stop_at, aarch64_opnd_qualifier_t *ret)
Definition: aarch64-opc.c:876
aarch64_opnd_qualifier_t aarch64_opnd_qualifier_seq_t[AARCH64_MAX_OPND_NUM]
Definition: aarch64.h:655
#define F_STRICT
Definition: aarch64.h:772
uint32_t flags
Definition: aarch64.h:706

References aarch64_find_best_match(), aarch64_get_qualifier_name(), AARCH64_MAX_OPND_NUM, aarch64_num_of_operands(), AARCH64_OPND_NIL, DEBUG_TRACE, DEBUG_TRACE_IF, F_STRICT, FALSE, aarch64_opcode::flags, i, aarch64_inst::opcode, aarch64_opcode::operands, aarch64_inst::operands, aarch64_opnd_info::qualifier, aarch64_opcode::qualifiers_list, and TRUE.

Referenced by aarch64_match_operands_constraint().

◆ operand_also_qualified_p()

static int operand_also_qualified_p ( const struct aarch64_opnd_info operand,
aarch64_opnd_qualifier_t  target 
)
inlinestatic

Definition at line 585 of file aarch64-opc.c.

587 {
588  switch (operand->qualifier)
589  {
590  case AARCH64_OPND_QLF_W:
592  return 1;
593  break;
594  case AARCH64_OPND_QLF_X:
596  return 1;
597  break;
599  if (target == AARCH64_OPND_QLF_W
601  return 1;
602  break;
603  case AARCH64_OPND_QLF_SP:
604  if (target == AARCH64_OPND_QLF_X
606  return 1;
607  break;
608  default:
609  break;
610  }
611 
612  return 0;
613 }

References aarch64_operands, AARCH64_OPND_QLF_SP, AARCH64_OPND_QLF_W, AARCH64_OPND_QLF_WSP, AARCH64_OPND_QLF_X, aarch64_stack_pointer_p(), and operand_maybe_stack_pointer().

Referenced by aarch64_find_best_match().

◆ operand_general_constraint_met_p()

static int operand_general_constraint_met_p ( const aarch64_opnd_info opnds,
int  idx,
enum aarch64_opnd  type,
const aarch64_opcode opcode,
aarch64_operand_error mismatch_detail 
)
static

Definition at line 1415 of file aarch64-opc.c.

1419 {
1420  unsigned num, modifiers, shift;
1421  unsigned char size;
1422  int64_t imm, min_value, max_value;
1423  uint64_t uvalue, mask;
1424  const aarch64_opnd_info *opnd = opnds + idx;
1425  aarch64_opnd_qualifier_t qualifier = opnd->qualifier;
1426 
1427  assert (opcode->operands[idx] == opnd->type && opnd->type == type);
1428 
1429  switch (aarch64_operands[type].op_class)
1430  {
1432  /* Check pair reg constraints for cas* instructions. */
1433  if (type == AARCH64_OPND_PAIRREG)
1434  {
1435  assert (idx == 1 || idx == 3);
1436  if (opnds[idx - 1].reg.regno % 2 != 0)
1437  {
1438  set_syntax_error (mismatch_detail, idx - 1,
1439  _("reg pair must start from even reg"));
1440  return 0;
1441  }
1442  if (opnds[idx].reg.regno != opnds[idx - 1].reg.regno + 1)
1443  {
1444  set_syntax_error (mismatch_detail, idx,
1445  _("reg pair must be contiguous"));
1446  return 0;
1447  }
1448  break;
1449  }
1450 
1451  /* <Xt> may be optional in some IC and TLBI instructions. */
1452  if (type == AARCH64_OPND_Rt_SYS)
1453  {
1454  assert (idx == 1 && (aarch64_get_operand_class (opnds[0].type)
1456  if (opnds[1].present
1457  && !aarch64_sys_ins_reg_has_xt (opnds[0].sysins_op))
1458  {
1459  set_other_error (mismatch_detail, idx, _("extraneous register"));
1460  return 0;
1461  }
1462  if (!opnds[1].present
1463  && aarch64_sys_ins_reg_has_xt (opnds[0].sysins_op))
1464  {
1465  set_other_error (mismatch_detail, idx, _("missing register"));
1466  return 0;
1467  }
1468  }
1469  switch (qualifier)
1470  {
1471  case AARCH64_OPND_QLF_WSP:
1472  case AARCH64_OPND_QLF_SP:
1473  if (!aarch64_stack_pointer_p (opnd))
1474  {
1475  set_other_error (mismatch_detail, idx,
1476  _("stack pointer register expected"));
1477  return 0;
1478  }
1479  break;
1480  default:
1481  break;
1482  }
1483  break;
1484 
1486  switch (type)
1487  {
1493  mask = (1 << shift) - 1;
1494  if (opnd->reg.regno > mask)
1495  {
1496  assert (mask == 7 || mask == 15);
1497  set_other_error (mismatch_detail, idx,
1498  mask == 15
1499  ? _("z0-z15 expected")
1500  : _("z0-z7 expected"));
1501  return 0;
1502  }
1503  mask = (1 << (size - shift)) - 1;
1504  if (!value_in_range_p (opnd->reglane.index, 0, mask))
1505  {
1506  set_elem_idx_out_of_range_error (mismatch_detail, idx, 0, mask);
1507  return 0;
1508  }
1509  break;
1510 
1513  if (!value_in_range_p (opnd->reglane.index, 0, 64 / size - 1))
1514  {
1515  set_elem_idx_out_of_range_error (mismatch_detail, idx,
1516  0, 64 / size - 1);
1517  return 0;
1518  }
1519  break;
1520 
1521  case AARCH64_OPND_SVE_ZnxN:
1522  case AARCH64_OPND_SVE_ZtxN:
1523  if (opnd->reglist.num_regs != get_opcode_dependent_value (opcode))
1524  {
1525  set_other_error (mismatch_detail, idx,
1526  _("invalid register list"));
1527  return 0;
1528  }
1529  break;
1530 
1531  default:
1532  break;
1533  }
1534  break;
1535 
1537  if (opnd->reg.regno >= 8
1539  {
1540  set_other_error (mismatch_detail, idx, _("p0-p7 expected"));
1541  return 0;
1542  }
1543  break;
1544 
1546  if (type == AARCH64_OPND_COND1
1547  && (opnds[idx].cond->value & 0xe) == 0xe)
1548  {
1549  /* Not allow AL or NV. */
1550  set_syntax_error (mismatch_detail, idx, NULL);
1551  }
1552  break;
1553 
1555  /* Check writeback. */
1556  switch (opcode->iclass)
1557  {
1558  case ldst_pos:
1559  case ldst_unscaled:
1560  case ldstnapair_offs:
1561  case ldstpair_off:
1562  case ldst_unpriv:
1563  if (opnd->addr.writeback == 1)
1564  {
1565  set_syntax_error (mismatch_detail, idx,
1566  _("unexpected address writeback"));
1567  return 0;
1568  }
1569  break;
1570  case ldst_imm10:
1571  if (opnd->addr.writeback == 1 && opnd->addr.preind != 1)
1572  {
1573  set_syntax_error (mismatch_detail, idx,
1574  _("unexpected address writeback"));
1575  return 0;
1576  }
1577  break;
1578  case ldst_imm9:
1579  case ldstpair_indexed:
1580  case asisdlsep:
1581  case asisdlsop:
1582  if (opnd->addr.writeback == 0)
1583  {
1584  set_syntax_error (mismatch_detail, idx,
1585  _("address writeback expected"));
1586  return 0;
1587  }
1588  break;
1589  default:
1590  assert (opnd->addr.writeback == 0);
1591  break;
1592  }
1593  switch (type)
1594  {
1596  /* Scaled signed 7 bits immediate offset. */
1597  /* Get the size of the data element that is accessed, which may be
1598  different from that of the source register size,
1599  e.g. in strb/ldrb. */
1601  if (!value_in_range_p (opnd->addr.offset.imm, -64 * size, 63 * size))
1602  {
1603  set_offset_out_of_range_error (mismatch_detail, idx,
1604  -64 * size, 63 * size);
1605  return 0;
1606  }
1607  if (!value_aligned_p (opnd->addr.offset.imm, size))
1608  {
1609  set_unaligned_error (mismatch_detail, idx, size);
1610  return 0;
1611  }
1612  break;
1615  /* Unscaled signed 9 bits immediate offset. */
1616  if (!value_in_range_p (opnd->addr.offset.imm, -256, 255))
1617  {
1618  set_offset_out_of_range_error (mismatch_detail, idx, -256, 255);
1619  return 0;
1620  }
1621  break;
1622 
1624  /* Unscaled signed 9 bits immediate offset, which has to be negative
1625  or unaligned. */
1626  size = aarch64_get_qualifier_esize (qualifier);
1627  if ((value_in_range_p (opnd->addr.offset.imm, 0, 255)
1628  && !value_aligned_p (opnd->addr.offset.imm, size))
1629  || value_in_range_p (opnd->addr.offset.imm, -256, -1))
1630  return 1;
1631  set_other_error (mismatch_detail, idx,
1632  _("negative or unaligned offset expected"));
1633  return 0;
1634 
1636  /* Scaled signed 10 bits immediate offset. */
1637  if (!value_in_range_p (opnd->addr.offset.imm, -4096, 4088))
1638  {
1639  set_offset_out_of_range_error (mismatch_detail, idx, -4096, 4088);
1640  return 0;
1641  }
1642  if (!value_aligned_p (opnd->addr.offset.imm, 8))
1643  {
1644  set_unaligned_error (mismatch_detail, idx, 8);
1645  return 0;
1646  }
1647  break;
1648 
1650  /* AdvSIMD load/store multiple structures, post-index. */
1651  assert (idx == 1);
1652  if (opnd->addr.offset.is_reg)
1653  {
1654  if (value_in_range_p (opnd->addr.offset.regno, 0, 30))
1655  return 1;
1656  else
1657  {
1658  set_other_error (mismatch_detail, idx,
1659  _("invalid register offset"));
1660  return 0;
1661  }
1662  }
1663  else
1664  {
1665  const aarch64_opnd_info *prev = &opnds[idx-1];
1666  unsigned num_bytes; /* total number of bytes transferred. */
1667  /* The opcode dependent area stores the number of elements in
1668  each structure to be loaded/stored. */
1669  int is_ld1r = get_opcode_dependent_value (opcode) == 1;
1670  if (opcode->operands[0] == AARCH64_OPND_LVt_AL)
1671  /* Special handling of loading single structure to all lane. */
1672  num_bytes = (is_ld1r ? 1 : prev->reglist.num_regs)
1674  else
1675  num_bytes = prev->reglist.num_regs
1678  if ((int) num_bytes != opnd->addr.offset.imm)
1679  {
1680  set_other_error (mismatch_detail, idx,
1681  _("invalid post-increment amount"));
1682  return 0;
1683  }
1684  }
1685  break;
1686 
1688  /* Get the size of the data element that is accessed, which may be
1689  different from that of the source register size,
1690  e.g. in strb/ldrb. */
1692  /* It is either no shift or shift by the binary logarithm of SIZE. */
1693  if (opnd->shifter.amount != 0
1694  && opnd->shifter.amount != (int)get_logsz (size))
1695  {
1696  set_other_error (mismatch_detail, idx,
1697  _("invalid shift amount"));
1698  return 0;
1699  }
1700  /* Only UXTW, LSL, SXTW and SXTX are the accepted extending
1701  operators. */
1702  switch (opnd->shifter.kind)
1703  {
1704  case AARCH64_MOD_UXTW:
1705  case AARCH64_MOD_LSL:
1706  case AARCH64_MOD_SXTW:
1707  case AARCH64_MOD_SXTX: break;
1708  default:
1709  set_other_error (mismatch_detail, idx,
1710  _("invalid extend/shift operator"));
1711  return 0;
1712  }
1713  break;
1714 
1716  imm = opnd->addr.offset.imm;
1717  /* Get the size of the data element that is accessed, which may be
1718  different from that of the source register size,
1719  e.g. in strb/ldrb. */
1720  size = aarch64_get_qualifier_esize (qualifier);
1721  if (!value_in_range_p (imm, 0, 4095 * size))
1722  {
1723  set_offset_out_of_range_error (mismatch_detail, idx,
1724  0, 4095 * size);
1725  return 0;
1726  }
1727  if (!value_aligned_p (imm, size))
1728  {
1729  set_unaligned_error (mismatch_detail, idx, size);
1730  return 0;
1731  }
1732  break;
1733 
1738  imm = opnd->imm.value;
1740  {
1741  /* The offset value in a PC-relative branch instruction is alway
1742  4-byte aligned and is encoded without the lowest 2 bits. */
1743  if (!value_aligned_p (imm, 4))
1744  {
1745  set_unaligned_error (mismatch_detail, idx, 4);
1746  return 0;
1747  }
1748  /* Right shift by 2 so that we can carry out the following check
1749  canonically. */
1750  imm >>= 2;
1751  }
1754  {
1755  set_other_error (mismatch_detail, idx,
1756  _("immediate out of range"));
1757  return 0;
1758  }
1759  break;
1760 
1765  min_value = -8;
1766  max_value = 7;
1767  sve_imm_offset_vl:
1768  assert (!opnd->addr.offset.is_reg);
1769  assert (opnd->addr.preind);
1771  min_value *= num;
1772  max_value *= num;
1773  if ((opnd->addr.offset.imm != 0 && !opnd->shifter.operator_present)
1774  || (opnd->shifter.operator_present
1775  && opnd->shifter.kind != AARCH64_MOD_MUL_VL))
1776  {
1777  set_other_error (mismatch_detail, idx,
1778  _("invalid addressing mode"));
1779  return 0;
1780  }
1781  if (!value_in_range_p (opnd->addr.offset.imm, min_value, max_value))
1782  {
1783  set_offset_out_of_range_error (mismatch_detail, idx,
1784  min_value, max_value);
1785  return 0;
1786  }
1787  if (!value_aligned_p (opnd->addr.offset.imm, num))
1788  {
1789  set_unaligned_error (mismatch_detail, idx, num);
1790  return 0;
1791  }
1792  break;
1793 
1795  min_value = -32;
1796  max_value = 31;
1797  goto sve_imm_offset_vl;
1798 
1800  min_value = -256;
1801  max_value = 255;
1802  goto sve_imm_offset_vl;
1803 
1808  min_value = 0;
1809  max_value = 63;
1810  sve_imm_offset:
1811  assert (!opnd->addr.offset.is_reg);
1812  assert (opnd->addr.preind);
1814  min_value *= num;
1815  max_value *= num;
1816  if (opnd->shifter.operator_present
1817  || opnd->shifter.amount_present)
1818  {
1819  set_other_error (mismatch_detail, idx,
1820  _("invalid addressing mode"));
1821  return 0;
1822  }
1823  if (!value_in_range_p (opnd->addr.offset.imm, min_value, max_value))
1824  {
1825  set_offset_out_of_range_error (mismatch_detail, idx,
1826  min_value, max_value);
1827  return 0;
1828  }
1829  if (!value_aligned_p (opnd->addr.offset.imm, num))
1830  {
1831  set_unaligned_error (mismatch_detail, idx, num);
1832  return 0;
1833  }
1834  break;
1835 
1837  min_value = -8;
1838  max_value = 7;
1839  goto sve_imm_offset;
1840 
1854  modifiers = 1 << AARCH64_MOD_LSL;
1855  sve_rr_operand:
1856  assert (opnd->addr.offset.is_reg);
1857  assert (opnd->addr.preind);
1858  if ((aarch64_operands[type].flags & OPD_F_NO_ZR) != 0
1859  && opnd->addr.offset.regno == 31)
1860  {
1861  set_other_error (mismatch_detail, idx,
1862  _("index register xzr is not allowed"));
1863  return 0;
1864  }
1865  if (((1 << opnd->shifter.kind) & modifiers) == 0
1866  || (opnd->shifter.amount
1868  {
1869  set_other_error (mismatch_detail, idx,
1870  _("invalid addressing mode"));
1871  return 0;
1872  }
1873  break;
1874 
1883  modifiers = (1 << AARCH64_MOD_SXTW) | (1 << AARCH64_MOD_UXTW);
1884  goto sve_rr_operand;
1885 
1890  min_value = 0;
1891  max_value = 31;
1892  goto sve_imm_offset;
1893 
1895  modifiers = 1 << AARCH64_MOD_LSL;
1896  sve_zz_operand:
1897  assert (opnd->addr.offset.is_reg);
1898  assert (opnd->addr.preind);
1899  if (((1 << opnd->shifter.kind) & modifiers) == 0
1900  || opnd->shifter.amount < 0
1901  || opnd->shifter.amount > 3)
1902  {
1903  set_other_error (mismatch_detail, idx,
1904  _("invalid addressing mode"));
1905  return 0;
1906  }
1907  break;
1908 
1910  modifiers = (1 << AARCH64_MOD_SXTW);
1911  goto sve_zz_operand;
1912 
1914  modifiers = 1 << AARCH64_MOD_UXTW;
1915  goto sve_zz_operand;
1916 
1917  default:
1918  break;
1919  }
1920  break;
1921 
1923  if (type == AARCH64_OPND_LEt)
1924  {
1925  /* Get the upper bound for the element index. */
1926  num = 16 / aarch64_get_qualifier_esize (qualifier) - 1;
1927  if (!value_in_range_p (opnd->reglist.index, 0, num))
1928  {
1929  set_elem_idx_out_of_range_error (mismatch_detail, idx, 0, num);
1930  return 0;
1931  }
1932  }
1933  /* The opcode dependent area stores the number of elements in
1934  each structure to be loaded/stored. */
1935  num = get_opcode_dependent_value (opcode);
1936  switch (type)
1937  {
1938  case AARCH64_OPND_LVt:
1939  assert (num >= 1 && num <= 4);
1940  /* Unless LD1/ST1, the number of registers should be equal to that
1941  of the structure elements. */
1942  if (num != 1 && opnd->reglist.num_regs != num)
1943  {
1944  set_reg_list_error (mismatch_detail, idx, num);
1945  return 0;
1946  }
1947  break;
1948  case AARCH64_OPND_LVt_AL:
1949  case AARCH64_OPND_LEt:
1950  assert (num >= 1 && num <= 4);
1951  /* The number of registers should be equal to that of the structure
1952  elements. */
1953  if (opnd->reglist.num_regs != num)
1954  {
1955  set_reg_list_error (mismatch_detail, idx, num);
1956  return 0;
1957  }
1958  break;
1959  default:
1960  break;
1961  }
1962  break;
1963 
1965  /* Constraint check on immediate operand. */
1966  imm = opnd->imm.value;
1967  /* E.g. imm_0_31 constrains value to be 0..31. */
1969  && !value_in_range_p (imm, get_lower_bound (qualifier),
1970  get_upper_bound (qualifier)))
1971  {
1972  set_imm_out_of_range_error (mismatch_detail, idx,
1973  get_lower_bound (qualifier),
1974  get_upper_bound (qualifier));
1975  return 0;
1976  }
1977 
1978  switch (type)
1979  {
1980  case AARCH64_OPND_AIMM:
1981  if (opnd->shifter.kind != AARCH64_MOD_LSL)
1982  {
1983  set_other_error (mismatch_detail, idx,
1984  _("invalid shift operator"));
1985  return 0;
1986  }
1987  if (opnd->shifter.amount != 0 && opnd->shifter.amount != 12)
1988  {
1989  set_other_error (mismatch_detail, idx,
1990  _("shift amount must be 0 or 12"));
1991  return 0;
1992  }
1993  if (!value_fit_unsigned_field_p (opnd->imm.value, 12))
1994  {
1995  set_other_error (mismatch_detail, idx,
1996  _("immediate out of range"));
1997  return 0;
1998  }
1999  break;
2000 
2001  case AARCH64_OPND_HALF:
2002  assert (idx == 1 && opnds[0].type == AARCH64_OPND_Rd);
2003  if (opnd->shifter.kind != AARCH64_MOD_LSL)
2004  {
2005  set_other_error (mismatch_detail, idx,
2006  _("invalid shift operator"));
2007  return 0;
2008  }
2009  size = aarch64_get_qualifier_esize (opnds[0].qualifier);
2010  if (!value_aligned_p (opnd->shifter.amount, 16))
2011  {
2012  set_other_error (mismatch_detail, idx,
2013  _("shift amount must be a multiple of 16"));
2014  return 0;
2015  }
2016  if (!value_in_range_p (opnd->shifter.amount, 0, size * 8 - 16))
2017  {
2018  set_sft_amount_out_of_range_error (mismatch_detail, idx,
2019  0, size * 8 - 16);
2020  return 0;
2021  }
2022  if (opnd->imm.value < 0)
2023  {
2024  set_other_error (mismatch_detail, idx,
2025  _("negative immediate value not allowed"));
2026  return 0;
2027  }
2028  if (!value_fit_unsigned_field_p (opnd->imm.value, 16))
2029  {
2030  set_other_error (mismatch_detail, idx,
2031  _("immediate out of range"));
2032  return 0;
2033  }
2034  break;
2035 
2036  case AARCH64_OPND_IMM_MOV:
2037  {
2038  int esize = aarch64_get_qualifier_esize (opnds[0].qualifier);
2039  imm = opnd->imm.value;
2040  assert (idx == 1);
2041  switch (opcode->op)
2042  {
2043  case OP_MOV_IMM_WIDEN:
2044  imm = ~imm;
2045  /* Fall through. */
2046  case OP_MOV_IMM_WIDE:
2047  if (!aarch64_wide_constant_p (imm, esize == 4, NULL))
2048  {
2049  set_other_error (mismatch_detail, idx,
2050  _("immediate out of range"));
2051  return 0;
2052  }
2053  break;
2054  case OP_MOV_IMM_LOG:
2055  if (!aarch64_logical_immediate_p (imm, esize, NULL))
2056  {
2057  set_other_error (mismatch_detail, idx,
2058  _("immediate out of range"));
2059  return 0;
2060  }
2061  break;
2062  default:
2063  assert (0);
2064  return 0;
2065  }
2066  }
2067  break;
2068 
2069  case AARCH64_OPND_NZCV:
2070  case AARCH64_OPND_CCMP_IMM:
2072  case AARCH64_OPND_UIMM4:
2073  case AARCH64_OPND_UIMM7:
2081  assert (size < 32);
2082  if (!value_fit_unsigned_field_p (opnd->imm.value, size))
2083  {
2084  set_imm_out_of_range_error (mismatch_detail, idx, 0,
2085  (1 << size) - 1);
2086  return 0;
2087  }
2088  break;
2089 
2090  case AARCH64_OPND_SIMM5:
2096  assert (size < 32);
2097  if (!value_fit_signed_field_p (opnd->imm.value, size))
2098  {
2099  set_imm_out_of_range_error (mismatch_detail, idx,
2100  -(1 << (size - 1)),
2101  (1 << (size - 1)) - 1);
2102  return 0;
2103  }
2104  break;
2105 
2106  case AARCH64_OPND_WIDTH:
2107  assert (idx > 1 && opnds[idx-1].type == AARCH64_OPND_IMM
2108  && opnds[0].type == AARCH64_OPND_Rd);
2109  size = get_upper_bound (qualifier);
2110  if (opnd->imm.value + opnds[idx-1].imm.value > size)
2111  /* lsb+width <= reg.size */
2112  {
2113  set_imm_out_of_range_error (mismatch_detail, idx, 1,
2114  size - opnds[idx-1].imm.value);
2115  return 0;
2116  }
2117  break;
2118 
2119  case AARCH64_OPND_LIMM:
2120  case AARCH64_OPND_SVE_LIMM:
2121  {
2122  int esize = aarch64_get_qualifier_esize (opnds[0].qualifier);
2123  uint64_t uimm = opnd->imm.value;
2124  if (opcode->op == OP_BIC)
2125  uimm = ~uimm;
2126  if (!aarch64_logical_immediate_p (uimm, esize, NULL))
2127  {
2128  set_other_error (mismatch_detail, idx,
2129  _("immediate out of range"));
2130  return 0;
2131  }
2132  }
2133  break;
2134 
2135  case AARCH64_OPND_IMM0:
2136  case AARCH64_OPND_FPIMM0:
2137  if (opnd->imm.value != 0)
2138  {
2139  set_other_error (mismatch_detail, idx,
2140  _("immediate zero expected"));
2141  return 0;
2142  }
2143  break;
2144 
2145  case AARCH64_OPND_IMM_ROT1:
2146  case AARCH64_OPND_IMM_ROT2:
2148  if (opnd->imm.value != 0
2149  && opnd->imm.value != 90
2150  && opnd->imm.value != 180
2151  && opnd->imm.value != 270)
2152  {
2153  set_other_error (mismatch_detail, idx,
2154  _("rotate expected to be 0, 90, 180 or 270"));
2155  return 0;
2156  }
2157  break;
2158 
2159  case AARCH64_OPND_IMM_ROT3:
2161  if (opnd->imm.value != 90 && opnd->imm.value != 270)
2162  {
2163  set_other_error (mismatch_detail, idx,
2164  _("rotate expected to be 90 or 270"));
2165  return 0;
2166  }
2167  break;
2168 
2169  case AARCH64_OPND_SHLL_IMM:
2170  assert (idx == 2);
2171  size = 8 * aarch64_get_qualifier_esize (opnds[idx - 1].qualifier);
2172  if (opnd->imm.value != size)
2173  {
2174  set_other_error (mismatch_detail, idx,
2175  _("invalid shift amount"));
2176  return 0;
2177  }
2178  break;
2179 
2180  case AARCH64_OPND_IMM_VLSL:
2181  size = aarch64_get_qualifier_esize (qualifier);
2182  if (!value_in_range_p (opnd->imm.value, 0, size * 8 - 1))
2183  {
2184  set_imm_out_of_range_error (mismatch_detail, idx, 0,
2185  size * 8 - 1);
2186  return 0;
2187  }
2188  break;
2189 
2190  case AARCH64_OPND_IMM_VLSR:
2191  size = aarch64_get_qualifier_esize (qualifier);
2192  if (!value_in_range_p (opnd->imm.value, 1, size * 8))
2193  {
2194  set_imm_out_of_range_error (mismatch_detail, idx, 1, size * 8);
2195  return 0;
2196  }
2197  break;
2198 
2199  case AARCH64_OPND_SIMD_IMM:
2201  /* Qualifier check. */
2202  switch (qualifier)
2203  {
2204  case AARCH64_OPND_QLF_LSL:
2205  if (opnd->shifter.kind != AARCH64_MOD_LSL)
2206  {
2207  set_other_error (mismatch_detail, idx,
2208  _("invalid shift operator"));
2209  return 0;
2210  }
2211  break;
2212  case AARCH64_OPND_QLF_MSL:
2213  if (opnd->shifter.kind != AARCH64_MOD_MSL)
2214  {
2215  set_other_error (mismatch_detail, idx,
2216  _("invalid shift operator"));
2217  return 0;
2218  }
2219  break;
2220  case AARCH64_OPND_QLF_NIL:
2221  if (opnd->shifter.kind != AARCH64_MOD_NONE)
2222  {
2223  set_other_error (mismatch_detail, idx,
2224  _("shift is not permitted"));
2225  return 0;
2226  }
2227  break;
2228  default:
2229  assert (0);
2230  return 0;
2231  }
2232  /* Is the immediate valid? */
2233  assert (idx == 1);
2234  if (aarch64_get_qualifier_esize (opnds[0].qualifier) != 8)
2235  {
2236  /* uimm8 or simm8 */
2237  if (!value_in_range_p (opnd->imm.value, -128, 255))
2238  {
2239  set_imm_out_of_range_error (mismatch_detail, idx, -128, 255);
2240  return 0;
2241  }
2242  }
2243  else if (aarch64_shrink_expanded_imm8 (opnd->imm.value) < 0)
2244  {
2245  /* uimm64 is not
2246  'aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee
2247  ffffffffgggggggghhhhhhhh'. */
2248  set_other_error (mismatch_detail, idx,
2249  _("invalid value for immediate"));
2250  return 0;
2251  }
2252  /* Is the shift amount valid? */
2253  switch (opnd->shifter.kind)
2254  {
2255  case AARCH64_MOD_LSL:
2256  size = aarch64_get_qualifier_esize (opnds[0].qualifier);
2257  if (!value_in_range_p (opnd->shifter.amount, 0, (size - 1) * 8))
2258  {
2259  set_sft_amount_out_of_range_error (mismatch_detail, idx, 0,
2260  (size - 1) * 8);
2261  return 0;
2262  }
2263  if (!value_aligned_p (opnd->shifter.amount, 8))
2264  {
2265  set_unaligned_error (mismatch_detail, idx, 8);
2266  return 0;
2267  }
2268  break;
2269  case AARCH64_MOD_MSL:
2270  /* Only 8 and 16 are valid shift amount. */
2271  if (opnd->shifter.amount != 8 && opnd->shifter.amount != 16)
2272  {
2273  set_other_error (mismatch_detail, idx,
2274  _("shift amount must be 0 or 16"));
2275  return 0;
2276  }
2277  break;
2278  default:
2279  if (opnd->shifter.kind != AARCH64_MOD_NONE)
2280  {
2281  set_other_error (mismatch_detail, idx,
2282  _("invalid shift operator"));
2283  return 0;
2284  }
2285  break;
2286  }
2287  break;
2288 
2289  case AARCH64_OPND_FPIMM:
2292  if (opnd->imm.is_fp == 0)
2293  {
2294  set_other_error (mismatch_detail, idx,
2295  _("floating-point immediate expected"));
2296  return 0;
2297  }
2298  /* The value is expected to be an 8-bit floating-point constant with
2299  sign, 3-bit exponent and normalized 4 bits of precision, encoded
2300  in "a:b:c:d:e:f:g:h" or FLD_imm8 (depending on the type of the
2301  instruction). */
2302  if (!value_in_range_p (opnd->imm.value, 0, 255))
2303  {
2304  set_other_error (mismatch_detail, idx,
2305  _("immediate out of range"));
2306  return 0;
2307  }
2308  if (opnd->shifter.kind != AARCH64_MOD_NONE)
2309  {
2310  set_other_error (mismatch_detail, idx,
2311  _("invalid shift operator"));
2312  return 0;
2313  }
2314  break;
2315 
2316  case AARCH64_OPND_SVE_AIMM:
2317  min_value = 0;
2318  sve_aimm:
2319  assert (opnd->shifter.kind == AARCH64_MOD_LSL);
2320  size = aarch64_get_qualifier_esize (opnds[0].qualifier);
2321  mask = ~((uint64_t) -1 << (size * 4) << (size * 4));
2322  uvalue = opnd->imm.value;
2323  shift = opnd->shifter.amount;
2324  if (size == 1)
2325  {
2326  if (shift != 0)
2327  {
2328  set_other_error (mismatch_detail, idx,
2329  _("no shift amount allowed for"
2330  " 8-bit constants"));
2331  return 0;
2332  }
2333  }
2334  else
2335  {
2336  if (shift != 0 && shift != 8)
2337  {
2338  set_other_error (mismatch_detail, idx,
2339  _("shift amount must be 0 or 8"));
2340  return 0;
2341  }
2342  if (shift == 0 && (uvalue & 0xff) == 0)
2343  {
2344  shift = 8;
2345  uvalue = (int64_t) uvalue / 256;
2346  }
2347  }
2348  mask >>= shift;
2349  if ((uvalue & mask) != uvalue && (uvalue | ~mask) != uvalue)
2350  {
2351  set_other_error (mismatch_detail, idx,
2352  _("immediate too big for element size"));
2353  return 0;
2354  }
2355  uvalue = (uvalue - min_value) & mask;
2356  if (uvalue > 0xff)
2357  {
2358  set_other_error (mismatch_detail, idx,
2359  _("invalid arithmetic immediate"));
2360  return 0;
2361  }
2362  break;
2363 
2365  min_value = -128;
2366  goto sve_aimm;
2367 
2369  assert (opnd->imm.is_fp);
2370  if (opnd->imm.value != 0x3f000000 && opnd->imm.value != 0x3f800000)
2371  {
2372  set_other_error (mismatch_detail, idx,
2373  _("floating-point value must be 0.5 or 1.0"));
2374  return 0;
2375  }
2376  break;
2377 
2379  assert (opnd->imm.is_fp);
2380  if (opnd->imm.value != 0x3f000000 && opnd->imm.value != 0x40000000)
2381  {
2382  set_other_error (mismatch_detail, idx,
2383  _("floating-point value must be 0.5 or 2.0"));
2384  return 0;
2385  }
2386  break;
2387 
2389  assert (opnd->imm.is_fp);
2390  if (opnd->imm.value != 0 && opnd->imm.value != 0x3f800000)
2391  {
2392  set_other_error (mismatch_detail, idx,
2393  _("floating-point value must be 0.0 or 1.0"));
2394  return 0;
2395  }
2396  break;
2397 
2399  {
2400  int esize = aarch64_get_qualifier_esize (opnds[0].qualifier);
2401  uint64_t uimm = ~opnd->imm.value;
2402  if (!aarch64_logical_immediate_p (uimm, esize, NULL))
2403  {
2404  set_other_error (mismatch_detail, idx,
2405  _("immediate out of range"));
2406  return 0;
2407  }
2408  }
2409  break;
2410 
2412  {
2413  int esize = aarch64_get_qualifier_esize (opnds[0].qualifier);
2414  uint64_t uimm = opnd->imm.value;
2415  if (!aarch64_logical_immediate_p (uimm, esize, NULL))
2416  {
2417  set_other_error (mismatch_detail, idx,
2418  _("immediate out of range"));
2419  return 0;
2420  }
2421  if (!aarch64_sve_dupm_mov_immediate_p (uimm, esize))
2422  {
2423  set_other_error (mismatch_detail, idx,
2424  _("invalid replicated MOV immediate"));
2425  return 0;
2426  }
2427  }
2428  break;
2429 
2431  assert (opnd->shifter.kind == AARCH64_MOD_MUL);
2432  if (!value_in_range_p (opnd->shifter.amount, 1, 16))
2433  {
2434  set_multiplier_out_of_range_error (mismatch_detail, idx, 1, 16);
2435  return 0;
2436  }
2437  break;
2438 
2441  size = aarch64_get_qualifier_esize (opnds[idx - 1].qualifier);
2442  if (!value_in_range_p (opnd->imm.value, 0, 8 * size - 1))
2443  {
2444  set_imm_out_of_range_error (mismatch_detail, idx,
2445  0, 8 * size - 1);
2446  return 0;
2447  }
2448  break;
2449 
2452  size = aarch64_get_qualifier_esize (opnds[idx - 1].qualifier);
2453  if (!value_in_range_p (opnd->imm.value, 1, 8 * size))
2454  {
2455  set_imm_out_of_range_error (mismatch_detail, idx, 1, 8 * size);
2456  return 0;
2457  }
2458  break;
2459 
2460  default:
2461  break;
2462  }
2463  break;
2464 
2466  switch (type)
2467  {
2469  assert (idx == 0 && opnds[1].type == AARCH64_OPND_UIMM4);
2470  /* MSR UAO, #uimm4
2471  MSR PAN, #uimm4
2472  The immediate must be #0 or #1. */
2473  if ((opnd->pstatefield == 0x03 /* UAO. */
2474  || opnd->pstatefield == 0x04 /* PAN. */
2475  || opnd->pstatefield == 0x1a) /* DIT. */
2476  && opnds[1].imm.value > 1)
2477  {
2478  set_imm_out_of_range_error (mismatch_detail, idx, 0, 1);
2479  return 0;
2480  }
2481  /* MSR SPSel, #uimm4
2482  Uses uimm4 as a control value to select the stack pointer: if
2483  bit 0 is set it selects the current exception level's stack
2484  pointer, if bit 0 is clear it selects shared EL0 stack pointer.
2485  Bits 1 to 3 of uimm4 are reserved and should be zero. */
2486  if (opnd->pstatefield == 0x05 /* spsel */ && opnds[1].imm.value > 1)
2487  {
2488  set_imm_out_of_range_error (mismatch_detail, idx, 0, 1);
2489  return 0;
2490  }
2491  break;
2492  default:
2493  break;
2494  }
2495  break;
2496 
2498  /* Get the upper bound for the element index. */
2499  if (opcode->op == OP_FCMLA_ELEM)
2500  /* FCMLA index range depends on the vector size of other operands
2501  and is halfed because complex numbers take two elements. */
2502  num = aarch64_get_qualifier_nelem (opnds[0].qualifier)
2503  * aarch64_get_qualifier_esize (opnds[0].qualifier) / 2;
2504  else
2505  num = 16;
2506  num = num / aarch64_get_qualifier_esize (qualifier) - 1;
2507 
2508  /* Index out-of-range. */
2509  if (!value_in_range_p (opnd->reglane.index, 0, num))
2510  {
2511  set_elem_idx_out_of_range_error (mismatch_detail, idx, 0, num);
2512  return 0;
2513  }
2514  /* SMLAL<Q> <Vd>.<Ta>, <Vn>.<Tb>, <Vm>.<Ts>[<index>].
2515  <Vm> Is the vector register (V0-V31) or (V0-V15), whose
2516  number is encoded in "size:M:Rm":
2517  size <Vm>
2518  00 RESERVED
2519  01 0:Rm
2520  10 M:Rm
2521  11 RESERVED */
2522  if (type == AARCH64_OPND_Em16 && qualifier == AARCH64_OPND_QLF_S_H
2523  && !value_in_range_p (opnd->reglane.regno, 0, 15))
2524  {
2525  set_regno_out_of_range_error (mismatch_detail, idx, 0, 15);
2526  return 0;
2527  }
2528  break;
2529 
2531  assert (idx == 1 || idx == 2);
2532  switch (type)
2533  {
2534  case AARCH64_OPND_Rm_EXT:
2536  && opnd->shifter.kind != AARCH64_MOD_LSL)
2537  {
2538  set_other_error (mismatch_detail, idx,
2539  _("extend operator expected"));
2540  return 0;
2541  }
2542  /* It is not optional unless at least one of "Rd" or "Rn" is '11111'
2543  (i.e. SP), in which case it defaults to LSL. The LSL alias is
2544  only valid when "Rd" or "Rn" is '11111', and is preferred in that
2545  case. */
2546  if (!aarch64_stack_pointer_p (opnds + 0)
2547  && (idx != 2 || !aarch64_stack_pointer_p (opnds + 1)))
2548  {
2549  if (!opnd->shifter.operator_present)
2550  {
2551  set_other_error (mismatch_detail, idx,
2552  _("missing extend operator"));
2553  return 0;
2554  }
2555  else if (opnd->shifter.kind == AARCH64_MOD_LSL)
2556  {
2557  set_other_error (mismatch_detail, idx,
2558  _("'LSL' operator not allowed"));
2559  return 0;
2560  }
2561  }
2562  assert (opnd->shifter.operator_present /* Default to LSL. */
2563  || opnd->shifter.kind == AARCH64_MOD_LSL);
2564  if (!value_in_range_p (opnd->shifter.amount, 0, 4))
2565  {
2566  set_sft_amount_out_of_range_error (mismatch_detail, idx, 0, 4);
2567  return 0;
2568  }
2569  /* In the 64-bit form, the final register operand is written as Wm
2570  for all but the (possibly omitted) UXTX/LSL and SXTX
2571  operators.
2572  N.B. GAS allows X register to be used with any operator as a
2573  programming convenience. */
2574  if (qualifier == AARCH64_OPND_QLF_X
2575  && opnd->shifter.kind != AARCH64_MOD_LSL
2576  && opnd->shifter.kind != AARCH64_MOD_UXTX
2577  && opnd->shifter.kind != AARCH64_MOD_SXTX)
2578  {
2579  set_other_error (mismatch_detail, idx, _("W register expected"));
2580  return 0;
2581  }
2582  break;
2583 
2584  case AARCH64_OPND_Rm_SFT:
2585  /* ROR is not available to the shifted register operand in
2586  arithmetic instructions. */
2587  if (!aarch64_shift_operator_p (opnd->shifter.kind))
2588  {
2589  set_other_error (mismatch_detail, idx,
2590  _("shift operator expected"));
2591  return 0;
2592  }
2593  if (opnd->shifter.kind == AARCH64_MOD_ROR
2594  && opcode->iclass != log_shift)
2595  {
2596  set_other_error (mismatch_detail, idx,
2597  _("'ROR' operator not allowed"));
2598  return 0;
2599  }
2600  num = qualifier == AARCH64_OPND_QLF_W ? 31 : 63;
2601  if (!value_in_range_p (opnd->shifter.amount, 0, num))
2602  {
2603  set_sft_amount_out_of_range_error (mismatch_detail, idx, 0, num);
2604  return 0;
2605  }
2606  break;
2607 
2608  default:
2609  break;
2610  }
2611  break;
2612 
2613  default:
2614  break;
2615  }
2616 
2617  return 1;
2618 }
bfd_boolean aarch64_sve_dupm_mov_immediate_p(uint64_t uvalue, int esize)
Definition: aarch64-opc.c:4521
static void set_imm_out_of_range_error(aarch64_operand_error *mismatch_detail, int idx, int lower_bound, int upper_bound)
Definition: aarch64-opc.c:1308
static void set_multiplier_out_of_range_error(aarch64_operand_error *mismatch_detail, int idx, int lower_bound, int upper_bound)
Definition: aarch64-opc.c:1360
static int get_upper_bound(aarch64_opnd_qualifier_t qualifier)
Definition: aarch64-opc.c:794
static void set_other_error(aarch64_operand_error *mismatch_detail, int idx, const char *error)
Definition: aarch64-opc.c:1390
static void set_syntax_error(aarch64_operand_error *mismatch_detail, int idx, const char *error)
Definition: aarch64-opc.c:1287
static void set_reg_list_error(aarch64_operand_error *mismatch_detail, int idx, int expected_num)
Definition: aarch64-opc.c:1380
static void set_regno_out_of_range_error(aarch64_operand_error *mismatch_detail, int idx, int lower_bound, int upper_bound)
Definition: aarch64-opc.c:1328
static int value_aligned_p(int64_t value, int align)
Definition: aarch64-opc.c:527
static bfd_boolean aarch64_shift_operator_p(enum aarch64_modifier_kind kind)
Definition: aarch64-opc.c:437
bfd_boolean aarch64_wide_constant_p(int64_t value, int is32, unsigned int *shift_amount)
Definition: aarch64-opc.c:1033
static int value_fit_unsigned_field_p(int64_t value, unsigned width)
Definition: aarch64-opc.c:548
int aarch64_shrink_expanded_imm8(uint64_t imm)
Definition: aarch64-opc.c:1255
static void set_sft_amount_out_of_range_error(aarch64_operand_error *mismatch_detail, int idx, int lower_bound, int upper_bound)
Definition: aarch64-opc.c:1348
bfd_boolean aarch64_sys_ins_reg_has_xt(const aarch64_sys_ins_reg *sys_ins_reg)
Definition: aarch64-opc.c:4445
static void set_offset_out_of_range_error(aarch64_operand_error *mismatch_detail, int idx, int lower_bound, int upper_bound)
Definition: aarch64-opc.c:1318
bfd_boolean aarch64_extend_operator_p(enum aarch64_modifier_kind kind)
Definition: aarch64-opc.c:430
static int value_fit_signed_field_p(int64_t value, unsigned width)
Definition: aarch64-opc.c:534
static int value_in_range_p(int64_t value, int low, int high)
Definition: aarch64-opc.c:520
bfd_boolean aarch64_logical_immediate_p(uint64_t value, int esize, aarch64_insn *encoding)
Definition: aarch64-opc.c:1207
static void set_elem_idx_out_of_range_error(aarch64_operand_error *mismatch_detail, int idx, int lower_bound, int upper_bound)
Definition: aarch64-opc.c:1338
unsigned char aarch64_get_qualifier_nelem(aarch64_opnd_qualifier_t qualifier)
Definition: aarch64-opc.c:773
static void set_unaligned_error(aarch64_operand_error *mismatch_detail, int idx, int alignment)
Definition: aarch64-opc.c:1370
static int get_lower_bound(aarch64_opnd_qualifier_t qualifier)
Definition: aarch64-opc.c:787
#define OPD_F_NO_ZR
Definition: aarch64-opc.h:199
static unsigned int get_logsz(unsigned int size)
Definition: aarch64-opc.h:475
static unsigned int get_operand_specific_data(const aarch64_operand *operand)
Definition: aarch64-opc.h:250
static const aarch64_operand * get_operand_from_code(enum aarch64_opnd code)
Definition: aarch64-opc.h:276
static unsigned get_operand_fields_width(const aarch64_operand *operand)
Definition: aarch64-opc.h:265
static bfd_boolean operand_need_shift_by_two(const aarch64_operand *operand)
Definition: aarch64-opc.h:237
@ AARCH64_MOD_MUL
Definition: aarch64.h:892
@ AARCH64_MOD_MSL
Definition: aarch64.h:879
@ AARCH64_MOD_MUL_VL
Definition: aarch64.h:893
@ AARCH64_OPND_QLF_LSL
Definition: aarch64.h:443
@ AARCH64_OPND_QLF_S_H
Definition: aarch64.h:401
@ AARCH64_OPND_QLF_MSL
Definition: aarch64.h:444
@ AARCH64_OPND_CLASS_MODIFIED_REG
Definition: aarch64.h:127
@ AARCH64_OPND_CLASS_SYSTEM
Definition: aarch64.h:137
@ AARCH64_OPND_CLASS_IMMEDIATE
Definition: aarch64.h:136
@ AARCH64_OPND_CLASS_SVE_REG
Definition: aarch64.h:133
@ AARCH64_OPND_CLASS_ADDRESS
Definition: aarch64.h:135
@ AARCH64_OPND_CLASS_COND
Definition: aarch64.h:138
@ AARCH64_OPND_CLASS_SIMD_REGLIST
Definition: aarch64.h:132
@ AARCH64_OPND_CLASS_PRED_REG
Definition: aarch64.h:134
@ AARCH64_OPND_CLASS_SIMD_ELEMENT
Definition: aarch64.h:130
static unsigned int get_opcode_dependent_value(const aarch64_opcode *opcode)
Definition: aarch64.h:818
@ ldst_unscaled
Definition: aarch64.h:513
@ log_shift
Definition: aarch64.h:520
@ ldst_imm9
Definition: aarch64.h:508
@ ldstpair_off
Definition: aarch64.h:516
@ ldstpair_indexed
Definition: aarch64.h:517
@ asisdlsep
Definition: aarch64.h:473
@ ldstnapair_offs
Definition: aarch64.h:515
@ ldst_pos
Definition: aarch64.h:510
@ ldst_imm10
Definition: aarch64.h:509
@ asisdlsop
Definition: aarch64.h:475
@ ldst_unpriv
Definition: aarch64.h:512
@ OP_FCMLA_ELEM
Definition: aarch64.h:642
@ OP_MOV_IMM_WIDEN
Definition: aarch64.h:589
@ OP_MOV_IMM_LOG
Definition: aarch64.h:587
@ OP_BIC
Definition: aarch64.h:597
@ OP_MOV_IMM_WIDE
Definition: aarch64.h:588
static RZ_NULLABLE RzILOpBitVector * shift(RzILOpBitVector *val, RZ_NULLABLE RzILOpBool **carry_out, arm_shifter type, RZ_OWN RzILOpBitVector *dist)
Definition: arm_il32.c:190
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void static offset const char static length static mode static who const char struct statfs static buf unsigned unsigned num
Definition: sflib.h:126
enum aarch64_insn_class iclass
Definition: aarch64.h:686
enum aarch64_op op
Definition: aarch64.h:689
unsigned amount_present
Definition: aarch64.h:995
struct aarch64_opnd_info::@35::@40 reglist

References _, aarch64_extend_operator_p(), aarch64_get_operand_class(), aarch64_get_qualifier_esize(), aarch64_get_qualifier_nelem(), aarch64_logical_immediate_p(), AARCH64_MOD_LSL, AARCH64_MOD_MSL, AARCH64_MOD_MUL, AARCH64_MOD_MUL_VL, AARCH64_MOD_NONE, AARCH64_MOD_ROR, AARCH64_MOD_SXTW, AARCH64_MOD_SXTX, AARCH64_MOD_UXTW, AARCH64_MOD_UXTX, aarch64_operands, AARCH64_OPND_ADDR_OFFSET, AARCH64_OPND_ADDR_PCREL14, AARCH64_OPND_ADDR_PCREL19, AARCH64_OPND_ADDR_PCREL21, AARCH64_OPND_ADDR_PCREL26, AARCH64_OPND_ADDR_REGOFF, AARCH64_OPND_ADDR_SIMM10, AARCH64_OPND_ADDR_SIMM7, AARCH64_OPND_ADDR_SIMM9, AARCH64_OPND_ADDR_SIMM9_2, AARCH64_OPND_ADDR_UIMM12, AARCH64_OPND_AIMM, AARCH64_OPND_CCMP_IMM, AARCH64_OPND_CLASS_ADDRESS, AARCH64_OPND_CLASS_COND, AARCH64_OPND_CLASS_IMMEDIATE, AARCH64_OPND_CLASS_INT_REG, AARCH64_OPND_CLASS_MODIFIED_REG, AARCH64_OPND_CLASS_PRED_REG, AARCH64_OPND_CLASS_SIMD_ELEMENT, AARCH64_OPND_CLASS_SIMD_REGLIST, AARCH64_OPND_CLASS_SVE_REG, AARCH64_OPND_CLASS_SYSTEM, AARCH64_OPND_COND1, AARCH64_OPND_Em16, AARCH64_OPND_EXCEPTION, AARCH64_OPND_FPIMM, AARCH64_OPND_FPIMM0, AARCH64_OPND_HALF, AARCH64_OPND_IMM, AARCH64_OPND_IMM0, AARCH64_OPND_IMM_MOV, AARCH64_OPND_IMM_ROT1, AARCH64_OPND_IMM_ROT2, AARCH64_OPND_IMM_ROT3, AARCH64_OPND_IMM_VLSL, AARCH64_OPND_IMM_VLSR, AARCH64_OPND_LEt, AARCH64_OPND_LIMM, AARCH64_OPND_LVt, AARCH64_OPND_LVt_AL, AARCH64_OPND_NZCV, AARCH64_OPND_PAIRREG, AARCH64_OPND_PSTATEFIELD, AARCH64_OPND_QLF_LSL, AARCH64_OPND_QLF_MSL, AARCH64_OPND_QLF_NIL, AARCH64_OPND_QLF_S_H, AARCH64_OPND_QLF_SP, AARCH64_OPND_QLF_W, AARCH64_OPND_QLF_WSP, AARCH64_OPND_QLF_X, AARCH64_OPND_Rd, AARCH64_OPND_Rm_EXT, AARCH64_OPND_Rm_SFT, AARCH64_OPND_Rt_SYS, AARCH64_OPND_SHLL_IMM, AARCH64_OPND_SIMD_ADDR_POST, AARCH64_OPND_SIMD_FPIMM, AARCH64_OPND_SIMD_IMM, AARCH64_OPND_SIMD_IMM_SFT, AARCH64_OPND_SIMM5, AARCH64_OPND_SVE_ADDR_R, AARCH64_OPND_SVE_ADDR_RI_S4x16, AARCH64_OPND_SVE_ADDR_RI_S4x2xVL, AARCH64_OPND_SVE_ADDR_RI_S4x3xVL, AARCH64_OPND_SVE_ADDR_RI_S4x4xVL, AARCH64_OPND_SVE_ADDR_RI_S4xVL, AARCH64_OPND_SVE_ADDR_RI_S6xVL, AARCH64_OPND_SVE_ADDR_RI_S9xVL, AARCH64_OPND_SVE_ADDR_RI_U6, AARCH64_OPND_SVE_ADDR_RI_U6x2, AARCH64_OPND_SVE_ADDR_RI_U6x4, AARCH64_OPND_SVE_ADDR_RI_U6x8, AARCH64_OPND_SVE_ADDR_RR, AARCH64_OPND_SVE_ADDR_RR_LSL1, AARCH64_OPND_SVE_ADDR_RR_LSL2, AARCH64_OPND_SVE_ADDR_RR_LSL3, AARCH64_OPND_SVE_ADDR_RX, AARCH64_OPND_SVE_ADDR_RX_LSL1, AARCH64_OPND_SVE_ADDR_RX_LSL2, AARCH64_OPND_SVE_ADDR_RX_LSL3, AARCH64_OPND_SVE_ADDR_RZ, AARCH64_OPND_SVE_ADDR_RZ_LSL1, AARCH64_OPND_SVE_ADDR_RZ_LSL2, AARCH64_OPND_SVE_ADDR_RZ_LSL3, AARCH64_OPND_SVE_ADDR_RZ_XTW1_14, AARCH64_OPND_SVE_ADDR_RZ_XTW1_22, AARCH64_OPND_SVE_ADDR_RZ_XTW2_14, AARCH64_OPND_SVE_ADDR_RZ_XTW2_22, AARCH64_OPND_SVE_ADDR_RZ_XTW3_14, AARCH64_OPND_SVE_ADDR_RZ_XTW3_22, AARCH64_OPND_SVE_ADDR_RZ_XTW_14, AARCH64_OPND_SVE_ADDR_RZ_XTW_22, AARCH64_OPND_SVE_ADDR_ZI_U5, AARCH64_OPND_SVE_ADDR_ZI_U5x2, AARCH64_OPND_SVE_ADDR_ZI_U5x4, AARCH64_OPND_SVE_ADDR_ZI_U5x8, AARCH64_OPND_SVE_ADDR_ZZ_LSL, AARCH64_OPND_SVE_ADDR_ZZ_SXTW, AARCH64_OPND_SVE_ADDR_ZZ_UXTW, AARCH64_OPND_SVE_AIMM, AARCH64_OPND_SVE_ASIMM, AARCH64_OPND_SVE_FPIMM8, AARCH64_OPND_SVE_I1_HALF_ONE, AARCH64_OPND_SVE_I1_HALF_TWO, AARCH64_OPND_SVE_I1_ZERO_ONE, AARCH64_OPND_SVE_IMM_ROT1, AARCH64_OPND_SVE_IMM_ROT2, AARCH64_OPND_SVE_INV_LIMM, AARCH64_OPND_SVE_LIMM, AARCH64_OPND_SVE_LIMM_MOV, AARCH64_OPND_SVE_PATTERN_SCALED, AARCH64_OPND_SVE_SHLIMM_PRED, AARCH64_OPND_SVE_SHLIMM_UNPRED, AARCH64_OPND_SVE_SHRIMM_PRED, AARCH64_OPND_SVE_SHRIMM_UNPRED, AARCH64_OPND_SVE_SIMM5, AARCH64_OPND_SVE_SIMM5B, AARCH64_OPND_SVE_SIMM6, AARCH64_OPND_SVE_SIMM8, AARCH64_OPND_SVE_UIMM3, AARCH64_OPND_SVE_UIMM7, AARCH64_OPND_SVE_UIMM8, AARCH64_OPND_SVE_UIMM8_53, AARCH64_OPND_SVE_Zm3_22_INDEX, AARCH64_OPND_SVE_Zm3_INDEX, AARCH64_OPND_SVE_Zm4_INDEX, AARCH64_OPND_SVE_Zn_INDEX, AARCH64_OPND_SVE_ZnxN, AARCH64_OPND_SVE_ZtxN, AARCH64_OPND_UIMM3_OP1, AARCH64_OPND_UIMM3_OP2, AARCH64_OPND_UIMM4, AARCH64_OPND_UIMM7, AARCH64_OPND_WIDTH, aarch64_shift_operator_p(), aarch64_shrink_expanded_imm8(), aarch64_stack_pointer_p(), aarch64_sve_dupm_mov_immediate_p(), aarch64_sys_ins_reg_has_xt(), aarch64_wide_constant_p(), aarch64_opnd_info::addr, aarch64_opnd_info::amount, aarch64_opnd_info::amount_present, asisdlsep, asisdlsop, assert(), cond, flags, get_logsz(), get_lower_bound(), get_opcode_dependent_value(), get_operand_fields_width(), get_operand_from_code(), get_operand_specific_data(), get_upper_bound(), aarch64_opcode::iclass, setup::idx, imm, aarch64_opnd_info::imm, aarch64_opnd_info::kind, ldst_imm10, ldst_imm9, ldst_pos, ldst_unpriv, ldst_unscaled, ldstnapair_offs, ldstpair_indexed, ldstpair_off, log_shift, mask, NULL, num, aarch64_opcode::op, OP_BIC, OP_FCMLA_ELEM, OP_MOV_IMM_LOG, OP_MOV_IMM_WIDE, OP_MOV_IMM_WIDEN, OPD_F_NO_ZR, operand_need_shift_by_two(), aarch64_opcode::operands, aarch64_opnd_info::operator_present, aarch64_opnd_info::pstatefield, aarch64_opnd_info::qualifier, qualifier_value_in_range_constraint_p(), aarch64_opnd_info::reg, reg, aarch64_opnd_info::reglane, aarch64_opnd_info::reglist, set_elem_idx_out_of_range_error(), set_imm_out_of_range_error(), set_multiplier_out_of_range_error(), set_offset_out_of_range_error(), set_other_error(), set_reg_list_error(), set_regno_out_of_range_error(), set_sft_amount_out_of_range_error(), set_syntax_error(), set_unaligned_error(), shift(), aarch64_opnd_info::shifter, aarch64_opnd_info::type, type, value_aligned_p(), value_fit_signed_field_p(), value_fit_unsigned_field_p(), and value_in_range_p().

Referenced by aarch64_match_operands_constraint().

◆ operand_variant_qualifier_p()

static bfd_boolean operand_variant_qualifier_p ( aarch64_opnd_qualifier_t  qualifier)
inlinestatic

◆ print_immediate_offset_address()

static void print_immediate_offset_address ( char *  buf,
size_t  size,
const aarch64_opnd_info opnd,
const char *  base 
)
static

Definition at line 2957 of file aarch64-opc.c.

2960 {
2961  if (opnd->addr.writeback)
2962  {
2963  if (opnd->addr.preind)
2964  snprintf (buf, size, "[%s, #%d]!", base, opnd->addr.offset.imm);
2965  else
2966  snprintf (buf, size, "[%s], #%d", base, opnd->addr.offset.imm);
2967  }
2968  else
2969  {
2970  if (opnd->shifter.operator_present)
2971  {
2973  snprintf (buf, size, "[%s, #%d, mul vl]",
2974  base, opnd->addr.offset.imm);
2975  }
2976  else if (opnd->addr.offset.imm)
2977  snprintf (buf, size, "[%s, #%d]", base, opnd->addr.offset.imm);
2978  else
2979  snprintf (buf, size, "[%s]", base);
2980  }
2981 }

References AARCH64_MOD_MUL_VL, aarch64_opnd_info::addr, assert(), aarch64_opnd_info::kind, aarch64_opnd_info::operator_present, aarch64_opnd_info::shifter, and snprintf.

Referenced by aarch64_print_operand().

◆ print_register_list()

static void print_register_list ( char *  buf,
size_t  size,
const aarch64_opnd_info opnd,
const char *  prefix 
)
static

Definition at line 2898 of file aarch64-opc.c.

2900 {
2901  const int num_regs = opnd->reglist.num_regs;
2902  const int first_reg = opnd->reglist.first_regno;
2903  const int last_reg = (first_reg + num_regs - 1) & 0x1f;
2904  const char *qlf_name = aarch64_get_qualifier_name (opnd->qualifier);
2905  char tb[8]; /* Temporary buffer. */
2906 
2907  assert (opnd->type != AARCH64_OPND_LEt || opnd->reglist.has_index);
2908  assert (num_regs >= 1 && num_regs <= 4);
2909 
2910  /* Prepare the index if any. */
2911  if (opnd->reglist.has_index)
2912  /* PR 21096: The %100 is to silence a warning about possible truncation. */
2913  snprintf (tb, 8, "[%" PRIi64 "]", (opnd->reglist.index % 100));
2914  else
2915  tb[0] = '\0';
2916 
2917  /* The hyphenated form is preferred for disassembly if there are
2918  more than two registers in the list, and the register numbers
2919  are monotonically increasing in increments of one. */
2920  if (num_regs > 2 && last_reg > first_reg)
2921  snprintf (buf, size, "{%s%d.%s-%s%d.%s}%s", prefix, first_reg, qlf_name,
2922  prefix, last_reg, qlf_name, tb);
2923  else
2924  {
2925  const int reg0 = first_reg;
2926  const int reg1 = (first_reg + 1) & 0x1f;
2927  const int reg2 = (first_reg + 2) & 0x1f;
2928  const int reg3 = (first_reg + 3) & 0x1f;
2929 
2930  switch (num_regs)
2931  {
2932  case 1:
2933  snprintf (buf, size, "{%s%d.%s}%s", prefix, reg0, qlf_name, tb);
2934  break;
2935  case 2:
2936  snprintf (buf, size, "{%s%d.%s, %s%d.%s}%s", prefix, reg0, qlf_name,
2937  prefix, reg1, qlf_name, tb);
2938  break;
2939  case 3:
2940  snprintf (buf, size, "{%s%d.%s, %s%d.%s, %s%d.%s}%s",
2941  prefix, reg0, qlf_name, prefix, reg1, qlf_name,
2942  prefix, reg2, qlf_name, tb);
2943  break;
2944  case 4:
2945  snprintf (buf, size, "{%s%d.%s, %s%d.%s, %s%d.%s, %s%d.%s}%s",
2946  prefix, reg0, qlf_name, prefix, reg1, qlf_name,
2947  prefix, reg2, qlf_name, prefix, reg3, qlf_name, tb);
2948  break;
2949  }
2950  }
2951 }
unsigned short prefix[65536]
Definition: gun.c:163

References aarch64_get_qualifier_name(), AARCH64_OPND_LEt, assert(), prefix, aarch64_opnd_info::qualifier, aarch64_opnd_info::reglist, snprintf, and aarch64_opnd_info::type.

Referenced by aarch64_print_operand().

◆ print_register_offset_address()

static void print_register_offset_address ( char *  buf,
size_t  size,
const aarch64_opnd_info opnd,
const char *  base,
const char *  offset 
)
static

Definition at line 2987 of file aarch64-opc.c.

2990 {
2991  char tb[16]; /* Temporary buffer. */
2992  bfd_boolean print_extend_p = TRUE;
2993  bfd_boolean print_amount_p = TRUE;
2994  const char *shift_name = aarch64_operand_modifiers[opnd->shifter.kind].name;
2995 
2996  if (!opnd->shifter.amount && (opnd->qualifier != AARCH64_OPND_QLF_S_B
2997  || !opnd->shifter.amount_present))
2998  {
2999  /* Not print the shift/extend amount when the amount is zero and
3000  when it is not the special case of 8-bit load/store instruction. */
3001  print_amount_p = FALSE;
3002  /* Likewise, no need to print the shift operator LSL in such a
3003  situation. */
3004  if (opnd->shifter.kind == AARCH64_MOD_LSL)
3005  print_extend_p = FALSE;
3006  }
3007 
3008  /* Prepare for the extend/shift. */
3009  if (print_extend_p)
3010  {
3011  if (print_amount_p)
3012  snprintf (tb, sizeof (tb), ", %s #%" PRIi64, shift_name,
3013  /* PR 21096: The %100 is to silence a warning about possible truncation. */
3014  (opnd->shifter.amount % 100));
3015  else
3016  snprintf (tb, sizeof (tb), ", %s", shift_name);
3017  }
3018  else
3019  tb[0] = '\0';
3020 
3021  snprintf (buf, size, "[%s, %s%s]", base, offset, tb);
3022 }
voidpf uLong offset
Definition: ioapi.h:144

References AARCH64_MOD_LSL, aarch64_operand_modifiers, AARCH64_OPND_QLF_S_B, aarch64_opnd_info::amount, aarch64_opnd_info::amount_present, FALSE, aarch64_opnd_info::kind, aarch64_name_value_pair::name, aarch64_opnd_info::qualifier, aarch64_opnd_info::shifter, snprintf, and TRUE.

Referenced by aarch64_print_operand().

◆ qualifier_value_in_range_constraint_p()

static bfd_boolean qualifier_value_in_range_constraint_p ( aarch64_opnd_qualifier_t  qualifier)
inlinestatic

Definition at line 751 of file aarch64-opc.c.

752 {
753  return (aarch64_opnd_qualifiers[qualifier].kind == OQK_VALUE_IN_RANGE)
754  ? TRUE : FALSE;
755 }

References aarch64_opnd_qualifiers, FALSE, operand_qualifier_data::kind, OQK_VALUE_IN_RANGE, and TRUE.

Referenced by get_lower_bound(), get_upper_bound(), and operand_general_constraint_met_p().

◆ set_elem_idx_out_of_range_error()

static void set_elem_idx_out_of_range_error ( aarch64_operand_error mismatch_detail,
int  idx,
int  lower_bound,
int  upper_bound 
)
inlinestatic

Definition at line 1338 of file aarch64-opc.c.

1340 {
1341  if (mismatch_detail == NULL)
1342  return;
1343  set_out_of_range_error (mismatch_detail, idx, lower_bound, upper_bound,
1344  _("register element index"));
1345 }
static void set_out_of_range_error(aarch64_operand_error *mismatch_detail, int idx, int lower_bound, int upper_bound, const char *error)
Definition: aarch64-opc.c:1296

References _, setup::idx, NULL, and set_out_of_range_error().

Referenced by operand_general_constraint_met_p().

◆ set_error()

static void set_error ( aarch64_operand_error mismatch_detail,
enum aarch64_operand_error_kind  kind,
int  idx,
const char *  error 
)
inlinestatic

Definition at line 1275 of file aarch64-opc.c.

1278 {
1279  if (mismatch_detail == NULL)
1280  return;
1281  mismatch_detail->kind = kind;
1282  mismatch_detail->index = idx;
1283  mismatch_detail->error = error;
1284 }
void error(const char *msg)
Definition: untgz.c:593

References aarch64_operand_error::error, error(), setup::idx, aarch64_operand_error::index, operand_qualifier_data::kind, aarch64_operand_error::kind, and NULL.

Referenced by set_other_error(), set_out_of_range_error(), set_reg_list_error(), set_syntax_error(), and set_unaligned_error().

◆ set_imm_out_of_range_error()

static void set_imm_out_of_range_error ( aarch64_operand_error mismatch_detail,
int  idx,
int  lower_bound,
int  upper_bound 
)
inlinestatic

Definition at line 1308 of file aarch64-opc.c.

1310 {
1311  if (mismatch_detail == NULL)
1312  return;
1313  set_out_of_range_error (mismatch_detail, idx, lower_bound, upper_bound,
1314  _("immediate value"));
1315 }

References _, setup::idx, NULL, and set_out_of_range_error().

Referenced by operand_general_constraint_met_p().

◆ set_multiplier_out_of_range_error()

static void set_multiplier_out_of_range_error ( aarch64_operand_error mismatch_detail,
int  idx,
int  lower_bound,
int  upper_bound 
)
inlinestatic

Definition at line 1360 of file aarch64-opc.c.

1362 {
1363  if (mismatch_detail == NULL)
1364  return;
1365  set_out_of_range_error (mismatch_detail, idx, lower_bound, upper_bound,
1366  _("multiplier"));
1367 }

References _, setup::idx, NULL, and set_out_of_range_error().

Referenced by operand_general_constraint_met_p().

◆ set_offset_out_of_range_error()

static void set_offset_out_of_range_error ( aarch64_operand_error mismatch_detail,
int  idx,
int  lower_bound,
int  upper_bound 
)
inlinestatic

Definition at line 1318 of file aarch64-opc.c.

1320 {
1321  if (mismatch_detail == NULL)
1322  return;
1323  set_out_of_range_error (mismatch_detail, idx, lower_bound, upper_bound,
1324  _("immediate offset"));
1325 }

References _, setup::idx, NULL, and set_out_of_range_error().

Referenced by operand_general_constraint_met_p().

◆ set_other_error()

static void set_other_error ( aarch64_operand_error mismatch_detail,
int  idx,
const char *  error 
)
inlinestatic

Definition at line 1390 of file aarch64-opc.c.

1392 {
1393  if (mismatch_detail == NULL)
1394  return;
1395  set_error (mismatch_detail, AARCH64_OPDE_OTHER_ERROR, idx, error);
1396 }
static void set_error(aarch64_operand_error *mismatch_detail, enum aarch64_operand_error_kind kind, int idx, const char *error)
Definition: aarch64-opc.c:1275
@ AARCH64_OPDE_OTHER_ERROR
Definition: aarch64.h:1103

References AARCH64_OPDE_OTHER_ERROR, error(), setup::idx, NULL, and set_error().

Referenced by operand_general_constraint_met_p().

◆ set_out_of_range_error()

static void set_out_of_range_error ( aarch64_operand_error mismatch_detail,
int  idx,
int  lower_bound,
int  upper_bound,
const char *  error 
)
inlinestatic

Definition at line 1296 of file aarch64-opc.c.

1299 {
1300  if (mismatch_detail == NULL)
1301  return;
1302  set_error (mismatch_detail, AARCH64_OPDE_OUT_OF_RANGE, idx, error);
1303  mismatch_detail->data[0] = lower_bound;
1304  mismatch_detail->data[1] = upper_bound;
1305 }
@ AARCH64_OPDE_OUT_OF_RANGE
Definition: aarch64.h:1100

References AARCH64_OPDE_OUT_OF_RANGE, aarch64_operand_error::data, error(), setup::idx, NULL, and set_error().

Referenced by set_elem_idx_out_of_range_error(), set_imm_out_of_range_error(), set_multiplier_out_of_range_error(), set_offset_out_of_range_error(), set_regno_out_of_range_error(), and set_sft_amount_out_of_range_error().

◆ set_reg_list_error()

static void set_reg_list_error ( aarch64_operand_error mismatch_detail,
int  idx,
int  expected_num 
)
inlinestatic

Definition at line 1380 of file aarch64-opc.c.

1382 {
1383  if (mismatch_detail == NULL)
1384  return;
1385  set_error (mismatch_detail, AARCH64_OPDE_REG_LIST, idx, NULL);
1386  mismatch_detail->data[0] = expected_num;
1387 }
@ AARCH64_OPDE_REG_LIST
Definition: aarch64.h:1102

References AARCH64_OPDE_REG_LIST, aarch64_operand_error::data, setup::idx, NULL, and set_error().

Referenced by operand_general_constraint_met_p().

◆ set_regno_out_of_range_error()

static void set_regno_out_of_range_error ( aarch64_operand_error mismatch_detail,
int  idx,
int  lower_bound,
int  upper_bound 
)
inlinestatic

Definition at line 1328 of file aarch64-opc.c.

1330 {
1331  if (mismatch_detail == NULL)
1332  return;
1333  set_out_of_range_error (mismatch_detail, idx, lower_bound, upper_bound,
1334  _("register number"));
1335 }

References _, setup::idx, NULL, and set_out_of_range_error().

Referenced by operand_general_constraint_met_p().

◆ set_sft_amount_out_of_range_error()

static void set_sft_amount_out_of_range_error ( aarch64_operand_error mismatch_detail,
int  idx,
int  lower_bound,
int  upper_bound 
)
inlinestatic

Definition at line 1348 of file aarch64-opc.c.

1350 {
1351  if (mismatch_detail == NULL)
1352  return;
1353  set_out_of_range_error (mismatch_detail, idx, lower_bound, upper_bound,
1354  _("shift amount"));
1355 }

References _, setup::idx, NULL, and set_out_of_range_error().

Referenced by operand_general_constraint_met_p().

◆ set_syntax_error()

static void set_syntax_error ( aarch64_operand_error mismatch_detail,
int  idx,
const char *  error 
)
inlinestatic

Definition at line 1287 of file aarch64-opc.c.

1289 {
1290  if (mismatch_detail == NULL)
1291  return;
1292  set_error (mismatch_detail, AARCH64_OPDE_SYNTAX_ERROR, idx, error);
1293 }
@ AARCH64_OPDE_SYNTAX_ERROR
Definition: aarch64.h:1096

References AARCH64_OPDE_SYNTAX_ERROR, error(), setup::idx, NULL, and set_error().

Referenced by operand_general_constraint_met_p().

◆ set_unaligned_error()

static void set_unaligned_error ( aarch64_operand_error mismatch_detail,
int  idx,
int  alignment 
)
inlinestatic

Definition at line 1370 of file aarch64-opc.c.

1372 {
1373  if (mismatch_detail == NULL)
1374  return;
1375  set_error (mismatch_detail, AARCH64_OPDE_UNALIGNED, idx, NULL);
1376  mismatch_detail->data[0] = alignment;
1377 }
@ AARCH64_OPDE_UNALIGNED
Definition: aarch64.h:1101

References AARCH64_OPDE_UNALIGNED, aarch64_operand_error::data, setup::idx, NULL, and set_error().

Referenced by operand_general_constraint_met_p().

◆ simd_imm_encoding_cmp()

static int simd_imm_encoding_cmp ( const void *  i1,
const void *  i2 
)
static

Definition at line 1106 of file aarch64-opc.c.

1107 {
1108  const simd_imm_encoding *imm1 = (const simd_imm_encoding *)i1;
1109  const simd_imm_encoding *imm2 = (const simd_imm_encoding *)i2;
1110 
1111  if (imm1->imm < imm2->imm)
1112  return -1;
1113  if (imm1->imm > imm2->imm)
1114  return +1;
1115  return 0;
1116 }

References i2, and simd_imm_encoding::imm.

Referenced by aarch64_logical_immediate_p(), and build_immediate_table().

◆ value_aligned_p()

static int value_aligned_p ( int64_t  value,
int  align 
)
inlinestatic

Definition at line 527 of file aarch64-opc.c.

528 {
529  return (value % align) == 0;
530 }

References value.

Referenced by operand_general_constraint_met_p().

◆ value_fit_signed_field_p()

static int value_fit_signed_field_p ( int64_t  value,
unsigned  width 
)
inlinestatic

Definition at line 534 of file aarch64-opc.c.

535 {
536  assert (width < 32);
537  if (width < sizeof (value) * 8)
538  {
539  int64_t lim = (int64_t)1 << (width - 1);
540  if (value >= -lim && value < lim)
541  return 1;
542  }
543  return 0;
544 }
int width
Definition: main.c:10

References assert(), value, and width.

Referenced by operand_general_constraint_met_p().

◆ value_fit_unsigned_field_p()

static int value_fit_unsigned_field_p ( int64_t  value,
unsigned  width 
)
inlinestatic

Definition at line 548 of file aarch64-opc.c.

549 {
550  assert (width < 32);
551  if (width < sizeof (value) * 8)
552  {
553  int64_t lim = (int64_t)1 << width;
554  if (value >= 0 && value < lim)
555  return 1;
556  }
557  return 0;
558 }

References assert(), value, and width.

Referenced by operand_general_constraint_met_p().

◆ value_in_range_p()

static int value_in_range_p ( int64_t  value,
int  low,
int  high 
)
inlinestatic

Definition at line 520 of file aarch64-opc.c.

521 {
522  return (value >= low && value <= high) ? 1 : 0;
523 }

References value.

Referenced by operand_general_constraint_met_p().

◆ vector_qualifier_p()

static bfd_boolean vector_qualifier_p ( enum aarch64_opnd_qualifier  qualifier)
inlinestatic

Definition at line 109 of file aarch64-opc.c.

110 {
111  return ((qualifier >= AARCH64_OPND_QLF_V_8B
112  && qualifier <= AARCH64_OPND_QLF_V_1Q) ? TRUE
113  : FALSE);
114 }
@ AARCH64_OPND_QLF_V_8B
Definition: aarch64.h:418
@ AARCH64_OPND_QLF_V_1Q
Definition: aarch64.h:427

References AARCH64_OPND_QLF_V_1Q, AARCH64_OPND_QLF_V_8B, FALSE, and TRUE.

◆ verify_ldpsw()

static bfd_boolean verify_ldpsw ( const struct aarch64_opcode *opcode  ATTRIBUTE_UNUSED,
const aarch64_insn  insn 
)
static

Definition at line 4492 of file aarch64-opc.c.

4494 {
4495  int t = BITS (insn, 4, 0);
4496  int n = BITS (insn, 9, 5);
4497  int t2 = BITS (insn, 14, 10);
4498 
4499  if (BIT (insn, 23))
4500  {
4501  /* Write back enabled. */
4502  if ((t == n || t2 == n) && n != 31)
4503  return FALSE;
4504  }
4505 
4506  if (BIT (insn, 22))
4507  {
4508  /* Load */
4509  if (t == t2)
4510  return FALSE;
4511  }
4512 
4513  return TRUE;
4514 }
#define BIT(INSN, BT)
Definition: aarch64-opc.c:4488
#define BITS(INSN, HI, LO)
Definition: aarch64-opc.c:4489
int n
Definition: mipsasm.c:19

References BIT, BITS, FALSE, n, and TRUE.

Variable Documentation

◆ aarch64_barrier_options

const struct aarch64_name_value_pair aarch64_barrier_options[16]
Initial value:
=
{
{ "#0x00", 0x0 },
{ "oshld", 0x1 },
{ "oshst", 0x2 },
{ "osh", 0x3 },
{ "#0x04", 0x4 },
{ "nshld", 0x5 },
{ "nshst", 0x6 },
{ "nsh", 0x7 },
{ "#0x08", 0x8 },
{ "ishld", 0x9 },
{ "ishst", 0xa },
{ "ish", 0xb },
{ "#0x0c", 0xc },
{ "ld", 0xd },
{ "st", 0xe },
{ "sy", 0xf },
}

Definition at line 437 of file aarch64-opc.c.

Referenced by aarch64_ext_barrier().

◆ aarch64_conds

const aarch64_cond aarch64_conds[16]
Initial value:
=
{
{{"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", "pmore"}, 0x8},
{{"ls", "plast"}, 0x9},
{{"ge", "tcont"}, 0xa},
{{"lt", "tstop"}, 0xb},
{{"gt"}, 0xc},
{{"le"}, 0xd},
{{"al"}, 0xe},
{{"nv"}, 0xf},
}

Definition at line 348 of file aarch64-opc.c.

Referenced by aarch64_get_operand_modifier(), and get_cond_from_value().

◆ aarch64_hint_options

const struct aarch64_name_value_pair aarch64_hint_options[]
Initial value:
=
{
{ "csync", 0x11 },
{ NULL, 0x0 },
}

Definition at line 437 of file aarch64-opc.c.

Referenced by aarch64_ext_hint().

◆ aarch64_operand_modifiers

const struct aarch64_name_value_pair aarch64_operand_modifiers[]
Initial value:
=
{
{"none", 0x0},
{"msl", 0x0},
{"ror", 0x3},
{"asr", 0x2},
{"lsr", 0x1},
{"lsl", 0x0},
{"uxtb", 0x0},
{"uxth", 0x1},
{"uxtw", 0x2},
{"uxtx", 0x3},
{"sxtb", 0x4},
{"sxth", 0x5},
{"sxtw", 0x6},
{"sxtx", 0x7},
{"mul", 0x0},
{"mul vl", 0x0},
{NULL, 0},
}

Definition at line 376 of file aarch64-opc.c.

Referenced by aarch64_get_operand_modifier_from_value(), aarch64_print_operand(), and print_register_offset_address().

◆ aarch64_opnd_qualifiers

◆ aarch64_prfops

const struct aarch64_name_value_pair aarch64_prfops[32]

Definition at line 437 of file aarch64-opc.c.

Referenced by aarch64_ext_prfop().

◆ aarch64_pstatefields

const aarch64_sys_reg aarch64_pstatefields[]
Initial value:
=
{
{ "spsel", 0x05, 0 },
{ "daifset", 0x1e, 0 },
{ "daifclr", 0x1f, 0 },
{ "pan", 0x04, F_ARCHEXT },
{ "uao", 0x03, F_ARCHEXT },
{ "dit", 0x1a, F_ARCHEXT },
{ 0, CPENC(0,0,0,0,0), 0 },
}

Definition at line 4281 of file aarch64-opc.c.

Referenced by aarch64_ext_pstatefield(), and aarch64_print_operand().

◆ aarch64_sve_pattern_array

const char* const aarch64_sve_pattern_array[32]

Definition at line 43 of file aarch64-opc.c.

Referenced by aarch64_print_operand().

◆ aarch64_sve_prfop_array

const char* const aarch64_sve_prfop_array[16]
Initial value:
= {
"pldl1keep",
"pldl1strm",
"pldl2keep",
"pldl2strm",
"pldl3keep",
"pldl3strm",
0,
0,
"pstl1keep",
"pstl1strm",
"pstl2keep",
"pstl2strm",
"pstl3keep",
"pstl3strm",
0,
0
}

Definition at line 84 of file aarch64-opc.c.

Referenced by aarch64_print_operand().

◆ aarch64_sys_regs

const aarch64_sys_reg aarch64_sys_regs[]

Definition at line 3673 of file aarch64-opc.c.

Referenced by aarch64_print_operand().

◆ aarch64_sys_regs_at

const aarch64_sys_ins_reg aarch64_sys_regs_at[]
Initial value:
=
{
{ "s1e1r", CPENS (0, C7, C8, 0), F_HASXT },
{ "s1e1w", CPENS (0, C7, C8, 1), F_HASXT },
{ "s1e0r", CPENS (0, C7, C8, 2), F_HASXT },
{ "s1e0w", CPENS (0, C7, C8, 3), F_HASXT },
{ "s12e1r", CPENS (4, C7, C8, 4), F_HASXT },
{ "s12e1w", CPENS (4, C7, C8, 5), F_HASXT },
{ "s12e0r", CPENS (4, C7, C8, 6), F_HASXT },
{ "s12e0w", CPENS (4, C7, C8, 7), F_HASXT },
{ "s1e2r", CPENS (4, C7, C8, 0), F_HASXT },
{ "s1e2w", CPENS (4, C7, C8, 1), F_HASXT },
{ "s1e3r", CPENS (6, C7, C8, 0), F_HASXT },
{ "s1e3w", CPENS (6, C7, C8, 1), F_HASXT },
{ "s1e1rp", CPENS (0, C7, C9, 0), F_HASXT | F_ARCHEXT },
{ "s1e1wp", CPENS (0, C7, C9, 1), F_HASXT | F_ARCHEXT },
{ 0, CPENS(0,0,0,0), 0 }
}

Definition at line 4339 of file aarch64-opc.c.

Referenced by aarch64_ext_sysins_op().

◆ aarch64_sys_regs_dc

const aarch64_sys_ins_reg aarch64_sys_regs_dc[]
Initial value:
=
{
{ "zva", CPENS (3, C7, C4, 1), F_HASXT },
{ "ivac", CPENS (0, C7, C6, 1), F_HASXT },
{ "isw", CPENS (0, C7, C6, 2), F_HASXT },
{ "cvac", CPENS (3, C7, C10, 1), F_HASXT },
{ "csw", CPENS (0, C7, C10, 2), F_HASXT },
{ "cvau", CPENS (3, C7, C11, 1), F_HASXT },
{ "cvap", CPENS (3, C7, C12, 1), F_HASXT | F_ARCHEXT },
{ "civac", CPENS (3, C7, C14, 1), F_HASXT },
{ "cisw", CPENS (0, C7, C14, 2), F_HASXT },
{ 0, CPENS(0,0,0,0), 0 }
}
#define C11
Definition: aarch64-opc.c:3665

Definition at line 4325 of file aarch64-opc.c.

Referenced by aarch64_ext_sysins_op().

◆ aarch64_sys_regs_ic

const aarch64_sys_ins_reg aarch64_sys_regs_ic[]
Initial value:
=
{
{ "ialluis", CPENS(0,C7,C1,0), 0 },
{ "iallu", CPENS(0,C7,C5,0), 0 },
{ "ivau", CPENS (3, C7, C5, 1), F_HASXT },
{ 0, CPENS(0,0,0,0), 0 }
}

Definition at line 4317 of file aarch64-opc.c.

Referenced by aarch64_ext_sysins_op().

◆ aarch64_sys_regs_tlbi

const aarch64_sys_ins_reg aarch64_sys_regs_tlbi[]

Definition at line 4358 of file aarch64-opc.c.

Referenced by aarch64_ext_sysins_op().

◆ fields

◆ int_reg

const char* int_reg[2][2][32]
static
Initial value:
= {
#define R32(X)
#define R64(X)
{ BANK (R32, "wsp"), BANK (R64, "sp") },
{ BANK (R32, "wzr"), BANK (R64, "xzr") }
}
#define R32(X)
#define BANK(R, FOR31)
Definition: aarch64-opc.c:2748
#define R64(X)

Definition at line 2757 of file aarch64-opc.c.

Referenced by get_64bit_int_reg_name(), and get_int_reg_name().

◆ significant_operand_index

const char significant_operand_index[]
static
Initial value:
=
{
0,
0,
1,
2,
1,
}

Definition at line 133 of file aarch64-opc.c.

Referenced by aarch64_select_operand_for_sizeq_field_coding().

◆ simd_immediates

simd_imm_encoding simd_immediates[TOTAL_IMM_NB]
static

Definition at line 1103 of file aarch64-opc.c.

Referenced by aarch64_logical_immediate_p(), and build_immediate_table().

◆ sve_reg

const char* sve_reg[2][32]
static
Initial value:
= {
#define ZS(X)
#define ZD(X)
BANK (ZS, ZS (31)), BANK (ZD, ZD (31))
}
#define ZD(X)
#define ZS(X)

Definition at line 2769 of file aarch64-opc.c.

Referenced by get_addr_sve_reg_name().