All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 2/6] TCG/sparc: use iargs or oargs instead of register names etc
@ 2012-01-07 22:24 Blue Swirl
  0 siblings, 0 replies; only message in thread
From: Blue Swirl @ 2012-01-07 22:24 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 5082 bytes --]

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 <blauwirbel@gmail.com>
---
 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 #2: 0002-TCG-sparc-use-iargs-or-oargs-instead-of-register-nam.patch --]
[-- Type: text/x-diff, Size: 5603 bytes --]

From 963d7b12945c3db75ad05071de6f112d360a064b Mon Sep 17 00:00:00 2001
Message-Id: <963d7b12945c3db75ad05071de6f112d360a064b.1325974684.git.blauwirbel@gmail.com>
In-Reply-To: <9773a03cec6b6c0dc3832087ca7ccb46bab7a784.1325974684.git.blauwirbel@gmail.com>
References: <9773a03cec6b6c0dc3832087ca7ccb46bab7a784.1325974684.git.blauwirbel@gmail.com>
From: Blue Swirl <blauwirbel@gmail.com>
Date: Sun, 25 Sep 2011 12:10:22 +0000
Subject: [PATCH 2/6] TCG/sparc: use iargs or oargs instead of register names etc

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 <blauwirbel@gmail.com>
---
 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.7.2.5


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-01-07 22:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-07 22:24 [Qemu-devel] [PATCH 2/6] TCG/sparc: use iargs or oargs instead of register names etc Blue Swirl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.