From: Dmitry Selyutin Date: Tue, 11 Apr 2023 18:27:25 +0000 (+0300) Subject: ppc/svp64: reuse md_parse_name in md_operand X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0068a282dd6b3bca3aa390481f1c8b7835c5f8d3;p=binutils-gdb.git ppc/svp64: reuse md_parse_name in md_operand --- diff --git a/gas/config/tc-ppc-svp64.c b/gas/config/tc-ppc-svp64.c index 733c1f95cc9..fe79618d887 100644 --- a/gas/config/tc-ppc-svp64.c +++ b/gas/config/tc-ppc-svp64.c @@ -289,7 +289,7 @@ svp64_parse_name (const char *name, expressionS *exp, enum expr_mode mode) if ((svp64_parse_predicate_cr (name, exp) || svp64_parse_predicate_RC1 (name, exp)) == 0) - ppc_parse_name_common (name, exp, mode, svp64_regs, svp64_num_regs); + ppc_parse_name_common (name, exp, mode, false, svp64_regs, svp64_num_regs); } static char * diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 1d3d12571f0..ff0b4d35b08 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -49,7 +49,7 @@ ppc_operand_common (expressionS *expressionP, static void ppc_parse_name_common (const char *name, - expressionS *exp, enum expr_mode mode, + expressionS *exp, enum expr_mode mode, bool operand, const struct powerpc_pd_reg *regs, size_t num); static void @@ -839,23 +839,15 @@ reg_name_search (const struct powerpc_pd_reg *regs, int regcount, const char *na /* Called for a non-symbol, non-number operand. Handles %reg. */ static void -ppc_operand_common (expressionS *expressionP, +ppc_operand_common (expressionS *exp, const struct powerpc_pd_reg *regs, size_t num) { char endc; char *name; - const struct powerpc_pd_reg *reg; endc = get_symbol_name (&name); - reg = reg_name_search (regs, num, name); + ppc_parse_name_common (name, exp, expr_normal, true, regs, num); restore_line_pointer (endc); - - if (reg != NULL) - { - expressionP->X_op = O_register; - expressionP->X_add_number = reg->value; - expressionP->X_md = reg->flags; - } } static void @@ -900,14 +892,14 @@ static const struct powerpc_pd_reg cr_cond[] = static void ppc_parse_name_common (const char *name, - expressionS *exp, enum expr_mode mode, + expressionS *exp, enum expr_mode mode, bool operand, const struct powerpc_pd_reg *regs, size_t num) { const struct powerpc_pd_reg *reg = NULL; if (cr_operand) reg = reg_name_search (cr_cond, ARRAY_SIZE (cr_cond), name); - if (reg == NULL && (cr_operand || reg_names_p)) + if (reg == NULL && (operand || cr_operand || reg_names_p)) reg = reg_name_search (regs, num, name); if (reg != NULL) { @@ -955,7 +947,7 @@ ppc_parse_name_common (const char *name, static void ppc_parse_name_default (const char *name, expressionS *exp, enum expr_mode mode) { - ppc_parse_name_common (name, exp, mode, + ppc_parse_name_common (name, exp, mode, false, pre_defined_registers, ARRAY_SIZE (pre_defined_registers)); }