Add mechanisms for calling helper functions from generated code.



git-svn-id: svn://svn.valgrind.org/vex/trunk@112 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/main/vex_main.c b/priv/main/vex_main.c
index 3e92d91..656e768 100644
--- a/priv/main/vex_main.c
+++ b/priv/main/vex_main.c
@@ -91,10 +91,11 @@
    HInstr*      (*genReload)   ( HReg, Int );
    void         (*ppInstr)     ( HInstr* );
    void         (*ppReg)       ( HReg );
-   HInstrArray* (*iselBB)      ( IRBB* );
+   HInstrArray* (*iselBB)      ( IRBB*, Addr64(*)(Char*) );
    IRBB*        (*bbToIR)      ( UChar*, Addr64, Int*, 
                                          Bool(*)(Addr64), Bool );
    Int          (*emit)        ( UChar*, Int, HInstr* );
+   Addr64       (*findHelper)  ( Char* );
 
    Bool         host_is_bigendian = False;
    IRBB*        irbb;
@@ -103,6 +104,20 @@
    Int          i, j, k, out_used;
    UChar        insn_bytes[32];
 
+   available_real_regs    = NULL;
+   n_available_real_regs  = 0;
+   isMove                 = NULL;
+   getRegUsage            = NULL;
+   mapRegs                = NULL;
+   genSpill               = NULL;
+   genReload              = NULL;
+   ppInstr                = NULL;
+   ppReg                  = NULL;
+   iselBB                 = NULL;
+   bbToIR                 = NULL;
+   emit                   = NULL;
+   findHelper             = NULL;
+
    vassert(vex_initdone);
    LibVEX_ClearTemporary(False);
 
@@ -129,7 +144,8 @@
 
    switch (iset_guest) {
       case InsnSetX86:
-         bbToIR = bbToIR_X86Instr;
+         bbToIR     = bbToIR_X86Instr;
+         findHelper = x86guest_findhelper;
          break;
       default:
          vpanic("LibVEX_Translate: unsupported guest insn set");
@@ -153,7 +169,7 @@
       irbb = (*instrument)(irbb);
 
    /* Turn it into virtual-registerised code. */
-   vcode = iselBB ( irbb );
+   vcode = iselBB ( irbb, findHelper );
 
    if (vex_verbosity > 0) {
       vex_printf("\n-------- Virtual registerised code --------\n");