* [Qemu-devel] [PATCH] tcg/mips: reserve a register for the guest_base.
@ 2017-07-10 9:12 Jiang Biao
2017-07-10 16:01 ` Richard Henderson
0 siblings, 1 reply; 2+ messages in thread
From: Jiang Biao @ 2017-07-10 9:12 UTC (permalink / raw)
To: qemu-devel
Cc: jinguojie, rth, james.hogan, jiang.yong5, wang.liang82,
shi.zhongbing, zhong.weidong, jiang.biao2
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>
---
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.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] tcg/mips: reserve a register for the guest_base.
2017-07-10 9:12 [Qemu-devel] [PATCH] tcg/mips: reserve a register for the guest_base Jiang Biao
@ 2017-07-10 16:01 ` Richard Henderson
0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2017-07-10 16:01 UTC (permalink / raw)
To: Jiang Biao, qemu-devel
Cc: jinguojie, james.hogan, jiang.yong5, wang.liang82, shi.zhongbing,
zhong.weidong
On 07/09/2017 11:12 PM, Jiang Biao wrote:
> 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>
> ---
> tcg/mips/tcg-target.inc.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
For future reference, you should not add a Signed-off-by for someone else.
That is like writing someone else's signature.
You may acknowledge my suggestion with a Suggested-by tag.
QEMU uses the same rules for this as does the linux kernel. Please read
> https://github.com/torvalds/linux/blob/master/Documentation/process/submitting-patches.rst
or at least section 11 from
> https://github.com/torvalds/linux/blob/master/Documentation/translations/zh_CN/SubmittingPatches
(The translation may be be out of date. I don't see any of the other tags,
like Suggested-by, within the Chinese text.)
That said, applied to tcg-next.
r~
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-10 16:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-10 9:12 [Qemu-devel] [PATCH] tcg/mips: reserve a register for the guest_base Jiang Biao
2017-07-10 16:01 ` Richard Henderson
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).