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

* Re: [RFA] Code gen improvement for sim-decode.scm
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Ch. Eigler @ 2000-12-06 17:36 UTC (permalink / raw)
  To: Ben Elliston; +Cc: CGEN

Hi -

On Wed, Dec 06, 2000 at 11:40:18PM +1100, Ben Elliston wrote:
: The following patch improves the generated extraction code -- such that an
: `insn' variable is not defined for instructions that have zero ifields.
: [...]

Are you convinced that nothing can possibly use that variable
except ifield extraction?  Is the improvement to generated code
merely the removal of a gcc warning?  (It should be able to
zap an unused variable, resulting in no performance difference.)

- FChE
-- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6LumRVZbdDOm/ZT0RAsT+AJ9jjaI6pCyUw7ASE3CppAUI6DmqHwCcCB2+
OeT+D/iC9Q1Xm1ePIvynAH4=
=06so
-----END PGP SIGNATURE-----

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

* Re: [RFA] Code gen improvement for sim-decode.scm
  2000-12-06 17:36 ` Frank Ch. Eigler
@ 2000-12-06 17:44   ` Ben Elliston
  0 siblings, 0 replies; 3+ messages in thread
From: Ben Elliston @ 2000-12-06 17:44 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: CGEN

   Are you convinced that nothing can possibly use that variable except
   ifield extraction?  Is the improvement to generated code merely the
   removal of a gcc warning?  (It should be able to zap an unused
   variable, resulting in no performance difference.)

Nothing else can use it because it's defined within block scope. Yes, the
improvement to generated code is to remove a GCC warning.

Ben

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