Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
SVF::SVFG Class Reference

#include <SVFG.h>

Inheritance diagram for SVF::SVFG:
SVF::VFG SVF::GenericGraph< NodeTy, EdgeTy > SVF::SVFGOPT

Public Types

typedef VFGNodeIDToNodeMapTy SVFGNodeIDToNodeMapTy
 
typedef Map< const ValVar *, NodeIDValVarToDefMapTy
 
typedef Map< const MRVer *, NodeIDMSSAVarToDefMapTy
 
typedef NodeBS ActualINSVFGNodeSet
 
typedef NodeBS ActualOUTSVFGNodeSet
 
typedef NodeBS FormalINSVFGNodeSet
 
typedef NodeBS FormalOUTSVFGNodeSet
 
typedef Map< const CallICFGNode *, ActualINSVFGNodeSetCallSiteToActualINsMapTy
 
typedef Map< const CallICFGNode *, ActualOUTSVFGNodeSetCallSiteToActualOUTsMapTy
 
typedef Map< const FunObjVar *, FormalINSVFGNodeSetFunctionToFormalINsMapTy
 
typedef Map< const FunObjVar *, FormalOUTSVFGNodeSetFunctionToFormalOUTsMapTy
 
typedef MemSSA::MUSet MUSet
 
typedef MemSSA::CHISet CHISet
 
typedef MemSSA::PHISet PHISet
 
typedef MemSSA::MU MU
 
typedef MemSSA::CHI CHI
 
typedef MemSSA::LOADMU LOADMU
 
typedef MemSSA::STORECHI STORECHI
 
typedef MemSSA::RETMU RETMU
 
typedef MemSSA::ENTRYCHI ENTRYCHI
 
typedef MemSSA::CALLCHI CALLCHI
 
typedef MemSSA::CALLMU CALLMU
 
- Public Types inherited from SVF::VFG
enum  VFGK { FULLSVFG , PTRONLYSVFG , FULLSVFG_OPT , PTRONLYSVFG_OPT }
 VFG kind. More...
 
typedef OrderedMap< NodeID, VFGNode * > VFGNodeIDToNodeMapTy
 
typedef Set< VFGNode * > VFGNodeSet
 
typedef Map< const ValVar *, NodeIDValVarToDefMapTy
 
typedef Map< std::pair< NodeID, const CallICFGNode * >, ActualParmVFGNode * > SVFVarToActualParmMapTy
 
typedef Map< const SVFVar *, ActualRetVFGNode * > SVFVarToActualRetMapTy
 
typedef Map< const SVFVar *, FormalParmVFGNode * > SVFVarToFormalParmMapTy
 
typedef Map< const SVFVar *, FormalRetVFGNode * > SVFVarToFormalRetMapTy
 
typedef Map< const SVFStmt *, StmtVFGNode * > SVFStmtToStmtVFGNodeMapTy
 
typedef Map< const SVFVar *, IntraPHIVFGNode * > SVFVarToPHIVFGNodeMapTy
 
typedef Map< const SVFVar *, BinaryOPVFGNode * > SVFVarToBinaryOPVFGNodeMapTy
 
typedef Map< const SVFVar *, UnaryOPVFGNode * > SVFVarToUnaryOPVFGNodeMapTy
 
typedef Map< const SVFVar *, BranchVFGNode * > SVFVarToBranchVFGNodeMapTy
 
typedef Map< const SVFVar *, CmpVFGNode * > SVFVarToCmpVFGNodeMapTy
 
typedef Map< const FunObjVar *, VFGNodeSetFunToVFGNodesMapTy
 
typedef FormalParmVFGNode::CallPESet CallPESet
 
typedef FormalRetVFGNode::RetPESet RetPESet
 
typedef VFGEdge::VFGEdgeSetTy VFGEdgeSetTy
 
typedef VFGEdge::SVFGEdgeSetTy SVFGEdgeSetTy
 
typedef VFGEdge::VFGEdgeSetTy::iterator VFGNodeIter
 
typedef VFGNodeIDToNodeMapTy::iterator iterator
 
typedef VFGNodeIDToNodeMapTy::const_iterator const_iterator
 
typedef SVFIR::SVFStmtSet SVFStmtSet
 
typedef Set< const VFGNode * > GlobalVFGNodeSet
 
typedef Set< const SVFVar * > SVFVarSet
 
- Public Types inherited from SVF::GenericGraph< NodeTy, EdgeTy >
typedef NodeTy NodeType
 
typedef EdgeTy EdgeType
 
typedef OrderedMap< NodeID, NodeType * > IDToNodeMapTy
 NodeID to GenericNode map.
 
typedef IDToNodeMapTy::iterator iterator
 Node Iterators.
 
typedef IDToNodeMapTy::const_iterator const_iterator
 

Public Member Functions

virtual ~SVFG ()
 Destructor.
 
SVFGStatgetStat () const
 Return statistics.
 
void clearMSSA ()
 Clear MSSA.
 
MemSSAgetMSSA () const
 Get SVFG memory SSA.
 
PointerAnalysisgetPTA () const
 Get Pointer Analysis.
 
SVFGNodegetSVFGNode (NodeID id) const
 Get a SVFG node.
 
bool hasSVFGNode (NodeID id) const
 Whether has the SVFGNode.
 
void getInterVFEdgesForIndirectCallSite (const CallICFGNode *cs, const FunObjVar *callee, SVFGEdgeSetTy &edges)
 Get all inter value flow edges of a indirect call site.
 
void dump (const std::string &file, bool simple=false)
 Dump graph into dot file.
 
virtual void connectCallerAndCallee (const CallICFGNode *cs, const FunObjVar *callee, SVFGEdgeSetTy &edges)
 Connect SVFG nodes between caller and callee for indirect call site.
 
const SVFGNodegetDefSVFGNode (const ValVar *valVar) const
 Given a valVar, return its definition site.
 
bool hasDefSVFGNode (const ValVar *valVar) const
 Given a valVar, return whether it has definition site.
 
const ICFGNodegetDefSiteOfValVar (const ValVar *var) const
 
const ICFGNodegetDefSiteOfObjVar (const ObjVar *obj, const ICFGNode *node) const
 
const Set< const ICFGNode * > getUseSitesOfValVar (const ValVar *var) const
 
const Set< const ICFGNode * > getUseSitesOfObjVar (const ObjVar *obj, const ICFGNode *node) const
 
void performStat ()
 Perform statistics.
 
bool hasActualINSVFGNodes (const CallICFGNode *cs) const
 Has a SVFGNode.
 
bool hasActualOUTSVFGNodes (const CallICFGNode *cs) const
 
bool hasFormalINSVFGNodes (const FunObjVar *fun) const
 
bool hasFormalOUTSVFGNodes (const FunObjVar *fun) const
 
ActualINSVFGNodeSetgetActualINSVFGNodes (const CallICFGNode *cs)
 Get SVFGNode set.
 
ActualOUTSVFGNodeSetgetActualOUTSVFGNodes (const CallICFGNode *cs)
 
FormalINSVFGNodeSetgetFormalINSVFGNodes (const FunObjVar *fun)
 
FormalOUTSVFGNodeSetgetFormalOUTSVFGNodes (const FunObjVar *fun)
 
const FunObjVarisFunEntrySVFGNode (const SVFGNode *node) const
 Whether a node is function entry SVFGNode.
 
const CallICFGNodeisCallSiteRetSVFGNode (const SVFGNode *node) const
 Whether a node is callsite return SVFGNode.
 
void removeSVFGEdge (SVFGEdge *edge)
 Remove a SVFG edge.
 
void removeSVFGNode (SVFGNode *node)
 Remove a SVFGNode.
 
bool addSVFGEdge (SVFGEdge *edge)
 Add SVFG edge.
 
u32_t getSVFGNodeNum () const
 Return total SVFG node number.
 
const DummyVersionPropSVFGNodeaddDummyVersionPropSVFGNode (const NodeID object, const NodeID version)
 
virtual void writeToFile (const std::string &filename)
 
virtual void readFile (const std::string &filename)
 
virtual MRVergetMRVERFromString (const std::string &input)
 
- Public Member Functions inherited from SVF::VFG
 VFG (CallGraph *callgraph, VFGK k=FULLSVFG)
 Constructor.
 
virtual ~VFG ()
 Destructor.
 
VFGK getKind () const
 Get VFG kind.
 
bool isPtrOnlySVFG () const
 Return true if this VFG only contains pointer related SVFGNodes for pointer analysis.
 
SVFIRgetPAG () const
 Return SVFIR.
 
CallGraphgetCallGraph () const
 Return PTACallGraph.
 
VFGNodegetVFGNode (NodeID id) const
 Get a VFG node.
 
bool hasVFGNode (NodeID id) const
 Whether has the VFGNode.
 
GlobalVFGNodeSetgetGlobalVFGNodes ()
 Return global stores.
 
VFGEdgegetIntraVFGEdge (const VFGNode *src, const VFGNode *dst, VFGEdge::VFGEdgeK kind)
 Get a SVFG edge according to src and dst.
 
void dump (const std::string &file, bool simple=false)
 Dump graph into dot file.
 
void view ()
 Dump graph into dot file.
 
void updateCallGraph (PointerAnalysis *pta)
 Update VFG based on pointer analysis results.
 
CallSiteID getCallSiteID (const CallICFGNode *cs, const FunObjVar *func) const
 Get callsite given a callsiteID.
 
const CallICFGNodegetCallSite (CallSiteID id) const
 
const VFGNodegetDefVFGNode (const ValVar *valVar) const
 Given a valVar, return its definition site.
 
bool hasLHSTopLevPtr (const VFGNode *node) const
 
const SVFVargetLHSTopLevPtr (const VFGNode *node) const
 
bool hasStmtVFGNode (const SVFStmt *svfStmt) const
 Existence checks for VFGNodes.
 
bool hasIntraPHIVFGNode (const SVFVar *svfVar) const
 
bool hasBinaryOPVFGNode (const SVFVar *svfVar) const
 
bool hasUnaryOPVFGNode (const SVFVar *svfVar) const
 
bool hasBranchVFGNode (const SVFVar *svfVar) const
 
bool hasCmpVFGNode (const SVFVar *svfVar) const
 
bool hasActualParmVFGNode (const SVFVar *aparm, const CallICFGNode *cs) const
 
bool hasActualRetVFGNode (const SVFVar *aret) const
 
bool hasFormalParmVFGNode (const SVFVar *fparm) const
 
bool hasFormalRetVFGNode (const SVFVar *fret) const
 
StmtVFGNodegetStmtVFGNode (const SVFStmt *svfStmt) const
 Get an VFGNode.
 
IntraPHIVFGNodegetIntraPHIVFGNode (const SVFVar *svfVar) const
 
BinaryOPVFGNodegetBinaryOPVFGNode (const SVFVar *svfVar) const
 
UnaryOPVFGNodegetUnaryOPVFGNode (const SVFVar *svfVar) const
 
BranchVFGNodegetBranchVFGNode (const SVFVar *svfVar) const
 
CmpVFGNodegetCmpVFGNode (const SVFVar *svfVar) const
 
ActualParmVFGNodegetActualParmVFGNode (const SVFVar *aparm, const CallICFGNode *cs) const
 
ActualRetVFGNodegetActualRetVFGNode (const SVFVar *aret) const
 
FormalParmVFGNodegetFormalParmVFGNode (const SVFVar *fparm) const
 
FormalRetVFGNodegetFormalRetVFGNode (const SVFVar *fret) const
 
const FunObjVarisFunEntryVFGNode (const VFGNode *node) const
 Whether a node is function entry VFGNode.
 
bool hasBlackHoleConstObjAddrAsDef (const ValVar *valVar) const
 Whether a SVFVar has a blackhole or const object as its definition.
 
VFGEdgeaddIntraDirectVFEdge (NodeID srcId, NodeID dstId)
 
VFGEdgeaddCallEdge (NodeID srcId, NodeID dstId, CallSiteID csId)
 
VFGEdgeaddRetEdge (NodeID srcId, NodeID dstId, CallSiteID csId)
 
void removeVFGEdge (VFGEdge *edge)
 Remove a SVFG edge.
 
void removeVFGNode (VFGNode *node)
 Remove a VFGNode.
 
VFGEdgehasIntraVFGEdge (VFGNode *src, VFGNode *dst, VFGEdge::VFGEdgeK kind)
 Whether we has a SVFG edge.
 
VFGEdgehasInterVFGEdge (VFGNode *src, VFGNode *dst, VFGEdge::VFGEdgeK kind, CallSiteID csId)
 
VFGEdgehasThreadVFGEdge (VFGNode *src, VFGNode *dst, VFGEdge::VFGEdgeK kind)
 
