From 5f3e25ef50a64224c42eb7ee2f10b0ea72e6783b Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Mon, 29 May 2023 01:04:56 +0300 Subject: [PATCH] ppc/svp64: reuse md_parse_name in md_operand --- gas/config/tc-ppc-svp64.c | 2 +- gas/config/tc-ppc.c | 20 ++++++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) 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 7d8a4845030..dadec84a738 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)); } -- 2.30.2