|
Static Value-Flow Analysis
|
#include <MTASVFGBuilder.h>
Public Types | |
| typedef Set< const StmtSVFGNode * > | SVFGNodeSet |
| typedef NodeBS | SVFGNodeIDSet |
| typedef std::pair< const StmtSVFGNode *, const StmtSVFGNode * > | ThreadVFEdge |
Public Types inherited from SVF::SVFGBuilder | |
| typedef PointerAnalysis::CallSiteSet | CallSiteSet |
| typedef PointerAnalysis::CallEdgeMap | CallEdgeMap |
| typedef PointerAnalysis::FunctionSet | FunctionSet |
| typedef SVFG::SVFGEdgeSetTy | SVFGEdgeSet |
Static Public Attributes | |
| static u32_t | numOfNewSVFGEdges = 0 |
| Number of thread-aware (interference) SVFG edges added. | |
Protected Member Functions | |
| void | buildSVFG () override |
| Rewrite the SVFG build hook: build the stock SVFG, then add MHP edges. | |
| std::unique_ptr< MRGenerator > | createMRGenerator (BVDataPTAImpl *pta, bool ptrOnlyMSSA) override |
Protected Member Functions inherited from SVF::SVFGBuilder | |
| SVFG * | build (BVDataPTAImpl *pta, VFG::VFGK kind) |
| Create a DDA SVFG. By default actualOut and FormalIN are removed, unless withAOFI is set true. | |
| virtual void | releaseMemory () |
| Release global SVFG. | |
Private Member Functions | |
| void | collectLoadStoreSVFGNodes () |
| void | connectThreadJoinEdges () |
| void | addJoinRetEdge (const FormalOUTSVFGNode *formalOut, const ActualOUTSVFGNode *actualOut, CallSiteID csId) |
| void | connectMHPEdges (PointerAnalysis *pta) |
| Connect inter-thread (interference) value-flow edges for MHP pairs. | |
| void | handleStoreLoad (const StmtSVFGNode *n1, const StmtSVFGNode *n2, PointerAnalysis *pta) |
| void | handleStoreStore (const StmtSVFGNode *n1, const StmtSVFGNode *n2, PointerAnalysis *pta) |
| void | recordThreadVFSource (const StmtSVFGNode *s, const StmtSVFGNode *sp, bool commonLock) |
| SVFGEdge * | addTDEdge (NodeID srcId, NodeID dstId, const PointsTo &pts) |
| Add a thread-MHP indirect value-flow edge srcId -> dstId carrying pts. | |
| SVFGNodeIDSet | getPrevNodes (const StmtSVFGNode *n) |
| Lock-span head/tail tests (non-interference lock-pair pruning). | |
| SVFGNodeIDSet | getSuccNodes (const StmtSVFGNode *n) |
| bool | isHeadOfSpan (const StmtSVFGNode *n) |
| bool | isTailOfSpan (const StmtSVFGNode *n) |
Private Attributes | |
| const SlicedICFGView * | icfgSlice = nullptr |
| Main-solve configuration (see configureForMainSolve); defaults suit VFG_pre. | |
| bool | recordThreadVF = true |
| false = skip [THREAD-VF] recording | |
| SVFGNodeSet | stnodeSet |
| all store SVFG nodes | |
| SVFGNodeSet | ldnodeSet |
| all load SVFG nodes | |
| std::map< ThreadVFEdge, std::set< const ICFGNode * > > | threadVFQueryMap |
| [THREAD-VF] per-edge query map (see getThreadVFQueryMap). | |
| MHP * | mhp |
| LockAnalysis * | lockana |
| Map< const StmtSVFGNode *, SVFGNodeIDSet > | prevset |
| Map< const StmtSVFGNode *, SVFGNodeIDSet > | succset |
| Map< const StmtSVFGNode *, bool > | headmap |
| Map< const StmtSVFGNode *, bool > | tailmap |
Additional Inherited Members | |
Protected Attributes inherited from SVF::SVFGBuilder | |
| SVFGEdgeSet | vfEdgesAtIndCallSite |
| SVFG Edges connected at indirect call/ret sites. | |
| std::unique_ptr< SVFG > | svfg |
| bool | SVFGWithIndCall |
| SVFG with precomputed indirect call edges. | |
| bool | SVFGWithPostOpts |
| Build optimised version of SVFG. | |
Definition at line 56 of file MTASVFGBuilder.h.
Definition at line 60 of file MTASVFGBuilder.h.
Definition at line 59 of file MTASVFGBuilder.h.
| typedef std::pair<const StmtSVFGNode*, const StmtSVFGNode*> SVF::MTASVFGBuilder::ThreadVFEdge |
A candidate thread-aware value-flow edge s –o--> s' (src store, dst load/store), keyed by its endpoint SVFG nodes.
Definition at line 84 of file MTASVFGBuilder.h.
|
inline |
Constructor: driven by the interleaving (MHP) and lock analyses.
Definition at line 63 of file MTASVFGBuilder.h.
|
overridedefault |
|
private |
Add a FormalOUT -> ActualOUT inter-procedural indirect ret edge for a join, mirroring SVFG::addInterIndirectVFRetEdge using the public SVFG API (points-to intersection + dedup via hasInterVFGEdge + addSVFGEdge).
Mirror of SVFG::addInterIndirectVFRetEdge over the public SVFG API, so the join edges can be added from the builder without modifying core SVFG.
Definition at line 137 of file MTASVFGBuilder.cpp.
Add a thread-MHP indirect value-flow edge srcId -> dstId carrying pts.
Add (or merge into) a thread-MHP indirect value-flow edge src -> dst.
Definition at line 226 of file MTASVFGBuilder.cpp.
|
overrideprotectedvirtual |
Rewrite the SVFG build hook: build the stock SVFG, then add MHP edges.
Build the stock (thread-oblivious) SVFG, add the FSAM join-related def-use edges (relocated out of core SVFG.cpp), then add thread-aware MHP edges.
Reimplemented from SVF::SVFGBuilder.
Definition at line 126 of file MTASVFGBuilder.cpp.
|
private |
Collect the store/load SVFG nodes to pair for interference edges (all of them, or – when a slice is set – only the kept ones).
Collect all store/load SVFG nodes.
Definition at line 200 of file MTASVFGBuilder.cpp.
|
inline |
Configure the builder for the main (post-slicing) FSAM solve rather than the pre-analysis VFG_pre:
Definition at line 76 of file MTASVFGBuilder.h.
|
private |
Connect inter-thread (interference) value-flow edges for MHP pairs.
For every MHP store/load and store/store pair, add the thread-aware (interference) value-flow edges.
Definition at line 490 of file MTASVFGBuilder.cpp.
|
private |
FSAM join-related thread-oblivious value flow (the "return" half of treating a join as a call without a forward): connect each start routine's exit defs (FormalOUT) to the ActualOUT at every site that joins it (FormalOUT -> ActualOUT ret edge). Done here as a post-pass over the stock SVFG, so core SVFG.cpp stays unmodified.
FSAM join-related def-use (the "return" half of treating a join as a call without a forward): for every FormalOUT (a start routine's exit def), connect it to the ActualOUT at each site that joins that routine. Relocated here from core SVFG::connectIndirectSVFGEdges so the stock SVFG stays unmodified.
Definition at line 166 of file MTASVFGBuilder.cpp.
|
overrideprotectedvirtual |
Inject a thread-aware MRGenerator so the MemSSA mod-ref carries the FSAM fork/join side effects (relocated here from core MemRegion).
Reimplemented from SVF::SVFGBuilder.
Definition at line 106 of file MTASVFGBuilder.cpp.
|
private |
Lock-span head/tail tests (non-interference lock-pair pruning).
Backward reachable store SVFG nodes via indirect value flow (lock-span head test).
Definition at line 248 of file MTASVFGBuilder.cpp.
|
private |
Forward reachable store/load SVFG nodes via indirect value flow (lock-span tail test).
Definition at line 288 of file MTASVFGBuilder.cpp.
|
inline |
[THREAD-VF] per-edge query map (MSli §4.2, Fig. 6 rule [THREAD-VF]).
While building VFG_pre we record, for every candidate thread-aware value-flow edge (s,s') the construction evaluates, its Query(s –o--> s') set: the endpoints {s,s'} plus — under a common lock — the in-span witnesses Succ_spl(s) / Pred_spl'(s') that decide TL/HD membership, i.e. whether the edge survives the non-interference test (Def. 2). The query is kept per edge (not pre-unioned) so ILA slicing can restrict the sources to the edges that survive the FSPTA slice — ThreadVF(VFG'_pre) — rather than every candidate pair. Feeding the retained edges' queries into ILA slicing makes the sliced MHP/lock reproduce the same value-flow decisions the main phase makes, while keeping the slice minimal.
The value stores only the additional lock-span witnesses; the endpoint ICFG nodes are implicit in the key and consumers must add them back.
Definition at line 101 of file MTASVFGBuilder.h.
|
private |
Store -> Load interference: add a thread-aware def-use edge if the store may happen in parallel with and may alias the load, unless excluded by a common lock (then only when the store is a span tail and the load a span head).
Definition at line 415 of file MTASVFGBuilder.cpp.
|
private |
Store -> Store interference (symmetric): add thread-aware def-use edges in both directions, with the same lock-span pruning as store/load.
Definition at line 451 of file MTASVFGBuilder.cpp.
|
private |
Whether, for all lock spans n belongs to, n is the first write (span head).
Definition at line 328 of file MTASVFGBuilder.cpp.
|
private |
Whether, for all lock spans n belongs to, n is the last write (span tail).
Definition at line 350 of file MTASVFGBuilder.cpp.
|
private |
Record the [THREAD-VF] slicing sources for one candidate pair s –o--> s' (s = src store, sp = dst load/store). Adds the endpoints, and — when the pair is protected by a common lock — the in-span successor/predecessor witnesses needed to re-decide the non-interference (tail/head) test.
Record the per-edge [THREAD-VF] query for one candidate pair s –o--> sp (see getThreadVFQueryMap for the rule): the endpoints, plus – under a common lock – the in-span Succ_spl(s) / Pred_spl'(sp) witnesses. Enumerated fully (the tail/head boolean tests short-circuit; source extraction must not).
Definition at line 380 of file MTASVFGBuilder.cpp.
|
private |
Definition at line 170 of file MTASVFGBuilder.h.
|
private |
Main-solve configuration (see configureForMainSolve); defaults suit VFG_pre.
null = whole program
Definition at line 116 of file MTASVFGBuilder.h.
|
private |
all load SVFG nodes
Definition at line 160 of file MTASVFGBuilder.h.
|
private |
Definition at line 166 of file MTASVFGBuilder.h.
|
private |
Definition at line 165 of file MTASVFGBuilder.h.
|
static |
Number of thread-aware (interference) SVFG edges added.
Definition at line 67 of file MTASVFGBuilder.h.
|
private |
Definition at line 168 of file MTASVFGBuilder.h.
false = skip [THREAD-VF] recording
Definition at line 117 of file MTASVFGBuilder.h.
|
private |
all store SVFG nodes
Definition at line 159 of file MTASVFGBuilder.h.
|
private |
Definition at line 169 of file MTASVFGBuilder.h.
|
private |
Definition at line 171 of file MTASVFGBuilder.h.
|
private |
[THREAD-VF] per-edge query map (see getThreadVFQueryMap).
Definition at line 163 of file MTASVFGBuilder.h.