X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=opcodes%2Fmep-asm.c;h=28085aa9cb72392499bb6a01f36862873cd2bddd;hb=d835a58baae720abe909795cb68763040d1750a8;hp=41a1f92fd092eef769f3c265c30c60e07264bb41;hpb=40493983ad5cdac9625b3f2a1f92e41e094fde4c;p=deliverable%2Fbinutils-gdb.git diff --git a/opcodes/mep-asm.c b/opcodes/mep-asm.c index 41a1f92fd0..28085aa9cb 100644 --- a/opcodes/mep-asm.c +++ b/opcodes/mep-asm.c @@ -1,11 +1,11 @@ +/* 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, 2007, 2008 - Free Software Foundation, Inc. + Copyright (C) 1996-2020 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 *); @@ -85,6 +88,32 @@ parse_csrn (CGEN_CPU_DESC cd, const char **strp, } /* begin-cop-ip-parse-handlers */ +static const char * +parse_ivc2_cr (CGEN_CPU_DESC, + const char **, + CGEN_KEYWORD *, + long *) ATTRIBUTE_UNUSED; +static const char * +parse_ivc2_cr (CGEN_CPU_DESC cd, + const char **strp, + CGEN_KEYWORD *keyword_table ATTRIBUTE_UNUSED, + long *field) +{ + return cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_cr_ivc2, field); +} +static const char * +parse_ivc2_ccr (CGEN_CPU_DESC, + const char **, + CGEN_KEYWORD *, + long *) ATTRIBUTE_UNUSED; +static const char * +parse_ivc2_ccr (CGEN_CPU_DESC cd, + const char **strp, + CGEN_KEYWORD *keyword_table ATTRIBUTE_UNUSED, + long *field) +{ + return cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_ccr_ivc2, field); +} /* end-cop-ip-parse-handlers */ const char * @@ -290,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 * @@ -420,7 +489,7 @@ parse_unsigned7 (CGEN_CPU_DESC cd, const char **strp, break; default: /* Safe assumption? */ - abort (); + abort (); } errmsg = cgen_parse_address (cd, strp, opindex, reloc, NULL, &value); @@ -463,10 +532,10 @@ parse_cdisp10 (CGEN_CPU_DESC cd, break; } - if (MEP_CPU == EF_MEP_CPU_C5) + if ((MEP_CPU & EF_MEP_CPU_MASK) == EF_MEP_CPU_C5) wide = 1; - if (strncmp (*strp, "0x0", 3) == 0 + if (strncmp (*strp, "0x0", 3) == 0 || (**strp == '0' && *(*strp + 1) != 'x')) have_zero = 1; @@ -533,7 +602,7 @@ mep_cgen_expand_macros_and_parse_operand static char * str_append (char *dest, const char *input, int len) -{ +{ char *new_dest; int oldlen; @@ -564,20 +633,20 @@ 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) { - if (*e == '`' && - (*e+1) && + if (*e == '`' && + (*e+1) && ((*(e + 1) - '1') <= MAXARGS) && ((*(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; } @@ -593,7 +662,7 @@ expand_macro (arg *args, int narg, macro *mac) free (result); return rescanned_result; } - else + else return result; } @@ -609,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; @@ -619,20 +687,20 @@ expand_string (const char *in, int first_only) switch (state) { case IN_TEXT: - if (*in == '%' && *(in + 1) && (!first_only || num_expansions == 0)) - { - macro = lookup_macro (in + 1); - if (macro) + if (*in == '%' && *(in + 1) && (!first_only || num_expansions == 0)) + { + 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; + state = IN_TEXT; + pmacro = NULL; } else { @@ -640,7 +708,7 @@ expand_string (const char *in, int first_only) narg = 0; args[narg].start = in + 1; args[narg].len = 0; - mark = in + 1; + mark = in + 1; } } } @@ -658,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) { @@ -673,16 +741,17 @@ expand_string (const char *in, int first_only) { result = str_append (result, mark, in - mark); } - macro = 0; + pmacro = NULL; mark = in + 1; break; case '(': depth++; + /* Fall through. */ default: args[narg].len++; - break; + break; } - } + } else { if (*in == ')') @@ -690,14 +759,14 @@ expand_string (const char *in, int first_only) if (narg > -1) args[narg].len++; } - + } ++in; } - + if (mark != in) result = str_append (result, mark, in - mark); - + return result; } @@ -736,10 +805,10 @@ mep_cgen_expand_macros_and_parse_operand (CGEN_CPU_DESC cd, int opindex, { if (strstr (*strp_in, str)) /* A macro-expansion was pulled off the front. */ - *strp_in = strstr (*strp_in, str); + *strp_in = strstr (*strp_in, str); else /* A non-macro-expansion was pulled off the front. */ - *strp_in += (str - hold); + *strp_in += (str - hold); } if (hold) @@ -748,7 +817,7 @@ mep_cgen_expand_macros_and_parse_operand (CGEN_CPU_DESC cd, int opindex, return errmsg; } -#define CGEN_ASM_INIT_HOOK (cd->parse_operand = mep_cgen_expand_macros_and_parse_operand); +#define CGEN_ASM_INIT_HOOK (cd->parse_operand = mep_cgen_expand_macros_and_parse_operand); /* -- dis.c */ @@ -840,6 +909,24 @@ mep_cgen_parse_operand (CGEN_CPU_DESC cd, case MEP_OPERAND_CRNX64 : errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_cr64, & fields->f_crnx); break; + case MEP_OPERAND_CROC : + errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_cr64, & fields->f_ivc2_5u7); + break; + case MEP_OPERAND_CROP : + errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_cr64, & fields->f_ivc2_5u23); + break; + case MEP_OPERAND_CRPC : + errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_cr64, & fields->f_ivc2_5u26); + break; + case MEP_OPERAND_CRPP : + errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_cr64, & fields->f_ivc2_5u18); + break; + case MEP_OPERAND_CRQC : + errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_cr64, & fields->f_ivc2_5u21); + break; + case MEP_OPERAND_CRQP : + errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_cr64, & fields->f_ivc2_5u13); + break; case MEP_OPERAND_CSRN : errmsg = parse_csrn (cd, strp, & mep_cgen_opval_h_csr, & fields->f_csrn); break; @@ -861,6 +948,162 @@ mep_cgen_parse_operand (CGEN_CPU_DESC cd, case MEP_OPERAND_HI : errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_csr, & junk); break; + case MEP_OPERAND_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)); + break; + case MEP_OPERAND_IMM3P25 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM3P25, (unsigned long *) (& fields->f_ivc2_3u25)); + break; + case MEP_OPERAND_IMM3P4 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM3P4, (unsigned long *) (& fields->f_ivc2_3u4)); + break; + case MEP_OPERAND_IMM3P5 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM3P5, (unsigned long *) (& fields->f_ivc2_3u5)); + break; + case MEP_OPERAND_IMM3P9 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM3P9, (unsigned long *) (& fields->f_ivc2_3u9)); + break; + case MEP_OPERAND_IMM4P10 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM4P10, (unsigned long *) (& fields->f_ivc2_4u10)); + break; + case MEP_OPERAND_IMM4P4 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM4P4, (unsigned long *) (& fields->f_ivc2_4u4)); + break; + case MEP_OPERAND_IMM4P8 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM4P8, (unsigned long *) (& fields->f_ivc2_4u8)); + break; + case MEP_OPERAND_IMM5P23 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM5P23, (unsigned long *) (& fields->f_ivc2_5u23)); + break; + case MEP_OPERAND_IMM5P3 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM5P3, (unsigned long *) (& fields->f_ivc2_5u3)); + break; + case MEP_OPERAND_IMM5P7 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM5P7, (unsigned long *) (& fields->f_ivc2_5u7)); + break; + case MEP_OPERAND_IMM5P8 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM5P8, (unsigned long *) (& fields->f_ivc2_5u8)); + break; + case MEP_OPERAND_IMM6P2 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM6P2, (unsigned long *) (& fields->f_ivc2_6u2)); + break; + case MEP_OPERAND_IMM6P6 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM6P6, (unsigned long *) (& fields->f_ivc2_6u6)); + break; + case MEP_OPERAND_IMM8P0 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM8P0, (unsigned long *) (& fields->f_ivc2_8u0)); + break; + case MEP_OPERAND_IMM8P20 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM8P20, (unsigned long *) (& fields->f_ivc2_8u20)); + break; + case MEP_OPERAND_IMM8P4 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM8P4, (unsigned long *) (& fields->f_ivc2_8u4)); + break; + case MEP_OPERAND_IVC_X_0_2 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IVC_X_0_2, (unsigned long *) (& fields->f_ivc2_2u0)); + break; + case MEP_OPERAND_IVC_X_0_3 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IVC_X_0_3, (unsigned long *) (& fields->f_ivc2_3u0)); + break; + case MEP_OPERAND_IVC_X_0_4 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IVC_X_0_4, (unsigned long *) (& fields->f_ivc2_4u0)); + break; + case MEP_OPERAND_IVC_X_0_5 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IVC_X_0_5, (unsigned long *) (& fields->f_ivc2_5u0)); + break; + case MEP_OPERAND_IVC_X_6_1 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IVC_X_6_1, (unsigned long *) (& fields->f_ivc2_1u6)); + break; + case MEP_OPERAND_IVC_X_6_2 : + errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IVC_X_6_2, (unsigned long *) (& fields->f_ivc2_2u6)); + break; + 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_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); + break; + case MEP_OPERAND_IVC2RM : + errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_gpr, & fields->f_ivc2_crm); + break; case MEP_OPERAND_LO : errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_csr, & junk); break; @@ -972,12 +1215,24 @@ mep_cgen_parse_operand (CGEN_CPU_DESC cd, case MEP_OPERAND_SIMM16 : errmsg = parse_signed16 (cd, strp, MEP_OPERAND_SIMM16, (long *) (& fields->f_16s16)); break; + case MEP_OPERAND_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)); break; case MEP_OPERAND_SIMM8 : errmsg = cgen_parse_signed_integer (cd, strp, MEP_OPERAND_SIMM8, (long *) (& fields->f_8s8)); break; + 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; case MEP_OPERAND_SP : errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_gpr, & junk); break; @@ -1029,14 +1284,16 @@ mep_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 mep_cgen_parse_handlers[] = +cgen_parse_fn * const mep_cgen_parse_handlers[] = { parse_insn_normal, }; @@ -1066,9 +1323,9 @@ CGEN_ASM_INIT_HOOK Returns NULL for success, an error message for failure. */ -char * +char * mep_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]; @@ -1107,18 +1364,18 @@ mep_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 @@ -1148,20 +1405,20 @@ mep_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 { @@ -1279,9 +1536,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; @@ -1358,7 +1617,7 @@ mep_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? */ @@ -1398,32 +1657,40 @@ 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; }