1 /* Assembler interface for targets using CGEN. -*- C -*-
2 CGEN: Cpu tools GENerator
4 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 - the resultant file is machine generated, cgen-asm.in isn't
7 Copyright (C) 1996-2015 Free Software Foundation, Inc.
9 This file is part of libopcodes.
11 This library is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3, or (at your option)
16 It is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19 License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
26 /* ??? Eventually more and more of this stuff can go to cpu-independent files.
34 #include "epiphany-desc.h"
35 #include "epiphany-opc.h"
38 #include "libiberty.h"
39 #include "safe-ctype.h"
42 #define min(a,b) ((a) < (b) ? (a) : (b))
44 #define max(a,b) ((a) > (b) ? (a) : (b))
46 static const char * parse_insn_normal
47 (CGEN_CPU_DESC, const CGEN_INSN *, const char **, CGEN_FIELDS *);
49 /* -- assembler routines inserted here. */
53 parse_shortregs (CGEN_CPU_DESC cd,
55 CGEN_KEYWORD * keywords,
61 errmsg = cgen_parse_keyword (cd, strp, keywords, regno);
67 errmsg = _("register unavailable for short instructions");
72 static const char * parse_simm_not_reg (CGEN_CPU_DESC, const char **, int,
76 parse_uimm_not_reg (CGEN_CPU_DESC cd,
79 unsigned long * valuep)
81 long * svalp = (void *) valuep;
82 return parse_simm_not_reg (cd, strp, opindex, svalp);
85 /* Handle simm3/simm11/imm3/imm12. */
88 parse_simm_not_reg (CGEN_CPU_DESC cd,
100 case EPIPHANY_OPERAND_SIMM3:
101 sign = 1; bits = 3; break;
102 case EPIPHANY_OPERAND_SIMM11:
103 sign = 1; bits = 11; break;
104 case EPIPHANY_OPERAND_DISP3:
105 sign = 0; bits = 3; break;
106 case EPIPHANY_OPERAND_DISP11:
107 /* Load/store displacement is a sign-magnitude 12 bit value. */
108 sign = 0; bits = 11; break;
111 /* First try to parse as a register name and reject the operand. */
112 errmsg = cgen_parse_keyword (cd, strp, & epiphany_cgen_opval_gr_names,valuep);
114 return _("register name used as immediate value");
116 errmsg = (sign ? cgen_parse_signed_integer (cd, strp, opindex, valuep)
117 : cgen_parse_unsigned_integer (cd, strp, opindex,
118 (unsigned long *) valuep));
123 errmsg = cgen_validate_signed_integer (*valuep,
124 -((1L << bits) - 1), (1 << (bits - 1)) - 1);
126 errmsg = cgen_validate_unsigned_integer (*valuep, 0, (1L << bits) - 1);
132 parse_postindex (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
134 int opindex ATTRIBUTE_UNUSED,
135 unsigned long *valuep)
138 ++*strp; /* Skip leading hashes. */
145 else if (**strp == '+')
157 parse_imm8 (CGEN_CPU_DESC cd,
160 bfd_reloc_code_real_type code,
161 enum cgen_parse_operand_result * result_type,
165 enum cgen_parse_operand_result rt;
171 code = BFD_RELOC_NONE;
173 if (!cgen_parse_keyword (cd, strp, &epiphany_cgen_opval_gr_names, &dummyval)
174 || !cgen_parse_keyword (cd, strp, &epiphany_cgen_opval_cr_names,
176 /* Don't treat "mov ip,ip" as a move-immediate. */
177 return _("register source in immediate move");
179 errmsg = cgen_parse_address (cd, strp, opindex, code, result_type, valuep);
183 if (*result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
184 errmsg = cgen_validate_unsigned_integer (*valuep, 0, 0xff);
186 errmsg = _("byte relocation unsupported");
192 static const char * MISSING_CLOSE_PARENTHESIS = N_("missing `)'");
195 parse_imm16 (CGEN_CPU_DESC cd,
198 bfd_reloc_code_real_type code ATTRIBUTE_UNUSED,
199 enum cgen_parse_operand_result * result_type,
203 enum cgen_parse_operand_result rt;
209 if (strncasecmp (*strp, "%high(", 6) == 0)
212 errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_EPIPHANY_HIGH,
213 result_type, valuep);
215 return MISSING_CLOSE_PARENTHESIS;
219 else if (strncasecmp (*strp, "%low(", 5) == 0)
222 errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_EPIPHANY_LOW,
223 result_type, valuep);
225 return MISSING_CLOSE_PARENTHESIS;
228 else if (!cgen_parse_keyword (cd, strp, &epiphany_cgen_opval_gr_names,
230 || !cgen_parse_keyword (cd, strp, &epiphany_cgen_opval_cr_names,
232 /* Don't treat "mov ip,ip" as a move-immediate. */
233 return _("register source in immediate move");
235 errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_16,
236 result_type, valuep);
238 if (!errmsg && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
239 errmsg = cgen_validate_unsigned_integer (*valuep, 0, 0xffff);
246 parse_branch_addr (CGEN_CPU_DESC cd,
249 int opinfo ATTRIBUTE_UNUSED,
250 enum cgen_parse_operand_result * resultp ATTRIBUTE_UNUSED,
251 bfd_vma *valuep ATTRIBUTE_UNUSED)
254 enum cgen_parse_operand_result result_type;
255 bfd_reloc_code_real_type code = BFD_RELOC_NONE;
260 case EPIPHANY_OPERAND_SIMM24:
261 code = BFD_RELOC_EPIPHANY_SIMM24;
264 case EPIPHANY_OPERAND_SIMM8:
265 code = BFD_RELOC_EPIPHANY_SIMM8;
269 errmsg = _("ABORT: unknown operand");
273 errmsg = cgen_parse_address (cd, strp, opindex, code,
274 &result_type, &value);
277 if (result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
279 /* Act as if we had done a PC-relative branch, ala .+num. */
281 const char * bufp = (const char *) buf;
283 sprintf (buf, ".+%ld", (long) value);
284 errmsg = cgen_parse_address (cd, &bufp, opindex, code, &result_type,
288 if (result_type == CGEN_PARSE_OPERAND_RESULT_QUEUED)
290 /* This will happen for things like (s2-s1) where s2 and s1
292 /* Nothing further to be done. */
295 errmsg = _("Not a pc-relative address.");
302 const char * epiphany_cgen_parse_operand
303 (CGEN_CPU_DESC, int, const char **, CGEN_FIELDS *);
305 /* Main entry point for operand parsing.
307 This function is basically just a big switch statement. Earlier versions
308 used tables to look up the function to use, but
309 - if the table contains both assembler and disassembler functions then
310 the disassembler contains much of the assembler and vice-versa,
311 - there's a lot of inlining possibilities as things grow,
312 - using a switch statement avoids the function call overhead.
314 This function could be moved into `parse_insn_normal', but keeping it
315 separate makes clear the interface between `parse_insn_normal' and each of
319 epiphany_cgen_parse_operand (CGEN_CPU_DESC cd,
322 CGEN_FIELDS * fields)
324 const char * errmsg = NULL;
325 /* Used by scalar operands that still need to be parsed. */
326 long junk ATTRIBUTE_UNUSED;
330 case EPIPHANY_OPERAND_DIRECTION :
331 errmsg = parse_postindex (cd, strp, EPIPHANY_OPERAND_DIRECTION, (unsigned long *) (& fields->f_addsubx));
333 case EPIPHANY_OPERAND_DISP11 :
334 errmsg = parse_uimm_not_reg (cd, strp, EPIPHANY_OPERAND_DISP11, (unsigned long *) (& fields->f_disp11));
336 case EPIPHANY_OPERAND_DISP3 :
337 errmsg = cgen_parse_unsigned_integer (cd, strp, EPIPHANY_OPERAND_DISP3, (unsigned long *) (& fields->f_disp3));
339 case EPIPHANY_OPERAND_DPMI :
340 errmsg = parse_postindex (cd, strp, EPIPHANY_OPERAND_DPMI, (unsigned long *) (& fields->f_subd));
342 case EPIPHANY_OPERAND_FRD :
343 errmsg = parse_shortregs (cd, strp, & epiphany_cgen_opval_gr_names, & fields->f_rd);
345 case EPIPHANY_OPERAND_FRD6 :
346 errmsg = cgen_parse_keyword (cd, strp, & epiphany_cgen_opval_gr_names, & fields->f_rd6);
348 case EPIPHANY_OPERAND_FRM :
349 errmsg = parse_shortregs (cd, strp, & epiphany_cgen_opval_gr_names, & fields->f_rm);
351 case EPIPHANY_OPERAND_FRM6 :
352 errmsg = cgen_parse_keyword (cd, strp, & epiphany_cgen_opval_gr_names, & fields->f_rm6);
354 case EPIPHANY_OPERAND_FRN :
355 errmsg = parse_shortregs (cd, strp, & epiphany_cgen_opval_gr_names, & fields->f_rn);
357 case EPIPHANY_OPERAND_FRN6 :
358 errmsg = cgen_parse_keyword (cd, strp, & epiphany_cgen_opval_gr_names, & fields->f_rn6);
360 case EPIPHANY_OPERAND_IMM16 :
363 errmsg = parse_imm16 (cd, strp, EPIPHANY_OPERAND_IMM16, 0, NULL, & value);
364 fields->f_imm16 = value;
367 case EPIPHANY_OPERAND_IMM8 :
370 errmsg = parse_imm8 (cd, strp, EPIPHANY_OPERAND_IMM8, 0, NULL, & value);
371 fields->f_imm8 = value;
374 case EPIPHANY_OPERAND_RD :
375 errmsg = parse_shortregs (cd, strp, & epiphany_cgen_opval_gr_names, & fields->f_rd);
377 case EPIPHANY_OPERAND_RD6 :
378 errmsg = cgen_parse_keyword (cd, strp, & epiphany_cgen_opval_gr_names, & fields->f_rd6);
380 case EPIPHANY_OPERAND_RM :
381 errmsg = parse_shortregs (cd, strp, & epiphany_cgen_opval_gr_names, & fields->f_rm);
383 case EPIPHANY_OPERAND_RM6 :
384 errmsg = cgen_parse_keyword (cd, strp, & epiphany_cgen_opval_gr_names, & fields->f_rm6);
386 case EPIPHANY_OPERAND_RN :
387 errmsg = parse_shortregs (cd, strp, & epiphany_cgen_opval_gr_names, & fields->f_rn);
389 case EPIPHANY_OPERAND_RN6 :
390 errmsg = cgen_parse_keyword (cd, strp, & epiphany_cgen_opval_gr_names, & fields->f_rn6);
392 case EPIPHANY_OPERAND_SD :
393 errmsg = parse_shortregs (cd, strp, & epiphany_cgen_opval_cr_names, & fields->f_sd);
395 case EPIPHANY_OPERAND_SD6 :
396 errmsg = cgen_parse_keyword (cd, strp, & epiphany_cgen_opval_cr_names, & fields->f_sd6);
398 case EPIPHANY_OPERAND_SDDMA :
399 errmsg = cgen_parse_keyword (cd, strp, & epiphany_cgen_opval_crdma_names, & fields->f_sd6);
401 case EPIPHANY_OPERAND_SDMEM :
402 errmsg = cgen_parse_keyword (cd, strp, & epiphany_cgen_opval_crmem_names, & fields->f_sd6);
404 case EPIPHANY_OPERAND_SDMESH :
405 errmsg = cgen_parse_keyword (cd, strp, & epiphany_cgen_opval_crmesh_names, & fields->f_sd6);
407 case EPIPHANY_OPERAND_SHIFT :
408 errmsg = cgen_parse_unsigned_integer (cd, strp, EPIPHANY_OPERAND_SHIFT, (unsigned long *) (& fields->f_shift));
410 case EPIPHANY_OPERAND_SIMM11 :
411 errmsg = parse_simm_not_reg (cd, strp, EPIPHANY_OPERAND_SIMM11, (long *) (& fields->f_sdisp11));
413 case EPIPHANY_OPERAND_SIMM24 :
416 errmsg = parse_branch_addr (cd, strp, EPIPHANY_OPERAND_SIMM24, 0, NULL, & value);
417 fields->f_simm24 = value;
420 case EPIPHANY_OPERAND_SIMM3 :
421 errmsg = parse_simm_not_reg (cd, strp, EPIPHANY_OPERAND_SIMM3, (long *) (& fields->f_sdisp3));
423 case EPIPHANY_OPERAND_SIMM8 :
426 errmsg = parse_branch_addr (cd, strp, EPIPHANY_OPERAND_SIMM8, 0, NULL, & value);
427 fields->f_simm8 = value;
430 case EPIPHANY_OPERAND_SN :
431 errmsg = parse_shortregs (cd, strp, & epiphany_cgen_opval_cr_names, & fields->f_sn);
433 case EPIPHANY_OPERAND_SN6 :
434 errmsg = cgen_parse_keyword (cd, strp, & epiphany_cgen_opval_cr_names, & fields->f_sn6);
436 case EPIPHANY_OPERAND_SNDMA :
437 errmsg = cgen_parse_keyword (cd, strp, & epiphany_cgen_opval_crdma_names, & fields->f_sn6);
439 case EPIPHANY_OPERAND_SNMEM :
440 errmsg = cgen_parse_keyword (cd, strp, & epiphany_cgen_opval_crmem_names, & fields->f_sn6);
442 case EPIPHANY_OPERAND_SNMESH :
443 errmsg = cgen_parse_keyword (cd, strp, & epiphany_cgen_opval_crmesh_names, & fields->f_sn6);
445 case EPIPHANY_OPERAND_SWI_NUM :
446 errmsg = parse_uimm_not_reg (cd, strp, EPIPHANY_OPERAND_SWI_NUM, (unsigned long *) (& fields->f_trap_num));
448 case EPIPHANY_OPERAND_TRAPNUM6 :
449 errmsg = cgen_parse_unsigned_integer (cd, strp, EPIPHANY_OPERAND_TRAPNUM6, (unsigned long *) (& fields->f_trap_num));
453 /* xgettext:c-format */
454 fprintf (stderr, _("Unrecognized field %d while parsing.\n"), opindex);
461 cgen_parse_fn * const epiphany_cgen_parse_handlers[] =
467 epiphany_cgen_init_asm (CGEN_CPU_DESC cd)
469 epiphany_cgen_init_opcode_table (cd);
470 epiphany_cgen_init_ibld_table (cd);
471 cd->parse_handlers = & epiphany_cgen_parse_handlers[0];
472 cd->parse_operand = epiphany_cgen_parse_operand;
473 #ifdef CGEN_ASM_INIT_HOOK
480 /* Regex construction routine.
482 This translates an opcode syntax string into a regex string,
483 by replacing any non-character syntax element (such as an
484 opcode) with the pattern '.*'
486 It then compiles the regex and stores it in the opcode, for
487 later use by epiphany_cgen_assemble_insn
489 Returns NULL for success, an error message for failure. */
492 epiphany_cgen_build_insn_regex (CGEN_INSN *insn)
494 CGEN_OPCODE *opc = (CGEN_OPCODE *) CGEN_INSN_OPCODE (insn);
495 const char *mnem = CGEN_INSN_MNEMONIC (insn);
496 char rxbuf[CGEN_MAX_RX_ELEMENTS];
498 const CGEN_SYNTAX_CHAR_TYPE *syn;
501 syn = CGEN_SYNTAX_STRING (CGEN_OPCODE_SYNTAX (opc));
503 /* Mnemonics come first in the syntax string. */
504 if (! CGEN_SYNTAX_MNEMONIC_P (* syn))
505 return _("missing mnemonic in syntax string");
508 /* Generate a case sensitive regular expression that emulates case
509 insensitive matching in the "C" locale. We cannot generate a case
510 insensitive regular expression because in Turkish locales, 'i' and 'I'
511 are not equal modulo case conversion. */
513 /* Copy the literal mnemonic out of the insn. */
514 for (; *mnem; mnem++)
529 /* Copy any remaining literals from the syntax string into the rx. */
530 for(; * syn != 0 && rx <= rxbuf + (CGEN_MAX_RX_ELEMENTS - 7 - 4); ++syn)
532 if (CGEN_SYNTAX_CHAR_P (* syn))
534 char c = CGEN_SYNTAX_CHAR (* syn);
538 /* Escape any regex metacharacters in the syntax. */
539 case '.': case '[': case '\\':
540 case '*': case '^': case '$':
542 #ifdef CGEN_ESCAPE_EXTENDED_REGEX
543 case '?': case '{': case '}':
544 case '(': case ')': case '*':
545 case '|': case '+': case ']':
566 /* Replace non-syntax fields with globs. */
572 /* Trailing whitespace ok. */
579 /* But anchor it after that. */
583 CGEN_INSN_RX (insn) = xmalloc (sizeof (regex_t));
584 reg_err = regcomp ((regex_t *) CGEN_INSN_RX (insn), rxbuf, REG_NOSUB);
592 regerror (reg_err, (regex_t *) CGEN_INSN_RX (insn), msg, 80);
593 regfree ((regex_t *) CGEN_INSN_RX (insn));
594 free (CGEN_INSN_RX (insn));
595 (CGEN_INSN_RX (insn)) = NULL;
601 /* Default insn parser.
603 The syntax string is scanned and operands are parsed and stored in FIELDS.
604 Relocs are queued as we go via other callbacks.
606 ??? Note that this is currently an all-or-nothing parser. If we fail to
607 parse the instruction, we return 0 and the caller will start over from
608 the beginning. Backtracking will be necessary in parsing subexpressions,
609 but that can be handled there. Not handling backtracking here may get
610 expensive in the case of the m68k. Deal with later.
612 Returns NULL for success, an error message for failure. */
615 parse_insn_normal (CGEN_CPU_DESC cd,
616 const CGEN_INSN *insn,
620 /* ??? Runtime added insns not handled yet. */
621 const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
622 const char *str = *strp;
625 const CGEN_SYNTAX_CHAR_TYPE * syn;
626 #ifdef CGEN_MNEMONIC_OPERANDS
631 /* For now we assume the mnemonic is first (there are no leading operands).
632 We can parse it without needing to set up operand parsing.
633 GAS's input scrubber will ensure mnemonics are lowercase, but we may
634 not be called from GAS. */
635 p = CGEN_INSN_MNEMONIC (insn);
636 while (*p && TOLOWER (*p) == TOLOWER (*str))
640 return _("unrecognized instruction");
642 #ifndef CGEN_MNEMONIC_OPERANDS
643 if (* str && ! ISSPACE (* str))
644 return _("unrecognized instruction");
647 CGEN_INIT_PARSE (cd);
648 cgen_init_parse_operand (cd);
649 #ifdef CGEN_MNEMONIC_OPERANDS
653 /* We don't check for (*str != '\0') here because we want to parse
654 any trailing fake arguments in the syntax string. */
655 syn = CGEN_SYNTAX_STRING (syntax);
657 /* Mnemonics come first for now, ensure valid string. */
658 if (! CGEN_SYNTAX_MNEMONIC_P (* syn))
665 /* Non operand chars must match exactly. */
666 if (CGEN_SYNTAX_CHAR_P (* syn))
668 /* FIXME: While we allow for non-GAS callers above, we assume the
669 first char after the mnemonic part is a space. */
670 /* FIXME: We also take inappropriate advantage of the fact that
671 GAS's input scrubber will remove extraneous blanks. */
672 if (TOLOWER (*str) == TOLOWER (CGEN_SYNTAX_CHAR (* syn)))
674 #ifdef CGEN_MNEMONIC_OPERANDS
675 if (CGEN_SYNTAX_CHAR(* syn) == ' ')
683 /* Syntax char didn't match. Can't be this insn. */
684 static char msg [80];
686 /* xgettext:c-format */
687 sprintf (msg, _("syntax error (expected char `%c', found `%c')"),
688 CGEN_SYNTAX_CHAR(*syn), *str);
693 /* Ran out of input. */
694 static char msg [80];
696 /* xgettext:c-format */
697 sprintf (msg, _("syntax error (expected char `%c', found end of instruction)"),
698 CGEN_SYNTAX_CHAR(*syn));
704 #ifdef CGEN_MNEMONIC_OPERANDS
705 (void) past_opcode_p;
707 /* We have an operand of some sort. */
708 errmsg = cd->parse_operand (cd, CGEN_SYNTAX_FIELD (*syn), &str, fields);
712 /* Done with this operand, continue with next one. */
716 /* If we're at the end of the syntax string, we're done. */
719 /* FIXME: For the moment we assume a valid `str' can only contain
720 blanks now. IE: We needn't try again with a longer version of
721 the insn and it is assumed that longer versions of insns appear
722 before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */
723 while (ISSPACE (* str))
727 return _("junk at end of line"); /* FIXME: would like to include `str' */
732 /* We couldn't parse it. */
733 return _("unrecognized instruction");
737 This routine is called for each instruction to be assembled.
738 STR points to the insn to be assembled.
739 We assume all necessary tables have been initialized.
740 The assembled instruction, less any fixups, is stored in BUF.
741 Remember that if CGEN_INT_INSN_P then BUF is an int and thus the value
742 still needs to be converted to target byte order, otherwise BUF is an array
743 of bytes in target byte order.
744 The result is a pointer to the insn's entry in the opcode table,
745 or NULL if an error occured (an error message will have already been
748 Note that when processing (non-alias) macro-insns,
749 this function recurses.
751 ??? It's possible to make this cpu-independent.
752 One would have to deal with a few minor things.
753 At this point in time doing so would be more of a curiosity than useful
754 [for example this file isn't _that_ big], but keeping the possibility in
755 mind helps keep the design clean. */
758 epiphany_cgen_assemble_insn (CGEN_CPU_DESC cd,
761 CGEN_INSN_BYTES_PTR buf,
765 CGEN_INSN_LIST *ilist;
766 const char *parse_errmsg = NULL;
767 const char *insert_errmsg = NULL;
768 int recognized_mnemonic = 0;
770 /* Skip leading white space. */
771 while (ISSPACE (* str))
774 /* The instructions are stored in hashed lists.
775 Get the first in the list. */
776 ilist = CGEN_ASM_LOOKUP_INSN (cd, str);
778 /* Keep looking until we find a match. */
780 for ( ; ilist != NULL ; ilist = CGEN_ASM_NEXT_INSN (ilist))
782 const CGEN_INSN *insn = ilist->insn;
783 recognized_mnemonic = 1;
785 #ifdef CGEN_VALIDATE_INSN_SUPPORTED
786 /* Not usually needed as unsupported opcodes
787 shouldn't be in the hash lists. */
788 /* Is this insn supported by the selected cpu? */
789 if (! epiphany_cgen_insn_supported (cd, insn))
792 /* If the RELAXED attribute is set, this is an insn that shouldn't be
793 chosen immediately. Instead, it is used during assembler/linker
794 relaxation if possible. */
795 if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXED) != 0)
800 /* Skip this insn if str doesn't look right lexically. */
801 if (CGEN_INSN_RX (insn) != NULL &&
802 regexec ((regex_t *) CGEN_INSN_RX (insn), str, 0, NULL, 0) == REG_NOMATCH)
805 /* Allow parse/insert handlers to obtain length of insn. */
806 CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
808 parse_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields);
809 if (parse_errmsg != NULL)
812 /* ??? 0 is passed for `pc'. */
813 insert_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf,
815 if (insert_errmsg != NULL)
818 /* It is up to the caller to actually output the insn and any
824 static char errbuf[150];
825 const char *tmp_errmsg;
826 #ifdef CGEN_VERBOSE_ASSEMBLER_ERRORS
834 /* If requesting verbose error messages, use insert_errmsg.
835 Failing that, use parse_errmsg. */
836 tmp_errmsg = (insert_errmsg ? insert_errmsg :
837 parse_errmsg ? parse_errmsg :
838 recognized_mnemonic ?
839 _("unrecognized form of instruction") :
840 _("unrecognized instruction"));
842 if (strlen (start) > 50)
843 /* xgettext:c-format */
844 sprintf (errbuf, "%s `%.50s...'", tmp_errmsg, start);
846 /* xgettext:c-format */
847 sprintf (errbuf, "%s `%.50s'", tmp_errmsg, start);
851 if (strlen (start) > 50)
852 /* xgettext:c-format */
853 sprintf (errbuf, _("bad instruction `%.50s...'"), start);
855 /* xgettext:c-format */
856 sprintf (errbuf, _("bad instruction `%.50s'"), start);