aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/cgen-asm.in52
-rw-r--r--opcodes/epiphany-asm.c52
-rw-r--r--opcodes/fr30-asm.c52
-rw-r--r--opcodes/frv-asm.c52
-rw-r--r--opcodes/ip2k-asm.c52
-rw-r--r--opcodes/iq2000-asm.c52
-rw-r--r--opcodes/lm32-asm.c52
-rw-r--r--opcodes/m32c-asm.c52
-rw-r--r--opcodes/m32r-asm.c52
-rw-r--r--opcodes/mep-asm.c52
-rw-r--r--opcodes/mt-asm.c52
-rw-r--r--opcodes/nds32-asm.c5
-rw-r--r--opcodes/or1k-asm.c52
-rw-r--r--opcodes/xstormy16-asm.c52
14 files changed, 234 insertions, 447 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)
diff --git a/opcodes/epiphany-asm.c b/opcodes/epiphany-asm.c
index ce10f48..6c3f549 100644
--- a/opcodes/epiphany-asm.c
+++ b/opcodes/epiphany-asm.c
@@ -499,7 +499,6 @@ epiphany_cgen_build_insn_regex (CGEN_INSN *insn)
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));
@@ -537,15 +536,6 @@ epiphany_cgen_build_insn_regex (CGEN_INSN *insn)
{
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. */
@@ -579,7 +569,6 @@ epiphany_cgen_build_insn_regex (CGEN_INSN *insn)
/* Replace non-syntax fields with globs. */
*rx++ = '.';
*rx++ = '*';
- prev_syntax_char = 0;
}
}
@@ -637,8 +626,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.
@@ -654,13 +645,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. */
@@ -674,28 +665,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;
@@ -707,7 +688,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
@@ -717,12 +698,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)
diff --git a/opcodes/fr30-asm.c b/opcodes/fr30-asm.c
index 966d36f..9ef15fe 100644
--- a/opcodes/fr30-asm.c
+++ b/opcodes/fr30-asm.c
@@ -354,7 +354,6 @@ fr30_cgen_build_insn_regex (CGEN_INSN *insn)
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));
@@ -392,15 +391,6 @@ fr30_cgen_build_insn_regex (CGEN_INSN *insn)
{
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. */
@@ -434,7 +424,6 @@ fr30_cgen_build_insn_regex (CGEN_INSN *insn)
/* Replace non-syntax fields with globs. */
*rx++ = '.';
*rx++ = '*';
- prev_syntax_char = 0;
}
}
@@ -492,8 +481,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.
@@ -509,13 +500,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. */
@@ -529,28 +520,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;
@@ -562,7 +543,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
@@ -572,12 +553,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)
diff --git a/opcodes/frv-asm.c b/opcodes/frv-asm.c
index 9d12534..6b64bf4 100644
--- a/opcodes/frv-asm.c
+++ b/opcodes/frv-asm.c
@@ -1307,7 +1307,6 @@ frv_cgen_build_insn_regex (CGEN_INSN *insn)
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));
@@ -1345,15 +1344,6 @@ frv_cgen_build_insn_regex (CGEN_INSN *insn)
{
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. */
@@ -1387,7 +1377,6 @@ frv_cgen_build_insn_regex (CGEN_INSN *insn)
/* Replace non-syntax fields with globs. */
*rx++ = '.';
*rx++ = '*';
- prev_syntax_char = 0;
}
}
@@ -1445,8 +1434,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.
@@ -1462,13 +1453,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. */
@@ -1482,28 +1473,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;
@@ -1515,7 +1496,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
@@ -1525,12 +1506,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)
diff --git a/opcodes/ip2k-asm.c b/opcodes/ip2k-asm.c
index 1799025..003b78d 100644
--- a/opcodes/ip2k-asm.c
+++ b/opcodes/ip2k-asm.c
@@ -555,7 +555,6 @@ ip2k_cgen_build_insn_regex (CGEN_INSN *insn)
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));
@@ -593,15 +592,6 @@ ip2k_cgen_build_insn_regex (CGEN_INSN *insn)
{
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. */
@@ -635,7 +625,6 @@ ip2k_cgen_build_insn_regex (CGEN_INSN *insn)
/* Replace non-syntax fields with globs. */
*rx++ = '.';
*rx++ = '*';
- prev_syntax_char = 0;
}
}
@@ -693,8 +682,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.
@@ -710,13 +701,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. */
@@ -730,28 +721,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;
@@ -763,7 +744,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
@@ -773,12 +754,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)
diff --git a/opcodes/iq2000-asm.c b/opcodes/iq2000-asm.c
index 1a329c2..66d828f 100644
--- a/opcodes/iq2000-asm.c
+++ b/opcodes/iq2000-asm.c
@@ -503,7 +503,6 @@ iq2000_cgen_build_insn_regex (CGEN_INSN *insn)
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));
@@ -541,15 +540,6 @@ iq2000_cgen_build_insn_regex (CGEN_INSN *insn)
{
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. */
@@ -583,7 +573,6 @@ iq2000_cgen_build_insn_regex (CGEN_INSN *insn)
/* Replace non-syntax fields with globs. */
*rx++ = '.';
*rx++ = '*';
- prev_syntax_char = 0;
}
}
@@ -641,8 +630,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.
@@ -658,13 +649,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. */
@@ -678,28 +669,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;
@@ -711,7 +692,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
@@ -721,12 +702,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)
diff --git a/opcodes/lm32-asm.c b/opcodes/lm32-asm.c
index 5c4f9f4..d5e25f9 100644
--- a/opcodes/lm32-asm.c
+++ b/opcodes/lm32-asm.c
@@ -393,7 +393,6 @@ lm32_cgen_build_insn_regex (CGEN_INSN *insn)
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));
@@ -431,15 +430,6 @@ lm32_cgen_build_insn_regex (CGEN_INSN *insn)
{
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. */
@@ -473,7 +463,6 @@ lm32_cgen_build_insn_regex (CGEN_INSN *insn)
/* Replace non-syntax fields with globs. */
*rx++ = '.';
*rx++ = '*';
- prev_syntax_char = 0;
}
}
@@ -531,8 +520,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.
@@ -548,13 +539,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. */
@@ -568,28 +559,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;
@@ -601,7 +582,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
@@ -611,12 +592,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)
diff --git a/opcodes/m32c-asm.c b/opcodes/m32c-asm.c
index aebb59f..8a7983c 100644
--- a/opcodes/m32c-asm.c
+++ b/opcodes/m32c-asm.c
@@ -1628,7 +1628,6 @@ m32c_cgen_build_insn_regex (CGEN_INSN *insn)
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));
@@ -1666,15 +1665,6 @@ m32c_cgen_build_insn_regex (CGEN_INSN *insn)
{
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. */
@@ -1708,7 +1698,6 @@ m32c_cgen_build_insn_regex (CGEN_INSN *insn)
/* Replace non-syntax fields with globs. */
*rx++ = '.';
*rx++ = '*';
- prev_syntax_char = 0;
}
}
@@ -1766,8 +1755,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.
@@ -1783,13 +1774,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. */
@@ -1803,28 +1794,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;
@@ -1836,7 +1817,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
@@ -1846,12 +1827,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)
diff --git a/opcodes/m32r-asm.c b/opcodes/m32r-asm.c
index ae6ed49..4d19bab 100644
--- a/opcodes/m32r-asm.c
+++ b/opcodes/m32r-asm.c
@@ -372,7 +372,6 @@ m32r_cgen_build_insn_regex (CGEN_INSN *insn)
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));
@@ -410,15 +409,6 @@ m32r_cgen_build_insn_regex (CGEN_INSN *insn)
{
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. */
@@ -452,7 +442,6 @@ m32r_cgen_build_insn_regex (CGEN_INSN *insn)
/* Replace non-syntax fields with globs. */
*rx++ = '.';
*rx++ = '*';
- prev_syntax_char = 0;
}
}
@@ -510,8 +499,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.
@@ -527,13 +518,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. */
@@ -547,28 +538,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;
@@ -580,7 +561,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
@@ -590,12 +571,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)
diff --git a/opcodes/mep-asm.c b/opcodes/mep-asm.c
index 87af40c..6e72ddb 100644
--- a/opcodes/mep-asm.c
+++ b/opcodes/mep-asm.c
@@ -1331,7 +1331,6 @@ mep_cgen_build_insn_regex (CGEN_INSN *insn)
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));
@@ -1369,15 +1368,6 @@ mep_cgen_build_insn_regex (CGEN_INSN *insn)
{
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. */
@@ -1411,7 +1401,6 @@ mep_cgen_build_insn_regex (CGEN_INSN *insn)
/* Replace non-syntax fields with globs. */
*rx++ = '.';
*rx++ = '*';
- prev_syntax_char = 0;
}
}
@@ -1469,8 +1458,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.
@@ -1486,13 +1477,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. */
@@ -1506,28 +1497,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;
@@ -1539,7 +1520,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
@@ -1549,12 +1530,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)
diff --git a/opcodes/mt-asm.c b/opcodes/mt-asm.c
index 8263670..074c1ab 100644
--- a/opcodes/mt-asm.c
+++ b/opcodes/mt-asm.c
@@ -639,7 +639,6 @@ mt_cgen_build_insn_regex (CGEN_INSN *insn)
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));
@@ -677,15 +676,6 @@ mt_cgen_build_insn_regex (CGEN_INSN *insn)
{
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. */
@@ -719,7 +709,6 @@ mt_cgen_build_insn_regex (CGEN_INSN *insn)
/* Replace non-syntax fields with globs. */
*rx++ = '.';
*rx++ = '*';
- prev_syntax_char = 0;
}
}
@@ -777,8 +766,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.
@@ -794,13 +785,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. */
@@ -814,28 +805,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;
@@ -847,7 +828,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
@@ -857,12 +838,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)
diff --git a/opcodes/nds32-asm.c b/opcodes/nds32-asm.c
index f7a5e54..67a9833 100644
--- a/opcodes/nds32-asm.c
+++ b/opcodes/nds32-asm.c
@@ -2486,9 +2486,6 @@ parse_insn (nds32_asm_desc_t *pdesc, nds32_asm_insn_t *pinsn,
while (*plex)
{
- if (ISSPACE (*p))
- ++p;
-
if (IS_LEX_CHAR (*plex))
{
/* If it's a plain char, just compare it. */
@@ -2533,8 +2530,6 @@ parse_insn (nds32_asm_desc_t *pdesc, nds32_asm_insn_t *pinsn,
}
/* Check whether this syntax is accepted. */
- if (ISSPACE (*p))
- ++p;
if (*plex == 0 && (*p == '\0' || *p == '!' || *p == '#'))
return 1;
diff --git a/opcodes/or1k-asm.c b/opcodes/or1k-asm.c
index 9351c1b..0839366 100644
--- a/opcodes/or1k-asm.c
+++ b/opcodes/or1k-asm.c
@@ -619,7 +619,6 @@ or1k_cgen_build_insn_regex (CGEN_INSN *insn)
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));
@@ -657,15 +656,6 @@ or1k_cgen_build_insn_regex (CGEN_INSN *insn)
{
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. */
@@ -699,7 +689,6 @@ or1k_cgen_build_insn_regex (CGEN_INSN *insn)
/* Replace non-syntax fields with globs. */
*rx++ = '.';
*rx++ = '*';
- prev_syntax_char = 0;
}
}
@@ -757,8 +746,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.
@@ -774,13 +765,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. */
@@ -794,28 +785,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;
@@ -827,7 +808,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
@@ -837,12 +818,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)
diff --git a/opcodes/xstormy16-asm.c b/opcodes/xstormy16-asm.c
index 40c9265..8a9f33c 100644
--- a/opcodes/xstormy16-asm.c
+++ b/opcodes/xstormy16-asm.c
@@ -320,7 +320,6 @@ xstormy16_cgen_build_insn_regex (CGEN_INSN *insn)
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));
@@ -358,15 +357,6 @@ xstormy16_cgen_build_insn_regex (CGEN_INSN *insn)
{
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. */
@@ -400,7 +390,6 @@ xstormy16_cgen_build_insn_regex (CGEN_INSN *insn)
/* Replace non-syntax fields with globs. */
*rx++ = '.';
*rx++ = '*';
- prev_syntax_char = 0;
}
}
@@ -458,8 +447,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.
@@ -475,13 +466,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. */
@@ -495,28 +486,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;
@@ -528,7 +509,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
@@ -538,12 +519,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)