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#include "Util/GeneralType.h"
36
37namespace SVF
38{
39
40class AbstractState;
41
43{
44public:
45 RelationSolver() = default;
46
47 /* gamma_hat, beta and abstract_consequence works on
48 IntervalESBase (the last element of inputs) for RSY or bilateral solver */
49
52
55
58
60
62
63
65 virtual inline Z3Expr toIntZ3Expr(u32_t varId) const
66 {
67 return Z3Expr::getContext().int_const(std::to_string(varId).c_str());
68 }
69
70 inline Z3Expr toIntVal(s32_t f) const
71 {
72 return Z3Expr::getContext().int_val(f);
73 }
75 {
76 return Z3Expr::getContext().real_val(std::to_string(f.getFVal()).c_str());
77 }
78
79 /* two optional solvers: RSY and bilateral */
80
82
84
86
88
89 void updateMap(Map<u32_t, s32_t>& map, u32_t key, const s32_t& value);
90
92};
93}
94
95#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:70
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76
signed s32_t
Definition GeneralType.h:68
unsigned u32_t
Definition GeneralType.h:67