[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 13/20] tcg-arm: Cleanup tcg_out_goto_label
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v3 13/20] tcg-arm: Cleanup tcg_out_goto_label |
Date: |
Thu, 28 Mar 2013 08:32:54 -0700 |
Since we folded the epilogue into exit_tb directly, we no longer
have a long direct branch. Fold tcg_out_goto into its only user,
eliminate the long branch case. Drop the long forward branch
case for tcg_out_goto_label.
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/arm/tcg-target.c | 42 ++++--------------------------------------
1 file changed, 4 insertions(+), 38 deletions(-)
diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c
index e5ec999..7bcba19 100644
--- a/tcg/arm/tcg-target.c
+++ b/tcg/arm/tcg-target.c
@@ -1011,37 +1011,6 @@ static inline void tcg_out_st8(TCGContext *s, int cond,
tcg_out_st8_12(s, cond, rd, rn, offset);
}
-/* The _goto case is normally between TBs within the same code buffer,
- * and with the code buffer limited to 16MB we shouldn't need the long
- * case.
- *
- * .... except to the prologue that is in its own buffer.
- */
-static inline void tcg_out_goto(TCGContext *s, int cond, uint32_t addr)
-{
- int32_t val;
-
- if (addr & 1) {
- /* goto to a Thumb destination isn't supported */
- tcg_abort();
- }
-
- val = addr - (tcg_target_long) s->code_ptr;
- if (val - 8 < 0x01fffffd && val - 8 > -0x01fffffd)
- tcg_out_b(s, cond, val);
- else {
- if (cond == COND_AL) {
- tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_PC, -4);
- tcg_out32(s, addr);
- } else {
- tcg_out_movi32(s, cond, TCG_REG_TMP, val - 8);
- tcg_out_dat_reg(s, cond, ARITH_ADD,
- TCG_REG_PC, TCG_REG_PC,
- TCG_REG_TMP, SHIFT_IMM_LSL(0));
- }
- }
-}
-
/* The call case is mostly used for helpers - so it's not unreasonable
* for them to be beyond branch range */
static inline void tcg_out_call(TCGContext *s, uint32_t addr)
@@ -1081,14 +1050,11 @@ static inline void tcg_out_goto_label(TCGContext *s,
int cond, int label_index)
{
TCGLabel *l = &s->labels[label_index];
- if (l->has_value)
- tcg_out_goto(s, cond, l->u.value);
- else if (cond == COND_AL) {
- tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_PC, -4);
- tcg_out_reloc(s, s->code_ptr, R_ARM_ABS32, label_index, 31337);
- s->code_ptr += 4;
+ if (l->has_value) {
+ int32_t val = l->u.value - (tcg_target_long) s->code_ptr;
+ assert(val - 8 < 0x01fffffd && val - 8 > -0x01fffffd);
+ tcg_out_b(s, cond, val);
} else {
- /* Probably this should be preferred even for COND_AL... */
tcg_out_reloc(s, s->code_ptr, R_ARM_PC24, label_index, 31337);
tcg_out_b_noaddr(s, cond);
}
--
1.8.1.4
- Re: [Qemu-devel] [PATCH v3 07/20] tcg-arm: Fold epilogue into INDEX_op_exit_tb, (continued)
- [Qemu-devel] [PATCH v3 09/20] tcg-arm: Implement division instructions, Richard Henderson, 2013/03/28
- [Qemu-devel] [PATCH v3 10/20] tcg-arm: Use TCG_REG_TMP name for the tcg temporary, Richard Henderson, 2013/03/28
- [Qemu-devel] [PATCH v3 11/20] tcg-arm: Use R12 for the tcg temporary, Richard Henderson, 2013/03/28
- [Qemu-devel] [PATCH v3 12/20] tcg-arm: Cleanup multiply subroutines, Richard Henderson, 2013/03/28
- [Qemu-devel] [PATCH v3 13/20] tcg-arm: Cleanup tcg_out_goto_label,
Richard Henderson <=
- [Qemu-devel] [PATCH v3 14/20] tcg-arm: Cleanup goto_tb handling, Richard Henderson, 2013/03/28
[Qemu-devel] [PATCH v3 15/20] tcg-arm: Cleanup most primitive load store subroutines, Richard Henderson, 2013/03/28
[Qemu-devel] [PATCH v3 16/20] tcg-arm: Fix local stack frame, Richard Henderson, 2013/03/28
[Qemu-devel] [PATCH v3 17/20] tcg-arm: Split out tcg_out_tlb_read, Richard Henderson, 2013/03/28
[Qemu-devel] [PATCH v3 18/20] tcg-arm: Improve scheduling of tcg_out_tlb_read, Richard Henderson, 2013/03/28