daily update
[deliverable/binutils-gdb.git] / opcodes / mep-asm.c
index 4f92cbdcd61a373b211eec4ce521a2ca4dd178e2..2fc3087215ce43b7415171817d4e0aad2ded96c0 100644 (file)
@@ -4,7 +4,7 @@
    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, 2008
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2005, 2007, 2008, 2010
    Free Software Foundation, Inc.
 
    This file is part of libopcodes.
@@ -54,6 +54,7 @@ static const char * parse_insn_normal
 #include "elf/mep.h"
 
 #define CGEN_VALIDATE_INSN_SUPPORTED
+#define mep_cgen_insn_supported mep_cgen_insn_supported_asm
 
        const char * parse_csrn       (CGEN_CPU_DESC, const char **, CGEN_KEYWORD *, long *);
        const char * parse_tpreg      (CGEN_CPU_DESC, const char **, CGEN_KEYWORD *, long *);
@@ -61,7 +62,9 @@ static const char * parse_insn_normal
        const char * parse_mep_align  (CGEN_CPU_DESC, const char **, enum cgen_operand_type, long *);
        const char * parse_mep_alignu (CGEN_CPU_DESC, const char **, enum cgen_operand_type, unsigned long *);
 static const char * parse_signed16   (CGEN_CPU_DESC, const char **, int, long *);
+static const char * parse_signed16_range   (CGEN_CPU_DESC, const char **, int, long *) ATTRIBUTE_UNUSED;
 static const char * parse_unsigned16 (CGEN_CPU_DESC, const char **, int, unsigned long *);
+static const char * parse_unsigned16_range (CGEN_CPU_DESC, const char **, int, unsigned long *) ATTRIBUTE_UNUSED;
 static const char * parse_lo16       (CGEN_CPU_DESC, const char **, int, long *, long);
 static const char * parse_unsigned7  (CGEN_CPU_DESC, const char **, enum cgen_operand_type, unsigned long *);
 static const char * parse_zero       (CGEN_CPU_DESC, const char **, int, long *);
@@ -316,6 +319,46 @@ parse_unsigned16 (CGEN_CPU_DESC cd,
   return parse_lo16 (cd, strp, opindex, (long *) valuep, 0);
 }
 
+static const char *
+parse_signed16_range (CGEN_CPU_DESC cd,
+                     const char **strp,
+                     int opindex,
+                     signed long *valuep)
+{
+  const char *errmsg = 0;
+  signed long value;
+
+  errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value);
+  if (errmsg)
+    return errmsg;
+
+  if (value < -32768 || value > 32767)
+    return _("Immediate is out of range -32768 to 32767");
+
+  *valuep = value;
+  return 0;
+}
+
+static const char *
+parse_unsigned16_range (CGEN_CPU_DESC cd,
+                       const char **strp,
+                       int opindex,
+                       unsigned long *valuep)
+{
+  const char *errmsg = 0;
+  unsigned long value;
+
+  errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
+  if (errmsg)
+    return errmsg;
+
+  if (value > 65535)
+    return _("Immediate is out of range 0 to 65535");
+
+  *valuep = value;
+  return 0;
+}
+
 /* A special case of parse_signed16 which accepts only the value zero.  */
 
 static const char *
@@ -590,7 +633,7 @@ expand_macro (arg *args, int narg, macro *mac)
   char *result = 0, *rescanned_result = 0;
   char *e = mac->expansion;
   char *mark = e;
-  int arg = 0;
+  int mac_arg = 0;
 
   /*  printf("expanding macro %s with %d args\n", mac->name, narg + 1); */
   while (*e)
@@ -601,9 +644,9 @@ expand_macro (arg *args, int narg, macro *mac)
          ((*(e + 1) - '1') <= narg))
        {
          result = str_append (result, mark, e - mark);
-         arg = (*(e + 1) - '1');
-         /* printf("replacing `%d with %s\n", arg+1, args[arg].start); */
-         result = str_append (result, args[arg].start, args[arg].len);
+         mac_arg = (*(e + 1) - '1');
+         /* printf("replacing `%d with %s\n", mac_arg+1, args[mac_arg].start); */
+         result = str_append (result, args[mac_arg].start, args[mac_arg].len);
          ++e;
          mark = e+1;
        }
@@ -635,8 +678,7 @@ expand_string (const char *in, int first_only)
   arg args[MAXARGS];
   int state = IN_TEXT;
   const char *mark = in;
-  macro *macro = 0;
-
+  macro *pmacro = NULL;
   char *expansion = 0;
   char *result = 0;
 
