> > On 8/31/20 4:10 PM, Taylor Simpson wrote: > > > > > > > > >> -----Original Message----- > > >> From: Richard Henderson <richard.hender...@linaro.org> > > >> Sent: Monday, August 31, 2020 1:20 PM > > >> To: Taylor Simpson <tsimp...@quicinc.com>; qemu-devel@nongnu.org > > >> Cc: phi...@redhat.com; laur...@vivier.eu; riku.voi...@iki.fi; > > >> aleksandar.m.m...@gmail.com; a...@rev.ng > > >> Subject: Re: [RFC PATCH v3 30/34] Hexagon (target/hexagon) TCG for > > >> instructions with multiple definitions > > >> > > Ho hum. Maybe I'm trying to overthink this too much before tackling the > > ultimate goal of full parsing of the SHORTCODE. > > Perhaps the only thing for the short term is to have the generator grep > > genptr.c for "#define fGEN", to choose between the two alternatives: > inline > > generation or out-of-line helper generation. > > That's certainly doable. It will also be good to implement some of your other > ideas > - Have the generator expand the DECL/READ/WRITE/FREE macros will make > the generated code more readable and we can specialize them for > predicated vs non-predicated instructions which will make translation faster. > - Generate the entire generate_<tag> function instead of just the body will > make the generated code more readable.
I've made these changes to the generator. I hope you like the results. As an example, here is what we generate for the add instruction DEF_TCG_FUNC(A2_add, static void generate_A2_add( CPUHexagonState *env, DisasContext *ctx, insn_t *insn, packet_t *pkt) { TCGv RdV = tcg_temp_local_new(); const int RdN = insn->regno[0]; TCGv RsV = hex_gpr[insn->regno[1]]; TCGv RtV = hex_gpr[insn->regno[2]]; gen_helper_A2_add(RdV, cpu_env, RsV, RtV); gen_log_reg_write(RdN, RdV); ctx_log_reg_write(ctx, RdN); tcg_temp_free(RdV); }) And here is how the generated file gets used in genptr.c #define DEF_TCG_FUNC(TAG, GENFN) \ GENFN #include "tcg_funcs_generated.h" #undef DEF_TCG_FUNC /* * Not all opcodes have generate_<tag> functions, so initialize * the table from the tcg_funcs_generated.h file. */ const semantic_insn_t opcode_genptr[XX_LAST_OPCODE] = { #define DEF_TCG_FUNC(TAG, GENFN) \ [TAG] = generate_##TAG, #include "tcg_funcs_generated.h" #undef DEF_TCG_FUNC }; I've also addressed several of the items from Richard's review, so I'll resubmit the series once I figure out how to get "make check-tcg" working under meson. Thanks, Taylor