From: Julian Seward Date: Mon, 5 Jul 2004 20:50:45 +0000 (+0000) Subject: - Pass host-specific insn and register printing functions to X-Git-Tag: svn/VALGRIND_3_0_1^2~1280 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7f9edc962fdf1cbb97d93364446dc248e57c7bc0;p=thirdparty%2Fvalgrind.git - Pass host-specific insn and register printing functions to the register allocator, so it can print debug info specific to the host. - Properly propagate some no-return attributes. git-svn-id: svn://svn.valgrind.org/vex/trunk@54 --- diff --git a/VEX/priv/host-generic/host_regs.h b/VEX/priv/host-generic/host_regs.h index 35fcda0fe9..c3c9735a65 100644 --- a/VEX/priv/host-generic/host_regs.h +++ b/VEX/priv/host-generic/host_regs.h @@ -195,7 +195,11 @@ HInstrArray* doRegisterAllocation ( /* Return an insn to spill/restore a real reg to a spill slot offset. */ HInstr* (*genSpill) ( HReg, Int ), - HInstr* (*genReload) ( HReg, Int ) + HInstr* (*genReload) ( HReg, Int ), + + /* For debug printing only. */ + void (*ppInstr) ( HInstr* ), + void (*ppReg) ( HReg ) ); diff --git a/VEX/priv/main/vex_globals.c b/VEX/priv/main/vex_globals.c index ff4141c490..0eac1ebfbc 100644 --- a/VEX/priv/main/vex_globals.c +++ b/VEX/priv/main/vex_globals.c @@ -18,6 +18,7 @@ Bool vex_initdone = False; /* failure exit function */ +__attribute__ ((noreturn)) void (*vex_failure_exit) ( void ) = NULL; /* logging output function */ diff --git a/VEX/priv/main/vex_globals.h b/VEX/priv/main/vex_globals.h index 2c40e3710b..3f77d97a71 100644 --- a/VEX/priv/main/vex_globals.h +++ b/VEX/priv/main/vex_globals.h @@ -19,6 +19,7 @@ extern Bool vex_initdone; /* failure exit function */ +__attribute__ ((noreturn)) extern void (*vex_failure_exit) ( void ); /* logging output function */ diff --git a/VEX/priv/main/vex_main.c b/VEX/priv/main/vex_main.c index c9f4b4bd88..9d64e81ba0 100644 --- a/VEX/priv/main/vex_main.c +++ b/VEX/priv/main/vex_main.c @@ -22,6 +22,7 @@ void LibVEX_Init ( /* failure exit function */ + __attribute__ ((noreturn)) void (*failure_exit) ( void ), /* logging output function */ void (*log_bytes) ( Char*, Int nbytes ), @@ -83,6 +84,8 @@ TranslateResult LibVEX_Translate ( void (*mapRegs) (HRegRemap*, HInstr*); HInstr* (*genSpill) ( HReg, Int ); HInstr* (*genReload) ( HReg, Int ); + void (*ppInstr) ( HInstr* ); + void (*ppReg) ( HReg ); HInstrArray* (*iselBB) ( IRBB* ); IRBB* (*bbToIR) ( Char*, Addr64, Int*, Bool(*)(Addr64) ); @@ -104,6 +107,8 @@ TranslateResult LibVEX_Translate ( mapRegs = (void(*)(HRegRemap*,HInstr*)) mapRegs_X86Instr; genSpill = (HInstr*(*)(HReg,Int)) genSpill_X86; genReload = (HInstr*(*)(HReg,Int)) genReload_X86; + ppInstr = (void(*)(HInstr*)) ppX86Instr; + ppReg = (void(*)(HReg)) ppHRegX86; iselBB = iselBB_X86; break; default: @@ -140,7 +145,8 @@ TranslateResult LibVEX_Translate ( rcode = doRegisterAllocation ( vcode, available_real_regs, n_available_real_regs, isMove, getRegUsage, mapRegs, - genSpill, genReload ); + genSpill, genReload, + ppInstr, ppReg ); /* Assemble, etc. */ LibVEX_Clear(True); diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h index 705f9224c0..c797f74ffb 100644 --- a/VEX/pub/libvex.h +++ b/VEX/pub/libvex.h @@ -23,6 +23,7 @@ extern void LibVEX_Init ( /* failure exit function */ + __attribute__ ((noreturn)) void (*failure_exit) ( void ), /* logging output function */ void (*log_bytes) ( Char*, Int nbytes ), diff --git a/VEX/test_main.c b/VEX/test_main.c index a68f126221..371594d633 100644 --- a/VEX/test_main.c +++ b/VEX/test_main.c @@ -18,6 +18,7 @@ #include "libvex_basictypes.h" #include "libvex.h" +__attribute__ ((noreturn)) void failure_exit ( void ) { fprintf(stdout, "VEX did failure_exit. Bye.\n");