> -----Original Message----- > From: Alessandro Di Federico <ale.q...@rev.ng> > Sent: Thursday, April 15, 2021 11:35 AM > To: qemu-devel@nongnu.org > Cc: Taylor Simpson <tsimp...@quicinc.com>; Brian Cain > <bc...@quicinc.com>; bab...@rev.ng; ni...@rev.ng; phi...@redhat.com; > richard.hender...@linaro.org; Alessandro Di Federico <a...@rev.ng> > Subject: [PATCH v4 11/12] target/hexagon: call idef-parser functions > > From: Alessandro Di Federico <a...@rev.ng> > > Extend gen_tcg_funcs.py in order to emit calls to the functions emitted > by the idef-parser, if available. > > Signed-off-by: Alessandro Di Federico <a...@rev.ng> > --- > target/hexagon/gen_tcg_funcs.py | 28 ++++++++++++++++++++++++++-- > target/hexagon/hex_common.py | 10 ++++++++++ > target/hexagon/meson.build | 22 +++++++++++++--------- > 3 files changed, 49 insertions(+), 11 deletions(-) > > diff --git a/target/hexagon/gen_tcg_funcs.py > b/target/hexagon/gen_tcg_funcs.py > index db9f663a77..5980dab8ee 100755 > --- a/target/hexagon/gen_tcg_funcs.py > +++ b/target/hexagon/gen_tcg_funcs.py > @@ -394,7 +394,29 @@ def gen_tcg_func(f, tag, regs, imms): > if (hex_common.is_read(regid)): > genptr_src_read_opn(f,regtype,regid,tag) > > - if ( hex_common.skip_qemu_helper(tag) ): > + if hex_common.is_idef_parser_enabled(tag): > + declared = [] > + ## Handle registers > + for regtype,regid,toss,numregs in regs: > + if (hex_common.is_pair(regid) > + or (hex_common.is_single(regid) > + and hex_common.is_old_val(regtype, regid, tag))): > + declared.append("%s%sV" % (regtype, regid)) > + if regtype == "M": > + declared.append("%s%sN" % (regtype, regid)) > + elif hex_common.is_new_val(regtype, regid, tag): > + declared.append("%s%sN" % (regtype,regid)) > + else: > + print("Bad register parse: ",regtype,regid,toss,numregs) > + > + ## Handle immediates > + for immlett,bits,immshift in imms: > + declared.append(hex_common.imm_name(immlett)) > + > + arguments = ", ".join(["ctx", "insn", "pkt"] + declared) > + f.write(" emit_%s(%s);\n" % (tag, arguments)) > + > + elif ( hex_common.skip_qemu_helper(tag) ): > f.write(" fGEN_TCG_%s(%s);\n" % (tag, hex_common.semdict[tag])) > else: > ## Generate the call to the helper You should add the hex_common.is_idef_parser_enabled(tag) check to gen_helper_protos.py and gen_helper_funcs.py. Look for these lines in each of those files if ( hex_common.skip_qemu_helper(tag) ): continue If you add if ( hex_common.is_idef_parser_enabled(tag) ): continue that will greatly reduce the size of helper_protos_generated.c.inc and helper_funcs.c.inc. That will reduce the build time for the Hexagon target as well as the size of the qemu executable. You'll also need to modify the main function in each of those files and the corresponding invocation in meson.build to do the setup so the check does what you expect. Thanks, Taylor