qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alessandro Di Federico <ale.qemu@rev.ng>
To: "qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>
Cc: "Taylor Simpson" <tsimpson@quicinc.com>,
	"Niccolò Izzo" <nizzo@rev.ng>,
	"Brian Cain" <bcain@codeaurora.org>
Subject: Simplifying the Hexagon frontend
Date: Mon, 18 May 2020 23:15:08 +0200	[thread overview]
Message-ID: <20200518231508.141b524f@orange> (raw)

Hi, this e-mail is intended to bootstrap a public discussion on how to
improve the Hexagon frontend implementation. At rev.ng, Niccolò and I,
developed an Hexagon frontend, and we're (finally!) joining forces with
the QuIC guys to merge our efforts (did you see our talk [1]?).

The status is as follows:

* QuIC has its own fully working implementation that has been submitted
  for review.
* We're working to integrate in their implementation our mechanism to
  automatically generate code to generate tiny code. But this will take
  some more work.

In the following, some initial considerations on how the latest
patchset could be simplified.

Here you can find a graph I've put together of the build process:

    https://rev.ng/downloads/qemu-hexagon/temporary/graph.svg
    https://rev.ng/downloads/qemu-hexagon/temporary/graph.dot

Colors indicate language.
Oval nodes are generated.
Rectangles are hand-written.

Taylor, I think some simplifications can be made to the process in order
to ease the review process.

* As far as I understand, from he "Source of Truth" set of files
  (`alu.idef`, `encode_pp.def`...), through `gen_semantics`, you
  generate `semantics_generated.pyinc`, which is then included by
  `do_qemu.py` script, which does the real job.

  I would suggest to keep `gen_semantics` and all its inputs
  out-of-tree. It increases complexity in a non-negligible way, while
  bringing a reduced benefit in terms of automation.

  I'd suggest replace `gen_semantics`'s output
  (`semantics_generated.pyinc`) with a human readable JSON file that
  could be manipulated by hand and is then parsed by `do_qemu.py`. I
  think JSON is more appropriate than generating executable python code
  that is then imported.

* I suggest to switch to the decoding approach developed by Richard.
  That would simplify the build process and reduce the code that has to
  be reviewed.
  I'm not 100% of the effort required to do this, maybe Richard can
  weigh on this.

* The current implementation can generate a helper function for each
  Hexagon instruction and, for a subset of instructions, it has an
  "override" mechanism to directly generate tiny code instructions
  corresponding to the semantics of the original instruction (i.e.,
  without using helpers).

  This override mechanism is implemented with the `fWRAP` macros. They
  have benefits, but they are quite convoluted. We should strive to
  minimize the number of macros and alternative macro implementations
  to what's strictly necessary in order to generate as much code as we
  can from the "Source of Truth", but no more than that.

  As a simpler override mechanism, we could use weak functions. But I
  think that, for simplicity, we should try to get in tree a simpler
  version of the frontend that relies exclusively on helper functions.
  It won't have optimal performances, but it will be fully functional.

  Later on, once our work for automatically generating functions
  generating tiny code is mature enough, we can extend the existing
  implementation with an appropriate override system.

In the meantime, we're setting up a Dockerfile based on Debian 10
providing a minimal C toolchain that we can use to automate testing.

Feedback is more than welcome.

-- 
Alessandro Di Federico
rev.ng

[1] https://www.youtube.com/watch?v=3EpnTYBOXCI


             reply	other threads:[~2020-05-18 21:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 21:15 Alessandro Di Federico [this message]
2020-05-19  2:41 ` Simplifying the Hexagon frontend Taylor Simpson
2020-05-22 16:44   ` Taylor Simpson

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=20200518231508.141b524f@orange \
    --to=ale.qemu@rev.ng \
    --cc=bcain@codeaurora.org \
    --cc=nizzo@rev.ng \
    --cc=qemu-devel@nongnu.org \
    --cc=tsimpson@quicinc.com \
    /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 NNTP newsgroup(s).