[patch][rfa]@arch@_cgen_ifld_table
Dave Brolley
brolley@redhat.com
Tue Feb 11 20:18:00 GMT 2003
Hi,
Stan Cox noticed the following when debugging a problem with one of our
internal ports. I've replaced the name of the port with '@arch@' and
'@ARCH@' below:
-------------------------------------------------------------------------
I notice that @arch@-opc.c defines:
#define F(f) & @arch@_cgen_ifld_table[@ARCH@_ ##f]
so it would seem as though the members of @arch@_cgen_ifld_table should
match those of enum ifield_type. However they do not always do so;
they seem to get out of sync for multi-ifields.
(@arch@-desc.c)
{ @ARCH@_F_CSRN_HI, "f-csrn-hi", 0, 32, 15, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
{ @ARCH@_F_CSRN_LO, "f-csrn-lo", 0, 32, 8, 4, { 0, { { { (1<<MACH_BASE), 0 } } } } },
{ @ARCH@_F_CRNX_HI, "f-crnx-hi", 0, 32, 28, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
{ @ARCH@_F_CRNX_LO, "f-crnx-lo", 0, 32, 4, 4, { 0, { { { (1<<MACH_BASE), 0 } } } } },
versus (@arch@-desc.h)
, @ARCH@_F_CSRN_HI, @ARCH@_F_CSRN_LO, @ARCH@_F_CSRN, @ARCH@_F_CRNX_HI
, @ARCH@_F_CRNX_LO, @ARCH@_F_CRNX, @ARCH@_F_0, @ARCH@_F_1
---------------------------------------------------------------------
As it turns out, gen-ifld-defns does explitictely omit VIRTUAL and
derived ifields when generating @arch@_cgen_ifld_table and
gen-maybe-multi-ifield expects them to be omitted when indexing the
table using ifld-number which generates hard coded indices. However,
Stan is correct that the generated macros 'F' index the table using the
enumerators and so require that all ifields be in the table in the
correct order.
The attached patch changes gen-maybe-multi-ifield to also index the
table using the enumerators (much cleaner) and adds the missing ifields
to the table. Note that some information is not available for the
additional fields (ifld-word-offset, ifld-word-length, ifld-start,
ifld-length) and zeroes are generated in these cases.
ifld-number is no longer used. Should it be removed?
I've also attached a diff of fr30-desc.c so you can see how the
generated code changes.
This has been tested on fr30 and on our internal port.
Seeking approval to commit.
Dave
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ifld_table.patch.txt
URL: <http://sourceware.org/pipermail/cgen/attachments/20030211/3e7ff625/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fr30.diff.txt
URL: <http://sourceware.org/pipermail/cgen/attachments/20030211/3e7ff625/attachment-0001.txt>
More information about the Cgen
mailing list