]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Rationalise --vex-guest* flags in the new IRSB construction framework
authorJulian Seward <jseward@acm.org>
Mon, 18 Nov 2019 18:12:49 +0000 (19:12 +0100)
committerJulian Seward <jseward@acm.org>
Mon, 18 Nov 2019 18:12:49 +0000 (19:12 +0100)
* removes --vex-guest-chase-cond=no|yes.  This was never used in practice.

* rename --vex-guest-chase-thresh=<0..99> to --vex-guest-chase=no|yes.  In
  otherwords, downgrade it from a numeric flag to a boolean one, that can
  simply disable all chasing if required.  (Some tools, notably Callgrind,
  force-disable block chasing, so this functionality at least needs to be
  retained).

VEX/priv/guest_generic_bb_to_IR.c
VEX/pub/libvex.h
callgrind/main.c
coregrind/m_main.c
docs/xml/manual-core-adv.xml
exp-bbv/bbv_main.c
exp-sgcheck/pc_main.c
helgrind/hg_main.c
none/tests/cmdline2.stdout.exp

index 3da99bc25b48dd6cdfe9c3940ca440cb09ad8c34..16d83a8846d3f54d3a3f8ba0a7f1fe99a8f28716 100644 (file)
@@ -1237,8 +1237,7 @@ IRSB* bb_to_IR (
    vassert(sizeof(HWord) == sizeof(void*));
    vassert(vex_control.guest_max_insns >= 1);
    vassert(vex_control.guest_max_insns <= 100);
-   vassert(vex_control.guest_chase_thresh >= 0);
-   vassert(vex_control.guest_chase_thresh < vex_control.guest_max_insns);
+   vassert(vex_control.guest_chase == False || vex_control.guest_chase == True);
    vassert(guest_word_type == Ity_I32 || guest_word_type == Ity_I64);
 
    if (guest_word_type == Ity_I32) {
@@ -1324,7 +1323,7 @@ IRSB* bb_to_IR (
 
       // Reasons to give up immediately:
       // User or tool asked us not to chase
-      if (vex_control.guest_chase_thresh == 0)
+      if (!vex_control.guest_chase)
          break;
 
       // Out of extent slots
index 5a76066d76e2f3891e5b09b3ffc8060b48a02b76..5a6a0e8057e54bc8ba716b2c836cf2e7c479cd32 100644 (file)
@@ -512,17 +512,12 @@ typedef
          BBs longer than this are split up.  Default=60 (guest
          insns). */
       Int guest_max_insns;
-      /* How aggressive should front ends be in following
-         unconditional branches to known destinations?  Default=10,
-         meaning that if a block contains less than 10 guest insns so
-         far, the front end(s) will attempt to chase into its
-         successor. A setting of zero disables chasing.  */
-      // FIXME change this to a Bool
-      Int guest_chase_thresh;
-      /* EXPERIMENTAL: chase across conditional branches?  Not all
-         front ends honour this.  Default: NO. */
-      // FIXME remove this completely.
-      Bool guest_chase_cond;
+      /* Should Vex try to construct superblocks, by chasing unconditional
+         branches/calls to known destinations, and performing AND/OR idiom
+         recognition?  It is recommended to set this to True as that possibly
+         improves performance a bit, and also is important for avoiding certain
+         kinds of false positives in Memcheck.  Default=True.  */
+      Bool guest_chase;
       /* Register allocator version. Allowed values are:
          - '2': previous, good and slow implementation.
          - '3': current, faster implementation; perhaps producing slightly worse
index 47369d1305dba8ee52ea2dc73532b34bf02fe4bd..904eb42a99fddf1b854cc9137d48a4f7c958630c 100644 (file)
@@ -2062,11 +2062,11 @@ void CLG_(post_clo_init)(void)
                    "=> resetting it back to 0\n");
       VG_(clo_vex_control).iropt_unroll_thresh = 0;   // cannot be overridden.
    }
-   if (VG_(clo_vex_control).guest_chase_thresh != 0) {
+   if (VG_(clo_vex_control).guest_chase) {
       VG_(message)(Vg_UserMsg,
-                   "callgrind only works with --vex-guest-chase-thresh=0\n"
-                   "=> resetting it back to 0\n");
-      VG_(clo_vex_control).guest_chase_thresh = 0; // cannot be overridden.
+                   "callgrind only works with --vex-guest-chase=no\n"
+                   "=> resetting it back to 'no'\n");
+      VG_(clo_vex_control).guest_chase = False; // cannot be overridden.
    }
    
    CLG_DEBUG(1, "  dump threads: %s\n", CLG_(clo).separate_threads ? "Yes":"No");
@@ -2120,7 +2120,7 @@ void CLG_(pre_clo_init)(void)
        = VexRegUpdSpAtMemAccess; // overridable by the user.
 
     VG_(clo_vex_control).iropt_unroll_thresh = 0;   // cannot be overridden.
-    VG_(clo_vex_control).guest_chase_thresh = 0;    // cannot be overridden.
+    VG_(clo_vex_control).guest_chase = False;       // cannot be overridden.
 
     VG_(basic_tool_funcs)        (CLG_(post_clo_init),
                                   CLG_(instrument),
index 6ad1b93d1ccd15cf19084e36fd5a06bd7875894c..38f7d9769e60cfd4bc0274feea6fad56cbe7db82 100644 (file)
@@ -271,8 +271,7 @@ static void usage_NORETURN ( int need_help )
 "    --vex-iropt-level=<0..2>               [2]\n"
 "    --vex-iropt-unroll-thresh=<0..400>     [120]\n"
 "    --vex-guest-max-insns=<1..100>         [50]\n"
-"    --vex-guest-chase-thresh=<0..99>       [10]\n"
-"    --vex-guest-chase-cond=no|yes          [no]\n"
+"    --vex-guest-chase=no|yes               [yes]\n"
 "    Precise exception control.  Possible values for 'mode' are as follows\n"
 "      and specify the minimum set of registers guaranteed to be correct\n"
 "      immediately prior to memory access instructions:\n"
@@ -714,10 +713,8 @@ static void process_option (Clo_Mode mode,
                        VG_(clo_vex_control).iropt_unroll_thresh, 0, 400) {}
    else if VG_BINT_CLO(arg, "--vex-guest-max-insns",
                        VG_(clo_vex_control).guest_max_insns, 1, 100) {}
-   else if VG_BINT_CLO(arg, "--vex-guest-chase-thresh",
-                       VG_(clo_vex_control).guest_chase_thresh, 0, 99) {}
-   else if VG_BOOL_CLO(arg, "--vex-guest-chase-cond",
-                       VG_(clo_vex_control).guest_chase_cond) {}
+   else if VG_BOOL_CLO(arg, "--vex-guest-chase",
+                       VG_(clo_vex_control).guest_chase) {}
 
    else if VG_INT_CLO(arg, "--log-fd", pos->tmp_log_fd) {
       pos->log_to = VgLogTo_Fd;
@@ -965,16 +962,6 @@ void main_process_cmd_line_options( void )
    if (VG_(clo_vgdb_prefix) == NULL)
      VG_(clo_vgdb_prefix) = VG_(vgdb_prefix_default)();
 
-   /* Make VEX control parameters sane */
-
-   if (VG_(clo_vex_control).guest_chase_thresh
-       >= VG_(clo_vex_control).guest_max_insns)
-      VG_(clo_vex_control).guest_chase_thresh
-         = VG_(clo_vex_control).guest_max_insns - 1;
-
-   if (VG_(clo_vex_control).guest_chase_thresh < 0)
-      VG_(clo_vex_control).guest_chase_thresh = 0;
    /* Check various option values */
 
    if (VG_(clo_verbosity) < 0)
index 11afbeb9312e84b39aca542a6f5be8477baf4714..362b916db933724cd701c1c0ee3ca03aa7818444 100644 (file)
@@ -1563,8 +1563,7 @@ $3 = {lwpid = 0x4688, threadgroup = 0x4688, parent = 0x0,
 (gdb) p vex_control
 $5 = {iropt_verbosity = 0, iropt_level = 2, 
   iropt_register_updates = VexRegUpdUnwindregsAtMemAccess, 
-  iropt_unroll_thresh = 120, guest_max_insns = 60, guest_chase_thresh = 10, 
-  guest_chase_cond = 0 '\000'}
+  iropt_unroll_thresh = 120, guest_max_insns = 60, guest_chase_thresh = 10}
 (gdb) 
 ]]></screen>
   </listitem>
index 438edbfb0167f6f39b7defd6d611a89c101dc757..e632ea11f7822db7dbffd5541b0a6b70b7ff21c9 100644 (file)
@@ -514,8 +514,8 @@ static void bbv_post_clo_init(void)
 
       /* Try a closer approximation of basic blocks  */
       /* This is the same as the command line option */
-      /* --vex-guest-chase-thresh=0                  */
-   VG_(clo_vex_control).guest_chase_thresh = 0;
+      /* --vex-guest-chase=no                        */
+   VG_(clo_vex_control).guest_chase = False;
 }
 
    /* Parse the command line options */
