Static Value-Flow Analysis
SVFGBuilder.h
Go to the documentation of this file.
1 //===- SVFGBuilder.h -- Building SVFG-----------------------------------------//
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  * AndersenMemSSA.h
25  *
26  * Created on: Oct 27, 2013
27  * Author: Yulei Sui
28  */
29 
30 #ifndef ANDERSENMEMSSA_H_
31 #define ANDERSENMEMSSA_H_
32 
34 #include "Graphs/SVFGOPT.h"
35 
36 namespace SVF
37 {
38 
43 {
44 
45 public:
50 
52  explicit SVFGBuilder(bool _SVFGWithIndCall = false): svfg(nullptr), SVFGWithIndCall(_SVFGWithIndCall) {}
53 
55  virtual ~SVFGBuilder() = default;
56 
59 
61  inline SVFG* getSVFG() const
62  {
63  return svfg.get();
64  }
65 
67  inline void markValidVFEdge(SVFGEdgeSet& edges)
68  {
69  for(SVFGEdgeSet::iterator it = edges.begin(), eit = edges.end(); it!=eit; ++it)
70  vfEdgesAtIndCallSite.erase(*it);
71  }
73  inline bool isSpuriousVFEdgeAtIndCallSite(const SVFGEdge* edge)
74  {
75  return vfEdgesAtIndCallSite.find(const_cast<SVFGEdge*>(edge))!=vfEdgesAtIndCallSite.end();
76  }
77 
79  virtual std::unique_ptr<MemSSA> buildMSSA(BVDataPTAImpl* pta, bool ptrOnlyMSSA);
80 
81 protected:
83  SVFG* build(BVDataPTAImpl* pta, VFG::VFGK kind);
85  virtual void buildSVFG();
87  virtual void releaseMemory();
88 
91  std::unique_ptr<SVFG> svfg;
94 };
95 
96 } // End namespace SVF
97 
98 #endif /* ANDERSENMEMSSA_H_ */
OrderedMap< const CallICFGNode *, FunctionSet > CallEdgeMap
Set< const CallICFGNode * > CallSiteSet
Indirect call edges type, map a callsite to a set of callees.
Set< const SVFFunction * > FunctionSet
SVFGBuilder(bool _SVFGWithIndCall=false)
Constructor.
Definition: SVFGBuilder.h:52
virtual std::unique_ptr< MemSSA > buildMSSA(BVDataPTAImpl *pta, bool ptrOnlyMSSA)
Build Memory SSA.
Definition: SVFGBuilder.cpp:97
PointerAnalysis::FunctionSet FunctionSet
Definition: SVFGBuilder.h:48
void markValidVFEdge(SVFGEdgeSet &edges)
Mark feasible VF edge by removing it from set vfEdgesAtIndCallSite.
Definition: SVFGBuilder.h:67
SVFG * build(BVDataPTAImpl *pta, VFG::VFGK kind)
Create a DDA SVFG. By default actualOut and FormalIN are removed, unless withAOFI is set true.
Definition: SVFGBuilder.cpp:64
SVFG * buildFullSVFG(BVDataPTAImpl *pta)
Definition: SVFGBuilder.cpp:49
SVFG::SVFGEdgeSetTy SVFGEdgeSet
Definition: SVFGBuilder.h:49
virtual void releaseMemory()
Release global SVFG.
Definition: SVFGBuilder.cpp:92
bool SVFGWithIndCall
SVFG with precomputed indirect call edges.
Definition: SVFGBuilder.h:93
PointerAnalysis::CallSiteSet CallSiteSet
Definition: SVFGBuilder.h:46
virtual ~SVFGBuilder()=default
Destructor.
bool isSpuriousVFEdgeAtIndCallSite(const SVFGEdge *edge)
Return true if this is an VF Edge pre-connected by Andersen's analysis.
Definition: SVFGBuilder.h:73
SVFGEdgeSet vfEdgesAtIndCallSite
SVFG Edges connected at indirect call/ret sites.
Definition: SVFGBuilder.h:90
SVFG * buildPTROnlySVFG(BVDataPTAImpl *pta)
Definition: SVFGBuilder.cpp:41
SVFG * getSVFG() const
Get SVFG instance.
Definition: SVFGBuilder.h:61
PointerAnalysis::CallEdgeMap CallEdgeMap
Definition: SVFGBuilder.h:47
virtual void buildSVFG()
Can be rewritten by subclasses.
Definition: SVFGBuilder.cpp:58
std::unique_ptr< SVFG > svfg
Definition: SVFGBuilder.h:91
Definition: SVFG.h:66
VFGK
VFG kind.
Definition: VFG.h:56
VFGEdge::SVFGEdgeSetTy SVFGEdgeSetTy
Definition: VFG.h:78
for isBitcode
Definition: BasicTypes.h:68