From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: "Vassili Karpov (malc)" <av1474@comtv.ru>,
aurelien@aurel32.net, Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH 09/14] tcg-ppc64: Tidy register allocation order
Date: Sun, 1 Sep 2013 09:16:08 -0700 [thread overview]
Message-ID: <1378052173-3579-10-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1378052173-3579-1-git-send-email-rth@twiddle.net>
Remove conditionalization from tcg_target_reg_alloc_order, relying on
reserved_regs to prevent register allocation that shouldn't happen.
So R11 is now present in reg_alloc_order for __APPLE__, but also now
reserved.
Sort reg_alloc_order into call-saved, call-clobbered, and parameters.
This reduces the effect of values getting spilled and reloaded before
function calls.
Whether or not it is reserved, R2 (TOC) is always call-clobbered.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
tcg/ppc64/tcg-target.c | 49 ++++++++++++++++++++++---------------------------
1 file changed, 22 insertions(+), 27 deletions(-)
diff --git a/tcg/ppc64/tcg-target.c b/tcg/ppc64/tcg-target.c
index 95980ce..d567d9a 100644
--- a/tcg/ppc64/tcg-target.c
+++ b/tcg/ppc64/tcg-target.c
@@ -99,7 +99,7 @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
#endif
static const int tcg_target_reg_alloc_order[] = {
- TCG_REG_R14,
+ TCG_REG_R14, /* call saved registers */
TCG_REG_R15,
TCG_REG_R16,
TCG_REG_R17,
@@ -109,29 +109,25 @@ static const int tcg_target_reg_alloc_order[] = {
TCG_REG_R21,
TCG_REG_R22,
TCG_REG_R23,
+ TCG_REG_R24,
+ TCG_REG_R25,
+ TCG_REG_R26,
+ TCG_REG_R27,
TCG_REG_R28,
TCG_REG_R29,
TCG_REG_R30,
TCG_REG_R31,
-#ifdef __APPLE__
+ TCG_REG_R12, /* call clobbered, non-arguments */
+ TCG_REG_R11,
TCG_REG_R2,
-#endif
- TCG_REG_R3,
- TCG_REG_R4,
- TCG_REG_R5,
- TCG_REG_R6,
- TCG_REG_R7,
- TCG_REG_R8,
+ TCG_REG_R10, /* call clobbered, arguments */
TCG_REG_R9,
- TCG_REG_R10,
-#ifndef __APPLE__
- TCG_REG_R11,
-#endif
- TCG_REG_R12,
- TCG_REG_R24,
- TCG_REG_R25,
- TCG_REG_R26,
- TCG_REG_R27
+ TCG_REG_R8,
+ TCG_REG_R7,
+ TCG_REG_R6,
+ TCG_REG_R5,
+ TCG_REG_R4,
+ TCG_REG_R3,
};
static const int tcg_target_call_iarg_regs[] = {
@@ -2151,9 +2147,7 @@ static void tcg_target_init(TCGContext *s)
tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I64], 0, 0xffffffff);
tcg_regset_set32(tcg_target_call_clobber_regs, 0,
(1 << TCG_REG_R0) |
-#ifdef __APPLE__
(1 << TCG_REG_R2) |
-#endif
(1 << TCG_REG_R3) |
(1 << TCG_REG_R4) |
(1 << TCG_REG_R5) |
@@ -2163,16 +2157,17 @@ static void tcg_target_init(TCGContext *s)
(1 << TCG_REG_R9) |
(1 << TCG_REG_R10) |
(1 << TCG_REG_R11) |
- (1 << TCG_REG_R12)
- );
+ (1 << TCG_REG_R12));
tcg_regset_clear(s->reserved_regs);
- tcg_regset_set_reg(s->reserved_regs, TCG_REG_R0);
- tcg_regset_set_reg(s->reserved_regs, TCG_REG_R1);
-#ifndef __APPLE__
- tcg_regset_set_reg(s->reserved_regs, TCG_REG_R2);
+ tcg_regset_set_reg(s->reserved_regs, TCG_REG_R0); /* tcg temp */
+ tcg_regset_set_reg(s->reserved_regs, TCG_REG_R1); /* stack pointer */
+#ifdef __APPLE__
+ tcg_regset_set_reg(s->reserved_regs, TCG_REG_R11); /* ??? */
+#else
+ tcg_regset_set_reg(s->reserved_regs, TCG_REG_R2); /* toc */
#endif
- tcg_regset_set_reg(s->reserved_regs, TCG_REG_R13);
+ tcg_regset_set_reg(s->reserved_regs, TCG_REG_R13); /* thread pointer */
tcg_add_target_add_op_defs(ppc_op_defs);
}
--
1.8.3.1
next prev parent reply other threads:[~2013-09-01 16:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-01 16:15 [Qemu-devel] [PATCH 00/14] tcg-ppc64 improvements Richard Henderson
2013-09-01 16:16 ` [Qemu-devel] [PATCH 01/14] tcg-ppc64: Reformat tcg-target.c Richard Henderson
2013-09-01 16:16 ` [Qemu-devel] [PATCH 02/14] tcg-ppc64: More use of TAI and SAI helper macros Richard Henderson
2013-09-01 16:16 ` [Qemu-devel] [PATCH 03/14] tcg-ppc64: Use TCG_REG_Rn constants Richard Henderson
2013-09-01 16:16 ` [Qemu-devel] [PATCH 04/14] tcg-ppc64: Use tcg_out64 Richard Henderson
2013-09-01 16:16 ` [Qemu-devel] [PATCH 05/14] tcg-ppc64: Avoid code for nop move Richard Henderson
2013-09-01 16:16 ` [Qemu-devel] [PATCH 06/14] tcg-ppc64: Don't load the static chain from TCG Richard Henderson
2013-09-01 16:16 ` [Qemu-devel] [PATCH 07/14] tcg-ppc64: Fold constant call address into descriptor load Richard Henderson
2013-09-01 16:16 ` [Qemu-devel] [PATCH 08/14] tcg-ppc64: Look through a constant function descriptor Richard Henderson
2013-09-01 16:16 ` Richard Henderson [this message]
2013-09-01 16:16 ` [Qemu-devel] [PATCH 10/14] tcg-ppc64: Handle long offsets better Richard Henderson
2013-09-01 16:16 ` [Qemu-devel] [PATCH 11/14] tcg-ppc64: Implement tcg_register_jit Richard Henderson
2013-09-01 16:16 ` [Qemu-devel] [PATCH 12/14] tcg-ppc64: Streamline tcg_out_tlb_read Richard Henderson
2013-09-01 16:16 ` [Qemu-devel] [PATCH 13/14] tcg-ppc64: Add _noaddr functions for emitting forward branches Richard Henderson
2013-09-01 16:16 ` [Qemu-devel] [PATCH 14/14] tcg-ppc64: Implement CONFIG_QEMU_LDST_OPTIMIZATION 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=1378052173-3579-10-git-send-email-rth@twiddle.net \
--to=rth@twiddle.net \
--cc=aurelien@aurel32.net \
--cc=av1474@comtv.ru \
--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).