qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] tcg_temp_local_new should take no parameter
@ 2009-01-01 13:19 Laurent Desnogues
  2009-01-01 14:09 ` Aurelien Jarno
  2009-01-01 14:36 ` Stuart Brady
  0 siblings, 2 replies; 4+ messages in thread
From: Laurent Desnogues @ 2009-01-01 13:19 UTC (permalink / raw)
  To: qemu-devel

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

Hello,

this patch removes useless type information in some calls to
tcg_temp_local_new.  It also removes the parameter from the
macro declaration;  if a target has to use a specific non-default
size then it should use tcg_temp_local_new_{i32,i64}.

Cheers,

Laurent

Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: temp_local_new.patch --]
[-- Type: text/x-patch; name=temp_local_new.patch, Size: 3648 bytes --]

Index: target-ppc/translate.c
===================================================================
--- target-ppc/translate.c	(revision 6144)
+++ target-ppc/translate.c	(working copy)
@@ -6350,7 +6350,7 @@
     TCGv_i32 t0 = tcg_temp_local_new_i32();                                   \
     TCGv_i32 t1 = tcg_temp_local_new_i32();                                   \
     TCGv_i32 t2 = tcg_temp_local_new_i32();                                   \
-    TCGv_i64 t3 = tcg_temp_local_new(TCG_TYPE_I64);                           \
+    TCGv_i64 t3 = tcg_temp_local_new();                                       \
     tcg_gen_trunc_i64_i32(t0, cpu_gpr[rA(ctx->opcode)]);                      \
     tcg_gen_trunc_i64_i32(t2, cpu_gpr[rB(ctx->opcode)]);                      \
     tcg_op(t0, t0, t2);                                                       \
