gas/arm: clean up register name parsing.

Richard Earnshaw rearnsha@arm.com
Wed Jan 9 09:59:00 GMT 2002


In order to get this patch to work I've had to reverse-engineer the cirrus 
maverick instructions using the tests in the testsuite, since there 
doesn't seem to be any public documentation of these instructions.  So I'm 
working on the assumption that those tests are correct and that they 
provide adequate coverage of the syntax of those instructions.  The tests 
still pass after this patch has been applied.

This patch splits the existing register names table into several smaller 
tables, one for each class of register; each entry can then contain the 
real register number rather than some offset that has to be mangled to 
extract the real value.  In all arm instructions, the class of register 
that is acceptable is always defined by the context at that point of 
parsing, so we should never need to look up a register in more than one 
table.

I've also fixed all the Maverick support routines so that they now impose 
the register class constraints (as determined from the testsuite).  So we 
should now get an error if an invalid register name is used.

The support routines for the Maverick functions could now be more usefully 
renamed to match the type of instruction, but without knowing what they 
all do it's a little hard to think of sensible names.  Aldy, perhaps you 
could come up with a further patch to apply on top of this one that does 
this.

<date>  Richard Earnshaw  (rearnsha@arm.com)

        * tc-arm.c (struct reg_entry): Move before prototypes.
        (int_register, cp_register, fp_register): Delete.
        (reg_table): Delete.  Replaced with ...
        (rn_table, cp_table, cn_table, fn_table, mav_mvf_table)
	(mav_mvd_table, mav_mvfx_table, mav_mvdx_table, mav_mvax_table)
	(mav_dspsc_table): ... one table per register set.
        (arm_reg_hsh): Delete.
        (struct reg_map): New structure.
        (all_reg_maps): New array.
        (enum arm_reg_type): New enums.
        (build_reg_hsh): New function.
        (insert_reg_alias): Use hash table passed by caller.  Adjust all
        callers.
        (create_register_alias): New function, split out from ...
        (md_assemble): ... here.
        (md_begin): Build new register hash tables.
        (arm_reg_parse): New argument for the hash table to search.  
Adjust all
        callers.
        (arm_reg_parse_any): New function.
        (co_proc_number): Look up the processor number in the processor 
hash
        table.
	(cirrus_regtype): Delete.
	(cirrus_register, cirrus_mvf_register, cirrus_mvd_register)
	(cirrus_mvfx_register, cirrus_mvdx_register, cirrus_mvax_register)
	(ARM_EXT_MAVERICKsc_register): Delete.
	(do_c_binops_1, do_c_binops_2, do_c_binops_3): Delete.
	(do_c_binops_1[a-o], do_c_binops_2[a-c], do_c_binops_3[a-d]): New
	functions.
	(do_c_triple_4, do_c_triple_5): Delete.
	(do_c_triple_4[ab], do_c_triple_5[a-h]): New functions.
	(do_c_quad_6): Delete.
	(do_c_quad_6[ab]): New functions.
	(do_c_binops, do_c_triple, do_c_quad, do_c_shift, do_c_ldst): Rework
	arguments to use new register parsing methods.
	(cirrus_reg_required_here): Likewise.
	(insns): Reclassify cirrus maverick worker functions.
	(cirrus_valid_reg): Delete.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: regscope.patch
Type: text/x-patch
Size: 59249 bytes
Desc: regscope.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20020109/b48e5048/attachment.bin>


More information about the Binutils mailing list