diff options
Diffstat (limited to 'opcodes/cgen-asm.in')
-rw-r--r-- | opcodes/cgen-asm.in | 52 |
1 files changed, 18 insertions, 34 deletions
diff --git a/opcodes/cgen-asm.in b/opcodes/cgen-asm.in index 8aab7e1..3f51804 100644 --- a/opcodes/cgen-asm.in +++ b/opcodes/cgen-asm.in @@ -68,7 +68,6 @@ char * char rxbuf[CGEN_MAX_RX_ELEMENTS]; char *rx = rxbuf; const CGEN_SYNTAX_CHAR_TYPE *syn; - char prev_syntax_char = 0; int reg_err; syn = CGEN_SYNTAX_STRING (CGEN_OPCODE_SYNTAX (opc)); @@ -106,15 +105,6 @@ char * { char c = CGEN_SYNTAX_CHAR (* syn); - /* See whitespace related comments in parse_insn_normal(). */ - if (c != ' ' && prev_syntax_char != ' ' - && (!ISALNUM (c) || !ISALNUM (prev_syntax_char))) - { - *rx++ = ' '; - *rx++ = '*'; - } - prev_syntax_char = c; - switch (c) { /* Escape any regex metacharacters in the syntax. */ @@ -148,7 +138,6 @@ char * /* Replace non-syntax fields with globs. */ *rx++ = '.'; *rx++ = '*'; - prev_syntax_char = 0; } } @@ -206,8 +195,10 @@ parse_insn_normal (CGEN_CPU_DESC cd, const char *errmsg; const char *p; const CGEN_SYNTAX_CHAR_TYPE * syn; - char prev_syntax_char = 0; - bool past_opcode_p; +#ifdef CGEN_MNEMONIC_OPERANDS + /* FIXME: wip */ + int past_opcode_p; +#endif /* For now we assume the mnemonic is first (there are no leading operands). We can parse it without needing to set up operand parsing. @@ -223,13 +214,13 @@ parse_insn_normal (CGEN_CPU_DESC cd, #ifndef CGEN_MNEMONIC_OPERANDS if (* str && ! ISSPACE (* str)) return _("unrecognized instruction"); - past_opcode_p = true; -#else - past_opcode_p = false; #endif CGEN_INIT_PARSE (cd); cgen_init_parse_operand (cd); +#ifdef CGEN_MNEMONIC_OPERANDS + past_opcode_p = 0; +#endif /* We don't check for (*str != '\0') here because we want to parse any trailing fake arguments in the syntax string. */ @@ -243,28 +234,18 @@ parse_insn_normal (CGEN_CPU_DESC cd, while (* syn != 0) { - char c = CGEN_SYNTAX_CHAR_P (*syn) ? CGEN_SYNTAX_CHAR (*syn) : 0; - - /* FIXME: Despite this check we may still take inappropriate advantage of - the fact that GAS's input scrubber will remove extraneous whitespace. - We may also be a little too lax with this now, yet being more strict - would require targets to indicate where whitespace is permissible. */ - if (past_opcode_p && c != ' ' && ISSPACE (*str) - /* No whitespace between consecutive alphanumeric syntax elements. */ - && (!ISALNUM (c) || !ISALNUM (prev_syntax_char))) - ++str; - prev_syntax_char = c; - /* Non operand chars must match exactly. */ - if (c != 0) + if (CGEN_SYNTAX_CHAR_P (* syn)) { /* FIXME: While we allow for non-GAS callers above, we assume the first char after the mnemonic part is a space. */ - if (TOLOWER (*str) == TOLOWER (c)) + /* FIXME: We also take inappropriate advantage of the fact that + GAS's input scrubber will remove extraneous blanks. */ + if (TOLOWER (*str) == TOLOWER (CGEN_SYNTAX_CHAR (* syn))) { #ifdef CGEN_MNEMONIC_OPERANDS - if (c == ' ') - past_opcode_p = true; + if (CGEN_SYNTAX_CHAR(* syn) == ' ') + past_opcode_p = 1; #endif ++ syn; ++ str; @@ -276,7 +257,7 @@ parse_insn_normal (CGEN_CPU_DESC cd, /* xgettext:c-format */ sprintf (msg, _("syntax error (expected char `%c', found `%c')"), - c, *str); + CGEN_SYNTAX_CHAR(*syn), *str); return msg; } else @@ -286,12 +267,15 @@ parse_insn_normal (CGEN_CPU_DESC cd, /* xgettext:c-format */ sprintf (msg, _("syntax error (expected char `%c', found end of instruction)"), - c); + CGEN_SYNTAX_CHAR(*syn)); return msg; } 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); if (errmsg) |