sewardj | edf4d69 | 2004-08-17 13:52:58 +0000 | [diff] [blame] | 1 | |
| 2 | /*---------------------------------------------------------------*/ |
sewardj | 752f906 | 2010-05-03 21:38:49 +0000 | [diff] [blame] | 3 | /*--- begin ir_opt.h ---*/ |
sewardj | edf4d69 | 2004-08-17 13:52:58 +0000 | [diff] [blame] | 4 | /*---------------------------------------------------------------*/ |
| 5 | |
sewardj | f8ed9d8 | 2004-11-12 17:40:23 +0000 | [diff] [blame] | 6 | /* |
sewardj | 752f906 | 2010-05-03 21:38:49 +0000 | [diff] [blame] | 7 | This file is part of Valgrind, a dynamic binary instrumentation |
| 8 | framework. |
sewardj | f8ed9d8 | 2004-11-12 17:40:23 +0000 | [diff] [blame] | 9 | |
sewardj | 89ae847 | 2013-10-18 14:12:58 +0000 | [diff] [blame] | 10 | Copyright (C) 2004-2013 OpenWorks LLP |
sewardj | 752f906 | 2010-05-03 21:38:49 +0000 | [diff] [blame] | 11 | info@open-works.net |
sewardj | f8ed9d8 | 2004-11-12 17:40:23 +0000 | [diff] [blame] | 12 | |
sewardj | 752f906 | 2010-05-03 21:38:49 +0000 | [diff] [blame] | 13 | This program is free software; you can redistribute it and/or |
| 14 | modify it under the terms of the GNU General Public License as |
| 15 | published by the Free Software Foundation; either version 2 of the |
| 16 | License, or (at your option) any later version. |
sewardj | f8ed9d8 | 2004-11-12 17:40:23 +0000 | [diff] [blame] | 17 | |
sewardj | 752f906 | 2010-05-03 21:38:49 +0000 | [diff] [blame] | 18 | This program is distributed in the hope that it will be useful, but |
| 19 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | General Public License for more details. |
| 22 | |
| 23 | You should have received a copy of the GNU General Public License |
| 24 | along with this program; if not, write to the Free Software |
| 25 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
sewardj | 7bd6ffe | 2005-08-03 16:07:36 +0000 | [diff] [blame] | 26 | 02110-1301, USA. |
| 27 | |
sewardj | 752f906 | 2010-05-03 21:38:49 +0000 | [diff] [blame] | 28 | The GNU General Public License is contained in the file COPYING. |
sewardj | f8ed9d8 | 2004-11-12 17:40:23 +0000 | [diff] [blame] | 29 | |
| 30 | Neither the names of the U.S. Department of Energy nor the |
| 31 | University of California nor the names of its contributors may be |
| 32 | used to endorse or promote products derived from this software |
| 33 | without prior written permission. |
sewardj | f8ed9d8 | 2004-11-12 17:40:23 +0000 | [diff] [blame] | 34 | */ |
| 35 | |
sewardj | cef7d3e | 2009-07-02 12:21:59 +0000 | [diff] [blame] | 36 | #ifndef __VEX_IR_OPT_H |
| 37 | #define __VEX_IR_OPT_H |
sewardj | 69933ac | 2004-12-20 04:12:14 +0000 | [diff] [blame] | 38 | |
sewardj | edf4d69 | 2004-08-17 13:52:58 +0000 | [diff] [blame] | 39 | #include "libvex_basictypes.h" |
| 40 | #include "libvex_ir.h" |
| 41 | #include "libvex.h" |
| 42 | |
sewardj | 49651f4 | 2004-10-28 22:11:04 +0000 | [diff] [blame] | 43 | /* Top level optimiser entry point. Returns a new BB. Operates |
| 44 | under the control of the global "vex_control" struct. */ |
| 45 | extern |
sewardj | be91791 | 2010-08-22 12:38:53 +0000 | [diff] [blame] | 46 | IRSB* do_iropt_BB( |
| 47 | IRSB* bb, |
florian | 1ff4756 | 2012-10-21 02:09:51 +0000 | [diff] [blame] | 48 | IRExpr* (*specHelper) (const HChar*, IRExpr**, IRStmt**, Int), |
sewardj | be91791 | 2010-08-22 12:38:53 +0000 | [diff] [blame] | 49 | Bool (*preciseMemExnsFn)(Int,Int), |
| 50 | Addr64 guest_addr, |
| 51 | VexArch guest_arch |
| 52 | ); |
sewardj | edf4d69 | 2004-08-17 13:52:58 +0000 | [diff] [blame] | 53 | |
sewardj | 9578a8b | 2004-11-04 19:44:48 +0000 | [diff] [blame] | 54 | /* Do a constant folding/propagation pass. */ |
| 55 | extern |
sewardj | dd40fdf | 2006-12-24 02:20:24 +0000 | [diff] [blame] | 56 | IRSB* cprop_BB ( IRSB* ); |
sewardj | 9578a8b | 2004-11-04 19:44:48 +0000 | [diff] [blame] | 57 | |
sewardj | f9517d0 | 2005-11-28 13:39:37 +0000 | [diff] [blame] | 58 | /* Do a dead-code removal pass. bb is destructively modified. */ |
sewardj | 49651f4 | 2004-10-28 22:11:04 +0000 | [diff] [blame] | 59 | extern |
sewardj | dd40fdf | 2006-12-24 02:20:24 +0000 | [diff] [blame] | 60 | void do_deadcode_BB ( IRSB* bb ); |
sewardj | 49651f4 | 2004-10-28 22:11:04 +0000 | [diff] [blame] | 61 | |
sewardj | f9517d0 | 2005-11-28 13:39:37 +0000 | [diff] [blame] | 62 | /* The tree-builder. Make (approximately) maximal safe trees. bb is |
sewardj | c6f970f | 2012-04-02 21:54:49 +0000 | [diff] [blame] | 63 | destructively modified. Returns (unrelatedly, but useful later on) |
| 64 | the guest address of the highest addressed byte from any insn in |
| 65 | this block, or Addr64_MAX if unknown (can that ever happen?) */ |
sewardj | 49651f4 | 2004-10-28 22:11:04 +0000 | [diff] [blame] | 66 | extern |
florian | 62140c1 | 2013-01-20 03:51:04 +0000 | [diff] [blame] | 67 | Addr64 ado_treebuild_BB ( IRSB* bb, Bool (*preciseMemExnsFn)(Int,Int) ); |
sewardj | edf4d69 | 2004-08-17 13:52:58 +0000 | [diff] [blame] | 68 | |
sewardj | cef7d3e | 2009-07-02 12:21:59 +0000 | [diff] [blame] | 69 | #endif /* ndef __VEX_IR_OPT_H */ |
sewardj | 69933ac | 2004-12-20 04:12:14 +0000 | [diff] [blame] | 70 | |
sewardj | edf4d69 | 2004-08-17 13:52:58 +0000 | [diff] [blame] | 71 | /*---------------------------------------------------------------*/ |
sewardj | cef7d3e | 2009-07-02 12:21:59 +0000 | [diff] [blame] | 72 | /*--- end ir_opt.h ---*/ |
sewardj | edf4d69 | 2004-08-17 13:52:58 +0000 | [diff] [blame] | 73 | /*---------------------------------------------------------------*/ |