public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* generated decoder code question
@ 2007-03-23  8:40 Chuan-Hua Chang
  2007-03-23 11:31 ` Frank Ch. Eigler
  2007-03-23 13:02 ` Dave Brolley
  0 siblings, 2 replies; 5+ messages in thread
From: Chuan-Hua Chang @ 2007-03-23  8:40 UTC (permalink / raw)
  To: cgen

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
		     indent "    if (("
		     (if (adata-integral-insn? CURRENT-ARCH) "entire_insn" "base_insn")
		     " & 0x" (number->hex (insn-base-mask insn)) ") == 0x"
(number->hex (insn-value insn)) ")\n"
		     indent "      { itype = " (gen-cpu-insn-enum (current-cpu) insn) ";"
		     (if (with-scache?)
			 (if fn?
			     (string-append " @prefix@_extract_" fmt-name " (this,
current_cpu, pc, base_insn, entire_insn); goto done;")
			     (string-append " goto extract_" fmt-name ";"))
			 " goto done;")
		     " }\n"
		     indent "    " (-gen-decode-default-entry indent invalid-insn fn?)))))
)

It generates an IF-statement to check the opcode again inside the case
statement before doing the real extraction. This seems really
redundant and make the decoder inefficient.

I am wondering why this is needed here. Could someone help to explain
the reasoning?

When looking at the M32R decode function, the IF-statement is absent
from the decoder code.  This lets me wonder that if there is a way to
remove this redundant IF-statement check in the CGEN flow.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-03-26  5:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-23  8:40 generated decoder code question Chuan-Hua Chang
2007-03-23 11:31 ` Frank Ch. Eigler
2007-03-23 14:13   ` Dave Brolley
2007-03-26  5:50     ` Chuan-Hua Chang
2007-03-23 13:02 ` Dave Brolley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).