[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 23/26] tcg: Pass TCGTempKind to tcg_temp_new_internal
From: |
Richard Henderson |
Subject: |
[PATCH 23/26] tcg: Pass TCGTempKind to tcg_temp_new_internal |
Date: |
Wed, 5 Oct 2022 20:44:18 -0700 |
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/tcg/tcg.h | 14 +++++++-------
tcg/tcg.c | 20 +++++++++++++++-----
2 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
index d84bae6e3f..e01a47ec20 100644
--- a/include/tcg/tcg.h
+++ b/include/tcg/tcg.h
@@ -846,7 +846,7 @@ void tcg_set_frame(TCGContext *s, TCGReg reg, intptr_t
start, intptr_t size);
TCGTemp *tcg_global_mem_new_internal(TCGType, TCGv_ptr,
intptr_t, const char *);
-TCGTemp *tcg_temp_new_internal(TCGType, bool);
+TCGTemp *tcg_temp_new_internal(TCGType, TCGTempKind kind);
void tcg_temp_free_internal(TCGTemp *);
TCGv_vec tcg_temp_new_vec(TCGType type);
TCGv_vec tcg_temp_new_vec_matching(TCGv_vec match);
@@ -880,13 +880,13 @@ static inline TCGv_i32 tcg_global_mem_new_i32(TCGv_ptr
reg, intptr_t offset,
static inline TCGv_i32 tcg_temp_new_i32(void)
{
- TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I32, false);
+ TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I32, TEMP_NORMAL);
return temp_tcgv_i32(t);
}
static inline TCGv_i32 tcg_temp_local_new_i32(void)
{
- TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I32, true);
+ TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I32, TEMP_LOCAL);
return temp_tcgv_i32(t);
}
@@ -899,13 +899,13 @@ static inline TCGv_i64 tcg_global_mem_new_i64(TCGv_ptr
reg, intptr_t offset,
static inline TCGv_i64 tcg_temp_new_i64(void)
{
- TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I64, false);
+ TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I64, TEMP_NORMAL);
return temp_tcgv_i64(t);
}
static inline TCGv_i64 tcg_temp_local_new_i64(void)
{
- TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I64, true);
+ TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_I64, TEMP_LOCAL);
return temp_tcgv_i64(t);
}
@@ -918,13 +918,13 @@ static inline TCGv_ptr tcg_global_mem_new_ptr(TCGv_ptr
reg, intptr_t offset,
static inline TCGv_ptr tcg_temp_new_ptr(void)
{
- TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_PTR, false);
+ TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_PTR, TEMP_NORMAL);
return temp_tcgv_ptr(t);
}
static inline TCGv_ptr tcg_temp_local_new_ptr(void)
{
- TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_PTR, true);
+ TCGTemp *t = tcg_temp_new_internal(TCG_TYPE_PTR, TEMP_LOCAL);
return temp_tcgv_ptr(t);
}
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 612a12f58f..acdbd5a9a2 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -942,14 +942,24 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type,
TCGv_ptr base,
return ts;
}
-TCGTemp *tcg_temp_new_internal(TCGType type, bool temp_local)
+TCGTemp *tcg_temp_new_internal(TCGType type, TCGTempKind kind)
{
TCGContext *s = tcg_ctx;
- TCGTempKind kind = temp_local ? TEMP_LOCAL : TEMP_NORMAL;
TCGTemp *ts;
int idx, k;
- k = type + (temp_local ? TCG_TYPE_COUNT : 0);
+ switch (kind) {
+ case TEMP_NORMAL:
+ k = 0;
+ break;
+ case TEMP_LOCAL:
+ k = TCG_TYPE_COUNT;
+ break;
+ default:
+ g_assert_not_reached();
+ }
+ k += type;
+
idx = find_first_bit(s->free_temps[k].l, TCG_MAX_TEMPS);
if (idx < TCG_MAX_TEMPS) {
/* There is already an available temp with the right type. */
@@ -1008,7 +1018,7 @@ TCGv_vec tcg_temp_new_vec(TCGType type)
}
#endif
- t = tcg_temp_new_internal(type, 0);
+ t = tcg_temp_new_internal(type, TEMP_NORMAL);
return temp_tcgv_vec(t);
}
@@ -1019,7 +1029,7 @@ TCGv_vec tcg_temp_new_vec_matching(TCGv_vec match)
tcg_debug_assert(t->temp_allocated != 0);
- t = tcg_temp_new_internal(t->base_type, 0);
+ t = tcg_temp_new_internal(t->base_type, TEMP_NORMAL);
return temp_tcgv_vec(t);
}
--
2.34.1
- [PATCH 01/26] target/s390x: Use tcg_constant_* in local contexts, (continued)
- [PATCH 01/26] target/s390x: Use tcg_constant_* in local contexts, Richard Henderson, 2022/10/05
- [PATCH 02/26] target/s390x: Use tcg_constant_* for DisasCompare, Richard Henderson, 2022/10/05
- [PATCH 04/26] target/s390x: Use tcg_constant_* in translate_vx.c.inc, Richard Henderson, 2022/10/05
- [PATCH 07/26] target/s390x: Remove pc argument to pc_to_link_into, Richard Henderson, 2022/10/05
- [PATCH 06/26] target/s390x: Introduce gen_psw_addr_disp, Richard Henderson, 2022/10/05
- [PATCH 08/26] target/s390x: Use gen_psw_addr_disp in pc_to_link_info, Richard Henderson, 2022/10/05
- [PATCH 22/26] target/s390x: Pass original r2 register to BCR, Richard Henderson, 2022/10/05
- [PATCH 17/26] target/s390x: Introduce help_goto_indirect, Richard Henderson, 2022/10/05
- [PATCH 20/26] target/s390x: Split per_breaking_event from per_branch_*, Richard Henderson, 2022/10/05
- [PATCH 09/26] target/s390x: Use gen_psw_addr_disp in save_link_info, Richard Henderson, 2022/10/05
- [PATCH 23/26] tcg: Pass TCGTempKind to tcg_temp_new_internal,
Richard Henderson <=
- [PATCH 25/26] tcg: Introduce tcg_temp_is_normal_*, Richard Henderson, 2022/10/05
- [PATCH 05/26] target/s390x: Change help_goto_direct to work on displacements, Richard Henderson, 2022/10/05
- [PATCH 18/26] target/s390x: Split per_branch, Richard Henderson, 2022/10/05
- [PATCH 10/26] target/s390x: Use gen_psw_addr_disp in op_sam, Richard Henderson, 2022/10/05
- [PATCH 11/26] target/s390x: Use ilen instead in branches, Richard Henderson, 2022/10/05
- [PATCH 12/26] target/s390x: Move masking of psw.addr to cpu_get_tb_cpu_state, Richard Henderson, 2022/10/05
- [PATCH 14/26] target/s390x: Don't set gbea for user-only, Richard Henderson, 2022/10/05
- [PATCH 21/26] target/s390x: Remove PER check from use_goto_tb, Richard Henderson, 2022/10/05
- [PATCH 16/26] target/s390x: Disable conditional branch-to-next for PER, Richard Henderson, 2022/10/05
- [PATCH 26/26] target/s390x: Enable TARGET_TB_PCREL, Richard Henderson, 2022/10/05