Skip to contentSkip to conversation

simplify storing temporaries in env structure regardless of host/target long size

PATCH In review Igor Kovalenko 2 participants 3 messages Feb 12, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 simplify storing temporaries in env structure regardless of host/target long size

This patch separates decision about storing temporaries in env structure from target long size by introducing a macro QEMU_TEMPORARY_IN_ENV
Makes it a bit easier to work around register allocation problems. By default there is no change to generated code.

Signature · 2 lines
Kind regards,
Igor V. Kovalenko

Index: target-i386/cpu.h
===================================================================
RCS file: /cvsroot/qemu/qemu/target-i386/cpu.h,v
retrieving revision 1.57

cpu.h +1 -1
diff -u -p -r1.57 cpu.h
@@ -467,7 +467,7 @@ typedef union {
 #define NB_MMU_MODES 2
 
 typedef struct CPUX86State {
-#if TARGET_LONG_BITS > HOST_LONG_BITS
+#if defined(QEMU_TEMPORARY_IN_ENV)
     /* temporaries if we cannot store them in host registers */
     target_ulong t0, t1, t2;
 #endif

Index: target-i386/exec.h
===================================================================
RCS file: /cvsroot/qemu/qemu/target-i386/exec.h,v
retrieving revision 1.41

exec.h +4 -0
diff -u -p -r1.41 exec.h
@@ -33,6 +33,10 @@
 register struct CPUX86State *env asm(AREG0);
 
 #if TARGET_LONG_BITS > HOST_LONG_BITS
+#define QEMU_TEMPORARY_IN_ENV
+#endif
+
+#if defined(QEMU_TEMPORARY_IN_ENV)
 
 /* no registers can be used */
 #define T0 (env->t0)
#1 lore raw
Quoted 5 lines · Igor Kovalenko

This patch separates decision about storing temporaries in env structure from target long size by introducing a macro QEMU_TEMPORARY_IN_ENV
Makes it a bit easier to work around register allocation problems. By default there is no change to generated code.

I'd move env->t0/t1/t2 to CPU_COMMON and the T0/T1/T2 logic to hostregs_helper.h.

#2 lore raw
Quoted 10 lines · Blue Swirl
Quoted 5 lines · Igor Kovalenko

This patch separates decision about storing temporaries in env structure from target long size by introducing a macro QEMU_TEMPORARY_IN_ENV
Makes it a bit easier to work around register allocation problems. By default there is no change to generated code.

I'd move env->t0/t1/t2 to CPU_COMMON and the T0/T1/T2 logic to hostregs_helper.h.

I don't think the hostregs_helper.h is supposed to be used for that. It knows nothing about env.

Signature · 2 lines
Kind regards,
Igor V. Kovalenko