Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Member Functions | List of all members
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 *vfg=nullptr)
 
OrderedSet< const ICFGNode * > runSlicing (const OrderedSet< const SVFStmt * > &vulnerableStatements)
 
- Public Member Functions inherited from SVF::MTASlicerBase
 MTASlicerBase (SVFIR *svfIr, AndersenBase *pta, MHP *mhp, LockAnalysis *lockAnalysis, SVFG *vfg=nullptr)
 
virtual ~MTASlicerBase ()
 

Additional Inherited Members

- Protected Member Functions inherited from SVF::MTASlicerBase
OrderedSet< const ICFGNode * > sliceDataDependenceOverVFG (const OrderedSet< const SVFStmt * > &seeds, SVFG *vfg)
 
OrderedSet< const VFGNode * > computeDataDependenceSVFGNodes (const OrderedSet< const SVFStmt * > &seeds, SVFG *vfg)
 
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 SVFStmt * > getDependentThreadCreate (const SVFStmt *stmt)
 
OrderedSet< const TCTNode * > getTCTNodeSetFromNode (const ICFGNode *node)
 
OrderedSet< const ICFGNode * > getLockSet (const ICFGNode *node)
 
OrderedSet< const CallICFGNode * > collectPthreadStatements (const OrderedSet< const SVFStmt * > &vulnerableStmts)
 
OrderedSet< const CallICFGNode * > collectMutexStatements (const OrderedSet< const SVFStmt * > &vulnerableStmts)
 
std::pair< OrderedSet< const CallICFGNode * >, OrderedSet< const CallICFGNode * > > collectCommonThreadStatements (const OrderedSet< const SVFStmt * > &vulnerableStatements)
 
OrderedSet< const ICFGNode * > buildBackwardICFGNodeSet (const OrderedSet< const ICFGNode * > &vulnerableNodes)
 
OrderedSet< const ICFGNode * > expandCallDependence (const OrderedSet< const ICFGNode * > &nodes)
 
OrderedSet< const ICFGNode * > runDualSlicing (const OrderedSet< const ICFGNode * > &slicedNodes)
 
- Protected Attributes inherited from SVF::MTASlicerBase
SVFIRsvfIr
 
AndersenBasepta
 
MHPmhp
 
LockAnalysislockAnalysis
 
CallGraphcallGraph
 
SVFGvfg
 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 data dependence (over the thread-aware VFG_pre) and call dependence until convergence, then a single dual-slicing pass.

Definition at line 258 of file MTASlicer.h.

Constructor & Destructor Documentation

◆ SingleSlicer()

SVF::SingleSlicer::SingleSlicer ( SVFIR svfIr,
AndersenBase pta,
MHP mhp,
LockAnalysis lockAnalysis,
SVFG vfg = nullptr 
)

Definition at line 1046 of file MTASlicer.cpp.

1049{
1050}
SVFG * vfg
thread-aware VFG_pre (PTA/Single slicers; null for MTA)
Definition MTASlicer.h:132
AndersenBase * pta
Definition MTASlicer.h:128
LockAnalysis * lockAnalysis
Definition MTASlicer.h:130

Member Function Documentation

◆ runSlicing()

OrderedSet< const ICFGNode * > 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
Set of ICFG nodes in the slice (including call/ret and entry/exit nodes)

Definition at line 1055 of file MTASlicer.cpp.

1057{
1058
1059 // Step 1: Synchronization dependence -- the relevant pthread (fork/join) and
1060 // mutex (lock/unlock) statements for the targets.
1064
1065 // Step 2: Seed the working set with the synchronization statements (and their
1066 // return nodes) and the target statements themselves.
1068 currentNodes.insert(pthreadCallNodes.begin(), pthreadCallNodes.end());
1070 currentNodes.insert(pthreadCallNode->getRetICFGNode());
1071 currentNodes.insert(mutexCallNodes.begin(), mutexCallNodes.end());
1073 currentNodes.insert(mutexCallNode->getRetICFGNode());
1075 for (const SVFStmt* stmt : vulnerableStatements)
1076 currentNodes.insert(stmt->getICFGNode());
1077
1078 // Step 3: Close over data dependence (the thread-aware VFG_pre value flow --
1079 // direct + indirect + interference, the same model the FSPTA stage uses) and call
1080 // dependence (function expansion), alternately, until the node set converges.
1081 bool changed = true;
1082 int iteration = 0;
1083 const int maxIterations = 100; // safety bound against non-convergence
1084 while (changed && iteration < maxIterations)
1085 {
1086 iteration++;
1088
1090 for (const ICFGNode* node : currentNodes)
1091 {
1092 const ICFGNode::SVFStmtList& stmts = node->getSVFStmts();
1093 currentStatements.insert(stmts.begin(), stmts.end());
1094 }
1095
1098 currentNodes.insert(dataDepNodes.begin(), dataDepNodes.end());
1099
1101
1103 }
1104
1105 if (iteration >= maxIterations)
1106 SVFUtil::writeWrnMsg("SingleSlicer reached max iterations, may not have converged");
1107
1108 // Step 4: One dual-slicing (temporal) pass at the end.
1110}
std::list< const SVFStmt * > SVFStmtList
Definition ICFGNode.h:65
std::pair< OrderedSet< const CallICFGNode * >, OrderedSet< const CallICFGNode * > > collectCommonThreadStatements(const OrderedSet< const SVFStmt * > &vulnerableStatements)
OrderedSet< const ICFGNode * > expandCallDependence(const OrderedSet< const ICFGNode * > &nodes)
OrderedSet< const ICFGNode * > runDualSlicing(const OrderedSet< const ICFGNode * > &slicedNodes)
OrderedSet< const ICFGNode * > sliceDataDependenceOverVFG(const OrderedSet< const SVFStmt * > &seeds, SVFG *vfg)
void writeWrnMsg(const std::string &msg)
Writes a message run through wrnMsg.
Definition SVFUtil.cpp:72
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76
static void collectLockFunctionMarkers(const OrderedSet< const CallICFGNode * > &mutexCallNodes, OrderedSet< const ICFGNode * > &sliceResult)

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