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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user