* [Qemu-devel] [PATCH] Some cleanups after dyngen removal
@ 2008-12-07 17:12 Laurent Desnogues
2008-12-07 18:17 ` Aurelien Jarno
0 siblings, 1 reply; 5+ messages in thread
From: Laurent Desnogues @ 2008-12-07 17:12 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 781 bytes --]
Hello,
this patch removes some now unused things after dyngen removal.
1. dyngen-exec.h: op_param, op _jmp and some associated macros
are now unused;
2. Makefile.target: tcg-dyngen is not needed anymore
2. tcg/tcg-op.h, tcg/tcg-opc.h: gen-op.h is dead
3. tcg.c:
- INDEX_op_end is now the first op
- CONFIG_DYNGEN_OP is never defined
4. tcg.h: dyngen_op not needed anymore
5. exec-all.h: remove some ASM macros.
Note tcg/tcg-dyngen.c can be removed.
I think dyngen-exec.h should be renamed (it's included by the various
exec.h targets).
I tested all targets still compile on my x86_64 machine.
This patch is probably not complete for possible removals, but I hope
it's a good start.
Laurent
Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tcg-no-dyngen.patch --]
[-- Type: text/x-patch; name=tcg-no-dyngen.patch, Size: 11270 bytes --]
Index: dyngen-exec.h
===================================================================
--- dyngen-exec.h (revision 5915)
+++ dyngen-exec.h (working copy)
@@ -201,10 +201,6 @@
/* force GCC to generate only one epilog at the end of the function */
#define FORCE_RET() __asm__ __volatile__("" : : : "memory");
-#ifndef OPPROTO
-#define OPPROTO
-#endif
-
#define xglue(x, y) x ## y
#define glue(x, y) xglue(x, y)
#define stringify(s) tostring(s)
@@ -217,79 +213,6 @@
#define __hidden
#endif
-#if defined(__alpha__)
-/* Suggested by Richard Henderson. This will result in code like
- ldah $0,__op_param1($29) !gprelhigh
- lda $0,__op_param1($0) !gprellow
- We can then conveniently change $29 to $31 and adapt the offsets to
- emit the appropriate constant. */
-extern int __op_param1 __hidden;
-extern int __op_param2 __hidden;
-extern int __op_param3 __hidden;
-#define PARAM1 ({ int _r; asm("" : "=r"(_r) : "0" (&__op_param1)); _r; })
-#define PARAM2 ({ int _r; asm("" : "=r"(_r) : "0" (&__op_param2)); _r; })
-#define PARAM3 ({ int _r; asm("" : "=r"(_r) : "0" (&__op_param3)); _r; })
-#elif defined(__s390__)
-extern int __op_param1 __hidden;
-extern int __op_param2 __hidden;
-extern int __op_param3 __hidden;
-#define PARAM1 ({ int _r; asm("bras %0,8; .long " ASM_NAME(__op_param1) "; l %0,0(%0)" : "=r"(_r) : ); _r; })
-#define PARAM2 ({ int _r; asm("bras %0,8; .long " ASM_NAME(__op_param2) "; l %0,0(%0)" : "=r"(_r) : ); _r; })
-#define PARAM3 ({ int _r; asm("bras %0,8; .long " ASM_NAME(__op_param3) "; l %0,0(%0)" : "=r"(_r) : ); _r; })
-#else
-#if defined(__APPLE__)
-static int __op_param1, __op_param2, __op_param3;
-#else
-extern int __op_param1, __op_param2, __op_param3;
-#endif
-#define PARAM1 ((long)(&__op_param1))
-#define PARAM2 ((long)(&__op_param2))
-#define PARAM3 ((long)(&__op_param3))
-#endif /* !defined(__alpha__) */
-
-extern int __op_jmp0, __op_jmp1, __op_jmp2, __op_jmp3;
-
-#if defined(_WIN32) || defined(__APPLE__)
-#define ASM_NAME(x) "_" #x
-#else
-#define ASM_NAME(x) #x
-#endif
-
-#if defined(__i386__)
-#define EXIT_TB() asm volatile ("ret")
-#define GOTO_LABEL_PARAM(n) asm volatile ("jmp " ASM_NAME(__op_gen_label) #n)
-#elif defined(__x86_64__)
-#define EXIT_TB() asm volatile ("ret")
-#define GOTO_LABEL_PARAM(n) asm volatile ("jmp " ASM_NAME(__op_gen_label) #n)
-#elif defined(__powerpc__)
-#define EXIT_TB() asm volatile ("blr")
-#define GOTO_LABEL_PARAM(n) asm volatile ("b " ASM_NAME(__op_gen_label) #n)
-#elif defined(__s390__)
-#define EXIT_TB() asm volatile ("br %r14")
-#define GOTO_LABEL_PARAM(n) asm volatile ("larl %r7,12; l %r7,0(%r7); br %r7; .long " ASM_NAME(__op_gen_label) #n)
-#elif defined(__alpha__)
-#define EXIT_TB() asm volatile ("ret")
-#elif defined(__ia64__)
-#define EXIT_TB() asm volatile ("br.ret.sptk.many b0;;")
-#define GOTO_LABEL_PARAM(n) asm volatile ("br.sptk.many " \
- ASM_NAME(__op_gen_label) #n)
-#elif defined(__sparc__)
-#define EXIT_TB() asm volatile ("jmpl %i0 + 8, %g0; nop")
-#define GOTO_LABEL_PARAM(n) asm volatile ("ba " ASM_NAME(__op_gen_label) #n ";nop")
-#elif defined(__arm__)
-#define EXIT_TB() asm volatile ("b exec_loop")
-#define GOTO_LABEL_PARAM(n) asm volatile ("b " ASM_NAME(__op_gen_label) #n)
-#elif defined(__mc68000)
-#define EXIT_TB() asm volatile ("rts")
-#elif defined(__mips__)
-#define EXIT_TB() asm volatile ("jr $ra")
-#define GOTO_LABEL_PARAM(n) asm volatile (".set noat; la $1, " ASM_NAME(__op_gen_label) #n "; jr $1; .set at")
-#elif defined(__hppa__)
-#define GOTO_LABEL_PARAM(n) asm volatile ("b,n " ASM_NAME(__op_gen_label) #n)
-#else
-#error unsupported CPU
-#endif
-
/* The return address may point to the start of the next instruction.
Subtracting one gets us the call instruction itself. */
#if defined(__s390__)
Index: Makefile.target
===================================================================
--- Makefile.target (revision 5915)
+++ Makefile.target (working copy)
@@ -186,7 +186,7 @@
LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\
translate.o host-utils.o
# TCG code generator
-LIBOBJS+= tcg/tcg.o tcg/tcg-dyngen.o tcg/tcg-runtime.o
+LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o
CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
ifeq ($(ARCH),sparc64)
CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
Index: tcg/tcg-op.h
===================================================================
--- tcg/tcg-op.h (revision 5915)
+++ tcg/tcg-op.h (working copy)
@@ -23,11 +23,6 @@
*/
#include "tcg.h"
-#ifdef CONFIG_DYNGEN_OP
-/* legacy dyngen operations */
-#include "gen-op.h"
-#endif
-
int gen_new_label(void);
static inline void tcg_gen_op1_i32(int opc, TCGv_i32 arg1)
Index: tcg/tcg-opc.h
===================================================================
--- tcg/tcg-opc.h (revision 5915)
+++ tcg/tcg-opc.h (working copy)
@@ -21,10 +21,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifdef CONFIG_DYNGEN_OP
-#include "dyngen-opc.h"
-#endif
-
#ifndef DEF2
#define DEF2(name, oargs, iargs, cargs, flags) DEF(name, oargs + iargs + cargs, 0)
#endif
Index: tcg/tcg.c
===================================================================
--- tcg/tcg.c (revision 5915)
+++ tcg/tcg.c (working copy)
@@ -1198,57 +1198,50 @@
break;
/* XXX: optimize by hardcoding common cases (e.g. triadic ops) */
default:
- if (op > INDEX_op_end) {
- args -= def->nb_args;
- nb_iargs = def->nb_iargs;
- nb_oargs = def->nb_oargs;
+ args -= def->nb_args;
+ nb_iargs = def->nb_iargs;
+ nb_oargs = def->nb_oargs;
- /* Test if the operation can be removed because all
- its outputs are dead. We assume that nb_oargs == 0
- implies side effects */
- if (!(def->flags & TCG_OPF_SIDE_EFFECTS) && nb_oargs != 0) {
- for(i = 0; i < nb_oargs; i++) {
- arg = args[i];
- if (!dead_temps[arg])
- goto do_not_remove;
- }
- tcg_set_nop(s, gen_opc_buf + op_index, args, def->nb_args);
+ /* Test if the operation can be removed because all
+ its outputs are dead. We assume that nb_oargs == 0
+ implies side effects */
+ if (!(def->flags & TCG_OPF_SIDE_EFFECTS) && nb_oargs != 0) {
+ for(i = 0; i < nb_oargs; i++) {
+ arg = args[i];
+ if (!dead_temps[arg])
+ goto do_not_remove;
+ }
+ tcg_set_nop(s, gen_opc_buf + op_index, args, def->nb_args);
#ifdef CONFIG_PROFILER
- s->del_op_count++;
+ s->del_op_count++;
#endif
- } else {
- do_not_remove:
+ } else {
+ do_not_remove:
- /* output args are dead */
- for(i = 0; i < nb_oargs; i++) {
- arg = args[i];
- dead_temps[arg] = 1;
+ /* output args are dead */
+ for(i = 0; i < nb_oargs; i++) {
+ arg = args[i];
+ dead_temps[arg] = 1;
+ }
+
+ /* if end of basic block, update */
+ if (def->flags & TCG_OPF_BB_END) {
+ tcg_la_bb_end(s, dead_temps);
+ } else if (def->flags & TCG_OPF_CALL_CLOBBER) {
+ /* globals are live */
+ memset(dead_temps, 0, s->nb_globals);
+ }
+
+ /* input args are live */
+ dead_iargs = 0;
+ for(i = 0; i < nb_iargs; i++) {
+ arg = args[i + nb_oargs];
+ if (dead_temps[arg]) {
+ dead_iargs |= (1 << i);
}
-
- /* if end of basic block, update */
- if (def->flags & TCG_OPF_BB_END) {
- tcg_la_bb_end(s, dead_temps);
- } else if (def->flags & TCG_OPF_CALL_CLOBBER) {
- /* globals are live */
- memset(dead_temps, 0, s->nb_globals);
- }
-
- /* input args are live */
- dead_iargs = 0;
- for(i = 0; i < nb_iargs; i++) {
- arg = args[i + nb_oargs];
- if (dead_temps[arg]) {
- dead_iargs |= (1 << i);
- }
- dead_temps[arg] = 0;
- }
- s->op_dead_iargs[op_index] = dead_iargs;
+ dead_temps[arg] = 0;
}
- } else {
- /* legacy dyngen operations */
- args -= def->nb_args;
- /* mark end of basic block */
- tcg_la_bb_end(s, dead_temps);
+ s->op_dead_iargs[op_index] = dead_iargs;
}
break;
}
@@ -2016,21 +2009,6 @@
case INDEX_op_end:
goto the_end;
-#ifdef CONFIG_DYNGEN_OP
- case 0 ... INDEX_op_end - 1:
- /* legacy dyngen ops */
-#ifdef CONFIG_PROFILER
- s->old_op_count++;
-#endif
- tcg_reg_alloc_bb_end(s, s->reserved_regs);
- if (search_pc >= 0) {
- s->code_ptr += def->copy_size;
- args += def->nb_args;
- } else {
- args = dyngen_op(s, opc, args);
- }
- goto next;
-#endif
default:
/* Note: in order to speed up the code, it would be much
faster to have specialized register allocator functions for
Index: tcg/tcg.h
===================================================================
--- tcg/tcg.h (revision 5915)
+++ tcg/tcg.h (working copy)
@@ -449,8 +449,6 @@
const TCGArg *tcg_gen_code_op(TCGContext *s, int opc, const TCGArg *args1,
unsigned int dead_iargs);
-const TCGArg *dyngen_op(TCGContext *s, int opc, const TCGArg *opparam_ptr);
-
/* tcg-runtime.c */
int64_t tcg_helper_shl_i64(int64_t arg1, int64_t arg2);
int64_t tcg_helper_shr_i64(int64_t arg1, int64_t arg2);
Index: exec-all.h
===================================================================
--- exec-all.h (revision 5915)
+++ exec-all.h (working copy)
@@ -267,20 +267,6 @@
TranslationBlock *tb_find_pc(unsigned long pc_ptr);
-#if defined(_WIN32)
-#define ASM_DATA_SECTION ".section \".data\"\n"
-#define ASM_PREVIOUS_SECTION ".section .text\n"
-#elif defined(__APPLE__)
-#define ASM_DATA_SECTION ".data\n"
-#define ASM_PREVIOUS_SECTION ".text\n"
-#else
-#define ASM_DATA_SECTION ".section \".data\"\n"
-#define ASM_PREVIOUS_SECTION ".previous\n"
-#endif
-
-#define ASM_OP_LABEL_NAME(n, opname) \
- ASM_NAME(__op_label) #n "." ASM_NAME(opname)
-
extern CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4];
extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4];
extern void *io_mem_opaque[IO_MEM_NB_ENTRIES];
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] Some cleanups after dyngen removal
2008-12-07 17:12 [Qemu-devel] [PATCH] Some cleanups after dyngen removal Laurent Desnogues
@ 2008-12-07 18:17 ` Aurelien Jarno
2008-12-07 19:10 ` Laurent Desnogues
0 siblings, 1 reply; 5+ messages in thread
From: Aurelien Jarno @ 2008-12-07 18:17 UTC (permalink / raw)
To: qemu-devel
On Sun, Dec 07, 2008 at 06:12:50PM +0100, Laurent Desnogues wrote:
> Hello,
>
> this patch removes some now unused things after dyngen removal.
>
> 1. dyngen-exec.h: op_param, op _jmp and some associated macros
> are now unused;
> 2. Makefile.target: tcg-dyngen is not needed anymore
> 2. tcg/tcg-op.h, tcg/tcg-opc.h: gen-op.h is dead
> 3. tcg.c:
> - INDEX_op_end is now the first op
> - CONFIG_DYNGEN_OP is never defined
> 4. tcg.h: dyngen_op not needed anymore
> 5. exec-all.h: remove some ASM macros.
>
> Note tcg/tcg-dyngen.c can be removed.
>
> I think dyngen-exec.h should be renamed (it's included by the various
> exec.h targets).
>
> I tested all targets still compile on my x86_64 machine.
>
> This patch is probably not complete for possible removals, but I hope
> it's a good start.
>
Yes, it is a good start. A grep -r dyngen still gives some results, but
far less. This code can be removed in another commit.
Thanks a lot, applied.
> Laurent
>
> Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>
> Index: dyngen-exec.h
> ===================================================================
> --- dyngen-exec.h (revision 5915)
> +++ dyngen-exec.h (working copy)
> @@ -201,10 +201,6 @@
> /* force GCC to generate only one epilog at the end of the function */
> #define FORCE_RET() __asm__ __volatile__("" : : : "memory");
>
> -#ifndef OPPROTO
> -#define OPPROTO
> -#endif
> -
> #define xglue(x, y) x ## y
> #define glue(x, y) xglue(x, y)
> #define stringify(s) tostring(s)
> @@ -217,79 +213,6 @@
> #define __hidden
> #endif
>
> -#if defined(__alpha__)
> -/* Suggested by Richard Henderson. This will result in code like
> - ldah $0,__op_param1($29) !gprelhigh
> - lda $0,__op_param1($0) !gprellow
> - We can then conveniently change $29 to $31 and adapt the offsets to
> - emit the appropriate constant. */
> -extern int __op_param1 __hidden;
> -extern int __op_param2 __hidden;
> -extern int __op_param3 __hidden;
> -#define PARAM1 ({ int _r; asm("" : "=r"(_r) : "0" (&__op_param1)); _r; })
> -#define PARAM2 ({ int _r; asm("" : "=r"(_r) : "0" (&__op_param2)); _r; })
> -#define PARAM3 ({ int _r; asm("" : "=r"(_r) : "0" (&__op_param3)); _r; })
> -#elif defined(__s390__)
> -extern int __op_param1 __hidden;
> -extern int __op_param2 __hidden;
> -extern int __op_param3 __hidden;
> -#define PARAM1 ({ int _r; asm("bras %0,8; .long " ASM_NAME(__op_param1) "; l %0,0(%0)" : "=r"(_r) : ); _r; })
> -#define PARAM2 ({ int _r; asm("bras %0,8; .long " ASM_NAME(__op_param2) "; l %0,0(%0)" : "=r"(_r) : ); _r; })
> -#define PARAM3 ({ int _r; asm("bras %0,8; .long " ASM_NAME(__op_param3) "; l %0,0(%0)" : "=r"(_r) : ); _r; })
> -#else
> -#if defined(__APPLE__)
> -static int __op_param1, __op_param2, __op_param3;
> -#else
> -extern int __op_param1, __op_param2, __op_param3;
> -#endif
> -#define PARAM1 ((long)(&__op_param1))
> -#define PARAM2 ((long)(&__op_param2))
> -#define PARAM3 ((long)(&__op_param3))
> -#endif /* !defined(__alpha__) */
> -
> -extern int __op_jmp0, __op_jmp1, __op_jmp2, __op_jmp3;
> -
> -#if defined(_WIN32) || defined(__APPLE__)
> -#define ASM_NAME(x) "_" #x
> -#else
> -#define ASM_NAME(x) #x
> -#endif
> -
> -#if defined(__i386__)
> -#define EXIT_TB() asm volatile ("ret")
> -#define GOTO_LABEL_PARAM(n) asm volatile ("jmp " ASM_NAME(__op_gen_label) #n)
> -#elif defined(__x86_64__)
> -#define EXIT_TB() asm volatile ("ret")
> -#define GOTO_LABEL_PARAM(n) asm volatile ("jmp " ASM_NAME(__op_gen_label) #n)
> -#elif defined(__powerpc__)
> -#define EXIT_TB() asm volatile ("blr")
> -#define GOTO_LABEL_PARAM(n) asm volatile ("b " ASM_NAME(__op_gen_label) #n)
> -#elif defined(__s390__)
> -#define EXIT_TB() asm volatile ("br %r14")
> -#define GOTO_LABEL_PARAM(n) asm volatile ("larl %r7,12; l %r7,0(%r7); br %r7; .long " ASM_NAME(__op_gen_label) #n)
> -#elif defined(__alpha__)
> -#define EXIT_TB() asm volatile ("ret")
> -#elif defined(__ia64__)
> -#define EXIT_TB() asm volatile ("br.ret.sptk.many b0;;")
> -#define GOTO_LABEL_PARAM(n) asm volatile ("br.sptk.many " \
> - ASM_NAME(__op_gen_label) #n)
> -#elif defined(__sparc__)
> -#define EXIT_TB() asm volatile ("jmpl %i0 + 8, %g0; nop")
> -#define GOTO_LABEL_PARAM(n) asm volatile ("ba " ASM_NAME(__op_gen_label) #n ";nop")
> -#elif defined(__arm__)
> -#define EXIT_TB() asm volatile ("b exec_loop")
> -#define GOTO_LABEL_PARAM(n) asm volatile ("b " ASM_NAME(__op_gen_label) #n)
> -#elif defined(__mc68000)
> -#define EXIT_TB() asm volatile ("rts")
> -#elif defined(__mips__)
> -#define EXIT_TB() asm volatile ("jr $ra")
> -#define GOTO_LABEL_PARAM(n) asm volatile (".set noat; la $1, " ASM_NAME(__op_gen_label) #n "; jr $1; .set at")
> -#elif defined(__hppa__)
> -#define GOTO_LABEL_PARAM(n) asm volatile ("b,n " ASM_NAME(__op_gen_label) #n)
> -#else
> -#error unsupported CPU
> -#endif
> -
> /* The return address may point to the start of the next instruction.
> Subtracting one gets us the call instruction itself. */
> #if defined(__s390__)
> Index: Makefile.target
> ===================================================================
> --- Makefile.target (revision 5915)
> +++ Makefile.target (working copy)
> @@ -186,7 +186,7 @@
> LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\
> translate.o host-utils.o
> # TCG code generator
> -LIBOBJS+= tcg/tcg.o tcg/tcg-dyngen.o tcg/tcg-runtime.o
> +LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o
> CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
> ifeq ($(ARCH),sparc64)
> CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
> Index: tcg/tcg-op.h
> ===================================================================
> --- tcg/tcg-op.h (revision 5915)
> +++ tcg/tcg-op.h (working copy)
> @@ -23,11 +23,6 @@
> */
> #include "tcg.h"
>
> -#ifdef CONFIG_DYNGEN_OP
> -/* legacy dyngen operations */
> -#include "gen-op.h"
> -#endif
> -
> int gen_new_label(void);
>
> static inline void tcg_gen_op1_i32(int opc, TCGv_i32 arg1)
> Index: tcg/tcg-opc.h
> ===================================================================
> --- tcg/tcg-opc.h (revision 5915)
> +++ tcg/tcg-opc.h (working copy)
> @@ -21,10 +21,6 @@
> * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> * THE SOFTWARE.
> */
> -#ifdef CONFIG_DYNGEN_OP
> -#include "dyngen-opc.h"
> -#endif
> -
> #ifndef DEF2
> #define DEF2(name, oargs, iargs, cargs, flags) DEF(name, oargs + iargs + cargs, 0)
> #endif
> Index: tcg/tcg.c
> ===================================================================
> --- tcg/tcg.c (revision 5915)
> +++ tcg/tcg.c (working copy)
> @@ -1198,57 +1198,50 @@
> break;
> /* XXX: optimize by hardcoding common cases (e.g. triadic ops) */
> default:
> - if (op > INDEX_op_end) {
> - args -= def->nb_args;
> - nb_iargs = def->nb_iargs;
> - nb_oargs = def->nb_oargs;
> + args -= def->nb_args;
> + nb_iargs = def->nb_iargs;
> + nb_oargs = def->nb_oargs;
>
> - /* Test if the operation can be removed because all
> - its outputs are dead. We assume that nb_oargs == 0
> - implies side effects */
> - if (!(def->flags & TCG_OPF_SIDE_EFFECTS) && nb_oargs != 0) {
> - for(i = 0; i < nb_oargs; i++) {
> - arg = args[i];
> - if (!dead_temps[arg])
> - goto do_not_remove;
> - }
> - tcg_set_nop(s, gen_opc_buf + op_index, args, def->nb_args);
> + /* Test if the operation can be removed because all
> + its outputs are dead. We assume that nb_oargs == 0
> + implies side effects */
> + if (!(def->flags & TCG_OPF_SIDE_EFFECTS) && nb_oargs != 0) {
> + for(i = 0; i < nb_oargs; i++) {
> + arg = args[i];
> + if (!dead_temps[arg])
> + goto do_not_remove;
> + }
> + tcg_set_nop(s, gen_opc_buf + op_index, args, def->nb_args);
> #ifdef CONFIG_PROFILER
> - s->del_op_count++;
> + s->del_op_count++;
> #endif
> - } else {
> - do_not_remove:
> + } else {
> + do_not_remove:
>
> - /* output args are dead */
> - for(i = 0; i < nb_oargs; i++) {
> - arg = args[i];
> - dead_temps[arg] = 1;
> + /* output args are dead */
> + for(i = 0; i < nb_oargs; i++) {
> + arg = args[i];
> + dead_temps[arg] = 1;
> + }
> +
> + /* if end of basic block, update */
> + if (def->flags & TCG_OPF_BB_END) {
> + tcg_la_bb_end(s, dead_temps);
> + } else if (def->flags & TCG_OPF_CALL_CLOBBER) {
> + /* globals are live */
> + memset(dead_temps, 0, s->nb_globals);
> + }
> +
> + /* input args are live */
> + dead_iargs = 0;
> + for(i = 0; i < nb_iargs; i++) {
> + arg = args[i + nb_oargs];
> + if (dead_temps[arg]) {
> + dead_iargs |= (1 << i);
> }
> -
> - /* if end of basic block, update */
> - if (def->flags & TCG_OPF_BB_END) {
> - tcg_la_bb_end(s, dead_temps);
> - } else if (def->flags & TCG_OPF_CALL_CLOBBER) {
> - /* globals are live */
> - memset(dead_temps, 0, s->nb_globals);
> - }
> -
> - /* input args are live */
> - dead_iargs = 0;
> - for(i = 0; i < nb_iargs; i++) {
> - arg = args[i + nb_oargs];
> - if (dead_temps[arg]) {
> - dead_iargs |= (1 << i);
> - }
> - dead_temps[arg] = 0;
> - }
> - s->op_dead_iargs[op_index] = dead_iargs;
> + dead_temps[arg] = 0;
> }
> - } else {
> - /* legacy dyngen operations */
> - args -= def->nb_args;
> - /* mark end of basic block */
> - tcg_la_bb_end(s, dead_temps);
> + s->op_dead_iargs[op_index] = dead_iargs;
> }
> break;
> }
> @@ -2016,21 +2009,6 @@
> case INDEX_op_end:
> goto the_end;
>
> -#ifdef CONFIG_DYNGEN_OP
> - case 0 ... INDEX_op_end - 1:
> - /* legacy dyngen ops */
> -#ifdef CONFIG_PROFILER
> - s->old_op_count++;
> -#endif
> - tcg_reg_alloc_bb_end(s, s->reserved_regs);
> - if (search_pc >= 0) {
> - s->code_ptr += def->copy_size;
> - args += def->nb_args;
> - } else {
> - args = dyngen_op(s, opc, args);
> - }
> - goto next;
> -#endif
> default:
> /* Note: in order to speed up the code, it would be much
> faster to have specialized register allocator functions for
> Index: tcg/tcg.h
> ===================================================================
> --- tcg/tcg.h (revision 5915)
> +++ tcg/tcg.h (working copy)
> @@ -449,8 +449,6 @@
> const TCGArg *tcg_gen_code_op(TCGContext *s, int opc, const TCGArg *args1,
> unsigned int dead_iargs);
>
> -const TCGArg *dyngen_op(TCGContext *s, int opc, const TCGArg *opparam_ptr);
> -
> /* tcg-runtime.c */
> int64_t tcg_helper_shl_i64(int64_t arg1, int64_t arg2);
> int64_t tcg_helper_shr_i64(int64_t arg1, int64_t arg2);
> Index: exec-all.h
> ===================================================================
> --- exec-all.h (revision 5915)
> +++ exec-all.h (working copy)
> @@ -267,20 +267,6 @@
>
> TranslationBlock *tb_find_pc(unsigned long pc_ptr);
>
> -#if defined(_WIN32)
> -#define ASM_DATA_SECTION ".section \".data\"\n"
> -#define ASM_PREVIOUS_SECTION ".section .text\n"
> -#elif defined(__APPLE__)
> -#define ASM_DATA_SECTION ".data\n"
> -#define ASM_PREVIOUS_SECTION ".text\n"
> -#else
> -#define ASM_DATA_SECTION ".section \".data\"\n"
> -#define ASM_PREVIOUS_SECTION ".previous\n"
> -#endif
> -
> -#define ASM_OP_LABEL_NAME(n, opname) \
> - ASM_NAME(__op_label) #n "." ASM_NAME(opname)
> -
> extern CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4];
> extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4];
> extern void *io_mem_opaque[IO_MEM_NB_ENTRIES];
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] Some cleanups after dyngen removal
2008-12-07 18:17 ` Aurelien Jarno
@ 2008-12-07 19:10 ` Laurent Desnogues
2008-12-07 19:17 ` Laurent Desnogues
0 siblings, 1 reply; 5+ messages in thread
From: Laurent Desnogues @ 2008-12-07 19:10 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 785 bytes --]
On Sun, Dec 7, 2008 at 7:17 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
>
> Yes, it is a good start. A grep -r dyngen still gives some results, but
> far less. This code can be removed in another commit.
It remains to rename dyngen-exec.h, some variables and
functions, and change some comments.
Here are some further cleanups.
1. hostregs_helper.h: fix comment
2. translate-all.c: rename dyngen_code(_search_pc) to
tcg_gen_code(_search_pc)
3. tcg.c:
- rename dyngen_table_op_count to tcg_table_op_count
- no need to generate a log of dyngen ops generated
- rename dyngen_code(_search_pc) to tcg_gen_code(_search_pc)
4. tcg.h: rename dyngen_code(_search_pc) to
tcg_gen_code(_search_pc)
Laurent
Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tcg-no-dyngen2.patch --]
[-- Type: text/x-patch; name=tcg-no-dyngen2.patch, Size: 4030 bytes --]
Index: hostregs_helper.h
===================================================================
--- hostregs_helper.h (revision 5923)
+++ hostregs_helper.h (working copy)
@@ -18,9 +18,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* The GCC global register vairable extension is used to reserve some
- host registers for use by dyngen. However only the core parts of the
- translation engine are compiled with these settings. We must manually
+/* The GCC global register variable extension is used to reserve some
+ host registers for use by generated code. However only the core parts of
+ the translation engine are compiled with these settings. We must manually
save/restore these registers when called from regular code.
It is not sufficient to save/restore T0 et. al. as these may be declared
with a datatype smaller than the actual register. */
Index: translate-all.c
===================================================================
--- translate-all.c (revision 5923)
+++ translate-all.c (working copy)
@@ -118,7 +118,7 @@
s->interm_time += profile_getclock() - ti;
s->code_time -= profile_getclock();
#endif
- gen_code_size = dyngen_code(s, gen_code_buf);
+ gen_code_size = tcg_gen_code(s, gen_code_buf);
*gen_code_size_ptr = gen_code_size;
#ifdef CONFIG_PROFILER
s->code_time += profile_getclock();
@@ -177,7 +177,7 @@
s->tb_jmp_offset = NULL;
s->tb_next = tb->tb_next;
#endif
- j = dyngen_code_search_pc(s, (uint8_t *)tc_ptr, searched_pc - tc_ptr);
+ j = tcg_gen_code_search_pc(s, (uint8_t *)tc_ptr, searched_pc - tc_ptr);
if (j < 0)
return -1;
/* now find start of instruction before */
Index: tcg/tcg.c
===================================================================
--- tcg/tcg.c (revision 5923)
+++ tcg/tcg.c (working copy)
@@ -1890,20 +1890,16 @@
#ifdef CONFIG_PROFILER
-static int64_t dyngen_table_op_count[NB_OPS];
+static int64_t tcg_table_op_count[NB_OPS];
void dump_op_count(void)
{
int i;
FILE *f;
- f = fopen("/tmp/op1.log", "w");
- for(i = 0; i < INDEX_op_end; i++) {
- fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name, dyngen_table_op_count[i]);
- }
fclose(f);
- f = fopen("/tmp/op2.log", "w");
+ f = fopen("/tmp/op.log", "w");
for(i = INDEX_op_end; i < NB_OPS; i++) {
- fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name, dyngen_table_op_count[i]);
+ fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name, tcg_table_op_count[i]);
}
fclose(f);
}
@@ -1953,7 +1949,7 @@
for(;;) {
opc = gen_opc_buf[op_index];
#ifdef CONFIG_PROFILER
- dyngen_table_op_count[opc]++;
+ tcg_table_op_count[opc]++;
#endif
def = &tcg_op_defs[opc];
#if 0
@@ -2030,7 +2026,7 @@
return -1;
}
-int dyngen_code(TCGContext *s, uint8_t *gen_code_buf)
+int tcg_gen_code(TCGContext *s, uint8_t *gen_code_buf)
{
#ifdef CONFIG_PROFILER
{
@@ -2058,7 +2054,7 @@
offset bytes from the start of the TB. The contents of gen_code_buf must
not be changed, though writing the same values is ok.
Return -1 if not found. */
-int dyngen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset)
+int tcg_gen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset)
{
return tcg_gen_code_common(s, gen_code_buf, offset);
}
Index: tcg/tcg.h
===================================================================
--- tcg/tcg.h (revision 5923)
+++ tcg/tcg.h (working copy)
@@ -314,8 +314,8 @@
void tcg_context_init(TCGContext *s);
void tcg_func_start(TCGContext *s);
-int dyngen_code(TCGContext *s, uint8_t *gen_code_buf);
-int dyngen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset);
+int tcg_gen_code(TCGContext *s, uint8_t *gen_code_buf);
+int tcg_gen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset);
void tcg_set_frame(TCGContext *s, int reg,
tcg_target_long start, tcg_target_long size);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] Some cleanups after dyngen removal
2008-12-07 19:10 ` Laurent Desnogues
@ 2008-12-07 19:17 ` Laurent Desnogues
2008-12-07 20:36 ` Aurelien Jarno
0 siblings, 1 reply; 5+ messages in thread
From: Laurent Desnogues @ 2008-12-07 19:17 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 644 bytes --]
On Sun, Dec 7, 2008 at 8:10 PM, Laurent Desnogues
<laurent.desnogues@gmail.com> wrote:
>
> Here are some further cleanups.
>
> 1. hostregs_helper.h: fix comment
> 2. translate-all.c: rename dyngen_code(_search_pc) to
> tcg_gen_code(_search_pc)
> 3. tcg.c:
> - rename dyngen_table_op_count to tcg_table_op_count
> - no need to generate a log of dyngen ops generated
> - rename dyngen_code(_search_pc) to tcg_gen_code(_search_pc)
> 4. tcg.h: rename dyngen_code(_search_pc) to
> tcg_gen_code(_search_pc)
Sorry, the previous patch contained an obvious mistake.
Laurent
Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tcg-no-dyngen3.patch --]
[-- Type: text/x-patch; name=tcg-no-dyngen3.patch, Size: 4030 bytes --]
Index: hostregs_helper.h
===================================================================
--- hostregs_helper.h (revision 5931)
+++ hostregs_helper.h (working copy)
@@ -18,9 +18,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* The GCC global register vairable extension is used to reserve some
- host registers for use by dyngen. However only the core parts of the
- translation engine are compiled with these settings. We must manually
+/* The GCC global register variable extension is used to reserve some
+ host registers for use by generated code. However only the core parts of
+ the translation engine are compiled with these settings. We must manually
save/restore these registers when called from regular code.
It is not sufficient to save/restore T0 et. al. as these may be declared
with a datatype smaller than the actual register. */
Index: translate-all.c
===================================================================
--- translate-all.c (revision 5931)
+++ translate-all.c (working copy)
@@ -118,7 +118,7 @@
s->interm_time += profile_getclock() - ti;
s->code_time -= profile_getclock();
#endif
- gen_code_size = dyngen_code(s, gen_code_buf);
+ gen_code_size = tcg_gen_code(s, gen_code_buf);
*gen_code_size_ptr = gen_code_size;
#ifdef CONFIG_PROFILER
s->code_time += profile_getclock();
@@ -177,7 +177,7 @@
s->tb_jmp_offset = NULL;
s->tb_next = tb->tb_next;
#endif
- j = dyngen_code_search_pc(s, (uint8_t *)tc_ptr, searched_pc - tc_ptr);
+ j = tcg_gen_code_search_pc(s, (uint8_t *)tc_ptr, searched_pc - tc_ptr);
if (j < 0)
return -1;
/* now find start of instruction before */
Index: tcg/tcg.c
===================================================================
--- tcg/tcg.c (revision 5931)
+++ tcg/tcg.c (working copy)
@@ -1890,20 +1890,15 @@
#ifdef CONFIG_PROFILER
-static int64_t dyngen_table_op_count[NB_OPS];
+static int64_t tcg_table_op_count[NB_OPS];
void dump_op_count(void)
{
int i;
FILE *f;
- f = fopen("/tmp/op1.log", "w");
- for(i = 0; i < INDEX_op_end; i++) {
- fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name, dyngen_table_op_count[i]);
- }
- fclose(f);
- f = fopen("/tmp/op2.log", "w");
+ f = fopen("/tmp/op.log", "w");
for(i = INDEX_op_end; i < NB_OPS; i++) {
- fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name, dyngen_table_op_count[i]);
+ fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name, tcg_table_op_count[i]);
}
fclose(f);
}
@@ -1953,7 +1948,7 @@
for(;;) {
opc = gen_opc_buf[op_index];
#ifdef CONFIG_PROFILER
- dyngen_table_op_count[opc]++;
+ tcg_table_op_count[opc]++;
#endif
def = &tcg_op_defs[opc];
#if 0
@@ -2030,7 +2025,7 @@
return -1;
}
-int dyngen_code(TCGContext *s, uint8_t *gen_code_buf)
+int tcg_gen_code(TCGContext *s, uint8_t *gen_code_buf)
{
#ifdef CONFIG_PROFILER
{
@@ -2058,7 +2053,7 @@
offset bytes from the start of the TB. The contents of gen_code_buf must
not be changed, though writing the same values is ok.
Return -1 if not found. */
-int dyngen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset)
+int tcg_gen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset)
{
return tcg_gen_code_common(s, gen_code_buf, offset);
}
Index: tcg/tcg.h
===================================================================
--- tcg/tcg.h (revision 5931)
+++ tcg/tcg.h (working copy)
@@ -314,8 +314,8 @@
void tcg_context_init(TCGContext *s);
void tcg_func_start(TCGContext *s);
-int dyngen_code(TCGContext *s, uint8_t *gen_code_buf);
-int dyngen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset);
+int tcg_gen_code(TCGContext *s, uint8_t *gen_code_buf);
+int tcg_gen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset);
void tcg_set_frame(TCGContext *s, int reg,
tcg_target_long start, tcg_target_long size);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] Some cleanups after dyngen removal
2008-12-07 19:17 ` Laurent Desnogues
@ 2008-12-07 20:36 ` Aurelien Jarno
0 siblings, 0 replies; 5+ messages in thread
From: Aurelien Jarno @ 2008-12-07 20:36 UTC (permalink / raw)
To: qemu-devel
On Sun, Dec 07, 2008 at 08:17:46PM +0100, Laurent Desnogues wrote:
> On Sun, Dec 7, 2008 at 8:10 PM, Laurent Desnogues
> <laurent.desnogues@gmail.com> wrote:
> >
> > Here are some further cleanups.
> >
> > 1. hostregs_helper.h: fix comment
> > 2. translate-all.c: rename dyngen_code(_search_pc) to
> > tcg_gen_code(_search_pc)
> > 3. tcg.c:
> > - rename dyngen_table_op_count to tcg_table_op_count
> > - no need to generate a log of dyngen ops generated
> > - rename dyngen_code(_search_pc) to tcg_gen_code(_search_pc)
> > 4. tcg.h: rename dyngen_code(_search_pc) to
> > tcg_gen_code(_search_pc)
>
> Sorry, the previous patch contained an obvious mistake.
>
Thanks, applied.
> Laurent
>
> Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>
> Index: hostregs_helper.h
> ===================================================================
> --- hostregs_helper.h (revision 5931)
> +++ hostregs_helper.h (working copy)
> @@ -18,9 +18,9 @@
> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> */
>
> -/* The GCC global register vairable extension is used to reserve some
> - host registers for use by dyngen. However only the core parts of the
> - translation engine are compiled with these settings. We must manually
> +/* The GCC global register variable extension is used to reserve some
> + host registers for use by generated code. However only the core parts of
> + the translation engine are compiled with these settings. We must manually
> save/restore these registers when called from regular code.
> It is not sufficient to save/restore T0 et. al. as these may be declared
> with a datatype smaller than the actual register. */
> Index: translate-all.c
> ===================================================================
> --- translate-all.c (revision 5931)
> +++ translate-all.c (working copy)
> @@ -118,7 +118,7 @@
> s->interm_time += profile_getclock() - ti;
> s->code_time -= profile_getclock();
> #endif
> - gen_code_size = dyngen_code(s, gen_code_buf);
> + gen_code_size = tcg_gen_code(s, gen_code_buf);
> *gen_code_size_ptr = gen_code_size;
> #ifdef CONFIG_PROFILER
> s->code_time += profile_getclock();
> @@ -177,7 +177,7 @@
> s->tb_jmp_offset = NULL;
> s->tb_next = tb->tb_next;
> #endif
> - j = dyngen_code_search_pc(s, (uint8_t *)tc_ptr, searched_pc - tc_ptr);
> + j = tcg_gen_code_search_pc(s, (uint8_t *)tc_ptr, searched_pc - tc_ptr);
> if (j < 0)
> return -1;
> /* now find start of instruction before */
> Index: tcg/tcg.c
> ===================================================================
> --- tcg/tcg.c (revision 5931)
> +++ tcg/tcg.c (working copy)
> @@ -1890,20 +1890,15 @@
>
> #ifdef CONFIG_PROFILER
>
> -static int64_t dyngen_table_op_count[NB_OPS];
> +static int64_t tcg_table_op_count[NB_OPS];
>
> void dump_op_count(void)
> {
> int i;
> FILE *f;
> - f = fopen("/tmp/op1.log", "w");
> - for(i = 0; i < INDEX_op_end; i++) {
> - fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name, dyngen_table_op_count[i]);
> - }
> - fclose(f);
> - f = fopen("/tmp/op2.log", "w");
> + f = fopen("/tmp/op.log", "w");
> for(i = INDEX_op_end; i < NB_OPS; i++) {
> - fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name, dyngen_table_op_count[i]);
> + fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name, tcg_table_op_count[i]);
> }
> fclose(f);
> }
> @@ -1953,7 +1948,7 @@
> for(;;) {
> opc = gen_opc_buf[op_index];
> #ifdef CONFIG_PROFILER
> - dyngen_table_op_count[opc]++;
> + tcg_table_op_count[opc]++;
> #endif
> def = &tcg_op_defs[opc];
> #if 0
> @@ -2030,7 +2025,7 @@
> return -1;
> }
>
> -int dyngen_code(TCGContext *s, uint8_t *gen_code_buf)
> +int tcg_gen_code(TCGContext *s, uint8_t *gen_code_buf)
> {
> #ifdef CONFIG_PROFILER
> {
> @@ -2058,7 +2053,7 @@
> offset bytes from the start of the TB. The contents of gen_code_buf must
> not be changed, though writing the same values is ok.
> Return -1 if not found. */
> -int dyngen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset)
> +int tcg_gen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset)
> {
> return tcg_gen_code_common(s, gen_code_buf, offset);
> }
> Index: tcg/tcg.h
> ===================================================================
> --- tcg/tcg.h (revision 5931)
> +++ tcg/tcg.h (working copy)
> @@ -314,8 +314,8 @@
> void tcg_context_init(TCGContext *s);
> void tcg_func_start(TCGContext *s);
>
> -int dyngen_code(TCGContext *s, uint8_t *gen_code_buf);
> -int dyngen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset);
> +int tcg_gen_code(TCGContext *s, uint8_t *gen_code_buf);
> +int tcg_gen_code_search_pc(TCGContext *s, uint8_t *gen_code_buf, long offset);
>
> void tcg_set_frame(TCGContext *s, int reg,
> tcg_target_long start, tcg_target_long size);
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-12-07 20:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-07 17:12 [Qemu-devel] [PATCH] Some cleanups after dyngen removal Laurent Desnogues
2008-12-07 18:17 ` Aurelien Jarno
2008-12-07 19:10 ` Laurent Desnogues
2008-12-07 19:17 ` Laurent Desnogues
2008-12-07 20:36 ` Aurelien Jarno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).