blob: 0af7225078f9359f0ddcd0e433a7777b1baab8d1 [file] [log] [blame]
sewardjedf4d692004-08-17 13:52:58 +00001
2/*---------------------------------------------------------------*/
sewardj752f9062010-05-03 21:38:49 +00003/*--- begin ir_opt.h ---*/
sewardjedf4d692004-08-17 13:52:58 +00004/*---------------------------------------------------------------*/
5
sewardjf8ed9d82004-11-12 17:40:23 +00006/*
sewardj752f9062010-05-03 21:38:49 +00007 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
sewardjf8ed9d82004-11-12 17:40:23 +00009
sewardj89ae8472013-10-18 14:12:58 +000010 Copyright (C) 2004-2013 OpenWorks LLP
sewardj752f9062010-05-03 21:38:49 +000011 info@open-works.net
sewardjf8ed9d82004-11-12 17:40:23 +000012
sewardj752f9062010-05-03 21:38:49 +000013 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.
sewardjf8ed9d82004-11-12 17:40:23 +000017
sewardj752f9062010-05-03 21:38:49 +000018 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
sewardj7bd6ffe2005-08-03 16:07:36 +000026 02110-1301, USA.
27
sewardj752f9062010-05-03 21:38:49 +000028 The GNU General Public License is contained in the file COPYING.
sewardjf8ed9d82004-11-12 17:40:23 +000029
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.
sewardjf8ed9d82004-11-12 17:40:23 +000034*/
35
sewardjcef7d3e2009-07-02 12:21:59 +000036#ifndef __VEX_IR_OPT_H
37#define __VEX_IR_OPT_H
sewardj69933ac2004-12-20 04:12:14 +000038
sewardjedf4d692004-08-17 13:52:58 +000039#include "libvex_basictypes.h"
40#include "libvex_ir.h"
41#include "libvex.h"
42
sewardj49651f42004-10-28 22:11:04 +000043/* Top level optimiser entry point. Returns a new BB. Operates
44 under the control of the global "vex_control" struct. */
45extern
sewardjbe917912010-08-22 12:38:53 +000046IRSB* do_iropt_BB(
47 IRSB* bb,
florian1ff47562012-10-21 02:09:51 +000048 IRExpr* (*specHelper) (const HChar*, IRExpr**, IRStmt**, Int),
sewardjbe917912010-08-22 12:38:53 +000049 Bool (*preciseMemExnsFn)(Int,Int),
50 Addr64 guest_addr,
51 VexArch guest_arch
52 );
sewardjedf4d692004-08-17 13:52:58 +000053
sewardj9578a8b2004-11-04 19:44:48 +000054/* Do a constant folding/propagation pass. */
55extern
sewardjdd40fdf2006-12-24 02:20:24 +000056IRSB* cprop_BB ( IRSB* );
sewardj9578a8b2004-11-04 19:44:48 +000057
sewardjf9517d02005-11-28 13:39:37 +000058/* Do a dead-code removal pass. bb is destructively modified. */
sewardj49651f42004-10-28 22:11:04 +000059extern
sewardjdd40fdf2006-12-24 02:20:24 +000060void do_deadcode_BB ( IRSB* bb );
sewardj49651f42004-10-28 22:11:04 +000061
sewardjf9517d02005-11-28 13:39:37 +000062/* The tree-builder. Make (approximately) maximal safe trees. bb is
sewardjc6f970f2012-04-02 21:54:49 +000063 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?) */
sewardj49651f42004-10-28 22:11:04 +000066extern
florian62140c12013-01-20 03:51:04 +000067Addr64 ado_treebuild_BB ( IRSB* bb, Bool (*preciseMemExnsFn)(Int,Int) );
sewardjedf4d692004-08-17 13:52:58 +000068
sewardjcef7d3e2009-07-02 12:21:59 +000069#endif /* ndef __VEX_IR_OPT_H */
sewardj69933ac2004-12-20 04:12:14 +000070
sewardjedf4d692004-08-17 13:52:58 +000071/*---------------------------------------------------------------*/
sewardjcef7d3e2009-07-02 12:21:59 +000072/*--- end ir_opt.h ---*/
sewardjedf4d692004-08-17 13:52:58 +000073/*---------------------------------------------------------------*/