From: Dmitry Selyutin Date: Sun, 28 May 2023 22:04:56 +0000 (+0300) Subject: ppc/svp64: reuse md_parse_name in md_operand X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2145aa437bd49bd14b417fc368fc34cb37520bcd;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 bf49d38f0a9..6065204bf68 100644 --- a/gas/config/tc-ppc-svp64.c +++ b/gas/config/tc-ppc-svp64.c @@ -313,7 +313,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 06aff47890d..6cddf0f007c 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)); }