public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* [RFA] Code gen improvement for sim-decode.scm
@ 2000-12-06  4:40 Ben Elliston
  2000-12-06 17:36 ` Frank Ch. Eigler
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Elliston @ 2000-12-06  4:40 UTC (permalink / raw)
  To: CGEN

The following patch improves the generated extraction code -- such that an
`insn' variable is not defined for instructions that have zero ifields.

Comments?  Is there a better way to do this?

Ben


@@ -433,10 +433,13 @@
    " extract_" (gen-sym sfmt) ":\n"
    "  {\n"
    "    const IDESC *idesc = &" IDESC-TABLE-VAR "[itype];\n"
-   "    CGEN_INSN_INT insn = "
-   (if (adata-integral-insn? CURRENT-ARCH)
-       "entire_insn;\n"
-       "base_insn;\n")
+   (if (> (length (sfmt-iflds sfmt)) 0)
+       (string-append
+       "    CGEN_INSN_INT insn = "
+       (if (adata-integral-insn? CURRENT-ARCH)
+           "entire_insn;\n"
+           "base_insn;\n"))
+       "")
    (gen-define-field-macro sfmt)
    (gen-define-ifields (sfmt-iflds sfmt) (sfmt-length sfmt) "    " #f)
    "\n"

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

end of thread, other threads:[~2000-12-06 17:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-06  4:40 [RFA] Code gen improvement for sim-decode.scm Ben Elliston
2000-12-06 17:36 ` Frank Ch. Eigler
2000-12-06 17:44   ` Ben Elliston

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).