[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 22/52] tcg: Use pointers in TCGOp->args
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v7 22/52] tcg: Use pointers in TCGOp->args |
Date: |
Fri, 20 Oct 2017 16:19:53 -0700 |
This limits the indexing into tcg_ctx.temps to initial
opcode generation time.
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/tcg.h | 46 +++++++++++++++++++++-------------------------
1 file changed, 21 insertions(+), 25 deletions(-)
diff --git a/tcg/tcg.h b/tcg/tcg.h
index 7fe0fb9e07..17779393a1 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -701,65 +701,61 @@ static inline size_t temp_idx(TCGTemp *ts)
static inline TCGArg temp_arg(TCGTemp *ts)
{
- ptrdiff_t a = (void *)ts - (void *)&tcg_ctx;
- tcg_debug_assert(a >= offsetof(TCGContext, temps)
- && a < offsetof(TCGContext, temps[tcg_ctx.nb_temps]));
- return a;
+ return (uintptr_t)ts;
}
static inline TCGTemp *arg_temp(TCGArg a)
{
- if (a == TCG_CALL_DUMMY_ARG) {
- return NULL;
- }
- tcg_debug_assert(a >= offsetof(TCGContext, temps)
- && a < offsetof(TCGContext, temps[tcg_ctx.nb_temps]));
- return (void *)&tcg_ctx + a;
+ return (TCGTemp *)a;
}
-static inline TCGArg tcgv_i32_arg(TCGv_i32 t)
+static inline TCGTemp *tcgv_i32_temp(TCGv_i32 v)
{
- return (intptr_t)t;
+ uintptr_t o = (uintptr_t)v;
+ TCGTemp *t = (void *)&tcg_ctx + o;
+ tcg_debug_assert(offsetof(TCGContext, temps[temp_idx(t)]) == o);
+ return t;
}
-static inline TCGArg tcgv_i64_arg(TCGv_i64 t)
+static inline TCGTemp *tcgv_i64_temp(TCGv_i64 v)
{
- return (intptr_t)t;
+ return tcgv_i32_temp((TCGv_i32)v);
}
-static inline TCGArg tcgv_ptr_arg(TCGv_ptr t)
+static inline TCGTemp *tcgv_ptr_temp(TCGv_ptr v)
{
- return (intptr_t)t;
+ return tcgv_i32_temp((TCGv_i32)v);
}
-static inline TCGTemp *tcgv_i32_temp(TCGv_i32 t)
+static inline TCGArg tcgv_i32_arg(TCGv_i32 v)
{
- return arg_temp(tcgv_i32_arg(t));
+ return temp_arg(tcgv_i32_temp(v));
}
-static inline TCGTemp *tcgv_i64_temp(TCGv_i64 t)
+static inline TCGArg tcgv_i64_arg(TCGv_i64 v)
{
- return arg_temp(tcgv_i64_arg(t));
+ return temp_arg(tcgv_i64_temp(v));
}
-static inline TCGTemp *tcgv_ptr_temp(TCGv_ptr t)
+static inline TCGArg tcgv_ptr_arg(TCGv_ptr v)
{
- return arg_temp(tcgv_ptr_arg(t));
+ return temp_arg(tcgv_ptr_temp(v));
}
static inline TCGv_i32 temp_tcgv_i32(TCGTemp *t)
{
- return (TCGv_i32)temp_arg(t);
+ (void)temp_idx(t); /* trigger embedded assert */
+ return (TCGv_i32)((void *)t - (void *)&tcg_ctx);
}
static inline TCGv_i64 temp_tcgv_i64(TCGTemp *t)
{
- return (TCGv_i64)temp_arg(t);
+ return (TCGv_i64)temp_tcgv_i32(t);
}
static inline TCGv_ptr temp_tcgv_ptr(TCGTemp *t)
{
- return (TCGv_ptr)temp_arg(t);
+ return (TCGv_ptr)temp_tcgv_i32(t);
}
#if TCG_TARGET_REG_BITS == 32
--
2.13.6
- [Qemu-devel] [PATCH v7 14/52] tcg: Push tcg_ctx into generator functions, (continued)
- [Qemu-devel] [PATCH v7 14/52] tcg: Push tcg_ctx into generator functions, Richard Henderson, 2017/10/20
- [Qemu-devel] [PATCH v7 17/52] tcg: Introduce temp_tcgv_{i32, i64, ptr}, Richard Henderson, 2017/10/20
- [Qemu-devel] [PATCH v7 16/52] tcg: Introduce tcgv_{i32, i64, ptr}_{arg, temp}, Richard Henderson, 2017/10/20
- Re: [Qemu-devel] [PATCH v7 16/52] tcg: Introduce tcgv_{i32, i64, ptr}_{arg, temp}, Emilio G. Cota, 2017/10/23
- Re: [Qemu-devel] [PATCH v7 16/52] tcg: Introduce tcgv_{i32, i64, ptr}_{arg, temp}, Philippe Mathieu-Daudé, 2017/10/23
- [Qemu-devel] [PATCH v7 18/52] tcg: Remove GET_TCGV_* and MAKE_TCGV_*, Richard Henderson, 2017/10/20
- [Qemu-devel] [PATCH v7 22/52] tcg: Use pointers in TCGOp->args,
Richard Henderson <=
- [Qemu-devel] [PATCH v7 21/52] tcg: Use offsets not indices for TCGv_*, Richard Henderson, 2017/10/20
- [Qemu-devel] [PATCH v7 20/52] qom: Introduce CPUClass.tcg_initialize, Richard Henderson, 2017/10/20
- [Qemu-devel] [PATCH v7 23/52] tcg: define CF_PARALLEL and use it for TB hashing along with CF_COUNT_MASK, Richard Henderson, 2017/10/20
- [Qemu-devel] [PATCH v7 25/52] tcg: Include CF_COUNT_MASK in CF_HASH_MASK, Richard Henderson, 2017/10/20