From: Julian Seward Date: Tue, 17 Aug 2004 13:52:58 +0000 (+0000) Subject: Connect no-op iropt to the driver logic. X-Git-Tag: svn/VALGRIND_3_0_1^2~1162 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d607aa0abf96c64ecb496bab6a68ba2cb24f8451;p=thirdparty%2Fvalgrind.git Connect no-op iropt to the driver logic. git-svn-id: svn://svn.valgrind.org/vex/trunk@172 --- diff --git a/VEX/priv/ir/iropt.c b/VEX/priv/ir/iropt.c index e1825158e3..9cfcf1e732 100644 --- a/VEX/priv/ir/iropt.c +++ b/VEX/priv/ir/iropt.c @@ -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 index 0000000000..d086765c50 --- /dev/null +++ b/VEX/priv/ir/iropt.h @@ -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 ---*/ +/*---------------------------------------------------------------*/ diff --git a/VEX/priv/main/vex_main.c b/VEX/priv/main/vex_main.c index 752f20f838..096d2e8ad0 100644 --- a/VEX/priv/main/vex_main.c +++ b/VEX/priv/main/vex_main.c @@ -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);