[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 23/34] accel/tcg/plugin: Don't search for the function pointer
From: |
Richard Henderson |
Subject: |
[PATCH v3 23/34] accel/tcg/plugin: Don't search for the function pointer index |
Date: |
Thu, 1 Dec 2022 21:39:47 -0800 |
The function pointer is immediately after the output and input
operands; no need to search.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
accel/tcg/plugin-gen.c | 29 +++++++++++------------------
1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c
index 80dff68934..9e359c006a 100644
--- a/accel/tcg/plugin-gen.c
+++ b/accel/tcg/plugin-gen.c
@@ -381,32 +381,25 @@ static TCGOp *copy_st_ptr(TCGOp **begin_op, TCGOp *op)
static TCGOp *copy_call(TCGOp **begin_op, TCGOp *op, void *empty_func,
void *func, int *cb_idx)
{
+ TCGOp *old_op;
+ int func_idx;
+
/* copy all ops until the call */
do {
op = copy_op_nocheck(begin_op, op);
} while (op->opc != INDEX_op_call);
/* fill in the op call */
- op->param1 = (*begin_op)->param1;
- op->param2 = (*begin_op)->param2;
+ old_op = *begin_op;
+ TCGOP_CALLI(op) = TCGOP_CALLI(old_op);
+ TCGOP_CALLO(op) = TCGOP_CALLO(old_op);
tcg_debug_assert(op->life == 0);
- if (*cb_idx == -1) {
- int i;
- /*
- * Instead of working out the position of the callback in args[], just
- * look for @empty_func, since it should be a unique pointer.
- */
- for (i = 0; i < MAX_OPC_PARAM_ARGS; i++) {
- if ((uintptr_t)(*begin_op)->args[i] == (uintptr_t)empty_func) {
- *cb_idx = i;
- break;
- }
- }
- tcg_debug_assert(i < MAX_OPC_PARAM_ARGS);
- }
- op->args[*cb_idx] = (uintptr_t)func;
- op->args[*cb_idx + 1] = (*begin_op)->args[*cb_idx + 1];
+ func_idx = TCGOP_CALLO(op) + TCGOP_CALLI(op);
+ *cb_idx = func_idx;
+
+ op->args[func_idx] = (uintptr_t)func;
+ op->args[func_idx + 1] = old_op->args[func_idx + 1];
return op;
}
--
2.34.1
- [PATCH v3 17/34] tcg: Move TCG_TYPE_COUNT outside enum, (continued)
- [PATCH v3 17/34] tcg: Move TCG_TYPE_COUNT outside enum, Richard Henderson, 2022/12/02
- [PATCH v3 16/34] tcg: Allocate TCGTemp pairs in host memory order, Richard Henderson, 2022/12/02
- [PATCH v3 18/34] tcg: Introduce tcg_type_size, Richard Henderson, 2022/12/02
- [PATCH v3 19/34] tcg: Introduce TCGCallReturnKind and TCGCallArgumentKind, Richard Henderson, 2022/12/02
- [PATCH v3 21/34] tcg: Replace TCG_TARGET_EXTEND_ARGS with TCG_TARGET_CALL_ARG_I32, Richard Henderson, 2022/12/02
- [PATCH v3 20/34] tcg: Replace TCG_TARGET_CALL_ALIGN_ARGS with TCG_TARGET_CALL_ARG_I64, Richard Henderson, 2022/12/02
- [PATCH v3 22/34] tcg: Use TCG_CALL_ARG_EVEN for TCI special case, Richard Henderson, 2022/12/02
- [PATCH v3 25/34] accel/tcg/plugin: Use copy_op in append_{udata, mem}_cb, Richard Henderson, 2022/12/02
- [PATCH v3 24/34] accel/tcg/plugin: Avoid duplicate copy in copy_call, Richard Henderson, 2022/12/02
- [PATCH v3 26/34] tci: MAX_OPC_PARAM_IARGS is no longer used, Richard Henderson, 2022/12/02
- [PATCH v3 23/34] accel/tcg/plugin: Don't search for the function pointer index,
Richard Henderson <=
- [PATCH v3 27/34] tcg: Vary the allocation size for TCGOp, Richard Henderson, 2022/12/02
- [PATCH v3 28/34] tcg: Use output_pref wrapper function, Richard Henderson, 2022/12/02
- [PATCH v3 30/34] tcg: Convert typecode_to_ffi from array to function, Richard Henderson, 2022/12/02
- [PATCH v3 32/34] tcg: Move ffi_cif pointer into TCGHelperInfo, Richard Henderson, 2022/12/02
- [PATCH v3 31/34] tcg: Factor init_ffi_layouts() out of tcg_context_init(), Richard Henderson, 2022/12/02
- [PATCH v3 29/34] tcg: Reorg function calls, Richard Henderson, 2022/12/02
- [PATCH v3 33/34] tcg/aarch64: Merge tcg_out_callr into tcg_out_call, Richard Henderson, 2022/12/02