This is the mail archive of the
cgen@sourceware.org
mailing list for the CGEN project.
Re: generated decoder code question
- From: "Frank Ch. Eigler" <fche at redhat dot com>
- To: Chuan-Hua Chang <chuanhua dot chang at gmail dot com>
- Cc: cgen at sourceware dot org
- Date: Fri, 23 Mar 2007 07:30:53 -0400
- Subject: Re: generated decoder code question
- References: <aefe1a0f0703230140r69d7a493y9d0e24014534222b@mail.gmail.com>
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.
> 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?
- FChE