On Tue, 8 Mar 2022 at 07:20, Richard Henderson
<richard.hender...@linaro.org> wrote:
>
> Constrain all references to cpu_R[] to load_gpr and dest_gpr.
> This will be required for supporting shadow register sets.
>
> Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
> ---
>  target/nios2/translate.c | 144 +++++++++++++++------------------------
>  1 file changed, 55 insertions(+), 89 deletions(-)



> @@ -449,15 +435,11 @@ static void rdctl(DisasContext *dc, uint32_t code, 
> uint32_t flags)
>      g_assert_not_reached();
>  #else
>      R_TYPE(instr, code);
> -    TCGv t1, t2;
> -
> -    if (unlikely(instr.c == R_ZERO)) {
> -        return;
> -    }
> +    TCGv t1, t2, dest = dest_gpr(dc, instr.c);
>
>      /* Reserved registers read as zero. */
>      if (nios2_cr_reserved(&dc->cr_state[instr.imm5])) {
> -        tcg_gen_movi_tl(cpu_R[instr.c], 0);
> +        tcg_gen_movi_tl(dest, 0);
>          return;
>      }

I assume the TCG dead-code elimination will mostly throw away the
write-to-R_ZERO stuff, but here for rdctl I suspect it won't.
But probably real code doesn't do that kind of silly thing.



Reviewed-by: Peter Maydell <peter.mayd...@linaro.org>

thanks
-- PMM

Reply via email to