Static Value-Flow Analysis
Loading...
Searching...
No Matches
FSMPTA.h
Go to the documentation of this file.
1//===- FSMPTA.h -- Flow-sensitive multithreaded pointer analysis (FSAM) -===//
2//
3// SVF: Static Value-Flow Analysis
4//
5// Copyright (C) <2013-> <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/*
24 * FSMPTA.h
25 *
26 * Author: Jiawei Yang
27 *
28 * Sparse flow-sensitive pointer analysis for multithreaded programs (FSAM,
29 * Sui/Di/Xue CGO'16). It runs the sparse flow-sensitive solver
30 * (`FlowSensitive`) over a *thread-aware* SVFG built by `MTASVFGBuilder`,
31 * i.e. the stock thread-oblivious value flow augmented with inter-thread
32 * (interference) edges derived from the MHP and lock analyses.
33 */
34
35#ifndef INCLUDE_MTA_FSMPTA_H_
36#define INCLUDE_MTA_FSMPTA_H_
37
38#include "WPA/FlowSensitive.h"
39#include "Graphs/SlicedGraphs.h"
40
41#include <deque>
42
43namespace SVF
44{
45
46class AndersenBase;
47class AndersenWaveDiff;
48
53template<class SVFGGraph>
55{
56public:
59 ~FSMPTA() override = default;
60
61 void initialize() override;
62 void finalize() override;
63
64 static bool supportsCurrentConfiguration();
65
73
74protected:
75 NodeStack& SCCDetect() override;
76 void processNode(NodeID nodeId) override;
77 void updateConnectedNodes(const SVFGEdgeSetTy& edges) override;
78
79private:
81
82 static void enqueueSVFGNode(const SVFGNode* node, NodeBS& retained,
83 std::deque<NodeID>& worklist);
84 static void demandTopLevelPointer(const SVFVar* var, SVFG* graph,
86 std::deque<NodeID>& worklist);
88 const SVFGNode* node, SVFG* graph, NodeBS& demandedVars,
89 NodeBS& retained, std::deque<NodeID>& worklist);
92
96 std::unique_ptr<SCCDetection<SVFGGraph>> solveSCC;
100};
101
102extern template class FSMPTA<SVFG*>;
103extern template class FSMPTA<const SlicedSVFGView*>;
104
105} // End namespace SVF
106
107#endif /* INCLUDE_MTA_FSMPTA_H_ */
NodeStack solveNodeStack
Definition FSMPTA.h:97
void cacheRetainedEdge(SVFGEdge *edge)
Definition FSMPTA.cpp:263
static NodeBS buildExecutionDependencyClosure(SVFG *graph, AndersenBase *preAnalysis, NodeBS dependencyNodes)
Definition FSMPTA.cpp:121
SVFG * backingGraph
Definition FSMPTA.h:94
static void enqueueSVFGNode(const SVFGNode *node, NodeBS &retained, std::deque< NodeID > &worklist)
Definition FSMPTA.cpp:57
void processNode(NodeID nodeId) override
Handle various constraints.
Definition FSMPTA.cpp:309
void finalize() override
Finalize analysis.
Definition FSMPTA.cpp:255
void buildRetainedAdjacency()
Definition FSMPTA.cpp:271
void updateConnectedNodes(const SVFGEdgeSetTy &edges) override
Update nodes connected during updating call graph.
Definition FSMPTA.cpp:346
Map< NodeID, std::vector< SVFGEdge * > > retainedOutEdges
Definition FSMPTA.h:98
std::unique_ptr< SCCDetection< SVFGGraph > > solveSCC
Definition FSMPTA.h:96
NodeStack & SCCDetect() override
SCC detection.
Definition FSMPTA.cpp:284
static void demandTopLevelPointer(const SVFVar *var, SVFG *graph, NodeBS &demandedVars, NodeBS &retained, std::deque< NodeID > &worklist)
Definition FSMPTA.cpp:69
SVFGGraph solveGraph
Definition FSMPTA.h:95
AndersenWaveDiff * preAnalysis
Definition FSMPTA.h:93
static bool supportsCurrentConfiguration()
Definition FSMPTA.cpp:50
GenericGraphTraits< SVFGGraph > SolveGraphTraits
Definition FSMPTA.h:80
~FSMPTA() override=default
void initialize() override
Initialize analysis.
Definition FSMPTA.cpp:227
static void collectNodeInputDependencies(const SVFGNode *node, SVFG *graph, NodeBS &demandedVars, NodeBS &retained, std::deque< NodeID > &worklist)
Definition FSMPTA.cpp:86
Set< const SVFGEdge * > retainedEdgeSet
Definition FSMPTA.h:99
SVFG::SVFGEdgeSetTy SVFGEdgeSetTy
WorkList worklist
Worklist for resolution.
Definition WPASolver.h:197
const GraphType graph()
Get/Set graph methods.
Definition WPASolver.h:75
for isBitcode
Definition BasicTypes.h:70
std::stack< NodeID > NodeStack
Definition GeneralType.h:92
u32_t NodeID
Definition GeneralType.h:76
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76