Detect illegal use of hash symbols in assembler mnemonics.

This commit is contained in:
Nick Clifton
1999-06-17 02:13:18 +00:00
parent df75f1af9c
commit 0f94f4c867
2 changed files with 29 additions and 3 deletions

View File

@ -1,3 +1,11 @@
1999-06-17 Nick Clifton <nickc@cygnus.com>
* config/tc-d10v.c (do_not_ignore_hash): New variable.
(get_operands): When parsing an expression after an '@' symbol
has been detected, do not ignore '#' symbols.
(md_operand): Only ignore '#' symbols if do_not_ignore_hash is
false.
1999-06-13 Ian Lance Taylor <ian@zembu.com> 1999-06-13 Ian Lance Taylor <ian@zembu.com>
From K. Richard Pixley <rich@noir.com>: From K. Richard Pixley <rich@noir.com>:

View File

@ -63,6 +63,8 @@ typedef struct _fixups
static Fixups FixUps[2]; static Fixups FixUps[2];
static Fixups *fixups; static Fixups *fixups;
static int do_not_ignore_hash = 0;
/* True if instruction swapping warnings should be inhibited. */ /* True if instruction swapping warnings should be inhibited. */
static unsigned char flag_warn_suppress_instructionswap; /* --nowarnswap */ static unsigned char flag_warn_suppress_instructionswap; /* --nowarnswap */
@ -393,6 +395,7 @@ get_operands (exp)
char *p = input_line_pointer; char *p = input_line_pointer;
int numops = 0; int numops = 0;
int post = 0; int post = 0;
int uses_at = 0;
while (*p) while (*p)
{ {
@ -403,6 +406,8 @@ get_operands (exp)
if (*p == '@') if (*p == '@')
{ {
uses_at = 1;
p++; p++;
exp[numops].X_op = O_absent; exp[numops].X_op = O_absent;
if (*p == '(') if (*p == '(')
@ -437,6 +442,19 @@ get_operands (exp)
if (!register_name (&exp[numops])) if (!register_name (&exp[numops]))
{ {
/* parse as an expression */ /* parse as an expression */
if (uses_at)
{
/* Any expression that involves the indirect addressing
cannot also involve immediate addressing. Therefore
the use of the hash character is illegal. */
int save = do_not_ignore_hash;
do_not_ignore_hash = 1;
expression (&exp[numops]);
do_not_ignore_hash = save;
}
else
expression (&exp[numops]); expression (&exp[numops]);
} }
@ -1595,7 +1613,7 @@ void
md_operand (expressionP) md_operand (expressionP)
expressionS *expressionP; expressionS *expressionP;
{ {
if (*input_line_pointer == '#') if (*input_line_pointer == '#' && ! do_not_ignore_hash)
{ {
input_line_pointer++; input_line_pointer++;
expression (expressionP); expression (expressionP);