Static Value-Flow Analysis
Public Types | Public Member Functions | Protected Member Functions | List of all members
SVF::CFLSVFGBuilder Class Reference

#include <CFLSVFGBuilder.h>

Inheritance diagram for SVF::CFLSVFGBuilder:
SVF::SaberSVFGBuilder SVF::SVFGBuilder

Public Types

typedef Set< const SVFGNode * > SVFGNodeSet
 
typedef Map< NodeID, PointsToNodeToPTSSMap
 
typedef FIFOWorkList< NodeIDWorkList
 
- Public Types inherited from SVF::SaberSVFGBuilder
typedef Set< const SVFGNode * > SVFGNodeSet
 
typedef Map< NodeID, PointsToNodeToPTSSMap
 
typedef FIFOWorkList< NodeIDWorkList
 
- Public Types inherited from SVF::SVFGBuilder
typedef PointerAnalysis::CallSiteSet CallSiteSet
 
typedef PointerAnalysis::CallEdgeMap CallEdgeMap
 
typedef PointerAnalysis::FunctionSet FunctionSet
 
typedef SVFG::SVFGEdgeSetTy SVFGEdgeSet
 

Public Member Functions

 CFLSVFGBuilder ()=default
 Constructor. More...
 
virtual ~CFLSVFGBuilder ()=default
 Destructor. More...
 
- Public Member Functions inherited from SVF::SaberSVFGBuilder
 SaberSVFGBuilder ()
 Constructor. More...
 
virtual ~SaberSVFGBuilder ()
 Destructor. More...
 
bool isGlobalSVFGNode (const SVFGNode *node) const
 
void addActualParmVFGNode (const PAGNode *pagNode, const CallICFGNode *cs)
 Add ActualParmVFGNode. More...
 
void setSaberCondAllocator (SaberCondAllocator *allocator)
 
- Public Member Functions inherited from SVF::SVFGBuilder
 SVFGBuilder (bool _SVFGWithIndCall=false)
 Constructor. More...
 
virtual ~SVFGBuilder ()=default
 Destructor. More...
 
SVFGbuildPTROnlySVFG (BVDataPTAImpl *pta)
 
SVFGbuildFullSVFG (BVDataPTAImpl *pta)
 
SVFGgetSVFG () const
 Get SVFG instance. More...
 
void markValidVFEdge (SVFGEdgeSet &edges)
 Mark feasible VF edge by removing it from set vfEdgesAtIndCallSite. More...
 
bool isSpuriousVFEdgeAtIndCallSite (const SVFGEdge *edge)
 Return true if this is an VF Edge pre-connected by Andersen's analysis. More...
 
virtual std::unique_ptr< MemSSAbuildMSSA (BVDataPTAImpl *pta, bool ptrOnlyMSSA)
 Build Memory SSA. More...
 

Protected Member Functions

virtual void buildSVFG ()
 Re-write create SVFG method. More...
 
virtual void rmIncomingEdgeForSUStore (BVDataPTAImpl *pta)
 
- Protected Member Functions inherited from SVF::SaberSVFGBuilder
bool isStrongUpdate (const SVFGNode *node, NodeID &singleton, BVDataPTAImpl *pta)
 Return TRUE if this is a strong update STORE statement. More...
 
void rmDerefDirSVFGEdges (BVDataPTAImpl *pta)
 
virtual void AddExtActualParmSVFGNodes (PTACallGraph *callgraph)
 Add actual parameter SVFGNode for 1st argument of a deallocation like external function. More...
 
void collectGlobals (BVDataPTAImpl *pta)
 
bool accessGlobal (BVDataPTAImpl *pta, const PAGNode *pagNode)
 Whether points-to of a PAGNode points-to global variable. More...
 
PointsToCollectPtsChain (BVDataPTAImpl *pta, NodeID id, NodeToPTSSMap &cachedPtsMap)
 Collect objects along points-to chains. More...
 
- Protected Member Functions inherited from SVF::SVFGBuilder
SVFGbuild (BVDataPTAImpl *pta, VFG::VFGK kind)
 Create a DDA SVFG. By default actualOut and FormalIN are removed, unless withAOFI is set true. More...
 
virtual void releaseMemory ()
 Release global SVFG. More...
 

Additional Inherited Members

- Protected Attributes inherited from SVF::SaberSVFGBuilder
PointsTo globs
 
SVFGNodeSet globSVFGNodes
 Store all global SVFG nodes. More...
 
SaberCondAllocatorsaberCondAllocator
 
- Protected Attributes inherited from SVF::SVFGBuilder
SVFGEdgeSet vfEdgesAtIndCallSite
 SVFG Edges connected at indirect call/ret sites. More...
 
std::unique_ptr< SVFGsvfg
 
bool SVFGWithIndCall
 SVFG with precomputed indirect call edges. More...
 

Detailed Description

Definition at line 35 of file CFLSVFGBuilder.h.

Member Typedef Documentation

