ppc: share pd_reg definition via libopcodes
authorDmitry Selyutin <ghostmansd@gmail.com>
Wed, 29 Jun 2022 11:18:38 +0000 (14:18 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Wed, 21 Sep 2022 08:25:16 +0000 (11:25 +0300)
gas/config/tc-ppc.c
include/opcode/ppc.h

index d20fd757091e12520523590c4f57124c90b0d421..31f096eeff87c68c920da1f4986af42298a2aeb5 100644 (file)
@@ -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);
index c5d96a265a8cb662d054a67cbbdf201b8d982081..07661b51cdf4a4522d99487fac54825be19aac24 100644 (file)
@@ -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