qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 08/48] tcg/optimize: Split out fold_call


From: Richard Henderson
Subject: Re: [PATCH v2 08/48] tcg/optimize: Split out fold_call
Date: Wed, 20 Oct 2021 19:04:15 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 10/20/21 9:05 AM, Alex Bennée wrote:

Richard Henderson <richard.henderson@linaro.org> writes:

Calls are special in that they have a variable number
of arguments, and need to be able to clobber globals.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
  tcg/optimize.c | 63 ++++++++++++++++++++++++++++++++------------------
  1 file changed, 41 insertions(+), 22 deletions(-)

diff --git a/tcg/optimize.c b/tcg/optimize.c
index fad6f5de1f..74b9aa025a 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -624,10 +624,42 @@ static void copy_propagate(OptContext *ctx, TCGOp *op,
      }
  }
+static bool fold_call(OptContext *ctx, TCGOp *op)
+{
+    TCGContext *s = ctx->tcg;
+    int nb_oargs = TCGOP_CALLO(op);
+    int nb_iargs = TCGOP_CALLI(op);
+    int flags, i;
+
+    init_arguments(ctx, op, nb_oargs + nb_iargs);
+    copy_propagate(ctx, op, nb_oargs, nb_iargs);
+
+    /* If the function reads or writes globals, reset temp data. */
+    flags = tcg_call_flags(op);
+    if (!(flags & (TCG_CALL_NO_READ_GLOBALS | TCG_CALL_NO_WRITE_GLOBALS))) {
+        int nb_globals = s->nb_globals;

Aren't we missing a trick here?

If the helper is going to read global registers we need to ensure any
temps holding their data is written but we don't need to throw the
existing temps away if the helper is TCG_CALL_NO_WRITE_GLOBALS?

Hmm, if NO_WRITE_GLOBALS, then yes, we should be able to preserve the information about the current contents. There must be some quirk, though; I just don't recall what it is. This patch preserves existing behaviour.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]