Static Value-Flow Analysis
Loading...
Searching...
No Matches
RelationSolver.h
Go to the documentation of this file.
1//===- RelationSolver.h ----Relation Solver for Interval Domains-----------//
2//
3// SVF: Static Value-Flow Analysis
4//
5// Copyright (C) <2013-2022> <Yulei Sui>
6//
7
8// This program is free software: you can redistribute it and/or modify
9// it under the terms of the GNU Affero General Public License as published by
10// the Free Software Foundation, either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU Affero General Public License for more details.
17
18// You should have received a copy of the GNU Affero General Public License
19// along with this program. If not, see <http://www.gnu.org/licenses/>.
20//
21//===----------------------------------------------------------------------===//
22/*
23 * RelationSolver.h
24 *
25 * Created on: Aug 4, 2022
26 * Author: Jiawei Ren
27 *
28 */
29
30#ifndef Z3_EXAMPLE_RELATIONSOLVER_H
31#define Z3_EXAMPLE_RELATIONSOLVER_H
32
34#include "Util/Z3Expr.h"
35
36namespace SVF
37{
39{
40public:
41 RelationSolver() = default;
42
43 /* gamma_hat, beta and abstract_consequence works on
44 IntervalESBase (the last element of inputs) for RSY or bilateral solver */
45
48
51
54
56
58
59
61 virtual inline Z3Expr toIntZ3Expr(u32_t varId) const
62 {
63 return Z3Expr::getContext().int_const(std::to_string(varId).c_str());
64 }
65
66 inline Z3Expr toIntVal(s32_t f) const
67 {
68 return Z3Expr::getContext().int_val(f);
69 }
71 {
72 return Z3Expr::getContext().real_val(std::to_string(f.getFVal()).c_str());
73 }
74
75 /* two optional solvers: RSY and bilateral */
76
78
80
82
84
85 void updateMap(Map<u32_t, s32_t>& map, u32_t key, const s32_t& value);
86
88};
89}
90
91#endif //Z3_EXAMPLE_RELATIONSOLVER_H
Z3Expr gamma_hat(const AbstractState &exeState) const
Return Z3Expr according to valToValMap.
AbstractState RSY(const AbstractState &domain, const Z3Expr &phi)
AbstractState bilateral(const AbstractState &domain, const Z3Expr &phi, u32_t descend_check=0)
Map< u32_t, s32_t > BoxedOptSolver(const Z3Expr &phi, Map< u32_t, s32_t > &ret, Map< u32_t, s32_t > &low_values, Map< u32_t, s32_t > &high_values)
AbstractState beta(const Map< u32_t, s32_t > &sigma, const AbstractState &exeState) const
virtual Z3Expr toIntZ3Expr(u32_t varId) const
Return Z3 expression lazily based on SVFVar ID.
void updateMap(Map< u32_t, s32_t > &map, u32_t key, const s32_t &value)
AbstractState abstract_consequence(const AbstractState &lower, const AbstractState &upper, const AbstractState &domain) const
void decide_cpa_ext(const Z3Expr &phi, Map< u32_t, Z3Expr > &, Map< u32_t, s32_t > &, Map< u32_t, s32_t > &, Map< u32_t, s32_t > &, Map< u32_t, s32_t > &)
AbstractState BS(const AbstractState &domain, const Z3Expr &phi)
Z3Expr toRealVal(BoundedDouble f) const
RelationSolver()=default
Z3Expr toIntVal(s32_t f) const
static z3::context & getContext()
Get z3 context, singleton design here to make sure we only have one context.
Definition Z3Expr.cpp:66
for isBitcode
Definition BasicTypes.h:68
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74
signed s32_t
Definition GeneralType.h:47
unsigned u32_t
Definition GeneralType.h:46