PowerPC: implement md_operand to parse register names
authorAlan Modra <amodra@gmail.com>
Tue, 12 Jul 2022 01:40:08 +0000 (11:10 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 14 Jul 2022 02:28:40 +0000 (11:58 +0930)
commit00b37cc41e699faa30435fb6a302311a5ad44a3d
tree6eaea925dac041af3cefcdb34eba7e5dbc81ff73
parent869fa2b36cb2db03deda55225560a2f93d98cc0b
PowerPC: implement md_operand to parse register names

Allows register names to appear in symbol assignments, so for example
 tocp = %r2
 mr %r3,tocp
now assembles.

* gas/config/tc-ppc.c (REG_NAME_CNT): Delete, replace uses with
ARRAY_SIZE.
(register_name): Rename to..
(md_operand): ..this.  Only handle %reg.
(cr_names): Rename to..
(cr_cond): ..this.  Just keep conditions.
(ppc_parse_name): Add mode param.  Search both cr_cond and
pre_defined_registers.  Handle absolute and register symbol
values here rather than in expr.c:operand().
(md_assemble): Don't special case register name matching in
operands, except to set cr_operand as appropriate.
* gas/config/tc-ppc.h (md_operand): Don't define.
(md_parse_name, ppc_parse_name): Update.
* read.c (pseudo_set): Copy over entire O_register value.
* testsuite/gas/ppc/regsyms.d.
* testsuite/gas/ppc/regsyms.s: New test.
* testsuite/gas/ppc/ppc.exp: Run it.
gas/config/tc-ppc.c
gas/config/tc-ppc.h
gas/read.c
gas/testsuite/gas/ppc/ppc.exp
gas/testsuite/gas/ppc/regsyms.d [new file with mode: 0644]
gas/testsuite/gas/ppc/regsyms.s [new file with mode: 0644]