[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v1 05/43] tcg: Add helper function dispatcher and hook tc
From: |
Anton Johansson |
Subject: |
Re: [RFC PATCH v1 05/43] tcg: Add helper function dispatcher and hook tcg_gen_callN |
Date: |
Tue, 3 Dec 2024 19:45:23 +0100 |
On 22/11/24, Richard Henderson wrote:
> On 11/20/24 19:49, Anton Johansson wrote:
> > Adds a function pointer to the TCGContext which may be set by targets via
> > the TARGET_HELPER_DISPATCHER macro. The dispatcher is function
> >
> > (void *func, TCGTemp *ret, int nargs, TCGTemp **args) -> bool
> >
> > which allows targets to hook the generation of helper calls in TCG and
> > take over translation. Specifically, this will be used by helper-to-tcg
> > to replace helper function translation, without having to modify frontends.
> >
> > Signed-off-by: Anton Johansson <anjo@rev.ng>
> > ---
> > accel/tcg/translate-all.c | 4 ++++
> > include/tcg/tcg.h | 4 ++++
> > tcg/tcg.c | 5 +++++
> > 3 files changed, 13 insertions(+)
>
> I guess I'll have to read further to understand this, but my first reaction
> is: why would we not modify how the gen_helper_* functions are defined
> instead?
Hmm this might be a better idea, and we could call the generated could
directly without having to go through a massive switch statement. What
I have in mind is something like
#if !glue(OVERRIDE_HELPER_, name) \
#define DEF_HELPER_FLAGS_1(name, flags, ret, t1) \
extern TCGHelperInfo glue(helper_info_, name); \
static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \
dh_arg_decl(t1, 1)) \
{ \
tcg_gen_call1(glue(helper_info_,name).func, \
&glue(helper_info_,name), dh_retvar(ret), \
dh_arg(t1, 1)); \
} \
#endif
and we could emit gen_helper_* for helpers which are translated and
redefine OVERRIDE_HELPER_* to 1 (would have to be defaulted to 0
somewhere else).
//Anton
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [RFC PATCH v1 05/43] tcg: Add helper function dispatcher and hook tcg_gen_callN,
Anton Johansson <=