Static Value-Flow Analysis
SaberSVFGBuilder.h
Go to the documentation of this file.
1 //===- SaberSVFGBuilder.h -- Building SVFG for Saber--------------------------//
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  * SaberSVFGBuilder.h
25  *
26  * Created on: May 1, 2014
27  * Author: Yulei Sui
28  */
29 
30 #ifndef SABERSVFGBUILDER_H_
31 #define SABERSVFGBUILDER_H_
32 
33 #include "MSSA/SVFGBuilder.h"
34 #include "SVFIR/SVFValue.h"
35 #include "Util/WorkList.h"
36 
37 
38 namespace SVF
39 {
40 
41 class SaberCondAllocator;
42 
44 {
45 
46 public:
50 
53 
55  virtual ~SaberSVFGBuilder() {}
56 
57  inline bool isGlobalSVFGNode(const SVFGNode* node) const
58  {
59  return globSVFGNodes.find(node)!=globSVFGNodes.end();
60  }
61 
63  inline void addActualParmVFGNode(const PAGNode* pagNode, const CallICFGNode* cs)
64  {
65  svfg->addActualParmVFGNode(pagNode, cs);
66  }
67 
69  {
70  saberCondAllocator = allocator;
71  }
72 
73 protected:
75  virtual void buildSVFG();
76 
78  bool isStrongUpdate(const SVFGNode* node, NodeID& singleton, BVDataPTAImpl* pta);
79 
80 protected:
85 
88  virtual void rmIncomingEdgeForSUStore(BVDataPTAImpl* pta);
89 
92  virtual void AddExtActualParmSVFGNodes(PTACallGraph* callgraph);
93 
97  void collectGlobals(BVDataPTAImpl* pta);
98 
100  bool accessGlobal(BVDataPTAImpl* pta,const PAGNode* pagNode);
101 
103  PointsTo& CollectPtsChain(BVDataPTAImpl* pta,NodeID id, NodeToPTSSMap& cachedPtsMap);
104 
108 
110 };
111 
112 } // End namespace SVF
113 
114 #endif /* SABERSVFGBUILDER_H_ */
return true
Definition: cJSON.cpp:2295
std::unique_ptr< SVFG > svfg
Definition: SVFGBuilder.h:91
virtual ~SaberSVFGBuilder()
Destructor.
bool isStrongUpdate(const SVFGNode *node, NodeID &singleton, BVDataPTAImpl *pta)
Return TRUE if this is a strong update STORE statement.
Set< const SVFGNode * > SVFGNodeSet
void collectGlobals(BVDataPTAImpl *pta)
PointsTo & CollectPtsChain(BVDataPTAImpl *pta, NodeID id, NodeToPTSSMap &cachedPtsMap)
Collect objects along points-to chains.
bool accessGlobal(BVDataPTAImpl *pta, const PAGNode *pagNode)
Whether points-to of a PAGNode points-to global variable.
Map< NodeID, PointsTo > NodeToPTSSMap
virtual void buildSVFG()
Re-write create SVFG method.
FIFOWorkList< NodeID > WorkList
void setSaberCondAllocator(SaberCondAllocator *allocator)
SVFGNodeSet globSVFGNodes
Store all global SVFG nodes.
SaberSVFGBuilder()
Constructor.
virtual void AddExtActualParmSVFGNodes(PTACallGraph *callgraph)
Add actual parameter SVFGNode for 1st argument of a deallocation like external function.
void addActualParmVFGNode(const PAGNode *pagNode, const CallICFGNode *cs)
Add ActualParmVFGNode.
SaberCondAllocator * saberCondAllocator
void rmDerefDirSVFGEdges(BVDataPTAImpl *pta)
virtual void rmIncomingEdgeForSUStore(BVDataPTAImpl *pta)
bool isGlobalSVFGNode(const SVFGNode *node) const
for isBitcode
Definition: BasicTypes.h:68
u32_t NodeID
Definition: GeneralType.h:55
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
Definition: GeneralType.h:101
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
Definition: GeneralType.h:96