Move the TCGv typedef into tcg.h. Per-target builds keep it as an alias of TCGv_i32 or TCGv_i64. Common-system builds use an opaque TCGv, with TCGv_tl and tcg_imm_tl beside it. The tcg_gen_*_tl macros stay in tcg-op.h.
Signed-off-by: Yonggang Luo <[email protected]> --- include/tcg/tcg-op.h | 2 -- include/tcg/tcg.h | 22 ++++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 37211642365..6835ad97901 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -32,14 +32,12 @@ #endif #if TARGET_LONG_BITS == 32 -typedef TCGv_i32 TCGv; #define tcg_temp_new() tcg_temp_new_i32() #define tcg_global_mem_new tcg_global_mem_new_i32 #define tcgv_tl_temp tcgv_i32_temp #define tcg_gen_qemu_ld_tl tcg_gen_qemu_ld_i32 #define tcg_gen_qemu_st_tl tcg_gen_qemu_st_i32 #elif TARGET_LONG_BITS == 64 -typedef TCGv_i64 TCGv; #define tcg_temp_new() tcg_temp_new_i64() #define tcg_global_mem_new tcg_global_mem_new_i64 #define tcgv_tl_temp tcgv_i64_temp diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 7669dc1c2db..7790228eeef 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -179,8 +179,11 @@ typedef tcg_target_ulong TCGArg; * TCGv_vaddr: an integer type wide enough to hold a target pointer type * TCGv_vec : a host vector type; the exact size is not exposed to the CPU front-end code. - * TCGv : an integer type the same size as target_ulong - (an alias for either TCGv_i32 or TCGv_i64) + * TCGv : an integer type the same size as target_ulong. + Per-target compiles alias TCGv_i32 or TCGv_i64. + Common-system compiles use a distinct opaque TCGv; + use tcg_gen_*_tl. + * TCGv_tl : alias of TCGv for helper-head glue(TCGv_, tl) The compiler's type checking will complain if you mix them up and pass the wrong sized TCGv to a function. @@ -203,6 +206,21 @@ typedef struct TCGv_i64_d *TCGv_i64; typedef struct TCGv_i128_d *TCGv_i128; typedef struct TCGv_ptr_d *TCGv_ptr; typedef struct TCGv_vec_d *TCGv_vec; +#ifdef COMPILING_PER_TARGET +# include "exec/target_long.h" +# if TARGET_LONG_BITS == 32 +typedef TCGv_i32 TCGv; +# elif TARGET_LONG_BITS == 64 +typedef TCGv_i64 TCGv; +# else +# error Unhandled TARGET_LONG_BITS value +# endif +typedef target_long tcg_imm_tl; +#else +typedef struct TCGv_d *TCGv; +typedef int64_t tcg_imm_tl; +#endif +typedef TCGv TCGv_tl; typedef TCGv_ptr TCGv_env; #if __SIZEOF_POINTER__ == 4 -- 2.52.0.windows.1
