arc: Don't generate dynamic relocation for non SEC_ALLOC sections
[deliverable/binutils-gdb.git] / opcodes / aarch64-gen.c
index 155ec85e93203cb55e538454e2b0c002fa064fb5..7cfa5d301dd7ab12221ef2857133f33e62869566 100644 (file)
@@ -1,6 +1,6 @@
 /* aarch64-gen.c -- Generate tables and routines for opcode lookup and
    instruction encoding and decoding.
 /* aarch64-gen.c -- Generate tables and routines for opcode lookup and
    instruction encoding and decoding.
-   Copyright (C) 2012-2015 Free Software Foundation, Inc.
+   Copyright (C) 2012-2020 Free Software Foundation, Inc.
    Contributed by ARM Ltd.
 
    This file is part of the GNU opcodes library.
    Contributed by ARM Ltd.
 
    This file is part of the GNU opcodes library.
@@ -28,6 +28,7 @@
 #include "getopt.h"
 #include "opcode/aarch64.h"
 
 #include "getopt.h"
 #include "opcode/aarch64.h"
 
+#define VERIFIER(x) NULL
 #include "aarch64-tbl.h"
 
 static int debug = 0;
 #include "aarch64-tbl.h"
 
 static int debug = 0;
@@ -142,9 +143,9 @@ read_table (const struct aarch64_opcode* table)
       /* F_PSEUDO needs to be used together with F_ALIAS to indicate an alias
         opcode is a programmer friendly pseudo instruction available only in
         the assembly code (thus will not show up in the disassembly).  */
       /* F_PSEUDO needs to be used together with F_ALIAS to indicate an alias
         opcode is a programmer friendly pseudo instruction available only in
         the assembly code (thus will not show up in the disassembly).  */
-      assert (pseudo_opcode_p (ent) == FALSE || alias_opcode_p (ent) == TRUE);
+      assert (!pseudo_opcode_p (ent) || alias_opcode_p (ent));
       /* Skip alias (inc. pseudo) opcode.  */
       /* Skip alias (inc. pseudo) opcode.  */
-      if (alias_opcode_p (ent) == TRUE)
+      if (alias_opcode_p (ent))
        {
          index++;
          continue;
        {
          index++;
          continue;
@@ -248,7 +249,7 @@ divide_table_1 (struct bittree *bittree, opcode_node *opcode)
       goto divide_table_1_finish;
     }
 
       goto divide_table_1_finish;
     }
 
-divide_table_1_try_again:
+ divide_table_1_try_again:
   mask_and = -1;
   ent = opcode;
   while (ent)
   mask_and = -1;
   ent = opcode;
   while (ent)
@@ -338,7 +339,7 @@ divide_table_1_try_again:
   divide_table_1 (bittree->bits[0], list0.next);
   divide_table_1 (bittree->bits[1], list1.next);
 
   divide_table_1 (bittree->bits[0], list0.next);
   divide_table_1 (bittree->bits[1], list1.next);
 
-divide_table_1_finish:
+ divide_table_1_finish:
   if (debug)
     printf ("Leave from depth %d\n", depth);
   --depth;
   if (debug)
     printf ("Leave from depth %d\n", depth);
   --depth;
@@ -377,13 +378,9 @@ initialize_decoder_tree (void)
 static void __attribute__ ((format (printf, 2, 3)))
 indented_print (unsigned int indent, const char *format, ...)
 {
 static void __attribute__ ((format (printf, 2, 3)))
 indented_print (unsigned int indent, const char *format, ...)
 {
-  /* 80 number of spaces pluc a NULL terminator.  */
-  static const char spaces[81] =
-    "                                                                                ";
   va_list ap;
   va_start (ap, format);
   va_list ap;
   va_start (ap, format);
-  assert (indent <= 80);
-  printf ("%s", &spaces[80 - indent]);
+  printf ("%*s", (int) indent, "");
   vprintf (format, ap);
   va_end (ap);
 }
   vprintf (format, ap);
   va_end (ap);
 }
@@ -396,6 +393,9 @@ print_decision_tree_1 (unsigned int indent, struct bittree* bittree)
 {
   /* PATTERN is only used to generate comment in the code.  */
   static char pattern[33] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
 {
   /* PATTERN is only used to generate comment in the code.  */
   static char pattern[33] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+  /* Low bits in PATTERN will be printed first which then look as the high
+     bits in comment.  We need to reverse the index to get correct print.  */
+  unsigned int msb = sizeof (pattern) - 2;
   assert (bittree != NULL);
 
   /* Leaf node located.  */
   assert (bittree != NULL);
 
   /* Leaf node located.  */
@@ -415,15 +415,15 @@ print_decision_tree_1 (unsigned int indent, struct bittree* bittree)
   /* Walk down the decoder tree.  */
   indented_print (indent, "if (((word >> %d) & 0x1) == 0)\n", bittree->bitno);
   indented_print (indent, "  {\n");
   /* Walk down the decoder tree.  */
   indented_print (indent, "if (((word >> %d) & 0x1) == 0)\n", bittree->bitno);
   indented_print (indent, "  {\n");
-  pattern[bittree->bitno] = '0';
+  pattern[msb - bittree->bitno] = '0';
   print_decision_tree_1 (indent + 4, bittree->bits[0]);
   indented_print (indent, "  }\n");
   indented_print (indent, "else\n");
   indented_print (indent, "  {\n");
   print_decision_tree_1 (indent + 4, bittree->bits[0]);
   indented_print (indent, "  }\n");
   indented_print (indent, "else\n");
   indented_print (indent, "  {\n");
-  pattern[bittree->bitno] = '1';
+  pattern[msb - bittree->bitno] = '1';
   print_decision_tree_1 (indent + 4, bittree->bits[1]);
   indented_print (indent, "  }\n");
   print_decision_tree_1 (indent + 4, bittree->bits[1]);
   indented_print (indent, "  }\n");
-  pattern[bittree->bitno] = 'x';
+  pattern[msb - bittree->bitno] = 'x';
 }
 
 /* Generate aarch64_opcode_lookup in C code to the standard output.  */
 }
 
 /* Generate aarch64_opcode_lookup in C code to the standard output.  */
