[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 17/35] tcg: Move tcg_constant_* out of line
|
From: |
Richard Henderson |
|
Subject: |
[PATCH 17/35] tcg: Move tcg_constant_* out of line |
|
Date: |
Mon, 6 Nov 2023 18:48:24 -0800 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231029210848.78234-10-richard.henderson@linaro.org>
---
include/tcg/tcg-op-common.h | 8 ++++++++
include/tcg/tcg.h | 26 --------------------------
tcg/tcg-internal.h | 7 +++++++
tcg/tcg.c | 15 +++++++++++++++
4 files changed, 30 insertions(+), 26 deletions(-)
diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h
index 760c67683b..dddf93067e 100644
--- a/include/tcg/tcg-op-common.h
+++ b/include/tcg/tcg-op-common.h
@@ -12,6 +12,11 @@
#include "exec/helper-proto-common.h"
#include "exec/helper-gen-common.h"
+TCGv_i32 tcg_constant_i32(int32_t val);
+TCGv_i64 tcg_constant_i64(int64_t val);
+TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val);
+TCGv_vec tcg_constant_vec_matching(TCGv_vec match, unsigned vece, int64_t val);
+
/* Generic ops. */
void gen_set_label(TCGLabel *l);
@@ -459,6 +464,9 @@ void tcg_gen_stl_vec(TCGv_vec r, TCGv_ptr base, TCGArg
offset, TCGType t);
# define NAT TCGv_i64
#endif
+TCGv_ptr tcg_constant_ptr_int(intptr_t x);
+#define tcg_constant_ptr(X) tcg_constant_ptr_int((intptr_t)(X))
+
static inline void tcg_gen_ld_ptr(TCGv_ptr r, TCGv_ptr a, intptr_t o)
{
glue(tcg_gen_ld_,PTR)((NAT)r, a, o);
diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
index 3a4c0f124f..1ae131c242 100644
--- a/include/tcg/tcg.h
+++ b/include/tcg/tcg.h
@@ -934,32 +934,6 @@ void tcg_remove_ops_after(TCGOp *op);
void tcg_optimize(TCGContext *s);
-/*
- * Locate or create a read-only temporary that is a constant.
- * This kind of temporary need not be freed, but for convenience
- * will be silently ignored by tcg_temp_free_*.
- */
-TCGTemp *tcg_constant_internal(TCGType type, int64_t val);
-
-static inline TCGv_i32 tcg_constant_i32(int32_t val)
-{
- return temp_tcgv_i32(tcg_constant_internal(TCG_TYPE_I32, val));
-}
-
-static inline TCGv_i64 tcg_constant_i64(int64_t val)
-{
- return temp_tcgv_i64(tcg_constant_internal(TCG_TYPE_I64, val));
-}
-
-TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val);
-TCGv_vec tcg_constant_vec_matching(TCGv_vec match, unsigned vece, int64_t val);
-
-#if UINTPTR_MAX == UINT32_MAX
-# define tcg_constant_ptr(x) ((TCGv_ptr)tcg_constant_i32((intptr_t)(x)))
-#else
-# define tcg_constant_ptr(x) ((TCGv_ptr)tcg_constant_i64((intptr_t)(x)))
-#endif
-
TCGLabel *gen_new_label(void);
/**
diff --git a/tcg/tcg-internal.h b/tcg/tcg-internal.h
index c9ac34fc3d..6c9d9e48db 100644
--- a/tcg/tcg-internal.h
+++ b/tcg/tcg-internal.h
@@ -83,6 +83,13 @@ static inline TCGv_i64 TCGV128_HIGH(TCGv_i128 t)
bool tcg_target_has_memory_bswap(MemOp memop);
+/*
+ * Locate or create a read-only temporary that is a constant.
+ * This kind of temporary need not be freed, but for convenience
+ * will be silently ignored by tcg_temp_free_*.
+ */
+TCGTemp *tcg_constant_internal(TCGType type, int64_t val);
+
void tcg_gen_op1(TCGOpcode, TCGArg);
void tcg_gen_op2(TCGOpcode, TCGArg, TCGArg);
void tcg_gen_op3(TCGOpcode, TCGArg, TCGArg, TCGArg);
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 6766b60b8a..ab0d227c00 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1806,6 +1806,21 @@ TCGTemp *tcg_constant_internal(TCGType type, int64_t val)
return ts;
}
+TCGv_i32 tcg_constant_i32(int32_t val)
+{
+ return temp_tcgv_i32(tcg_constant_internal(TCG_TYPE_I32, val));
+}
+
+TCGv_i64 tcg_constant_i64(int64_t val)
+{
+ return temp_tcgv_i64(tcg_constant_internal(TCG_TYPE_I64, val));
+}
+
+TCGv_ptr tcg_constant_ptr_int(intptr_t val)
+{
+ return temp_tcgv_ptr(tcg_constant_internal(TCG_TYPE_PTR, val));
+}
+
TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val)
{
val = dup_const(vece, val);
--
2.34.1
- [PATCH 05/35] tcg/loongarch64: Use cpuinfo.h, (continued)
- [PATCH 05/35] tcg/loongarch64: Use cpuinfo.h, Richard Henderson, 2023/11/06
- [PATCH 07/35] accel/tcg: Remove redundant case in store_atom_16, Richard Henderson, 2023/11/06
- [PATCH 08/35] accel/tcg: Fix condition for store_atom_insert_al16, Richard Henderson, 2023/11/06
- [PATCH 11/35] tcg: Move generic expanders out of line, Richard Henderson, 2023/11/06
- [PATCH 09/35] tcg: Mark tcg_gen_op* as noinline, Richard Henderson, 2023/11/06
- [PATCH 10/35] tcg: Move tcg_gen_op* out of line, Richard Henderson, 2023/11/06
- [PATCH 12/35] tcg: Move 32-bit expanders out of line, Richard Henderson, 2023/11/06
- [PATCH 15/35] tcg: Move tcg_gen_opN declarations to tcg-internal.h, Richard Henderson, 2023/11/06
- [PATCH 13/35] tcg: Move 64-bit expanders out of line, Richard Henderson, 2023/11/06
- [PATCH 14/35] tcg: Move vec_gen_* declarations to tcg-internal.h, Richard Henderson, 2023/11/06
- [PATCH 17/35] tcg: Move tcg_constant_* out of line,
Richard Henderson <=
- [PATCH 16/35] tcg: Unexport tcg_gen_op*_{i32,i64}, Richard Henderson, 2023/11/06
- [PATCH 18/35] tcg: Move tcg_temp_new_*, tcg_global_mem_new_* out of line, Richard Henderson, 2023/11/06
- [PATCH 19/35] tcg: Move tcg_temp_free_* out of line, Richard Henderson, 2023/11/06
- [PATCH 20/35] tcg/mips: Split out tcg_out_setcond_int, Richard Henderson, 2023/11/06
- [PATCH 21/35] tcg/mips: Always implement movcond, Richard Henderson, 2023/11/06
- [PATCH 06/35] host/include/loongarch64: Add atomic16 load and store, Richard Henderson, 2023/11/06
- [PATCH 22/35] tcg: Remove TCG_TARGET_HAS_movcond_{i32,i64}, Richard Henderson, 2023/11/06
- [PATCH 23/35] tcg/mips: Implement neg opcodes, Richard Henderson, 2023/11/06
- [PATCH 24/35] tcg/loongarch64: Implement neg opcodes, Richard Henderson, 2023/11/06
- [PATCH 26/35] tcg: Don't free vector results, Richard Henderson, 2023/11/06