bool addVFGEdge (VFGEdge *edge)
 Add VFG edge.
 
VFGNodeSetgetVFGNodes (const FunObjVar *fun)
 
bool hasVFGNodes (const FunObjVar *fun) const
 
bool VFGNodes (const FunObjVar *fun) const
 
VFGNodeSet::const_iterator getVFGNodeBegin (const FunObjVar *fun) const
 
VFGNodeSet::const_iterator getVFGNodeEnd (const FunObjVar *fun) const
 
- Public Member Functions inherited from SVF::GenericGraph< NodeTy, EdgeTy >
 GenericGraph ()
 Constructor.
 
virtual ~GenericGraph ()
 Destructor.
 
void destroy ()
 Release memory.
 
iterator begin ()
 Iterators.
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
void addGNode (NodeID id, NodeType *node)
 Add a Node.
 
NodeTypegetGNode (NodeID id) const
 Get a node.
 
bool hasGNode (NodeID id) const
 Has a node.
 
void removeGNode (NodeType *node)
 Delete a node.
 
u32_t getTotalNodeNum () const
 Get total number of node/edge.
 
u32_t getTotalEdgeNum () const
 
void incNodeNum ()
 Increase number of node/edge.
 
void incEdgeNum ()
 

Protected Member Functions

void destroy ()
 Clean up memory.
 
 SVFG (std::unique_ptr< MemSSA > mssa, VFGK k)
 Constructor.
 
virtual void buildSVFG ()
 Start building SVFG.
 
SVFGEdgeaddIntraIndirectVFEdge (NodeID srcId, NodeID dstId, const NodeBS &cpts)
 Add indirect def-use edges of a memory region between two statements,.
 
SVFGEdgeaddCallIndirectVFEdge (NodeID srcId, NodeID dstId, const NodeBS &cpts, CallSiteID csId)
 
SVFGEdgeaddRetIndirectVFEdge (NodeID srcId, NodeID dstId, const NodeBS &cpts, CallSiteID csId)
 
SVFGEdgeaddThreadMHPIndirectVFEdge (NodeID srcId, NodeID dstId, const NodeBS &cpts)
 
SVFGEdgeaddInterIndirectVFCallEdge (const ActualINSVFGNode *src, const FormalINSVFGNode *dst, CallSiteID csId)
 Add inter VF edge from callsite mu to function entry chi.
 
SVFGEdgeaddInterIndirectVFRetEdge (const FormalOUTSVFGNode *src, const ActualOUTSVFGNode *dst, CallSiteID csId)
 Add inter VF edge from function exit mu to callsite chi.
 
virtual void connectAInAndFIn (const ActualINSVFGNode *actualIn, const FormalINSVFGNode *formalIn, CallSiteID csId, SVFGEdgeSetTy &edges)
 Connect SVFG nodes between caller and callee for indirect call site.
 
virtual void connectFOutAndAOut (const FormalOUTSVFGNode *formalOut, const ActualOUTSVFGNode *actualOut, CallSiteID csId, SVFGEdgeSetTy &edges)
 Connect formal-out and actual-out.
 
virtual void getInterVFEdgeAtIndCSFromAPToFP (const ValVar *cs_arg, const ValVar *fun_arg, const CallICFGNode *, CallSiteID csId, SVFGEdgeSetTy &edges)
 Get inter value flow edges between indirect call site and callee.
 
virtual void getInterVFEdgeAtIndCSFromFRToAR (const ValVar *fun_ret, const ValVar *cs_ret, CallSiteID csId, SVFGEdgeSetTy &edges)
 
virtual void getInterVFEdgeAtIndCSFromAInToFIn (ActualINSVFGNode *actualIn, const FunObjVar *callee, SVFGEdgeSetTy &edges)
 
virtual void getInterVFEdgeAtIndCSFromFOutToAOut (ActualOUTSVFGNode *actualOut, const FunObjVar *callee, SVFGEdgeSetTy &edges)
 
void setDef (const ValVar *valVar, const SVFGNode *node)
 Given a ValVar, set/get its def SVFG node (definition of top level pointers)
 
NodeID getDef (const ValVar *valVar) const
 
bool hasDef (const ValVar *valVar) const
 
void setDef (const MRVer *mvar, const SVFGNode *node)
 Given a MSSADef, set/get its def SVFG node (definition of address-taken variables)
 
NodeID getDef (const MRVer *mvar) const
 
void addSVFGNodesForAddrTakenVars ()
 Create SVFG nodes for address-taken variables.
 
void connectIndirectSVFGEdges ()
 Connect direct SVFG edges between two SVFG nodes (value-flow of top address-taken variables)
 
void connectFromGlobalToProgEntry ()
 Connect indirect SVFG edges from global initializers (store) to main function entry.
 
virtual void addSVFGNode (SVFGNode *node, ICFGNode *icfgNode)
 Add SVFG node.
 
void addFormalINSVFGNode (const FunEntryICFGNode *funEntry, const MRVer *resVer, const NodeID nodeId)
 Add memory Function entry chi SVFG node.
 
void addFormalOUTSVFGNode (const FunExitICFGNode *funExit, const MRVer *ver, const NodeID nodeId)
 Add memory Function return mu SVFG node.
 
void addActualINSVFGNode (const CallICFGNode *callsite, const MRVer *ver, const NodeID nodeId)
 Add memory callsite mu SVFG node.
 
void addActualOUTSVFGNode (const CallICFGNode *callsite, const MRVer *resVer, const NodeID nodeId)
 Add memory callsite chi SVFG node.
 
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.
 
bool hasFuncEntryChi (const FunObjVar *func) const
 Has function for EntryCHI/RetMU/CallCHI/CallMU.
 
bool hasFuncRetMu (const FunObjVar *func) const
 
bool hasCallSiteChi (const CallICFGNode *cs) const
 
bool hasCallSiteMu (const CallICFGNode *cs) const
 
- Protected Member Functions inherited from SVF::VFG
void destroy ()
 Clean up memory.
 
void checkIntraEdgeParents (const VFGNode *srcNode, const VFGNode *dstNode)
 sanitize Intra edges, verify that both nodes belong to the same function.
 
VFGEdgeaddInterEdgeFromAPToFP (ActualParmVFGNode *src, FormalParmVFGNode *dst, CallSiteID csId)
 Add inter VF edge from actual to formal parameters.
 
VFGEdgeaddInterEdgeFromFRToAR (FormalRetVFGNode *src, ActualRetVFGNode *dst, CallSiteID csId)
 Add inter VF edge from callee return to callsite receive parameter.
 
VFGEdgeaddInterEdgeFromAPToFP (NodeID src, NodeID dst, CallSiteID csId)
 Add inter VF edge from actual to formal parameters.
 
VFGEdgeaddInterEdgeFromFRToAR (NodeID src, NodeID dst, CallSiteID csId)
 Add inter VF edge from callee return to callsite receive parameter.
 
virtual void connectAParamAndFParam (const ValVar *csArg, const ValVar *funArg, const CallICFGNode *cbn, CallSiteID csId, VFGEdgeSetTy &edges)
 Connect VFG nodes between caller and callee for indirect call site.
 
virtual void connectFRetAndARet (const ValVar *funReturn, const ValVar *csReturn, CallSiteID csId, VFGEdgeSetTy &edges)
 Connect formal-ret and actual ret.
 
void setDef (const ValVar *valVar, const VFGNode *node)
 Given a ValVar, set/get its def VFG node (definition of top level pointers)
 
NodeID getDef (const ValVar *valVar) const
 
bool hasDef (const ValVar *valVar) const
 
void addVFGNodes ()
 Create VFG nodes.
 
virtual SVFStmt::SVFStmtSetTygetSVFStmtSet (SVFStmt::PEDGEK kind)
 Get SVFStmt set.
 
virtual bool isInterestedSVFVar (const SVFVar *node) const
 
void connectDirectVFGEdges ()
 Create edges between VFG nodes within a function.
 
void addVFGInterEdges (const CallICFGNode *cs, const FunObjVar *callee)
 Create edges between VFG nodes across functions.
 
bool isPhiCopyEdge (const SVFStmt *copy) const
 
virtual void addVFGNode (VFGNode *vfgNode, ICFGNode *icfgNode)
 Add a VFG node.
 
void addStmtVFGNode (StmtVFGNode *node, const SVFStmt *svfStmt)
 Add a VFG node for program statement.
 
void addNullPtrVFGNode (const ValVar *svfVar)
 
void addAddrVFGNode (const AddrStmt *addr)
 Add an Address VFG node.
 
void addCopyVFGNode (const CopyStmt *copy)
 Add a Copy VFG node.
 
void addGepVFGNode (const GepStmt *gep)
 Add a Gep VFG node.
 
void addLoadVFGNode (const LoadStmt *load)
 Add a Load VFG node.
 
void addStoreVFGNode (const StoreStmt *store)
 
void addActualParmVFGNode (const ValVar *aparm, const CallICFGNode *cs)
 
void addFormalParmVFGNode (const ValVar *fparm, const FunObjVar *fun, CallPESet &callPEs)
 Add a formal parameter VFG node.
 
void addFormalRetVFGNode (const ValVar *uniqueFunRet, const FunObjVar *fun, RetPESet &retPEs)
 
void addActualRetVFGNode (const ValVar *ret, const CallICFGNode *cs)
 Add a callsite Receive VFG node.
 
void addIntraPHIVFGNode (const MultiOpndStmt *edge)
 Add an llvm PHI VFG node.
 
void addCmpVFGNode (const CmpStmt *edge)
 Add a Compare VFG node.
 
void addBinaryOPVFGNode (const BinaryOPStmt *edge)
 Add a BinaryOperator VFG node.
 
void addUnaryOPVFGNode (const UnaryOPStmt *edge)
 Add a UnaryOperator VFG node.
 
void addBranchVFGNode (const BranchStmt *edge)
 Add a BranchVFGNode.
 

Protected Attributes

MSSAVarToDefMapTy MSSAVarToDefMap
 map a memory SSA operator to its definition SVFG node
 
CallSiteToActualINsMapTy callSiteToActualINMap
 
CallSiteToActualOUTsMapTy callSiteToActualOUTMap
 
FunctionToFormalINsMapTy funToFormalINMap
 
FunctionToFormalOUTsMapTy funToFormalOUTMap
 
SVFGStatstat
 
std::unique_ptr< MemSSAmssa
 
PointerAnalysispta
 
- Protected Attributes inherited from SVF::VFG
NodeID totalVFGNode
 
ValVarToDefMapTy ValVarToDefMap
 map a pag node to its definition SVG node
 
SVFVarToActualParmMapTy SVFVarToActualParmMap
 map a SVFVar to an actual parameter
 
SVFVarToActualRetMapTy SVFVarToActualRetMap
 map a SVFVar to an actual return
 
SVFVarToFormalParmMapTy SVFVarToFormalParmMap
 map a SVFVar to a formal parameter
 
SVFVarToFormalRetMapTy SVFVarToFormalRetMap
 map a SVFVar to a formal return
 
SVFVarToPHIVFGNodeMapTy SVFVarToIntraPHIVFGNodeMap
 map a SVFVar to its PHIVFGNode
 
SVFVarToBinaryOPVFGNodeMapTy SVFVarToBinaryOPVFGNodeMap
 map a SVFVar to its BinaryOPVFGNode
 
SVFVarToUnaryOPVFGNodeMapTy SVFVarToUnaryOPVFGNodeMap
 map a SVFVar to its UnaryOPVFGNode
 
SVFVarToBranchVFGNodeMapTy SVFVarToBranchVFGNodeMap
 map a SVFVar to its BranchVFGNode
 
SVFVarToCmpVFGNodeMapTy SVFVarToCmpVFGNodeMap
 map a SVFVar to its CmpVFGNode
 
SVFStmtToStmtVFGNodeMapTy SVFStmtToStmtVFGNodeMap
 map a SVFStmt to its StmtVFGNode
 
FunToVFGNodesMapTy funToVFGNodesMap
 map a function to its VFGNodes;
 
GlobalVFGNodeSet globalVFGNodes
 set of global store VFG nodes
 
CallGraphcallgraph
 
SVFIRpag
 
VFGK kind
 
- Protected Attributes inherited from SVF::GenericGraph< NodeTy, EdgeTy >
IDToNodeMapTy IDToNodeMap
 node map
 

Friends

class SVFGBuilder
 
class SaberSVFGBuilder
 
class CFLSVFGBuilder
 
class TaintSVFGBuilder
 
class DDASVFGBuilder
 
class MTASVFGBuilder
 
class RcSvfgBuilder
 

Additional Inherited Members

