[binutils-gdb] aarch64: Add new qualifier AARCH64_OPND_QLF_UNUSED

Alice Carlotti via Binutils-cvs <[email protected]>
Newsgroups gmane.comp.gnu.binutils.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1b01d9a735c75573b10e9d89a3201d811062b889

commit 1b01d9a735c75573b10e9d89a3201d811062b889
Author: Alice Carlotti <[email protected]>
Date:   Thu May 7 07:08:53 2026 +0100

    aarch64: Add new qualifier AARCH64_OPND_QLF_UNUSED
    
    Replace QLF_NIL with QLF_UNUSED for qualifier sequence list padding.
    This splits apart distinct qualifier meanings, and simplifies detection
    of empty qualifier sequences.

Diff:
---
 gas/config/tc-aarch64.c  |  2 +-
 include/opcode/aarch64.h | 12 ++++++------
 opcodes/aarch64-dis.c    |  8 ++++----
 opcodes/aarch64-opc.c    |  3 ++-
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index f88f1b27c9f..fb58bcca9b1 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -6003,7 +6003,7 @@ output_operand_error_record (const operand_error_record *record, char *str)
 	  for (i = 0; i < AARCH64_MAX_QLF_SEQ_NUM; ++i, ++qualifiers_list)
 	    {
 	      /* Most opcodes has much fewer patterns in the list.
-		 First NIL qualifier indicates the end in the list.   */
+		 First UNUSED qualifier indicates the end in the list.  */
 	      if (empty_qualifier_sequence_p (*qualifiers_list))
 		break;
 
diff --git a/include/opcode/aarch64.h b/include/opcode/aarch64.h
index 9a1767fa6c0..6d1b414444a 100644
--- a/include/opcode/aarch64.h
+++ b/include/opcode/aarch64.h
@@ -1010,6 +1010,11 @@ enum aarch64_opnd
 
 enum aarch64_opnd_qualifier
 {
+  /* Indicating an unused entry in a list of qualifier sequences (assigned via
+     empty initialization of unused array elements), or some other unused
+     value.  */
+  AARCH64_OPND_QLF_UNUSED,
+
   /* Indicating no further qualification on an operand.  */
   AARCH64_OPND_QLF_NIL,
 
@@ -1353,15 +1358,10 @@ typedef enum aarch64_opnd_qualifier aarch64_opnd_qualifier_t;
 typedef aarch64_opnd_qualifier_t	\
 	  aarch64_opnd_qualifier_seq_t [AARCH64_MAX_OPND_NUM];
 
-/* FIXME: improve the efficiency.  */
 static inline bool
 empty_qualifier_sequence_p (const aarch64_opnd_qualifier_t *qualifiers)
 {
-  int i;
-  for (i = 0; i < AARCH64_MAX_OPND_NUM; ++i)
-    if (qualifiers[i] != AARCH64_OPND_QLF_NIL)
-      return false;
-  return true;
+  return qualifiers[0] == AARCH64_OPND_QLF_UNUSED;
 }
 
 /*  Forward declare error reporting type.  */
diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c
index 95d70d79294..c3a809ef576 100644
--- a/opcodes/aarch64-dis.c
+++ b/opcodes/aarch64-dis.c
@@ -2516,7 +2516,7 @@ aarch64_ext_plain_shrimm (const aarch64_operand *self, aarch64_opnd_info *info,
 
    N.B. CANDIDATES is a group of possible qualifiers that are valid for
    one operand; it has a maximum of AARCH64_MAX_QLF_SEQ_NUM qualifiers and
-   may end with AARCH64_OPND_QLF_NIL.  */
+   may end with AARCH64_OPND_QLF_UNUSED.  */
 
 static enum aarch64_opnd_qualifier
 get_qualifier_from_partial_encoding (aarch64_insn value,
@@ -2529,7 +2529,7 @@ get_qualifier_from_partial_encoding (aarch64_insn value,
   for (i = 0; i < AARCH64_MAX_QLF_SEQ_NUM; ++i)
     {
       aarch64_insn standard_value;
-      if (candidates[i] == AARCH64_OPND_QLF_NIL)
+      if (candidates[i] == AARCH64_OPND_QLF_UNUSED)
 	break;
       standard_value = aarch64_get_qualifier_standard_value (candidates[i]);
       if ((standard_value & mask) == (value & mask))
@@ -2549,7 +2549,7 @@ get_operand_possible_qualifiers (int idx,
 {
   int i;
   for (i = 0; i < AARCH64_MAX_QLF_SEQ_NUM; ++i)
-    if ((qualifiers[i] = list[i][idx]) == AARCH64_OPND_QLF_NIL)
+    if ((qualifiers[i] = list[i][idx]) == AARCH64_OPND_QLF_UNUSED)
       break;
 }
 
@@ -2604,7 +2604,7 @@ decode_sizeq (aarch64_inst *inst)
   if (debug_dump)
     {
       int i;
-      for (i = 0; candidates[i] != AARCH64_OPND_QLF_NIL
+      for (i = 0; candidates[i] != AARCH64_OPND_QLF_UNUSED
 	   && i < AARCH64_MAX_QLF_SEQ_NUM; ++i)
 	DEBUG_TRACE ("qualifier %d: %s", i,
 		     aarch64_get_qualifier_name(candidates[i]));
diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c
index b21315333db..62bb11868fd 100644
--- a/opcodes/aarch64-opc.c
+++ b/opcodes/aarch64-opc.c
@@ -195,7 +195,7 @@ get_data_pattern (const aarch64_opnd_qualifier_seq_t qualifiers)
     {
       /* e.g. SADDLV <V><d>, <Vn>.<T>.  */
       if (vector_qualifier_p (qualifiers[1])
-	  && qualifiers[2] == AARCH64_OPND_QLF_NIL)
+	  && (qualifiers[2] == AARCH64_OPND_QLF_UNUSED))
 	return DP_VECTOR_ACROSS_LANES;
     }
 
@@ -737,6 +737,7 @@ struct operand_qualifier_data
 /* Indexed by the operand qualifier enumerators.  */
 static const struct operand_qualifier_data aarch64_opnd_qualifiers[] =
 {
+  {0, 0, 0, "UNUSED", OQK_NIL},
   {0, 0, 0, "NIL", OQK_NIL},
   {0, 0, 0, "UNKNOWN", OQK_NIL},
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.