@@ -690,8 +690,8 @@ opcode_node *
 find_alias_opcode (const aarch64_opcode *opcode)
 {
   int i;
 find_alias_opcode (const aarch64_opcode *opcode)
 {
   int i;
-  /* Assume maximum of 8 disassemble preference candidates.  */
-  const int max_num_aliases = 8;
+  /* Assume maximum of 32 disassemble preference candidates.  */
+  const int max_num_aliases = 32;
   const aarch64_opcode *ent;
   const aarch64_opcode *preferred[max_num_aliases + 1];
   opcode_node head, **next;
   const aarch64_opcode *ent;
   const aarch64_opcode *preferred[max_num_aliases + 1];
   opcode_node head, **next;
@@ -707,7 +707,7 @@ find_alias_opcode (const aarch64_opcode *opcode)
       /* The mask of an alias opcode must be equal to or a super-set (i.e.
         more constrained) of that of the aliased opcode; so is the base
         opcode value.  */
       /* The mask of an alias opcode must be equal to or a super-set (i.e.
         more constrained) of that of the aliased opcode; so is the base
         opcode value.  */
-      if (alias_opcode_p (ent) == TRUE
+      if (alias_opcode_p (ent)
          && (ent->mask & opcode->mask) == opcode->mask
          && (opcode->mask & ent->opcode) == (opcode->mask & opcode->opcode))
        {
          && (ent->mask & opcode->mask) == opcode->mask
          && (opcode->mask & ent->opcode) == (opcode->mask & opcode->opcode))
        {
@@ -984,10 +984,11 @@ print_operand_inserter (void)
     printf ("Enter print_operand_inserter\n");
 
   printf ("\n");
     printf ("Enter print_operand_inserter\n");
 
   printf ("\n");
-  printf ("const char*\n");
+  printf ("bfd_boolean\n");
   printf ("aarch64_insert_operand (const aarch64_operand *self,\n\
                           const aarch64_opnd_info *info,\n\
   printf ("aarch64_insert_operand (const aarch64_operand *self,\n\
                           const aarch64_opnd_info *info,\n\
-                          aarch64_insn *code, const aarch64_inst *inst)\n");
+                          aarch64_insn *code, const aarch64_inst *inst,\n\
+                          aarch64_operand_error *errors)\n");
   printf ("{\n");
   printf ("  /* Use the index as the key.  */\n");
   printf ("  int key = self - aarch64_operands;\n");
   printf ("{\n");
   printf ("  /* Use the index as the key.  */\n");
   printf ("  int key = self - aarch64_operands;\n");
@@ -1017,7 +1018,7 @@ print_operand_inserter (void)
                  opnd2->processed = 1;
                }
            }
                  opnd2->processed = 1;
                }
            }
-         printf ("      return aarch64_%s (self, info, code, inst);\n",
+         printf ("      return aarch64_%s (self, info, code, inst, errors);\n",
                  opnd->inserter);
        }
     }
                  opnd->inserter);
        }
     }
@@ -1040,10 +1041,11 @@ print_operand_extractor (void)
     printf ("Enter print_operand_extractor\n");
 
   printf ("\n");
     printf ("Enter print_operand_extractor\n");
 
   printf ("\n");
-  printf ("int\n");
+  printf ("bfd_boolean\n");
   printf ("aarch64_extract_operand (const aarch64_operand *self,\n\
                           aarch64_opnd_info *info,\n\
   printf ("aarch64_extract_operand (const aarch64_operand *self,\n\
                           aarch64_opnd_info *info,\n\
-                          aarch64_insn code, const aarch64_inst *inst)\n");
+                          aarch64_insn code, const aarch64_inst *inst,\n\
+                          aarch64_operand_error *errors)\n");
   printf ("{\n");
   printf ("  /* Use the index as the key.  */\n");
   printf ("  int key = self - aarch64_operands;\n");
   printf ("{\n");
   printf ("  /* Use the index as the key.  */\n");
   printf ("  int key = self - aarch64_operands;\n");
@@ -1073,7 +1075,7 @@ print_operand_extractor (void)
                  opnd2->processed = 1;
                }
            }
                  opnd2->processed = 1;
                }
            }
-         printf ("      return aarch64_%s (self, info, code, inst);\n",
+         printf ("      return aarch64_%s (self, info, code, inst, errors);\n",
                  opnd->extractor);
        }
     }
                  opnd->extractor);
        }
     }
@@ -1244,7 +1246,7 @@ main (int argc, char **argv)
     print_divide_result (decoder_tree);
 
   printf ("/* This file is automatically generated by aarch64-gen.  Do not edit!  */\n");
     print_divide_result (decoder_tree);
 
   printf ("/* This file is automatically generated by aarch64-gen.  Do not edit!  */\n");
-  printf ("/* Copyright (C) 2012-2015 Free Software Foundation, Inc.\n\
+  printf ("/* Copyright (C) 2012-2020 Free Software Foundation, Inc.\n\
    Contributed by ARM Ltd.\n\
 \n\
    This file is part of the GNU opcodes library.\n\
    Contributed by ARM Ltd.\n\
 \n\
    This file is part of the GNU opcodes library.\n\
This page took 0.031091 seconds and 4 git commands to generate.