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: Alex Bennée
Subject: Re: [PATCH v2 08/48] tcg/optimize: Split out fold_call
Date: Wed, 20 Oct 2021 17:05:41 +0100
User-agent: mu4e 1.7.0; emacs 28.0.60

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?

I guess we have to handle the case of temps that are about to get smahed
by the call though....

Otherwise:

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée



reply via email to

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