From: "Chuan-Hua Chang" <chuanhua.chang@gmail.com>
To: cgen@sourceware.org
Subject: generated decoder code question
Date: Fri, 23 Mar 2007 08:40:00 -0000 [thread overview]
Message-ID: <aefe1a0f0703230140r69d7a493y9d0e24014534222b@mail.gmail.com> (raw)
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.
next reply other threads:[~2007-03-23 8:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-23 8:40 Chuan-Hua Chang [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aefe1a0f0703230140r69d7a493y9d0e24014534222b@mail.gmail.com \
--to=chuanhua.chang@gmail.com \
--cc=cgen@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).