◆ NodeToPTSSMap

Definition at line 39 of file CFLSVFGBuilder.h.

◆ SVFGNodeSet

Definition at line 38 of file CFLSVFGBuilder.h.

◆ WorkList

Definition at line 40 of file CFLSVFGBuilder.h.

Constructor & Destructor Documentation

◆ CFLSVFGBuilder()

SVF::CFLSVFGBuilder::CFLSVFGBuilder ( )
default

Constructor.

◆ ~CFLSVFGBuilder()

virtual SVF::CFLSVFGBuilder::~CFLSVFGBuilder ( )
virtualdefault

Destructor.

Member Function Documentation

◆ buildSVFG()

void CFLSVFGBuilder::buildSVFG ( )
protectedvirtual

Re-write create SVFG method.

Reimplemented from SVF::SaberSVFGBuilder.

Definition at line 35 of file CFLSVFGBuilder.cpp.

36 {
37 
38  MemSSA* mssa = svfg->getMSSA();
39  svfg->buildSVFG();
40  BVDataPTAImpl* pta = mssa->getPTA();
41  DBOUT(DGENERAL, outs() << pasMsg("\tCollect Global Variables\n"));
42 
43  collectGlobals(pta);
44 
45  DBOUT(DGENERAL, outs() << pasMsg("\tRemove Dereference Direct SVFG Edge\n"));
46 
48 
50 
51  DBOUT(DGENERAL, outs() << pasMsg("\tAdd Sink SVFG Nodes\n"));
52 
54 
55  if(pta->printStat())
56  svfg->performStat();
57 }
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
Definition: SVFType.h:484
#define DGENERAL
Definition: SVFType.h:490
virtual void rmIncomingEdgeForSUStore(BVDataPTAImpl *pta)
BVDataPTAImpl * getPTA() const
Return PTA.
Definition: MemSSA.h:308
bool printStat()
Whether print statistics.
PTACallGraph * getCallGraph() const
Return call graph.
std::unique_ptr< SVFG > svfg
Definition: SVFGBuilder.h:91
void collectGlobals(BVDataPTAImpl *pta)
virtual void AddExtActualParmSVFGNodes(PTACallGraph *callgraph)
Add actual parameter SVFGNode for 1st argument of a deallocation like external function.
void rmDerefDirSVFGEdges(BVDataPTAImpl *pta)
std::string pasMsg(const std::string &msg)
Print each pass/phase message by converting a string into blue string output.
Definition: SVFUtil.cpp:99
std::ostream & outs()
Overwrite llvm::outs()
Definition: SVFUtil.h:50

◆ rmIncomingEdgeForSUStore()

void CFLSVFGBuilder::rmIncomingEdgeForSUStore ( BVDataPTAImpl pta)
protectedvirtual

Remove Incoming Edge for strong-update (SU) store instruction Because the SU node does not receive indirect value

Remove Incoming Edge for strong-update (SU) store instruction Because the SU node does not receive indirect value

e.g., L1: *p = O; (singleton) L2: *p = _; (SU here) We should remove the indirect value flow L1 -> L2 Because the points-to set of O from L1 does not pass to that after L2

Reimplemented from SVF::SaberSVFGBuilder.

Definition at line 70 of file CFLSVFGBuilder.cpp.

71 {
72 
73  for(SVFG::iterator it = svfg->begin(), eit = svfg->end(); it!=eit; ++it)
74  {
75  const SVFGNode* node = it->second;
76 
77  if(const StoreSVFGNode* stmtNode = SVFUtil::dyn_cast<StoreSVFGNode>(node))
78  {
79  if(SVFUtil::isa<StoreStmt>(stmtNode->getPAGEdge()))
80  {
81  NodeID singleton;
82  if(isStrongUpdate(node, singleton, pta))
83  {
84  Set<SVFGEdge*> toRemove;
85  for (SVFGNode::const_iterator it2 = node->InEdgeBegin(), eit2 = node->InEdgeEnd(); it2 != eit2; ++it2)
86  {
87  if ((*it2)->isIndirectVFGEdge())
88  {
89  toRemove.insert(*it2);
90  }
91  }
92  for (SVFGEdge* edge: toRemove)
93  {
94  svfg->removeSVFGEdge(edge);
95  }
96  }
97  }
98  }
99  }
100 }
iterator InEdgeBegin()
Definition: GenericGraph.h:462
iterator InEdgeEnd()
Definition: GenericGraph.h:466
bool isStrongUpdate(const SVFGNode *node, NodeID &singleton, BVDataPTAImpl *pta)
Return TRUE if this is a strong update STORE statement.
VFGEdge::VFGEdgeSetTy::const_iterator const_iterator
Definition: VFGNode.h:55
VFGNodeIDToNodeMapTy::iterator iterator
Definition: VFG.h:80
u32_t NodeID
Definition: GeneralType.h:55
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
Definition: GeneralType.h:96

The documentation for this class was generated from the following files: