-
Notifications
You must be signed in to change notification settings - Fork 1
/
optimizer.hpp
33 lines (29 loc) · 945 Bytes
/
optimizer.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
* Copyright (c) 2023 by Hex-Rays, [email protected]
* ALL RIGHTS RESERVED.
*
* gooMBA plugin for Hex-Rays Decompiler.
*
*/
#pragma once
#include "equiv_class.hpp"
#include "smt_convert.hpp"
#include "heuristics.hpp"
#include "lin_conj_exprs.hpp"
#include "simp_lin_conj_exprs.hpp"
//--------------------------------------------------------------------------
inline void substitute(minsn_t *insn, minsn_t *cand)
{
cand->d = insn->d;
insn->swap(*cand);
}
//--------------------------------------------------------------------------
class optimizer_t
{
public:
uint z3_timeout = 1000;
bool z3_assume_timeouts_correct = true;
equiv_class_finder_t *equiv_classes = nullptr;
bool optimize_insn(minsn_t *insn); // attempts to replace the instruction with a simpler version
bool optimize_insn_recurse(minsn_t *insn); // attempts to optimize the instruction, and if it fails, optimizes its subinstructions
};