Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVF::SingleSlicer Class Reference

#include <MTASlicer.h>

Inheritance diagram for SVF::SingleSlicer:
SVF::MTASlicerBase

Public Member Functions

 SingleSlicer (SVFIR *svfir, AndersenBase *pta, MHP *mhp, LockAnalysis *lockAnalysis, SVFG *svfg=nullptr)
ValueFlowSlice runSlicing (const OrderedSet< const SVFStmt * > &vulnerableStatements)
Public Member Functions inherited from SVF::MTASlicerBase
 MTASlicerBase (SVFIR *svfir, AndersenBase *pta, MHP *mhp, LockAnalysis *lockAnalysis, SVFG *svfg=nullptr)

Additional Inherited Members

Protected Member Functions inherited from SVF::MTASlicerBase
OrderedSet< const VFGNode * > computeDataDependenceSVFGNodes (const OrderedSet< const SVFStmt * > &seeds, SVFG *svfg)
OrderedSet< const ICFGNode * > svfgNodesToICFGNodes (const OrderedSet< const VFGNode * > &nodes, const OrderedSet< const SVFStmt * > &seeds)
 Project the retained VFG nodes (plus the seeds) onto their ICFG nodes.
OrderedSet< const CallICFGNode * > getDependentThreadCreate (const ICFGNode *node)
OrderedSet< const TCTNode * > getTCTNodeSetFromNode (const ICFGNode *node)
OrderedSet< const ICFGNode * > getLockSet (const ICFGNode *node)
OrderedSet< const CallICFGNode * > collectPthreadStatements (const OrderedSet< const ICFGNode * > &sourceNodes)
OrderedSet< const CallICFGNode * > collectMutexStatements (const OrderedSet< const ICFGNode * > &sourceNodes)
std::pair< OrderedSet< const CallICFGNode * >, OrderedSet< const CallICFGNode * > > collectCommonThreadStatements (const OrderedSet< const ICFGNode * > &sourceNodes)
void addSynchronizationDependencies (const OrderedSet< const CallICFGNode * > &pthreadCallNodes, const OrderedSet< const CallICFGNode * > &mutexCallNodes, OrderedSet< const ICFGNode * > &retainedNodes)
OrderedSet< const ICFGNode * > expandCallDependence (const OrderedSet< const ICFGNode * > &nodes)
Static Protected Member Functions inherited from SVF::MTASlicerBase
static void enqueueSVFGNode (const SVFGNode *node, OrderedSet< const SVFGNode * > &visited, std::deque< const SVFGNode * > &worklist)
Protected Attributes inherited from SVF::MTASlicerBase
SVFIR * svfir
AndersenBase * pta
MHP * mhp
LockAnalysis * lockAnalysis
CallGraph * callGraph
SVFG * svfg
 thread-aware VFG_pre (PTA/Single slicers; null for MTA)

Detailed Description

SingleSlicer - Unified slicer combining synchronization, data, and call dependence into ONE slice (the single-pass baseline, MSli §3/§5.4: the transitive closure of the target statements under the combined dependence graph). Both ILA and FSPTA run on this single slice, so V_ILA, V_PTA subset V_Single. Used by the differential-slicing ablation (-mta-slicing-single).

Iteratively applies synchronization, data, and call dependence over the thread-aware VFG_pre until convergence.

Definition at line 252 of file MTASlicer.h.

Constructor & Destructor Documentation

◆ SingleSlicer()

SVF::SingleSlicer::SingleSlicer ( SVFIR * svfir,
AndersenBase * pta,
MHP * mhp,
LockAnalysis * lockAnalysis,
SVFG * svfg = nullptr )

Definition at line 892 of file MTASlicer.cpp.

