* [PATCH] target/hexagon: Access `pkt/insn` through `ctx`
@ 2023-02-08 16:50 Anton Johansson via
2023-02-08 17:28 ` Philippe Mathieu-Daudé
2023-02-08 17:37 ` Taylor Simpson
0 siblings, 2 replies; 3+ messages in thread
From: Anton Johansson via @ 2023-02-08 16:50 UTC (permalink / raw)
To: qemu-devel; +Cc: ale, tsimpson, bcain, mlambert
In code emitted by idef-parser, access insn and pkt through DisasContext
instead of explicitly taking them as arguments.
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
target/hexagon/gen_tcg_funcs.py | 2 +-
target/hexagon/idef-parser/parser-helpers.c | 13 ++++++-------
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs.py
index 7e8ba17ca2..1d0ff29c5e 100755
--- a/target/hexagon/gen_tcg_funcs.py
+++ b/target/hexagon/gen_tcg_funcs.py
@@ -635,7 +635,7 @@ def gen_tcg_func(f, tag, regs, imms):
for immlett,bits,immshift in imms:
declared.append(hex_common.imm_name(immlett))
- arguments = ", ".join(["ctx", "ctx->insn", "ctx->pkt"] + declared)
+ arguments = ", ".join(["ctx"] + declared)
f.write(" emit_%s(%s);\n" % (tag, arguments))
elif ( hex_common.skip_qemu_helper(tag) ):
diff --git a/target/hexagon/idef-parser/parser-helpers.c b/target/hexagon/idef-parser/parser-helpers.c
index 8110686c51..3917c6ae89 100644
--- a/target/hexagon/idef-parser/parser-helpers.c
+++ b/target/hexagon/idef-parser/parser-helpers.c
@@ -189,7 +189,7 @@ void imm_print(Context *c, YYLTYPE *locp, HexImm *imm)
EMIT(c, "ctx->npc");
break;
case IMM_CONSTEXT:
- EMIT(c, "insn->extension_valid");
+ EMIT(c, "ctx->insn->extension_valid");
break;
default:
yyassert(c, locp, false, "Cannot print this expression!");
@@ -1822,8 +1822,7 @@ void gen_inst(Context *c, GString *iname)
c->inst.allocated = g_array_new(FALSE, FALSE, sizeof(Var));
c->inst.init_list = g_array_new(FALSE, FALSE, sizeof(HexValue));
c->inst.strings = g_array_new(FALSE, FALSE, sizeof(GString *));
- EMIT_SIG(c, "void emit_%s(DisasContext *ctx, Insn *insn, Packet *pkt",
- c->inst.name->str);
+ EMIT_SIG(c, "void emit_%s(DisasContext *ctx", c->inst.name->str);
}
@@ -1903,13 +1902,13 @@ void gen_pred_assign(Context *c, YYLTYPE *locp, HexValue *left_pred,
void gen_cancel(Context *c, YYLTYPE *locp)
{
- OUT(c, locp, "gen_cancel(insn->slot);\n");
+ OUT(c, locp, "gen_cancel(ctx->insn->slot);\n");
}
void gen_load_cancel(Context *c, YYLTYPE *locp)
{
gen_cancel(c, locp);
- OUT(c, locp, "if (insn->slot == 0 && pkt->pkt_has_store_s1) {\n");
+ OUT(c, locp, "if (ctx->insn->slot == 0 && ctx->pkt->pkt_has_store_s1) {\n");
OUT(c, locp, "ctx->s1_store_processed = false;\n");
OUT(c, locp, "process_store(ctx, 1);\n");
OUT(c, locp, "}\n");
@@ -1933,7 +1932,7 @@ void gen_load(Context *c, YYLTYPE *locp, HexValue *width,
snprintf(size_suffix, 4, "%" PRIu64, width->imm.value * 8);
/* Lookup the effective address EA */
find_variable(c, locp, ea, ea);
- OUT(c, locp, "if (insn->slot == 0 && pkt->pkt_has_store_s1) {\n");
+ OUT(c, locp, "if (ctx->insn->slot == 0 && ctx->pkt->pkt_has_store_s1) {\n");
OUT(c, locp, "probe_noshuf_load(", ea, ", ", width, ", ctx->mem_idx);\n");
OUT(c, locp, "process_store(ctx, 1);\n");
OUT(c, locp, "}\n");
@@ -1962,7 +1961,7 @@ void gen_store(Context *c, YYLTYPE *locp, HexValue *width, HexValue *ea,
find_variable(c, locp, ea, ea);
src_m = rvalue_materialize(c, locp, &src_m);
OUT(c, locp, "gen_store", &mem_width, "(cpu_env, ", ea, ", ", &src_m);
- OUT(c, locp, ", insn->slot);\n");
+ OUT(c, locp, ", ctx->insn->slot);\n");
gen_rvalue_free(c, locp, &src_m);
/* If the var in ea was truncated it is now a tmp HexValue, so free it. */
gen_rvalue_free(c, locp, ea);
--
2.39.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] target/hexagon: Access `pkt/insn` through `ctx`
2023-02-08 16:50 [PATCH] target/hexagon: Access `pkt/insn` through `ctx` Anton Johansson via
@ 2023-02-08 17:28 ` Philippe Mathieu-Daudé
2023-02-08 17:37 ` Taylor Simpson
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-08 17:28 UTC (permalink / raw)
To: Anton Johansson, qemu-devel; +Cc: ale, tsimpson, bcain, mlambert
On 8/2/23 17:50, Anton Johansson via wrote:
> In code emitted by idef-parser, access insn and pkt through DisasContext
> instead of explicitly taking them as arguments.
>
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
> target/hexagon/gen_tcg_funcs.py | 2 +-
> target/hexagon/idef-parser/parser-helpers.c | 13 ++++++-------
> 2 files changed, 7 insertions(+), 8 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] target/hexagon: Access `pkt/insn` through `ctx`
2023-02-08 16:50 [PATCH] target/hexagon: Access `pkt/insn` through `ctx` Anton Johansson via
2023-02-08 17:28 ` Philippe Mathieu-Daudé
@ 2023-02-08 17:37 ` Taylor Simpson
1 sibling, 0 replies; 3+ messages in thread
From: Taylor Simpson @ 2023-02-08 17:37 UTC (permalink / raw)
To: Anton Johansson, qemu-devel@nongnu.org
Cc: ale@rev.ng, Brian Cain, Michael Lambert
> -----Original Message-----
> From: Anton Johansson <anjo@rev.ng>
> Sent: Wednesday, February 8, 2023 10:51 AM
> To: qemu-devel@nongnu.org
> Cc: ale@rev.ng; Taylor Simpson <tsimpson@quicinc.com>; Brian Cain
> <bcain@quicinc.com>; Michael Lambert <mlambert@quicinc.com>
> Subject: [PATCH] target/hexagon: Access `pkt/insn` through `ctx`
>
> In code emitted by idef-parser, access insn and pkt through DisasContext
> instead of explicitly taking them as arguments.
>
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
> target/hexagon/gen_tcg_funcs.py | 2 +-
> target/hexagon/idef-parser/parser-helpers.c | 13 ++++++-------
> 2 files changed, 7 insertions(+), 8 deletions(-)
Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-08 17:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-08 16:50 [PATCH] target/hexagon: Access `pkt/insn` through `ctx` Anton Johansson via
2023-02-08 17:28 ` Philippe Mathieu-Daudé
2023-02-08 17:37 ` Taylor Simpson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).