This is the mail archive of the cgen@sourceware.org mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: generated decoder code question


Frank Ch. Eigler wrote:

Hi -



In the utils-sim.scm file, the "-gen-decode-insn-entry" function has
the following lines:
; Generate code to check that all of the opcode bits for this insn match
[...]
It generates an IF-statement to check the opcode again inside the case
statement before doing the real extraction. This seems really
redundant




I believe that this check is done because the switch statement by
itself is not necessarily sufficient. The switch may simply
disambiguate the instructions (so no two candidate instructions fall
into the same switch case), but that could leave some additional
decodeable bits. Those bits would need to be tested to tell apart the
remaining candidate instruction from illegal opcodes.


This is correct. The switch only disambiguates the valid insns. Sometimes when a case has been reduced to only one insn, there are still some opcodes bits which have not been tested. In this case only, the additional test is generated.



and make the decoder inefficient.



Do you have a sense of how frequently such a test is completely
redundant, and how much additional time this test takes?


Please point out any cases where the test is not needed and I will see if I can eliminate it in those cases.

Thanks,
Dave


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]