diff options
author | Jens Remus <jremus@linux.ibm.com> | 2024-11-29 15:37:19 +0100 |
---|---|---|
committer | Jens Remus <jremus@linux.ibm.com> | 2024-11-29 15:37:19 +0100 |
commit | 2727c14ec4bc97c683fa07fab022d6d00410c963 (patch) | |
tree | f18fa44a865b06c1051de7cc92617be47c1ecb2d | |
parent | 36bbf8646c8b885ddb1a7e617e85fb29bead6f53 (diff) | |
download | binutils-2727c14ec4bc97c683fa07fab022d6d00410c963.zip binutils-2727c14ec4bc97c683fa07fab022d6d00410c963.tar.gz binutils-2727c14ec4bc97c683fa07fab022d6d00410c963.tar.bz2 |
s390: Simplify parsing of omitted index register operand
The index register operand X in D(X,B) can optionally be omitted by
coding D(,B) or D(B). Simplify the parsing logic.
gas/
* config/tc-s390.c (md_gather_operands): Rename
omitted_base_or_index to omitted_index and simplify logic.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
-rw-r--r-- | gas/config/tc-s390.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index 5d58991..5d830c3 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -1424,7 +1424,7 @@ md_gather_operands (char *str, expressionS ex; elf_suffix_type suffix; bfd_reloc_code_real_type reloc; - int omitted_base_or_index; + int omitted_index; int operand_number; char *f; int fc, i; @@ -1433,7 +1433,7 @@ md_gather_operands (char *str, str++; /* Gather the operands. */ - omitted_base_or_index = 0; /* Whether B in D(L,B) or X in D(X,B) were omitted. */ + omitted_index = 0; /* Whether X in D(X,B) was omitted. */ operand_number = 1; /* Current operand number in e.g. R1,I2,M3,D4(B4). */ fc = 0; for (opindex_ptr = opcode->operands; *opindex_ptr != 0; opindex_ptr++) @@ -1450,13 +1450,13 @@ md_gather_operands (char *str, break; } - if (omitted_base_or_index && (operand->flags & S390_OPERAND_INDEX)) + if (omitted_index && (operand->flags & S390_OPERAND_INDEX)) { /* Skip omitted optional index register operand in D(X,B) due to D(,B) or D(B). Skip comma, if D(,B). */ if (*str == ',') str++; - omitted_base_or_index = 0; + omitted_index = 0; continue; } @@ -1720,17 +1720,9 @@ md_gather_operands (char *str, break; /* If there is no comma until the closing parenthesis ')' or there is a comma right after the opening parenthesis '(', - we have to skip the omitted optional index or base register - operand: - - Index X in D(X,B), when D(,B) or D(B) - - Base B in D(L,B), when D(L) */ - if (*f == ',' && f == str) - { - /* Comma directly after opening parenthesis '(' ? */ - omitted_base_or_index = 1; - } - else - omitted_base_or_index = (*f != ','); + we have to skip an omitted optional index register + operand X in D(X,B), when D(,B) or D(B). */ + omitted_index = ((*f == ',' && f == str) || (*f == ')')); } } else if (operand->flags & S390_OPERAND_BASE) @@ -1741,7 +1733,7 @@ md_gather_operands (char *str, operand_number); else str++; - omitted_base_or_index = 0; + omitted_index = 0; /* If there is no further input and the remaining operands are optional then have these optional operands processed. */ |