- Public Attributes inherited from SVF::GenericGraph< NodeTy, EdgeTy >
u32_t edgeNum
 total num of node
 
u32_t nodeNum
 total num of edge
 

Detailed Description

Sparse value flow graph Each node stands for a definition, each edge stands for value flow relations

Definition at line 65 of file SVFG.h.

Member Typedef Documentation

◆ ActualINSVFGNodeSet

Definition at line 79 of file SVFG.h.

◆ ActualOUTSVFGNodeSet

Definition at line 80 of file SVFG.h.

◆ CALLCHI

Definition at line 96 of file SVFG.h.

◆ CALLMU

Definition at line 97 of file SVFG.h.

◆ CallSiteToActualINsMapTy

Definition at line 83 of file SVFG.h.

◆ CallSiteToActualOUTsMapTy

Definition at line 84 of file SVFG.h.

◆ CHI

Definition at line 91 of file SVFG.h.

◆ CHISet

Definition at line 88 of file SVFG.h.

◆ ENTRYCHI

Definition at line 95 of file SVFG.h.

◆ FormalINSVFGNodeSet

Definition at line 81 of file SVFG.h.

◆ FormalOUTSVFGNodeSet

Definition at line 82 of file SVFG.h.

◆ FunctionToFormalINsMapTy

Definition at line 85 of file SVFG.h.

◆ FunctionToFormalOUTsMapTy

Definition at line 86 of file SVFG.h.

◆ LOADMU

Definition at line 92 of file SVFG.h.

◆ MSSAVarToDefMapTy

Definition at line 78 of file SVFG.h.

◆ MU

Definition at line 90 of file SVFG.h.

◆ MUSet

Definition at line 87 of file SVFG.h.

◆ PHISet

Definition at line 89 of file SVFG.h.

◆ RETMU

Definition at line 94 of file SVFG.h.

◆ STORECHI

Definition at line 93 of file SVFG.h.

◆ SVFGNodeIDToNodeMapTy

Definition at line 76 of file SVFG.h.

◆ ValVarToDefMapTy

Definition at line 77 of file SVFG.h.

Constructor & Destructor Documentation

◆ SVFG()

SVFG::SVFG ( std::unique_ptr< MemSSA mssa,
VFGK  k 
)
protected

Constructor.

Constructor

Definition at line 204 of file SVFG.cpp.

204 : VFG(mssa->getPTA()->getCallGraph(),k),mssa(std::move(mssa)), pta(this->mssa->getPTA())
205{
206 stat = new SVFGStat(this);
207}
PointerAnalysis * pta
Definition SVFG.h:107
std::unique_ptr< MemSSA > mssa
Definition SVFG.h:106
SVFGStat * stat
Definition SVFG.h:105
Definition VFG.h:51
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ ~SVFG()

virtual SVF::SVFG::~SVFG ( )
inlinevirtual

Destructor.

Definition at line 120 of file SVFG.h.

121 {
122 destroy();
123 }
void destroy()
Clean up memory.
Definition SVFG.cpp:212

Member Function Documentation

◆ addActualINSVFGNode()

void SVF::SVFG::addActualINSVFGNode ( const CallICFGNode callsite,
const MRVer ver,
const NodeID  nodeId 
)
inlineprotected

Add memory callsite mu SVFG node.

Definition at line 436 of file SVFG.h.

437 {
438 ActualINSVFGNode* sNode = new ActualINSVFGNode(nodeId, callsite, ver);
439 addSVFGNode(sNode, const_cast<CallICFGNode*>(callsite));
440 callSiteToActualINMap[callsite].set(sNode->getId());
441 }
virtual void addSVFGNode(SVFGNode *node, ICFGNode *icfgNode)
Add SVFG node.
Definition SVFG.h:413
CallSiteToActualINsMapTy callSiteToActualINMap
Definition SVFG.h:101

◆ addActualOUTSVFGNode()

void SVF::SVFG::addActualOUTSVFGNode ( const CallICFGNode callsite,
const MRVer resVer,
const NodeID  nodeId 
)
inlineprotected

Add memory callsite chi SVFG node.

Definition at line 444 of file SVFG.h.

445 {
446 ActualOUTSVFGNode* sNode = new ActualOUTSVFGNode(nodeId, callsite, resVer);
447 addSVFGNode(sNode,const_cast<RetICFGNode*>(callsite->getRetICFGNode()));
448 setDef(resVer,sNode);
449 callSiteToActualOUTMap[callsite].set(sNode->getId());
450 }
CallSiteToActualOUTsMapTy callSiteToActualOUTMap
Definition SVFG.h:102
void setDef(const ValVar *valVar, const SVFGNode *node)
Given a ValVar, set/get its def SVFG node (definition of top level pointers)
Definition SVFG.h:368

◆ addCallIndirectVFEdge()

SVFGEdge * SVFG::addCallIndirectVFEdge ( NodeID  srcId,
NodeID  dstId,
const NodeBS cpts,
CallSiteID  csId 
)
protected

Definition at line 505 of file SVFG.cpp.

506{
510 {
511 assert(SVFUtil::isa<CallIndSVFGEdge>(edge) && "this should be a indirect value flow edge!");
512 return (SVFUtil::cast<CallIndSVFGEdge>(edge)->addPointsTo(cpts) ? edge : nullptr);
513 }
514 else
515 {
517 callEdge->addPointsTo(cpts);
518 return (addSVFGEdge(callEdge) ? callEdge : nullptr);
519 }
520}
SVFGNode * getSVFGNode(NodeID id) const
Get a SVFG node.
Definition SVFG.h:150
bool addSVFGEdge(SVFGEdge *edge)
Add SVFG edge.
Definition SVFG.h:265
VFGEdge * hasInterVFGEdge(VFGNode *src, VFGNode *dst, VFGEdge::VFGEdgeK kind, CallSiteID csId)
Definition VFG.cpp:894

◆ addDummyVersionPropSVFGNode()

const DummyVersionPropSVFGNode * SVF::SVFG::addDummyVersionPropSVFGNode ( const NodeID  object,
const NodeID  version 
)
inline

Used only for Versioned FSPTA to encode propagation of versions in the worklist (allowing for breadth-first propagation). Returns the created node.

Definition at line 279 of file SVFG.h.

280 {
281 DummyVersionPropSVFGNode *dvpNode = new DummyVersionPropSVFGNode(totalVFGNode++, object, version);
282 // Not going through add[S]VFGNode because we have no ICFG edge.
283 addGNode(dvpNode->getId(), dvpNode);
284 return dvpNode;
285 }
void addGNode(NodeID id, NodeType *node)
Add a Node.
NodeID totalVFGNode
Definition VFG.h:88

◆ addFormalINSVFGNode()

void SVF::SVFG::addFormalINSVFGNode ( const FunEntryICFGNode funEntry,
const MRVer resVer,
const NodeID  nodeId 
)
inlineprotected

Add memory Function entry chi SVFG node.

Definition at line 419 of file SVFG.h.

420 {
421 FormalINSVFGNode* sNode = new FormalINSVFGNode(nodeId, resVer, funEntry);
423 setDef(resVer,sNode);
424 funToFormalINMap[funEntry->getFun()].set(sNode->getId());
425 }
FunEntryICFGNode * getFunEntryICFGNode(const FunObjVar *fun)
Add a function entry node.
Definition ICFG.cpp:242
FunctionToFormalINsMapTy funToFormalINMap
Definition SVFG.h:103
ICFG * getICFG() const
Definition SVFIR.h:227
SVFIR * pag
Definition VFG.h:104

◆ addFormalOUTSVFGNode()

void SVF::SVFG::addFormalOUTSVFGNode ( const FunExitICFGNode funExit,
const MRVer ver,
const NodeID  nodeId 
)
inlineprotected

Add memory Function return mu SVFG node.

Definition at line 428 of file SVFG.h.

429 {
430 FormalOUTSVFGNode* sNode = new FormalOUTSVFGNode(nodeId, ver, funExit);
432 funToFormalOUTMap[funExit->getFun()].set(sNode->getId());
433 }
FunExitICFGNode * getFunExitICFGNode(const FunObjVar *fun)
Add a function exit node.
Definition ICFG.cpp:249
FunctionToFormalOUTsMapTy funToFormalOUTMap
Definition SVFG.h:104

◆ addInterIndirectVFCallEdge()

SVFGEdge * SVFG::addInterIndirectVFCallEdge ( const ActualINSVFGNode src,
const FormalINSVFGNode dst,
CallSiteID  csId 
)
protected

Add inter VF edge from callsite mu to function entry chi.

Definition at line 545 of file SVFG.cpp.

546{
547 NodeBS cpts1 = src->getPointsTo();
548 NodeBS cpts2 = dst->getPointsTo();
549 if(cpts1.intersects(cpts2))
550 {
551 cpts1 &= cpts2;
552 return addCallIndirectVFEdge(src->getId(),dst->getId(),cpts1,csId);
553 }
554 return nullptr;
555}
const NodeBS & getPointsTo() const
Return points-to of the MR.
Definition SVFGNode.h:52
SVFGEdge * addCallIndirectVFEdge(NodeID srcId, NodeID dstId, const NodeBS &cpts, CallSiteID csId)
Definition SVFG.cpp:505
NodeID getId() const
Get ID.
Definition SVFValue.h:160

◆ addInterIndirectVFRetEdge()

SVFGEdge * SVFG::addInterIndirectVFRetEdge ( const FormalOUTSVFGNode src,
const ActualOUTSVFGNode dst,
CallSiteID  csId 
)
protected

Add inter VF edge from function exit mu to callsite chi.

Add inter VF edge from function exit mu to callsite chi

Definition at line 560 of file SVFG.cpp.

561{
562
563 NodeBS cpts1 = src->getPointsTo();
564 NodeBS cpts2 = dst->getPointsTo();
565 if(cpts1.intersects(cpts2))
566 {
567 cpts1 &= cpts2;
568 return addRetIndirectVFEdge(src->getId(),dst->getId(),cpts1,csId);
569 }
570 return nullptr;
571}
SVFGEdge * addRetIndirectVFEdge(NodeID srcId, NodeID dstId, const NodeBS &cpts, CallSiteID csId)
Definition SVFG.cpp:525

◆ addIntraIndirectVFEdge()

SVFGEdge * SVFG::addIntraIndirectVFEdge ( NodeID  srcId,
NodeID  dstId,
const NodeBS cpts 
)
protected

Add indirect def-use edges of a memory region between two statements,.

Definition at line 463 of file SVFG.cpp.

464{
469 {
470 assert(SVFUtil::isa<IndirectSVFGEdge>(edge) && "this should be a indirect value flow edge!");
471 return (SVFUtil::cast<IndirectSVFGEdge>(edge)->addPointsTo(cpts) ? edge : nullptr);
472 }
473 else
474 {
476 indirectEdge->addPointsTo(cpts);
478 }
479}
@ IntraIndirectVF
Definition VFGEdge.h:54
void checkIntraEdgeParents(const VFGNode *srcNode, const VFGNode *dstNode)
sanitize Intra edges, verify that both nodes belong to the same function.
Definition VFG.h:413
VFGEdge * hasIntraVFGEdge(VFGNode *src, VFGNode *dst, VFGEdge::VFGEdgeK kind)
Whether we has a SVFG edge.
Definition VFG.cpp:859

◆ addIntraMSSAPHISVFGNode()

void SVF::SVFG::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 
)
inlineprotected

Add memory SSA PHI SVFG node.

Definition at line 453 of file SVFG.h.

455 {
456 IntraMSSAPHISVFGNode* sNode = new IntraMSSAPHISVFGNode(nodeId, resVer);
458 for(MemSSA::PHI::OPVers::const_iterator it = opVerBegin, eit=opVerEnd; it!=eit; ++it)
459 sNode->setOpVer(it->first,it->second);
460 setDef(resVer,sNode);
461 }

◆ addRetIndirectVFEdge()

SVFGEdge * SVFG::addRetIndirectVFEdge ( NodeID  srcId,
NodeID  dstId,
const NodeBS cpts,
CallSiteID  csId 
)
protected

Definition at line 525 of file SVFG.cpp.

526{
530 {
531 assert(SVFUtil::isa<RetIndSVFGEdge>(edge) && "this should be a indirect value flow edge!");
532 return (SVFUtil::cast<RetIndSVFGEdge>(edge)->addPointsTo(cpts) ? edge : nullptr);
533 }
534 else
535 {
537 retEdge->addPointsTo(cpts);
538 return (addSVFGEdge(retEdge) ? retEdge : nullptr);
539 }
540}

◆ addSVFGEdge()

bool SVF::SVFG::addSVFGEdge ( SVFGEdge edge)
inline

