From fdbca0eeb56b5f4eec822a9f2d29e8862f3bb7b2 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Wed, 29 Jun 2022 14:18:38 +0300 Subject: [PATCH] ppc: share pd_reg definition via libopcodes --- gas/config/tc-ppc.c | 20 ++++++-------------- include/opcode/ppc.h | 8 ++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index d20fd757091..31f096eeff8 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -276,14 +276,6 @@ const pseudo_typeS md_pseudo_table[] = In general, there are lots of them, in an attempt to be compatible with a number of other Windows NT assemblers. */ -/* Structure to hold information about predefined registers. */ -struct pd_reg - { - const char *name; - unsigned short value; - unsigned short flags; - }; - /* List of registers that are pre-defined: Each general register has predefined names of the form: @@ -317,7 +309,7 @@ struct pd_reg The table is sorted. Suitable for searching by a binary search. */ -static const struct pd_reg pre_defined_registers[] = +static const struct powerpc_pd_reg pre_defined_registers[] = { /* VSX accumulators. */ { "a0", 0, PPC_OPERAND_ACC }, @@ -788,8 +780,8 @@ static const struct pd_reg pre_defined_registers[] = /* Given NAME, find the register number associated with that name, return the integer value associated with the given name or -1 on failure. */ -static const struct pd_reg * -reg_name_search (const struct pd_reg *regs, int regcount, const char *name) +static const struct powerpc_pd_reg * +reg_name_search (const struct powerpc_pd_reg *regs, int regcount, const char *name) { int middle, low, high; int cmp; @@ -818,7 +810,7 @@ reg_name_search (const struct pd_reg *regs, int regcount, const char *name) void md_operand (expressionS *expressionP) { - const struct pd_reg *reg; + const struct powerpc_pd_reg *reg; char *name; char *start; char c; @@ -848,7 +840,7 @@ md_operand (expressionS *expressionP) static bool cr_operand; /* Extra names to recognise in a condition code. This table is sorted. */ -static const struct pd_reg cr_cond[] = +static const struct powerpc_pd_reg cr_cond[] = { { "eq", 2, PPC_OPERAND_CR_BIT }, { "gt", 1, PPC_OPERAND_CR_BIT }, @@ -865,7 +857,7 @@ static const struct pd_reg cr_cond[] = void ppc_parse_name (const char *name, expressionS *exp, enum expr_mode mode) { - const struct pd_reg *reg = NULL; + const struct powerpc_pd_reg *reg = NULL; if (cr_operand) reg = reg_name_search (cr_cond, ARRAY_SIZE (cr_cond), name); diff --git a/include/opcode/ppc.h b/include/opcode/ppc.h index c5d96a265a8..07661b51cdf 100644 --- a/include/opcode/ppc.h +++ b/include/opcode/ppc.h @@ -506,6 +506,14 @@ ppc_optional_operand_value (const struct powerpc_operand *operand, #define E_LI_INSN 0x70000000 #define E_LI_MASK 0xfc008000 +/* Structure to hold information about predefined registers. */ +struct powerpc_pd_reg + { + const char *name; + unsigned short value; + unsigned short flags; + }; + #ifdef __cplusplus } #endif -- 2.30.2