On Fri, Sep 18, 2026 at 4:09 PM Richard Henderson <
[email protected]> wrote:
>
> On 9/17/26 18:06, Yonggang Luo wrote:
> > > (1) Put the comment before the implementation, not the header.
> > > That avoids whatever you're concerned about vs patch 2.
> >
> > Indeed I tried, and I found basically all tcg's gen_ function have no
> > comment(detect by the auto-tools),
> > and it's parameter arg0 arg1 arg2 that can not understand at all; and
> > can not link to the impl
> > helper_* that defined as HELPEP(X) that makes me reading the tcg code
> > very hard.
>
> Ah, new-fangled tooling. Something I don't use.
I
>
> To me, the only thing that's interesting is the implementation.
> That is, helper_foo. The wrapper, gen_helper_foo is not interesting.
>
> Since I don't use it, I'm not sure what to suggest. Putting big block
> comments in what are essentially templates does not make much sense.
> Is there something the tooling can use to cross-reference the "real" code?
Using `clangd` can do that, any IDE along with clangd e Language Server
Protocol (LSP) will work with that.
>
> > > (2) Don't pass an extra argument that changes behavior like this.
> > > Better to have two separate functions, each doing one thing.
> >
> > how about gen_helper_raise_excp and gen_helper_raise_excp_restore
>
> Sure.
>
> > > (3) Maybe better to place the functions in cpu-exec-common.c, so that
> > > the compiler can see all the definitions at once.
> >
> > Do you mean do not use DEF_HELPER_FLAGS_3 at all?
> Absolutely not. I meant put helper_raise_excp* in cpu-exec-common.c
> instead of tcg-runtime.c.
Thanks, now I know how to go next,
void HELPER(raise_excp)(CPUArchState *env, uint32_t exception)
{
cpu_loop_exit_excp(env_cpu(env), exception, 0);
}
or
void helper_raise_excp(CPUArchState *env, uint32_t exception)
{
cpu_loop_exit_excp(env_cpu(env), exception, 0);
}
which I should use? I'll prefer HELPER(raise_excp)
>
>
> r~
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo