- return "unrecognized instruction";
-}
-
-/* Default insn builder (insert handler).
- The instruction is recorded in target byte order.
- The result is an error message or NULL if success. */
-/* FIXME: change buffer to char *? */
-
-static const char *
-insert_insn_normal (insn, fields, buffer, pc)
- const CGEN_INSN * insn;
- CGEN_FIELDS * fields;
- cgen_insn_t * buffer;
- bfd_vma pc;
-{
- const CGEN_SYNTAX * syntax = CGEN_INSN_SYNTAX (insn);
- bfd_vma value;
- const unsigned char * syn;
-
- CGEN_INIT_INSERT ();
- value = CGEN_INSN_VALUE (insn);
-
- /* If we're recording insns as numbers (rather than a string of bytes),
- target byte order handling is deferred until later. */
-#undef min
-#define min(a,b) ((a) < (b) ? (a) : (b))
-#if 0 /*def CGEN_INT_INSN*/
- *buffer = value;
-#else
- switch (min (CGEN_BASE_INSN_BITSIZE, CGEN_FIELDS_BITSIZE (fields)))
- {
- case 8:
- * buffer = value;
- break;
- case 16:
- if (CGEN_CURRENT_ENDIAN == CGEN_ENDIAN_BIG)
- bfd_putb16 (value, (char *) buffer);
- else
- bfd_putl16 (value, (char *) buffer);
- break;
- case 32:
- if (CGEN_CURRENT_ENDIAN == CGEN_ENDIAN_BIG)
- bfd_putb32 (value, (char *) buffer);
- else
- bfd_putl32 (value, (char *) buffer);
- break;
- default:
- abort ();
- }
-#endif
-
- /* ??? Rather than scanning the syntax string again, we could store
- in `fields' a null terminated list of the fields that are present. */
-
- for (syn = CGEN_SYNTAX_STRING (syntax); * syn != '\0'; ++ syn)
- {
- const char *errmsg;
-
- if (CGEN_SYNTAX_CHAR_P (* syn))
- continue;
-
- errmsg = @arch@_cgen_insert_operand (CGEN_SYNTAX_FIELD (*syn), fields,
- (char *) buffer, pc);
- if (errmsg)
- return errmsg;
- }
-
- return NULL;