aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJens Remus <jremus@linux.ibm.com>2024-03-01 12:45:14 +0100
committerJens Remus <jremus@linux.ibm.com>2024-03-01 12:45:14 +0100
commita0af167da214b166dc2b7a17f688aa001687e999 (patch)
tree50de6799f4717ee3e7936dc23d0a9a93fd186385 /gas
parent566d4098fde1fd80bfff65ee1d9c45f63d6fd85e (diff)
downloadgdb-a0af167da214b166dc2b7a17f688aa001687e999.zip
gdb-a0af167da214b166dc2b7a17f688aa001687e999.tar.gz
gdb-a0af167da214b166dc2b7a17f688aa001687e999.tar.bz2
s390: Add comments to assembler operand parsing logic
gas/ * config/tc-s390.c: Add comments to assembler operand parsing logic. Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Diffstat (limited to 'gas')
-rw-r--r--gas/config/tc-s390.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index 55a5873..9aebd8c 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -1474,9 +1474,10 @@ md_gather_operands (char *str,
/* After a displacement a block in parentheses can start. */
if (*str != '(')
{
- /* Check if parenthesized block can be skipped. If the next
- operand is neither an optional operand nor a base register
- then we have a syntax error. */
+ /* There is no opening parentheses. Check if operands of
+ parenthesized block can be skipped. Only index and base
+ register operands as well as optional operands may be
+ skipped. A length operand may not be skipped. */
operand = s390_operands + *(++opindex_ptr);
if (!(operand->flags & (S390_OPERAND_INDEX|S390_OPERAND_BASE)))
as_bad (_("syntax error; missing '(' after displacement"));
@@ -1485,6 +1486,8 @@ md_gather_operands (char *str,
while (!(operand->flags & S390_OPERAND_BASE))
operand = s390_operands + *(++opindex_ptr);
+ /* If there is no further input and the remaining operands are
+ optional then have these optional operands processed. */
if (*str == '\0' && skip_optargs_p (opcode->flags, &opindex_ptr[1]))
continue;
@@ -1493,6 +1496,7 @@ md_gather_operands (char *str,
{
if (*str != ',')
{
+ /* There is no comma. Skip all operands and stop. */
while (opindex_ptr[1] != '\0')
{
operand = s390_operands + *(++opindex_ptr);
@@ -1501,7 +1505,10 @@ md_gather_operands (char *str,
}
}
else
- str++;
+ {
+ /* Comma. */
+ str++;
+ }
}
}
else
@@ -1535,6 +1542,8 @@ md_gather_operands (char *str,
str++;
omitted_base_or_index = 0;
+ /* If there is no further input and the remaining operands are
+ optional then have these optional operands processed. */
if (*str == '\0' && skip_optargs_p (opcode->flags, &opindex_ptr[1]))
continue;
@@ -1543,6 +1552,7 @@ md_gather_operands (char *str,
{
if (*str != ',')
{
+ /* There is no comma. Skip all operands and stop. */
while (opindex_ptr[1] != '\0')
{
operand = s390_operands + *(++opindex_ptr);
@@ -1551,7 +1561,10 @@ md_gather_operands (char *str,
}
}
else
- str++;
+ {
+ /* Comma. */
+ str++;
+ }
}
}
else
@@ -1567,6 +1580,8 @@ md_gather_operands (char *str,
str++;
}
+ /* If there is no further input and the remaining operands are
+ optional then have these optional operands processed. */
if (*str == '\0' && skip_optargs_p (opcode->flags, &opindex_ptr[1]))
continue;
@@ -1575,6 +1590,7 @@ md_gather_operands (char *str,
{
if (*str != ',')
{
+ /* There is no comma. Skip all operands and stop. */
while (opindex_ptr[1] != '\0')
{
operand = s390_operands + *(++opindex_ptr);
@@ -1583,7 +1599,10 @@ md_gather_operands (char *str,
}
}
else
- str++;
+ {
+ /* Comma. */
+ str++;
+ }
}
}
}