Add SVFG edge.

Definition at line 265 of file SVFG.h.

266 {
267 return addVFGEdge(edge);
268 }
bool addVFGEdge(VFGEdge *edge)
Add VFG edge.
Definition VFG.h:401

◆ addSVFGNode()

virtual void SVF::SVFG::addSVFGNode ( SVFGNode node,
ICFGNode icfgNode 
)
inlineprotectedvirtual

Add SVFG node.

Definition at line 413 of file SVFG.h.

414 {
415 addVFGNode(node, icfgNode);
416 }
virtual void addVFGNode(VFGNode *vfgNode, ICFGNode *icfgNode)
Add a VFG node.
Definition VFG.h:526

◆ addSVFGNodesForAddrTakenVars()

void SVFG::addSVFGNodesForAddrTakenVars ( )
protected

Create SVFG nodes for address-taken variables.

set defs for address-taken vars defined at phi/chi/call create corresponding def and use nodes for address-taken vars (a.k.a MRVers) initialize memory SSA phi nodes (phi of address-taken variables)

initialize memory SSA entry chi nodes

initialize memory SSA return mu nodes

initialize memory SSA callsite mu nodes

initialize memory SSA callsite chi nodes

Definition at line 255 of file SVFG.cpp.

256{
257
258 // set defs for address-taken vars defined at store statements
260 for (SVFStmt::SVFStmtSetTy::iterator iter = stores.begin(), eiter =
261 stores.end(); iter != eiter; ++iter)
262 {
263 StoreStmt* store = SVFUtil::cast<StoreStmt>(*iter);
264 const StmtSVFGNode* sNode = getStmtVFGNode(store);
265 for(CHISet::iterator pi = mssa->getCHISet(store).begin(), epi = mssa->getCHISet(store).end(); pi!=epi; ++pi)
266 setDef((*pi)->getResVer(),sNode);
267 }
268
272 for(MemSSA::BBToPhiSetMap::iterator it = mssa->getBBToPhiSetMap().begin(),
273 eit = mssa->getBBToPhiSetMap().end(); it!=eit; ++it)
274 {
275 for(PHISet::iterator pi = it->second.begin(), epi = it->second.end(); pi!=epi; ++pi)
276 {
277 MemSSA::PHI* phi = *pi;
278 const ICFGNode* inst = phi->getBasicBlock()->front();
279 addIntraMSSAPHISVFGNode(const_cast<ICFGNode*>(inst), phi->opVerBegin(), phi->opVerEnd(),phi->getResVer(), totalVFGNode++);
280 }
281 }
283 for(MemSSA::FunToEntryChiSetMap::iterator it = mssa->getFunToEntryChiSetMap().begin(),
284 eit = mssa->getFunToEntryChiSetMap().end(); it!=eit; ++it)
285 {
286 for(CHISet::iterator pi = it->second.begin(), epi = it->second.end(); pi!=epi; ++pi)
287 {
288 const MemSSA::ENTRYCHI* chi = SVFUtil::cast<ENTRYCHI>(*pi);
289 addFormalINSVFGNode(pag->getICFG()->getFunEntryICFGNode(chi->getFunction()), chi->getResVer(), totalVFGNode++);
290 }
291 }
293 for(MemSSA::FunToReturnMuSetMap::iterator it = mssa->getFunToRetMuSetMap().begin(),
294 eit = mssa->getFunToRetMuSetMap().end(); it!=eit; ++it)
295 {
296 for(MUSet::iterator pi = it->second.begin(), epi = it->second.end(); pi!=epi; ++pi)
297 {
298 const MemSSA::RETMU* mu = SVFUtil::cast<RETMU>(*pi);
299 addFormalOUTSVFGNode(pag->getICFG()->getFunExitICFGNode(mu->getFunction()), mu->getMRVer(), totalVFGNode++);
300 }
301 }
303 for(MemSSA::CallSiteToMUSetMap::iterator it = mssa->getCallSiteToMuSetMap().begin(),
304 eit = mssa->getCallSiteToMuSetMap().end();
305 it!=eit; ++it)
306 {
307 for(MUSet::iterator pi = it->second.begin(), epi = it->second.end(); pi!=epi; ++pi)
308 {
309 const MemSSA::CALLMU* mu = SVFUtil::cast<CALLMU>(*pi);
310 addActualINSVFGNode(mu->getCallSite(), mu->getMRVer(), totalVFGNode++);
311 }
312 }
314 for(MemSSA::CallSiteToCHISetMap::iterator it = mssa->getCallSiteToChiSetMap().begin(),
315 eit = mssa->getCallSiteToChiSetMap().end();
316 it!=eit; ++it)
317 {
318 for(CHISet::iterator pi = it->second.begin(), epi = it->second.end(); pi!=epi; ++pi)
319 {
320 const MemSSA::CALLCHI* chi = SVFUtil::cast<CALLCHI>(*pi);
321 addActualOUTSVFGNode(chi->getCallSite(), chi->getResVer(), totalVFGNode++);
322 }
323
324 }
325}
CallCHI< Condition > CALLCHI
Definition MemSSA.h:66
EntryCHI< Condition > ENTRYCHI
Definition MemSSA.h:64
CallMU< Condition > CALLMU
Definition MemSSA.h:62
RetMU< Condition > RETMU
Definition MemSSA.h:60
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:453
void addActualOUTSVFGNode(const CallICFGNode *callsite, const MRVer *resVer, const NodeID nodeId)
Add memory callsite chi SVFG node.
Definition SVFG.h:444
void addFormalOUTSVFGNode(const FunExitICFGNode *funExit, const MRVer *ver, const NodeID nodeId)
Add memory Function return mu SVFG node.
Definition SVFG.h:428
void addActualINSVFGNode(const CallICFGNode *callsite, const MRVer *ver, const NodeID nodeId)
Add memory callsite mu SVFG node.
Definition SVFG.h:436
void addFormalINSVFGNode(const FunEntryICFGNode *funEntry, const MRVer *resVer, const NodeID nodeId)
Add memory Function entry chi SVFG node.
Definition SVFG.h:419
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
StmtVFGNode * getStmtVFGNode(const SVFStmt *svfStmt) const
Get an VFGNode.
Definition VFG.h:261
virtual SVFStmt::SVFStmtSetTy & getSVFStmtSet(SVFStmt::PEDGEK kind)
Get SVFStmt set.
Definition VFG.h:498

◆ addThreadMHPIndirectVFEdge()

SVFGEdge * SVFG::addThreadMHPIndirectVFEdge ( NodeID  srcId,
NodeID  dstId,
const NodeBS cpts 
)
protected

Add def-use edges of a memory region between two may-happen-in-parallel statements for multithreaded program

Definition at line 485 of file SVFG.cpp.

486{
490 {
491 assert(SVFUtil::isa<IndirectSVFGEdge>(edge) && "this should be a indirect value flow edge!");
492 return (SVFUtil::cast<IndirectSVFGEdge>(edge)->addPointsTo(cpts) ? edge : nullptr);
493 }
494 else
495 {
497 indirectEdge->addPointsTo(cpts);
499 }
500}
@ TheadMHPIndirectVF
Definition VFGEdge.h:59
VFGEdge * hasThreadVFGEdge(VFGNode *src, VFGNode *dst, VFGEdge::VFGEdgeK kind)
Definition VFG.cpp:877

◆ buildSVFG()

void SVFG::buildSVFG ( )
protectedvirtual

Start building SVFG.

Build SVFG 1) build SVFG nodes a) statements for top level pointers (SVFStmts) b) operators of address-taken variables (MSSAPHI and MSSACHI) 2) connect SVFG edges a) between two statements (SVFStmts) b) between two memory SSA operators (MSSAPHI MSSAMU and MSSACHI)

Reimplemented in SVF::SVFGOPT.

Definition at line 228 of file SVFG.cpp.

229{
230 DBOUT(DGENERAL, outs() << pasMsg("Build Sparse Value-Flow Graph \n"));
231
232 stat->startClk();
233 if (!Options::ReadSVFG().empty())
234 {
236 }
237 else
238 {
239 DBOUT(DGENERAL, outs() << pasMsg("\tCreate SVFG Addr-taken Node\n"));
242 stat->ATVFNodeEnd();
243 DBOUT(DGENERAL, outs() << pasMsg("\tCreate SVFG Indirect Edge\n"));
247 if (!Options::WriteSVFG().empty())
249 }
250}
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
Definition SVFType.h:593
#define DGENERAL
Definition SVFType.h:599
static const Option< std::string > ReadSVFG
Definition Options.h:149
static const Option< std::string > WriteSVFG
Definition Options.h:148
void ATVFNodeStart()
Definition SVFGStat.h:139
void indVFEdgeEnd()
Definition SVFGStat.h:124
void ATVFNodeEnd()
Definition SVFGStat.h:144
void indVFEdgeStart()
Definition SVFGStat.h:119
void connectIndirectSVFGEdges()
Connect direct SVFG edges between two SVFG nodes (value-flow of top address-taken variables)
Definition SVFG.cpp:330
virtual void writeToFile(const std::string &filename)
virtual void readFile(const std::string &filename)
void addSVFGNodesForAddrTakenVars()
Create SVFG nodes for address-taken variables.
Definition SVFG.cpp:255
virtual void startClk()
Definition SVFStat.h:58
std::string pasMsg(const std::string &msg)
Print each pass/phase message by converting a string into blue string output.
Definition SVFUtil.cpp:101
std::ostream & outs()
Overwrite llvm::outs()
Definition SVFUtil.h:52

◆ clearMSSA()

void SVF::SVFG::clearMSSA ( )
inline

Clear MSSA.

Definition at line 132 of file SVFG.h.

133 {
134 mssa = nullptr;
135 }

◆ connectAInAndFIn()

virtual void SVF::SVFG::connectAInAndFIn ( const ActualINSVFGNode actualIn,
const FormalINSVFGNode formalIn,
CallSiteID  csId,
SVFGEdgeSetTy edges 
)
inlineprotectedvirtual

Connect SVFG nodes between caller and callee for indirect call site.

Connect actual-in and formal-in

Reimplemented in SVF::SVFGOPT.

Definition at line 309 of file SVFG.h.

310 {
312 if (edge != nullptr)
313 edges.insert(edge);
314 }
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
VFGEdge SVFGEdge
Definition SVFG.h:42

◆ connectCallerAndCallee()

void SVFG::connectCallerAndCallee ( const CallICFGNode cs,
const FunObjVar callee,
SVFGEdgeSetTy edges 
)
virtual

Connect SVFG nodes between caller and callee for indirect call site.

Connect actual params/return to formal params/return for top-level variables. Also connect indirect actual in/out and formal in/out.

Reimplemented from SVF::VFG.

Definition at line 658 of file SVFG.cpp.

659{
661
662 CallSiteID csId = getCallSiteID(cs, callee);
663
664 // connect actual in and formal in
666 {
671 {
672 const ActualINSVFGNode * actualIn = SVFUtil::cast<ActualINSVFGNode>(getSVFGNode(*ai_it));
675 {
676 const FormalINSVFGNode* formalIn = SVFUtil::cast<FormalINSVFGNode>(getSVFGNode(*fi_it));
678 }
679 }
680 }
681
682 // connect actual out and formal out
684 {
685 // connect formal out and actual out
690 {
691 const FormalOUTSVFGNode * formalOut = SVFUtil::cast<FormalOUTSVFGNode>(getSVFGNode(*fo_it));
694 {
695 const ActualOUTSVFGNode* actualOut = SVFUtil::cast<ActualOUTSVFGNode>(getSVFGNode(*ao_it));
697 }
698 }
699 }
700}
ActualOUTSVFGNodeSet & getActualOUTSVFGNodes(const CallICFGNode *cs)
Definition SVFG.h:231
FormalOUTSVFGNodeSet & getFormalOUTSVFGNodes(const FunObjVar *fun)
Definition SVFG.h:241
FormalINSVFGNodeSet & getFormalINSVFGNodes(const FunObjVar *fun)
Definition SVFG.h:236
virtual void connectFOutAndAOut(const FormalOUTSVFGNode *formalOut, const ActualOUTSVFGNode *actualOut, CallSiteID csId, SVFGEdgeSetTy &edges)
Connect formal-out and actual-out.
Definition SVFG.h:316
ActualINSVFGNodeSet & getActualINSVFGNodes(const CallICFGNode *cs)
Get SVFGNode set.
Definition SVFG.h:226
bool hasCallSiteMu(const CallICFGNode *cs) const
Definition SVFG.h:477
bool hasFuncRetMu(const FunObjVar *func) const
Definition SVFG.h:469
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:309
bool hasCallSiteChi(const CallICFGNode *cs) const
Definition SVFG.h:473
bool hasFuncEntryChi(const FunObjVar *func) const
Has function for EntryCHI/RetMU/CallCHI/CallMU.
Definition SVFG.h:465
CallSiteID getCallSiteID(const CallICFGNode *cs, const FunObjVar *func) const
Get callsite given a callsiteID.
Definition VFG.h:178
virtual void connectCallerAndCallee(const CallICFGNode *cs, const FunObjVar *callee, VFGEdgeSetTy &edges)
Connect VFG nodes between caller and callee for indirect call site.
Definition VFG.cpp:957
unsigned CallSiteID
Definition GeneralType.h:58