@@ -647,18 +689,18 @@ expand_string (const char *in, int first_only)
        case IN_TEXT:
          if (*in == '%' && *(in + 1) && (!first_only || num_expansions == 0)) 
            {         
-             macro = lookup_macro (in + 1);
-             if (macro)
+             pmacro = lookup_macro (in + 1);
+             if (pmacro)
                {
                  /* printf("entering state %d at '%s'...\n", state, in); */
                  result = str_append (result, mark, in - mark);
                  mark = in;
-                 in += 1 + strlen (macro->name);
+                 in += 1 + strlen (pmacro->name);
                  while (*in == ' ') ++in;
                  if (*in != '(')
                    {
                      state = IN_TEXT;                
-                     macro = 0;
+                     pmacro = NULL;
                    }
                  else
                    {
@@ -684,10 +726,10 @@ expand_string (const char *in, int first_only)
                case ')':
                  state = IN_TEXT;
                  /* printf("entering state %d at '%s'...\n", state, in); */
-                 if (macro)
+                 if (pmacro)
                    {
                      expansion = 0;
-                     expansion = expand_macro (args, narg, macro);
+                     expansion = expand_macro (args, narg, pmacro);
                      num_expansions++;
                      if (expansion)
                        {
@@ -699,7 +741,7 @@ expand_string (const char *in, int first_only)
                    {
                      result = str_append (result, mark, in - mark);
                    }
-                 macro = 0;
+                 pmacro = NULL;
                  mark = in + 1;
                  break;
                case '(':
@@ -906,7 +948,7 @@ mep_cgen_parse_operand (CGEN_CPU_DESC cd,
       errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_csr, & junk);
       break;
     case MEP_OPERAND_IMM16P0 :
-      errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM16P0, (unsigned long *) (& fields->f_ivc2_imm16p0));
+      errmsg = parse_unsigned16_range (cd, strp, MEP_OPERAND_IMM16P0, (unsigned long *) (& fields->f_ivc2_imm16p0));
       break;
     case MEP_OPERAND_IMM3P12 :
       errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM3P12, (unsigned long *) (& fields->f_ivc2_3u12));
@@ -980,8 +1022,80 @@ mep_cgen_parse_operand (CGEN_CPU_DESC cd,
     case MEP_OPERAND_IVC_X_6_3 :
       errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IVC_X_6_3, (unsigned long *) (& fields->f_ivc2_3u6));
       break;
+    case MEP_OPERAND_IVC2_ACC0_0 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_ACC0_1 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_ACC0_2 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_ACC0_3 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_ACC0_4 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_ACC0_5 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_ACC0_6 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_ACC0_7 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_ACC1_0 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_ACC1_1 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_ACC1_2 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_ACC1_3 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_ACC1_4 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_ACC1_5 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_ACC1_6 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_ACC1_7 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_CC :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_COFA0 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_COFA1 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_COFR0 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_COFR1 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_CSAR0 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2_CSAR1 :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & junk);
+      break;
+    case MEP_OPERAND_IVC2C3CCRN :
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & fields->f_ivc2_ccrn_c3);
+      break;
     case MEP_OPERAND_IVC2CCRN :
-      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr, & fields->f_ivc2_ccrn);
+      errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, & fields->f_ivc2_ccrn);
       break;
     case MEP_OPERAND_IVC2CRN :
       errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_cr64, & fields->f_ivc2_crnx);
@@ -1101,7 +1215,7 @@ mep_cgen_parse_operand (CGEN_CPU_DESC cd,
       errmsg = parse_signed16 (cd, strp, MEP_OPERAND_SIMM16, (long *) (& fields->f_16s16));
       break;
     case MEP_OPERAND_SIMM16P0 :
-      errmsg = cgen_parse_signed_integer (cd, strp, MEP_OPERAND_SIMM16P0, (long *) (& fields->f_ivc2_simm16p0));
+      errmsg = parse_signed16_range (cd, strp, MEP_OPERAND_SIMM16P0, (long *) (& fields->f_ivc2_simm16p0));
       break;
     case MEP_OPERAND_SIMM6 :
       errmsg = cgen_parse_signed_integer (cd, strp, MEP_OPERAND_SIMM6, (long *) (& fields->f_6s8));
@@ -1112,6 +1226,9 @@ mep_cgen_parse_operand (CGEN_CPU_DESC cd,
     case MEP_OPERAND_SIMM8P0 :
       errmsg = cgen_parse_signed_integer (cd, strp, MEP_OPERAND_SIMM8P0, (long *) (& fields->f_ivc2_8s0));
       break;
+    case MEP_OPERAND_SIMM8P20 :
+      errmsg = cgen_parse_signed_integer (cd, strp, MEP_OPERAND_SIMM8P20, (long *) (& fields->f_ivc2_8s20));
+      break;
     case MEP_OPERAND_SIMM8P4 :
       errmsg = cgen_parse_signed_integer (cd, strp, MEP_OPERAND_SIMM8P4, (long *) (& fields->f_ivc2_8s4));
       break;
@@ -1416,9 +1533,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;
 
@@ -1535,31 +1654,39 @@ mep_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.057383 seconds and 4 git commands to generate.