X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=opcodes%2Ffrv-asm.c;h=13cb41cf9938cf260a788b4b08d2c32e28ae3739;hb=c7d7aea2f5fadff84eee78aaa0b1830016d26319;hp=44114b9f64159be4ec1b8ae5f4bf356139410f8f;hpb=1620f33de1ac5f1ee4abf14b87c49e45b5bf097f;p=deliverable%2Fbinutils-gdb.git diff --git a/opcodes/frv-asm.c b/opcodes/frv-asm.c index 44114b9f64..13cb41cf99 100644 --- a/opcodes/frv-asm.c +++ b/opcodes/frv-asm.c @@ -1,28 +1,29 @@ +/* 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 - Free Software Foundation, Inc. + Copyright (C) 1996-2020 Free Software Foundation, Inc. - This file is part of the GNU Binutils and GDB, the GNU debugger. + This file is part of libopcodes. - This program is free software; you can redistribute it and/or modify + This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + It is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + /* ??? Eventually more and more of this stuff can go to cpu-independent files. Keep that in mind. */ @@ -99,10 +100,10 @@ parse_ldd_annotation (CGEN_CPU_DESC cd, return errmsg; } } - + while (**strp == ' ' || **strp == '\t') ++*strp; - + if (**strp != '@') return "missing `@'"; @@ -138,10 +139,10 @@ parse_call_annotation (CGEN_CPU_DESC cd, return errmsg; } } - + while (**strp == ' ' || **strp == '\t') ++*strp; - + if (**strp != '@') return "missing `@'"; @@ -177,10 +178,10 @@ parse_ld_annotation (CGEN_CPU_DESC cd, return errmsg; } } - + while (**strp == ' ' || **strp == '\t') ++*strp; - + if (**strp != '@') return "missing `@'"; @@ -198,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) @@ -324,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) @@ -450,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) @@ -464,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; @@ -635,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 == '%') { @@ -748,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 == '%') { @@ -864,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) @@ -895,7 +896,7 @@ parse_A (CGEN_CPU_DESC cd, unsigned long A) { const char *errmsg; - + if (**strp == '#') ++*strp; @@ -957,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 == '%')) { @@ -1259,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, }; @@ -1296,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]; @@ -1337,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 @@ -1378,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 { @@ -1509,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; @@ -1588,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? */ @@ -1628,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; }