mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
tcg: Use bitmaps for free temporaries
We previously allocated 32-bits per temp for the next_free_temp entry. We now allocate 4 bits per temp across the 4 bitmaps. Using a linked list meant that if a translator is tweeked, resulting in temps being freed in a different order, that would have follow-on effects throughout the TB. Always allocating the lowest free temp means that follow-on effects are minimized, which can make it easier to diff output when debugging the translators. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
parent
8f84271da8
commit
0ec9eabc7f
2 changed files with 21 additions and 22 deletions
11
tcg/tcg.h
11
tcg/tcg.h
|
@ -26,7 +26,7 @@
|
|||
#define TCG_H
|
||||
|
||||
#include "qemu-common.h"
|
||||
|
||||
#include "qemu/bitops.h"
|
||||
#include "tcg-target.h"
|
||||
|
||||
/* Default target word size to pointer size. */
|
||||
|
@ -436,13 +436,15 @@ typedef struct TCGTemp {
|
|||
basic blocks. Otherwise, it is not
|
||||
preserved across basic blocks. */
|
||||
unsigned int temp_allocated:1; /* never used for code gen */
|
||||
/* index of next free temp of same base type, -1 if end */
|
||||
int next_free_temp;
|
||||
const char *name;
|
||||
} TCGTemp;
|
||||
|
||||
typedef struct TCGContext TCGContext;
|
||||
|
||||
typedef struct TCGTempSet {
|
||||
unsigned long l[BITS_TO_LONGS(TCG_MAX_TEMPS)];
|
||||
} TCGTempSet;
|
||||
|
||||
struct TCGContext {
|
||||
uint8_t *pool_cur, *pool_end;
|
||||
TCGPool *pool_first, *pool_current, *pool_first_large;
|
||||
|
@ -450,8 +452,6 @@ struct TCGContext {
|
|||
int nb_labels;
|
||||
int nb_globals;
|
||||
int nb_temps;
|
||||
/* index of free temps, -1 if none */
|
||||
int first_free_temp[TCG_TYPE_COUNT * 2];
|
||||
|
||||
/* goto_tb support */
|
||||
uint8_t *code_buf;
|
||||
|
@ -477,6 +477,7 @@ struct TCGContext {
|
|||
|
||||
uint8_t *code_ptr;
|
||||
TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */
|
||||
TCGTempSet free_temps[TCG_TYPE_COUNT * 2];
|
||||
|
||||
GHashTable *helpers;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue