diff options
author | Andreas Krebbel <krebbel@linux.vnet.ibm.com> | 2017-05-29 12:34:56 +0200 |
---|---|---|
committer | Andreas Krebbel <krebbel@linux.vnet.ibm.com> | 2017-05-30 10:22:25 +0200 |
commit | a09f2586017aeed82fa07c8bfea6c75859295bd9 (patch) | |
tree | 8e64265ebd74205ae47c7a8dde8db8f64dac8592 /gas/config | |
parent | bfcfbe611b4d7e650236f8b8ba7d0706cfe6a0b7 (diff) | |
download | gdb-a09f2586017aeed82fa07c8bfea6c75859295bd9.zip gdb-a09f2586017aeed82fa07c8bfea6c75859295bd9.tar.gz gdb-a09f2586017aeed82fa07c8bfea6c75859295bd9.tar.bz2 |
S/390: Improve error checking for optional operands
So far we only had an instruction flag which made an arbitrary number
of operands optional. This limits error checking capabilities for
instructions marked that way. With this patch the optparm flag only
allows a single optional parameter and another one is added (optparm2)
allowing 2 optional arguments. Hopefully we won't need more than that
in the future. So far there will be only a single use of optparm2.
gas/ChangeLog:
2017-05-30 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config/tc-s390.c (md_gather_operands): Support new optparm2
instruction flag.
include/ChangeLog:
2017-05-30 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* opcode/s390.h: Add new instruction flags optparm2.
opcodes/ChangeLog:
2017-05-30 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* s390-dis.c (s390_print_insn_with_opcode): Support new optparm2
instruction flag.
* s390-mkopc.c (main): Recognize the new instruction flag when
parsing instruction list.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-s390.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index a31cb3a..043336e 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -1270,7 +1270,8 @@ md_gather_operands (char *str, operand = s390_operands + *opindex_ptr; - if ((opcode->flags & S390_INSTR_FLAG_OPTPARM) && *str == '\0') + if ((opcode->flags & (S390_INSTR_FLAG_OPTPARM | S390_INSTR_FLAG_OPTPARM2)) + && *str == '\0') { /* Optional parameters might need to be ORed with a value so calling s390_insert_operand is needed. */ @@ -1536,7 +1537,18 @@ md_gather_operands (char *str, str++; } - if ((opcode->flags & S390_INSTR_FLAG_OPTPARM) && *str == '\0') + if ((opcode->flags & (S390_INSTR_FLAG_OPTPARM + | S390_INSTR_FLAG_OPTPARM2)) + && opindex_ptr[1] != '\0' + && opindex_ptr[2] == '\0' + && *str == '\0') + continue; + + if ((opcode->flags & S390_INSTR_FLAG_OPTPARM2) + && opindex_ptr[1] != '\0' + && opindex_ptr[2] != '\0' + && opindex_ptr[3] == '\0' + && *str == '\0') continue; /* If there is a next operand it must be separated by a comma. */ |