[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 30/43] tcg/sparc: Use tcg_tbrel_diff
From: |
Richard Henderson |
Subject: |
[PATCH v5 30/43] tcg/sparc: Use tcg_tbrel_diff |
Date: |
Tue, 5 Jan 2021 07:19:37 -1000 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/sparc/tcg-target.c.inc | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc
index d599ae27b5..8f04fdf981 100644
--- a/tcg/sparc/tcg-target.c.inc
+++ b/tcg/sparc/tcg-target.c.inc
@@ -440,7 +440,7 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type,
TCGReg ret,
/* A 13-bit constant relative to the TB. */
if (!in_prologue && USE_REG_TB) {
- test = arg - (uintptr_t)s->code_gen_ptr;
+ test = tcg_tbrel_diff(s, (void *)arg);
if (check_fit_ptr(test, 13)) {
tcg_out_arithi(s, ret, TCG_REG_TB, test, ARITH_ADD);
return;
@@ -537,15 +537,15 @@ static inline bool tcg_out_sti(TCGContext *s, TCGType
type, TCGArg val,
return false;
}
-static void tcg_out_ld_ptr(TCGContext *s, TCGReg ret, uintptr_t arg)
+static void tcg_out_ld_ptr(TCGContext *s, TCGReg ret, const void *arg)
{
- intptr_t diff = arg - (uintptr_t)s->code_gen_ptr;
+ intptr_t diff = tcg_tbrel_diff(s, arg);
if (USE_REG_TB && check_fit_ptr(diff, 13)) {
tcg_out_ld(s, TCG_TYPE_PTR, ret, TCG_REG_TB, diff);
return;
}
- tcg_out_movi(s, TCG_TYPE_PTR, ret, arg & ~0x3ff);
- tcg_out_ld(s, TCG_TYPE_PTR, ret, ret, arg & 0x3ff);
+ tcg_out_movi(s, TCG_TYPE_PTR, ret, (uintptr_t)arg & ~0x3ff);
+ tcg_out_ld(s, TCG_TYPE_PTR, ret, ret, (uintptr_t)arg & 0x3ff);
}
static inline void tcg_out_sety(TCGContext *s, TCGReg rs)
@@ -1313,7 +1313,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
tcg_out_movi_imm13(s, TCG_REG_O0, a0);
break;
} else if (USE_REG_TB) {
- intptr_t tb_diff = a0 - (uintptr_t)s->code_gen_ptr;
+ intptr_t tb_diff = tcg_tbrel_diff(s, (void *)a0);
if (check_fit_ptr(tb_diff, 13)) {
tcg_out_arithi(s, TCG_REG_G0, TCG_REG_I7, 8, RETURN);
/* Note that TCG_REG_TB has been unwound to O1. */
@@ -1345,8 +1345,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
}
} else {
/* indirect jump method */
- tcg_out_ld_ptr(s, TCG_REG_TB,
- (uintptr_t)(s->tb_jmp_target_addr + a0));
+ tcg_out_ld_ptr(s, TCG_REG_TB, s->tb_jmp_target_addr + a0);
tcg_out_arithi(s, TCG_REG_G0, TCG_REG_TB, 0, JMPL);
tcg_out_nop(s);
}
--
2.25.1
- [PATCH v5 24/43] disas: Push const down through host disassembly, (continued)
- [PATCH v5 24/43] disas: Push const down through host disassembly, Richard Henderson, 2021/01/05
- [PATCH v5 23/43] tcg/aarch64: Support split-wx code generation, Richard Henderson, 2021/01/05
- [PATCH v5 25/43] tcg/tci: Push const down through bytecode reading, Richard Henderson, 2021/01/05
- [PATCH v5 28/43] tcg/ppc: Use tcg_out_mem_long to reset TCG_REG_TB, Richard Henderson, 2021/01/05
- [PATCH v5 18/43] accel/tcg: Support split-wx for linux with memfd, Richard Henderson, 2021/01/05
- [PATCH v5 22/43] tcg/aarch64: Use B not BL for tcg_out_goto_long, Richard Henderson, 2021/01/05
- [PATCH v5 26/43] tcg: Introduce tcg_tbrel_diff, Richard Henderson, 2021/01/05
- [PATCH v5 27/43] tcg/ppc: Use tcg_tbrel_diff, Richard Henderson, 2021/01/05
- [PATCH v5 29/43] tcg/ppc: Support split-wx code generation, Richard Henderson, 2021/01/05
- [PATCH v5 30/43] tcg/sparc: Use tcg_tbrel_diff,
Richard Henderson <=
- [PATCH v5 33/43] tcg/s390: Support split-wx code generation, Richard Henderson, 2021/01/05
- [PATCH v5 34/43] tcg/riscv: Fix branch range checks, Richard Henderson, 2021/01/05
- [PATCH v5 37/43] accel/tcg: Add mips support to alloc_code_gen_buffer_splitwx_memfd, Richard Henderson, 2021/01/05
- [PATCH v5 35/43] tcg/riscv: Remove branch-over-branch fallback, Richard Henderson, 2021/01/05
- [PATCH v5 31/43] tcg/sparc: Support split-wx code generation, Richard Henderson, 2021/01/05
- [PATCH v5 32/43] tcg/s390: Use tcg_tbrel_diff, Richard Henderson, 2021/01/05
- [PATCH v5 36/43] tcg/riscv: Support split-wx code generation, Richard Henderson, 2021/01/05
- [PATCH v5 39/43] tcg/mips: Support split-wx code generation, Richard Henderson, 2021/01/05
- [PATCH v5 38/43] tcg/mips: Do not assert on relocation overflow, Richard Henderson, 2021/01/05
- [PATCH v5 43/43] tcg: Constify TCGLabelQemuLdst.raddr, Richard Henderson, 2021/01/05