|
Static Value-Flow Analysis
|
#include <ConsG.h>
Public Types | |
| typedef OrderedMap< NodeID, ConstraintNode * > | ConstraintNodeIDToNodeMapTy |
| typedef ConstraintEdge::ConstraintEdgeSetTy::iterator | ConstraintNodeIter |
| typedef Map< NodeID, NodeID > | NodeToRepMap |
| typedef Map< NodeID, NodeBS > | NodeToSubsMap |
| typedef FIFOWorkList< NodeID > | WorkList |
| Public Types inherited from SVF::GenericGraph< ConstraintNode, ConstraintEdge > | |
| typedef ConstraintNode | NodeType |
| typedef ConstraintEdge | 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 | |
| ConstraintGraph (SVFIR *p) | |
| Constructor. | |
| virtual | ~ConstraintGraph () |
| Destructor. | |
| ConstraintNode * | getConstraintNode (NodeID id) const |
| Get/add/remove constraint node. | |
| void | addConstraintNode (ConstraintNode *node, NodeID id) |
| bool | hasConstraintNode (NodeID id) const |
| void | removeConstraintNode (ConstraintNode *node) |
| bool | hasEdge (ConstraintNode *src, ConstraintNode *dst, ConstraintEdge::ConstraintEdgeK kind) |
| ConstraintEdge * | getEdge (ConstraintNode *src, ConstraintNode *dst, ConstraintEdge::ConstraintEdgeK kind) |
| Get an edge via its src and dst nodes and kind. | |
| AddrCGEdge * | addAddrCGEdge (NodeID src, NodeID dst) |
| Add a SVFIR edge into Edge map. | |
| CopyCGEdge * | addCopyCGEdge (NodeID src, NodeID dst) |
| Add Copy edge. | |
| NormalGepCGEdge * | addNormalGepCGEdge (NodeID src, NodeID dst, const AccessPath &ap) |
| Add Gep edge. | |
| VariantGepCGEdge * | addVariantGepCGEdge (NodeID src, NodeID dst) |
| LoadCGEdge * | addLoadCGEdge (NodeID src, NodeID dst) |
| Add Load edge. | |
| StoreCGEdge * | addStoreCGEdge (NodeID src, NodeID dst) |
| Add Store edge. | |
| ConstraintEdge::ConstraintEdgeSetTy & | getAddrCGEdges () |
| Get SVFIR edge. | |
| ConstraintEdge::ConstraintEdgeSetTy & | getDirectCGEdges () |
| Get Copy/call/ret/gep edges. | |
| ConstraintEdge::ConstraintEdgeSetTy & | getLoadCGEdges () |
| Get Load edges. | |
| ConstraintEdge::ConstraintEdgeSetTy & | getStoreCGEdges () |
| Get Store edges. | |
| void | reTargetDstOfEdge (ConstraintEdge *edge, ConstraintNode *newDstNode) |
| Used for cycle elimination. | |
| void | reTargetSrcOfEdge (ConstraintEdge *edge, ConstraintNode *newSrcNode) |
| Remove edge from old src target, change edge dst id and add modified edge into new src. | |
| void | removeAddrEdge (AddrCGEdge *edge) |
| Remove addr edge from their src and dst edge sets. | |
| void | removeDirectEdge (ConstraintEdge *edge) |
| Remove direct edge from their src and dst edge sets. | |
| void | removeLoadEdge (LoadCGEdge *edge) |
| Remove load edge from their src and dst edge sets. | |
| void | removeStoreEdge (StoreCGEdge *edge) |
| Remove store edge from their src and dst edge sets. | |
| NodeID | sccRepNode (NodeID id) const |
| SCC rep/sub nodes methods. | |
| NodeBS & | sccSubNodes (NodeID id) |
| void | setRep (NodeID node, NodeID rep) |
| void | setSubs (NodeID node, NodeBS &subs) |
| void | resetSubs (NodeID node) |
| NodeBS & | getSubs (NodeID node) |
| NodeID | getRep (NodeID node) |
| void | resetRep (NodeID node) |
| bool | moveInEdgesToRepNode (ConstraintNode *node, ConstraintNode *rep) |
| bool | moveOutEdgesToRepNode (ConstraintNode *node, ConstraintNode *rep) |
| bool | moveEdgesToRepNode (ConstraintNode *node, ConstraintNode *rep) |
| bool | isZeroOffsettedGepCGEdge (ConstraintEdge *edge) const |
| Check if a given edge is a NormalGepCGEdge with 0 offset. | |
| const SVFIR::CallSiteToFunPtrMap & | getIndirectCallsites () const |
| Wrappers for invoking SVFIR methods. | |
| NodeID | getBlackHoleNode () |
| bool | isBlkObjOrConstantObj (NodeID id) |
| NodeBS & | getAllFieldsObjVars (NodeID id) |
| NodeID | getBaseObjVarID (NodeID id) |
| bool | isSingleFieldObj (NodeID id) const |
| NodeID | getGepObjVar (NodeID id, const APOffset &apOffset) |
| Get a field of a memory object. | |
| NodeID | getFIObjVar (NodeID id) |
| Get a field-insensitive node of a memory object. | |
| bool | isPWCNode (NodeID nodeId) |
| Check/Set PWC (positive weight cycle) flag. | |
| void | setPWCNode (NodeID nodeId) |
| bool | hasNodesToBeCollapsed () const |
| Add/get nodes to be collapsed. | |
| void | addNodeToBeCollapsed (NodeID id) |
| NodeID | getNextCollapseNode () |
| void | dump (std::string name) |
| Dump graph into dot file. | |
| void | print () |
| Print CG into terminal. | |
| void | view () |
| View graph from the debugger. | |
| Public Member Functions inherited from SVF::GenericGraph< ConstraintNode, ConstraintEdge > | |
| GenericGraph () | |
| Constructor. | |
| virtual | ~GenericGraph () |
| Destructor. | |
| void | destroy () |
| Release memory. | |
| iterator | begin () |
| Iterators. | |
| iterator | end () |
| void | addGNode (NodeID id, NodeType *node) |
| Add a Node. | |
| NodeType * | getGNode (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 | buildCG () |
| void | destroy () |
| void | clearSolitaries () |
| SVFStmt::SVFStmtSetTy & | getSVFStmtSet (SVFStmt::PEDGEK kind) |
| NodeID | getReturnNode (const FunObjVar *value) const |
| Wrappers used internally, not expose to Andersen Pass. | |
| NodeID | getVarargNode (const FunObjVar *value) const |
Additional Inherited Members | |
| Public Attributes inherited from SVF::GenericGraph< ConstraintNode, ConstraintEdge > | |
| u32_t | edgeNum |
| total num of node | |
| u32_t | nodeNum |
| total num of edge | |
Constraint graph for Andersen's analysis ConstraintNodes are same as PAGNodes ConstraintEdges are self-defined edges (initialized with ConstraintEdges)
| typedef ConstraintEdge::ConstraintEdgeSetTy::iterator SVF::ConstraintGraph::ConstraintNodeIter |
| typedef Map<NodeID, NodeID> SVF::ConstraintGraph::NodeToRepMap |
| typedef Map<NodeID, NodeBS> SVF::ConstraintGraph::NodeToSubsMap |
|
inline |
|
inlinevirtual |
Destructor.
| AddrCGEdge * ConstraintGraph::addAddrCGEdge | ( | NodeID | src, |
| NodeID | dst ) |
Add a SVFIR edge into Edge map.
Add Address edge
Add an address edge
Definition at line 206 of file ConsG.cpp.
|
inline |
| CopyCGEdge * ConstraintGraph::addCopyCGEdge | ( | NodeID | src, |
| NodeID | dst ) |
Add Copy edge.
Add Copy edge
Definition at line 226 of file ConsG.cpp.
| LoadCGEdge * ConstraintGraph::addLoadCGEdge | ( | NodeID | src, |
| NodeID | dst ) |
Add Load edge.
Add Load edge
Definition at line 292 of file ConsG.cpp.
|
inline |
| NormalGepCGEdge * ConstraintGraph::addNormalGepCGEdge | ( | NodeID | src, |
| NodeID | dst, | ||
| const AccessPath & | ap ) |
Add Gep edge.
Add Gep edge
Definition at line 249 of file ConsG.cpp.
| StoreCGEdge * ConstraintGraph::addStoreCGEdge | ( | NodeID | src, |
| NodeID | dst ) |
Add Store edge.
Add Store edge
Definition at line 313 of file ConsG.cpp.
| VariantGepCGEdge * ConstraintGraph::addVariantGepCGEdge | ( | NodeID | src, |
| NodeID | dst ) |
Add variant gep edge
Definition at line 271 of file ConsG.cpp.
|
protected |
Start building constraint graph
Definition at line 42 of file ConsG.cpp.
|
protected |
Remove nodes that are neither pointers nor connected with any edge
We don't remove return SVFVar from an indirect callsite
Definition at line 154 of file ConsG.cpp.
|
protected |
| void ConstraintGraph::dump | ( | std::string | name | ) |
Dump graph into dot file.
Dump constraint graph
Definition at line 595 of file ConsG.cpp.
|
inline |
Get SVFIR edge.
Get Address edges
|
inline |
|
inline |
Get/add/remove constraint node.
Definition at line 104 of file ConsG.h.
|
inline |
Get Copy/call/ret/gep edges.
|
inline |
Get an edge via its src and dst nodes and kind.
Definition at line 143 of file ConsG.h.
Get a field-insensitive node of a memory object.
The fi obj in PAG must be either an existing node or merged to another rep node in ConsG
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
inline |
|
inline |
|
inline |
Add/get nodes to be collapsed.
|
inline |
|
inline |
Check/Set PWC (positive weight cycle) flag.
Definition at line 345 of file ConsG.h.
|
inline |
|
inline |
Check if a given edge is a NormalGepCGEdge with 0 offset.
Definition at line 289 of file ConsG.h.
|
inline |
Move incoming/outgoing direct edges of a sub node to its rep node Return TRUE if there's a gep edge inside this SCC (PWC).
Definition at line 281 of file ConsG.h.
| bool ConstraintGraph::moveInEdgesToRepNode | ( | ConstraintNode * | node, |
| ConstraintNode * | rep ) |
Move incoming direct edges of a sub node which is outside the SCC to its rep node Remove incoming direct edges of a sub node which is inside the SCC from its rep node Return TRUE if there's a gep edge inside this SCC (PWC).
Move incoming direct edges of a sub node which is outside SCC to its rep node Remove incoming direct edges of a sub node which is inside SCC from its rep node
only copy and gep edge can be removed
Definition at line 478 of file ConsG.cpp.
| bool ConstraintGraph::moveOutEdgesToRepNode | ( | ConstraintNode * | node, |
| ConstraintNode * | rep ) |
Move outgoing direct edges of a sub node which is outside the SCC to its rep node Remove outgoing direct edges of sub node which is inside the SCC from its rep node Return TRUE if there's a gep edge inside this SCC (PWC).
Move outgoing direct edges of a sub node which is outside SCC to its rep node Remove outgoing direct edges of a sub node which is inside SCC from its rep node
only copy and gep edge can be removed
Definition at line 536 of file ConsG.cpp.
| void ConstraintGraph::print | ( | ) |
Print CG into terminal.
Print this constraint graph including its nodes and edges
Definition at line 603 of file ConsG.cpp.
| void ConstraintGraph::removeAddrEdge | ( | AddrCGEdge * | edge | ) |
Remove addr edge from their src and dst edge sets.
Remove addr edge from their src and dst edge sets
Definition at line 424 of file ConsG.cpp.
|
inline |
| void ConstraintGraph::removeDirectEdge | ( | ConstraintEdge * | edge | ) |
Remove direct edge from their src and dst edge sets.
Remove edges from their src and dst edge sets
Definition at line 463 of file ConsG.cpp.
| void ConstraintGraph::removeLoadEdge | ( | LoadCGEdge * | edge | ) |
Remove load edge from their src and dst edge sets.
Remove load edge from their src and dst edge sets
Definition at line 437 of file ConsG.cpp.
| void ConstraintGraph::removeStoreEdge | ( | StoreCGEdge * | edge | ) |
Remove store edge from their src and dst edge sets.
Remove store edge from their src and dst edge sets
Definition at line 450 of file ConsG.cpp.
|
inline |
|
inline |
| void ConstraintGraph::reTargetDstOfEdge | ( | ConstraintEdge * | edge, |
| ConstraintNode * | newDstNode ) |
Used for cycle elimination.
Remove edge from old dst target, change edge dst id and add modified edge into new dst
Re-target dst node of an edge
(1) Remove edge from old dst target, (2) Change edge dst id and (3) Add modified edge into new dst
Definition at line 339 of file ConsG.cpp.
| void ConstraintGraph::reTargetSrcOfEdge | ( | ConstraintEdge * | edge, |
| ConstraintNode * | newSrcNode ) |
Remove edge from old src target, change edge dst id and add modified edge into new src.
Re-target src node of an edge (1) Remove edge from old src target, (2) Change edge src id and (3) Add modified edge into new src
Definition at line 383 of file ConsG.cpp.
|
inline |
| void ConstraintGraph::view | ( | ) |
View graph from the debugger.
View dot graph of Constraint graph from debugger.
Definition at line 663 of file ConsG.cpp.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |