@@ -329,7 +329,11 @@ void tcg_context_init(TCGContext *s)
GHashTable *helper_table;
memset(s, 0, sizeof(*s));
- s->nb_globals = 0;
+
+ /* Reserve global 0 so that, when foxing these integrals
+ as pointers, NULL is unused. */
+ s->nb_globals = 1;
+ s->nb_temps = 1;
/* Count total number of arguments and allocate the corresponding
space */
@@ -467,13 +467,13 @@ static inline intptr_t QEMU_ARTIFICIAL GET_TCGV_PTR(TCGv_ptr t)
#define TCGV_EQUAL_PTR(a, b) (GET_TCGV_PTR(a) == GET_TCGV_PTR(b))
/* Dummy definition to avoid compiler warnings. */
-#define TCGV_UNUSED_I32(x) x = MAKE_TCGV_I32(-1)
-#define TCGV_UNUSED_I64(x) x = MAKE_TCGV_I64(-1)
-#define TCGV_UNUSED_PTR(x) x = MAKE_TCGV_PTR(-1)
+#define TCGV_UNUSED_I32(x) x = NULL
+#define TCGV_UNUSED_I64(x) x = NULL
+#define TCGV_UNUSED_PTR(x) x = NULL
-#define TCGV_IS_UNUSED_I32(x) (GET_TCGV_I32(x) == -1)
-#define TCGV_IS_UNUSED_I64(x) (GET_TCGV_I64(x) == -1)
-#define TCGV_IS_UNUSED_PTR(x) (GET_TCGV_PTR(x) == -1)
+#define TCGV_IS_UNUSED_I32(x) ((x) == NULL)
+#define TCGV_IS_UNUSED_I64(x) ((x) == NULL)
+#define TCGV_IS_UNUSED_PTR(x) ((x) == NULL)
/* call flags */
/* Helper does not read globals (either directly or through an exception). It
Signed-off-by: Richard Henderson <rth@twiddle.net> --- tcg/tcg.c | 6 +++++- tcg/tcg.h | 12 ++++++------ 2 files changed, 11 insertions(+), 7 deletions(-)