]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
vg_improve() -- the ucode optimiser: consistently apply the
authorJulian Seward <jseward@acm.org>
Tue, 30 Apr 2002 00:29:36 +0000 (00:29 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 30 Apr 2002 00:29:36 +0000 (00:29 +0000)
no-deferred-updates of %ESP rule, regardless of end use of the ucode.
This seems more consistent, and was exposed following examination of
code causing an assertion failure in the cache profiler.  Added an
assertion to check this too, and was surprised I hadn't had an
assertion there in the first place.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@170

coregrind/vg_translate.c
vg_translate.c

index 76c6ef8a9b7c58282df2b60f786ff7d424e6e419..39f444ff7bb952f8d634c8e4f9818f2168f18f0f 100644 (file)
@@ -1359,11 +1359,11 @@ static void vg_improve ( UCodeBlock* cb )
 
 #  undef BIND_ARCH_TO_TEMP
 
-   /* PASS 2: redundant PUT elimination.  If doing instrumentation,
-      don't annul (delay) puts of %ESP, since the memory check
-      machinery always requires the in-memory value of %ESP to be up
-      to date. 
-   */
+   /* PASS 2: redundant PUT elimination.  Don't annul (delay) puts of
+      %ESP, since the memory check machinery always requires the
+      in-memory value of %ESP to be up to date.  Although this isn't
+      actually required by other analyses (cache simulation), it's
+      simplest to be consistent for all end-uses. */
    for (j = 0; j < 8; j++)
       annul_put[j] = False;
 
@@ -1375,12 +1375,13 @@ static void vg_improve ( UCodeBlock* cb )
          vg_assert(u->tag2 == ArchReg);
          actual_areg = containingArchRegOf ( 4, u->val2 );
          if (annul_put[actual_areg]) {
+            vg_assert(actual_areg != R_ESP);
             u->opcode = NOP;
             u->tag1 = u->tag2 = NoValue;
             if (VG_(disassemble)) 
                VG_(printf)("at %d: delete PUT\n", i );
          } else {
-            if (!(VG_(clo_instrument) && actual_areg == R_ESP))
+            if (actual_areg != R_ESP)
                annul_put[actual_areg] = True;
          }
       } 
index 76c6ef8a9b7c58282df2b60f786ff7d424e6e419..39f444ff7bb952f8d634c8e4f9818f2168f18f0f 100644 (file)
@@ -1359,11 +1359,11 @@ static void vg_improve ( UCodeBlock* cb )
 
 #  undef BIND_ARCH_TO_TEMP
 
-   /* PASS 2: redundant PUT elimination.  If doing instrumentation,
-      don't annul (delay) puts of %ESP, since the memory check
-      machinery always requires the in-memory value of %ESP to be up
-      to date. 
-   */
+   /* PASS 2: redundant PUT elimination.  Don't annul (delay) puts of
+      %ESP, since the memory check machinery always requires the
+      in-memory value of %ESP to be up to date.  Although this isn't
+      actually required by other analyses (cache simulation), it's
+      simplest to be consistent for all end-uses. */
    for (j = 0; j < 8; j++)
       annul_put[j] = False;
 
@@ -1375,12 +1375,13 @@ static void vg_improve ( UCodeBlock* cb )
          vg_assert(u->tag2 == ArchReg);
          actual_areg = containingArchRegOf ( 4, u->val2 );
          if (annul_put[actual_areg]) {
+            vg_assert(actual_areg != R_ESP);
             u->opcode = NOP;
             u->tag1 = u->tag2 = NoValue;
             if (VG_(disassemble)) 
                VG_(printf)("at %d: delete PUT\n", i );
          } else {
-            if (!(VG_(clo_instrument) && actual_areg == R_ESP))
+            if (actual_areg != R_ESP)
                annul_put[actual_areg] = True;
          }
       }