]> git.proxmox.com Git - qemu.git/commitdiff
tcg-ppc: Conditionally reserve TCG_GUEST_BASE_REG.
authorRichard Henderson <rth@twiddle.net>
Thu, 6 May 2010 05:50:45 +0000 (05:50 +0000)
committermalc <av1474@comtv.ru>
Tue, 29 Jun 2010 19:30:36 +0000 (23:30 +0400)
We need not reserve the register unless we're going to use it.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: malc <av1474@comtv.ru>
tcg/ppc/tcg-target.c
tcg/ppc64/tcg-target.c

index 2e5bb9f884bceb39dd1ac8f8def88ec63ba47f39..7970268e5a89243369808c5db61b2f67a829a468 100644 (file)
@@ -933,7 +933,10 @@ static void tcg_target_qemu_prologue (TCGContext *s)
     tcg_out32 (s, STW | RS (0) | RA (1) | (frame_size + LR_OFFSET));
 
 #ifdef CONFIG_USE_GUEST_BASE
-    tcg_out_movi (s, TCG_TYPE_I32, TCG_GUEST_BASE_REG, GUEST_BASE);
+    if (GUEST_BASE) {
+        tcg_out_movi (s, TCG_TYPE_I32, TCG_GUEST_BASE_REG, GUEST_BASE);
+        tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
+    }
 #endif
 
     tcg_out32 (s, MTSPR | RS (3) | CTR);
@@ -1914,9 +1917,6 @@ static void tcg_target_init(TCGContext *s)
 #ifdef _CALL_SYSV
     tcg_regset_set_reg(s->reserved_regs, TCG_REG_R13);
 #endif
-#ifdef CONFIG_USE_GUEST_BASE
-    tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
-#endif
 
     tcg_add_target_add_op_defs(ppc_op_defs);
 }
index 0483d6bd789f39d75ea082e98f1a4305974c5691..5ba5d053b7adf0bd71ec7a33d905c3f8b3a47a51 100644 (file)
@@ -899,7 +899,10 @@ static void tcg_target_qemu_prologue (TCGContext *s)
     tcg_out32 (s, STD | RS (0) | RA (1) | (frame_size + 16));
 
 #ifdef CONFIG_USE_GUEST_BASE
-    tcg_out_movi (s, TCG_TYPE_I64, TCG_GUEST_BASE_REG, GUEST_BASE);
+    if (GUEST_BASE) {
+        tcg_out_movi (s, TCG_TYPE_I64, TCG_GUEST_BASE_REG, GUEST_BASE);
+        tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
+    }
 #endif
 
     tcg_out32 (s, MTSPR | RS (3) | CTR);
@@ -1692,9 +1695,5 @@ static void tcg_target_init (TCGContext *s)
 #endif
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R13);
 
-#ifdef CONFIG_USE_GUEST_BASE
-    tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
-#endif
-
     tcg_add_target_add_op_defs (ppc_op_defs);
 }