qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v8 29/35] Hexagon (target/hexagon) translation


From: Richard Henderson
Subject: Re: [PATCH v8 29/35] Hexagon (target/hexagon) translation
Date: Sun, 14 Feb 2021 17:03:54 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 2/7/21 9:46 PM, Taylor Simpson wrote:
> +static inline void ctx_log_reg_write(DisasContext *ctx, int rnum)

Drop the inline markup throughout.

> +static int read_packet_words(CPUHexagonState *env, DisasContext *ctx,
> +                             uint32_t words[])
> +{
> +    bool found_end = false;
> +    int nwords, max_words;
> +
> +    memset(words, 0, PACKET_WORDS_MAX * sizeof(uint32_t));
> +    for (nwords = 0; !found_end && nwords < PACKET_WORDS_MAX; nwords++) {
> +        words[nwords] = cpu_ldl_code(env,
> +                                ctx->base.pc_next + nwords * 
> sizeof(uint32_t));

translate_ldl, so that a plugin has access to the packet data.  (Note that
pkt_crosses_page is fine, because that's read-ahead, not reads for the current
packet.)

> +#if HEX_DEBUG
> +static inline void gen_check_store_width(DisasContext *ctx, int slot_num)
> +{
> +    TCGv slot = tcg_const_tl(slot_num);
> +    TCGv check = tcg_const_tl(ctx->store_width[slot_num]);
> +    gen_helper_debug_check_store_width(cpu_env, slot, check);
> +    tcg_temp_free(slot);
> +    tcg_temp_free(check);
> +}
> +#define HEX_DEBUG_GEN_CHECK_STORE_WIDTH(ctx, slot_num) \
> +    gen_check_store_width(ctx, slot_num)
> +#else
> +#define HEX_DEBUG_GEN_CHECK_STORE_WIDTH(ctx, slot_num)  /* nothing */
> +#endif

Fold this to a simple function call:

static void gen_check_store_width(...)
{
    if (HEX_DEBUG) {
       ....
    }
}

> +#if HEX_DEBUG
> +        /* When debugging, only put one packet per TB */
> +        ctx->base.is_jmp = DISAS_TOO_MANY;
> +#endif

Why?  You can always add -singlestep to the command-line.

> +    case DISAS_NORETURN:
> +        gen_exec_counters(ctx);
> +        tcg_gen_mov_tl(hex_gpr[HEX_REG_PC], hex_next_PC);
> +        if (ctx->base.singlestep_enabled) {
> +            gen_exception_debug();
> +        } else {
> +            tcg_gen_exit_tb(NULL, 0);
> +        }

DISAS_NORETURN says that we have *already* exited the TB.  None of the code you
emit here will be reachable.


r~



reply via email to

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