- 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 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/host-generic/host_regs.h b/priv/host-generic/host_regs.h
index 35fcda0..c3c9735 100644
--- a/priv/host-generic/host_regs.h
+++ b/priv/host-generic/host_regs.h
@@ -195,7 +195,11 @@
/* 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/priv/main/vex_globals.c b/priv/main/vex_globals.c
index ff4141c..0eac1eb 100644
--- a/priv/main/vex_globals.c
+++ b/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/priv/main/vex_globals.h b/priv/main/vex_globals.h
index 2c40e37..3f77d97 100644
--- a/priv/main/vex_globals.h
+++ b/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/priv/main/vex_main.c b/priv/main/vex_main.c
index c9f4b4b..9d64e81 100644
--- a/priv/main/vex_main.c
+++ b/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 @@
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 @@
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 @@
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/pub/libvex.h b/pub/libvex.h
index 705f922..c797f74 100644
--- a/pub/libvex.h
+++ b/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/test_main.c b/test_main.c
index a68f126..371594d 100644
--- a/test_main.c
+++ b/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");