From: Dmitry Selyutin Date: Sun, 24 Jul 2022 19:04:32 +0000 (+0300) Subject: ppc/svp64: reuse md_parse_name in md_operand X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=97bfbbbd176277a4ca798fd7bbb5377e552d30bd;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 b5e16bb9abb..ec0fda793c8 100644 --- a/gas/config/tc-ppc-svp64.c +++ b/gas/config/tc-ppc-svp64.c @@ -299,7 +299,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 5aa4722c9c7..02d7f844f64 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 @@ -829,23 +829,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 @@ -890,14 +882,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) { @@ -945,7 +937,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)); }