From: Eduardo Habkost <ehabkost@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org,
richard.henderson@linaro.org, Cleber Rosa <crosa@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH 1/4] scripts/decodetree.py: add a disassembly generator (HACK!)
Date: Fri, 10 Aug 2018 09:21:32 -0300 [thread overview]
Message-ID: <20180810122132.GN15372@localhost.localdomain> (raw)
In-Reply-To: <878t5eppm1.fsf@linaro.org>
On Fri, Aug 10, 2018 at 09:55:50AM +0100, Alex Bennée wrote:
>
> Eduardo Habkost <ehabkost@redhat.com> writes:
>
> > On Wed, Aug 08, 2018 at 01:39:31PM +0100, Alex Bennée wrote:
> >> Given our issues with failing disassembly we could try and re-use the
> >> decode tree data to output what instruction is being decoded. This
> >> will be used if registered as a fall-back for when the "proper"
> >> disassembler fails to decode an instruction.
> >>
> >> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> >
> > I don't have an opinion on the approach you are taking, but the
> > Python code you are adding is consistent with the existing style
> > of the script.
> >
> > That said, I find the existing code full of output() calls very
> > hard to read. If anybody wants to volunteer to improve the
> > readability of the output generation, it would be welcome.
>
> If we expect to have the script output a number of different forms I
> guess re-factoring it with some sort of template based approach would be
> worthwhile. I wonder if there are other examples in the code base? We
> wouldn't want to have multiple template types.
QAPI scripts also generates C code, and I find them more
readable[1].
I think a true template language would be even better than QAPI's
approach, but I don't see an obvious candidate that would be
worth adding another build dependency to QEMU.
[1] Compare:
def output_decl(self):
global translate_scope
global translate_prefix
output('typedef ', self.base.base.struct_name(),
' arg_', self.name, ';\n')
output(translate_scope, 'bool ', translate_prefix, '_', self.name,
'(DisasContext *ctx, arg_', self.name,
' *a, ', insntype, ' insn);\n')
And:
def gen_visit_members_decl(name):
return mcgen('''
void visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **errp);
''',
c_name=c_name(name))
--
Eduardo
next prev parent reply other threads:[~2018-08-10 12:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-08 12:39 [RFC PATCH 0/4] add hand-rolled fallback when capstone fails Alex Bennée
2018-08-08 12:39 ` [RFC PATCH 1/4] scripts/decodetree.py: add a disassembly generator (HACK!) Alex Bennée
2018-08-10 3:32 ` [Qemu-devel] " Eduardo Habkost
2018-08-10 8:55 ` Alex Bennée
2018-08-10 12:21 ` Eduardo Habkost [this message]
2018-08-08 12:39 ` [RFC PATCH 2/4] target/arm: move decoder helpers into header Alex Bennée
2018-08-08 12:39 ` [RFC PATCH 3/4] target/arm: add a fallback disassemble function Alex Bennée
2018-08-08 12:39 ` [RFC PATCH 4/4] disas: allow capstone to defer to a fallback function on failure Alex Bennée
2018-08-08 16:09 ` Alex Bennée
2018-08-15 10:15 ` [Qemu-devel] [RFC PATCH 0/4] add hand-rolled fallback when capstone fails no-reply
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=20180810122132.GN15372@localhost.localdomain \
--to=ehabkost@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=crosa@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 NNTP newsgroup(s).