|
Static Value-Flow Analysis
|
#include <SparseObjGraph.h>
Public Types | |
| typedef SparseObjNode | Node |
| typedef SparseObjEdge | Edge |
| Public Types inherited from SVF::GenericGraph< SparseObjNode, SparseObjEdge > | |
| typedef SparseObjNode | NodeType |
| typedef SparseObjEdge | 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 | |
| SparseObjGraph (const SVFG &svfg, ICFG &icfg, PointerAnalysis &pta, const PAG &pag) | |
| Construction uses static graphs and points-to results, not AE state. | |
| ~SparseObjGraph () override | |
| SparseObjGraph (const SparseObjGraph &)=delete | |
| SparseObjGraph & | operator= (const SparseObjGraph &)=delete |
| const std::vector< const Edge * > & | getInputs (const ICFGNode *node) const |
| Return incoming edges at this ICFG location for client-side value flow. | |
| std::string | toString () const |
| Describe the static nodes and edges as text, without AE values. | |
| void | dump (const std::string &file) |
| Write a DOT graph to <file>.dot through GraphPrinter. | |
| const PAG & | getPAG () const |
| Public Member Functions inherited from SVF::GenericGraph< SparseObjNode, SparseObjEdge > | |
| 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. | |
| 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 () |
Private Types | |
| typedef std::pair< const ICFGNode *, const IntraCFGEdge * > | NodeKey |
| typedef std::pair< NodeKey, NodeKey > | EdgeKey |
Private Member Functions | |
| bool | isBranch (const ICFGNode *node) const |
| bool | isControlBoundary (const ICFGNode *node) const |
| void | addRoute (const NodeBS &bases, const ICFGNode *source, const ICFGNode *target, const IntraCFGEdge *branch) |
| void | addRoute (NodeID base, const ICFGNode *source, const ICFGNode *target, const IntraCFGEdge *branch) |
| void | connectFunction (const FunObjVar *fun, const NodeBS &funBases, const Map< const ICFGNode *, NodeBS > &eventsAt) |
| Walk one function once, carrying base sets instead of one base. | |
| void | addSource (const ICFGNode *node, const NodeBS &bases) |
| void | connectCallBypass (const CallICFGNode *call, const NodeBS &bases) |
| Route the bases that no callee returns from the call to its return site. | |
| void | connectSegment (const FunObjVar *fun, const ICFGNode *source, const ICFGNode *start, const IntraCFGEdge *branch, const NodeBS &bases, const Map< const ICFGNode *, NodeBS > &eventsAt) |
| Node * | getOrCreateNode (const ICFGNode *location, const IntraCFGEdge *branch) |
| const NodeBS * | intern (const NodeBS &bases) |
| void | finalize () |
Static Private Member Functions | |
| static const NodeBS & | getEvents (const Map< const ICFGNode *, NodeBS > &eventsAt, const ICFGNode *node) |
Private Attributes | |
| ICFG & | icfg |
| const PAG & | pag |
| Map< NodeKey, Node * > | nodes |
| std::map< EdgeKey, NodeBS > | routeLabels |
| Map< const ICFGNode *, std::vector< const Edge * > > | inputs |
| Map< u64_t, std::vector< std::unique_ptr< NodeBS > > > | labels |
| Interned labels, bucketed by hash. | |
| Map< const ICFGNode *, NodeBS > | returnedGroups |
| Map< const ICFGNode *, Map< const FunObjVar *, NodeBS > > | returnedGroupsByCallee |
| Map< const ICFGNode *, NodeBS > | doneSources |
| Worklist of connectFunction for the function being connected. | |
| Map< const ICFGNode *, NodeBS > | pendingSources |
| std::deque< const ICFGNode * > | sourceWorklist |
Additional Inherited Members | |
| Public Attributes inherited from SVF::GenericGraph< SparseObjNode, SparseObjEdge > | |
| u32_t | edgeNum |
| total num of node | |
| u32_t | nodeNum |
| total num of edge | |
| Protected Attributes inherited from SVF::GenericGraph< SparseObjNode, SparseObjEdge > | |
| IDToNodeMapTy | IDToNodeMap |
| node map | |
Prebuild Obj routes from SVFG object information and ICFG order. Fields and array elements of the same base are packed on one route: D: a[0] = 1; S: a[1] = 7; N: use(a[0]); Program order gives D -> S -> N, rather than two independent packed inputs from D and S. Bases that share a route segment share one labeled edge: S1: *p = 1 (p -> {a,b}); S2: *q = 2 (q -> {a,b}) gives one edge S1 -{a,b}-> S2. A branch edge gets one node, but the graph neither computes nor stores intervals; clients check feasibility and refine values.
Definition at line 79 of file SparseObjGraph.h.
Definition at line 83 of file SparseObjGraph.h.
|
private |
Definition at line 106 of file SparseObjGraph.h.
Definition at line 82 of file SparseObjGraph.h.
|
private |
Definition at line 105 of file SparseObjGraph.h.
| SparseObjGraph::SparseObjGraph | ( | const SVFG & | svfg, |
| ICFG & | icfg, | ||
| PointerAnalysis & | pta, | ||
| const PAG & | pag ) |
Construction uses static graphs and points-to results, not AE state.
Definition at line 56 of file SparseObjGraph.cpp.
|
overridedefault |
|
delete |
|
private |
Record that bases travel from source (via branch, if non-null) to target. Labels accumulate in routeLabels and become edges in finalize.
Definition at line 233 of file SparseObjGraph.cpp.
|
private |
Definition at line 224 of file SparseObjGraph.cpp.
Queue bases to start a route segment at node, skipping bases already processed there.
Definition at line 297 of file SparseObjGraph.cpp.
|
private |
Route the bases that no callee returns from the call to its return site.
Definition at line 311 of file SparseObjGraph.cpp.
|
private |
Walk one function once, carrying base sets instead of one base.
Definition at line 252 of file SparseObjGraph.cpp.
|
private |
Follow ordinary ICFG nodes from start until each base reaches its next event or a control boundary.
Definition at line 350 of file SparseObjGraph.cpp.
| void SparseObjGraph::dump | ( | const std::string & | file | ) |
Write a DOT graph to <file>.dot through GraphPrinter.
Definition at line 544 of file SparseObjGraph.cpp.
|
private |
Definition at line 427 of file SparseObjGraph.cpp.
|
staticprivate |
Definition at line 394 of file SparseObjGraph.cpp.
| const std::vector< const SparseObjGraph::Edge * > & SparseObjGraph::getInputs | ( | const ICFGNode * | node | ) | const |
Return incoming edges at this ICFG location for client-side value flow.
Definition at line 447 of file SparseObjGraph.cpp.
|
private |
Definition at line 402 of file SparseObjGraph.cpp.
|
inline |
Definition at line 99 of file SparseObjGraph.h.
Definition at line 414 of file SparseObjGraph.cpp.
|
private |
Definition at line 206 of file SparseObjGraph.cpp.
|
private |
Definition at line 218 of file SparseObjGraph.cpp.
|
delete |
| std::string SparseObjGraph::toString | ( | ) | const |
Describe the static nodes and edges as text, without AE values.
Definition at line 454 of file SparseObjGraph.cpp.
Worklist of connectFunction for the function being connected.
Definition at line 149 of file SparseObjGraph.h.
|
private |
Definition at line 136 of file SparseObjGraph.h.
Definition at line 140 of file SparseObjGraph.h.
Interned labels, bucketed by hash.
Definition at line 142 of file SparseObjGraph.h.
Definition at line 138 of file SparseObjGraph.h.
|
private |
Definition at line 137 of file SparseObjGraph.h.
Definition at line 150 of file SparseObjGraph.h.
Bases with a callee-output to caller-return SVFG edge. The second map distinguishes callees when deciding whether a multi-target call bypasses.
Definition at line 145 of file SparseObjGraph.h.
|
private |
Definition at line 146 of file SparseObjGraph.h.
Definition at line 139 of file SparseObjGraph.h.
|
private |
Definition at line 151 of file SparseObjGraph.h.