qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/6] TCG/sparc: use iargs or oargs instead of regist


From: Blue Swirl
Subject: [Qemu-devel] [PATCH 2/6] TCG/sparc: use iargs or oargs instead of register names etc
Date: Sat, 7 Jan 2012 22:24:55 +0000

Don't use register names (or temporary registers) for call arguments
and return values directly but iargs or oargs tables. Later it will be
easier to shift the registers used.

Signed-off-by: Blue Swirl <address@hidden>
---
 tcg/sparc/tcg-target.c |   44 ++++++++++++++++++++++----------------------
 1 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/tcg/sparc/tcg-target.c b/tcg/sparc/tcg-target.c
index 5cd5a3b..6f69e56 100644
--- a/tcg/sparc/tcg-target.c
+++ b/tcg/sparc/tcg-target.c
@@ -86,9 +86,8 @@ static const int tcg_target_call_iarg_regs[6] = {

 static const int tcg_target_call_oarg_regs[] = {
     TCG_REG_O0,
-#if TCG_TARGET_REG_BITS == 32
-    TCG_REG_O1
-#endif
+    TCG_REG_O1,
+    TCG_REG_O2,
 };

 static inline int check_fit_tl(tcg_target_long val, unsigned int bits)
@@ -152,9 +151,9 @@ static int
target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
         ct->ct |= TCG_CT_REG;
         tcg_regset_set32(ct->u.regs, 0, 0xffffffff);
         // Helper args
-        tcg_regset_reset_reg(ct->u.regs, TCG_REG_O0);
-        tcg_regset_reset_reg(ct->u.regs, TCG_REG_O1);
-        tcg_regset_reset_reg(ct->u.regs, TCG_REG_O2);
+        tcg_regset_reset_reg(ct->u.regs, tcg_target_call_oarg_regs[0]);
+        tcg_regset_reset_reg(ct->u.regs, tcg_target_call_oarg_regs[1]);
+        tcg_regset_reset_reg(ct->u.regs, tcg_target_call_oarg_regs[2]);
         break;
     case 'I':
         ct->ct |= TCG_CT_CONST_S11;
@@ -760,9 +759,9 @@ static void tcg_out_qemu_ld(TCGContext *s, const
TCGArg *args,
     mem_index = *args;
     s_bits = opc & 3;

-    arg0 = TCG_REG_O0;
-    arg1 = TCG_REG_O1;
-    arg2 = TCG_REG_O2;
+    arg0 = tcg_target_call_iarg_regs[0];
+    arg1 = tcg_target_call_iarg_regs[1];
+    arg2 = tcg_target_call_iarg_regs[2];

 #if defined(CONFIG_SOFTMMU)
     /* srl addr_reg, x, arg1 */
@@ -797,10 +796,10 @@ static void tcg_out_qemu_ld(TCGContext *s, const
TCGArg *args,
     tcg_out32(s, 0);

     /* mov (delay slot) */
-    tcg_out_mov(s, TCG_TYPE_PTR, arg0, addr_reg);
+    tcg_out_mov(s, TCG_TYPE_PTR, tcg_target_call_iarg_regs[0], addr_reg);

     /* mov */
-    tcg_out_movi(s, TCG_TYPE_I32, arg1, mem_index);
+    tcg_out_movi(s, TCG_TYPE_I32, tcg_target_call_iarg_regs[1], mem_index);

     /* XXX: move that code at the end of the TB */
     /* qemu_ld_helper[s_bits](arg0, arg1) */
@@ -821,15 +820,15 @@ static void tcg_out_qemu_ld(TCGContext *s, const
TCGArg *args,
     switch(opc) {
     case 0 | 4:
         /* sll arg0, 24/56, data_reg */
-        tcg_out_arithi(s, data_reg, arg0, (int)sizeof(tcg_target_long) * 8 - 8,
-                       HOST_SLL_OP);
+        tcg_out_arithi(s, data_reg, tcg_target_call_oarg_regs[0],
+                       (int)sizeof(tcg_target_long) * 8 - 8, HOST_SLL_OP);
         /* sra data_reg, 24/56, data_reg */
         tcg_out_arithi(s, data_reg, data_reg,
                        (int)sizeof(tcg_target_long) * 8 - 8, HOST_SRA_OP);
         break;
     case 1 | 4:
         /* sll arg0, 16/48, data_reg */
-        tcg_out_arithi(s, data_reg, arg0,
+        tcg_out_arithi(s, data_reg, tcg_target_call_oarg_regs[0],
                        (int)sizeof(tcg_target_long) * 8 - 16, HOST_SLL_OP);
         /* sra data_reg, 16/48, data_reg */
         tcg_out_arithi(s, data_reg, data_reg,
@@ -837,7 +836,8 @@ static void tcg_out_qemu_ld(TCGContext *s, const
TCGArg *args,
         break;
     case 2 | 4:
         /* sll arg0, 32, data_reg */
-        tcg_out_arithi(s, data_reg, arg0, 32, HOST_SLL_OP);
+        tcg_out_arithi(s, data_reg, tcg_target_call_oarg_regs[0],
+                       32, HOST_SLL_OP);
         /* sra data_reg, 32, data_reg */
         tcg_out_arithi(s, data_reg, data_reg, 32, HOST_SRA_OP);
         break;
@@ -847,7 +847,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const
TCGArg *args,
     case 3:
     default:
         /* mov */
-        tcg_out_mov(s, TCG_TYPE_REG, data_reg, arg0);
+        tcg_out_mov(s, TCG_TYPE_REG, data_reg, tcg_target_call_oarg_regs[0]);
         break;
     }

@@ -971,9 +971,9 @@ static void tcg_out_qemu_st(TCGContext *s, const
TCGArg *args,

     s_bits = opc;

-    arg0 = TCG_REG_O0;
-    arg1 = TCG_REG_O1;
-    arg2 = TCG_REG_O2;
+    arg0 = tcg_target_call_iarg_regs[0];
+    arg1 = tcg_target_call_iarg_regs[1];
+    arg2 = tcg_target_call_iarg_regs[2];

 #if defined(CONFIG_SOFTMMU)
     /* srl addr_reg, x, arg1 */
@@ -1009,13 +1009,13 @@ static void tcg_out_qemu_st(TCGContext *s,
const TCGArg *args,
     tcg_out32(s, 0);

     /* mov (delay slot) */
-    tcg_out_mov(s, TCG_TYPE_PTR, arg0, addr_reg);
+    tcg_out_mov(s, TCG_TYPE_PTR, tcg_target_call_oarg_regs[0], addr_reg);

     /* mov */
-    tcg_out_mov(s, TCG_TYPE_REG, arg1, data_reg);
+    tcg_out_mov(s, TCG_TYPE_REG, tcg_target_call_oarg_regs[1], data_reg);

     /* mov */
-    tcg_out_movi(s, TCG_TYPE_I32, arg2, mem_index);
+    tcg_out_movi(s, TCG_TYPE_I32, tcg_target_call_oarg_regs[2], mem_index);

     /* XXX: move that code at the end of the TB */
     /* qemu_st_helper[s_bits](arg0, arg1, arg2) */
-- 
1.6.2.4

Attachment: 0002-TCG-sparc-use-iargs-or-oargs-instead-of-register-nam.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]