-
Notifications
You must be signed in to change notification settings - Fork 154
Expand file tree
/
Copy pathIFDSTabulationProblem.h
More file actions
105 lines (89 loc) · 4.12 KB
/
IFDSTabulationProblem.h
File metadata and controls
105 lines (89 loc) · 4.12 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/******************************************************************************
* Copyright (c) 2022 Philipp Schubert.
* All rights reserved. This program and the accompanying materials are made
* available under the terms of LICENSE.txt.
*
* Contributors:
* Philipp Schubert, Fabian Schiebel and others
*****************************************************************************/
#ifndef PHASAR_DATAFLOW_IFDSIDE_IFDSTABULATIONPROBLEM_H
#define PHASAR_DATAFLOW_IFDSIDE_IFDSTABULATIONPROBLEM_H
#include "phasar/DataFlow/IfdsIde/EdgeFunctionUtils.h"
#include "phasar/DataFlow/IfdsIde/IDETabulationProblem.h"
#include "phasar/DataFlow/IfdsIde/IfdsIdeDomain.h"
#include "phasar/Domain/AnalysisDomain.h"
#include <set>
#include <string>
namespace psr {
/// \brief The analysis problem interface for IFDS problems (solvable by the
/// IFDSSolver). Create a subclass from this and override all pure-virtual
/// functions to create your own IFDS analysis.
///
/// For more information on how to write an IFDS analysis, see [Writing an IFDS
/// Analysis](https://github.com/secure-software-engineering/phasar/wiki/Writing-an-IFDS-analysis)
template <IfdsAnalysisDomain AnalysisDomainTy,
typename Container = std::set<typename AnalysisDomainTy::d_t>>
class IFDSTabulationProblem
: public IDETabulationProblem<WithBinaryValueDomain<AnalysisDomainTy>,
Container> {
using Base =
IDETabulationProblem<WithBinaryValueDomain<AnalysisDomainTy>, Container>;
public:
using typename Base::d_t;
using typename Base::db_t;
using typename Base::f_t;
using typename Base::i_t;
using typename Base::l_t;
using typename Base::n_t;
using typename Base::ProblemAnalysisDomain;
using typename Base::t_t;
using typename Base::v_t;
/// Takes an IR database (IRDB) and collects information from it to create a
/// tabulation problem.
/// @param[in] IRDB The project IR database, that holds the code under
/// analysis
/// @param[in] EntryPoints The (mangled) names of all entry functions of the
/// target being analyzed, given as a vector of strings. An example would
/// simply be `{"main"}`. To set every function as entry point, pass
/// `"__ALL__"`
/// @param[in] ZeroValue Provides the special tautological zero value (aka.
/// Λ).
explicit IFDSTabulationProblem(const db_t *IRDB,
std::vector<std::string> EntryPoints,
d_t ZeroValue)
: Base(IRDB, std::move(EntryPoints), std::move(ZeroValue)) {}
IFDSTabulationProblem(IFDSTabulationProblem &&) noexcept = default;
IFDSTabulationProblem &operator=(IFDSTabulationProblem &&) noexcept = default;
IFDSTabulationProblem(const IFDSTabulationProblem &) = delete;
IFDSTabulationProblem &operator=(const IFDSTabulationProblem &) = delete;
~IFDSTabulationProblem() override = default;
EdgeFunction<l_t> getNormalEdgeFunction(n_t /*Curr*/, d_t /*CurrNode*/,
n_t /*Succ*/,
d_t /*SuccNode*/) final {
return EdgeIdentity<l_t>{};
}
EdgeFunction<l_t> getCallEdgeFunction(n_t /*CallInst*/, d_t /*SrcNode*/,
f_t /*CalleeFun*/,
d_t /*DestNode*/) final {
return EdgeIdentity<l_t>{};
}
EdgeFunction<l_t> getReturnEdgeFunction(n_t /*CallSite*/, f_t /*CalleeFun*/,
n_t /*ExitInst*/, d_t /*ExitNode*/,
n_t /*RetSite*/,
d_t /*RetNode*/) final {
return EdgeIdentity<l_t>{};
}
EdgeFunction<l_t>
getCallToRetEdgeFunction(n_t /*CallSite*/, d_t /*CallNode*/, n_t /*RetSite*/,
d_t /*RetSiteNode*/,
llvm::ArrayRef<f_t> /*Callees*/) final {
return EdgeIdentity<l_t>{};
}
EdgeFunction<l_t> getSummaryEdgeFunction(n_t /*Curr*/, d_t /*CurrNode*/,
n_t /*Succ*/,
d_t /*SuccNode*/) final {
return EdgeIdentity<l_t>{};
}
};
} // namespace psr
#endif