Skip to contentSkip to conversation

tcg: Remove redundant pointer from TCGContext

PATCH Applied Stefan Weil 3 participants 3 messages Oct 4, 2012 – Oct 7, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcg: Remove redundant pointer from TCGContext

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.

---

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(-)
tcg/tcg.c +0 -1
index 72f4b26..a99255c 100644
@@ -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
tcg/tcg.h +1 -2
index af7464a..1e43ce4 100644
@@ -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;
Signature · 1 line
1.7.10
Applied
#2 lore raw
In reply to Stefan Weil

Thanks, applied.

Quoted 54 lines · 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.

---

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(-)
tcg/tcg.c +0 -1
index 72f4b26..a99255c 100644
@@ -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
tcg/tcg.h +1 -3
index af7464a..1e43ce4 100644
@@ -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