◆ connectFOutAndAOut()

virtual void SVF::SVFG::connectFOutAndAOut ( const FormalOUTSVFGNode formalOut,
const ActualOUTSVFGNode actualOut,
CallSiteID  csId,
SVFGEdgeSetTy edges 
)
inlineprotectedvirtual

Connect formal-out and actual-out.

Reimplemented in SVF::SVFGOPT.

Definition at line 316 of file SVFG.h.

317 {
319 if (edge != nullptr)
320 edges.insert(edge);
321 }
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

◆ connectFromGlobalToProgEntry()

void SVFG::connectFromGlobalToProgEntry ( )
protected

Connect indirect SVFG edges from global initializers (store) to main function entry.

Connect indirect SVFG edges from global initializers (store) to main function entry

connect this store to main function entry

add indirect value flow edge

Definition at line 428 of file SVFG.cpp.

429{
432 if (formalIns.empty())
433 return;
434
435 for (GlobalVFGNodeSet::const_iterator storeIt = globalVFGNodes.begin(), storeEit = globalVFGNodes.end();
437 {
438 if (const StoreSVFGNode* store = SVFUtil::dyn_cast<StoreSVFGNode>(*storeIt))
439 {
441 const NodeBS& storePts = mssa->getPTA()->getPts(store->getDstNodeID()).toNodeBS();
442
444 formalIns.end(); fiIt != fiEit; ++fiIt)
445 {
448
450 if (formalInPts.empty())
451 continue;
452
455 }
456 }
457 }
458}
NodeBS FormalINSVFGNodeSet
Definition SVFG.h:81
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
SparseBitVectorIterator iterator
GlobalVFGNodeSet globalVFGNodes
set of global store VFG nodes
Definition VFG.h:102
const FunObjVar * getProgEntryFunction()
Get program entry function.
Definition SVFUtil.cpp:410
u32_t NodeID
Definition GeneralType.h:56

◆ connectIndirectSVFGEdges()

void SVFG::connectIndirectSVFGEdges ( )
protected

Connect direct SVFG edges between two SVFG nodes (value-flow of top address-taken variables)

There's no need to connect actual out node to its definition site in the same function.

Definition at line 330 of file SVFG.cpp.

331{
332
333 for(iterator it = begin(), eit = end(); it!=eit; ++it)
334 {
335 NodeID nodeId = it->first;
336 const SVFGNode* node = it->second;
337 if(const LoadSVFGNode* loadNode = SVFUtil::dyn_cast<LoadSVFGNode>(node))
338 {
339 MUSet& muSet = mssa->getMUSet(SVFUtil::cast<LoadStmt>(loadNode->getSVFStmt()));
340 for(MUSet::iterator it = muSet.begin(), eit = muSet.end(); it!=eit; ++it)
341 {
342 if(LOADMU* mu = SVFUtil::dyn_cast<LOADMU>(*it))
343 {
344 NodeID def = getDef(mu->getMRVer());
345 addIntraIndirectVFEdge(def,nodeId, mu->getMRVer()->getMR()->getPointsTo());
346 }
347 }
348 }
349 else if(const StoreSVFGNode* storeNode = SVFUtil::dyn_cast<StoreSVFGNode>(node))
350 {
351 CHISet& chiSet = mssa->getCHISet(SVFUtil::cast<StoreStmt>(storeNode->getSVFStmt()));
352 for(CHISet::iterator it = chiSet.begin(), eit = chiSet.end(); it!=eit; ++it)
353 {
354 if(STORECHI* chi = SVFUtil::dyn_cast<STORECHI>(*it))
355 {
356 NodeID def = getDef(chi->getOpVer());
357 addIntraIndirectVFEdge(def,nodeId, chi->getOpVer()->getMR()->getPointsTo());
358 }
359 }
360 }
361 else if(const FormalINSVFGNode* formalIn = SVFUtil::dyn_cast<FormalINSVFGNode>(node))
362 {
364 mssa->getPTA()->getCallGraph()->getDirCallSitesInvokingCallee(formalIn->getFun(),callInstSet);
365 for(CallGraphEdge::CallInstSet::iterator it = callInstSet.begin(), eit = callInstSet.end(); it!=eit; ++it)
366 {
367 const CallICFGNode* cs = *it;
368 if(!mssa->hasMU(cs))
369 continue;
372 {
373 const ActualINSVFGNode* actualIn = SVFUtil::cast<ActualINSVFGNode>(getSVFGNode(*ait));
375 }
376 }
377 }
378 else if(const FormalOUTSVFGNode* formalOut = SVFUtil::dyn_cast<FormalOUTSVFGNode>(node))
379 {
381 // const MemSSA::RETMU* retMu = formalOut->getRetMU();
382 mssa->getPTA()->getCallGraph()->getDirCallSitesInvokingCallee(formalOut->getFun(),callInstSet);
383 for(CallGraphEdge::CallInstSet::iterator it = callInstSet.begin(), eit = callInstSet.end(); it!=eit; ++it)
384 {
385 const CallICFGNode* cs = *it;
386 if(!mssa->hasCHI(cs))
387 continue;
390 {
391 const ActualOUTSVFGNode* actualOut = SVFUtil::cast<ActualOUTSVFGNode>(getSVFGNode(*ait));
393 }
394 }
395 NodeID def = getDef(formalOut->getMRVer());
396 addIntraIndirectVFEdge(def,nodeId, formalOut->getMRVer()->getMR()->getPointsTo());
397 }
398 else if(const ActualINSVFGNode* actualIn = SVFUtil::dyn_cast<ActualINSVFGNode>(node))
399 {
400 const MRVer* ver = actualIn->getMRVer();
401 NodeID def = getDef(ver);
403 }
404 else if(SVFUtil::isa<ActualOUTSVFGNode>(node))
405 {
407 }
408 else if(const MSSAPHISVFGNode* phiNode = SVFUtil::dyn_cast<MSSAPHISVFGNode>(node))
409 {
410 for (MemSSA::PHI::OPVers::const_iterator it = phiNode->opVerBegin(), eit = phiNode->opVerEnd();
411 it != eit; it++)
412 {
413 const MRVer* op = it->second;
414 NodeID def = getDef(op);
415 addIntraIndirectVFEdge(def,nodeId, op->getMR()->getPointsTo());
416 }
417 }
418 }
419
420
422}
Set< const CallICFGNode * > CallInstSet
Definition CallGraph.h:55
iterator begin()
Iterators.
const MemRegion * getMR() const
Return the memory region.
Definition MSSAMuChi.h:63
const NodeBS & getPointsTo() const
Return points-to.
Definition MemRegion.h:83
NodeBS ActualOUTSVFGNodeSet
Definition SVFG.h:80
void connectFromGlobalToProgEntry()
Connect indirect SVFG edges from global initializers (store) to main function entry.
Definition SVFG.cpp:428
MemSSA::LOADMU LOADMU
Definition SVFG.h:92
MemSSA::CHISet CHISet
Definition SVFG.h:88
NodeID getDef(const ValVar *valVar) const
Definition SVFG.h:372
NodeBS ActualINSVFGNodeSet
Definition SVFG.h:79
MemSSA::MUSet MUSet
Definition SVFG.h:87
MemSSA::STORECHI STORECHI
Definition SVFG.h:93
VFGNodeIDToNodeMapTy::iterator iterator
Definition VFG.h:80

◆ destroy()

void SVFG::destroy ( )
protected

Clean up memory.

Memory has been cleaned up at GenericGraph

Definition at line 212 of file SVFG.cpp.

213{
214 delete stat;
215 stat = nullptr;
216 clearMSSA();
217}
void clearMSSA()
Clear MSSA.
Definition SVFG.h:132

◆ dump()

void SVFG::dump ( const std::string &  file,
bool  simple = false 
)

Dump graph into dot file.

Dump SVFG

Definition at line 576 of file SVFG.cpp.

577{
579}
static void WriteGraphToFile(SVF::OutStream &O, const std::string &GraphName, const GraphType &GT, bool simple=false)

◆ getActualINSVFGNodes()

ActualINSVFGNodeSet & SVF::SVFG::getActualINSVFGNodes ( const CallICFGNode cs)
inline

Get SVFGNode set.

Definition at line 226 of file SVFG.h.

227 {
228 return callSiteToActualINMap[cs];
229 }

◆ getActualOUTSVFGNodes()

ActualOUTSVFGNodeSet & SVF::SVFG::getActualOUTSVFGNodes ( const CallICFGNode cs)
inline

Definition at line 231 of file SVFG.h.

232 {
233 return callSiteToActualOUTMap[cs];
234 }

◆ getDef() [1/2]

NodeID SVF::SVFG::getDef ( const MRVer mvar) const
inlineprotected

Definition at line 397 of file SVFG.h.

398 {
399 MSSAVarToDefMapTy::const_iterator it = MSSAVarToDefMap.find(mvar);
400 assert(it!=MSSAVarToDefMap.end() && "memory SSA does not have a definition??");
401 return it->second;
402 }
MSSAVarToDefMapTy MSSAVarToDefMap
map a memory SSA operator to its definition SVFG node
Definition SVFG.h:100

◆ getDef() [2/2]

NodeID SVF::SVFG::getDef ( const ValVar valVar) const
inlineprotected

Definition at line 372 of file SVFG.h.

373 {
374 return VFG::getDef(valVar);
375 }
NodeID getDef(const ValVar *valVar) const
Definition VFG.h:482

◆ getDefSiteOfObjVar()

const ICFGNode * SVFG::getDefSiteOfObjVar ( const ObjVar obj,
const ICFGNode node 
) const

Given an ObjVar and its use-site ICFGNode, find the definition-site ICFGNode by following incoming IndirectSVFGEdges whose pts contains the ObjVar (asserts unique definition)

Definition at line 772 of file SVFG.cpp.

773{
774 const ICFGNode* defSite = nullptr;
775 NodeID objId = obj->getId();
776 for (const VFGNode* vNode : node->getVFGNodes())
777 {
778 for (auto it = vNode->InEdgeBegin(), eit = vNode->InEdgeEnd(); it != eit; ++it)
779 {
780 if (const IndirectSVFGEdge* indEdge = SVFUtil::dyn_cast<IndirectSVFGEdge>(*it))
781 {
782 if (indEdge->getPointsTo().test(objId))
783 {
784 assert(defSite == nullptr && "ObjVar should have a unique indirect definition!");
785 defSite = indEdge->getSrcNode()->getICFGNode();
786 }
787 }
788 }
789 }
790 return defSite;
791}
VFGNodeSet & getVFGNodes(const FunObjVar *fun)
Definition VFG.h:348

◆ getDefSiteOfValVar()

const ICFGNode * SVFG::getDefSiteOfValVar ( const ValVar var) const

Given a ValVar and its SVFGNode, find the definition-site ICFGNode by following incoming direct VFGEdges (asserts unique definition)

Definition at line 765 of file SVFG.cpp.

766{
767 return getDefSVFGNode(var)->getICFGNode();
768}
const SVFGNode * getDefSVFGNode(const ValVar *valVar) const
Given a valVar, return its definition site.
Definition SVFG.h:171
virtual const ICFGNode * getICFGNode() const
Return corresponding ICFG node.
Definition VFGNode.h:67

◆ getDefSVFGNode()

const SVFGNode * SVF::SVFG::getDefSVFGNode ( const ValVar valVar) const
inline

Given a valVar, return its definition site.

Definition at line 171 of file SVFG.h.

172 {
173 return getSVFGNode(getDef(valVar));
174 }

◆ getFormalINSVFGNodes()

FormalINSVFGNodeSet & SVF::SVFG::getFormalINSVFGNodes ( const FunObjVar fun)
inline

Definition at line 236 of file SVFG.h.

237 {
238 return funToFormalINMap[fun];
239 }

◆ getFormalOUTSVFGNodes()

FormalOUTSVFGNodeSet & SVF::SVFG::getFormalOUTSVFGNodes ( const FunObjVar fun)
inline

