[binutils-gdb] MIPS16/GAS: Streamline forced size suffix handling code

Maciej W. Rozycki macro@sourceware.org
Mon Feb 10 22:14:55 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8eca085f0ad6319f2ba331d27281a478b67992d3

commit 8eca085f0ad6319f2ba331d27281a478b67992d3
Author: Maciej W. Rozycki <macro@orcam.me.uk>
Date:   Mon Feb 10 22:11:25 2025 +0000

    MIPS16/GAS: Streamline forced size suffix handling code
    
    Clean up after commit 112cf77b1855 ("MIPS: use is_whitespace()") and
    untangle the code flow in the handling of forced size suffixes, noting
    that owing to the loop right above the only data `c' can hold at this
    point is '\0', '.', or a white-space character.  No functional change.

Diff:
---
 gas/config/tc-mips.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index c5d36c24558..d01b6a5ba05 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -14394,17 +14394,8 @@ mips16_ip (char *str, struct mips_cl_insn *insn)
   c = *end;
 
   l = 0;
-  switch (c)
+  if (c == '.')
     {
-    case '\0':
-      break;
-
-    default:
-      if (is_whitespace (*s))
-	s++;
-      break;
-
-    case '.':
       s++;
       if (*s == 't')
 	{
@@ -14416,16 +14407,14 @@ mips16_ip (char *str, struct mips_cl_insn *insn)
 	  l = 4;
 	  s++;
 	}
-      if (l != 0)
+      if (l == 0 || (*s != '\0' && !is_whitespace (*s++)))
 	{
-	  if (*s == '\0')
-	    break;
-	  else if (is_whitespace (*s++))
-	    break;
+	  set_insn_error (0, _("unrecognized opcode"));
+	  return;
 	}
-      set_insn_error (0, _("unrecognized opcode"));
-      return;
     }
+  else if (is_whitespace (c))
+    s++;
   forced_insn_length = l;
 
   *end = 0;


More information about the Binutils-cvs mailing list