Commit 302baf9367292880b3dbcfb243abff36dbb4c4e8
1 parent
a018d617
Get rid of temporary variable cache.
The temporary variable cache in no longer need since tcg_temp_free was introduced. Signed-off-by: Filip Navara <filip.navara@gmail.com>
Showing
1 changed file
with
3 additions
and
28 deletions
target-arm/translate.c
@@ -110,44 +110,20 @@ void arm_translate_init(void) | @@ -110,44 +110,20 @@ void arm_translate_init(void) | ||
110 | #include "helpers.h" | 110 | #include "helpers.h" |
111 | } | 111 | } |
112 | 112 | ||
113 | -/* The code generator doesn't like lots of temporaries, so maintain our own | ||
114 | - cache for reuse within a function. */ | ||
115 | -#define MAX_TEMPS 8 | ||
116 | static int num_temps; | 113 | static int num_temps; |
117 | -static TCGv temps[MAX_TEMPS]; | ||
118 | 114 | ||
119 | /* Allocate a temporary variable. */ | 115 | /* Allocate a temporary variable. */ |
120 | static TCGv_i32 new_tmp(void) | 116 | static TCGv_i32 new_tmp(void) |
121 | { | 117 | { |
122 | - TCGv tmp; | ||
123 | - if (num_temps == MAX_TEMPS) | ||
124 | - abort(); | ||
125 | - | ||
126 | - if (GET_TCGV_I32(temps[num_temps])) | ||
127 | - return temps[num_temps++]; | ||
128 | - | ||
129 | - tmp = tcg_temp_new_i32(); | ||
130 | - temps[num_temps++] = tmp; | ||
131 | - return tmp; | 118 | + num_temps++; |
119 | + return tcg_temp_new_i32(); | ||
132 | } | 120 | } |
133 | 121 | ||
134 | /* Release a temporary variable. */ | 122 | /* Release a temporary variable. */ |
135 | static void dead_tmp(TCGv tmp) | 123 | static void dead_tmp(TCGv tmp) |
136 | { | 124 | { |
137 | - int i; | 125 | + tcg_temp_free(tmp); |
138 | num_temps--; | 126 | num_temps--; |
139 | - i = num_temps; | ||
140 | - if (TCGV_EQUAL(temps[i], tmp)) | ||
141 | - return; | ||
142 | - | ||
143 | - /* Shuffle this temp to the last slot. */ | ||
144 | - while (!TCGV_EQUAL(temps[i], tmp)) | ||
145 | - i--; | ||
146 | - while (i < num_temps) { | ||
147 | - temps[i] = temps[i + 1]; | ||
148 | - i++; | ||
149 | - } | ||
150 | - temps[i] = tmp; | ||
151 | } | 127 | } |
152 | 128 | ||
153 | static inline TCGv load_cpu_offset(int offset) | 129 | static inline TCGv load_cpu_offset(int offset) |
@@ -8760,7 +8736,6 @@ static inline void gen_intermediate_code_internal(CPUState *env, | @@ -8760,7 +8736,6 @@ static inline void gen_intermediate_code_internal(CPUState *env, | ||
8760 | 8736 | ||
8761 | /* generate intermediate code */ | 8737 | /* generate intermediate code */ |
8762 | num_temps = 0; | 8738 | num_temps = 0; |
8763 | - memset(temps, 0, sizeof(temps)); | ||
8764 | 8739 | ||
8765 | pc_start = tb->pc; | 8740 | pc_start = tb->pc; |
8766 | 8741 |