Definition at line 241 of file SVFG.h.

242 {
243 return funToFormalOUTMap[fun];
244 }

◆ getInterVFEdgeAtIndCSFromAInToFIn()

virtual void SVF::SVFG::getInterVFEdgeAtIndCSFromAInToFIn ( ActualINSVFGNode actualIn,
const FunObjVar callee,
SVFGEdgeSetTy edges 
)
inlineprotectedvirtual

Definition at line 344 of file SVFG.h.

345 {
346 for (SVFGNode::const_iterator outIt = actualIn->OutEdgeBegin(), outEit = actualIn->OutEdgeEnd(); outIt != outEit; ++outIt)
347 {
348 SVFGEdge* edge = *outIt;
349 if (edge->getDstNode()->getFun() == callee)
350 edges.insert(edge);
351 }
352 }
VFGEdge::VFGEdgeSetTy::const_iterator const_iterator
Definition VFGNode.h:55

◆ getInterVFEdgeAtIndCSFromAPToFP()

virtual void SVF::SVFG::getInterVFEdgeAtIndCSFromAPToFP ( const ValVar cs_arg,
const ValVar fun_arg,
const CallICFGNode ,
CallSiteID  csId,
SVFGEdgeSetTy edges 
)
inlineprotectedvirtual

Get inter value flow edges between indirect call site and callee.

Definition at line 326 of file SVFG.h.

327 {
331 assert(edge != nullptr && "Can not find inter value flow edge from aparam to fparam");
332 edges.insert(edge);
333 }
VFGNode SVFGNode
Definition SVFG.h:43

◆ getInterVFEdgeAtIndCSFromFOutToAOut()

virtual void SVF::SVFG::getInterVFEdgeAtIndCSFromFOutToAOut ( ActualOUTSVFGNode actualOut,
const FunObjVar callee,
SVFGEdgeSetTy edges 
)
inlineprotectedvirtual

Definition at line 354 of file SVFG.h.

355 {
356 for (SVFGNode::const_iterator inIt = actualOut->InEdgeBegin(), inEit = actualOut->InEdgeEnd(); inIt != inEit; ++inIt)
357 {
358 SVFGEdge* edge = *inIt;
359 if (edge->getSrcNode()->getFun() == callee)
360 edges.insert(edge);
361 }
362 }

◆ getInterVFEdgeAtIndCSFromFRToAR()

virtual void SVF::SVFG::getInterVFEdgeAtIndCSFromFRToAR ( const ValVar fun_ret,
const ValVar cs_ret,
CallSiteID  csId,
SVFGEdgeSetTy edges 
)
inlineprotectedvirtual

Definition at line 335 of file SVFG.h.

336 {
337 SVFGNode* formalRet = getSVFGNode(getDef(fun_ret));
338 SVFGNode* actualRet = getSVFGNode(getDef(cs_ret));
339 SVFGEdge* edge = hasInterVFGEdge(formalRet, actualRet, SVFGEdge::RetDirVF, csId);
340 assert(edge != nullptr && "Can not find inter value flow edge from fret to aret");
341 edges.insert(edge);
342 }

◆ getInterVFEdgesForIndirectCallSite()

void SVFG::getInterVFEdgesForIndirectCallSite ( const CallICFGNode callICFGNode,
const FunObjVar callee,
SVFGEdgeSetTy edges 
)

Get all inter value flow edges of a indirect call site.

Get all inter value flow edges at this indirect call site, including call and return edges.

Definition at line 584 of file SVFG.cpp.

585{
587 const RetICFGNode* retICFGNode = callICFGNode->getRetICFGNode();
588
589 // Find inter direct call edges between actual param and formal param.
591 {
594 SVFIR::ValVarList::const_iterator csArgIt = csArgList.begin(), csArgEit = csArgList.end();
595 SVFIR::ValVarList::const_iterator funArgIt = funArgList.begin(), funArgEit = funArgList.end();
596 for (; funArgIt != funArgEit && csArgIt != csArgEit; funArgIt++, csArgIt++)
597 {
598 const ValVar *cs_arg = *csArgIt;
599 const ValVar *fun_arg = *funArgIt;
602 }
603 assert(funArgIt == funArgEit && "function has more arguments than call site");
604 if (callee->isVarArg())
605 {
609 {
610 for (; csArgIt != csArgEit; csArgIt++)
611 {
612 const ValVar *cs_arg = *csArgIt;
615 }
616 }
617 }
618 }
619
620 // Find inter direct return edges between actual return and formal return.
622 {
627 }
628
629 // Find inter indirect call edges between actual-in and formal-in svfg nodes.
631 {
635 {
636 ActualINSVFGNode * actualIn = SVFUtil::cast<ActualINSVFGNode>(getSVFGNode(*ai_it));
638 }
639 }
640
641 // Find inter indirect return edges between actual-out and formal-out svfg nodes.
643 {
647 {
648 ActualOUTSVFGNode* actualOut = SVFUtil::cast<ActualOUTSVFGNode>(getSVFGNode(*ao_it));
650 }
651 }
652}
NodeID getVarargNode(const FunObjVar *func) const
getVarargNode - Return the unique node representing the variadic argument of a variadic function.
Definition IRGraph.cpp:67
virtual void getInterVFEdgeAtIndCSFromFOutToAOut(ActualOUTSVFGNode *actualOut, const FunObjVar *callee, SVFGEdgeSetTy &edges)
Definition SVFG.h:354
virtual void getInterVFEdgeAtIndCSFromAPToFP(const ValVar *cs_arg, const ValVar *fun_arg, const CallICFGNode *, CallSiteID csId, SVFGEdgeSetTy &edges)
Get inter value flow edges between indirect call site and callee.
Definition SVFG.h:326
virtual void getInterVFEdgeAtIndCSFromAInToFIn(ActualINSVFGNode *actualIn, const FunObjVar *callee, SVFGEdgeSetTy &edges)
Definition SVFG.h:344
virtual void getInterVFEdgeAtIndCSFromFRToAR(const ValVar *fun_ret, const ValVar *cs_ret, CallSiteID csId, SVFGEdgeSetTy &edges)
Definition SVFG.h:335
bool funHasRet(const FunObjVar *func) const
Definition SVFIR.h:419
bool hasFunArgsList(const FunObjVar *func) const
Function has arguments list.
Definition SVFIR.h:358
const ValVar * getCallSiteRet(const RetICFGNode *cs) const
Get callsite return.
Definition SVFIR.h:397
const ValVarList & getFunArgsList(const FunObjVar *func) const
Get function arguments list.
Definition SVFIR.h:368
std::vector< const ValVar * > ValVarList
Definition SVFIR.h:58
bool hasCallSiteArgsMap(const CallICFGNode *cs) const
Callsite has argument list.
Definition SVFIR.h:375
bool callsiteHasRet(const RetICFGNode *cs) const
Definition SVFIR.h:403
const ValVar * getFunRet(const FunObjVar *func) const
Get function return list.
Definition SVFIR.h:413
const ValVarList & getCallSiteArgsList(const CallICFGNode *cs) const
Get callsite argument list.
Definition SVFIR.h:385
const ValVar * getValVar(NodeID id) const
Definition SVFIR.h:135
virtual bool isInterestedSVFVar(const SVFVar *node) const
Definition VFG.h:506

◆ getMRVERFromString()

MRVer * SVFG::getMRVERFromString ( const std::string &  input)
virtual

Definition at line 430 of file SVFGReadWrite.cpp.

431{
432 if(s == "")
433 {
434 return NULL;
435 }
436 string temp;
437 size_t last = 0;
438 size_t next = 0;
442 //{create Memory Region object
443 next = s.find("MemRegion: pts{") + 15;
444 last = s.find("} MRVERSION: ");
445 temp = s.substr(next, last-next);
446 // convert string to PointsTo
448 string point;
450 while (getline(ss, point, ' '))
451 {
453 NodeID obj;
454 sss >> obj;
455 dstPts.set(obj);
456 }
458 // create mssdef
459 next = s.find("MSSADef: ") + 9;
460 last = s.find("} >=");
461 temp = s.substr(next, last-next);
462 // convert string to deftype
463 istringstream ss1(temp.substr(0, temp.find(", ")));
464 int obj1;
465 ss1 >> obj1;
468 // mrversion
469 next = s.find("MRVERSION: ") + 11;
470 last = s.find(" MSSADef:");
471 temp = s.substr(next, last-next);
472 // convert mrversion to nodeid
474 NodeID obj2;
475 ss2 >> obj2;
476 // create mrver
478 return tempMRVer;
479}
item next
Definition cJSON.cpp:2224
Memory Region class.
Definition MemRegion.h:56
#define NULL
Definition extapi.c:5

◆ getMSSA()

MemSSA * SVF::SVFG::getMSSA ( ) const
inline

Get SVFG memory SSA.

Definition at line 138 of file SVFG.h.

139 {
140 return mssa.get();
141 }

◆ getPTA()

PointerAnalysis * SVF::SVFG::getPTA ( ) const
inline

Get Pointer Analysis.

Definition at line 144 of file SVFG.h.

145 {
146 return pta;
147 }

◆ getStat()

SVFGStat * SVF::SVFG::getStat ( ) const
inline

Return statistics.

Definition at line 126 of file SVFG.h.

127 {
128 return stat;
129 }

◆ getSVFGNode()

SVFGNode * SVF::SVFG::getSVFGNode ( NodeID  id) const
inline

Get a SVFG node.

Definition at line 150 of file SVFG.h.

151 {
152 return getVFGNode(id);
153 }
VFGNode * getVFGNode(NodeID id) const
Get a VFG node.
Definition VFG.h:145

◆ getSVFGNodeNum()

u32_t SVF::SVFG::getSVFGNodeNum ( ) const
inline

Return total SVFG node number.

Definition at line 271 of file SVFG.h.

272 {
273 return nodeNum;
274 }
u32_t nodeNum
total num of edge

◆ getUseSitesOfObjVar()

const Set< const ICFGNode * > SVFG::getUseSitesOfObjVar ( const ObjVar obj,
const ICFGNode node 
) const

Given an ObjVar and its def-site ICFGNode, find all use-site ICFGNodes by following outgoing IndirectSVFGEdges whose pts contains the ObjVar

Definition at line 815 of file SVFG.cpp.

816{
818 NodeID objId = obj->getId();
819 for (const VFGNode* vNode : node->getVFGNodes())
820 {
821 for (auto it = vNode->OutEdgeBegin(), eit = vNode->OutEdgeEnd(); it != eit; ++it)
822 {
823 if (const IndirectSVFGEdge* indEdge = SVFUtil::dyn_cast<IndirectSVFGEdge>(*it))
824 {
825 if (indEdge->getPointsTo().test(objId))
826 {
827 if (const ICFGNode* icfgNode = indEdge->getDstNode()->getICFGNode())
828 useSites.insert(icfgNode);
829 else
830 assert(false && "The destination node of an indirect SVFG edge should have an ICFG node!");
831 }
832 }
833 }
834 }
835 return useSites;
836}

◆ getUseSitesOfValVar()

const Set< const ICFGNode * > SVFG::getUseSitesOfValVar ( const ValVar var) const

Given a ValVar, find all use-site ICFGNodes by following outgoing direct VFGEdges from its unique definition SVFGNode

Definition at line 795 of file SVFG.cpp.

796{
799 for (auto it = defNode->OutEdgeBegin(), eit = defNode->OutEdgeEnd(); it != eit; ++it)
800 {
801 const VFGEdge* edge = *it;
802 if (edge->isDirectVFGEdge())
803 {
804 if (const ICFGNode* icfgNode = edge->getDstNode()->getICFGNode())
805 useSites.insert(icfgNode);
806 else
807 assert(false && "The destination node of a direct VFG edge should have an ICFG node!");
808 }
809 }
810 return useSites;
811}

◆ hasActualINSVFGNodes()

bool SVF::SVFG::hasActualINSVFGNodes ( const CallICFGNode cs) const
inline

Has a SVFGNode.

Definition at line 203 of file SVFG.h.

204 {
205 return callSiteToActualINMap.find(cs)!=callSiteToActualINMap.end();
206 }

◆ hasActualOUTSVFGNodes()

bool SVF::SVFG::hasActualOUTSVFGNodes ( const CallICFGNode cs) const
inline

Definition at line 208 of file SVFG.h.

209 {
210 return callSiteToActualOUTMap.find(cs)!=callSiteToActualOUTMap.end();
211 }

◆ hasCallSiteChi()

bool SVF::SVFG::hasCallSiteChi ( const CallICFGNode cs) const
inlineprotected

Definition at line 473 of file SVFG.h.

