qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] tcg: Remove redundant pointer from TCGContext
@ 2012-10-04 18:29 Stefan Weil
  2012-10-04 21:39 ` Richard Henderson
  2012-10-07 18:43 ` Blue Swirl
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Weil @ 2012-10-04 18:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl, Stefan Weil

The pointer entry 'temps' always refers to the array entry 'static_temps'.
Removing the pointer and renaming 'static_temps' to 'temps' reduces the
size of TCGContext (4 or 8 byte) and allows better code generation.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---

The size of the executables is typically reduced by about 80 byte.
Usually smaller code also runs faster, but that effect will be
very small here.

Regards
Stefan Weil

 tcg/tcg.c |    1 -
 tcg/tcg.h |    3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/tcg/tcg.c b/tcg/tcg.c
index 72f4b26..a99255c 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -242,7 +242,6 @@ void tcg_context_init(TCGContext *s)
     int *sorted_args;
 
     memset(s, 0, sizeof(*s));
-    s->temps = s->static_temps;
     s->nb_globals = 0;
     
     /* Count total number of arguments and allocate the corresponding
diff --git a/tcg/tcg.h b/tcg/tcg.h
index af7464a..1e43ce4 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -336,7 +336,6 @@ struct TCGContext {
     TCGPool *pool_first, *pool_current, *pool_first_large;
     TCGLabel *labels;
     int nb_labels;
-    TCGTemp *temps; /* globals first, temps after */
     int nb_globals;
     int nb_temps;
     /* index of free temps, -1 if none */
@@ -362,7 +361,7 @@ struct TCGContext {
     int frame_reg;
 
     uint8_t *code_ptr;
-    TCGTemp static_temps[TCG_MAX_TEMPS];
+    TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */
 
     TCGHelperInfo *helpers;
     int nb_helpers;
-- 
1.7.10

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

* Re: [Qemu-devel] [PATCH] tcg: Remove redundant pointer from TCGContext
  2012-10-04 18:29 [Qemu-devel] [PATCH] tcg: Remove redundant pointer from TCGContext Stefan Weil
@ 2012-10-04 21:39 ` Richard Henderson
  2012-10-07 18:43 ` Blue Swirl
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2012-10-04 21:39 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Blue Swirl, qemu-devel

On 10/04/2012 11:29 AM, Stefan Weil wrote:
> The pointer entry 'temps' always refers to the array entry 'static_temps'.
> Removing the pointer and renaming 'static_temps' to 'temps' reduces the
> size of TCGContext (4 or 8 byte) and allows better code generation.
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

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

* Re: [Qemu-devel] [PATCH] tcg: Remove redundant pointer from TCGContext
  2012-10-04 18:29 [Qemu-devel] [PATCH] tcg: Remove redundant pointer from TCGContext Stefan Weil
  2012-10-04 21:39 ` Richard Henderson
@ 2012-10-07 18:43 ` Blue Swirl
  1 sibling, 0 replies; 3+ messages in thread
From: Blue Swirl @ 2012-10-07 18:43 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

Thanks, applied.

On Thu, Oct 4, 2012 at 6:29 PM, Stefan Weil <sw@weilnetz.de> wrote:
> The pointer entry 'temps' always refers to the array entry 'static_temps'.
> Removing the pointer and renaming 'static_temps' to 'temps' reduces the
> size of TCGContext (4 or 8 byte) and allows better code generation.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>
> The size of the executables is typically reduced by about 80 byte.
> Usually smaller code also runs faster, but that effect will be
> very small here.
>
> Regards
> Stefan Weil
>
>  tcg/tcg.c |    1 -
>  tcg/tcg.h |    3 +--
>  2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index 72f4b26..a99255c 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -242,7 +242,6 @@ void tcg_context_init(TCGContext *s)
>      int *sorted_args;
>
>      memset(s, 0, sizeof(*s));
> -    s->temps = s->static_temps;
>      s->nb_globals = 0;
>
>      /* Count total number of arguments and allocate the corresponding
> diff --git a/tcg/tcg.h b/tcg/tcg.h
> index af7464a..1e43ce4 100644
> --- a/tcg/tcg.h
> +++ b/tcg/tcg.h
> @@ -336,7 +336,6 @@ struct TCGContext {
>      TCGPool *pool_first, *pool_current, *pool_first_large;
>      TCGLabel *labels;
>      int nb_labels;
> -    TCGTemp *temps; /* globals first, temps after */
>      int nb_globals;
>      int nb_temps;
>      /* index of free temps, -1 if none */
> @@ -362,7 +361,7 @@ struct TCGContext {
>      int frame_reg;
>
>      uint8_t *code_ptr;
> -    TCGTemp static_temps[TCG_MAX_TEMPS];
> +    TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */
>
>      TCGHelperInfo *helpers;
>      int nb_helpers;
> --
> 1.7.10
>

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

end of thread, other threads:[~2012-10-07 18:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-04 18:29 [Qemu-devel] [PATCH] tcg: Remove redundant pointer from TCGContext Stefan Weil
2012-10-04 21:39 ` Richard Henderson
2012-10-07 18:43 ` Blue Swirl

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