895{
896}
AndersenBase * pta
Definition MTASlicer.h:129
LockAnalysis * lockAnalysis
Definition MTASlicer.h:131
MTASlicerBase(SVFIR *svfir, AndersenBase *pta, MHP *mhp, LockAnalysis *lockAnalysis, SVFG *svfg=nullptr)
SVFG * svfg
thread-aware VFG_pre (PTA/Single slicers; null for MTA)
Definition MTASlicer.h:133

Member Function Documentation

◆ runSlicing()

ValueFlowSlice SVF::SingleSlicer::runSlicing ( const OrderedSet< const SVFStmt * > & vulnerableStatements)

Perform unified slicing combining synchronization, data, and call dependence.

Parameters
vulnerableStatementsSet of vulnerable statements to start slicing from
Returns
Exact SVFG data slice plus its synchronization/call-complete ICFG view

Definition at line 901 of file MTASlicer.cpp.

903{
904
905 OrderedSet<const ICFGNode*> sourceNodes;
906 for (const SVFStmt* stmt : vulnerableStatements)
907 if (stmt != nullptr && stmt->getICFGNode() != nullptr)
908 sourceNodes.insert(stmt->getICFGNode());
909
910 OrderedSet<const ICFGNode*> currentNodes = sourceNodes;
911 OrderedSet<const SVFGNode*> dataSliceNodes;
912
913 // Step 3: Close over data dependence (the thread-aware VFG_pre value flow --
914 // direct + indirect + interference, the same model the FSPTA stage uses) and call
915 // dependence (function expansion), alternately, until the node set converges.
916 while (true)
917 {
918 OrderedSet<const ICFGNode*> previousNodes = currentNodes;
919
920 auto commonStmts = collectCommonThreadStatements(currentNodes);
922 commonStmts.first, commonStmts.second, currentNodes);
923
924 OrderedSet<const SVFStmt*> currentStatements;
925 for (const ICFGNode* node : currentNodes)
926 {
927 const ICFGNode::SVFStmtList& stmts = node->getSVFStmts();
928 currentStatements.insert(stmts.begin(), stmts.end());
929 }
930
931 dataSliceNodes =
932 computeDataDependenceSVFGNodes(currentStatements, svfg);
933 OrderedSet<const ICFGNode*> dataDepNodes =
934 svfgNodesToICFGNodes(dataSliceNodes, currentStatements);
935 currentNodes.insert(dataDepNodes.begin(), dataDepNodes.end());
936
937 currentNodes = expandCallDependence(currentNodes);
938
939 if (currentNodes == previousNodes)
940 break;
941 }
942 ValueFlowSlice result;
943 result.svfgNodes = std::move(dataSliceNodes);
944 result.icfgNodes = std::move(currentNodes);
945 return result;
946}
std::list< const SVFStmt * > SVFStmtList
Definition ICFGNode.h:65
std::pair< OrderedSet< const CallICFGNode * >, OrderedSet< const CallICFGNode * > > collectCommonThreadStatements(const OrderedSet< const ICFGNode * > &sourceNodes)
OrderedSet< const VFGNode * > computeDataDependenceSVFGNodes(const OrderedSet< const SVFStmt * > &seeds, SVFG *svfg)
OrderedSet< const ICFGNode * > expandCallDependence(const OrderedSet< const ICFGNode * > &nodes)
OrderedSet< const ICFGNode * > svfgNodesToICFGNodes(const OrderedSet< const VFGNode * > &nodes, const OrderedSet< const SVFStmt * > &seeds)
Project the retained VFG nodes (plus the seeds) onto their ICFG nodes.
void addSynchronizationDependencies(const OrderedSet< const CallICFGNode * > &pthreadCallNodes, const OrderedSet< const CallICFGNode * > &mutexCallNodes, OrderedSet< const ICFGNode * > &retainedNodes)
std::set< Key, Compare, Allocator > OrderedSet
Definition GeneralType.h:60
OrderedSet< const SVFGNode * > svfgNodes
Definition MTASlicer.h:61
OrderedSet< const ICFGNode * > icfgNodes
Definition MTASlicer.h:62

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