]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - opcodes/ppc-opc.c
Use operand->extract to provide defaults for optional PowerPC operands
authorAlan Modra <amodra@gmail.com>
Thu, 16 Aug 2018 06:44:12 +0000 (16:14 +0930)
committerAlan Modra <amodra@gmail.com>
Tue, 21 Aug 2018 06:35:36 +0000 (16:05 +0930)
commit9cf7e5687f823a1009d25cb25ff653ee8372e517
tree33fc95350dcbe996766c532ed4349dba4d01e4a0
parent46807bf45106af5523ad06cf84e7b825dcb9f089
Use operand->extract to provide defaults for optional PowerPC operands

Most optional operands to powerpc instructions use a default value of
zero, but there are a few exceptions.  Those have been handled by
PPC_OPERAND_OPTIONAL_VALUE and an entry in the powerpc_operands table
for the default value, smuggled in the shift field.  This patch
changes that to using the operand extract function to provide non-zero
defaults.

I've also moved the code determining whether optional operands are
provided or omitted, to the point the first optional operand is seen,
and allowed for the possibility of optional base register operands
in a future patch.

The patch does change the error you get on invalid assembly like

  ld 3,4

You'll now see "missing operand" rather than
"syntax error; end of line, expected `('".

gas/
* config/tc-ppc.c (md_assemble): Delay counting of optional
operands until one is encountered.  Allow for the possibility
of optional base regs, ie. PPC_OPERAND_PARENS.  Call
ppc_optional_operand_value with extra args.
include/
* opcode/ppc.h (struct powerpc_operand): Correct "insert" comment.
Mention use of "extract" function to provide default value.
(PPC_OPERAND_OPTIONAL_VALUE): Delete.
(ppc_optional_operand_value): Rewrite to use extract function.
opcodes/
* ppc-dis.c (operand_value_powerpc): Init "invalid".
(skip_optional_operands): Count optional operands, and update
ppc_optional_operand_value call.
* ppc-opc.c (extract_dxdn): Remove ATTRIBUTE_UNUSED from used arg.
(extract_vlensi): Likewise.
(extract_fxm): Return default value for missing optional operand.
(extract_ls, extract_raq, extract_tbr): Likewise.
(insert_sxl, extract_sxl): New functions.
(insert_esync, extract_esync): Remove Power9 handling and simplify.
(powerpc_operands <FXM4, TBR>): Delete PPC_OPERAND_OPTIONAL_VALUE
flag and extra entry.
(powerpc_operands <SXL>): Likewise, and use insert_sxl and
extract_sxl.
gas/ChangeLog
gas/config/tc-ppc.c
include/ChangeLog
include/opcode/ppc.h
opcodes/ChangeLog
opcodes/ppc-dis.c
opcodes/ppc-opc.c