Guest User

Untitled

a guest
Jan 29th, 2022
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.60 KB | None | 0 0
  1. commit 9207325cc5237c17ebe2c9074a1a8eec23a9f6dc
  2. Author: Dmitry Selyutin <[email protected]>
  3. Date:   Sat Jan 29 14:54:41 2022 +0000
  4.  
  5.     svp64: hack powerpc_opcode struct
  6.  
  7. diff --git a/gas/config/tc-ppc-svp64.c b/gas/config/tc-ppc-svp64.c
  8. index 451242dad27..dd5405b55b3 100644
  9. --- a/gas/config/tc-ppc-svp64.c
  10. +++ b/gas/config/tc-ppc-svp64.c
  11. @@ -1,5 +1,10 @@
  12. +#include <assert.h>
  13. +#include <stdalign.h>
  14. +#include <stddef.h>
  15.  #include <stdint.h>
  16.  
  17. +#include "opcode/ppc.h"
  18. +
  19.  struct svp64_rm {
  20.    uint64_t flags;
  21.    const char *pme;
  22. @@ -869,30 +874,35 @@ svp64_setup_opcodes (htab_t ppc_hash)
  23.    const struct svp64_entry *svp64_end;
  24.    char name[SVP64_NAME_MAX + sizeof(".")];
  25.  
  26. +  static_assert(alignof(struct svp64_record) == alignof(struct powerpc_opcode),
  27. +                "svp64_record alignment mismatch");
  28. +  static_assert(sizeof(struct svp64_record) == sizeof(uint64_t),
  29. +                "svp64_record size mismatch");
  30. +
  31.    svp64_end = svp64_entries + svp64_num_entries;
  32.    for (svp64 = svp64_entries; svp64 < svp64_end; svp64++)
  33.      {
  34.        size_t len;
  35. -      struct powerpc_opcode *ppc;
  36. +      struct svp64_record *ppc_svp64;
  37.  
  38.        len = strlen(svp64->name);
  39.        memcpy(name, svp64->name, len);
  40.  
  41.        name[len] = '\0';
  42. -      ppc = (struct powerpc_opcode *) str_hash_find (ppc_hash, name);
  43. -      if (!ppc)
  44. +      ppc_svp64 = (struct svp64_record *) str_hash_find (ppc_hash, name);
  45. +      if (!ppc_svp64)
  46.          as_fatal (_("SVP64 instruction missing: %s"), name);
  47. -      ppc->svp64 = svp64->record;
  48. -      ppc->svp64.active = 1;
  49. +      *ppc_svp64 = svp64->record;
  50. +      ppc_svp64->active = 1;
  51.  
  52.        name[len] = '.';
  53.        name[len + 1] = '\0';
  54. -      ppc = (struct powerpc_opcode *) str_hash_find (ppc_hash, name);
  55. -      if (ppc) {
  56. -        if (ppc->svp64.active)
  57. +      ppc_svp64 = (struct svp64_record *) str_hash_find (ppc_hash, name);
  58. +      if (ppc_svp64) {
  59. +        if (ppc_svp64->active)
  60.            as_fatal (_("SVP64 instruction collision: '%s'"), name);
  61. -        ppc->svp64 = svp64->record;
  62. -        ppc->svp64.active = 1;
  63. +        *ppc_svp64 = svp64->record;
  64. +        ppc_svp64->active = 1;
  65.        }
  66.      }
  67.  }
  68. diff --git a/include/opcode/ppc.h b/include/opcode/ppc.h
  69. index e791523211a..3f1bab61b7b 100644
  70. --- a/include/opcode/ppc.h
  71. +++ b/include/opcode/ppc.h
  72. @@ -36,6 +36,12 @@ typedef uint64_t ppc_cpu_t;
  73.  
  74.  struct powerpc_opcode
  75.  {
  76. +  /*
  77. +   * SVP64 extensions record placeholder.
  78. +   * This placeholder must always be the first entry.
  79. +   */
  80. +  uint64_t : 64;
  81. +
  82.    /* The opcode name.  */
  83.    const char *name;
  84.  
  85. @@ -63,9 +69,6 @@ struct powerpc_opcode
  86.       operand table.  They appear in the order which the operands must
  87.       appear in assembly code, and are terminated by a zero.  */
  88.    unsigned char operands[8];
  89. -
  90. -  /* SVP64 extensions record. */
  91. -  struct svp64_record svp64;
  92.  };
  93.  
  94.  /* The table itself is sorted by major opcode number, and is otherwise
  95. diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c
  96. index 3aac79dbb41..11fb48306d5 100644
  97. --- a/opcodes/ppc-opc.c
  98. +++ b/opcodes/ppc-opc.c
  99. @@ -4329,8 +4329,6 @@ const unsigned int num_powerpc_operands = (sizeof (powerpc_operands)
  100.  #define EXT    PPC_OPCODE_RAW
  101.  
  102.  /* Opcode tables below might have zero-initialized SVP64 entry. */
  103. -#pragma GCC diagnostic push
  104. -#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
  105.  
  106.  /* The opcode table.
  107.  
  108. @@ -10831,6 +10829,4 @@ struct powerpc_opcode spe2_opcodes[] = {
  109.  const unsigned int spe2_num_opcodes =
  110.    sizeof (spe2_opcodes) / sizeof (spe2_opcodes[0]);
  111.  
  112. -#pragma GCC diagnostic pop
  113. -
  114.  #include "ppc-svp64-opc.c"
  115.  
Advertisement
Add Comment
Please, Sign In to add comment