tcg cleanup and optimization
PATCH 1/10 tcg: Optimize brcond2 and setcond2 ne/eq
In reply to Richard HendersonIf either the high or low pair can be resolved, we can simplify to either a constant or to a 32-bit comparison.
--- tcg/optimize.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+)
tcg/optimize.c +94 -0
@@ -859,6 +859,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,break ; CASE_OP_32_64(setcond): +case INDEX_op_setcond2_i32: mask =1 ;break ;
@@ -1193,11 +1194,13 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr, tmp =do_constant_folding_cond2 (&args[0 ], &args[2 ], args[4 ]);if (tmp !=2 ) {if (tmp) { + do_brcond_true:reset_all_temps (nb_temps); s->gen_opc_buf[op_index] = INDEX_op_br; gen_args[0 ] = args[5 ]; gen_args +=1 ; }else { + do_brcond_false: s->gen_opc_buf[op_index] = INDEX_op_nop; } } else if ((args[4] == TCG_COND_LT || args[4] == TCG_COND_GE)
@@ -1207,6 +1210,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr, && temps[args[3]].val == 0) {/* Simplify LT/GE comparisons vs zero to a single compare vs the high word of the input. */ + do_brcond_high:reset_all_temps (nb_temps); s->gen_opc_buf[op_index] = INDEX_op_brcond_i32; gen_args[0 ] = args[1 ];
@@ -1214,6 +1218,49 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr, gen_args[2 ] = args[4 ]; gen_args[3 ] = args[5 ]; gen_args +=4 ; + }else if (args[4 ] ==TCG_COND_EQ ) { +/* Simplify EQ comparisons where one of the pairs +can be simplified. */ + tmp =do_constant_folding_cond (INDEX_op_brcond_i32, + args[0 ], args[2 ],TCG_COND_EQ ); +if (tmp ==0 ) { + goto do_brcond_false; + }else if (tmp ==1 ) { + goto do_brcond_high; + } + tmp =do_constant_folding_cond (INDEX_op_brcond_i32, + args[1 ], args[3 ],TCG_COND_EQ ); +if (tmp ==0 ) { + goto do_brcond_false; + }else if (tmp !=1 ) { + goto do_default; + } + do_brcond_low: +reset_all_temps (nb_temps); + s->gen_opc_buf[op_index] = INDEX_op_brcond_i32; + gen_args[0 ] = args[0 ]; + gen_args[1 ] = args[2 ]; + gen_args[2 ] = args[4 ]; + gen_args[3 ] = args[5 ]; + gen_args +=4 ; + }else if (args[4 ] ==TCG_COND_NE ) { +/* Simplify NE comparisons where one of the pairs +can be simplified. */ + tmp =do_constant_folding_cond (INDEX_op_brcond_i32, + args[0 ], args[2 ],TCG_COND_NE ); +if (tmp ==0 ) { + goto do_brcond_high; + }else if (tmp ==1 ) { + goto do_brcond_true; + } + tmp =do_constant_folding_cond (INDEX_op_brcond_i32, + args[1 ], args[3 ],TCG_COND_NE ); +if (tmp ==0 ) { + goto do_brcond_low; + }else if (tmp ==1 ) { + goto do_brcond_true; + } + goto do_default; }else { goto do_default; }
@@ -1223,6 +1270,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,case INDEX_op_setcond2_i32: tmp =do_constant_folding_cond2 (&args[1 ], &args[3 ], args[5 ]);if (tmp !=2 ) { + do_setcond_const: s->gen_opc_buf[op_index] = INDEX_op_movi_i32;tcg_opt_gen_movi (gen_args, args[0 ], tmp); gen_args +=2 ;
@@ -1233,13 +1281,59 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr, && temps[args[4]].val == 0) {/* Simplify LT/GE comparisons vs zero to a single compare vs the high word of the input. */ + do_setcond_high: s->gen_opc_buf[op_index] = INDEX_op_setcond_i32;reset_temp (args[0 ]); + temps[args[0 ]].mask =1 ; gen_args[0 ] = args[0 ]; gen_args[1 ] = args[2 ]; gen_args[2 ] = args[4 ]; gen_args[3 ] = args[5 ]; gen_args +=4 ; + } else if (args[5] == TCG_COND_EQ) { +/* Simplify EQ comparisons where one of the pairs +can be simplified. */ + tmp =do_constant_folding_cond (INDEX_op_setcond_i32, + args[1 ], args[3 ],TCG_COND_EQ ); +if (tmp ==0 ) { + goto do_setcond_const; + }else if (tmp ==1 ) { + goto do_setcond_high; + } + tmp =do_constant_folding_cond (INDEX_op_setcond_i32, + args[2 ], args[4 ],TCG_COND_EQ ); +if (tmp ==0 ) { + goto do_setcond_high; + }else if (tmp !=1 ) { + goto do_default; + } + do_setcond_low: +reset_temp (args[0 ]); + temps[args[0 ]].mask =1 ; + s->gen_opc_buf[op_index] = INDEX_op_setcond_i32; + gen_args[0 ] = args[0 ]; + gen_args[1 ] = args[1 ]; + gen_args[2 ] = args[3 ]; + gen_args[3 ] = args[5 ]; + gen_args +=4 ; + } else if (args[5] == TCG_COND_NE) { +/* Simplify NE comparisons where one of the pairs +can be simplified. */ + tmp =do_constant_folding_cond (INDEX_op_setcond_i32, + args[1 ], args[3 ],TCG_COND_NE ); +if (tmp ==0 ) { + goto do_setcond_high; + }else if (tmp ==1 ) { + goto do_setcond_const; + } + tmp =do_constant_folding_cond (INDEX_op_setcond_i32, + args[2 ], args[4 ],TCG_COND_NE ); +if (tmp ==0 ) { + goto do_setcond_low; + }else if (tmp ==1 ) { + goto do_setcond_const; + } + goto do_default; } else { goto do_default; }
Signature · 1 line
1.9.0
cover tcg cleanup and optimization
Two unrelated changes here, but the first consists of only one patch and I'm too lazy to do two patch sets.
The first change improves code for 64-bit guests on 32-bit hosts. If we can prove that one half of a 64-bit comparison is constant, we can simplify to only comparing the other half. This is most common with zero-extended values such that 0:x == 0:y can be simplified to x == y.
The second change is a series of patches tidies the way helper.h is arranged. This cleanup reduces the number of files that must be recompiled when the old def-helper.h needed to be changed. In the process, it moves some data from arguments to tcg_callN into const static data within tcg.c. This change is a pre-requisite to being able to use libffi in the interpreter, but I think the cleanups are nice enough to justify separate inclusion.
r~
Richard Henderson (10):
tcg: Optimize brcond2 and setcond2 ne/eq
tcg: Invert the inclusion of helper.h
tcg: Push tcg-runtime routines into exec/helper-*
tcg: Use helper-gen.h in tcg-op.h
tcg: Inline tcg_gen_helperN
tcg: Move side effects out of dh_sizemask
tcg: Register the helper info struct rather than the name
tcg: Save flags and computed sizemask in TCGHelperInfo
tcg: Remove sizemask and flags arguments to tcg_gen_callN
tcg: Move size effects out of dh_arg
include/exec/def-helper.h | 274 ------------------------------------- include/exec/helper-gen.h | 70 ++++++++++ include/exec/helper-head.h | 134 ++++++++++++++++++ include/exec/helper-proto.h | 39 ++++++ include/exec/helper-tcg.h | 48 +++++++ target-alpha/fpu_helper.c | 2 +- target-alpha/helper.c | 2 +- target-alpha/helper.h | 4 - target-alpha/int_helper.c | 2 +- target-alpha/mem_helper.c | 2 +- target-alpha/sys_helper.c | 2 +- target-alpha/translate.c | 5 +- target-arm/crypto_helper.c | 2 +- target-arm/helper-a64.c | 2 +- target-arm/helper.c | 2 +- target-arm/helper.h | 4 - target-arm/iwmmxt_helper.c | 2 +- target-arm/neon_helper.c | 2 +- target-arm/op_helper.c | 2 +- target-arm/translate-a64.c | 5 +- target-arm/translate.c | 5 +- target-cris/helper.h | 4 - target-cris/op_helper.c | 2 +- target-cris/translate.c | 5 +- target-i386/cc_helper.c | 2 +- target-i386/excp_helper.c | 2 +- target-i386/fpu_helper.c | 2 +- target-i386/helper.h | 4 - target-i386/int_helper.c | 2 +- target-i386/mem_helper.c | 2 +- target-i386/misc_helper.c | 2 +- target-i386/seg_helper.c | 2 +- target-i386/smm_helper.c | 2 +- target-i386/svm_helper.c | 2 +- target-i386/translate.c | 5 +- target-lm32/helper.h | 4 - target-lm32/op_helper.c | 2 +- target-lm32/translate.c | 5 +- target-m68k/helper.c | 2 +- target-m68k/helper.h | 4 - target-m68k/op_helper.c | 2 +- target-m68k/translate.c | 5 +- target-microblaze/helper.h | 4 - target-microblaze/op_helper.c | 2 +- target-microblaze/translate.c | 6 +- target-mips/dsp_helper.c | 2 +- target-mips/helper.h | 6 - target-mips/lmi_helper.c | 2 +- target-mips/op_helper.c | 2 +- target-mips/translate.c | 5 +- target-moxie/helper.c | 2 +- target-moxie/helper.h | 4 - target-moxie/translate.c | 5 +- target-openrisc/exception_helper.c | 2 +- target-openrisc/fpu_helper.c | 2 +- target-openrisc/helper.h | 4 - target-openrisc/int_helper.c | 2 +- target-openrisc/interrupt_helper.c | 2 +- target-openrisc/sys_helper.c | 2 +- target-openrisc/translate.c | 5 +- target-ppc/excp_helper.c | 2 +- target-ppc/fpu_helper.c | 2 +- target-ppc/helper.h | 4 - target-ppc/int_helper.c | 2 +- target-ppc/mem_helper.c | 2 +- target-ppc/misc_helper.c | 2 +- target-ppc/mmu-hash32.c | 2 +- target-ppc/mmu-hash64.c | 2 +- target-ppc/mmu_helper.c | 2 +- target-ppc/timebase_helper.c | 2 +- target-ppc/translate.c | 5 +- target-s390x/cc_helper.c | 2 +- target-s390x/fpu_helper.c | 2 +- target-s390x/helper.h | 4 - target-s390x/int_helper.c | 2 +- target-s390x/mem_helper.c | 2 +- target-s390x/misc_helper.c | 2 +- target-s390x/translate.c | 5 +- target-sh4/helper.h | 4 - target-sh4/op_helper.c | 2 +- target-sh4/translate.c | 5 +- target-sparc/cc_helper.c | 2 +- target-sparc/fop_helper.c | 2 +- target-sparc/helper.c | 2 +- target-sparc/helper.h | 4 - target-sparc/int64_helper.c | 2 +- target-sparc/ldst_helper.c | 2 +- target-sparc/translate.c | 5 +- target-sparc/vis_helper.c | 2 +- target-sparc/win_helper.c | 2 +- target-unicore32/helper.c | 2 +- target-unicore32/helper.h | 3 - target-unicore32/op_helper.c | 2 +- target-unicore32/translate.c | 5 +- target-unicore32/ucf64_helper.c | 2 +- target-xtensa/helper.h | 4 - target-xtensa/op_helper.c | 2 +- target-xtensa/translate.c | 5 +- target-xtensa/xtensa-semi.c | 2 +- tcg-runtime.c | 40 ++++-- tcg/optimize.c | 94 +++++++++++++ tcg/tcg-op.h | 169 +++-------------------- tcg/tcg-runtime.h | 30 ++-- tcg/tcg.c | 50 +++---- tcg/tcg.h | 6 +- 105 files changed, 559 insertions(+), 668 deletions(-) delete mode 100644 include/exec/def-helper.h create mode 100644 include/exec/helper-gen.h create mode 100644 include/exec/helper-head.h create mode 100644 include/exec/helper-proto.h create mode 100644 include/exec/helper-tcg.h
Signature · 1 line
1.9.0
PATCH 2/10 tcg: Invert the inclusion of helper.h
Rather than include helper.h with N values of GEN_HELPER, include a secondary file that sets up the macros to include helper.h. This minimizes the files that must be rebuilt when changing the macros for file N.
---
include/exec/helper-gen.h | 92 +++++++++++++++++
include/exec/{def-helper.h => helper-head.h} | 144 +--------------------------
include/exec/helper-proto.h | 38 +++++++
include/exec/helper-tcg.h | 35 +++++++
target-alpha/fpu_helper.c | 2 +-
target-alpha/helper.c | 2 +-
target-alpha/helper.h | 4 -
target-alpha/int_helper.c | 2 +-
target-alpha/mem_helper.c | 2 +-
target-alpha/sys_helper.c | 2 +-
target-alpha/translate.c | 5 +-
target-arm/crypto_helper.c | 2 +-
target-arm/helper-a64.c | 2 +-
target-arm/helper.c | 2 +-
target-arm/helper.h | 4 -
target-arm/iwmmxt_helper.c | 2 +-
target-arm/neon_helper.c | 2 +-
target-arm/op_helper.c | 2 +-
target-arm/translate-a64.c | 5 +-
target-arm/translate.c | 5 +-
target-cris/helper.h | 4 -
target-cris/op_helper.c | 2 +-
target-cris/translate.c | 5 +-
target-i386/cc_helper.c | 2 +-
target-i386/excp_helper.c | 2 +-
target-i386/fpu_helper.c | 2 +-
target-i386/helper.h | 4 -
target-i386/int_helper.c | 2 +-
target-i386/mem_helper.c | 2 +-
target-i386/misc_helper.c | 2 +-
target-i386/seg_helper.c | 2 +-
target-i386/smm_helper.c | 2 +-
target-i386/svm_helper.c | 2 +-
target-i386/translate.c | 5 +-
target-lm32/helper.h | 4 -
target-lm32/op_helper.c | 2 +-
target-lm32/translate.c | 5 +-
target-m68k/helper.c | 2 +-
target-m68k/helper.h | 4 -
target-m68k/op_helper.c | 2 +-
target-m68k/translate.c | 5 +-
target-microblaze/helper.h | 4 -
target-microblaze/op_helper.c | 2 +-
target-microblaze/translate.c | 6 +-
target-mips/dsp_helper.c | 2 +-
target-mips/helper.h | 6 --
target-mips/lmi_helper.c | 2 +-
target-mips/op_helper.c | 2 +-
target-mips/translate.c | 5 +-
target-moxie/helper.c | 2 +-
target-moxie/helper.h | 4 -
target-moxie/translate.c | 5 +-
target-openrisc/exception_helper.c | 2 +-
target-openrisc/fpu_helper.c | 2 +-
target-openrisc/helper.h | 4 -
target-openrisc/int_helper.c | 2 +-
target-openrisc/interrupt_helper.c | 2 +-
target-openrisc/sys_helper.c | 2 +-
target-openrisc/translate.c | 5 +-
target-ppc/excp_helper.c | 2 +-
target-ppc/fpu_helper.c | 2 +-
target-ppc/helper.h | 4 -
target-ppc/int_helper.c | 2 +-
target-ppc/mem_helper.c | 2 +-
target-ppc/misc_helper.c | 2 +-
target-ppc/mmu-hash32.c | 2 +-
target-ppc/mmu-hash64.c | 2 +-
target-ppc/mmu_helper.c | 2 +-
target-ppc/timebase_helper.c | 2 +-
target-ppc/translate.c | 5 +-
target-s390x/cc_helper.c | 2 +-
target-s390x/fpu_helper.c | 2 +-
target-s390x/helper.h | 4 -
target-s390x/int_helper.c | 2 +-
target-s390x/mem_helper.c | 2 +-
target-s390x/misc_helper.c | 2 +-
target-s390x/translate.c | 5 +-
target-sh4/helper.h | 4 -
target-sh4/op_helper.c | 2 +-
target-sh4/translate.c | 5 +-
target-sparc/cc_helper.c | 2 +-
target-sparc/fop_helper.c | 2 +-
target-sparc/helper.c | 2 +-
target-sparc/helper.h | 4 -
target-sparc/int64_helper.c | 2 +-
target-sparc/ldst_helper.c | 2 +-
target-sparc/translate.c | 5 +-
target-sparc/vis_helper.c | 2 +-
target-sparc/win_helper.c | 2 +-
target-unicore32/helper.c | 2 +-
target-unicore32/helper.h | 3 -
target-unicore32/op_helper.c | 2 +-
target-unicore32/translate.c | 5 +-
target-unicore32/ucf64_helper.c | 2 +-
target-xtensa/helper.h | 4 -
target-xtensa/op_helper.c | 2 +-
target-xtensa/translate.c | 5 +-
target-xtensa/xtensa-semi.c | 2 +-
tcg/tcg.c | 7 +-
99 files changed, 264 insertions(+), 325 deletions(-)
create mode 100644 include/exec/helper-gen.h
rename include/exec/{def-helper.h => helper-head.h} (51%)
create mode 100644 include/exec/helper-proto.h
create mode 100644 include/exec/helper-tcg.hinclude/exec/helper-gen.h new file +92 -0
@@ -0,0 +1,92 @@ +/* Helper file for declaring TCG helper functions. +This one expands generation functions for tcg opcodes. */ + +#ifndef HELPER_GEN_H +#define HELPER_GEN_H 1 + +#include <exec/helper-head.h> + +#define DEF_HELPER_FLAGS_0 (name, flags, ret) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret)) \ +{ \ + int sizemask; \ + sizemask = dh_is_64bit(ret); \ + tcg_gen_helperN(HELPER(name), flags, sizemask, dh_retvar(ret), 0, NULL); \ +} + +#define DEF_HELPER_FLAGS_1 (name, flags, ret, t1) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1)) \ +{ \ + TCGArg args[1]; \ + int sizemask = 0; \ + dh_sizemask(ret, 0); \ + dh_arg(t1, 1); \ + tcg_gen_helperN(HELPER(name), flags, sizemask, dh_retvar(ret), 1, args); \ +} + +#define DEF_HELPER_FLAGS_2 (name, flags, ret, t1, t2) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1), \ + dh_arg_decl(t2, 2)) \ +{ \ + TCGArg args[2]; \ + int sizemask = 0; \ + dh_sizemask(ret, 0); \ + dh_arg(t1, 1); \ + dh_arg(t2, 2); \ + tcg_gen_helperN(HELPER(name), flags, sizemask, dh_retvar(ret), 2, args); \ +} + +#define DEF_HELPER_FLAGS_3 (name, flags, ret, t1, t2, t3) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1), \ + dh_arg_decl(t2, 2), dh_arg_decl(t3, 3)) \ +{ \ + TCGArg args[3]; \ + int sizemask = 0; \ + dh_sizemask(ret, 0); \ + dh_arg(t1, 1); \ + dh_arg(t2, 2); \ + dh_arg(t3, 3); \ + tcg_gen_helperN(HELPER(name), flags, sizemask, dh_retvar(ret), 3, args); \ +} + +#define DEF_HELPER_FLAGS_4 (name, flags, ret, t1, t2, t3, t4) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1), \ + dh_arg_decl(t2, 2), dh_arg_decl(t3, 3), dh_arg_decl(t4, 4)) \ +{ \ + TCGArg args[4]; \ + int sizemask = 0; \ + dh_sizemask(ret, 0); \ + dh_arg(t1, 1); \ + dh_arg(t2, 2); \ + dh_arg(t3, 3); \ + dh_arg(t4, 4); \ + tcg_gen_helperN(HELPER(name), flags, sizemask, dh_retvar(ret), 4, args); \ +} + +#define DEF_HELPER_FLAGS_5 (name, flags, ret, t1, t2, t3, t4, t5) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ + dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3), \ + dh_arg_decl(t4, 4), dh_arg_decl(t5, 5)) \ +{ \ + TCGArg args[5]; \ + int sizemask = 0; \ + dh_sizemask(ret, 0); \ + dh_arg(t1, 1); \ + dh_arg(t2, 2); \ + dh_arg(t3, 3); \ + dh_arg(t4, 4); \ + dh_arg(t5, 5); \ + tcg_gen_helperN(HELPER(name), flags, sizemask, dh_retvar(ret), 5, args); \ +} + +#include "helper.h" + +#undef DEF_HELPER_FLAGS_0 +#undef DEF_HELPER_FLAGS_1 +#undef DEF_HELPER_FLAGS_2 +#undef DEF_HELPER_FLAGS_3 +#undef DEF_HELPER_FLAGS_4 +#undef DEF_HELPER_FLAGS_5 +#undef GEN_HELPER + +#endif /* HELPER_GEN_H */
include/exec/helper-head.h renamed from include/exec/def-helper.h +1 -143
157 lines not on this page · raw message
include/exec/helper-proto.h new file +38 -0
@@ -0,0 +1,38 @@ +/* Helper file for declaring TCG helper functions. +This one expands prototypes for the helper functions. */ + +#ifndef HELPER_PROTO_H +#define HELPER_PROTO_H 1 + +#include <exec/helper-head.h> + +#define DEF_HELPER_FLAGS_0 (name, flags, ret) \ +dh_ctype(ret) HELPER(name) (void); + +#define DEF_HELPER_FLAGS_1 (name, flags, ret, t1) \ +dh_ctype(ret) HELPER(name) (dh_ctype(t1)); + +#define DEF_HELPER_FLAGS_2 (name, flags, ret, t1, t2) \ +dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2)); + +#define DEF_HELPER_FLAGS_3 (name, flags, ret, t1, t2, t3) \ +dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3)); + +#define DEF_HELPER_FLAGS_4 (name, flags, ret, t1, t2, t3, t4) \ +dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \ + dh_ctype(t4)); + +#define DEF_HELPER_FLAGS_5 (name, flags, ret, t1, t2, t3, t4, t5) \ +dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \ + dh_ctype(t4), dh_ctype(t5)); + +#include "helper.h" + +#undef DEF_HELPER_FLAGS_0 +#undef DEF_HELPER_FLAGS_1 +#undef DEF_HELPER_FLAGS_2 +#undef DEF_HELPER_FLAGS_3 +#undef DEF_HELPER_FLAGS_4 +#undef DEF_HELPER_FLAGS_5 + +#endif /* HELPER_PROTO_H */
include/exec/helper-tcg.h new file +35 -0
@@ -0,0 +1,35 @@ +/* Helper file for declaring TCG helper functions. +This one defines data structures private to tcg.c. */ + +#ifndef HELPER_TCG_H +#define HELPER_TCG_H 1 + +#include <exec/helper-head.h> + +#define DEF_HELPER_FLAGS_0 (name, flags, ret) { HELPER(name), #name }, + +#define DEF_HELPER_FLAGS_1 (name, flags, ret, t1) \ +DEF_HELPER_FLAGS_0(name, flags, ret) + +#define DEF_HELPER_FLAGS_2 (name, flags, ret, t1, t2) \ +DEF_HELPER_FLAGS_0(name, flags, ret) + +#define DEF_HELPER_FLAGS_3 (name, flags, ret, t1, t2, t3) \ +DEF_HELPER_FLAGS_0(name, flags, ret) + +#define DEF_HELPER_FLAGS_4 (name, flags, ret, t1, t2, t3, t4) \ +DEF_HELPER_FLAGS_0(name, flags, ret) + +#define DEF_HELPER_FLAGS_5 (name, flags, ret, t1, t2, t3, t4, t5) \ +DEF_HELPER_FLAGS_0(name, flags, ret) + +#include "helper.h" + +#undef DEF_HELPER_FLAGS_0 +#undef DEF_HELPER_FLAGS_1 +#undef DEF_HELPER_FLAGS_2 +#undef DEF_HELPER_FLAGS_3 +#undef DEF_HELPER_FLAGS_4 +#undef DEF_HELPER_FLAGS_5 + +#endif /* HELPER_TCG_H */
target-alpha/fpu_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "fpu/softfloat.h" #define FP_STATUS (env->fp_status)
target-alpha/helper.c +1 -1
@@ -23,7 +23,7 @@#include "cpu.h" #include "fpu/softfloat.h" -#include "helper.h" +#include "exec/helper-proto.h" uint64_t cpu_alpha_load_fpcr (CPUAlphaState *env) {
target-alpha/helper.h +0 -4
@@ -1,5 +1,3 @@ -#include "exec/def-helper.h" - DEF_HELPER_3(excp, noreturn, env, int, int)DEF_HELPER_FLAGS_1 (load_pcc,TCG_CALL_NO_RWG_SE , i64, env)
@@ -121,5 +119,3 @@ DEF_HELPER_FLAGS_0(get_vmtime, TCG_CALL_NO_RWG, i64) DEF_HELPER_FLAGS_0(get_walltime, TCG_CALL_NO_RWG, i64) DEF_HELPER_FLAGS_2(set_alarm, TCG_CALL_NO_RWG, void, env, i64)#endif - -#include "exec/def-helper.h"
target-alpha/int_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "qemu/host-utils.h"
target-alpha/mem_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" /* Softmmu support */
target-alpha/sys_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "sysemu/sysemu.h" #include "qemu/timer.h"
target-alpha/translate.c +2 -3
@@ -22,9 +22,8 @@#include "qemu/host-utils.h" #include "tcg-op.h" -#include "helper.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-proto.h" +#include "exec/helper-gen.h" #undef ALPHA_DEBUG_DISAS#define CONFIG_SOFTFLOAT_INLINE
target-arm/crypto_helper.c +1 -1
@@ -13,7 +13,7 @@#include "cpu.h" #include "exec/exec-all.h" -#include "helper.h" +#include "exec/helper-proto.h" union AES_STATE {uint8_t bytes[16 ];
target-arm/helper-a64.c +1 -1
@@ -19,7 +19,7 @@#include "cpu.h" #include "exec/gdbstub.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "qemu/host-utils.h" #include "sysemu/sysemu.h" #include "qemu/bitops.h"
target-arm/helper.c +1 -1
@@ -1,7 +1,7 @@#include "cpu.h" #include "internals.h" #include "exec/gdbstub.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "qemu/host-utils.h" #include "sysemu/arch_init.h" #include "sysemu/sysemu.h"
target-arm/helper.h +0 -4
@@ -1,5 +1,3 @@ -#include "exec/def-helper.h" - DEF_HELPER_FLAGS_1(clz, TCG_CALL_NO_RWG_SE, i32, i32) DEF_HELPER_FLAGS_1(sxtb16, TCG_CALL_NO_RWG_SE, i32, i32)DEF_HELPER_FLAGS_1 (uxtb16,TCG_CALL_NO_RWG_SE , i32, i32)
@@ -521,5 +519,3 @@ DEF_HELPER_2(dc_zva, void, env, i64)#ifdef TARGET_AARCH64 #include "helper-a64.h" #endif - -#include "exec/def-helper.h"
target-arm/iwmmxt_helper.c +1 -1
@@ -24,7 +24,7 @@#include "cpu.h" #include "exec/exec-all.h" -#include "helper.h" +#include "exec/helper-proto.h" /* iwMMXt macros extracted from GNU gdb. */
target-arm/neon_helper.c +1 -1
@@ -11,7 +11,7 @@#include "cpu.h" #include "exec/exec-all.h" -#include "helper.h" +#include "exec/helper-proto.h" #define SIGNBIT (uint32_t)0x80000000#define SIGNBIT64 ((uint64_t)1 << 63)
target-arm/op_helper.c +1 -1
@@ -17,7 +17,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "internals.h" #define SIGNBIT (uint32_t)0x80000000
target-arm/translate-a64.c +2 -3
@@ -31,9 +31,8 @@#include "exec/gen-icount.h" -#include "helper.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-proto.h" +#include "exec/helper-gen.h" static TCGv_i64 cpu_X[32 ];static TCGv_i64 cpu_pc;
target-arm/translate.c +2 -3
@@ -31,9 +31,8 @@#include "qemu/log.h" #include "qemu/bitops.h" -#include "helper.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-proto.h" +#include "exec/helper-gen.h" #define ENABLE_ARCH_4T arm_feature(env, ARM_FEATURE_V4T)#define ENABLE_ARCH_5 arm_feature(env, ARM_FEATURE_V5)
target-cris/helper.h +0 -4
@@ -1,5 +1,3 @@ -#include "exec/def-helper.h" - DEF_HELPER_2(raise_exception, void, env, i32) DEF_HELPER_2(tlb_flush_pid, void, env, i32)DEF_HELPER_2 (spc_write, void, env, i32)
@@ -25,5 +23,3 @@ DEF_HELPER_FLAGS_3(evaluate_flags_move_4, TCG_CALL_NO_SE, i32, env, i32, i32) DEF_HELPER_FLAGS_3(evaluate_flags_move_2, TCG_CALL_NO_SE, i32, env, i32, i32) DEF_HELPER_1(evaluate_flags, void, env)DEF_HELPER_1 (top_evaluate_flags, void, env) - -#include "exec/def-helper.h"
target-cris/op_helper.c +1 -1
@@ -20,7 +20,7 @@#include "cpu.h" #include "mmu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "qemu/host-utils.h" //#define CRIS_OP_HELPER_DEBUG
target-cris/translate.c +2 -3
@@ -26,12 +26,11 @@#include "cpu.h" #include "disas/disas.h" #include "tcg-op.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "mmu.h" #include "crisv32-decode.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-gen.h" #define DISAS_CRIS 0#if DISAS_CRIS
target-i386/cc_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" const uint8_t parity_table[256 ] = {CC_P ,0 ,0 ,CC_P ,0 ,CC_P ,CC_P ,0 ,
target-i386/excp_helper.c +1 -1
@@ -20,7 +20,7 @@#include "cpu.h" #include "qemu/log.h" #include "sysemu/sysemu.h" -#include "helper.h" +#include "exec/helper-proto.h" #if 0 #define raise_exception_err (env, a, b) \
target-i386/fpu_helper.c +1 -1
@@ -19,7 +19,7 @@#include <math.h> #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "qemu/aes.h" #include "qemu/host-utils.h"
target-i386/helper.h +0 -4
@@ -1,5 +1,3 @@ -#include "exec/def-helper.h" - DEF_HELPER_FLAGS_4(cc_compute_all, TCG_CALL_NO_RWG_SE, tl, tl, tl, tl, int)DEF_HELPER_FLAGS_4 (cc_compute_c,TCG_CALL_NO_RWG_SE , tl, tl, tl, tl, int)
@@ -219,5 +217,3 @@ DEF_HELPER_3(rcrl, tl, env, tl, tl) DEF_HELPER_3(rclq, tl, env, tl, tl) DEF_HELPER_3(rcrq, tl, env, tl, tl)#endif - -#include "exec/def-helper.h"
target-i386/int_helper.c +1 -1
@@ -19,7 +19,7 @@#include "cpu.h" #include "qemu/host-utils.h" -#include "helper.h" +#include "exec/helper-proto.h" //#define DEBUG_MULDIV
target-i386/mem_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #if !defined(CONFIG_USER_ONLY )#include "exec/softmmu_exec.h"
target-i386/misc_helper.c +1 -1
@@ -19,7 +19,7 @@#include "cpu.h" #include "exec/ioport.h" -#include "helper.h" +#include "exec/helper-proto.h" #if !defined(CONFIG_USER_ONLY )#include "exec/softmmu_exec.h"
target-i386/seg_helper.c +1 -1
@@ -20,7 +20,7 @@#include "cpu.h" #include "qemu/log.h" -#include "helper.h" +#include "exec/helper-proto.h" //#define DEBUG_PCALL
target-i386/smm_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" /* SMM support */
target-i386/svm_helper.c +1 -1
@@ -19,7 +19,7 @@#include "cpu.h" #include "exec/cpu-all.h" -#include "helper.h" +#include "exec/helper-proto.h" #if !defined(CONFIG_USER_ONLY )#include "exec/softmmu_exec.h"
target-i386/translate.c +2 -3
@@ -28,9 +28,8 @@#include "disas/disas.h" #include "tcg-op.h" -#include "helper.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-proto.h" +#include "exec/helper-gen.h" #define PREFIX_REPZ 0x01#define PREFIX_REPNZ 0x02
target-lm32/helper.h +0 -4
@@ -1,5 +1,3 @@ -#include "exec/def-helper.h" - DEF_HELPER_2(raise_exception, void, env, i32) DEF_HELPER_1(hlt, void, env)DEF_HELPER_3 (wcsr_bp, void, env, i32, i32)
@@ -14,5 +12,3 @@ DEF_HELPER_1(rcsr_ip, i32, env) DEF_HELPER_1(rcsr_jtx, i32, env) DEF_HELPER_1(rcsr_jrx, i32, env)DEF_HELPER_1 (ill, void, env) - -#include "exec/def-helper.h"
target-lm32/op_helper.c +1 -1
@@ -1,6 +1,6 @@#include <assert.h> #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "qemu/host-utils.h" #include "hw/lm32/lm32_pic.h"
target-lm32/translate.c +2 -3
@@ -19,13 +19,12 @@#include "cpu.h" #include "disas/disas.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "tcg-op.h" #include "hw/lm32/lm32_pic.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-gen.h" #define DISAS_LM32 1#if DISAS_LM32
target-m68k/helper.c +1 -1
@@ -21,7 +21,7 @@#include "cpu.h" #include "exec/gdbstub.h" -#include "helper.h" +#include "exec/helper-proto.h" #define SIGNBIT (1u << 31)
target-m68k/helper.h +0 -4
@@ -1,5 +1,3 @@ -#include "exec/def-helper.h" - DEF_HELPER_1(bitrev, i32, i32) DEF_HELPER_1(ff1, i32, i32)DEF_HELPER_2 (sats, i32, i32, i32)
@@ -50,5 +48,3 @@ DEF_HELPER_3(set_mac_extu, void, env, i32, i32) DEF_HELPER_2(flush_flags, void, env, i32)DEF_HELPER_2 (raise_exception, void, env, i32) - -#include "exec/def-helper.h"
target-m68k/op_helper.c +1 -1
@@ -17,7 +17,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #if defined(CONFIG_USER_ONLY )
target-m68k/translate.c +2 -3
@@ -23,9 +23,8 @@#include "tcg-op.h" #include "qemu/log.h" -#include "helper.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-proto.h" +#include "exec/helper-gen.h" //#define DEBUG_DISPATCH 1
target-microblaze/helper.h +0 -4
@@ -1,5 +1,3 @@ -#include "exec/def-helper.h" - DEF_HELPER_2(raise_exception, void, env, i32) DEF_HELPER_1(debug, void, env)DEF_HELPER_FLAGS_3 (carry,TCG_CALL_NO_RWG_SE , i32, i32, i32, i32)
@@ -37,5 +35,3 @@ DEF_HELPER_2(stackprot, void, env, i32) DEF_HELPER_2(get, i32, i32, i32)DEF_HELPER_3 (put, void, i32, i32, i32) - -#include "exec/def-helper.h"
target-microblaze/op_helper.c +1 -1
@@ -20,7 +20,7 @@#include <assert.h> #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "qemu/host-utils.h" #define D (x)
target-microblaze/translate.c +2 -4
@@ -21,11 +21,9 @@#include "cpu.h" #include "disas/disas.h" #include "tcg-op.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "microblaze-decode.h" - -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-gen.h" #define SIM_COMPAT 0#define DISAS_GNU 1
target-mips/dsp_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "qemu/bitops.h" /* As the byte ordering doesn't matter, i.e. all columns are treated
target-mips/helper.h +0 -6
@@ -1,5 +1,3 @@ -#include "exec/def-helper.h" - DEF_HELPER_3(raise_exception_err, noreturn, env, i32, int)DEF_HELPER_2 (raise_exception, noreturn, env, i32)
@@ -691,7 +689,3 @@ DEF_HELPER_FLAGS_3(dmthlip, 0, void, tl, tl, env)#endif DEF_HELPER_FLAGS_3(wrdsp, 0, void, tl, tl, env)DEF_HELPER_FLAGS_2 (rddsp,0 , tl, tl, env) - - - -#include "exec/def-helper.h"
target-mips/lmi_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" /* If the byte ordering doesn't matter, i.e. all columns are treated identically, then this union can be used directly. If byte ordering
target-mips/op_helper.c +1 -1
@@ -20,7 +20,7 @@#include "cpu.h" #include "qemu/host-utils.h" -#include "helper.h" +#include "exec/helper-proto.h" #if !defined(CONFIG_USER_ONLY )#include "exec/softmmu_exec.h"
target-mips/translate.c +2 -3
@@ -25,9 +25,8 @@#include "disas/disas.h" #include "tcg-op.h" -#include "helper.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-proto.h" +#include "exec/helper-gen.h" #define MIPS_DEBUG_DISAS 0//#define MIPS_DEBUG_SIGN_EXTENSIONS
target-moxie/helper.c +1 -1
@@ -27,7 +27,7 @@#include "exec/exec-all.h" #include "exec/softmmu_exec.h" #include "qemu/host-utils.h" -#include "helper.h" +#include "exec/helper-proto.h" #define MMUSUFFIX _mmu
target-moxie/helper.h +0 -4
@@ -1,9 +1,5 @@ -#include "exec/def-helper.h" - DEF_HELPER_2(raise_exception, void, env, int) DEF_HELPER_1(debug, void, env) DEF_HELPER_FLAGS_3(div, TCG_CALL_NO_WG, i32, env, i32, i32)DEF_HELPER_FLAGS_3 (udiv,TCG_CALL_NO_WG , i32, env, i32, i32) - -#include "exec/def-helper.h"
target-moxie/translate.c +2 -3
@@ -33,9 +33,8 @@#include "disas/disas.h" #include "tcg-op.h" -#include "helper.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-proto.h" +#include "exec/helper-gen.h" /* This is the state at translation time. */ typedef struct DisasContext {
target-openrisc/exception_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "exception.h" void HELPER (exception )(CPUOpenRISCState *env,uint32_t excp)
target-openrisc/fpu_helper.c +1 -1
@@ -19,7 +19,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "exception.h" static inline uint32_t ieee_ex_to_openrisc (OpenRISCCPU *cpu,int fexcp)
target-openrisc/helper.h +0 -4
@@ -17,8 +17,6 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#include "exec/def-helper.h" -/* exception */ DEF_HELPER_FLAGS_2 (exception,0 , void, env, i32)
@@ -66,5 +64,3 @@ DEF_HELPER_FLAGS_1(rfe, 0, void, env)/* sys */ DEF_HELPER_FLAGS_4(mtspr, 0, void, env, tl, tl, tl)DEF_HELPER_FLAGS_4 (mfspr,0 , tl, env, tl, tl, tl) - -#include "exec/def-helper.h"
target-openrisc/int_helper.c +1 -1
@@ -19,7 +19,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "exception.h" #include "qemu/host-utils.h"
target-openrisc/interrupt_helper.c +1 -1
@@ -19,7 +19,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" void HELPER (rfe )(CPUOpenRISCState *env) {
target-openrisc/sys_helper.c +1 -1
@@ -19,7 +19,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #define TO_SPR (group, number) (((group) << 11) + (number))
target-openrisc/translate.c +2 -3
@@ -27,9 +27,8 @@#include "config.h" #include "qemu/bitops.h" -#include "helper.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-proto.h" +#include "exec/helper-gen.h" #define OPENRISC_DISAS
target-ppc/excp_helper.c +1 -1
@@ -17,7 +17,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "helper_regs.h"
target-ppc/fpu_helper.c +1 -1
@@ -17,7 +17,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" /*****************************************************************************/ /* Floating point operations helpers */
target-ppc/helper.h +0 -4
@@ -1,5 +1,3 @@ -#include "exec/def-helper.h" - DEF_HELPER_3(raise_exception_err, void, env, i32, i32) DEF_HELPER_2(raise_exception, void, env, i32)DEF_HELPER_4 (tw, void, env, tl, tl, i32)
@@ -613,5 +611,3 @@ DEF_HELPER_3(store_dbatu, void, env, i32, tl) DEF_HELPER_3(store_601_batl, void, env, i32, tl) DEF_HELPER_3(store_601_batu, void, env, i32, tl)#endif - -#include "exec/def-helper.h"
target-ppc/int_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" #include "qemu/host-utils.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "helper_regs.h" /*****************************************************************************/
target-ppc/mem_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" #include "qemu/host-utils.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "helper_regs.h"
target-ppc/misc_helper.c +1 -1
@@ -17,7 +17,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "helper_regs.h"
target-ppc/mmu-hash32.c +1 -1
@@ -19,7 +19,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "sysemu/kvm.h" #include "kvm_ppc.h" #include "mmu-hash32.h"
target-ppc/mmu-hash64.c +1 -1
@@ -18,7 +18,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "sysemu/kvm.h" #include "kvm_ppc.h" #include "mmu-hash64.h"
target-ppc/mmu_helper.c +1 -1
@@ -17,7 +17,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "sysemu/kvm.h" #include "kvm_ppc.h" #include "mmu-hash64.h"
target-ppc/timebase_helper.c +1 -1
@@ -17,7 +17,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" /*****************************************************************************/ /* SPR accesses */
target-ppc/translate.c +2 -3
@@ -23,9 +23,8 @@#include "tcg-op.h" #include "qemu/host-utils.h" -#include "helper.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-proto.h" +#include "exec/helper-gen.h" #define CPU_SINGLE_STEP 0x1#define CPU_BRANCH_STEP 0x2
target-s390x/cc_helper.c +1 -1
@@ -19,7 +19,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "qemu/host-utils.h" /* #define DEBUG_HELPER */
target-s390x/fpu_helper.c +1 -1
@@ -19,7 +19,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #if !defined(CONFIG_USER_ONLY )#include "exec/softmmu_exec.h"
target-s390x/helper.h +0 -4
@@ -1,5 +1,3 @@ -#include "exec/def-helper.h" - DEF_HELPER_2(exception, noreturn, env, i32) DEF_HELPER_FLAGS_4(nc, TCG_CALL_NO_WG, i32, env, i32, i64, i64)DEF_HELPER_FLAGS_4 (oc,TCG_CALL_NO_WG , i32, env, i32, i64, i64)
@@ -115,5 +113,3 @@ DEF_HELPER_FLAGS_1(ptlb, TCG_CALL_NO_RWG, void, env) DEF_HELPER_2(lra, i64, env, i64) DEF_HELPER_FLAGS_3(stura, TCG_CALL_NO_WG, void, env, i64, i64)#endif - -#include "exec/def-helper.h"
target-s390x/int_helper.c +1 -1
@@ -20,7 +20,7 @@#include "cpu.h" #include "qemu/host-utils.h" -#include "helper.h" +#include "exec/helper-proto.h" /* #define DEBUG_HELPER */ #ifdef DEBUG_HELPER
target-s390x/mem_helper.c +1 -1
@@ -19,7 +19,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" /*****************************************************************************/ /* Softmmu support */
target-s390x/misc_helper.c +1 -1
@@ -21,7 +21,7 @@#include "cpu.h" #include "exec/memory.h" #include "qemu/host-utils.h" -#include "helper.h" +#include "exec/helper-proto.h" #include <string.h> #include "sysemu/kvm.h" #include "qemu/timer.h"
target-s390x/translate.c +2 -3
@@ -38,9 +38,8 @@static TCGv_ptr cpu_env;#include "exec/gen-icount.h" -#include "helper.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-proto.h" +#include "exec/helper-gen.h" /* Information that (most) every instruction needs to manipulate. */
target-sh4/helper.h +0 -4
@@ -1,5 +1,3 @@ -#include "exec/def-helper.h" - DEF_HELPER_1(ldtlb, void, env) DEF_HELPER_1(raise_illegal_instruction, noreturn, env)DEF_HELPER_1 (raise_slot_illegal_instruction, noreturn, env)
@@ -46,5 +44,3 @@ DEF_HELPER_2(ftrc_FT, i32, env, f32) DEF_HELPER_2(ftrc_DT, i32, env, f64) DEF_HELPER_3(fipr, void, env, i32, i32)DEF_HELPER_2 (ftrv, void, env, i32) - -#include "exec/def-helper.h"
target-sh4/op_helper.c +1 -1
@@ -19,7 +19,7 @@#include <assert.h> #include <stdlib.h> #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #ifndef CONFIG_USER_ONLY #include "exec/softmmu_exec.h"
target-sh4/translate.c +2 -3
@@ -24,9 +24,8 @@#include "disas/disas.h" #include "tcg-op.h" -#include "helper.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-proto.h" +#include "exec/helper-gen.h" typedef struct DisasContext { struct TranslationBlock *tb;
target-sparc/cc_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" static uint32_t compute_all_flags (CPUSPARCState *env) {
target-sparc/fop_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #define QT0 (env->qt0)#define QT1 (env->qt1)
target-sparc/helper.c +1 -1
@@ -19,7 +19,7 @@#include "cpu.h" #include "qemu/host-utils.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "sysemu/sysemu.h" void helper_raise_exception (CPUSPARCState *env,int tt)
target-sparc/helper.h +0 -4
@@ -1,5 +1,3 @@ -#include "exec/def-helper.h" -#ifndef TARGET_SPARC64 DEF_HELPER_1(rett, void, env)DEF_HELPER_2 (wrpsr, void, env, tl)
@@ -175,5 +173,3 @@ VIS_CMPHELPER(cmpne)#undef VIS_CMPHELPER DEF_HELPER_1(compute_psr, void, env)DEF_HELPER_1 (compute_C_icc, i32, env) - -#include "exec/def-helper.h"
target-sparc/int64_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "trace.h" #define DEBUG_PCALL
target-sparc/ldst_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" //#define DEBUG_MMU //#define DEBUG_MXCC
target-sparc/translate.c +2 -3
@@ -26,11 +26,10 @@#include "cpu.h" #include "disas/disas.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "tcg-op.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-gen.h" #define DEBUG_DISAS
target-sparc/vis_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" /* This function uses non-native bit order */ #define GET_FIELD (X ,FROM ,TO ) \
target-sparc/win_helper.c +1 -1
@@ -18,7 +18,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "trace.h" static inline void memcpy32 (target_ulong *dst,const target_ulong *src)
target-unicore32/helper.c +1 -1
@@ -11,7 +11,7 @@#include "cpu.h" #include "exec/gdbstub.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "qemu/host-utils.h" #ifndef CONFIG_USER_ONLY #include "ui/console.h"
target-unicore32/helper.h +0 -3
@@ -6,7 +6,6 @@* published by the Free Software Foundation, or (at your option) any * later version. See the COPYING file in the top-level directory. */ -#include "exec/def-helper.h" #ifndef CONFIG_USER_ONLY DEF_HELPER_4 (cp0_set, void, env, i32, i32, i32)
@@ -64,5 +63,3 @@ DEF_HELPER_2(ucf64_si2df, f64, f32, env) DEF_HELPER_2(ucf64_sf2si, f32, f32, env)DEF_HELPER_2 (ucf64_df2si, f32, f64, env) - -#include "exec/def-helper.h"
target-unicore32/op_helper.c +1 -1
@@ -9,7 +9,7 @@* later version. See the COPYING file in the top-level directory. */ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #define SIGNBIT (uint32_t)0x80000000#define SIGNBIT64 ((uint64_t)1 << 63)
target-unicore32/translate.c +2 -3
@@ -19,9 +19,8 @@#include "tcg-op.h" #include "qemu/log.h" -#include "helper.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-proto.h" +#include "exec/helper-gen.h" /* internal defines */ typedef struct DisasContext {
target-unicore32/ucf64_helper.c +1 -1
@@ -9,7 +9,7 @@* See the COPYING file in the top-level directory. */ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" /* * The convention used for UniCore-F64 instructions:
target-xtensa/helper.h +0 -4
@@ -1,5 +1,3 @@ -#include "exec/def-helper.h" - DEF_HELPER_2(exception, noreturn, env, i32) DEF_HELPER_3(exception_cause, noreturn, env, i32, i32)DEF_HELPER_4 (exception_cause_vaddr, noreturn, env, i32, i32, i32)
@@ -58,5 +56,3 @@ DEF_HELPER_4(olt_s, void, env, i32, f32, f32) DEF_HELPER_4(ult_s, void, env, i32, f32, f32) DEF_HELPER_4(ole_s, void, env, i32, f32, f32)DEF_HELPER_4 (ule_s, void, env, i32, f32, f32) - -#include "exec/def-helper.h"
target-xtensa/op_helper.c +1 -1
@@ -26,7 +26,7 @@*/ #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "qemu/host-utils.h" #include "exec/softmmu_exec.h" #include "exec/address-spaces.h"
target-xtensa/translate.c +2 -3
@@ -37,9 +37,8 @@#include "qemu/log.h" #include "sysemu/sysemu.h" -#include "helper.h" -#define GEN_HELPER 1 -#include "helper.h" +#include "exec/helper-proto.h" +#include "exec/helper-gen.h" typedef struct DisasContext { const XtensaConfig *config;
target-xtensa/xtensa-semi.c +1 -1
@@ -30,7 +30,7 @@#include <string.h> #include <stddef.h> #include "cpu.h" -#include "helper.h" +#include "exec/helper-proto.h" #include "qemu/log.h" enum {
tcg/tcg.c +3 -4
@@ -307,16 +307,15 @@ void tcg_pool_reset(TCGContext *s) s->pool_current =NULL ; } -#include "helper.h" -typedef struct TCGHelperInfo {void *func;const char *name; }TCGHelperInfo ; +#include "exec/helper-proto.h" +static const TCGHelperInfo all_helpers[] = { -#define GEN_HELPER 2 -#include "helper.h" +#include "exec/helper-tcg.h"/* Include tcg-runtime.c functions. */ { tcg_helper_div_i32,"div_i32" },
Signature · 1 line
1.9.0
PATCH 3/10 tcg: Push tcg-runtime routines into exec/helper-*
In reply to Richard HendersonRather than special casing them, use the standard mechanisms for tcg helper generation.
--- include/exec/helper-gen.h | 1 + include/exec/helper-head.h | 12 ++++++++---- include/exec/helper-proto.h | 1 + include/exec/helper-tcg.h | 1 + tcg-runtime.c | 40 +++++++++++++++++++++++++--------------- tcg/tcg-op.h | 35 ++++++++++++++++++----------------- tcg/tcg-runtime.h | 30 +++++++++++++----------------- tcg/tcg.c | 16 ---------------- tcg/tcg.h | 2 -- 9 files changed, 67 insertions(+), 71 deletions(-)
include/exec/helper-gen.h +1 -0
@@ -80,6 +80,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ }#include "helper.h" +#include "tcg-runtime.h" #undef DEF_HELPER_FLAGS_0#undef DEF_HELPER_FLAGS_1
include/exec/helper-head.h +8 -4
@@ -18,6 +18,8 @@#ifndef DEF_HELPER_H #define DEF_HELPER_H 1 +#include "qemu/osdep.h" +#define HELPER (name) glue(helper_, name)#define GET_TCGV_i32 GET_TCGV_I32
@@ -32,10 +34,12 @@#define dh_alias_s64 i64#define dh_alias_f32 i32#define dh_alias_f64 i64 -#if TARGET_LONG_BITS ==32 -#define dh_alias_tl i32 -#else -#define dh_alias_tl i64 +#ifdef TARGET_LONG_BITS +# if TARGET_LONG_BITS ==32 +# define dh_alias_tl i32 +# else +# define dh_alias_tl i64 +# endif #endif #define dh_alias_ptr ptr#define dh_alias_void void
include/exec/helper-proto.h +1 -0
@@ -27,6 +27,7 @@ dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \ dh_ctype(t4), dh_ctype(t5));#include "helper.h" +#include "tcg-runtime.h" #undef DEF_HELPER_FLAGS_0#undef DEF_HELPER_FLAGS_1
include/exec/helper-tcg.h +1 -0
@@ -24,6 +24,7 @@ DEF_HELPER_FLAGS_0(name, flags, ret) DEF_HELPER_FLAGS_0(name, flags, ret)#include "helper.h" +#include "tcg-runtime.h" #undef DEF_HELPER_FLAGS_0#undef DEF_HELPER_FLAGS_1
tcg-runtime.c +25 -15
@@ -23,75 +23,85 @@*/ #include <stdint.h> #include "qemu/host-utils.h" -#include "tcg/tcg-runtime.h" + +/* This file is compiled once, and thus we can't include the standard +"exec/helper-proto.h", which has includes that are target specific. */ + +#include "exec/helper-head.h" + +#define DEF_HELPER_FLAGS_2 (name, flags, ret, t1, t2) \ + dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2)); + +#include "tcg-runtime.h" +/* 32-bit helpers */ -int32_t tcg_helper_div_i32 (int32_t arg1,int32_t arg2) +int32_t HELPER (div_i32 )(int32_t arg1,int32_t arg2) {return arg1 / arg2; } -int32_t tcg_helper_rem_i32 (int32_t arg1,int32_t arg2) +int32_t HELPER (rem_i32 )(int32_t arg1,int32_t arg2) {return arg1 % arg2; } -uint32_t tcg_helper_divu_i32 (uint32_t arg1,uint32_t arg2) +uint32_t HELPER (divu_i32 )(uint32_t arg1,uint32_t arg2) {return arg1 / arg2; } -uint32_t tcg_helper_remu_i32 (uint32_t arg1,uint32_t arg2) +uint32_t HELPER (remu_i32 )(uint32_t arg1,uint32_t arg2) {return arg1 % arg2; }/* 64-bit helpers */ -int64_t tcg_helper_shl_i64 (int64_t arg1,int64_t arg2) +uint64_t HELPER (shl_i64 )(uint64_t arg1,uint64_t arg2) {return arg1 << arg2; } -int64_t tcg_helper_shr_i64 (int64_t arg1,int64_t arg2) +uint64_t HELPER (shr_i64 )(uint64_t arg1,uint64_t arg2) { -return (uint64_t )arg1 >> arg2; +return arg1 >> arg2; } -int64_t tcg_helper_sar_i64 (int64_t arg1,int64_t arg2) +int64_t HELPER (sar_i64 )(int64_t arg1,int64_t arg2) {return arg1 >> arg2; } -int64_t tcg_helper_div_i64 (int64_t arg1,int64_t arg2) +int64_t HELPER (div_i64 )(int64_t arg1,int64_t arg2) {return arg1 / arg2; } -int64_t tcg_helper_rem_i64 (int64_t arg1,int64_t arg2) +int64_t HELPER (rem_i64 )(int64_t arg1,int64_t arg2) {return arg1 % arg2; } -uint64_t tcg_helper_divu_i64 (uint64_t arg1,uint64_t arg2) +uint64_t HELPER (divu_i64 )(uint64_t arg1,uint64_t arg2) {return arg1 / arg2; } -uint64_t tcg_helper_remu_i64 (uint64_t arg1,uint64_t arg2) +uint64_t HELPER (remu_i64 )(uint64_t arg1,uint64_t arg2) {return arg1 % arg2; } -uint64_t tcg_helper_muluh_i64 (uint64_t arg1,uint64_t arg2) +uint64_t HELPER (muluh_i64 )(uint64_t arg1,uint64_t arg2) {uint64_t l, h;mulu64 (&l, &h, arg1, arg2);return h; } -int64_t tcg_helper_mulsh_i64 (int64_t arg1,int64_t arg2) +int64_t HELPER (mulsh_i64 )(int64_t arg1,int64_t arg2) {uint64_t l, h;muls64 (&l, &h, arg1, arg2);
tcg/tcg-op.h +18 -17
@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "tcg.h" +#include "exec/helper-proto.h" int gen_new_label (void );
@@ -712,7 +713,7 @@ static inline void tcg_gen_div_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) sizemask |=tcg_gen_sizemask (0 ,0 ,1 ); sizemask |=tcg_gen_sizemask (1 ,0 ,1 ); sizemask |=tcg_gen_sizemask (2 ,0 ,1 ); -tcg_gen_helper32 (tcg_helper_div_i32, sizemask, ret, arg1, arg2); +tcg_gen_helper32 (helper_div_i32, sizemask, ret, arg1, arg2); } }
@@ -737,7 +738,7 @@ static inline void tcg_gen_rem_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) sizemask |=tcg_gen_sizemask (0 ,0 ,1 ); sizemask |=tcg_gen_sizemask (1 ,0 ,1 ); sizemask |=tcg_gen_sizemask (2 ,0 ,1 ); -tcg_gen_helper32 (tcg_helper_rem_i32, sizemask, ret, arg1, arg2); +tcg_gen_helper32 (helper_rem_i32, sizemask, ret, arg1, arg2); } }
@@ -756,7 +757,7 @@ static inline void tcg_gen_divu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) sizemask |=tcg_gen_sizemask (0 ,0 ,0 ); sizemask |=tcg_gen_sizemask (1 ,0 ,0 ); sizemask |=tcg_gen_sizemask (2 ,0 ,0 ); -tcg_gen_helper32 (tcg_helper_divu_i32, sizemask, ret, arg1, arg2); +tcg_gen_helper32 (helper_divu_i32, sizemask, ret, arg1, arg2); } }
@@ -781,7 +782,7 @@ static inline void tcg_gen_remu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) sizemask |=tcg_gen_sizemask (0 ,0 ,0 ); sizemask |=tcg_gen_sizemask (1 ,0 ,0 ); sizemask |=tcg_gen_sizemask (2 ,0 ,0 ); -tcg_gen_helper32 (tcg_helper_remu_i32, sizemask, ret, arg1, arg2); +tcg_gen_helper32 (helper_remu_i32, sizemask, ret, arg1, arg2); } }
@@ -951,7 +952,7 @@ static inline void tcg_gen_shl_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); sizemask |=tcg_gen_sizemask (2 ,1 ,1 ); -tcg_gen_helper64 (tcg_helper_shl_i64, sizemask, ret, arg1, arg2); +tcg_gen_helper64 (helper_shl_i64, sizemask, ret, arg1, arg2); }static inline void tcg_gen_shli_i64 (TCGv_i64 ret,TCGv_i64 arg1,int64_t arg2)
@@ -967,7 +968,7 @@ static inline void tcg_gen_shr_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); sizemask |=tcg_gen_sizemask (2 ,1 ,1 ); -tcg_gen_helper64 (tcg_helper_shr_i64, sizemask, ret, arg1, arg2); +tcg_gen_helper64 (helper_shr_i64, sizemask, ret, arg1, arg2); }static inline void tcg_gen_shri_i64 (TCGv_i64 ret,TCGv_i64 arg1,int64_t arg2)
@@ -983,7 +984,7 @@ static inline void tcg_gen_sar_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); sizemask |=tcg_gen_sizemask (2 ,1 ,1 ); -tcg_gen_helper64 (tcg_helper_sar_i64, sizemask, ret, arg1, arg2); +tcg_gen_helper64 (helper_sar_i64, sizemask, ret, arg1, arg2); }static inline void tcg_gen_sari_i64 (TCGv_i64 ret,TCGv_i64 arg1,int64_t arg2)
@@ -1057,7 +1058,7 @@ static inline void tcg_gen_div_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); sizemask |=tcg_gen_sizemask (2 ,1 ,1 ); -tcg_gen_helper64 (tcg_helper_div_i64, sizemask, ret, arg1, arg2); +tcg_gen_helper64 (helper_div_i64, sizemask, ret, arg1, arg2); }static inline void tcg_gen_rem_i64 (TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2)
@@ -1068,7 +1069,7 @@ static inline void tcg_gen_rem_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); sizemask |=tcg_gen_sizemask (2 ,1 ,1 ); -tcg_gen_helper64 (tcg_helper_rem_i64, sizemask, ret, arg1, arg2); +tcg_gen_helper64 (helper_rem_i64, sizemask, ret, arg1, arg2); }static inline void tcg_gen_divu_i64 (TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2)
@@ -1079,7 +1080,7 @@ static inline void tcg_gen_divu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) sizemask |=tcg_gen_sizemask (1 ,1 ,0 ); sizemask |=tcg_gen_sizemask (2 ,1 ,0 ); -tcg_gen_helper64 (tcg_helper_divu_i64, sizemask, ret, arg1, arg2); +tcg_gen_helper64 (helper_divu_i64, sizemask, ret, arg1, arg2); }static inline void tcg_gen_remu_i64 (TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2)
@@ -1090,7 +1091,7 @@ static inline void tcg_gen_remu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) sizemask |=tcg_gen_sizemask (1 ,1 ,0 ); sizemask |=tcg_gen_sizemask (2 ,1 ,0 ); - tcg_gen_helper64(tcg_helper_remu_i64, sizemask, ret, arg1, arg2); + tcg_gen_helper64(helper_remu_i64, sizemask, ret, arg1, arg2); }#else
@@ -1362,7 +1363,7 @@ static inline void tcg_gen_div_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) sizemask |=tcg_gen_sizemask (0 ,1 ,1 ); sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); sizemask |=tcg_gen_sizemask (2 ,1 ,1 ); -tcg_gen_helper64 (tcg_helper_div_i64, sizemask, ret, arg1, arg2); +tcg_gen_helper64 (helper_div_i64, sizemask, ret, arg1, arg2); } }
@@ -1387,7 +1388,7 @@ static inline void tcg_gen_rem_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) sizemask |=tcg_gen_sizemask (0 ,1 ,1 ); sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); sizemask |=tcg_gen_sizemask (2 ,1 ,1 ); -tcg_gen_helper64 (tcg_helper_rem_i64, sizemask, ret, arg1, arg2); +tcg_gen_helper64 (helper_rem_i64, sizemask, ret, arg1, arg2); } }
@@ -1406,7 +1407,7 @@ static inline void tcg_gen_divu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) sizemask |=tcg_gen_sizemask (0 ,1 ,0 ); sizemask |=tcg_gen_sizemask (1 ,1 ,0 ); sizemask |=tcg_gen_sizemask (2 ,1 ,0 ); -tcg_gen_helper64 (tcg_helper_divu_i64, sizemask, ret, arg1, arg2); +tcg_gen_helper64 (helper_divu_i64, sizemask, ret, arg1, arg2); } }
@@ -1431,7 +1432,7 @@ static inline void tcg_gen_remu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2) sizemask |=tcg_gen_sizemask (0 ,1 ,0 ); sizemask |=tcg_gen_sizemask (1 ,1 ,0 ); sizemask |=tcg_gen_sizemask (2 ,1 ,0 ); - tcg_gen_helper64(tcg_helper_remu_i64, sizemask, ret, arg1, arg2); + tcg_gen_helper64(helper_remu_i64, sizemask, ret, arg1, arg2); } }#endif /* TCG_TARGET_REG_BITS == 32 */
@@ -2536,7 +2537,7 @@ static inline void tcg_gen_mulu2_i64(TCGv_i64 rl, TCGv_i64 rh, sizemask |=tcg_gen_sizemask (1 ,1 ,0 ); sizemask |=tcg_gen_sizemask (2 ,1 ,0 );tcg_gen_mul_i64 (t0, arg1, arg2); -tcg_gen_helper64 (tcg_helper_muluh_i64, sizemask, rh, arg1, arg2); +tcg_gen_helper64 (helper_muluh_i64, sizemask, rh, arg1, arg2);tcg_gen_mov_i64 (rl, t0);tcg_temp_free_i64 (t0); }
@@ -2581,7 +2582,7 @@ static inline void tcg_gen_muls2_i64(TCGv_i64 rl, TCGv_i64 rh, sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); sizemask |=tcg_gen_sizemask (2 ,1 ,1 );tcg_gen_mul_i64 (t0, arg1, arg2); -tcg_gen_helper64 (tcg_helper_mulsh_i64, sizemask, rh, arg1, arg2); +tcg_gen_helper64 (helper_mulsh_i64, sizemask, rh, arg1, arg2);tcg_gen_mov_i64 (rl, t0);tcg_temp_free_i64 (t0); }
tcg/tcg-runtime.h +13 -17
@@ -1,20 +1,16 @@ -#ifndef TCG_RUNTIME_H -#define TCG_RUNTIME_H +DEF_HELPER_FLAGS_2(div_i32, TCG_CALL_NO_RWG_SE, s32, s32, s32) +DEF_HELPER_FLAGS_2(rem_i32, TCG_CALL_NO_RWG_SE, s32, s32, s32) +DEF_HELPER_FLAGS_2(divu_i32, TCG_CALL_NO_RWG_SE, i32, i32, i32) +DEF_HELPER_FLAGS_2(remu_i32, TCG_CALL_NO_RWG_SE, i32, i32, i32) -/* tcg-runtime.c */ -int32_t tcg_helper_div_i32 (int32_t arg1,int32_t arg2); -int32_t tcg_helper_rem_i32 (int32_t arg1,int32_t arg2); -uint32_t tcg_helper_divu_i32 (uint32_t arg1,uint32_t arg2); -uint32_t tcg_helper_remu_i32 (uint32_t arg1,uint32_t arg2); +DEF_HELPER_FLAGS_2(div_i64, TCG_CALL_NO_RWG_SE, s64, s64, s64) +DEF_HELPER_FLAGS_2(rem_i64, TCG_CALL_NO_RWG_SE, s64, s64, s64) +DEF_HELPER_FLAGS_2(divu_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64) +DEF_HELPER_FLAGS_2(remu_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64) -int64_t tcg_helper_shl_i64 (int64_t arg1,int64_t arg2); -int64_t tcg_helper_shr_i64 (int64_t arg1,int64_t arg2); -int64_t tcg_helper_sar_i64 (int64_t arg1,int64_t arg2); -int64_t tcg_helper_div_i64 (int64_t arg1,int64_t arg2); -int64_t tcg_helper_rem_i64 (int64_t arg1,int64_t arg2); -int64_t tcg_helper_mulsh_i64 (int64_t arg1,int64_t arg2); -uint64_t tcg_helper_divu_i64 (uint64_t arg1,uint64_t arg2); -uint64_t tcg_helper_remu_i64 (uint64_t arg1,uint64_t arg2); -uint64_t tcg_helper_muluh_i64 (uint64_t arg1,uint64_t arg2); +DEF_HELPER_FLAGS_2(shl_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64) +DEF_HELPER_FLAGS_2(shr_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64) +DEF_HELPER_FLAGS_2(sar_i64, TCG_CALL_NO_RWG_SE, s64, s64, s64) -#endif +DEF_HELPER_FLAGS_2(mulsh_i64, TCG_CALL_NO_RWG_SE, s64, s64, s64) +DEF_HELPER_FLAGS_2 (muluh_i64,TCG_CALL_NO_RWG_SE , i64, i64, i64)
tcg/tcg.c +0 -16
@@ -316,22 +316,6 @@ typedef struct TCGHelperInfo {static const TCGHelperInfo all_helpers[] = { #include "exec/helper-tcg.h" - -/* Include tcg-runtime.c functions. */ - { tcg_helper_div_i32,"div_i32" }, - { tcg_helper_rem_i32,"rem_i32" }, - { tcg_helper_divu_i32,"divu_i32" }, - { tcg_helper_remu_i32,"remu_i32" }, - - { tcg_helper_shl_i64,"shl_i64" }, - { tcg_helper_shr_i64,"shr_i64" }, - { tcg_helper_sar_i64,"sar_i64" }, - { tcg_helper_div_i64,"div_i64" }, - { tcg_helper_rem_i64,"rem_i64" }, - { tcg_helper_divu_i64,"divu_i64" }, - { tcg_helper_remu_i64,"remu_i64" }, - { tcg_helper_mulsh_i64,"mulsh_i64" }, - { tcg_helper_muluh_i64,"muluh_i64" }, };void tcg_context_init (TCGContext *s)
tcg/tcg.h +0 -2
@@ -54,8 +54,6 @@ typedef uint64_t tcg_target_ulong;#error unsupported#endif -#include "tcg-runtime.h" -#if TCG_TARGET_NB_REGS <=32 typedef uint32_t TCGRegSet ;#elif TCG_TARGET_NB_REGS <=64
Signature · 1 line
1.9.0
PATCH 5/10 tcg: Inline tcg_gen_helperN
In reply to Richard Henderson--- include/exec/helper-gen.h | 12 ++++++------ tcg/tcg-op.h | 7 ------- 2 files changed, 6 insertions(+), 13 deletions(-)
include/exec/helper-gen.h +6 -6
@@ -11,7 +11,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret)) \ { \int sizemask; \ sizemask =dh_is_64bit (ret); \ -tcg_gen_helperN (HELPER (name), flags, sizemask,dh_retvar (ret),0 ,NULL ); \ +tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),0 ,NULL ); \ }#define DEF_HELPER_FLAGS_1 (name, flags, ret, t1) \
@@ -21,7 +21,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1int sizemask =0 ; \dh_sizemask (ret,0 ); \dh_arg (t1,1 ); \ -tcg_gen_helperN (HELPER (name), flags, sizemask,dh_retvar (ret),1 , args); \ +tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),1 , args); \ }#define DEF_HELPER_FLAGS_2 (name, flags, ret, t1, t2) \
@@ -33,7 +33,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1dh_sizemask (ret,0 ); \dh_arg (t1,1 ); \dh_arg (t2,2 ); \ -tcg_gen_helperN (HELPER (name), flags, sizemask,dh_retvar (ret),2 , args); \ +tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),2 , args); \ }#define DEF_HELPER_FLAGS_3 (name, flags, ret, t1, t2, t3) \
@@ -46,7 +46,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1dh_arg (t1,1 ); \dh_arg (t2,2 ); \dh_arg (t3,3 ); \ -tcg_gen_helperN (HELPER (name), flags, sizemask,dh_retvar (ret),3 , args); \ +tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),3 , args); \ }#define DEF_HELPER_FLAGS_4 (name, flags, ret, t1, t2, t3, t4) \
@@ -60,7 +60,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1dh_arg (t2,2 ); \dh_arg (t3,3 ); \dh_arg (t4,4 ); \ -tcg_gen_helperN (HELPER (name), flags, sizemask,dh_retvar (ret),4 , args); \ +tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),4 , args); \ }#define DEF_HELPER_FLAGS_5 (name, flags, ret, t1, t2, t3, t4, t5) \
@@ -76,7 +76,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \dh_arg (t3,3 ); \dh_arg (t4,4 ); \dh_arg (t5,5 ); \ -tcg_gen_helperN (HELPER (name), flags, sizemask,dh_retvar (ret),5 , args); \ +tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),5 , args); \ }#include "helper.h"
tcg/tcg-op.h +0 -7
@@ -23,13 +23,6 @@*/ #include "tcg.h" #include "exec/helper-proto.h" - -static inline void tcg_gen_helperN (void *func,int flags,int sizemask, -TCGArg ret,int nargs,TCGArg *args) -{ -tcg_gen_callN (&tcg_ctx, func, flags, sizemask, ret, nargs, args); -} -#include "exec/helper-gen.h" int gen_new_label (void );
Signature · 1 line
1.9.0
PATCH 6/10 tcg: Move side effects out of dh_sizemask
In reply to Richard HendersonMoving them into dh_arg instead.
--- include/exec/helper-gen.h | 18 ++++++------------ include/exec/helper-head.h | 5 ++--- 2 files changed, 8 insertions(+), 15 deletions(-)
include/exec/helper-gen.h +6 -12
@@ -9,8 +9,7 @@#define DEF_HELPER_FLAGS_0 (name, flags, ret) \ static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret)) \ { \ - int sizemask; \ - sizemask = dh_is_64bit(ret); \ + int sizemask = dh_sizemask(ret, 0); \ tcg_gen_callN(&tcg_ctx, HELPER(name), flags, sizemask, dh_retvar(ret), 0, NULL); \ }
@@ -18,8 +17,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret)) \ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1)) \ { \TCGArg args[1 ]; \ -int sizemask =0 ; \ -dh_sizemask (ret,0 ); \ +int sizemask =dh_sizemask (ret,0 ); \dh_arg (t1,1 ); \tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),1 , args); \ }
@@ -29,8 +27,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1 dh_arg_decl(t2, 2)) \ { \TCGArg args[2 ]; \ -int sizemask =0 ; \ -dh_sizemask (ret,0 ); \ +int sizemask =dh_sizemask (ret,0 ); \dh_arg (t1,1 ); \dh_arg (t2,2 ); \tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),2 , args); \
@@ -41,8 +38,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1 dh_arg_decl(t2, 2), dh_arg_decl(t3, 3)) \ { \TCGArg args[3 ]; \ -int sizemask =0 ; \ -dh_sizemask (ret,0 ); \ +int sizemask =dh_sizemask (ret,0 ); \dh_arg (t1,1 ); \dh_arg (t2,2 ); \dh_arg (t3,3 ); \
@@ -54,8 +50,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1 dh_arg_decl(t2, 2), dh_arg_decl(t3, 3), dh_arg_decl(t4, 4)) \ { \TCGArg args[4 ]; \ -int sizemask =0 ; \ -dh_sizemask (ret,0 ); \ +int sizemask =dh_sizemask (ret,0 ); \dh_arg (t1,1 ); \dh_arg (t2,2 ); \dh_arg (t3,3 ); \
@@ -69,8 +64,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ dh_arg_decl(t4, 4), dh_arg_decl(t5, 5)) \ { \TCGArg args[5 ]; \ -int sizemask =0 ; \ -dh_sizemask (ret,0 ); \ +int sizemask =dh_sizemask (ret,0 ); \dh_arg (t1,1 ); \dh_arg (t2,2 ); \dh_arg (t3,3 ); \
include/exec/helper-head.h +2 -3
@@ -109,12 +109,11 @@#define dh_is_signed (t) dh_is_signed_##t#define dh_sizemask (t, n) \ - sizemask |= dh_is_64bit(t) << (n*2); \ - sizemask |= dh_is_signed(t) << (n*2+1) + ((dh_is_64bit(t) << (n*2)) | (dh_is_signed(t) << (n*2+1)))#define dh_arg (t, n) \ args[n - 1] = glue(GET_TCGV_, dh_alias(t))(glue(arg, n)); \ - dh_sizemask(t, n) + sizemask |= dh_sizemask(t, n)#define dh_arg_decl (t, n) glue(TCGv_, dh_alias(t)) glue(arg, n)
Signature · 1 line
1.9.0
PATCH 4/10 tcg: Use helper-gen.h in tcg-op.h
In reply to Richard HendersonNo need to open-code the setup of the builtin helpers.
--- tcg/tcg-op.h | 175 +++++++++-------------------------------------------------- 1 file changed, 25 insertions(+), 150 deletions(-)
tcg/tcg-op.h +25 -150
@@ -24,6 +24,14 @@#include "tcg.h" #include "exec/helper-proto.h" +static inline void tcg_gen_helperN (void *func,int flags,int sizemask, +TCGArg ret,int nargs,TCGArg *args) +{ +tcg_gen_callN (&tcg_ctx, func, flags, sizemask, ret, nargs, args); +} + +#include "exec/helper-gen.h" +int gen_new_label (void );static inline void tcg_gen_op0 (TCGOpcode opc)
@@ -380,47 +388,6 @@ static inline void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg)tcg_gen_op2i_i32 (INDEX_op_movi_i32, ret, arg); } -/* A version of dh_sizemask from def-helper.h that doesn't rely on -preprocessor magic. */ -static inline int tcg_gen_sizemask (int n,int is_64bit,int is_signed) -{ -return (is_64bit << n*2 ) | (is_signed << (n*2 +1 )); -} - -/* helper calls */ -static inline void tcg_gen_helperN (void *func,int flags,int sizemask, -TCGArg ret,int nargs,TCGArg *args) -{ -tcg_gen_callN (&tcg_ctx, func, flags, sizemask, ret, nargs, args); -} - -/* Note: Both tcg_gen_helper32() and tcg_gen_helper64() are currently -reserved for helpers in tcg-runtime.c. These helpers all do not read -globals and do not have side effects, hence the call to tcg_gen_callN() -with TCG_CALL_NO_READ_GLOBALS | TCG_CALL_NO_SIDE_EFFECTS. This may need -to be adjusted if these functions start to be used with other helpers. */ -static inline void tcg_gen_helper32 (void *func,int sizemask,TCGv_i32 ret, -TCGv_i32 a,TCGv_i32 b) -{ -TCGArg args[2 ]; - args[0 ] =GET_TCGV_I32 (a); - args[1 ] =GET_TCGV_I32 (b); -tcg_gen_callN (&tcg_ctx, func, -TCG_CALL_NO_READ_GLOBALS |TCG_CALL_NO_SIDE_EFFECTS , - sizemask,GET_TCGV_I32 (ret),2 , args); -} - -static inline void tcg_gen_helper64 (void *func,int sizemask,TCGv_i64 ret, -TCGv_i64 a,TCGv_i64 b) -{ -TCGArg args[2 ]; - args[0 ] =GET_TCGV_I64 (a); - args[1 ] =GET_TCGV_I64 (b); -tcg_gen_callN (&tcg_ctx, func, -TCG_CALL_NO_READ_GLOBALS |TCG_CALL_NO_SIDE_EFFECTS , - sizemask,GET_TCGV_I64 (ret),2 , args); -} -/* 32 bit ops */ static inline void tcg_gen_ld8u_i32 (TCGv_i32 ret,TCGv_ptr arg2,tcg_target_long offset)
@@ -708,12 +675,7 @@ static inline void tcg_gen_div_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)tcg_gen_op5_i32 (INDEX_op_div2_i32, ret, t0, arg1, t0, arg2);tcg_temp_free_i32 (t0); }else { -int sizemask =0 ; -/* Return value and both arguments are 32-bit and signed. */ - sizemask |=tcg_gen_sizemask (0 ,0 ,1 ); - sizemask |=tcg_gen_sizemask (1 ,0 ,1 ); - sizemask |=tcg_gen_sizemask (2 ,0 ,1 ); -tcg_gen_helper32 (helper_div_i32, sizemask, ret, arg1, arg2); +gen_helper_div_i32 (ret, arg1, arg2); } }
@@ -733,12 +695,7 @@ static inline void tcg_gen_rem_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)tcg_gen_op5_i32 (INDEX_op_div2_i32, t0, ret, arg1, t0, arg2);tcg_temp_free_i32 (t0); }else { -int sizemask =0 ; -/* Return value and both arguments are 32-bit and signed. */ - sizemask |=tcg_gen_sizemask (0 ,0 ,1 ); - sizemask |=tcg_gen_sizemask (1 ,0 ,1 ); - sizemask |=tcg_gen_sizemask (2 ,0 ,1 ); -tcg_gen_helper32 (helper_rem_i32, sizemask, ret, arg1, arg2); +gen_helper_rem_i32 (ret, arg1, arg2); } }
@@ -752,12 +709,7 @@ static inline void tcg_gen_divu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)tcg_gen_op5_i32 (INDEX_op_divu2_i32, ret, t0, arg1, t0, arg2);tcg_temp_free_i32 (t0); }else { -int sizemask =0 ; -/* Return value and both arguments are 32-bit and unsigned. */ - sizemask |=tcg_gen_sizemask (0 ,0 ,0 ); - sizemask |=tcg_gen_sizemask (1 ,0 ,0 ); - sizemask |=tcg_gen_sizemask (2 ,0 ,0 ); -tcg_gen_helper32 (helper_divu_i32, sizemask, ret, arg1, arg2); +gen_helper_divu_i32 (ret, arg1, arg2); } }
@@ -777,12 +729,7 @@ static inline void tcg_gen_remu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)tcg_gen_op5_i32 (INDEX_op_divu2_i32, t0, ret, arg1, t0, arg2);tcg_temp_free_i32 (t0); }else { -int sizemask =0 ; -/* Return value and both arguments are 32-bit and unsigned. */ - sizemask |=tcg_gen_sizemask (0 ,0 ,0 ); - sizemask |=tcg_gen_sizemask (1 ,0 ,0 ); - sizemask |=tcg_gen_sizemask (2 ,0 ,0 ); -tcg_gen_helper32 (helper_remu_i32, sizemask, ret, arg1, arg2); +gen_helper_remu_i32 (ret, arg1, arg2); } }
@@ -946,13 +893,7 @@ static inline void tcg_gen_xori_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)specific code (x86) */ static inline void tcg_gen_shl_i64 (TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2) { -int sizemask =0 ; -/* Return value and both arguments are 64-bit and signed. */ - sizemask |=tcg_gen_sizemask (0 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (2 ,1 ,1 ); - -tcg_gen_helper64 (helper_shl_i64, sizemask, ret, arg1, arg2); +gen_helper_shl_i64 (ret, arg1, arg2); }static inline void tcg_gen_shli_i64 (TCGv_i64 ret,TCGv_i64 arg1,int64_t arg2)
@@ -962,13 +903,7 @@ static inline void tcg_gen_shli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)static inline void tcg_gen_shr_i64 (TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2) { -int sizemask =0 ; -/* Return value and both arguments are 64-bit and signed. */ - sizemask |=tcg_gen_sizemask (0 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (2 ,1 ,1 ); - -tcg_gen_helper64 (helper_shr_i64, sizemask, ret, arg1, arg2); +gen_helper_shr_i64 (ret, arg1, arg2); }static inline void tcg_gen_shri_i64 (TCGv_i64 ret,TCGv_i64 arg1,int64_t arg2)
@@ -978,13 +913,7 @@ static inline void tcg_gen_shri_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)static inline void tcg_gen_sar_i64 (TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2) { -int sizemask =0 ; -/* Return value and both arguments are 64-bit and signed. */ - sizemask |=tcg_gen_sizemask (0 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (2 ,1 ,1 ); - -tcg_gen_helper64 (helper_sar_i64, sizemask, ret, arg1, arg2); +gen_helper_sar_i64 (ret, arg1, arg2); }static inline void tcg_gen_sari_i64 (TCGv_i64 ret,TCGv_i64 arg1,int64_t arg2)
@@ -1052,46 +981,22 @@ static inline void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)static inline void tcg_gen_div_i64 (TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2) { -int sizemask =0 ; -/* Return value and both arguments are 64-bit and signed. */ - sizemask |=tcg_gen_sizemask (0 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (2 ,1 ,1 ); - -tcg_gen_helper64 (helper_div_i64, sizemask, ret, arg1, arg2); +gen_helper_div_i64 (ret, arg1, arg2); }static inline void tcg_gen_rem_i64 (TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2) { -int sizemask =0 ; -/* Return value and both arguments are 64-bit and signed. */ - sizemask |=tcg_gen_sizemask (0 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (2 ,1 ,1 ); - -tcg_gen_helper64 (helper_rem_i64, sizemask, ret, arg1, arg2); +gen_helper_rem_i64 (ret, arg1, arg2); }static inline void tcg_gen_divu_i64 (TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2) { -int sizemask =0 ; -/* Return value and both arguments are 64-bit and unsigned. */ - sizemask |=tcg_gen_sizemask (0 ,1 ,0 ); - sizemask |=tcg_gen_sizemask (1 ,1 ,0 ); - sizemask |=tcg_gen_sizemask (2 ,1 ,0 ); - -tcg_gen_helper64 (helper_divu_i64, sizemask, ret, arg1, arg2); +gen_helper_divu_i64 (ret, arg1, arg2); }static inline void tcg_gen_remu_i64 (TCGv_i64 ret,TCGv_i64 arg1,TCGv_i64 arg2) { -int sizemask =0 ; -/* Return value and both arguments are 64-bit and unsigned. */ - sizemask |=tcg_gen_sizemask (0 ,1 ,0 ); - sizemask |=tcg_gen_sizemask (1 ,1 ,0 ); - sizemask |=tcg_gen_sizemask (2 ,1 ,0 ); - -tcg_gen_helper64 (helper_remu_i64, sizemask, ret, arg1, arg2); +gen_helper_remu_i64 (ret, arg1, arg2); }#else
@@ -1358,12 +1263,7 @@ static inline void tcg_gen_div_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)tcg_gen_op5_i64 (INDEX_op_div2_i64, ret, t0, arg1, t0, arg2);tcg_temp_free_i64 (t0); }else { -int sizemask =0 ; -/* Return value and both arguments are 64-bit and signed. */ - sizemask |=tcg_gen_sizemask (0 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (2 ,1 ,1 ); -tcg_gen_helper64 (helper_div_i64, sizemask, ret, arg1, arg2); +gen_helper_div_i64 (ret, arg1, arg2); } }
@@ -1383,12 +1283,7 @@ static inline void tcg_gen_rem_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)tcg_gen_op5_i64 (INDEX_op_div2_i64, t0, ret, arg1, t0, arg2);tcg_temp_free_i64 (t0); }else { -int sizemask =0 ; -/* Return value and both arguments are 64-bit and signed. */ - sizemask |=tcg_gen_sizemask (0 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (2 ,1 ,1 ); -tcg_gen_helper64 (helper_rem_i64, sizemask, ret, arg1, arg2); +gen_helper_rem_i64 (ret, arg1, arg2); } }
@@ -1402,12 +1297,7 @@ static inline void tcg_gen_divu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)tcg_gen_op5_i64 (INDEX_op_divu2_i64, ret, t0, arg1, t0, arg2);tcg_temp_free_i64 (t0); }else { -int sizemask =0 ; -/* Return value and both arguments are 64-bit and unsigned. */ - sizemask |=tcg_gen_sizemask (0 ,1 ,0 ); - sizemask |=tcg_gen_sizemask (1 ,1 ,0 ); - sizemask |=tcg_gen_sizemask (2 ,1 ,0 ); -tcg_gen_helper64 (helper_divu_i64, sizemask, ret, arg1, arg2); +gen_helper_divu_i64 (ret, arg1, arg2); } }
@@ -1427,12 +1317,7 @@ static inline void tcg_gen_remu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)tcg_gen_op5_i64 (INDEX_op_divu2_i64, t0, ret, arg1, t0, arg2); tcg_temp_free_i64(t0); }else { -int sizemask =0 ; -/* Return value and both arguments are 64-bit and unsigned. */ - sizemask |=tcg_gen_sizemask (0 ,1 ,0 ); - sizemask |=tcg_gen_sizemask (1 ,1 ,0 ); - sizemask |=tcg_gen_sizemask (2 ,1 ,0 ); -tcg_gen_helper64 (helper_remu_i64, sizemask, ret, arg1, arg2); +gen_helper_remu_i64 (ret, arg1, arg2); } }#endif /* TCG_TARGET_REG_BITS == 32 */
@@ -2531,13 +2416,8 @@ static inline void tcg_gen_mulu2_i64(TCGv_i64 rl, TCGv_i64 rh,tcg_temp_free_i64 (t); }else {TCGv_i64 t0 =tcg_temp_new_i64 (); -int sizemask =0 ; -/* Return value and both arguments are 64-bit and unsigned. */ - sizemask |=tcg_gen_sizemask (0 ,1 ,0 ); - sizemask |=tcg_gen_sizemask (1 ,1 ,0 ); - sizemask |=tcg_gen_sizemask (2 ,1 ,0 );tcg_gen_mul_i64 (t0, arg1, arg2); -tcg_gen_helper64 (helper_muluh_i64, sizemask, rh, arg1, arg2); +gen_helper_muluh_i64 (rh, arg1, arg2);tcg_gen_mov_i64 (rl, t0);tcg_temp_free_i64 (t0); }
@@ -2576,13 +2456,8 @@ static inline void tcg_gen_muls2_i64(TCGv_i64 rl, TCGv_i64 rh,tcg_temp_free_i64 (t3); }else {TCGv_i64 t0 =tcg_temp_new_i64 (); -int sizemask =0 ; -/* Return value and both arguments are 64-bit and signed. */ - sizemask |=tcg_gen_sizemask (0 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (1 ,1 ,1 ); - sizemask |=tcg_gen_sizemask (2 ,1 ,1 );tcg_gen_mul_i64 (t0, arg1, arg2); -tcg_gen_helper64 (helper_mulsh_i64, sizemask, rh, arg1, arg2); +gen_helper_mulsh_i64 (rh, arg1, arg2);tcg_gen_mov_i64 (rl, t0);tcg_temp_free_i64 (t0); }
Signature · 1 line
1.9.0
PATCH 7/10 tcg: Register the helper info struct rather than the name
In reply to Richard HendersonThis will let us find all the info from the hash table.
--- tcg/tcg.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tcg/tcg.c +5 -2
@@ -356,7 +356,7 @@ void tcg_context_init(TCGContext *s)for (i =0 ; i <ARRAY_SIZE (all_helpers); ++i) {g_hash_table_insert (helper_table, (gpointer )all_helpers[i].func, - (gpointer )all_helpers[i].name); + (gpointer)&all_helpers[i]); }tcg_target_init (s);
@@ -1149,7 +1149,10 @@ static inline const char *tcg_find_helper(TCGContext *s, uintptr_t val) {const char *ret =NULL ;if (s->helpers) { - ret =g_hash_table_lookup (s->helpers, (gpointer )val); +TCGHelperInfo *info =g_hash_table_lookup (s->helpers, (gpointer )val); +if (info) { + ret = info->name; + } }return ret; }
Signature · 1 line
1.9.0
PATCH 8/10 tcg: Save flags and computed sizemask in TCGHelperInfo
In reply to Richard Henderson--- include/exec/helper-tcg.h | 44 ++++++++++++++++++++++++++++---------------- tcg/tcg.c | 7 +++++++ 2 files changed, 35 insertions(+), 16 deletions(-)
include/exec/helper-tcg.h +28 -16
@@ -6,22 +6,34 @@#include <exec/helper-head.h> -#define DEF_HELPER_FLAGS_0 (name, flags, ret) { HELPER(name), #name }, - -#define DEF_HELPER_FLAGS_1 (name, flags, ret, t1) \ -DEF_HELPER_FLAGS_0(name, flags, ret) - -#define DEF_HELPER_FLAGS_2 (name, flags, ret, t1, t2) \ -DEF_HELPER_FLAGS_0(name, flags, ret) - -#define DEF_HELPER_FLAGS_3 (name, flags, ret, t1, t2, t3) \ -DEF_HELPER_FLAGS_0(name, flags, ret) - -#define DEF_HELPER_FLAGS_4 (name, flags, ret, t1, t2, t3, t4) \ -DEF_HELPER_FLAGS_0(name, flags, ret) - -#define DEF_HELPER_FLAGS_5 (name, flags, ret, t1, t2, t3, t4, t5) \ -DEF_HELPER_FLAGS_0(name, flags, ret) +#define DEF_HELPER_FLAGS_0 (NAME ,FLAGS , ret) \ + { .func = HELPER(NAME), .name = #NAME, .flags = FLAGS, \ + .sizemask = dh_sizemask(ret, 0) }, + +#define DEF_HELPER_FLAGS_1 (NAME ,FLAGS , ret, t1) \ + { .func = HELPER(NAME), .name = #NAME, .flags = FLAGS, \ + .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) }, + +#define DEF_HELPER_FLAGS_2 (NAME ,FLAGS , ret, t1, t2) \ + { .func = HELPER(NAME), .name = #NAME, .flags = FLAGS, \ + .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) \ + | dh_sizemask(t2, 2) }, + +#define DEF_HELPER_FLAGS_3 (NAME ,FLAGS , ret, t1, t2, t3) \ + { .func = HELPER(NAME), .name = #NAME, .flags = FLAGS, \ + .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) \ + | dh_sizemask(t2, 2) | dh_sizemask(t3, 3) }, + +#define DEF_HELPER_FLAGS_4 (NAME ,FLAGS , ret, t1, t2, t3, t4) \ + { .func = HELPER(NAME), .name = #NAME, .flags = FLAGS, \ + .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) \ + | dh_sizemask(t2, 2) | dh_sizemask(t3, 3) | dh_sizemask(t4, 4) }, + +#define DEF_HELPER_FLAGS_5 (NAME ,FLAGS , ret, t1, t2, t3, t4, t5) \ + { .func = HELPER(NAME), .name = #NAME, .flags = FLAGS, \ + .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) \ + | dh_sizemask(t2, 2) | dh_sizemask(t3, 3) | dh_sizemask(t4, 4) \ + | dh_sizemask(t5, 5) },#include "helper.h" #include "tcg-runtime.h"
tcg/tcg.c +7 -0
@@ -310,6 +310,8 @@ void tcg_pool_reset(TCGContext *s)typedef struct TCGHelperInfo {void *func;const char *name; +unsigned flags; +unsigned sizemask; }TCGHelperInfo ;#include "exec/helper-proto.h"
@@ -696,6 +698,11 @@ void tcg_gen_callN(TCGContext *s, void *func, unsigned int flags,int real_args;int nb_rets;TCGArg *nparam; +TCGHelperInfo *info; + + info =g_hash_table_lookup (s->helpers, (gpointer )func); +assert (info !=NULL ); +assert (info->sizemask == sizemask);#if defined(__sparc__) && !defined(__arch64__) \ && !defined(CONFIG_TCG_INTERPRETER )
Signature · 1 line
1.9.0
PATCH 9/10 tcg: Remove sizemask and flags arguments to tcg_gen_callN
In reply to Richard HendersonTake them from the TCGHelperInfo struct instead.
--- include/exec/helper-gen.h | 18 ++++++------------ include/exec/helper-head.h | 3 +-- tcg/tcg.c | 17 +++++++---------- tcg/tcg.h | 4 ++-- 4 files changed, 16 insertions(+), 26 deletions(-)
include/exec/helper-gen.h +6 -12
@@ -9,17 +9,15 @@#define DEF_HELPER_FLAGS_0 (name, flags, ret) \ static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret)) \ { \ - int sizemask = dh_sizemask(ret, 0); \ - tcg_gen_callN(&tcg_ctx, HELPER(name), flags, sizemask, dh_retvar(ret), 0, NULL); \ + tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 0, NULL); \ }#define DEF_HELPER_FLAGS_1 (name, flags, ret, t1) \ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1)) \ { \ TCGArg args[1]; \ - int sizemask = dh_sizemask(ret, 0); \ dh_arg(t1, 1); \ - tcg_gen_callN(&tcg_ctx, HELPER(name), flags, sizemask, dh_retvar(ret), 1, args); \ + tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 1, args); \ }#define DEF_HELPER_FLAGS_2 (name, flags, ret, t1, t2) \
@@ -27,10 +25,9 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1 dh_arg_decl(t2, 2)) \ { \TCGArg args[2 ]; \ -int sizemask =dh_sizemask (ret,0 ); \dh_arg (t1,1 ); \dh_arg (t2,2 ); \ -tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),2 , args); \ +tcg_gen_callN (&tcg_ctx,HELPER (name),dh_retvar (ret),2 , args); \ }#define DEF_HELPER_FLAGS_3 (name, flags, ret, t1, t2, t3) \
@@ -38,11 +35,10 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1 dh_arg_decl(t2, 2), dh_arg_decl(t3, 3)) \ { \TCGArg args[3 ]; \ -int sizemask =dh_sizemask (ret,0 ); \dh_arg (t1,1 ); \dh_arg (t2,2 ); \dh_arg (t3,3 ); \ -tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),3 , args); \ +tcg_gen_callN (&tcg_ctx,HELPER (name),dh_retvar (ret),3 , args); \ }#define DEF_HELPER_FLAGS_4 (name, flags, ret, t1, t2, t3, t4) \
@@ -50,12 +46,11 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1 dh_arg_decl(t2, 2), dh_arg_decl(t3, 3), dh_arg_decl(t4, 4)) \ { \TCGArg args[4 ]; \ -int sizemask =dh_sizemask (ret,0 ); \dh_arg (t1,1 ); \dh_arg (t2,2 ); \dh_arg (t3,3 ); \dh_arg (t4,4 ); \ -tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),4 , args); \ +tcg_gen_callN (&tcg_ctx,HELPER (name),dh_retvar (ret),4 , args); \ }#define DEF_HELPER_FLAGS_5 (name, flags, ret, t1, t2, t3, t4, t5) \
@@ -64,13 +59,12 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ dh_arg_decl(t4, 4), dh_arg_decl(t5, 5)) \ { \TCGArg args[5 ]; \ -int sizemask =dh_sizemask (ret,0 ); \dh_arg (t1,1 ); \dh_arg (t2,2 ); \dh_arg (t3,3 ); \dh_arg (t4,4 ); \dh_arg (t5,5 ); \ -tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),5 , args); \ +tcg_gen_callN (&tcg_ctx,HELPER (name),dh_retvar (ret),5 , args); \ }#include "helper.h"
include/exec/helper-head.h +1 -2
@@ -112,8 +112,7 @@ ((dh_is_64bit(t) << (n*2)) | (dh_is_signed(t) << (n*2+1)))#define dh_arg (t, n) \ - args[n - 1] = glue(GET_TCGV_, dh_alias(t))(glue(arg, n)); \ - sizemask |= dh_sizemask(t, n) + (args[n - 1] = glue(GET_TCGV_, dh_alias(t))(glue(arg, n)))#define dh_arg_decl (t, n) glue(TCGv_, dh_alias(t)) glue(arg, n)
tcg/tcg.c +7 -10
@@ -691,18 +691,17 @@ int tcg_check_temp_count(void)/* Note: we convert the 64 bit args to 32 bit and do some alignment and endian swap. Maybe it would be better to do the alignment and endian swap in tcg_reg_alloc_call(). */ -void tcg_gen_callN (TCGContext *s,void *func,unsigned int flags, -int sizemask,TCGArg ret,int nargs,TCGArg *args) +void tcg_gen_callN (TCGContext *s,void *func,TCGArg ret, +int nargs,TCGArg *args) { -int i; -int real_args; -int nb_rets; +int i, real_args, nb_rets; +unsigned sizemask, flags;TCGArg *nparam;TCGHelperInfo *info; info =g_hash_table_lookup (s->helpers, (gpointer )func); -assert (info !=NULL ); -assert (info->sizemask == sizemask); + flags = info->flags; + sizemask = info->sizemask;#if defined(__sparc__) && !defined(__arch64__) \ && !defined(CONFIG_TCG_INTERPRETER )
@@ -788,9 +787,8 @@ void tcg_gen_callN(TCGContext *s, void *func, unsigned int flags, } real_args =0 ;for (i =0 ; i < nargs; i++) { -#if TCG_TARGET_REG_BITS < 64int is_64bit = sizemask & (1 << (i+1 )*2 ); - if (is_64bit) { +if (TCG_TARGET_REG_BITS <64 && is_64bit) {#ifdef TCG_TARGET_CALL_ALIGN_ARGS /* some targets want aligned 64 bit args */ if (real_args &1 ) {
@@ -818,7 +816,6 @@ void tcg_gen_callN(TCGContext *s, void *func, unsigned int flags, real_args +=2 ;continue ; } -#endif /* TCG_TARGET_REG_BITS < 64 */ *s->gen_opparam_ptr++ = args[i]; real_args++;
tcg/tcg.h +2 -2
@@ -723,8 +723,8 @@ void tcg_add_target_add_op_defs(const TCGTargetOpDef *tdefs);#define tcg_temp_free_ptr (T ) tcg_temp_free_i64(TCGV_PTR_TO_NAT(T))#endif -void tcg_gen_callN (TCGContext *s,void *func,unsigned int flags, -int sizemask,TCGArg ret,int nargs,TCGArg *args); +void tcg_gen_callN (TCGContext *s,void *func, +TCGArg ret,int nargs,TCGArg *args);void tcg_gen_shifti_i64 (TCGv_i64 ret,TCGv_i64 arg1,int c,int right,int arith);
Signature · 1 line
1.9.0
PATCH 10/10 tcg: Move size effects out of dh_arg
In reply to Richard HendersonTidying the initialization of the args arrays at the same time.
--- include/exec/helper-gen.h | 87 ++++++++++++++++++++-------------------------- include/exec/helper-head.h | 2 +- 2 files changed, 39 insertions(+), 50 deletions(-)
include/exec/helper-gen.h +38 -49
@@ -6,65 +6,54 @@#include <exec/helper-head.h> -#define DEF_HELPER_FLAGS_0 (name, flags, ret) \ -static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret)) \ -{ \ - tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 0, NULL); \ +#define DEF_HELPER_FLAGS_0 (name, flags, ret) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret)) \ +{ \ + tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 0, NULL); \ } -#define DEF_HELPER_FLAGS_1 (name, flags, ret, t1) \ -static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1)) \ -{ \ - TCGArg args[1]; \ - dh_arg(t1, 1); \ - tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 1, args); \ +#define DEF_HELPER_FLAGS_1 (name, flags, ret, t1) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ + dh_arg_decl(t1, 1)) \ +{ \ + TCGArg args[1] = { dh_arg(t1, 1) }; \ + tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 1, args); \ } -#define DEF_HELPER_FLAGS_2 (name, flags, ret, t1, t2) \ -static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1), \ - dh_arg_decl(t2, 2)) \ -{ \ - TCGArg args[2]; \ - dh_arg(t1, 1); \ - dh_arg(t2, 2); \ - tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 2, args); \ +#define DEF_HELPER_FLAGS_2 (name, flags, ret, t1, t2) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ + dh_arg_decl(t1, 1), dh_arg_decl(t2, 2)) \ +{ \ + TCGArg args[2] = { dh_arg(t1, 1), dh_arg(t2, 2) }; \ + tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 2, args); \ } -#define DEF_HELPER_FLAGS_3 (name, flags, ret, t1, t2, t3) \ -static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1), \ - dh_arg_decl(t2, 2), dh_arg_decl(t3, 3)) \ -{ \ - TCGArg args[3]; \ - dh_arg(t1, 1); \ - dh_arg(t2, 2); \ - dh_arg(t3, 3); \ - tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 3, args); \ +#define DEF_HELPER_FLAGS_3 (name, flags, ret, t1, t2, t3) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ + dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3)) \ +{ \ + TCGArg args[3] = { dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3) }; \ + tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 3, args); \ } -#define DEF_HELPER_FLAGS_4 (name, flags, ret, t1, t2, t3, t4) \ -static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1), \ - dh_arg_decl(t2, 2), dh_arg_decl(t3, 3), dh_arg_decl(t4, 4)) \ -{ \ - TCGArg args[4]; \ - dh_arg(t1, 1); \ - dh_arg(t2, 2); \ - dh_arg(t3, 3); \ - dh_arg(t4, 4); \ - tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 4, args); \ +#define DEF_HELPER_FLAGS_4 (name, flags, ret, t1, t2, t3, t4) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ + dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), \ + dh_arg_decl(t3, 3), dh_arg_decl(t4, 4)) \ +{ \ + TCGArg args[4] = { dh_arg(t1, 1), dh_arg(t2, 2), \ + dh_arg(t3, 3), dh_arg(t4, 4) }; \ + tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 4, args); \ } -#define DEF_HELPER_FLAGS_5 (name, flags, ret, t1, t2, t3, t4, t5) \ -static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ - dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3), \ - dh_arg_decl(t4, 4), dh_arg_decl(t5, 5)) \ -{ \ - TCGArg args[5]; \ - dh_arg(t1, 1); \ - dh_arg(t2, 2); \ - dh_arg(t3, 3); \ - dh_arg(t4, 4); \ - dh_arg(t5, 5); \ - tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 5, args); \ +#define DEF_HELPER_FLAGS_5 (name, flags, ret, t1, t2, t3, t4, t5) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ + dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3), \ + dh_arg_decl(t4, 4), dh_arg_decl(t5, 5)) \ +{ \ + TCGArg args[5] = { dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3), \ + dh_arg(t4, 4), dh_arg(t5, 5) }; \ + tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 5, args); \ }#include "helper.h"
include/exec/helper-head.h +1 -1
@@ -112,7 +112,7 @@ ((dh_is_64bit(t) << (n*2)) | (dh_is_signed(t) << (n*2+1)))#define dh_arg (t, n) \ - (args[n - 1] = glue(GET_TCGV_, dh_alias(t))(glue(arg, n))) + glue(GET_TCGV_, dh_alias(t))(glue(arg, n))#define dh_arg_decl (t, n) glue(TCGv_, dh_alias(t)) glue(arg, n)
Signature · 1 line
1.9.0
Re: [Qemu-devel] [PATCH 02/10] tcg: Invert the inclusion of helper.h
In reply to Richard HendersonQuoted 11 lines · Richard Henderson
Rather than include
helper.hwith N values ofGEN_HELPER, include a secondary file that sets up the macros to includehelper.h. This minimizes the files that must be rebuilt when changing the macros for file N.Signed-off-by Richard Henderson <[email protected]>--- include/exec/helper-gen.h | 92 +++++++++++++++++ include/exec/{def-helper.h => helper-head.h} | 144 +-------------------------- include/exec/helper-proto.h | 38 +++++++ include/exec/helper-tcg.h | 35 +++++++
I still find the macro gymnastics of the helper generators a pain because hitting "find" on gen_helper_foo doesn't lead you anywhere useful but I guess that's the price you pay for using macros.
Signature · 1 line
Alex Bennée
Re: [Qemu-devel] [PATCH 03/10] tcg: Push tcg-runtime routines into exec/helper-*
In reply to Richard HendersonQuoted 45 lines · Richard Henderson
Rather than special casing them, use the standard mechanisms for tcg helper generation.
Signed-off-by Richard Henderson <[email protected]>--- include/exec/helper-gen.h | 1 + include/exec/helper-head.h | 12 ++++++++---- include/exec/helper-proto.h | 1 + include/exec/helper-tcg.h | 1 + tcg-runtime.c | 40 +++++++++++++++++++++++++--------------- tcg/tcg-op.h | 35 ++++++++++++++++++----------------- tcg/tcg-runtime.h | 30 +++++++++++++----------------- tcg/tcg.c | 16 ---------------- tcg/tcg.h | 2 -- 9 files changed, 67 insertions(+), 71 deletions(-)include/exec/helper-gen.h +1
-0@@ -80,6 +80,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ }#include "helper.h" +#include "tcg-runtime.h" #undef DEF_HELPER_FLAGS_0#undef DEF_HELPER_FLAGS_1include/exec/helper-head.h +2
-0@@ -18,6 +18,8 @@#ifndef DEF_HELPER_H #define DEF_HELPER_H 1 +#include "qemu/osdep.h" +#define HELPER (name) glue(helper_, name)#define GET_TCGV_i32 GET_TCGV_I32@@ -32,10 +34,12 @@#define dh_alias_s64 i64#define dh_alias_f32 i32#define dh_alias_f64 i64
include/exec/helper-head.h line 42
Quoted 10 lines
include/exec/helper-head.h +6
-4-#if TARGET_LONG_BITS ==32 -#define dh_alias_tl i32 -#else -#define dh_alias_tl i64 +#ifdef TARGET_LONG_BITS +# if TARGET_LONG_BITS ==32 +# define dh_alias_tl i32 +# else +# define dh_alias_tl i64 +# endif
This bit seems unrelated to the rest of the patch. In fact I can't see any uses of the dh_alias_* in the code base although there is some dh_alias() glue magic that could be throwing me off.
include/exec/helper-head.h line 43
Quoted 1 line
include/exec/helper-head.h +0
-0#endif
<snip>
Otherwise:
Signature · 1 line
Alex Bennée
Re: [Qemu-devel] [PATCH 04/10] tcg: Use helper-gen.h in tcg-op.h
In reply to Richard HendersonQuoted 23 lines · Richard Henderson
No need to open-code the setup of the builtin helpers.
Signed-off-by Richard Henderson <[email protected]>--- tcg/tcg-op.h | 175 +++++++++-------------------------------------------------- 1 file changed, 25 insertions(+), 150 deletions(-)tcg/tcg-op.h +8
-0@@ -24,6 +24,14 @@#include "tcg.h" #include "exec/helper-proto.h" +static inline void tcg_gen_helperN (void *func,int flags,int sizemask, +TCGArg ret,int nargs,TCGArg *args) +{ +tcg_gen_callN (&tcg_ctx, func, flags, sizemask, ret, nargs, args); +} + +#include "exec/helper-gen.h" +
<snip>
Quoted 15 lines
tcg/tcg-op.h +0
-14-/* A version of dh_sizemask from def-helper.h that doesn't rely on -preprocessor magic. */ -static inline int tcg_gen_sizemask (int n,int is_64bit,int is_signed) -{ -return (is_64bit << n*2 ) | (is_signed << (n*2 +1 )); -} - -/* helper calls */ -static inline void tcg_gen_helperN (void *func,int flags,int sizemask, -TCGArg ret,int nargs,TCGArg *args) -{ -tcg_gen_callN (&tcg_ctx, func, flags, sizemask, ret, nargs, args); -} -
<snip>
Quoted 5 lines
static inline void
tcg_gen_ld8u_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset)tcg/tcg-op.h +0
-0@@ -708,12 +675,7 @@ static inline void tcg_gen_div_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)tcg_gen_op5_i32 (INDEX_op_div2_i32, ret, t0, arg1, t0, arg2);tcg_temp_free_i32 (t0);
tcg/tcg-op.h static inline void tcg_gen_div_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2) · line 680
Quoted 10 lines
tcg/tcg-op.h +1
-6}else { -int sizemask =0 ; -/* Return value and both arguments are 32-bit and signed. */ - sizemask |=tcg_gen_sizemask (0 ,0 ,1 ); - sizemask |=tcg_gen_sizemask (1 ,0 ,1 ); - sizemask |=tcg_gen_sizemask (2 ,0 ,1 ); -tcg_gen_helper32 (helper_div_i32, sizemask, ret, arg1, arg2); +gen_helper_div_i32 (ret, arg1, arg2); } }
I'm having trouble figuring out what the sizemask stuff was trying to achieve and if it's required/covered after the change. Is the final helper now the one defined as?
DEF(div_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_div_i32))
it's hard to follow the parameters of this compared to the target helpers where the the argument sizes are a lot more explicit.
Signature · 1 line
Alex Bennée
Re: [Qemu-devel] [PATCH 05/10] tcg: Inline tcg_gen_helperN
In reply to Richard HendersonQuoted 1 line · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>
Quoted 81 lines
--- include/exec/helper-gen.h | 12 ++++++------ tcg/tcg-op.h | 7 ------- 2 files changed, 6 insertions(+), 13 deletions(-)include/exec/helper-gen.h +6
-6@@ -11,7 +11,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret)) \ { \int sizemask; \ sizemask =dh_is_64bit (ret); \ -tcg_gen_helperN (HELPER (name), flags, sizemask,dh_retvar (ret),0 ,NULL ); \ +tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),0 ,NULL ); \ }#define DEF_HELPER_FLAGS_1 (name, flags, ret, t1) \@@ -21,7 +21,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1int sizemask =0 ; \dh_sizemask (ret,0 ); \dh_arg (t1,1 ); \ -tcg_gen_helperN (HELPER (name), flags, sizemask,dh_retvar (ret),1 , args); \ +tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),1 , args); \ }#define DEF_HELPER_FLAGS_2 (name, flags, ret, t1, t2) \@@ -33,7 +33,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1dh_sizemask (ret,0 ); \dh_arg (t1,1 ); \dh_arg (t2,2 ); \ -tcg_gen_helperN (HELPER (name), flags, sizemask,dh_retvar (ret),2 , args); \ +tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),2 , args); \ }#define DEF_HELPER_FLAGS_3 (name, flags, ret, t1, t2, t3) \@@ -46,7 +46,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1dh_arg (t1,1 ); \dh_arg (t2,2 ); \dh_arg (t3,3 ); \ -tcg_gen_helperN (HELPER (name), flags, sizemask,dh_retvar (ret),3 , args); \ +tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),3 , args); \ }#define DEF_HELPER_FLAGS_4 (name, flags, ret, t1, t2, t3, t4) \@@ -60,7 +60,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1dh_arg (t2,2 ); \dh_arg (t3,3 ); \dh_arg (t4,4 ); \ -tcg_gen_helperN (HELPER (name), flags, sizemask,dh_retvar (ret),4 , args); \ +tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),4 , args); \ }#define DEF_HELPER_FLAGS_5 (name, flags, ret, t1, t2, t3, t4, t5) \@@ -76,7 +76,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \dh_arg (t3,3 ); \dh_arg (t4,4 ); \dh_arg (t5,5 ); \ -tcg_gen_helperN (HELPER (name), flags, sizemask,dh_retvar (ret),5 , args); \ +tcg_gen_callN (&tcg_ctx,HELPER (name), flags, sizemask,dh_retvar (ret),5 , args); \ }#include "helper.h" tcg/tcg-op.h +0
-7@@ -23,13 +23,6 @@*/ #include "tcg.h" #include "exec/helper-proto.h" - -static inline void tcg_gen_helperN (void *func,int flags,int sizemask, -TCGArg ret,int nargs,TCGArg *args) -{ -tcg_gen_callN (&tcg_ctx, func, flags, sizemask, ret, nargs, args); -} -#include "exec/helper-gen.h" int gen_new_label (void );
Signature · 1 line
Alex Bennée
Re: [Qemu-devel] [PATCH 07/10] tcg: Register the helper info struct rather than the name
In reply to Richard HendersonQuoted 3 lines · Richard Henderson
This will let us find all the info from the hash table.
Signed-off-by Richard Henderson <[email protected]>
Quoted 29 lines
--- tcg/tcg.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)tcg/tcg.c +5
-2@@ -356,7 +356,7 @@ void tcg_context_init(TCGContext *s)for (i =0 ; i <ARRAY_SIZE (all_helpers); ++i) {g_hash_table_insert (helper_table, (gpointer )all_helpers[i].func, - (gpointer )all_helpers[i].name); + (gpointer)&all_helpers[i]); }tcg_target_init (s);@@ -1149,7 +1149,10 @@ static inline const char *tcg_find_helper(TCGContext *s, uintptr_t val) {const char *ret =NULL ;if (s->helpers) { - ret =g_hash_table_lookup (s->helpers, (gpointer )val); +TCGHelperInfo *info =g_hash_table_lookup (s->helpers, (gpointer )val); +if (info) { + ret = info->name; + } }return ret; }
Signature · 1 line
Alex Bennée
Re: [Qemu-devel] [PATCH 08/10] tcg: Save flags and computed sizemask in TCGHelperInfo
In reply to Richard HendersonQuoted 2 lines · Richard Henderson
Signed-off-by Richard Henderson <[email protected]>---
<snip>
Quoted 18 lines
include/exec/helper-tcg.h +18
-0+#define DEF_HELPER_FLAGS_0 (NAME ,FLAGS , ret) \ + { .func = HELPER(NAME), .name = #NAME, .flags = FLAGS, \ + .sizemask = dh_sizemask(ret, 0) }, + +#define DEF_HELPER_FLAGS_1 (NAME ,FLAGS , ret, t1) \ + { .func = HELPER(NAME), .name = #NAME, .flags = FLAGS, \ + .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) }, + +#define DEF_HELPER_FLAGS_2 (NAME ,FLAGS , ret, t1, t2) \ + { .func = HELPER(NAME), .name = #NAME, .flags = FLAGS, \ + .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) \ + | dh_sizemask(t2, 2) }, + +#define DEF_HELPER_FLAGS_3 (NAME ,FLAGS , ret, t1, t2, t3) \ + { .func = HELPER(NAME), .name = #NAME, .flags = FLAGS, \ + .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) \ + | dh_sizemask(t2, 2) | dh_sizemask(t3, 3) }, +
include/exec/helper-tcg.h line 36
Quoted 10 lines
include/exec/helper-tcg.h +10
-0+#define DEF_HELPER_FLAGS_4 (NAME ,FLAGS , ret, t1, t2, t3, t4) \ + { .func = HELPER(NAME), .name = #NAME, .flags = FLAGS, \ + .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) \ + | dh_sizemask(t2, 2) | dh_sizemask(t3, 3) | dh_sizemask(t4, 4) }, + +#define DEF_HELPER_FLAGS_5 (NAME ,FLAGS , ret, t1, t2, t3, t4, t5) \ + { .func = HELPER(NAME), .name = #NAME, .flags = FLAGS, \ + .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) \ + | dh_sizemask(t2, 2) | dh_sizemask(t3, 3) | dh_sizemask(t4, 4) \ + | dh_sizemask(t5, 5) },
I'll come back to this when I understand the sizemask stuff better.
Quoted 17 lines
#include "
helper.h"
#include "tcg-runtime.h"tcg/tcg.c +2
-0@@ -310,6 +310,8 @@ void tcg_pool_reset(TCGContext *s)typedef struct TCGHelperInfo {void *func;const char *name; +unsigned flags; +unsigned sizemask; }TCGHelperInfo ;#include "exec/helper-proto.h"
tcg/tcg.c void tcg_gen_callN(TCGContext *s, void *func, unsigned int flags, · line 705
Quoted 8 lines
tcg/tcg.c +5
-0@@ -696,6 +698,11 @@ void tcg_gen_callN(TCGContext *s, void *func, unsigned int flags,int real_args;int nb_rets;TCGArg *nparam; +TCGHelperInfo *info; + + info =g_hash_table_lookup (s->helpers, (gpointer )func); +assert (info !=NULL ); +assert (info->sizemask == sizemask);
I assume g_assert vs assert is purely cosmetic? QEMU seems inconsistent at best about this :-/
Quoted 3 lines
tcg/tcg.c +0
-0#if defined(__sparc__) && !defined(__arch64__) \ && !defined(CONFIG_TCG_INTERPRETER )
Signature · 1 line
Alex Bennée
Re: [Qemu-devel] [PATCH 10/10] tcg: Move size effects out of dh_arg
In reply to Richard HendersonQuoted 121 lines · Richard Henderson
Tidying the initialization of the args arrays at the same time.
Signed-off-by Richard Henderson <[email protected]>--- include/exec/helper-gen.h | 87 ++++++++++++++++++++-------------------------- include/exec/helper-head.h | 2 +- 2 files changed, 39 insertions(+), 50 deletions(-)include/exec/helper-gen.h +38
-49@@ -6,65 +6,54 @@#include <exec/helper-head.h> -#define DEF_HELPER_FLAGS_0 (name, flags, ret) \ -static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret)) \ -{ \ - tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 0, NULL); \ +#define DEF_HELPER_FLAGS_0 (name, flags, ret) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret)) \ +{ \ + tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 0, NULL); \ } -#define DEF_HELPER_FLAGS_1 (name, flags, ret, t1) \ -static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1)) \ -{ \ - TCGArg args[1]; \ - dh_arg(t1, 1); \ - tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 1, args); \ +#define DEF_HELPER_FLAGS_1 (name, flags, ret, t1) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ + dh_arg_decl(t1, 1)) \ +{ \ + TCGArg args[1] = { dh_arg(t1, 1) }; \ + tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 1, args); \ } -#define DEF_HELPER_FLAGS_2 (name, flags, ret, t1, t2) \ -static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1), \ - dh_arg_decl(t2, 2)) \ -{ \ - TCGArg args[2]; \ - dh_arg(t1, 1); \ - dh_arg(t2, 2); \ - tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 2, args); \ +#define DEF_HELPER_FLAGS_2 (name, flags, ret, t1, t2) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ + dh_arg_decl(t1, 1), dh_arg_decl(t2, 2)) \ +{ \ + TCGArg args[2] = { dh_arg(t1, 1), dh_arg(t2, 2) }; \ + tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 2, args); \ } -#define DEF_HELPER_FLAGS_3 (name, flags, ret, t1, t2, t3) \ -static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1), \ - dh_arg_decl(t2, 2), dh_arg_decl(t3, 3)) \ -{ \ - TCGArg args[3]; \ - dh_arg(t1, 1); \ - dh_arg(t2, 2); \ - dh_arg(t3, 3); \ - tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 3, args); \ +#define DEF_HELPER_FLAGS_3 (name, flags, ret, t1, t2, t3) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ + dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3)) \ +{ \ + TCGArg args[3] = { dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3) }; \ + tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 3, args); \ } -#define DEF_HELPER_FLAGS_4 (name, flags, ret, t1, t2, t3, t4) \ -static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1), \ - dh_arg_decl(t2, 2), dh_arg_decl(t3, 3), dh_arg_decl(t4, 4)) \ -{ \ - TCGArg args[4]; \ - dh_arg(t1, 1); \ - dh_arg(t2, 2); \ - dh_arg(t3, 3); \ - dh_arg(t4, 4); \ - tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 4, args); \ +#define DEF_HELPER_FLAGS_4 (name, flags, ret, t1, t2, t3, t4) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ + dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), \ + dh_arg_decl(t3, 3), dh_arg_decl(t4, 4)) \ +{ \ + TCGArg args[4] = { dh_arg(t1, 1), dh_arg(t2, 2), \ + dh_arg(t3, 3), dh_arg(t4, 4) }; \ + tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 4, args); \ } -#define DEF_HELPER_FLAGS_5 (name, flags, ret, t1, t2, t3, t4, t5) \ -static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ - dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3), \ - dh_arg_decl(t4, 4), dh_arg_decl(t5, 5)) \ -{ \ - TCGArg args[5]; \ - dh_arg(t1, 1); \ - dh_arg(t2, 2); \ - dh_arg(t3, 3); \ - dh_arg(t4, 4); \ - dh_arg(t5, 5); \ - tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 5, args); \ +#define DEF_HELPER_FLAGS_5 (name, flags, ret, t1, t2, t3, t4, t5) \ +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ + dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3), \ + dh_arg_decl(t4, 4), dh_arg_decl(t5, 5)) \ +{ \ + TCGArg args[5] = { dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3), \ + dh_arg(t4, 4), dh_arg(t5, 5) }; \ + tcg_gen_callN(&tcg_ctx, HELPER(name), dh_retvar(ret), 5, args); \ }#include "helper.h" include/exec/helper-head.h +0
-0
include/exec/helper-head.h line 115
Quoted 5 lines
include/exec/helper-head.h +1
-1@@ -112,7 +112,7 @@ ((dh_is_64bit(t) << (n*2)) | (dh_is_signed(t) << (n*2+1)))#define dh_arg (t, n) \ - (args[n - 1] = glue(GET_TCGV_, dh_alias(t))(glue(arg, n))) + glue(GET_TCGV_, dh_alias(t))(glue(arg, n))
Yeah that's marginally cleaner. I'm going to have to work on better understanding the glue stuff. However based on superficial understanding:
Quoted 2 lines
include/exec/helper-head.h +0
-0#define dh_arg_decl (t, n) glue(TCGv_, dh_alias(t)) glue(arg, n)
Signature · 1 line
Alex Bennée
Re: [Qemu-devel] [PATCH 03/10] tcg: Push tcg-runtime routines into exec/helper-*
In reply to Alex BennéeQuoted 10 lines · Alex Bennée
Quoted 6 lines
+#ifdef
TARGET_LONG_BITSinclude/exec/helper-head.h line 42
Quoted 5 lines
include/exec/helper-head.h +5
-0+# if TARGET_LONG_BITS ==32 +# define dh_alias_tl i32 +# else +# define dh_alias_tl i64 +# endif This bit seems unrelated to the rest of the patch. In fact I can't see any uses of the dh_alias_* in the code base although there is some
dh_alias()glue magic that could be throwing me off.
It's the fact that the file gets used in tcg-runtime.c, a generic file compiled once that does not have TARGET_LONG_BITS defined at all. I take care to leave "tl" undefined as an alias so that we'd get a compile-time error if it were used.
r~
Re: [Qemu-devel] [PATCH 04/10] tcg: Use helper-gen.h in tcg-op.h
In reply to Alex BennéeQuoted 8 lines · Alex Bennée
I'm having trouble figuring out what the sizemask stuff was trying to achieve and if it's required/covered after the change. Is the final helper now the one defined as?
DEF(div_i32, 1, 2, 0, IMPL(TCG_TARGET_HAS_div_i32))it's hard to follow the parameters of this compared to the target helpers where the the argument sizes are a lot more explicit.
The sizemask stuff is about encoding the argument types of the function.
What you've quoted above is not the helper, but the TCG opcode. The helper is defined as
DEF_HELPER_FLAGS_2(div_i32, TCG_CALL_NO_RWG_SE, s32, s32, s32)
in the previous patch.
r~
Re: [Qemu-devel] [PATCH 08/10] tcg: Save flags and computed sizemask in TCGHelperInfo
In reply to Alex BennéeQuoted 5 lines · Alex Bennée
Quoted 3 lines
+ info =
g_hash_table_lookup(s->helpers, (gpointer)func);Quoted 2 lines
tcg/tcg.c +2
-0+assert (info !=NULL ); +assert (info->sizemask == sizemask);I assume
g_assertvs assert is purely cosmetic? QEMU seems inconsistent at best about this :-/
Yes indeed. It doesn't help that g_assert is stupid and doesn't evaluate its argument when assertions are disabled, so that you can get unused variable warnings.
The best sort of assert is as we do for tcg_debug_assert, where we invoke __builtin_unreachable when not aborting, which gives the compiler optimization info about the expression.
I'm not sure how best to clean all this up in qemu, but I'm pretty sure that more use of glib isn't it.
r~