From: Jens Remus <jremus@linux.ibm.com>
To: binutils@sourceware.org
Cc: Jens Remus <jremus@linux.ibm.com>,
Andreas Krebbel <krebbel@linux.ibm.com>
Subject: [PATCH 06/14] s390: Add comments to assembler operand parsing logic
Date: Thu, 15 Feb 2024 16:58:13 +0100 [thread overview]
Message-ID: <20240215155821.4065623-7-jremus@linux.ibm.com> (raw)
In-Reply-To: <20240215155821.4065623-1-jremus@linux.ibm.com>
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>
---
gas/config/tc-s390.c | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index 55a5873edc18..9aebd8ca91e5 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++;
+ }
}
}
}
--
2.40.1
next prev parent reply other threads:[~2024-02-15 15:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-15 15:58 [PATCH 00/14] s390: Enhancements to working with addressing operands Jens Remus
2024-02-15 15:58 ` [PATCH 01/14] s390: Lower severity of assembler syntax errors from fatal to error Jens Remus
2024-02-15 15:58 ` [PATCH 02/14] s390: Enhance handling of syntax errors in assembler Jens Remus
2024-02-15 15:58 ` [PATCH 03/14] s390: Do not erroneously use base operand value for length operand Jens Remus
2024-02-15 15:58 ` [PATCH 04/14] s390: Correct setting of highgprs flag in ELF output Jens Remus
2024-02-15 15:58 ` [PATCH 05/14] s390: Assemble processor specific test cases for their processor Jens Remus
2024-02-15 15:58 ` Jens Remus [this message]
2024-02-15 15:58 ` [PATCH 07/14] s390: Add test cases for base/index register 0 Jens Remus
2024-02-15 15:58 ` [PATCH 08/14] s390: Add test case for disassembler option warn-areg-zero Jens Remus
2024-02-15 15:58 ` [PATCH 09/14] s390: Revise s390-specific assembler option descriptions Jens Remus
2024-02-15 15:58 ` [PATCH 10/14] s390: Warn when register name type does not match operand Jens Remus
2024-02-15 15:58 ` [PATCH 11/14] s390: Print base register 0 as "0" in disassembly Jens Remus
2024-02-15 15:58 ` [PATCH 12/14] s390: Allow to explicitly omit base register operand in assembly Jens Remus
2024-02-15 15:58 ` [PATCH 13/14] s390: Provide operand number in assembler warning and error messages Jens Remus
2024-02-15 15:58 ` [PATCH 14/14] s390: Be more verbose about missing operand type Jens Remus
2024-03-01 12:24 ` [PATCH 00/14] s390: Enhancements to working with addressing operands Jens Remus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240215155821.4065623-7-jremus@linux.ibm.com \
--to=jremus@linux.ibm.com \
--cc=binutils@sourceware.org \
--cc=krebbel@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).