mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
tcg: Move temp_idx and tcgv_i32_temp debug out of line
Removes a multiplicity of calls to __assert_fail, saving up to 360kiB of .text space as measured on an x86_64 host. Old New Less %Change 9257272 8888680 368592 3.98% qemu-system-aarch64 6100968 5911832 189136 3.10% qemu-system-riscv64 5839112 5707032 132080 2.26% qemu-system-mips 4447608 4341752 105856 2.38% qemu-system-s390x Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
d53106c997
commit
177f648f0e
2 changed files with 35 additions and 14 deletions
19
tcg/tcg.c
19
tcg/tcg.c
|
@ -1800,6 +1800,25 @@ TCGv_vec tcg_constant_vec_matching(TCGv_vec match, unsigned vece, int64_t val)
|
|||
return tcg_constant_vec(t->base_type, vece, val);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_TCG
|
||||
size_t temp_idx(TCGTemp *ts)
|
||||
{
|
||||
ptrdiff_t n = ts - tcg_ctx->temps;
|
||||
assert(n >= 0 && n < tcg_ctx->nb_temps);
|
||||
return n;
|
||||
}
|
||||
|
||||
TCGTemp *tcgv_i32_temp(TCGv_i32 v)
|
||||
{
|
||||
uintptr_t o = (uintptr_t)v - offsetof(TCGContext, temps);
|
||||
|
||||
assert(o < sizeof(TCGTemp) * tcg_ctx->nb_temps);
|
||||
assert(o % sizeof(TCGTemp) == 0);
|
||||
|
||||
return (void *)tcg_ctx + (uintptr_t)v;
|
||||
}
|
||||
#endif /* CONFIG_DEBUG_TCG */
|
||||
|
||||
/* Return true if OP may appear in the opcode stream.
|
||||
Test the runtime variable that controls each opcode. */
|
||||
bool tcg_op_supported(TCGOpcode op)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue