qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, Jiang Biao <jiang.biao2@zte.com.cn>
Subject: [Qemu-devel] [PULL 01/14] tcg/mips: reserve a register for the guest_base.
Date: Tue, 18 Jul 2017 18:57:09 -1000	[thread overview]
Message-ID: <20170719045722.25492-2-rth@twiddle.net> (raw)
In-Reply-To: <20170719045722.25492-1-rth@twiddle.net>

From: Jiang Biao <jiang.biao2@zte.com.cn>

Reserve a register for the guest_base using ppc code for reference.
By doing so, we do not have to recompute it for every memory load.

Signed-off-by: Jiang Biao <jiang.biao2@zte.com.cn>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-Id: <1499677934-2249-1-git-send-email-jiang.biao2@zte.com.cn>
---
 tcg/mips/tcg-target.inc.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/tcg/mips/tcg-target.inc.c b/tcg/mips/tcg-target.inc.c
index 85756b8..1a8169f 100644
--- a/tcg/mips/tcg-target.inc.c
+++ b/tcg/mips/tcg-target.inc.c
@@ -85,6 +85,10 @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
 #define TCG_TMP2  TCG_REG_T8
 #define TCG_TMP3  TCG_REG_T7
 
+#ifndef CONFIG_SOFTMMU
+#define TCG_GUEST_BASE_REG TCG_REG_S1
+#endif
+
 /* check if we really need so many registers :P */
 static const int tcg_target_reg_alloc_order[] = {
     /* Call saved registers.  */
@@ -1547,8 +1551,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is_64)
     } else if (guest_base == (int16_t)guest_base) {
         tcg_out_opc_imm(s, ALIAS_PADDI, base, addr_regl, guest_base);
     } else {
-        tcg_out_movi(s, TCG_TYPE_PTR, TCG_TMP0, guest_base);
-        tcg_out_opc_reg(s, ALIAS_PADD, base, TCG_TMP0, addr_regl);
+        tcg_out_opc_reg(s, ALIAS_PADD, base, TCG_GUEST_BASE_REG, addr_regl);
     }
     tcg_out_qemu_ld_direct(s, data_regl, data_regh, base, opc, is_64);
 #endif
@@ -1652,8 +1655,7 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is_64)
     } else if (guest_base == (int16_t)guest_base) {
         tcg_out_opc_imm(s, ALIAS_PADDI, base, addr_regl, guest_base);
     } else {
-        tcg_out_movi(s, TCG_TYPE_PTR, TCG_TMP0, guest_base);
-        tcg_out_opc_reg(s, ALIAS_PADD, base, TCG_TMP0, addr_regl);
+        tcg_out_opc_reg(s, ALIAS_PADD, base, TCG_GUEST_BASE_REG, addr_regl);
     }
     tcg_out_qemu_st_direct(s, data_regl, data_regh, base, opc);
 #endif
@@ -2452,6 +2454,13 @@ static void tcg_target_qemu_prologue(TCGContext *s)
                    TCG_REG_SP, SAVE_OFS + i * REG_SIZE);
     }
 
+#ifndef CONFIG_SOFTMMU
+    if (guest_base) {
+        tcg_out_movi(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, guest_base);
+        tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
+    }
+#endif
+
     /* Call generated code */
     tcg_out_opc_reg(s, OPC_JR, 0, tcg_target_call_iarg_regs[1], 0);
     /* delay slot */
-- 
2.9.4

  reply	other threads:[~2017-07-19  4:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-19  4:57 [Qemu-devel] [PULL 00/14] tcg-next patch queue Richard Henderson
2017-07-19  4:57 ` Richard Henderson [this message]
2017-07-19  4:57 ` [Qemu-devel] [PULL 02/14] util/cacheinfo: Add missing include for ppc linux Richard Henderson
2017-07-19  4:57 ` [Qemu-devel] [PULL 03/14] tcg: Expand glue macros before stringifying helper names Richard Henderson
2017-07-19  4:57 ` [Qemu-devel] [PULL 04/14] coccinelle: ignore ASTs pre-parsed cached C files Richard Henderson
2017-07-19  4:57 ` [Qemu-devel] [PULL 05/14] coccinelle: add a script to optimize tcg op using tcg_gen_extract() Richard Henderson
2017-07-19  4:57 ` [Qemu-devel] [PULL 06/14] target/arm: Optimize aarch64 rev16 Richard Henderson
2017-07-19  4:57 ` [Qemu-devel] [PULL 07/14] target/arm: optimize aarch32 rev16 Richard Henderson
2017-07-19  4:57 ` [Qemu-devel] [PULL 08/14] target/m68k: optimize bcd_flags() using extract op Richard Henderson
2017-07-19  4:57 ` [Qemu-devel] [PULL 09/14] target/ppc: optimize various functions " Richard Henderson
2017-07-19  4:57 ` [Qemu-devel] [PULL 10/14] target/sparc: " Richard Henderson
2017-07-19  4:57 ` [Qemu-devel] [PULL 11/14] target/sparc: optimize gen_op_mulscc() using deposit op Richard Henderson
2017-07-19  4:57 ` [Qemu-devel] [PULL 12/14] target/alpha: optimize gen_cvtlq() " Richard Henderson
2017-07-19  4:57 ` [Qemu-devel] [PULL 13/14] tcg/tci: enable bswap16_i64 Richard Henderson
2017-07-19  4:57 ` [Qemu-devel] [PULL 14/14] tcg: Pass generic CPUState to gen_intermediate_code() Richard Henderson
2017-07-19  6:06 ` [Qemu-devel] [PULL 00/14] tcg-next patch queue no-reply
2017-07-19 19:45 ` Peter Maydell
2017-07-19 20:33   ` Philippe Mathieu-Daudé
2017-07-19 21:36     ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170719045722.25492-2-rth@twiddle.net \
    --to=rth@twiddle.net \
    --cc=jiang.biao2@zte.com.cn \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).