On 3/19/25 06:45, Philippe Mathieu-Daudé wrote:
Define TARGET_INSN_START_WORDS_MAX and use it to check
TARGET_INSN_START_EXTRA_WORDS at runtime in tb_gen_code().

Suggested-by: Peter Maydell <peter.mayd...@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
  include/tcg/tcg-op.h      | 4 +---
  include/tcg/tcg.h         | 2 ++
  accel/tcg/translate-all.c | 2 ++
  3 files changed, 5 insertions(+), 3 deletions(-)

Nack.

@@ -52,8 +52,6 @@ static inline void tcg_gen_insn_start(uint64_t pc, uint64_t 
a1, uint64_t a2)
      tcg_set_insn_start_param(op, 1, a1);
      tcg_set_insn_start_param(op, 2, a2);
  }
-#else
-#error Unhandled TARGET_INSN_START_EXTRA_WORDS value
  #endif

This is far superior to ...

@@ -351,6 +352,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
      tcg_ctx->tlb_dyn_max_bits = CPU_TLB_DYN_MAX_BITS;
  #endif
      tcg_ctx->insn_start_words = TARGET_INSN_START_WORDS;
+    tcg_debug_assert(tcg_ctx->insn_start_words <= TARGET_INSN_START_WORDS_MAX);

... this.


r~

Reply via email to