]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Connect no-op iropt to the driver logic.
authorJulian Seward <jseward@acm.org>
Tue, 17 Aug 2004 13:52:58 +0000 (13:52 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 17 Aug 2004 13:52:58 +0000 (13:52 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@172

VEX/priv/ir/iropt.c
VEX/priv/ir/iropt.h [new file with mode: 0644]
VEX/priv/main/vex_main.c

index e1825158e3bf594c27c54a8d37bdcfe10582fa59..9cfcf1e7323ede597cd22fdb7920ab424594b77c 100644 (file)
@@ -7,9 +7,11 @@
 /*---------------------------------------------------------------*/
 
 #include "libvex_basictypes.h"
+#include "libvex_ir.h"
 #include "libvex.h"
 
 #include "main/vex_util.h"
+#include "ir/iropt.h"
 
 
 /*---------------------------------------------------------------*/
@@ -113,6 +115,25 @@ static void addToH64 ( Hash64* h, ULong key, ULong val )
    h->used++;
 }
 
+
+/*---------------------------------------------------------------*/
+/*--- iropt main                                              ---*/
+/*---------------------------------------------------------------*/
+
+/* Rules of the game:
+
+   - IRExpr/IRStmt trees should be treated as immutable, as they
+     may get shared.  So never change a field of such a tree node;
+     instead construct and return a new one if needed.
+*/
+
+/* exported from this file */
+IRBB* do_iropt_BB ( IRBB* bb0 )
+{
+   return bb0;
+}
+
+
 /*---------------------------------------------------------------*/
 /*--- end                                          ir/iropt.c ---*/
 /*---------------------------------------------------------------*/
diff --git a/VEX/priv/ir/iropt.h b/VEX/priv/ir/iropt.h
new file mode 100644 (file)
index 0000000..d086765
--- /dev/null
@@ -0,0 +1,18 @@
+
+/*---------------------------------------------------------------*/
+/*---                                                         ---*/
+/*--- This file (ir/iropt.h) is                               ---*/
+/*--- Copyright (c) 2004 OpenWorks LLP.  All rights reserved. ---*/
+/*---                                                         ---*/
+/*---------------------------------------------------------------*/
+
+#include "libvex_basictypes.h"
+#include "libvex_ir.h"
+#include "libvex.h"
+
+
+extern IRBB* do_iropt_BB ( IRBB* );
+
+/*---------------------------------------------------------------*/
+/*--- end                                          ir/iropt.h ---*/
+/*---------------------------------------------------------------*/
index 752f20f838af0588fb6ff840d8eb29646f9ad711..096d2e8ad0c4aa9b7de931b4d9242a1e87fc8bdd 100644 (file)
@@ -13,6 +13,7 @@
 #include "host-generic/h_generic_regs.h"
 #include "host-x86/hdefs.h"
 #include "guest-x86/gdefs.h"
+#include "ir/iropt.h"
 
 
 /* This file contains the top level interface to the library. */
@@ -171,6 +172,15 @@ TranslateResult LibVEX_Translate (
    }
    sanityCheckIRBB(irbb, Ity_I32);
 
+   /* Clean it up, hopefully a lot. */
+   irbb = do_iropt_BB ( irbb );
+
+   if (vex_verbosity > 0) {
+      vex_printf("\n-------- After IR optimisation --------\n");
+      ppIRBB ( irbb );
+      vex_printf("\n");
+   }
+
    /* Get the thing instrumented. */
    if (instrument)
       irbb = (*instrument)(irbb);