Index: target-sh4/translate.c
===================================================================
--- target-sh4/translate.c	(revision 6144)
+++ target-sh4/translate.c	(working copy)
@@ -785,8 +785,8 @@
 	{
 	    int label1 = gen_new_label();
 	    int label2 = gen_new_label();
-	    TCGv cmp1 = tcg_temp_local_new(TCG_TYPE_I32);
-	    TCGv cmp2 = tcg_temp_local_new(TCG_TYPE_I32);
+	    TCGv cmp1 = tcg_temp_local_new();
+	    TCGv cmp2 = tcg_temp_local_new();
 	    tcg_gen_xor_i32(cmp1, REG(B7_4), REG(B11_8));
 	    tcg_gen_andi_i32(cmp2, cmp1, 0xff000000);
 	    tcg_gen_brcondi_i32(TCG_COND_EQ, cmp2, 0, label1);
@@ -935,7 +935,7 @@
 	    int label2 = gen_new_label();
 	    int label3 = gen_new_label();
 	    int label4 = gen_new_label();
-	    TCGv shift = tcg_temp_local_new(TCG_TYPE_I32);
+	    TCGv shift = tcg_temp_local_new();
 	    tcg_gen_brcondi_i32(TCG_COND_LT, REG(B7_4), 0, label1);
 	    /* Rm positive, shift to the left */
 	    tcg_gen_andi_i32(shift, REG(B7_4), 0x1f);
@@ -966,7 +966,7 @@
 	    int label1 = gen_new_label();
 	    int label2 = gen_new_label();
 	    int label3 = gen_new_label();
-	    TCGv shift = tcg_temp_local_new(TCG_TYPE_I32);
+	    TCGv shift = tcg_temp_local_new();
 	    tcg_gen_brcondi_i32(TCG_COND_LT, REG(B7_4), 0, label1);
 	    /* Rm positive, shift to the left */
 	    tcg_gen_andi_i32(shift, REG(B7_4), 0x1f);
@@ -1645,9 +1645,9 @@
     case 0x401b:		/* tas.b @Rn */
 	{
 	    TCGv addr, val;
-	    addr = tcg_temp_local_new(TCG_TYPE_I32);
+	    addr = tcg_temp_local_new();
 	    tcg_gen_mov_i32(addr, REG(B11_8));
-	    val = tcg_temp_local_new(TCG_TYPE_I32);
+	    val = tcg_temp_local_new();
 	    tcg_gen_qemu_ld8u(val, addr, ctx->memidx);
 	    gen_cmp_imm(TCG_COND_EQ, val, 0);
 	    tcg_gen_ori_i32(val, val, 0x80);
Index: tcg/tcg-op.h
===================================================================
--- tcg/tcg-op.h	(revision 6144)
+++ tcg/tcg-op.h	(working copy)
@@ -1693,7 +1693,7 @@
 #define tcg_temp_new() tcg_temp_new_i32()
 #define tcg_global_reg_new tcg_global_reg_new_i32
 #define tcg_global_mem_new tcg_global_mem_new_i32
-#define tcg_temp_local_new(t) tcg_temp_local_new_i32()
+#define tcg_temp_local_new() tcg_temp_local_new_i32()
 #define tcg_temp_free tcg_temp_free_i32
 #define tcg_gen_qemu_ldst_op tcg_gen_op3i_i32
 #define tcg_gen_qemu_ldst_op_i64 tcg_gen_qemu_ldst_op_i64_i32
@@ -1704,7 +1704,7 @@
 #define tcg_temp_new() tcg_temp_new_i64()
 #define tcg_global_reg_new tcg_global_reg_new_i64
 #define tcg_global_mem_new tcg_global_mem_new_i64
-#define tcg_temp_local_new(t) tcg_temp_local_new_i64()
+#define tcg_temp_local_new() tcg_temp_local_new_i64()
 #define tcg_temp_free tcg_temp_free_i64
 #define tcg_gen_qemu_ldst_op tcg_gen_op3i_i64
 #define tcg_gen_qemu_ldst_op_i64 tcg_gen_qemu_ldst_op_i64_i64

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] tcg_temp_local_new should take no parameter
  2009-01-01 13:19 [Qemu-devel] [PATCH] tcg_temp_local_new should take no parameter Laurent Desnogues
@ 2009-01-01 14:09 ` Aurelien Jarno
  2009-01-01 14:36 ` Stuart Brady
  1 sibling, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2009-01-01 14:09 UTC (permalink / raw)
  To: Laurent Desnogues; +Cc: qemu-devel

On Thu, Jan 01, 2009 at 02:19:10PM +0100, Laurent Desnogues wrote:
> Hello,
> 
> this patch removes useless type information in some calls to
> tcg_temp_local_new.  It also removes the parameter from the
> macro declaration;  if a target has to use a specific non-default
> size then it should use tcg_temp_local_new_{i32,i64}.
> 

Thanks, applied.

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] tcg_temp_local_new should take no parameter
  2009-01-01 13:19 [Qemu-devel] [PATCH] tcg_temp_local_new should take no parameter Laurent Desnogues
  2009-01-01 14:09 ` Aurelien Jarno
@ 2009-01-01 14:36 ` Stuart Brady
  2009-01-02  4:36   ` Paul Brook
  1 sibling, 1 reply; 4+ messages in thread
From: Stuart Brady @ 2009-01-01 14:36 UTC (permalink / raw)
  To: qemu-devel

On Thu, Jan 01, 2009 at 02:19:10PM +0100, Laurent Desnogues wrote:
> Index: target-ppc/translate.c
> ===================================================================
> --- target-ppc/translate.c	(revision 6144)
> +++ target-ppc/translate.c	(working copy)
> @@ -6350,7 +6350,7 @@
>      TCGv_i32 t0 = tcg_temp_local_new_i32();                                   \
>      TCGv_i32 t1 = tcg_temp_local_new_i32();                                   \
>      TCGv_i32 t2 = tcg_temp_local_new_i32();                                   \
> -    TCGv_i64 t3 = tcg_temp_local_new(TCG_TYPE_I64);                           \
> +    TCGv_i64 t3 = tcg_temp_local_new();                                       \
>      tcg_gen_trunc_i64_i32(t0, cpu_gpr[rA(ctx->opcode)]);                      \
>      tcg_gen_trunc_i64_i32(t2, cpu_gpr[rB(ctx->opcode)]);                      \
>      tcg_op(t0, t0, t2);                                                       \

Wouldn't tcg_temp_local_new_i64 be a little clearer, as t3 is later 
freed with tcg_temp_free_i64()?

The SH4 emulation seems to use 'plain' TCGv mostly, expects it to be
32-bits, and doesn't use the _tl macros, which I suppose is reasonable 
for a 32-bit only target.

Alpha, ARM and M68K do something similar (so I'll try to follow the
style that they use) but CRIS uses _tl a lot, which seems peculiar...

Cheers,
-- 
Stuart Brady

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] tcg_temp_local_new should take no parameter
  2009-01-01 14:36 ` Stuart Brady
@ 2009-01-02  4:36   ` Paul Brook
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Brook @ 2009-01-02  4:36 UTC (permalink / raw)
  To: qemu-devel

> The SH4 emulation seems to use 'plain' TCGv mostly, expects it to be
> 32-bits, and doesn't use the _tl macros, which I suppose is reasonable
> for a 32-bit only target.
>
> Alpha, ARM and M68K do something similar (so I'll try to follow the
> style that they use) but CRIS uses _tl a lot, which seems peculiar...

The distinction only really makes sense on CPUs that have both 32-bit and 
64-bit variants.  Chances are that if a 64-bit arm/m68k/cris cpu were to 
exist then most of the code would need auditing anyway, so it's mostly a 
matter of personal preference which is used.

Paul

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-02  4:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-01 13:19 [Qemu-devel] [PATCH] tcg_temp_local_new should take no parameter Laurent Desnogues
2009-01-01 14:09 ` Aurelien Jarno
2009-01-01 14:36 ` Stuart Brady
2009-01-02  4:36   ` Paul Brook

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).