]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
(stats only) Let the callers of LibVEX_Translate know how many guest
authorJulian Seward <jseward@acm.org>
Tue, 24 Apr 2012 11:49:03 +0000 (11:49 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 24 Apr 2012 11:49:03 +0000 (11:49 +0000)
instructions got incorporated into the IRSB.

git-svn-id: svn://svn.valgrind.org/vex/trunk@2313

VEX/priv/guest_generic_bb_to_IR.c
VEX/priv/guest_generic_bb_to_IR.h
VEX/priv/main_main.c
VEX/pub/libvex.h

index 6066fe0ae5a78bcae840c429a3328a3c0cdc6518..7e39619ee3841d5d0427a006d5d1d2b62f08e981 100644 (file)
@@ -180,6 +180,7 @@ static Bool const_False ( void* callback_opaque, Addr64 a ) {
 IRSB* bb_to_IR ( 
          /*OUT*/VexGuestExtents* vge,
          /*OUT*/UInt*            n_sc_extents,
+         /*OUT*/UInt*            n_guest_instrs, /* stats only */
          /*IN*/ void*            callback_opaque,
          /*IN*/ DisOneInstrFn    dis_instr_fn,
          /*IN*/ UChar*           guest_code,
@@ -245,6 +246,7 @@ IRSB* bb_to_IR (
       so far gone. */
    delta    = 0;
    n_instrs = 0;
+   *n_guest_instrs = 0;
 
    /* Guest addresses as IRConsts.  Used in self-checks to specify the
       restart-after-discard point. */
@@ -756,6 +758,7 @@ IRSB* bb_to_IR (
       vex_printf( "\n");
    }
 
+   *n_guest_instrs = n_instrs;
    return irsb;
 }
 
index 9c1e7409be8ba4157a0e415124a1b7a125baff5d..aba6f3c47672f096e647927e87a04c217e4a886b 100644 (file)
@@ -164,6 +164,7 @@ extern
 IRSB* bb_to_IR ( 
          /*OUT*/VexGuestExtents* vge,
          /*OUT*/UInt*            n_sc_extents,
+         /*OUT*/UInt*            n_guest_instrs, /* stats only */
          /*IN*/ void*            callback_opaque,
          /*IN*/ DisOneInstrFn    dis_instr_fn,
          /*IN*/ UChar*           guest_code,
index a8c396816c530a844750aded89343b834f78d2c8..c73c5d291af5451fa5324e5183126d00632d09f2 100644 (file)
@@ -528,9 +528,10 @@ VexTranslateResult LibVEX_Translate ( VexTranslateArgs* vta )
 
    /* Set up result struct. */
    VexTranslateResult res;
-   res.status       = VexTransOK;
-   res.n_sc_extents = 0;
-   res.offs_profInc = -1;
+   res.status         = VexTransOK;
+   res.n_sc_extents   = 0;
+   res.offs_profInc   = -1;
+   res.n_guest_instrs = 0;
 
    /* yet more sanity checks ... */
    if (vta->arch_guest == vta->arch_host) {
@@ -549,6 +550,7 @@ VexTranslateResult LibVEX_Translate ( VexTranslateArgs* vta )
 
    irsb = bb_to_IR ( vta->guest_extents,
                      &res.n_sc_extents,
+                     &res.n_guest_instrs,
                      vta->callback_opaque,
                      disInstrFn,
                      vta->guest_bytes, 
index bf6162eb55684946410c193f1d77b13701c5f856..ef50206cc84f44f13b7095a3e2f95c73134db805 100644 (file)
@@ -491,6 +491,9 @@ typedef
       /* Offset in generated code of the profile inc, or -1 if
          none.  Needed for later patching. */
       Int offs_profInc;
+      /* Stats only: the number of guest insns included in the
+         translation.  It may be zero (!). */
+      UInt n_guest_instrs;
    }
    VexTranslateResult;