[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 23/31] tcg: Allocate objects contiguously in temp_allocate_frame
From: |
Richard Henderson |
Subject: |
[PATCH 23/31] tcg: Allocate objects contiguously in temp_allocate_frame |
Date: |
Thu, 20 Oct 2022 21:52:34 +1000 |
When allocating a temp to the stack frame, consider the
base type and allocate all parts at once.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/tcg.c | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 5b17892058..3a0cbe8ac6 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -3318,11 +3318,12 @@ static void check_regs(TCGContext *s)
static void temp_allocate_frame(TCGContext *s, TCGTemp *ts)
{
- int size = tcg_type_size(ts->type);
- int align;
intptr_t off;
+ int size, align;
- switch (ts->type) {
+ /* When allocating an object, look at the full type. */
+ size = tcg_type_size(ts->base_type);
+ switch (ts->base_type) {
case TCG_TYPE_I32:
align = 4;
break;
@@ -3353,13 +3354,26 @@ static void temp_allocate_frame(TCGContext *s, TCGTemp
*ts)
tcg_raise_tb_overflow(s);
}
s->current_frame_offset = off + size;
-
- ts->mem_offset = off;
#if defined(__sparc__)
- ts->mem_offset += TCG_TARGET_STACK_BIAS;
+ off += TCG_TARGET_STACK_BIAS;
#endif
- ts->mem_base = s->frame_temp;
- ts->mem_allocated = 1;
+
+ /* If the object was subdivided, assign memory to all the parts. */
+ if (ts->base_type != ts->type) {
+ int part_size = tcg_type_size(ts->type);
+ int part_count = size / part_size;
+
+ ts -= ts->temp_subindex;
+ for (int i = 0; i < part_count; ++i) {
+ ts[i].mem_offset = off + i * part_size;
+ ts[i].mem_base = s->frame_temp;
+ ts[i].mem_allocated = 1;
+ }
+ } else {
+ ts->mem_offset = off;
+ ts->mem_base = s->frame_temp;
+ ts->mem_allocated = 1;
+ }
}
static void temp_load(TCGContext *, TCGTemp *, TCGRegSet, TCGRegSet,
TCGRegSet);
--
2.34.1
- [PATCH 10/31] tcg: Add temp_subindex to TCGTemp, (continued)
- [PATCH 10/31] tcg: Add temp_subindex to TCGTemp, Richard Henderson, 2022/10/20
- [PATCH 14/31] tcg: Introduce TCGCallReturnKind and TCGCallArgumentKind, Richard Henderson, 2022/10/20
- [PATCH 12/31] tcg: Move TCG_TYPE_COUNT outside enum, Richard Henderson, 2022/10/20
- [PATCH 16/31] tcg: Replace TCG_TARGET_EXTEND_ARGS with TCG_TARGET_CALL_ARG_I32, Richard Henderson, 2022/10/20
- [PATCH 20/31] tcg: Add TCGHelperInfo argument to tcg_out_call, Richard Henderson, 2022/10/20
- [PATCH 25/31] tcg: Add TCG_CALL_{RET,ARG}_BY_REF, Richard Henderson, 2022/10/20
- [PATCH 01/31] tcg: Tidy tcg_reg_alloc_op, Richard Henderson, 2022/10/20
- [PATCH 21/31] tcg: Define TCG_TYPE_I128 and related helper macros, Richard Henderson, 2022/10/20
- [PATCH 02/31] tcg: Introduce paired register allocation, Richard Henderson, 2022/10/20
- [PATCH 19/31] tcg: Move ffi_cif pointer into TCGHelperInfo, Richard Henderson, 2022/10/20
- [PATCH 23/31] tcg: Allocate objects contiguously in temp_allocate_frame,
Richard Henderson <=
- [PATCH 18/31] tcg: Reorg function calls, Richard Henderson, 2022/10/20
- [PATCH 27/31] tcg: Add TCG_CALL_RET_BY_VEC, Richard Henderson, 2022/10/20
- [PATCH 24/31] tcg: Introduce tcg_out_addi_ptr, Richard Henderson, 2022/10/20
- [PATCH 31/31] tcg: Add tcg_gen_extr_i128_i64, tcg_gen_concat_i64_i128, Richard Henderson, 2022/10/20
- [PATCH 17/31] tcg: Use TCG_CALL_ARG_EVEN for TCI special case, Richard Henderson, 2022/10/20
- [PATCH 22/31] tcg: Add TCG_CALL_{RET,ARG}_NORMAL_4, Richard Henderson, 2022/10/20
- [PATCH 30/31] tcg: Add temp allocation for TCGv_i128, Richard Henderson, 2022/10/20
- [PATCH 03/31] tcg/s390x: Use register pair allocation for div and mulu2, Richard Henderson, 2022/10/20
- [PATCH 08/31] target/sparc: Avoid TCGV_{LOW,HIGH}, Richard Henderson, 2022/10/20
- [PATCH 28/31] include/qemu/int128: Use Int128 structure for TCI, Richard Henderson, 2022/10/20