* cgen-asm.c (cgen_asm_parse_operand_fn): New global.
authorDavid Edelsohn <dje.gcc@gmail.com>
Thu, 10 Apr 1997 21:58:28 +0000 (21:58 +0000)
committerDavid Edelsohn <dje.gcc@gmail.com>
Thu, 10 Apr 1997 21:58:28 +0000 (21:58 +0000)
(cgen_parse_{{,un}signed_integer,address}): Update call to
cgen_asm_parse_operand_fn.
* m32r-asm.c (parse_insn_normal): Delete call to cgen_asm_init_parse.
(m32r_cgen_assemble_insn): New operand `errmsg'.
Delete call to as_bad, return error message to caller.
(m32r_cgen_asm_hash_keywords): #if 0 out.

opcodes/ChangeLog
opcodes/cgen-asm.c
opcodes/m32r-asm.c

index 2575bae235811ca9757b98f44063418c33b03f9b..e9357fe6f92f2997bd6eb537135c39ebe715b9e3 100644 (file)
@@ -1,3 +1,13 @@
+Thu Apr 10 14:44:56 1997  Doug Evans  <dje@canuck.cygnus.com>
+
+       * cgen-asm.c (cgen_asm_parse_operand_fn): New global.
+       (cgen_parse_{{,un}signed_integer,address}): Update call to
+       cgen_asm_parse_operand_fn.
+       * m32r-asm.c (parse_insn_normal): Delete call to cgen_asm_init_parse.
+       (m32r_cgen_assemble_insn): New operand `errmsg'.
+       Delete call to as_bad, return error message to caller.
+       (m32r_cgen_asm_hash_keywords): #if 0 out.
+
 Wed Apr  9 12:05:25 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
 
        * m68k-dis.c (print_insn_arg) [case 'd']: Print as address register,
index bbc45dac024b275d2896df5005921754fd3d00bc..14c830ad6566acc417091b12bd59c231c4c7a405 100644 (file)
@@ -31,6 +31,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "bfd.h"
 #include "opcode/cgen.h"
 
+/* Operand parsing callback.  */
+const char * (*cgen_asm_parse_operand_fn)
+     PARAMS ((const char **, int, int, enum cgen_asm_result *, bfd_vma *));
+
 /* This is not published as part of the public interface so we don't
    declare this in cgen.h.  */
 extern CGEN_OPCODE_DATA *cgen_current_opcode_data;
@@ -176,8 +180,8 @@ cgen_parse_signed_integer (strp, opindex, min, max, valuep)
   enum cgen_asm_result result;
   const char *errmsg;
 
-  errmsg = cgen_asm_parse_operand (strp, opindex, BFD_RELOC_NONE,
-                                  &result, &value);
+  errmsg = (*cgen_asm_parse_operand_fn) (strp, opindex, BFD_RELOC_NONE,
+                                        &result, &value);
   /* FIXME: Examine `result'.  */
   if (!errmsg)
     {
@@ -201,8 +205,8 @@ cgen_parse_unsigned_integer (strp, opindex, min, max, valuep)
   enum cgen_asm_result result;
   const char *errmsg;
 
-  errmsg = cgen_asm_parse_operand (strp, opindex, BFD_RELOC_NONE,
-                                  &result, &value);
+  errmsg = (*cgen_asm_parse_operand_fn) (strp, opindex, BFD_RELOC_NONE,
+                                        &result, &value);
   /* FIXME: Examine `result'.  */
   if (!errmsg)
     {
@@ -226,7 +230,8 @@ cgen_parse_address (strp, opindex, opinfo, valuep)
   enum cgen_asm_result result;
   const char *errmsg;
 
-  errmsg = cgen_asm_parse_operand (strp, opindex, opinfo, &result, &value);
+  errmsg = (*cgen_asm_parse_operand_fn) (strp, opindex, opinfo,
+                                        &result, &value);
   /* FIXME: Examine `result'.  */
   if (!errmsg)
     {
index 068b30f35203ab26b4eee5178df7cd99fa7e144a..824366c716541ee6b6197bc731a4ce37e94a7513 100644 (file)
@@ -551,7 +551,6 @@ parse_insn_normal (insn, strp, fields)
 #endif
 
   CGEN_INIT_PARSE ();
-  cgen_asm_init_parse ();
 #ifdef CGEN_MNEMONIC_OPERANDS
   past_opcode_p = 0;
 #endif
@@ -678,10 +677,11 @@ insert_insn_normal (insn, fields, buffer)
    printed).  */
 
 const struct cgen_insn *
-m32r_cgen_assemble_insn (str, fields, buf)
+m32r_cgen_assemble_insn (str, fields, buf, errmsg)
      const char *str;
      struct cgen_fields *fields;
      cgen_insn_t *buf;
+     char **errmsg;
 {
   const char *start;
   CGEN_INSN_LIST *ilist;
@@ -740,13 +740,22 @@ m32r_cgen_assemble_insn (str, fields, buf)
       /* Try the next entry.  */
     }
 
-  /* FIXME: Define this as a callback, or pass back string? */
-  as_bad ("bad instruction `%s'", start);
-  return NULL;
+  /* FIXME: We can return a better error message than this.
+     Need to track why it failed and pick the right one.  */
+  {
+    static char errbuf[100];
+    sprintf (errbuf, "bad instruction `%.50s%s'",
+            start, strlen (start) > 50 ? "..." : "");
+    *errmsg = errbuf;
+    return NULL;
+  }
 }
 \f
+#if 0 /* This calls back to GAS which we can't do without care.  */
+
 /* Record each member of OPVALS in the assembler's symbol table.
-   FIXME: Not currently used.  */
+   This lets GAS parse registers for us.
+   ??? Interesting idea but not currently used.  */
 
 void
 m32r_cgen_asm_hash_keywords (opvals)
@@ -764,3 +773,5 @@ m32r_cgen_asm_hash_keywords (opvals)
       cgen_asm_record_register (ke->name, ke->value);
     }
 }
+
+#endif /* 0 */
This page took 0.032855 seconds and 4 git commands to generate.