Replace xmalloc/xfree with vector in jit.c
[deliverable/binutils-gdb.git] / opcodes / frv-asm.c
index b537c92680d422368126d764dcb4d5cf7d11f64b..159d932710b0b8b444278c3c5e3e3870fe4089a7 100644 (file)
@@ -1,11 +1,11 @@
+/* DO NOT EDIT!  -*- buffer-read-only: t -*- vi:set ro:  */
 /* Assembler interface for targets using CGEN. -*- C -*-
    CGEN: Cpu tools GENerator
 
    THIS FILE IS MACHINE GENERATED WITH CGEN.
    - the resultant file is machine generated, cgen-asm.in isn't
 
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2005, 2007
-   Free Software Foundation, Inc.
+   Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
    This file is part of libopcodes.
 
@@ -100,10 +100,10 @@ parse_ldd_annotation (CGEN_CPU_DESC cd,
            return errmsg;
        }
     }
-  
+
   while (**strp == ' ' || **strp == '\t')
     ++*strp;
-  
+
   if (**strp != '@')
     return "missing `@'";
 
@@ -139,10 +139,10 @@ parse_call_annotation (CGEN_CPU_DESC cd,
            return errmsg;
        }
     }
-  
+
   while (**strp == ' ' || **strp == '\t')
     ++*strp;
-  
+
   if (**strp != '@')
     return "missing `@'";
 
@@ -178,10 +178,10 @@ parse_ld_annotation (CGEN_CPU_DESC cd,
            return errmsg;
        }
     }
-  
+
   while (**strp == ' ' || **strp == '\t')
     ++*strp;
-  
+
   if (**strp != '@')
     return "missing `@'";
 
@@ -199,7 +199,7 @@ parse_ulo16 (CGEN_CPU_DESC cd,
   const char *errmsg;
   enum cgen_parse_operand_result result_type;
   bfd_vma value;
+
   if (**strp == '#' || **strp == '%')
     {
       if (strncasecmp (*strp + 1, "lo(", 3) == 0)
@@ -325,7 +325,7 @@ parse_uslo16 (CGEN_CPU_DESC cd,
   const char *errmsg;
   enum cgen_parse_operand_result result_type;
   bfd_vma value;
+
   if (**strp == '#' || **strp == '%')
     {
       if (strncasecmp (*strp + 1, "lo(", 3) == 0)
@@ -451,7 +451,7 @@ parse_uhi16 (CGEN_CPU_DESC cd,
   const char *errmsg;
   enum cgen_parse_operand_result result_type;
   bfd_vma value;
+
   if (**strp == '#' || **strp == '%')
     {
       if (strncasecmp (*strp + 1, "hi(", 3) == 0)
@@ -465,11 +465,11 @@ parse_uhi16 (CGEN_CPU_DESC cd,
          if (errmsg == NULL
              && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
            {
-             /* If bfd_vma is wider than 32 bits, but we have a sign-
-                or zero-extension, truncate it.  */
-             if (value >= - ((bfd_vma)1 << 31)
-                 || value <= ((bfd_vma)1 << 31) - (bfd_vma)1)
-               value &= (((bfd_vma)1 << 16) << 16) - 1;
+             /* If value is wider than 32 bits then be
+                careful about how we extract bits 16-31.  */
+             if (sizeof (value) > 4)
+               value &= (((bfd_vma)1 << 16) << 16) - 1;
+
              value >>= 16;
            }
          *valuep = value;