474 {
475 return (callSiteToActualOUTMap.find(cs) != callSiteToActualOUTMap.end());
476 }

◆ hasCallSiteMu()

bool SVF::SVFG::hasCallSiteMu ( const CallICFGNode cs) const
inlineprotected

Definition at line 477 of file SVFG.h.

478 {
479 return (callSiteToActualINMap.find(cs) != callSiteToActualINMap.end());
480 }

◆ hasDef()

bool SVF::SVFG::hasDef ( const ValVar valVar) const
inlineprotected

Definition at line 376 of file SVFG.h.

377 {
378 return VFG::hasDef(valVar);
379 }
bool hasDef(const ValVar *valVar) const
Definition VFG.h:488

◆ hasDefSVFGNode()

bool SVF::SVFG::hasDefSVFGNode ( const ValVar valVar) const
inline

Given a valVar, return whether it has definition site.

Definition at line 177 of file SVFG.h.

178 {
180 }
bool hasSVFGNode(NodeID id) const
Whether has the SVFGNode.
Definition SVFG.h:156
bool hasDef(const ValVar *valVar) const
Definition SVFG.h:376

◆ hasFormalINSVFGNodes()

bool SVF::SVFG::hasFormalINSVFGNodes ( const FunObjVar fun) const
inline

Definition at line 213 of file SVFG.h.

214 {
215 return funToFormalINMap.find(fun)!=funToFormalINMap.end();
216 }

◆ hasFormalOUTSVFGNodes()

bool SVF::SVFG::hasFormalOUTSVFGNodes ( const FunObjVar fun) const
inline

Definition at line 218 of file SVFG.h.

219 {
220 return funToFormalOUTMap.find(fun)!=funToFormalOUTMap.end();
221 }

◆ hasFuncEntryChi()

bool SVF::SVFG::hasFuncEntryChi ( const FunObjVar func) const
inlineprotected

Has function for EntryCHI/RetMU/CallCHI/CallMU.

Definition at line 465 of file SVFG.h.

466 {
467 return (funToFormalINMap.find(func) != funToFormalINMap.end());
468 }

◆ hasFuncRetMu()

bool SVF::SVFG::hasFuncRetMu ( const FunObjVar func) const
inlineprotected

Definition at line 469 of file SVFG.h.

470 {
471 return (funToFormalOUTMap.find(func) != funToFormalOUTMap.end());
472 }

◆ hasSVFGNode()

bool SVF::SVFG::hasSVFGNode ( NodeID  id) const
inline

Whether has the SVFGNode.

Definition at line 156 of file SVFG.h.

157 {
158 return hasVFGNode(id);
159 }
bool hasVFGNode(NodeID id) const
Whether has the VFGNode.
Definition VFG.h:151

◆ isCallSiteRetSVFGNode()

const CallICFGNode * SVFG::isCallSiteRetSVFGNode ( const SVFGNode node) const

Whether a node is callsite return SVFGNode.

Whether this is an callsite return SVFGNode (actual return, actual out)

Definition at line 732 of file SVFG.cpp.

733{
734 if(const ActualRetSVFGNode* ar = SVFUtil::dyn_cast<ActualRetSVFGNode>(node))
735 {
736 return ar->getCallSite();
737 }
738 else if(const InterPHISVFGNode* phi = SVFUtil::dyn_cast<InterPHISVFGNode>(node))
739 {
740 if(phi->isActualRetPHI())
741 return phi->getCallSite();
742 }
743 else if(const ActualOUTSVFGNode* ao = SVFUtil::dyn_cast<ActualOUTSVFGNode>(node))
744 {
745 return ao->getCallSite();
746 }
747 else if(const InterMSSAPHISVFGNode* mphi = SVFUtil::dyn_cast<InterMSSAPHISVFGNode>(node))
748 {
749 if(mphi->isActualOUTPHI())
750 return mphi->getCallSite();
751 }
752 return nullptr;
753}

◆ isFunEntrySVFGNode()

const FunObjVar * SVFG::isFunEntrySVFGNode ( const SVFGNode node) const

Whether a node is function entry SVFGNode.

Whether this is an function entry SVFGNode (formal parameter, formal In)

Definition at line 706 of file SVFG.cpp.

707{
708 if(const FormalParmSVFGNode* fp = SVFUtil::dyn_cast<FormalParmSVFGNode>(node))
709 {
710 return fp->getFun();
711 }
712 else if(const InterPHISVFGNode* phi = SVFUtil::dyn_cast<InterPHISVFGNode>(node))
713 {
714 if(phi->isFormalParmPHI())
715 return phi->getFun();
716 }
717 else if(const FormalINSVFGNode* fi = SVFUtil::dyn_cast<FormalINSVFGNode>(node))
718 {
719 return fi->getFun();
720 }
721 else if(const InterMSSAPHISVFGNode* mphi = SVFUtil::dyn_cast<InterMSSAPHISVFGNode>(node))
722 {
723 if(mphi->isFormalINPHI())
724 return mphi->getFun();
725 }
726 return nullptr;
727}

◆ performStat()

void SVFG::performStat ( )

Perform statistics.

Perform Statistics

Definition at line 758 of file SVFG.cpp.

759{
760 stat->performStat();
761}
virtual void performStat() override
Definition SVFGStat.cpp:178

◆ readFile()

void SVFG::readFile ( const std::string &  filename)
virtual

Definition at line 206 of file SVFGReadWrite.cpp.

207{
208 outs() << "Loading SVFG analysis results from '" << filename << "'...";
209 ifstream F(filename.c_str());
210 if (!F.is_open())
211 {
212 outs() << " error opening file for reading!\n";
213 return;
214 }
215
217 for (SVFStmt::SVFStmtSetTy::iterator iter = stores.begin(), eiter =
218 stores.end(); iter != eiter; ++iter)
219 {
220 StoreStmt* store = SVFUtil::cast<StoreStmt>(*iter);
221 const StmtSVFGNode* sNode = getStmtVFGNode(store);
222 for(CHISet::iterator pi = mssa->getCHISet(store).begin(), epi = mssa->getCHISet(store).end(); pi!=epi; ++pi)
223 setDef((*pi)->getResVer(),sNode);
224 }
225 //outer loop through each line in the file
226 string line;
227 // add nodes
229 while (F.good())
230 {
231 getline(F, line);
232 if (line.empty())
233 continue;
234 if (line.find("__Edges__") != std::string::npos)
235 break;
236
237 std::string s = line;
238 std::string delimiter = " >= ";
239 string temp;
240 int index = 0;
241 //implement delimiter to split string using ">="
242 size_t next = 0;
243 size_t last = 0;
244 size_t outer_last = 0;
245 size_t nextTemp; //size_t lastTemp;
246 NodeID id = 0;
247 string type;
248 string MR;
249 string basicBlock;
250 string opVer;
251 //inner loop through to get each element in the line
252 while ((next = s.find(delimiter, last)) != string::npos)
253 {
254 temp = s.substr(last, next-last);
255 last = next + 4;
256 outer_last = next + 4;
257 if(index == 0)
258 {
259 nextTemp = temp.find("SVFGNodeID: ") + 12;
260 id = atoi(temp.substr(nextTemp).c_str());
261 }
262 if(index == 1)
263 {
264 type = temp;
265 }
266 if(index > 1)
267 {
268 if(index == 2)
269 {
270 MR = temp;
271 }
272 if(index == 3)
273 {
274 basicBlock = temp;
275 }
276 }
277 index++;
278 }
280 if(!MR.empty())
281 {
283 }
284 else
285 {
287 }
288 //add nodes using the variables we extracted
289 if(type == "FormalINSVFGNode")
290 {
291 outer_last = s.find("ICFGNodeID: ") + 12;
292 NodeID FunID = atoi(s.substr(outer_last).c_str());
293 addFormalINSVFGNode(SVFUtil::dyn_cast<FunEntryICFGNode>(pag->getICFG()->getICFGNode(FunID)), tempMRVer, id);
294 }
295 else if(type == "FormalOUTSVFGNode")
296 {
297 outer_last = s.find("ICFGNodeID: ") + 12;
298 NodeID FunID = atoi(s.substr(outer_last).c_str());
299 addFormalOUTSVFGNode(SVFUtil::dyn_cast<FunExitICFGNode>(pag->getICFG()->getICFGNode(FunID)), tempMRVer, id);
300 }
301 else if(type == "ActualINSVFGNode")
302 {
303 outer_last = s.find("ICFGNodeID: ") + 12;
304 NodeID CallSiteID = atoi(s.substr(outer_last).c_str());
305 addActualINSVFGNode(SVFUtil::dyn_cast<CallICFGNode>(pag->getICFG()->getICFGNode(CallSiteID)), tempMRVer, id);
306 }
307 else if(type == "ActualOUTSVFGNode")
308 {
309 outer_last = s.find("ICFGNodeID: ") + 12;
310 NodeID CallSiteID = atoi(s.substr(outer_last).c_str());
311 addActualOUTSVFGNode(SVFUtil::dyn_cast<CallICFGNode>(pag->getICFG()->getICFGNode(CallSiteID)), tempMRVer, id);
312 }
313 else if (type == "PHISVFGNode")
314 {
315 opVer = s.substr(outer_last);
316 next = opVer.find("{") + 1;
317 last = opVer.find(",}");
318 temp = opVer.substr(next, last);
320 int index = 0;
321 while ((next = temp.find("{") + 1) != string::npos)
322 {
323 if (temp == ",}")
324 break;
325 last = temp.find("},");
326 string temp1;
327 temp1 = temp.substr(next, last-next);
329 OPVers.insert(make_pair(index, tempOPVer));
330 temp = temp.substr(last + 1);
331 index++;
332 }
333 next = basicBlock.find("ICFGNodeID: ") + 12;
334 temp = basicBlock.substr(next);
335 addIntraMSSAPHISVFGNode(pag->getICFG()->getICFGNode(atoi(temp.c_str())), OPVers.begin(), OPVers.end(), tempMRVer, id);
336 }
337 else
338 {
339 }
340
341 if (totalVFGNode < id)
342 totalVFGNode = id + 1;
343 }
344 stat->ATVFNodeEnd();
345
347 // Edges
348 while (F.good())
349 {
350 getline(F, line);
351 if (line.empty())
352 continue;
353
354 std::string s = line;
355 std::string delimiter = " >= ";
356 string temp;
357 // int index = 0;
358 size_t last = 0;
359 size_t next = 0; // size_t outer_last = 0;
360 string edge;
361 string attributes;
362
363 next = s.find(delimiter);
364
365 edge = s.substr(0, next);
366 attributes = s.substr(next + 4);
367
368 // extract nodeIDs for src and dst nodes
369 NodeID src;
370 NodeID dst;
371 next = edge.find("srcSVFGNodeID: ") + 15;
372 last = edge.find(" => ");
373 src = atoi(edge.substr(next, last-next).c_str());
374 next = edge.find("dstSVFGNodeID: ") + 15;
375 dst = atoi(edge.substr(next).c_str());
376
377 string type;
378 string attribute;
379 if (attributes.find(" | ") == string::npos)
381 else
382 {
383 next = attributes.find(" | ");
384 type = attributes.substr(0, next);
385 attribute = attributes.substr(next + 3);
386 }
387
388 if(type == "FormalINSVFGNode")
389 {
390 const FormalINSVFGNode* formalIn = SVFUtil::cast<FormalINSVFGNode>(getSVFGNode(src));
391 const ActualINSVFGNode* actualIn = SVFUtil::cast<ActualINSVFGNode>(getSVFGNode(dst));
393 }
394 else if(type == "FormalOUTSVFGNode")
395 {
396 const FormalOUTSVFGNode* formalOut = SVFUtil::cast<FormalOUTSVFGNode>(getSVFGNode(src));
397 if (attribute.find("intra") != string::npos)
398 {
399 addIntraIndirectVFEdge(dst, src, formalOut->getMRVer()->getMR()->getPointsTo());
400 }
401 else
402 {
403 const ActualOUTSVFGNode* actualOut = SVFUtil::cast<ActualOUTSVFGNode>(getSVFGNode(dst));
405 }
406 }
407 else if(type == "ActualINSVFGNode")
408 {
409 const ActualINSVFGNode* actualIn = SVFUtil::cast<ActualINSVFGNode>(getSVFGNode(src));
410 addIntraIndirectVFEdge(dst,src, actualIn->getMRVer()->getMR()->getPointsTo());
411 }
412 else if(type == "ActualOUTSVFGNode")
413 {
414 // There's no need to connect actual out node to its definition site in the same function.
415 }
416 else if (type == "StoreNode" || type == "LoadNode" || type == "PHISVFGNode")
417 {
419 tempMRVer = getMRVERFromString(attribute);
420 addIntraIndirectVFEdge(dst,src, tempMRVer->getMR()->getPointsTo());
421 }
422 else
423 {
424 }
425 }
428}
newitem type
Definition cJSON.cpp:2739
int index
Definition cJSON.h:170
ICFGNode * getICFGNode(NodeID id) const
Get a ICFG node.
Definition ICFG.h:82
virtual MRVer * getMRVERFromString(const std::string &input)

