public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] RISC-V: drop "percent_op" parameter from my_getOpcodeExpression()
@ 2023-04-25  9:19 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2023-04-25  9:19 UTC (permalink / raw)
  To: bfd-cvs

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

commit 408ab0161d09ff29e258c8ff1bb02ec5e084087c
Author: Jan Beulich <jbeulich@suse.com>
Date:   Tue Apr 25 11:16:07 2023 +0200

    RISC-V: drop "percent_op" parameter from my_getOpcodeExpression()
    
    Both callers check for no relocations, so there's no point parsing for
    some. Have the function pass percent_op_null into
    my_getSmallExpression(). Note that there's no point passing
    percent_op_itype: Elsewhere, especially when processing compressed alias
    insns ahead of non-alias ones, this has the effect of avoiding "bad
    expression" errors when another parsing pass may follow (and succeed).
    Here, however, all alternative forms of an insn type will again start
    with the same O4 or O2, so avoiding errors earlier on doesn't really
    help. Plus constructs with a relocation specifier (as percent_op_itype
    would permit) can't be specified anyway, as the scrubber eats the
    whitespace between .insn's type and the O4 or O2 expression when that
    starts with % or ( - i.e. these will be seen as e.g. "i%lo(x)", and
    riscv_ip() looks only for whitespace when finding the end of a mnemonic.

Diff:
---
 gas/config/tc-riscv.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 82dfea1bc0d..160161c3c75 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -2299,7 +2299,7 @@ my_getSmallExpression (expressionS *ep, bfd_reloc_code_real_type *reloc,
 
 static size_t
 my_getOpcodeExpression (expressionS *ep, bfd_reloc_code_real_type *reloc,
-			char *str, const struct percent_op_match *percent_op)
+			char *str)
 {
   const struct opcode_name_t *o = opcode_name_lookup (&str);
 
@@ -2310,7 +2310,7 @@ my_getOpcodeExpression (expressionS *ep, bfd_reloc_code_real_type *reloc,
       return 0;
     }
 
-  return my_getSmallExpression (ep, reloc, str, percent_op);
+  return my_getSmallExpression (ep, reloc, str, percent_op_null);
 }
 
 /* Parse string STR as a vsetvli operand.  Store the expression in *EP.
@@ -3314,7 +3314,7 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
 	      switch (*++oparg)
 		{
 		case '4':
-		  if (my_getOpcodeExpression (imm_expr, imm_reloc, asarg, p)
+		  if (my_getOpcodeExpression (imm_expr, imm_reloc, asarg)
 		      || imm_expr->X_op != O_constant
 		      || imm_expr->X_add_number < 0
 		      || imm_expr->X_add_number >= 128
@@ -3331,7 +3331,7 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
 		  continue;
 
 		case '2':
-		  if (my_getOpcodeExpression (imm_expr, imm_reloc, asarg, p)
+		  if (my_getOpcodeExpression (imm_expr, imm_reloc, asarg)
 		      || imm_expr->X_op != O_constant
 		      || imm_expr->X_add_number < 0
 		      || imm_expr->X_add_number >= 3)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-25  9:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-25  9:19 [binutils-gdb] RISC-V: drop "percent_op" parameter from my_getOpcodeExpression() Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).