[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/14] tcg-sparc: Preserve branch destinations durin
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 14/14] tcg-sparc: Preserve branch destinations during retranslation |
Date: |
Fri, 21 Sep 2012 19:05:07 -0700 |
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/sparc/tcg-target.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/tcg/sparc/tcg-target.c b/tcg/sparc/tcg-target.c
index 1db0c9d..876da4f 100644
--- a/tcg/sparc/tcg-target.c
+++ b/tcg/sparc/tcg-target.c
@@ -488,30 +488,33 @@ static inline void tcg_out_nop(TCGContext *s)
static void tcg_out_branch_i32(TCGContext *s, int opc, int label_index)
{
TCGLabel *l = &s->labels[label_index];
+ uint32_t off22;
if (l->has_value) {
- tcg_out32(s, (INSN_OP(0) | INSN_COND(opc, 0) | INSN_OP2(0x2)
- | INSN_OFF22(l->u.value - (unsigned long)s->code_ptr)));
+ off22 = INSN_OFF22(l->u.value - (unsigned long)s->code_ptr);
} else {
+ /* Make sure to preserve destinations during retranslation. */
+ off22 = *(uint32_t *)s->code_ptr & INSN_OFF22(-1);
tcg_out_reloc(s, s->code_ptr, R_SPARC_WDISP22, label_index, 0);
- tcg_out32(s, (INSN_OP(0) | INSN_COND(opc, 0) | INSN_OP2(0x2) | 0));
}
+ tcg_out32(s, INSN_OP(0) | INSN_COND(opc, 0) | INSN_OP2(0x2) | off22);
}
#if TCG_TARGET_REG_BITS == 64
static void tcg_out_branch_i64(TCGContext *s, int opc, int label_index)
{
TCGLabel *l = &s->labels[label_index];
+ uint32_t off19;
if (l->has_value) {
- tcg_out32(s, (INSN_OP(0) | INSN_COND(opc, 0) | INSN_OP2(0x1) |
- (0x5 << 19) |
- INSN_OFF19(l->u.value - (unsigned long)s->code_ptr)));
+ off19 = INSN_OFF19(l->u.value - (unsigned long)s->code_ptr);
} else {
+ /* Make sure to preserve destinations during retranslation. */
+ off19 = *(uint32_t *)s->code_ptr & INSN_OFF19(-1);
tcg_out_reloc(s, s->code_ptr, R_SPARC_WDISP19, label_index, 0);
- tcg_out32(s, (INSN_OP(0) | INSN_COND(opc, 0) | INSN_OP2(0x1) |
- (0x5 << 19) | 0));
}
+ tcg_out32(s, (INSN_OP(0) | INSN_COND(opc, 0) | INSN_OP2(0x1) |
+ (0x5 << 19) | off19));
}
#endif
--
1.7.11.4
- [Qemu-devel] [PATCH 01/14] linux-user: Use memcpy in get_user/put_user., (continued)
- [Qemu-devel] [PATCH 01/14] linux-user: Use memcpy in get_user/put_user., Richard Henderson, 2012/09/21
- [Qemu-devel] [PATCH 02/14] tcg-sparc: Hack in qemu_ld/st64 for 32-bit., Richard Henderson, 2012/09/21
- [Qemu-devel] [PATCH 05/14] tcg-sparc: Assume v9 cpu always, i.e. force v8plus in 32-bit mode., Richard Henderson, 2012/09/21
- [Qemu-devel] [PATCH 08/14] tcg-sparc: Change AREG0 in generated code to %i0., Richard Henderson, 2012/09/21
- [Qemu-devel] [PATCH 07/14] tcg-sparc: Support GUEST_BASE., Richard Henderson, 2012/09/21
- [Qemu-devel] [PATCH 09/14] tcg-sparc: Clean up cruft stemming from attempts to use global registers., Richard Henderson, 2012/09/21
- [Qemu-devel] [PATCH 06/14] tcg-sparc: Fix qemu_ld/st to handle 32-bit host., Richard Henderson, 2012/09/21
- [Qemu-devel] [PATCH 10/14] tcg-sparc: Mask shift immediates to avoid illegal insns., Richard Henderson, 2012/09/21
- [Qemu-devel] [PATCH 12/14] tcg-sparc: Add %g/%o registers to alloc_order, Richard Henderson, 2012/09/21
- [Qemu-devel] [PATCH 13/14] tcg-sparc: Fix and enable direct TB chaining., Richard Henderson, 2012/09/21
- [Qemu-devel] [PATCH 14/14] tcg-sparc: Preserve branch destinations during retranslation,
Richard Henderson <=
- [Qemu-devel] [PATCH 11/14] tcg-sparc: Use defines for temporaries., Richard Henderson, 2012/09/21
- Re: [Qemu-devel] [PATCH v3 00/14] Sparc TCG cleanup, Blue Swirl, 2012/09/22