◆ removeSVFGEdge()

void SVF::SVFG::removeSVFGEdge ( SVFGEdge edge)
inline

Remove a SVFG edge.

Definition at line 254 of file SVFG.h.

255 {
257 }
void removeVFGEdge(VFGEdge *edge)
Remove a SVFG edge.
Definition VFG.h:381

◆ removeSVFGNode()

void SVF::SVFG::removeSVFGNode ( SVFGNode node)
inline

Remove a SVFGNode.

Definition at line 259 of file SVFG.h.

260 {
261 removeVFGNode(node);
262 }
void removeVFGNode(VFGNode *node)
Remove a VFGNode.
Definition VFG.h:388

◆ setDef() [1/2]

void SVF::SVFG::setDef ( const MRVer mvar,
const SVFGNode node 
)
inlineprotected

Given a MSSADef, set/get its def SVFG node (definition of address-taken variables)

Definition at line 384 of file SVFG.h.

385 {
386 MSSAVarToDefMapTy::iterator it = MSSAVarToDefMap.find(mvar);
387 if(it==MSSAVarToDefMap.end())
388 {
389 MSSAVarToDefMap[mvar] = node->getId();
390 assert(hasSVFGNode(node->getId()) && "not in the map!!");
391 }
392 else
393 {
394 assert((it->second == node->getId()) && "a SVFIR node can only have unique definition ");
395 }
396 }

◆ setDef() [2/2]

void SVF::SVFG::setDef ( const ValVar valVar,
const SVFGNode node 
)
inlineprotected

Given a ValVar, set/get its def SVFG node (definition of top level pointers)

Definition at line 368 of file SVFG.h.

369 {
370 VFG::setDef(valVar, node);
371 }
void setDef(const ValVar *valVar, const VFGNode *node)
Given a ValVar, set/get its def VFG node (definition of top level pointers)
Definition VFG.h:469

◆ writeToFile()

void SVFG::writeToFile ( const std::string &  filename)
virtual

Definition at line 46 of file SVFGReadWrite.cpp.

47{
48 outs() << "Writing SVFG analysis to '" << filename << "'...";
50 std::fstream f(filename.c_str(), std::ios_base::out);
51 if (!f.good())
52 {
53 outs() << " error opening file for writing!\n";
54 return;
55 }
56 f << "__Nodes__\n";
57 // Iterate over nodes and write to file
58 for(iterator it = begin(), eit = end(); it!=eit; ++it)
59 {
60 NodeID nodeId = it->first;
61 const SVFGNode* node = it->second;
62 if(const FormalINSVFGNode* formalIn = SVFUtil::dyn_cast<FormalINSVFGNode>(node))
63 {
64 //node
65 f << "SVFGNodeID: " << nodeId << " >= " << "FormalINSVFGNode";
66 f << " >= MVER: {";
67 f << *formalIn->getMRVer() << "} >= ICFGNodeID: " << formalIn->getFunEntryNode()->getId() << "\n";
68 }
69 else if(const FormalOUTSVFGNode* formalOut = SVFUtil::dyn_cast<FormalOUTSVFGNode>(node))
70 {
71 //node
72 f << "SVFGNodeID: " << nodeId << " >= " << "FormalOUTSVFGNode";
73 f << " >= MVER: {";
74 f << *formalOut->getMRVer() << "} >= ICFGNodeID: " << formalOut->getFunExitNode()->getId() << "\n";
75 }
76 else if(const ActualINSVFGNode* actualIn = SVFUtil::dyn_cast<ActualINSVFGNode>(node))
77 {
78 //node
79 f << "SVFGNodeID: " << nodeId << " >= " << "ActualINSVFGNode";
80 f << " >= MVER: {";
81 f << *actualIn->getMRVer() << "} >= ICFGNodeID: " << actualIn->getCallSite()->getId() << "\n";
82 }
83 else if(const ActualOUTSVFGNode* actualOut = SVFUtil::dyn_cast<ActualOUTSVFGNode>(node))
84 {
85 //node
86 f << "SVFGNodeID: " << nodeId << " >= " << "ActualOUTSVFGNode" << " >= MVER: {";
87 f << *actualOut->getMRVer() << "} >= ICFGNodeID: " << actualOut->getCallSite()->getId() << "\n";
88 }
89 else if(const MSSAPHISVFGNode* phiNode = SVFUtil::dyn_cast<MSSAPHISVFGNode>(node))
90 {
91 //node
92 f << "SVFGNodeID: " << nodeId << " >= " << "PHISVFGNode";
94 for (MemSSA::PHI::OPVers::const_iterator it = phiNode->opVerBegin(), eit = phiNode->opVerEnd();
95 it != eit; it++)
96 {
97 opvers.insert(make_pair(it->first, it->second));
98 }
99 // opvers
100 f << " >= MVER: {";
101 f << *phiNode->getResVer();
102 const ICFGNode* inst = phiNode->getICFGNode()->getBB()->front();
103 f << "} >= ICFGNodeID: " << inst->getId();
104 f << " >= OPVers: {";
105 for (auto x: opvers)
106 {
107 const MRVer* op = x.second;
108 f << "{" << *op << "}" << ",";
109 }
110 f << "}\n";
111 }
112 }
113
114 f << "\n\n__Edges__\n";
115 // Iterate over edges and write to file
116 for(iterator it = begin(), eit = end(); it!=eit; ++it)
117 {
118 NodeID nodeId = it->first;
119 const SVFGNode* node = it->second;
120 if(const LoadSVFGNode* loadNode = SVFUtil::dyn_cast<LoadSVFGNode>(node))
121 {
122 MUSet& muSet = mssa->getMUSet(SVFUtil::cast<LoadStmt>(loadNode->getSVFStmt()));
123 for(MUSet::iterator it = muSet.begin(), eit = muSet.end(); it!=eit; ++it)
124 {
125 if(LOADMU* mu = SVFUtil::dyn_cast<LOADMU>(*it))
126 {
127 NodeID def = getDef(mu->getMRVer());
128 f << "srcSVFGNodeID: " << nodeId << " => " << "dstSVFGNodeID: " << def << " >= LoadNode | MVER: {" << *mu->getMRVer() << "}" << "\n";
129 }
130 }
131 }
132 else if(const StoreSVFGNode* storeNode = SVFUtil::dyn_cast<StoreSVFGNode>(node))
133 {
134 CHISet& chiSet = mssa->getCHISet(SVFUtil::cast<StoreStmt>(storeNode->getSVFStmt()));
135 for(CHISet::iterator it = chiSet.begin(), eit = chiSet.end(); it!=eit; ++it)
136 {
137 if(STORECHI* chi = SVFUtil::dyn_cast<STORECHI>(*it))
138 {
139 NodeID def = getDef(chi->getOpVer());
140 f << "srcSVFGNodeID: " << nodeId << " => " << "dstSVFGNodeID: " << def << " >= StoreNode | MVER: {" << *chi->getOpVer() << "}" << "\n";
141 }
142 }
143 }
144 else if(const FormalINSVFGNode* formalIn = SVFUtil::dyn_cast<FormalINSVFGNode>(node))
145 {
147 mssa->getPTA()->getCallGraph()->getDirCallSitesInvokingCallee(formalIn->getFun(),callInstSet);
148 for(CallGraphEdge::CallInstSet::iterator it = callInstSet.begin(), eit = callInstSet.end(); it!=eit; ++it)
149 {
150 const CallICFGNode* cs = *it;
151 if(!mssa->hasMU(cs))
152 continue;
155 {
156 const ActualINSVFGNode* actualIn = SVFUtil::cast<ActualINSVFGNode>(getSVFGNode(*ait));
157 f << "srcSVFGNodeID: " << nodeId << " => " << "dstSVFGNodeID: " << actualIn->getId() << " >= FormalINSVFGNode" << "\n";
158 }
159 }
160 }
161 else if(const FormalOUTSVFGNode* formalOut = SVFUtil::dyn_cast<FormalOUTSVFGNode>(node))
162 {
164 mssa->getPTA()->getCallGraph()->getDirCallSitesInvokingCallee(formalOut->getFun(),callInstSet);
165 for(CallGraphEdge::CallInstSet::iterator it = callInstSet.begin(), eit = callInstSet.end(); it!=eit; ++it)
166 {
167 const CallICFGNode* cs = *it;
168 if(!mssa->hasCHI(cs))
169 continue;
172 {
173 const ActualOUTSVFGNode* actualOut = SVFUtil::cast<ActualOUTSVFGNode>(getSVFGNode(*ait));
174 f << "srcSVFGNodeID: " << nodeId << " => " << "dstSVFGNodeID: " << actualOut->getId() << " >= FormalOUTSVFGNode" << "\n";
175 }
176 }
177 NodeID def = getDef(formalOut->getMRVer());
178 f << "srcSVFGNodeID: " << nodeId << " => " << "dstSVFGNodeID: " << def << " >= FormalOUTSVFGNode | intra" << "\n";
179 }
180 else if(const ActualINSVFGNode* actualIn = SVFUtil::dyn_cast<ActualINSVFGNode>(node))
181 {
182 NodeID def = getDef(actualIn->getMRVer());
183 f << "srcSVFGNodeID: " << nodeId << " => " << "dstSVFGNodeID: " << def << " >= ActualINSVFGNode" << "\n";
184
185 }
186 else if(const MSSAPHISVFGNode* phiNode = SVFUtil::dyn_cast<MSSAPHISVFGNode>(node))
187 {
188 for (MemSSA::PHI::OPVers::const_iterator it = phiNode->opVerBegin(), eit = phiNode->opVerEnd();
189 it != eit; it++)
190 {
191 const MRVer* op = it->second;
192 NodeID def = getDef(op);
193 f << "srcSVFGNodeID: " << nodeId << " => " << "dstSVFGNodeID: " << def << " >= PHISVFGNode | MVER: {" << *op << "}" << "\n";
194 }
195 }
196 }
197 // Job finish and close file
198 f.close();
199 if (f.good())
200 {
201 outs() << "\n";
202 return;
203 }
204}
virtual const SVFBasicBlock * getBB() const
Return the basic block of this ICFGNode.
Definition ICFGNode.h:80
const ICFGNode * front() const

Friends And Related Symbol Documentation

◆ CFLSVFGBuilder

Definition at line 69 of file SVFG.h.

◆ DDASVFGBuilder

friend class DDASVFGBuilder
friend

Definition at line 71 of file SVFG.h.

◆ MTASVFGBuilder

friend class MTASVFGBuilder
friend

Definition at line 72 of file SVFG.h.

◆ RcSvfgBuilder

friend class RcSvfgBuilder
friend

Definition at line 73 of file SVFG.h.

◆ SaberSVFGBuilder

Definition at line 68 of file SVFG.h.

◆ SVFGBuilder

Definition at line 67 of file SVFG.h.

◆ TaintSVFGBuilder

friend class TaintSVFGBuilder
friend

Definition at line 70 of file SVFG.h.

Member Data Documentation

◆ callSiteToActualINMap

CallSiteToActualINsMapTy SVF::SVFG::callSiteToActualINMap
protected

Definition at line 101 of file SVFG.h.

◆ callSiteToActualOUTMap

CallSiteToActualOUTsMapTy SVF::SVFG::callSiteToActualOUTMap
protected

Definition at line 102 of file SVFG.h.

◆ funToFormalINMap

FunctionToFormalINsMapTy SVF::SVFG::funToFormalINMap
protected

Definition at line 103 of file SVFG.h.

◆ funToFormalOUTMap

FunctionToFormalOUTsMapTy SVF::SVFG::funToFormalOUTMap
protected

Definition at line 104 of file SVFG.h.

◆ mssa

std::unique_ptr<MemSSA> SVF::SVFG::mssa
protected

Definition at line 106 of file SVFG.h.

◆ MSSAVarToDefMap

MSSAVarToDefMapTy SVF::SVFG::MSSAVarToDefMap
protected

map a memory SSA operator to its definition SVFG node

Definition at line 100 of file SVFG.h.

◆ pta

PointerAnalysis* SVF::SVFG::pta
protected

Definition at line 107 of file SVFG.h.

◆ stat

SVFGStat* SVF::SVFG::stat
protected

Definition at line 105 of file SVFG.h.


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