@@ -636,7 +636,7 @@ parse_d12 (CGEN_CPU_DESC cd,
   const char *errmsg;
   enum cgen_parse_operand_result result_type;
   bfd_vma value;
+
   /* Check for small data reference.  */
   if (**strp == '#' || **strp == '%')
     {
@@ -749,7 +749,7 @@ parse_s12 (CGEN_CPU_DESC cd,
   const char *errmsg;
   enum cgen_parse_operand_result result_type;
   bfd_vma value;
+
   /* Check for small data reference.  */
   if (**strp == '#' || **strp == '%')
     {
@@ -865,7 +865,7 @@ parse_u12 (CGEN_CPU_DESC cd,
   const char *errmsg;
   enum cgen_parse_operand_result result_type;
   bfd_vma value;
+
   /* Check for small data reference.  */
   if ((**strp == '#' || **strp == '%')
       && strncasecmp (*strp + 1, "gprel12(", 8) == 0)
@@ -896,7 +896,7 @@ parse_A (CGEN_CPU_DESC cd,
         unsigned long A)
 {
   const char *errmsg;
+
   if (**strp == '#')
     ++*strp;
 
@@ -958,7 +958,7 @@ parse_call_label (CGEN_CPU_DESC cd,
 {
   const char *errmsg;
   bfd_vma value;
+
   /* Check for small data reference.  */
   if (opinfo == 0 && (**strp == '#' || **strp == '%'))
     {
@@ -1260,14 +1260,16 @@ frv_cgen_parse_operand (CGEN_CPU_DESC cd,
 
     default :
       /* xgettext:c-format */
-      fprintf (stderr, _("Unrecognized field %d while parsing.\n"), opindex);
+      opcodes_error_handler
+       (_("internal error: unrecognized field %d while parsing"),
+        opindex);
       abort ();
   }
 
   return errmsg;
 }
 
-cgen_parse_fn * const frv_cgen_parse_handlers[] = 
+cgen_parse_fn * const frv_cgen_parse_handlers[] =
 {
   parse_insn_normal,
 };
@@ -1297,9 +1299,9 @@ CGEN_ASM_INIT_HOOK
 
    Returns NULL for success, an error message for failure.  */
 
-char * 
+char *
 frv_cgen_build_insn_regex (CGEN_INSN *insn)
-{  
+{
   CGEN_OPCODE *opc = (CGEN_OPCODE *) CGEN_INSN_OPCODE (insn);
   const char *mnem = CGEN_INSN_MNEMONIC (insn);
   char rxbuf[CGEN_MAX_RX_ELEMENTS];
@@ -1338,18 +1340,18 @@ frv_cgen_build_insn_regex (CGEN_INSN *insn)
   /* Copy any remaining literals from the syntax string into the rx.  */
   for(; * syn != 0 && rx <= rxbuf + (CGEN_MAX_RX_ELEMENTS - 7 - 4); ++syn)
     {
-      if (CGEN_SYNTAX_CHAR_P (* syn)) 
+      if (CGEN_SYNTAX_CHAR_P (* syn))
        {
          char c = CGEN_SYNTAX_CHAR (* syn);
 
-         switch (c) 
+         switch (c)
            {
              /* Escape any regex metacharacters in the syntax.  */
-           case '.': case '[': case '\\': 
-           case '*': case '^': case '$': 
+           case '.': case '[': case '\\':
+           case '*': case '^': case '$':
 
 #ifdef CGEN_ESCAPE_EXTENDED_REGEX
-           case '?': case '{': case '}': 
+           case '?': case '{': case '}':
            case '(': case ')': case '*':
            case '|': case '+': case ']':
 #endif
@@ -1379,20 +1381,20 @@ frv_cgen_build_insn_regex (CGEN_INSN *insn)
     }
 
   /* Trailing whitespace ok.  */
-  * rx++ = '['; 
-  * rx++ = ' '; 
-  * rx++ = '\t'; 
-  * rx++ = ']'; 
-  * rx++ = '*'; 
+  * rx++ = '[';
+  * rx++ = ' ';
+  * rx++ = '\t';
+  * rx++ = ']';
+  * rx++ = '*';
 
   /* But anchor it after that.  */
-  * rx++ = '$'; 
+  * rx++ = '$';
   * rx = '\0';
 
   CGEN_INSN_RX (insn) = xmalloc (sizeof (regex_t));
   reg_err = regcomp ((regex_t *) CGEN_INSN_RX (insn), rxbuf, REG_NOSUB);
 
-  if (reg_err == 0) 
+  if (reg_err == 0)
     return NULL;
   else
     {
@@ -1510,9 +1512,11 @@ parse_insn_normal (CGEN_CPU_DESC cd,
          continue;
        }
 
+#ifdef CGEN_MNEMONIC_OPERANDS
+      (void) past_opcode_p;
+#endif
       /* We have an operand of some sort.  */
-      errmsg = cd->parse_operand (cd, CGEN_SYNTAX_FIELD (*syn),
-                                         &str, fields);
+      errmsg = cd->parse_operand (cd, CGEN_SYNTAX_FIELD (*syn), &str, fields);
       if (errmsg)
        return errmsg;
 
@@ -1589,7 +1593,7 @@ frv_cgen_assemble_insn (CGEN_CPU_DESC cd,
       const CGEN_INSN *insn = ilist->insn;
       recognized_mnemonic = 1;
 
-#ifdef CGEN_VALIDATE_INSN_SUPPORTED 
+#ifdef CGEN_VALIDATE_INSN_SUPPORTED
       /* Not usually needed as unsupported opcodes
         shouldn't be in the hash lists.  */
       /* Is this insn supported by the selected cpu?  */
@@ -1629,32 +1633,40 @@ frv_cgen_assemble_insn (CGEN_CPU_DESC cd,
 
   {
     static char errbuf[150];
-#ifdef CGEN_VERBOSE_ASSEMBLER_ERRORS
     const char *tmp_errmsg;
-
-    /* If requesting verbose error messages, use insert_errmsg.
-       Failing that, use parse_errmsg.  */
-    tmp_errmsg = (insert_errmsg ? insert_errmsg :
-                 parse_errmsg ? parse_errmsg :
-                 recognized_mnemonic ?
-                 _("unrecognized form of instruction") :
-                 _("unrecognized instruction"));
-
-    if (strlen (start) > 50)
-      /* xgettext:c-format */
-      sprintf (errbuf, "%s `%.50s...'", tmp_errmsg, start);
-    else 
-      /* xgettext:c-format */
-      sprintf (errbuf, "%s `%.50s'", tmp_errmsg, start);
+#ifdef CGEN_VERBOSE_ASSEMBLER_ERRORS
+#define be_verbose 1
 #else
-    if (strlen (start) > 50)
-      /* xgettext:c-format */
-      sprintf (errbuf, _("bad instruction `%.50s...'"), start);
-    else 
-      /* xgettext:c-format */
-      sprintf (errbuf, _("bad instruction `%.50s'"), start);
+#define be_verbose 0
 #endif
-      
+
+    if (be_verbose)
+      {
+       /* If requesting verbose error messages, use insert_errmsg.
+          Failing that, use parse_errmsg.  */
+       tmp_errmsg = (insert_errmsg ? insert_errmsg :
+                     parse_errmsg ? parse_errmsg :
+                     recognized_mnemonic ?
+                     _("unrecognized form of instruction") :
+                     _("unrecognized instruction"));
+
+       if (strlen (start) > 50)
+         /* xgettext:c-format */
+         sprintf (errbuf, "%s `%.50s...'", tmp_errmsg, start);
+       else
+         /* xgettext:c-format */
+         sprintf (errbuf, "%s `%.50s'", tmp_errmsg, start);
+      }
+    else
+      {
+       if (strlen (start) > 50)
+         /* xgettext:c-format */
+         sprintf (errbuf, _("bad instruction `%.50s...'"), start);
+       else
+         /* xgettext:c-format */
+         sprintf (errbuf, _("bad instruction `%.50s'"), start);
+      }
+
     *errmsg = errbuf;
     return NULL;
   }
This page took 0.027106 seconds and 4 git commands to generate.