Static Value-Flow Analysis
SVFG.h
Go to the documentation of this file.
1 //===- SVFG.h -- Sparse value-flow graph--------------------------------------//
2 //
3 // SVF: Static Value-Flow Analysis
4 //
5 // Copyright (C) <2013-2017> <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  * SVFG.h
25  *
26  * Created on: Oct 28, 2013
27  * Author: Yulei Sui
28  */
29 
30 #ifndef SVFG_H_
31 #define SVFG_H_
32 
33 #include "Graphs/VFG.h"
34 #include "Graphs/SVFGNode.h"
35 
36 namespace SVF
37 {
38 
39 class PointerAnalysis;
40 class SVFGStat;
41 
42 typedef VFGEdge SVFGEdge;
43 typedef VFGNode SVFGNode;
48 
59 
60 
65 class SVFG : public VFG
66 {
67  friend class SVFGBuilder;
68  friend class SaberSVFGBuilder;
69  friend class CFLSVFGBuilder;
70  friend class TaintSVFGBuilder;
71  friend class DDASVFGBuilder;
72  friend class MTASVFGBuilder;
73  friend class RcSvfgBuilder;
74 
75 public:
90  typedef MemSSA::MU MU;
91  typedef MemSSA::CHI CHI;
98 
99 protected:
106  std::unique_ptr<MemSSA> mssa;
108 
110  void destroy();
111 
113  SVFG(std::unique_ptr<MemSSA> mssa, VFGK k);
114 
116  virtual void buildSVFG();
117 
118 public:
120  virtual ~SVFG()
121  {
122  destroy();
123  }
124 
126  inline SVFGStat* getStat() const
127  {
128  return stat;
129  }
130 
132  inline void clearMSSA()
133  {
134  mssa = nullptr;
135  }
136 
138  inline MemSSA* getMSSA() const
139  {
140  return mssa.get();
141  }
142 
144  inline PointerAnalysis* getPTA() const
145  {
146  return pta;
147  }
148 
150  inline SVFGNode* getSVFGNode(NodeID id) const
151  {
152  return getVFGNode(id);
153  }
154 
156  inline bool hasSVFGNode(NodeID id) const
157  {
158  return hasVFGNode(id);
159  }
160 
162  void getInterVFEdgesForIndirectCallSite(const CallICFGNode* cs, const SVFFunction* callee, SVFGEdgeSetTy& edges);
163 
165  void dump(const std::string& file, bool simple = false);
166 
168  virtual void connectCallerAndCallee(const CallICFGNode* cs, const SVFFunction* callee, SVFGEdgeSetTy& edges);
169 
171  inline const SVFGNode* getDefSVFGNode(const PAGNode* pagNode) const
172  {
173  return getSVFGNode(getDef(pagNode));
174  }
175 
177  inline bool hasDefSVFGNode(const PAGNode* pagNode) const
178  {
179  return hasDef(pagNode) && hasSVFGNode(getDef(pagNode));
180  }
181 
183  void performStat();
184 
186 
187  inline bool hasActualINSVFGNodes(const CallICFGNode* cs) const
188  {
189  return callSiteToActualINMap.find(cs)!=callSiteToActualINMap.end();
190  }
191 
192  inline bool hasActualOUTSVFGNodes(const CallICFGNode* cs) const
193  {
194  return callSiteToActualOUTMap.find(cs)!=callSiteToActualOUTMap.end();
195  }
196 
197  inline bool hasFormalINSVFGNodes(const SVFFunction* fun) const
198  {
199  return funToFormalINMap.find(fun)!=funToFormalINMap.end();
200  }
201 
202  inline bool hasFormalOUTSVFGNodes(const SVFFunction* fun) const
203  {
204  return funToFormalOUTMap.find(fun)!=funToFormalOUTMap.end();
205  }
207 
209 
211  {
212  return callSiteToActualINMap[cs];
213  }
214 
216  {
217  return callSiteToActualOUTMap[cs];
218  }
219 
221  {
222  return funToFormalINMap[fun];
223  }
224 
226  {
227  return funToFormalOUTMap[fun];
228  }
230 
232  const SVFFunction* isFunEntrySVFGNode(const SVFGNode* node) const;
233 
235  const CallICFGNode* isCallSiteRetSVFGNode(const SVFGNode* node) const;
236 
238  inline void removeSVFGEdge(SVFGEdge* edge)
239  {
240  removeVFGEdge(edge);
241  }
243  inline void removeSVFGNode(SVFGNode* node)
244  {
245  removeVFGNode(node);
246  }
247 
249  inline bool addSVFGEdge(SVFGEdge* edge)
250  {
251  return addVFGEdge(edge);
252  }
253 
255  inline u32_t getSVFGNodeNum() const
256  {
257  return nodeNum;
258  }
259 
263  inline const DummyVersionPropSVFGNode *addDummyVersionPropSVFGNode(const NodeID object, const NodeID version)
264  {
265  DummyVersionPropSVFGNode *dvpNode = new DummyVersionPropSVFGNode(totalVFGNode++, object, version);
266  // Not going through add[S]VFGNode because we have no ICFG edge.
267  addGNode(dvpNode->getId(), dvpNode);
268  return dvpNode;
269  }
270 
271  virtual void writeToFile(const std::string& filename);
272  virtual void readFile(const std::string& filename);
273  virtual MRVer* getMRVERFromString(const std::string& input);
274 
275 protected:
277 
278  SVFGEdge* addIntraIndirectVFEdge(NodeID srcId, NodeID dstId, const NodeBS& cpts);
279  SVFGEdge* addCallIndirectVFEdge(NodeID srcId, NodeID dstId, const NodeBS& cpts,CallSiteID csId);
280  SVFGEdge* addRetIndirectVFEdge(NodeID srcId, NodeID dstId, const NodeBS& cpts,CallSiteID csId);
281  SVFGEdge* addThreadMHPIndirectVFEdge(NodeID srcId, NodeID dstId, const NodeBS& cpts);
283 
286 
289 
291 
292  virtual inline void connectAInAndFIn(const ActualINSVFGNode* actualIn, const FormalINSVFGNode* formalIn, CallSiteID csId, SVFGEdgeSetTy& edges)
294  {
295  SVFGEdge* edge = addInterIndirectVFCallEdge(actualIn, formalIn,csId);
296  if (edge != nullptr)
297  edges.insert(edge);
298  }
300  virtual inline void connectFOutAndAOut(const FormalOUTSVFGNode* formalOut, const ActualOUTSVFGNode* actualOut, CallSiteID csId, SVFGEdgeSetTy& edges)
301  {
302  SVFGEdge* edge = addInterIndirectVFRetEdge(formalOut, actualOut,csId);
303  if (edge != nullptr)
304  edges.insert(edge);
305  }
307 
309 
310  virtual inline void getInterVFEdgeAtIndCSFromAPToFP(const PAGNode* cs_arg, const PAGNode* fun_arg, const CallICFGNode*, CallSiteID csId, SVFGEdgeSetTy& edges)
311  {
312  SVFGNode* actualParam = getSVFGNode(getDef(cs_arg));
313  SVFGNode* formalParam = getSVFGNode(getDef(fun_arg));
314  SVFGEdge* edge = hasInterVFGEdge(actualParam, formalParam, SVFGEdge::CallDirVF, csId);
315  assert(edge != nullptr && "Can not find inter value flow edge from aparam to fparam");
316  edges.insert(edge);
317  }
318 
319  virtual inline void getInterVFEdgeAtIndCSFromFRToAR(const PAGNode* fun_ret, const PAGNode* cs_ret, CallSiteID csId, SVFGEdgeSetTy& edges)
320  {
321  SVFGNode* formalRet = getSVFGNode(getDef(fun_ret));
322  SVFGNode* actualRet = getSVFGNode(getDef(cs_ret));
323  SVFGEdge* edge = hasInterVFGEdge(formalRet, actualRet, SVFGEdge::RetDirVF, csId);
324  assert(edge != nullptr && "Can not find inter value flow edge from fret to aret");
325  edges.insert(edge);
326  }
327 
328  virtual inline void getInterVFEdgeAtIndCSFromAInToFIn(ActualINSVFGNode* actualIn, const SVFFunction* callee, SVFGEdgeSetTy& edges)
329  {
330  for (SVFGNode::const_iterator outIt = actualIn->OutEdgeBegin(), outEit = actualIn->OutEdgeEnd(); outIt != outEit; ++outIt)
331  {
332  SVFGEdge* edge = *outIt;
333  if (edge->getDstNode()->getFun() == callee)
334  edges.insert(edge);
335  }
336  }
337 
338  virtual inline void getInterVFEdgeAtIndCSFromFOutToAOut(ActualOUTSVFGNode* actualOut, const SVFFunction* callee, SVFGEdgeSetTy& edges)
339  {
340  for (SVFGNode::const_iterator inIt = actualOut->InEdgeBegin(), inEit = actualOut->InEdgeEnd(); inIt != inEit; ++inIt)
341  {
342  SVFGEdge* edge = *inIt;
343  if (edge->getSrcNode()->getFun() == callee)
344  edges.insert(edge);
345  }
346  }
348 
349 
351 
352  inline void setDef(const PAGNode* pagNode, const SVFGNode* node)
353  {
354  VFG::setDef(pagNode, node);
355  }
356  inline NodeID getDef(const PAGNode* pagNode) const
357  {
358  return VFG::getDef(pagNode);
359  }
360  inline bool hasDef(const PAGNode* pagNode) const
361  {
362  return VFG::hasDef(pagNode);
363  }
365 
367 
368  inline void setDef(const MRVer* mvar, const SVFGNode* node)
369  {
370  MSSAVarToDefMapTy::iterator it = MSSAVarToDefMap.find(mvar);
371  if(it==MSSAVarToDefMap.end())
372  {
373  MSSAVarToDefMap[mvar] = node->getId();
374  assert(hasSVFGNode(node->getId()) && "not in the map!!");
375  }
376  else
377  {
378  assert((it->second == node->getId()) && "a SVFIR node can only have unique definition ");
379  }
380  }
381  inline NodeID getDef(const MRVer* mvar) const
382  {
383  MSSAVarToDefMapTy::const_iterator it = MSSAVarToDefMap.find(mvar);
384  assert(it!=MSSAVarToDefMap.end() && "memory SSA does not have a definition??");
385  return it->second;
386  }
388 
395 
397  virtual inline void addSVFGNode(SVFGNode* node, ICFGNode* icfgNode)
398  {
399  addVFGNode(node, icfgNode);
400  }
401 
403  inline void addFormalINSVFGNode(const FunEntryICFGNode* funEntry, const MRVer* resVer, const NodeID nodeId)
404  {
405  FormalINSVFGNode* sNode = new FormalINSVFGNode(nodeId, resVer, funEntry);
406  addSVFGNode(sNode, pag->getICFG()->getFunEntryICFGNode(funEntry->getFun()));
407  setDef(resVer,sNode);
408  funToFormalINMap[funEntry->getFun()].set(sNode->getId());
409  }
410 
412  inline void addFormalOUTSVFGNode(const FunExitICFGNode* funExit, const MRVer* ver, const NodeID nodeId)
413  {
414  FormalOUTSVFGNode* sNode = new FormalOUTSVFGNode(nodeId, ver, funExit);
415  addSVFGNode(sNode,pag->getICFG()->getFunExitICFGNode(funExit->getFun()));
416  funToFormalOUTMap[funExit->getFun()].set(sNode->getId());
417  }
418 
420  inline void addActualINSVFGNode(const CallICFGNode* callsite, const MRVer* ver, const NodeID nodeId)
421  {
422  ActualINSVFGNode* sNode = new ActualINSVFGNode(nodeId, callsite, ver);
423  addSVFGNode(sNode, const_cast<CallICFGNode*>(callsite));
424  callSiteToActualINMap[callsite].set(sNode->getId());
425  }
426 
428  inline void addActualOUTSVFGNode(const CallICFGNode* callsite, const MRVer* resVer, const NodeID nodeId)
429  {
430  ActualOUTSVFGNode* sNode = new ActualOUTSVFGNode(nodeId, callsite, resVer);
431  addSVFGNode(sNode,const_cast<RetICFGNode*>(callsite->getRetICFGNode()));
432  setDef(resVer,sNode);
433  callSiteToActualOUTMap[callsite].set(sNode->getId());
434  }
435 
437  inline void addIntraMSSAPHISVFGNode(ICFGNode* BlockICFGNode, const Map<u32_t,const MRVer*>::const_iterator opVerBegin,
438  const Map<u32_t,const MRVer*>::const_iterator opVerEnd, const MRVer* resVer, const NodeID nodeId)
439  {
440  IntraMSSAPHISVFGNode* sNode = new IntraMSSAPHISVFGNode(nodeId, resVer);
441  addSVFGNode(sNode, BlockICFGNode);
442  for(MemSSA::PHI::OPVers::const_iterator it = opVerBegin, eit=opVerEnd; it!=eit; ++it)
443  sNode->setOpVer(it->first,it->second);
444  setDef(resVer,sNode);
445  }
446 
448 
449  inline bool hasFuncEntryChi(const SVFFunction* func) const
450  {
451  return (funToFormalINMap.find(func) != funToFormalINMap.end());
452  }
453  inline bool hasFuncRetMu(const SVFFunction* func) const
454  {
455  return (funToFormalOUTMap.find(func) != funToFormalOUTMap.end());
456  }
457  inline bool hasCallSiteChi(const CallICFGNode* cs) const
458  {
459  return (callSiteToActualOUTMap.find(cs) != callSiteToActualOUTMap.end());
460  }
461  inline bool hasCallSiteMu(const CallICFGNode* cs) const
462  {
463  return (callSiteToActualINMap.find(cs) != callSiteToActualINMap.end());
464  }
466 };
467 
468 } // End namespace SVF
469 
470 namespace SVF
471 {
472 /* !
473  * GenericGraphTraits specializations for SVFG to be used for generic graph algorithms.
474  * Provide graph traits for traversing from a SVFG node using standard graph traversals.
475  */
476 //template<> struct GenericGraphTraits<SVF::SVFGNode*>: public GenericGraphTraits<SVF::GenericNode<SVF::SVFGNode,SVF::SVFGEdge>* > {
477 //};
478 //
480 //template<>
481 //struct GenericGraphTraits<Inverse<SVF::SVFGNode *> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::SVFGNode,SVF::SVFGEdge>* > > {
482 //};
483 
484 template<> struct GenericGraphTraits<SVF::SVFG*> : public GenericGraphTraits<SVF::GenericGraph<SVF::SVFGNode,SVF::SVFGEdge>* >
485 {
487 };
488 
489 } // End namespace llvm
490 
491 #endif /* SVFG_H_ */
const char *const string
Definition: cJSON.h:172
const RetICFGNode * getRetICFGNode() const
Return callsite.
Definition: ICFGNode.h:457
const SVFFunction * getFun() const override
Return function.
Definition: ICFGNode.h:295
const SVFFunction * getFun() const override
Return function.
Definition: ICFGNode.h:366
NodeType * getSrcNode() const
Definition: GenericGraph.h:97
NodeType * getDstNode() const
Definition: GenericGraph.h:101
void addGNode(NodeID id, NodeType *node)
Add a Node.
Definition: GenericGraph.h:646
u32_t nodeNum
total num of edge
Definition: GenericGraph.h:703
iterator OutEdgeEnd()
Definition: GenericGraph.h:458
iterator OutEdgeBegin()
iterators
Definition: GenericGraph.h:454
iterator InEdgeBegin()
Definition: GenericGraph.h:462
iterator InEdgeEnd()
Definition: GenericGraph.h:466
FunEntryICFGNode * getFunEntryICFGNode(const SVFFunction *fun)
Add a function entry node.
Definition: ICFG.cpp:234
FunExitICFGNode * getFunExitICFGNode(const SVFFunction *fun)
Add a function exit node.
Definition: ICFG.cpp:241
void setOpVer(u32_t pos, const MRVer *node)
Definition: SVFGNode.h:293
Set< MU * > MUSet
Definition: MemSSA.h:70
Set< PHI * > PHISet
Definition: MemSSA.h:72
Set< CHI * > CHISet
Definition: MemSSA.h:71
NodeID getId() const
Get ID.
Definition: GenericGraph.h:260
Definition: SVFG.h:66
MemSSA::RETMU RETMU
Definition: SVFG.h:94
SVFG(std::unique_ptr< MemSSA > mssa, VFGK k)
Constructor.
Definition: SVFG.cpp:204
virtual void buildSVFG()
Start building SVFG.
Definition: SVFG.cpp:228
PointerAnalysis * pta
Definition: SVFG.h:107
MemSSA::ENTRYCHI ENTRYCHI
Definition: SVFG.h:95
void connectIndirectSVFGEdges()
Connect direct SVFG edges between two SVFG nodes (value-flow of top address-taken variables)
Definition: SVFG.cpp:330
SVFGEdge * addThreadMHPIndirectVFEdge(NodeID srcId, NodeID dstId, const NodeBS &cpts)
Definition: SVFG.cpp:485
bool hasSVFGNode(NodeID id) const
Whether has the SVFGNode.
Definition: SVFG.h:156
bool hasFormalOUTSVFGNodes(const SVFFunction *fun) const
Definition: SVFG.h:202
bool hasActualINSVFGNodes(const CallICFGNode *cs) const
Has a SVFGNode.
Definition: SVFG.h:187
bool hasFuncEntryChi(const SVFFunction *func) const
Has function for EntryCHI/RetMU/CallCHI/CallMU.
Definition: SVFG.h:449
Map< const PAGNode *, NodeID > PAGNodeToDefMapTy
Definition: SVFG.h:77
FormalOUTSVFGNodeSet & getFormalOUTSVFGNodes(const SVFFunction *fun)
Definition: SVFG.h:225
Map< const SVFFunction *, FormalINSVFGNodeSet > FunctionToFormalINsMapTy
Definition: SVFG.h:85
NodeBS ActualOUTSVFGNodeSet
Definition: SVFG.h:80
bool hasFuncRetMu(const SVFFunction *func) const
Definition: SVFG.h:453
CallSiteToActualOUTsMapTy callSiteToActualOUTMap
Definition: SVFG.h:102
VFGNodeIDToNodeMapTy SVFGNodeIDToNodeMapTy
Definition: SVFG.h:76
virtual void connectFOutAndAOut(const FormalOUTSVFGNode *formalOut, const ActualOUTSVFGNode *actualOut, CallSiteID csId, SVFGEdgeSetTy &edges)
Connect formal-out and actual-out.
Definition: SVFG.h:300
ActualINSVFGNodeSet & getActualINSVFGNodes(const CallICFGNode *cs)
Get SVFGNode set.
Definition: SVFG.h:210
MemSSA * getMSSA() const
Get SVFG memory SSA.
Definition: SVFG.h:138
void getInterVFEdgesForIndirectCallSite(const CallICFGNode *cs, const SVFFunction *callee, SVFGEdgeSetTy &edges)
Get all inter value flow edges of a indirect call site.
Definition: SVFG.cpp:584
NodeID getDef(const MRVer *mvar) const
Definition: SVFG.h:381
SVFGEdge * addInterIndirectVFCallEdge(const ActualINSVFGNode *src, const FormalINSVFGNode *dst, CallSiteID csId)
Add inter VF edge from callsite mu to function entry chi.
Definition: SVFG.cpp:545
void connectFromGlobalToProgEntry()
Connect indirect SVFG edges from global initializers (store) to main function entry.
Definition: SVFG.cpp:428
ActualOUTSVFGNodeSet & getActualOUTSVFGNodes(const CallICFGNode *cs)
Definition: SVFG.h:215
MemSSA::CALLCHI CALLCHI
Definition: SVFG.h:96
void dump(const std::string &file, bool simple=false)
Dump graph into dot file.
Definition: SVFG.cpp:576
void addIntraMSSAPHISVFGNode(ICFGNode *BlockICFGNode, const Map< u32_t, const MRVer * >::const_iterator opVerBegin, const Map< u32_t, const MRVer * >::const_iterator opVerEnd, const MRVer *resVer, const NodeID nodeId)
Add memory SSA PHI SVFG node.
Definition: SVFG.h:437
MemSSA::CHI CHI
Definition: SVFG.h:91
bool hasFormalINSVFGNodes(const SVFFunction *fun) const
Definition: SVFG.h:197
friend class TaintSVFGBuilder
Definition: SVFG.h:70
friend class RcSvfgBuilder
Definition: SVFG.h:73
bool addSVFGEdge(SVFGEdge *edge)
Add SVFG edge.
Definition: SVFG.h:249
void removeSVFGNode(SVFGNode *node)
Remove a SVFGNode.
Definition: SVFG.h:243
virtual ~SVFG()
Destructor.
Definition: SVFG.h:120
Map< const CallICFGNode *, ActualINSVFGNodeSet > CallSiteToActualINsMapTy
Definition: SVFG.h:83
void addActualOUTSVFGNode(const CallICFGNode *callsite, const MRVer *resVer, const NodeID nodeId)
Add memory callsite chi SVFG node.
Definition: SVFG.h:428
virtual void getInterVFEdgeAtIndCSFromFOutToAOut(ActualOUTSVFGNode *actualOut, const SVFFunction *callee, SVFGEdgeSetTy &edges)
Definition: SVFG.h:338
SVFGNode * getSVFGNode(NodeID id) const
Get a SVFG node.
Definition: SVFG.h:150
Map< const CallICFGNode *, ActualOUTSVFGNodeSet > CallSiteToActualOUTsMapTy
Definition: SVFG.h:84
virtual void writeToFile(const std::string &filename)
FunctionToFormalOUTsMapTy funToFormalOUTMap
Definition: SVFG.h:104
MemSSA::MU MU
Definition: SVFG.h:90
void addFormalOUTSVFGNode(const FunExitICFGNode *funExit, const MRVer *ver, const NodeID nodeId)
Add memory Function return mu SVFG node.
Definition: SVFG.h:412
void destroy()
Clean up memory.
Definition: SVFG.cpp:212
bool hasCallSiteMu(const CallICFGNode *cs) const
Definition: SVFG.h:461
MemSSA::LOADMU LOADMU
Definition: SVFG.h:92
MemSSA::CHISet CHISet
Definition: SVFG.h:88
NodeBS FormalINSVFGNodeSet
Definition: SVFG.h:81
virtual void addSVFGNode(SVFGNode *node, ICFGNode *icfgNode)
Add SVFG node.
Definition: SVFG.h:397
SVFGStat * getStat() const
Return statistics.
Definition: SVFG.h:126
const DummyVersionPropSVFGNode * addDummyVersionPropSVFGNode(const NodeID object, const NodeID version)
Definition: SVFG.h:263
const SVFGNode * getDefSVFGNode(const PAGNode *pagNode) const
Given a pagNode, return its definition site.
Definition: SVFG.h:171
SVFGEdge * addRetIndirectVFEdge(NodeID srcId, NodeID dstId, const NodeBS &cpts, CallSiteID csId)
Definition: SVFG.cpp:525
virtual MRVer * getMRVERFromString(const std::string &input)
void addActualINSVFGNode(const CallICFGNode *callsite, const MRVer *ver, const NodeID nodeId)
Add memory callsite mu SVFG node.
Definition: SVFG.h:420
bool hasDef(const PAGNode *pagNode) const
Definition: SVFG.h:360
void removeSVFGEdge(SVFGEdge *edge)
Remove a SVFG edge.
Definition: SVFG.h:238
friend class DDASVFGBuilder
Definition: SVFG.h:71
FormalINSVFGNodeSet & getFormalINSVFGNodes(const SVFFunction *fun)
Definition: SVFG.h:220
virtual void readFile(const std::string &filename)
void setDef(const MRVer *mvar, const SVFGNode *node)
Given a MSSADef, set/get its def SVFG node (definition of address-taken variables)
Definition: SVFG.h:368
std::unique_ptr< MemSSA > mssa
Definition: SVFG.h:106
NodeBS ActualINSVFGNodeSet
Definition: SVFG.h:79
MSSAVarToDefMapTy MSSAVarToDefMap
map a memory SSA operator to its definition SVFG node
Definition: SVFG.h:100
bool hasActualOUTSVFGNodes(const CallICFGNode *cs) const
Definition: SVFG.h:192
virtual void getInterVFEdgeAtIndCSFromFRToAR(const PAGNode *fun_ret, const PAGNode *cs_ret, CallSiteID csId, SVFGEdgeSetTy &edges)
Definition: SVFG.h:319
void addFormalINSVFGNode(const FunEntryICFGNode *funEntry, const MRVer *resVer, const NodeID nodeId)
Add memory Function entry chi SVFG node.
Definition: SVFG.h:403
PointerAnalysis * getPTA() const
Get Pointer Analysis.
Definition: SVFG.h:144
NodeID getDef(const PAGNode *pagNode) const
Definition: SVFG.h:356
void addSVFGNodesForAddrTakenVars()
Create SVFG nodes for address-taken variables.
Definition: SVFG.cpp:255
friend class MTASVFGBuilder
Definition: SVFG.h:72
virtual void getInterVFEdgeAtIndCSFromAPToFP(const PAGNode *cs_arg, const PAGNode *fun_arg, const CallICFGNode *, CallSiteID csId, SVFGEdgeSetTy &edges)
Get inter value flow edges between indirect call site and callee.
Definition: SVFG.h:310
Map< const SVFFunction *, FormalOUTSVFGNodeSet > FunctionToFormalOUTsMapTy
Definition: SVFG.h:86
Map< const MRVer *, NodeID > MSSAVarToDefMapTy
Definition: SVFG.h:78
u32_t getSVFGNodeNum() const
Return total SVFG node number.
Definition: SVFG.h:255
SVFGEdge * addInterIndirectVFRetEdge(const FormalOUTSVFGNode *src, const ActualOUTSVFGNode *dst, CallSiteID csId)
Add inter VF edge from function exit mu to callsite chi.
Definition: SVFG.cpp:560
virtual void connectAInAndFIn(const ActualINSVFGNode *actualIn, const FormalINSVFGNode *formalIn, CallSiteID csId, SVFGEdgeSetTy &edges)
Connect SVFG nodes between caller and callee for indirect call site.
Definition: SVFG.h:293
NodeBS FormalOUTSVFGNodeSet
Definition: SVFG.h:82
void setDef(const PAGNode *pagNode, const SVFGNode *node)
Given a PAGNode, set/get its def SVFG node (definition of top level pointers)
Definition: SVFG.h:352
MemSSA::CALLMU CALLMU
Definition: SVFG.h:97
MemSSA::MUSet MUSet
Definition: SVFG.h:87
SVFGEdge * addIntraIndirectVFEdge(NodeID srcId, NodeID dstId, const NodeBS &cpts)
Add indirect def-use edges of a memory region between two statements,.
Definition: SVFG.cpp:463
MemSSA::STORECHI STORECHI
Definition: SVFG.h:93
const CallICFGNode * isCallSiteRetSVFGNode(const SVFGNode *node) const
Whether a node is callsite return SVFGNode.
Definition: SVFG.cpp:732
bool hasDefSVFGNode(const PAGNode *pagNode) const
Given a pagNode, return whether it has definition site.
Definition: SVFG.h:177
SVFGStat * stat
Definition: SVFG.h:105
bool hasCallSiteChi(const CallICFGNode *cs) const
Definition: SVFG.h:457
void performStat()
Perform statistics.
Definition: SVFG.cpp:758
const SVFFunction * isFunEntrySVFGNode(const SVFGNode *node) const
Whether a node is function entry SVFGNode.
Definition: SVFG.cpp:706
FunctionToFormalINsMapTy funToFormalINMap
Definition: SVFG.h:103
void clearMSSA()
Clear MSSA.
Definition: SVFG.h:132
MemSSA::PHISet PHISet
Definition: SVFG.h:89
virtual void connectCallerAndCallee(const CallICFGNode *cs, const SVFFunction *callee, SVFGEdgeSetTy &edges)
Connect SVFG nodes between caller and callee for indirect call site.
Definition: SVFG.cpp:658
SVFGEdge * addCallIndirectVFEdge(NodeID srcId, NodeID dstId, const NodeBS &cpts, CallSiteID csId)
Definition: SVFG.cpp:505
CallSiteToActualINsMapTy callSiteToActualINMap
Definition: SVFG.h:101
virtual void getInterVFEdgeAtIndCSFromAInToFIn(ActualINSVFGNode *actualIn, const SVFFunction *callee, SVFGEdgeSetTy &edges)
Definition: SVFG.h:328
ICFG * getICFG() const
Definition: SVFIR.h:171
VFGEdge::VFGEdgeSetTy::const_iterator const_iterator
Definition: VFGNode.h:55
Definition: VFG.h:51
void removeVFGNode(VFGNode *node)
Remove a VFGNode.
Definition: VFG.h:326
void setDef(const PAGNode *pagNode, const VFGNode *node)
Given a PAGNode, set/get its def VFG node (definition of top level pointers)
Definition: VFG.h:407
SVFIR * pag
Definition: VFG.h:104
bool hasVFGNode(NodeID id) const
Whether has the VFGNode.
Definition: VFG.h:151
NodeID getDef(const PAGNode *pagNode) const
Definition: VFG.h:420
bool addVFGEdge(VFGEdge *edge)
Add VFG edge.
Definition: VFG.h:339
VFGNode * getVFGNode(NodeID id) const
Get a VFG node.
Definition: VFG.h:145
bool hasDef(const PAGNode *pagNode) const
Definition: VFG.h:426
VFGK
VFG kind.
Definition: VFG.h:56
VFGEdge::SVFGEdgeSetTy SVFGEdgeSetTy
Definition: VFG.h:78
OrderedMap< NodeID, VFGNode * > VFGNodeIDToNodeMapTy
Definition: VFG.h:60
NodeID totalVFGNode
Definition: VFG.h:88
VFGEdge * hasInterVFGEdge(VFGNode *src, VFGNode *dst, VFGEdge::VFGEdgeK kind, CallSiteID csId)
Definition: VFG.cpp:910
virtual void addVFGNode(VFGNode *vfgNode, ICFGNode *icfgNode)
Add a VFG node.
Definition: VFG.h:464
void removeVFGEdge(VFGEdge *edge)
Remove a SVFG edge.
Definition: VFG.h:319
for isBitcode
Definition: BasicTypes.h:68
unsigned CallSiteID
Definition: GeneralType.h:58
InterPHIVFGNode InterPHISVFGNode
Definition: SVFG.h:58
ActualParmVFGNode ActualParmSVFGNode
Definition: SVFG.h:44
StmtVFGNode StmtSVFGNode
Definition: SVFG.h:50
LoadVFGNode LoadSVFGNode
Definition: SVFG.h:54
u32_t NodeID
Definition: GeneralType.h:55
StoreVFGNode StoreSVFGNode
Definition: SVFG.h:53
VFGNode SVFGNode
Definition: SVFG.h:43
GepVFGNode GepSVFGNode
Definition: SVFG.h:55
PHIVFGNode PHISVFGNode
Definition: SVFG.h:56
ActualRetVFGNode ActualRetSVFGNode
Definition: SVFG.h:45
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
Definition: GeneralType.h:101
AddrVFGNode AddrSVFGNode
Definition: SVFG.h:51
VFGEdge SVFGEdge
Definition: SVFG.h:40
CopyVFGNode CopySVFGNode
Definition: SVFG.h:52
unsigned u32_t
Definition: GeneralType.h:46
FormalParmVFGNode FormalParmSVFGNode
Definition: SVFG.h:46
IntraPHIVFGNode IntraPHISVFGNode
Definition: SVFG.h:57
FormalRetVFGNode FormalRetSVFGNode
Definition: SVFG.h:47
NullPtrVFGNode NullPtrSVFGNode
Definition: SVFG.h:49