index 93f4b1e409ba774b9352a3655c86212c2e3dd5af..fc13d6afa30aa2a5140986ccf858c371d09d3eb0 100644 (file)
@@ -147,7 +147,7 @@ static void pc_pre_clo_init(void)
    sg_pre_clo_init();
 
    VG_(clo_vex_control).iropt_unroll_thresh = 0;
-   VG_(clo_vex_control).guest_chase_thresh = 0;
+   VG_(clo_vex_control).guest_chase = False;
 }
 
 VG_DETERMINE_INTERFACE_VERSION(pc_pre_clo_init)
index ddf582f84ba0723b7e5a943585d5104077c93abd..8b8dd054987d2227a71ea7f86efdb19ae4c5015b 100644 (file)
@@ -5954,14 +5954,13 @@ static void hg_post_clo_init ( void )
 {
    Thr* hbthr_root;
 
-   if (HG_(clo_delta_stacktrace)
-       && VG_(clo_vex_control).guest_chase_thresh != 0) {
+   if (HG_(clo_delta_stacktrace) && VG_(clo_vex_control).guest_chase) {
       if (VG_(clo_verbosity) >= 2)
          VG_(message)(Vg_UserMsg,
                       "helgrind --delta-stacktrace=yes only works with "
-                      "--vex-guest-chase-thresh=0\n"
-                      "=> (re-setting it to 0)\n");
-      VG_(clo_vex_control).guest_chase_thresh = 0;
+                      "--vex-guest-chase=no\n"
+                      "=> (re-setting it to 'no')\n");
+      VG_(clo_vex_control).guest_chase = False;
    }
 
 
index cfa30605251f40a32080ffae8c51e1fb7cb1fafc..9e8e3df01f0f84c69e05d44a02d7ffcfb2d71288 100644 (file)
@@ -184,8 +184,7 @@ usage: valgrind [options] prog-and-args
     --vex-iropt-level=<0..2>               [2]
     --vex-iropt-unroll-thresh=<0..400>     [120]
     --vex-guest-max-insns=<1..100>         [50]
-    --vex-guest-chase-thresh=<0..99>       [10]
-    --vex-guest-chase-cond=no|yes          [no]
+    --vex-guest-chase=no|yes               [yes]
     Precise exception control.  Possible values for 'mode' are as follows
       and specify the minimum set of registers guaranteed to be correct
       immediately prior to memory access instructions: