[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [RFC PATCH v3 25/34] Hexagon (target/hexagon) macros to interface wi
From: |
Taylor Simpson |
Subject: |
RE: [RFC PATCH v3 25/34] Hexagon (target/hexagon) macros to interface with the generator |
Date: |
Sun, 30 Aug 2020 21:20:27 +0000 |
> -----Original Message-----
> From: Richard Henderson <richard.henderson@linaro.org>
> Sent: Sunday, August 30, 2020 2:59 PM
> To: Taylor Simpson <tsimpson@quicinc.com>; qemu-devel@nongnu.org
> Cc: philmd@redhat.com; laurent@vivier.eu; riku.voipio@iki.fi;
> aleksandar.m.mail@gmail.com; ale@rev.ng
> Subject: Re: [RFC PATCH v3 25/34] Hexagon (target/hexagon) macros to
> interface with the generator
>
> On 8/30/20 1:30 PM, Taylor Simpson wrote:
> >
> >
> >> -----Original Message-----
> >> From: Richard Henderson <richard.henderson@linaro.org>
> >> Sent: Friday, August 28, 2020 6:49 PM
> >> To: Taylor Simpson <tsimpson@quicinc.com>; qemu-devel@nongnu.org
> >> Cc: philmd@redhat.com; laurent@vivier.eu; riku.voipio@iki.fi;
> >> aleksandar.m.mail@gmail.com; ale@rev.ng
> >> Subject: Re: [RFC PATCH v3 25/34] Hexagon (target/hexagon) macros to
> >> interface with the generator
> >>
> >> On 8/18/20 8:50 AM, Taylor Simpson wrote:
> >>> +#define DECL_REG(NAME, NUM, X, OFF) \
> >>> + TCGv NAME = tcg_temp_local_new(); \
> >>> + int NUM = REGNO(X) + OFF
> >>> +
> >>> +#define DECL_REG_WRITABLE(NAME, NUM, X, OFF) \
> >>> + TCGv NAME = tcg_temp_local_new(); \
> >>> + int NUM = REGNO(X) + OFF; \
> >>> + do { \
> >>> + int is_predicated = GET_ATTRIB(insn->opcode, A_CONDEXEC); \
> >>> + if (is_predicated && !is_preloaded(ctx, NUM)) { \
> >>> + tcg_gen_mov_tl(hex_new_value[NUM], hex_gpr[NUM]); \
> >>> + } \
> >>> + } while (0)
> >>> +/*
> >>> + * For read-only temps, avoid allocating and freeing
> >>> + */
> >>> +#define DECL_REG_READONLY(NAME, NUM, X, OFF) \
> >>> + TCGv NAME; \
> >>> + int NUM = REGNO(X) + OFF
> >>> +
> >>> +#define DECL_RREG_d(NAME, NUM, X, OFF) \
> >>> + DECL_REG_WRITABLE(NAME, NUM, X, OFF)
> >>> +#define DECL_RREG_e(NAME, NUM, X, OFF) \
> >>> + DECL_REG(NAME, NUM, X, OFF)
> >>
> >> Is there a good reason for all these macros?
> >> Why not just bake this knowledge into gen_tcg_funcs.py?
> >> Seems like it would be just a couple of functions...
> >>
> >> At present, both this and the intermediary files are unreadable. One has
> to
> >> pass genptr.c through -E and indent to see what's going on.
> >
> > I add the regid...
>
> No, that doesn't answer the question.
>
> Why does DECL_RREG_d et al exist as macros at all? Why not emit the
> expansions
> directly by gen_tcg_funcs.py?
>
> It seems to me that all this does is obfuscate the code, adding one more layer
> that one has to unwind in order to understand.
>
>
> r~
This is partly historical. My intent was to keep the generator simple and
mechanical and put the optimization and complexity into the macros. I will
code this up and see if we think it's better.
[RFC PATCH v3 20/34] Hexagon (target/hexagon) generator phase 1 - C preprocessor for semantics, Taylor Simpson, 2020/08/18
[RFC PATCH v3 28/34] Hexagon (target/hexagon) TCG generation helpers, Taylor Simpson, 2020/08/18
[RFC PATCH v3 29/34] Hexagon (target/hexagon) TCG generation, Taylor Simpson, 2020/08/18
[RFC PATCH v3 27/34] Hexagon (target/hexagon) instruction classes, Taylor Simpson, 2020/08/18