Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
SVF::AndersenSCD Class Reference

#include <AndersenPWC.h>

Inheritance diagram for SVF::AndersenSCD:
SVF::Andersen SVF::AndersenBase SVF::WPASolver< GraphType > SVF::BVDataPTAImpl SVF::PointerAnalysis SVF::AndersenSFR

Public Types

typedef Map< NodeID, NodeIDNodeToNodeMap
 
- Public Types inherited from SVF::Andersen
typedef SCCDetection< ConstraintGraph * > CGSCC
 
- Public Types inherited from SVF::AndersenBase
typedef OrderedMap< const CallICFGNode *, NodeIDCallSite2DummyValPN
 
- Public Types inherited from SVF::WPASolver< GraphType >
typedef SVF::GenericGraphTraits< GraphType > GTraits
 Define the GTraits and node iterator for printing.
 
typedef GTraits::NodeRef GNODE
 
typedef GTraits::EdgeType GEDGE
 
typedef GTraits::ChildIteratorType child_iterator
 
typedef SCCDetection< GraphType > SCC
 
typedef FIFOWorkList< NodeIDWorkList
 
- Public Types inherited from SVF::BVDataPTAImpl
enum  PTBackingType { Mutable , Persistent }
 How the PTData used is implemented. More...
 
typedef PTData< NodeID, NodeSet, NodeID, PointsToPTDataTy
 
typedef DiffPTData< NodeID, NodeSet, NodeID, PointsToDiffPTDataTy
 
typedef DFPTData< NodeID, NodeSet, NodeID, PointsToDFPTDataTy
 
typedef VersionedPTData< NodeID, NodeSet, NodeID, PointsTo, VersionedVar, Set< VersionedVar > > VersionedPTDataTy
 
typedef MutablePTData< NodeID, NodeSet, NodeID, PointsToMutPTDataTy
 
typedef MutableDiffPTData< NodeID, NodeSet, NodeID, PointsToMutDiffPTDataTy
 
typedef MutableDFPTData< NodeID, NodeSet, NodeID, PointsToMutDFPTDataTy
 
typedef MutableIncDFPTData< NodeID, NodeSet, NodeID, PointsToMutIncDFPTDataTy
 
typedef MutableVersionedPTData< NodeID, NodeSet, NodeID, PointsTo, VersionedVar, Set< VersionedVar > > MutVersionedPTDataTy
 
typedef PersistentPTData< NodeID, NodeSet, NodeID, PointsToPersPTDataTy
 
typedef PersistentDiffPTData< NodeID, NodeSet, NodeID, PointsToPersDiffPTDataTy
 
typedef PersistentDFPTData< NodeID, NodeSet, NodeID, PointsToPersDFPTDataTy
 
typedef PersistentIncDFPTData< NodeID, NodeSet, NodeID, PointsToPersIncDFPTDataTy
 
typedef PersistentVersionedPTData< NodeID, NodeSet, NodeID, PointsTo, VersionedVar, Set< VersionedVar > > PersVersionedPTDataTy
 
- Public Types inherited from SVF::PointerAnalysis
enum  PTATY {
  Andersen_BASE , Andersen_WPA , AndersenSCD_WPA , AndersenSFR_WPA ,
  AndersenWaveDiff_WPA , Steensgaard_WPA , CSCallString_WPA , CSSummary_WPA ,
  FSDATAFLOW_WPA , FSSPARSE_WPA , VFS_WPA , FSCS_WPA ,
  CFLFICI_WPA , CFLFSCI_WPA , CFLFSCS_WPA , TypeCPP_WPA ,
  FieldS_DDA , FlowS_DDA , PathS_DDA , Cxt_DDA ,
  Default_PTA
}
 Pointer analysis type list. More...
 
enum  PTAImplTy { BaseImpl , BVDataImpl , CondImpl }
 Implementation type: BVDataPTAImpl or CondPTAImpl. More...
 
typedef Set< const CallICFGNode * > CallSiteSet
 Indirect call edges type, map a callsite to a set of callees.
 
typedef SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap
 
typedef Set< const SVFFunction * > FunctionSet
 
typedef OrderedMap< const CallICFGNode *, FunctionSetCallEdgeMap
 
typedef SCCDetection< PTACallGraph * > CallGraphSCC
 
typedef Set< const SVFGlobalValue * > VTableSet
 
typedef Set< const SVFFunction * > VFunSet
 

Public Member Functions

 AndersenSCD (SVFIR *_pag, PTATY type=AndersenSCD_WPA)
 
- Public Member Functions inherited from SVF::Andersen
 Andersen (SVFIR *_pag, PTATY type=Andersen_WPA, bool alias_check=true)
 Constructor.
 
virtual ~Andersen ()
 Destructor.
 
virtual void initialize ()
 Initialize analysis.
 
virtual void finalize ()
 Finalize analysis.
 
void resetData ()
 Reset data.
 
virtual const PointsTogetPts (NodeID id)
 Operation of points-to set.
 
virtual bool unionPts (NodeID id, const PointsTo &target)
 
virtual bool unionPts (NodeID id, NodeID ptd)
 
void dumpTopLevelPtsTo ()
 
void setDetectPWC (bool flag)
 
- Public Member Functions inherited from SVF::AndersenBase
 AndersenBase (SVFIR *_pag, PTATY type=Andersen_BASE, bool alias_check=true)
 Constructor.
 
 ~AndersenBase () override
 Destructor.
 
virtual void analyze () override
 Andersen analysis.
 
virtual void solveAndwritePtsToFile (const std::string &filename)
 
virtual void readPtsFromFile (const std::string &filename)
 
virtual void solveConstraints ()
 
virtual bool updateThreadCallGraph (const CallSiteToFunPtrMap &, NodePairSet &)
 Update thread call graph.
 
virtual void connectCaller2ForkedFunParams (const CallICFGNode *cs, const SVFFunction *F, NodePairSet &cpySrcNodes)
 Connect formal and actual parameters for indirect forksites.
 
virtual void connectCaller2CalleeParams (const CallICFGNode *cs, const SVFFunction *F, NodePairSet &cpySrcNodes)
 Connect formal and actual parameters for indirect callsites.
 
ConstraintGraphgetConstraintGraph ()
 Get constraint graph.
 
NodeID sccRepNode (NodeID id) const override
 SCC methods.
 
NodeBSsccSubNodes (NodeID repId)
 
void printStat ()
 dump statistics
 
virtual void normalizePointsTo () override
 
void cleanConsCG (NodeID id)
 remove redundant gepnodes in constraint graph
 
- Public Member Functions inherited from SVF::BVDataPTAImpl
 BVDataPTAImpl (SVFIR *pag, PointerAnalysis::PTATY type, bool alias_check=true)
 Constructor.
 
 ~BVDataPTAImpl () override=default
 Destructor.
 
PersistentPointsToCache< PointsTo > & getPtCache ()
 
const PointsTogetPts (NodeID id) override
 
const NodeSetgetRevPts (NodeID nodeId) override
 
virtual void clearPts (NodeID id, NodeID element)
 Remove element from the points-to set of id.
 
virtual void clearFullPts (NodeID id)
 Clear points-to set of id.
 
virtual bool addPts (NodeID id, NodeID ptd)
 
virtual void clearAllPts ()
 Clear all data.
 
virtual void expandFIObjs (const PointsTo &pts, PointsTo &expandedPts)
 Expand FI objects.
 
virtual void expandFIObjs (const NodeBS &pts, NodeBS &expandedPts)
 TODO: remove repetition.
 
void remapPointsToSets (void)
 Remap all points-to sets to use the current mapping.
 
virtual void writeToFile (const std::string &filename)
 Interface for analysis result storage on filesystem.
 
virtual void writeObjVarToFile (const std::string &filename)
 
virtual void writePtsResultToFile (std::fstream &f)
 
virtual void writeGepObjVarMapToFile (std::fstream &f)
 
virtual bool readFromFile (const std::string &filename)
 
virtual void readPtsResultFromFile (std::ifstream &f)
 
virtual void readGepObjVarMapFromFile (std::ifstream &f)
 
virtual void readAndSetObjFieldSensitivity (std::ifstream &f, const std::string &delimiterStr)
 
AliasResult alias (const SVFValue *V1, const SVFValue *V2) override
 Interface expose to users of our pointer analysis, given Value infos.
 
AliasResult alias (NodeID node1, NodeID node2) override
 Interface expose to users of our pointer analysis, given PAGNodeID.
 
virtual AliasResult alias (const PointsTo &pts1, const PointsTo &pts2)
 Interface expose to users of our pointer analysis, given two pts.
 
void dumpCPts () override
 dump and debug, print out conditional pts
 
void dumpTopLevelPtsTo () override
 
void dumpAllPts () override
 
- Public Member Functions inherited from SVF::PointerAnalysis
ICFGgetICFG () const
 Get ICFG.
 
u32_t getNumOfResolvedIndCallEdge () const
 Return number of resolved indirect call edges.
 
PTACallGraphgetCallGraph () const
 Return call graph.
 
CallGraphSCCgetCallGraphSCC () const
 Return call graph SCC.
 
 PointerAnalysis (SVFIR *pag, PTATY ty=Default_PTA, bool alias_check=true)
 Constructor.
 
PTATY getAnalysisTy () const
 Type of pointer analysis.
 
PTAImplTy getImplTy () const
 Return implementation type of the pointer analysis.
 
bool printStat ()
 Whether print statistics.
 
void disablePrintStat ()
 Whether print statistics.
 
CallEdgeMapgetIndCallMap ()
 Get callees from an indirect callsite.
 
bool hasIndCSCallees (const CallICFGNode *cs) const
 
const FunctionSetgetIndCSCallees (const CallICFGNode *cs) const
 
virtual void resolveIndCalls (const CallICFGNode *cs, const PointsTo &target, CallEdgeMap &newEdges)
 Resolve indirect call edges.
 
void callGraphSCCDetection ()
 PTACallGraph SCC related methods.
 
NodeID getCallGraphSCCRepNode (NodeID id) const
 Get SCC rep node of a SVFG node.
 
bool inSameCallGraphSCC (const SVFFunction *fun1, const SVFFunction *fun2)
 Return TRUE if this edge is inside a PTACallGraph SCC, i.e., src node and dst node are in the same SCC on the SVFG.
 
bool isInRecursion (const SVFFunction *fun) const
 
bool isLocalVarInRecursiveFun (NodeID id) const
 Whether a local variable is in function recursions.
 
CommonCHGraphgetCHGraph () const
 get CHGraph
 
void getVFnsFromCHA (const CallICFGNode *cs, VFunSet &vfns)
 
void getVFnsFromPts (const CallICFGNode *cs, const PointsTo &target, VFunSet &vfns)
 
void connectVCallToVFns (const CallICFGNode *cs, const VFunSet &vfns, CallEdgeMap &newEdges)
 
virtual void resolveCPPIndCalls (const CallICFGNode *cs, const PointsTo &target, CallEdgeMap &newEdges)
 Resolve cpp indirect call edges.
 
SVFIRgetPAG () const
 
PTAStatgetStat () const
 Get PTA stat.
 
SVFModulegetModule () const
 Module.
 
OrderedNodeSetgetAllValidPtrs ()
 Get all Valid Pointers for resolution.
 
virtual void computeDDAPts (NodeID)
 Compute points-to results on-demand, overridden by derived classes.
 
void printIndCSTargets (const CallICFGNode *cs, const FunctionSet &targets)
 Print targets of a function pointer.
 
virtual void dumpPts (NodeID ptr, const PointsTo &pts)
 
void printIndCSTargets ()
 
void dumpAllTypes ()
 
void dumpStat ()
 Dump the statistics.
 
bool containBlackHoleNode (const PointsTo &pts)
 Determine whether a points-to contains a black hole or constant node.
 
bool containConstantNode (const PointsTo &pts)
 
virtual bool isBlkObjOrConstantObj (NodeID ptd) const
 
bool isHeapMemObj (NodeID id) const
 Whether this object is heap or array.
 
bool isArrayMemObj (NodeID id) const
 
bool isFIObjNode (NodeID id) const
 
NodeID getBaseObjVar (NodeID id)
 
NodeID getFIObjVar (NodeID id)
 
NodeID getGepObjVar (NodeID id, const APOffset &ap)
 
virtual const NodeBSgetAllFieldsObjVars (NodeID id)
 
void setObjFieldInsensitive (NodeID id)
 
bool isFieldInsensitive (NodeID id) const
 

Static Public Member Functions

static AndersenSCDcreateAndersenSCD (SVFIR *_pag)
 Create an singleton instance directly instead of invoking llvm pass manager.
 
static void releaseAndersenSCD ()
 
- Static Public Member Functions inherited from SVF::Andersen
static bool classof (const Andersen *)
 Methods for support type inquiry through isa, cast, and dyn_cast:
 
static bool classof (const PointerAnalysis *pta)
 
- Static Public Member Functions inherited from SVF::AndersenBase
static bool classof (const AndersenBase *)
 Methods for support type inquiry through isa, cast, and dyn_cast:
 
static bool classof (const PointerAnalysis *pta)
 
- Static Public Member Functions inherited from SVF::BVDataPTAImpl
static bool classof (const PointerAnalysis *pta)
 

Protected Member Functions

void addSccCandidate (NodeID nodeId)
 
virtual NodeStackSCCDetect ()
 
virtual void PWCDetect ()
 
virtual void solveWorklist ()
 
virtual void handleLoadStore (ConstraintNode *node)
 
virtual void processAddr (const AddrCGEdge *addr)
 
virtual bool addCopyEdge (NodeID src, NodeID dst)
 
virtual bool updateCallGraph (const CallSiteToFunPtrMap &callsites)
 
virtual void processPWC (ConstraintNode *rep)
 
virtual void handleCopyGep (ConstraintNode *node)
 
- Protected Member Functions inherited from SVF::Andersen
virtual void computeDiffPts (NodeID id)
 Handle diff points-to set.
 
virtual const PointsTogetDiffPts (NodeID id)
 
void updatePropaPts (NodeID dstId, NodeID srcId)
 Handle propagated points-to set.
 
void clearPropaPts (NodeID src)
 
virtual void initWorklist ()
 
virtual void processNode (NodeID nodeId)
 Override WPASolver function in order to use the default solver.
 
void processAllAddr ()
 handling various constraints
 
virtual bool processLoad (NodeID node, const ConstraintEdge *load)
 
virtual bool processStore (NodeID node, const ConstraintEdge *load)
 
virtual bool processCopy (NodeID node, const ConstraintEdge *edge)
 
virtual bool processGep (NodeID node, const GepCGEdge *edge)
 
virtual bool processGepPts (const PointsTo &pts, const GepCGEdge *edge)
 
virtual void mergeNodeToRep (NodeID nodeId, NodeID newRepId)
 Merge sub node to its rep.
 
virtual bool mergeSrcToTgt (NodeID srcId, NodeID tgtId)
 
void mergeSccNodes (NodeID repNodeId, const NodeBS &subNodes)
 Merge sub node in a SCC cycle to their rep node.
 
void mergeSccCycle ()
 
virtual void collapsePWCNode (NodeID nodeId)
 Collapse a field object into its base for field insensitive analysis.
 
void collapseFields ()
 collapse positive weight cycles of a graph
 
bool collapseNodePts (NodeID nodeId)
 
bool collapseField (NodeID nodeId)
 
void updateNodeRepAndSubs (NodeID nodeId, NodeID newRepId)
 Updates subnodes of its rep, and rep node of its subs.
 
void sanitizePts ()
 Sanitize pts for field insensitive objects.
 
virtual const std::string PTAName () const
 Get PTA name.
 
virtual void cluster (void) const
 
- Protected Member Functions inherited from SVF::AndersenBase
void heapAllocatorViaIndCall (const CallICFGNode *cs, NodePairSet &cpySrcNodes)
 
- Protected Member Functions inherited from SVF::WPASolver< GraphType >
 WPASolver ()
 Constructor.
 
virtual ~WPASolver ()=default
 Destructor.
 
SCCgetSCCDetector () const
 Get SCC detector.
 
const GraphType graph ()
 Get/Set graph methods.
 
void setGraph (GraphType g)
 
virtual NodeStackSCCDetect (NodeSet &candidates)
 
virtual void propagate (GNODE *v)
 
virtual bool propFromSrcToDst (GEDGE *)
 Propagate information from source to destination node, to be implemented in the child class.
 
NodeID popFromWorklist ()
 Worklist operations.
 
virtual void pushIntoWorklist (NodeID id)
 
bool isWorklistEmpty ()
 
bool isInWorklist (NodeID id)
 
GNODENode (NodeID id)
 Get node on the graph.
 
NodeID Node_Index (GNODE node)
 Get node ID.
 
- Protected Member Functions inherited from SVF::BVDataPTAImpl
PTDataTygetPTDataTy () const
 Get points-to data structure.
 
void finalize () override
 Finalization of pointer analysis, and normalize points-to information to Bit Vector representation.
 
DiffPTDataTygetDiffPTDataTy () const
 
DFPTDataTygetDFPTDataTy () const
 
MutDFPTDataTygetMutDFPTDataTy () const
 
VersionedPTDataTygetVersionedPTDataTy () const
 
virtual void onTheFlyCallGraphSolve (const CallSiteToFunPtrMap &callsites, CallEdgeMap &newEdges)
 On the fly call graph construction.
 
virtual void onTheFlyThreadCallGraphSolve (const CallSiteToFunPtrMap &callsites, CallEdgeMap &newForkEdges)
 On the fly thread call graph construction respecting forksite.
 
- Protected Member Functions inherited from SVF::PointerAnalysis
const CallSiteToFunPtrMapgetIndirectCallsites () const
 Return all indirect callsites.
 
NodeID getFunPtr (const CallICFGNode *cs) const
 Return function pointer PAGNode at a callsite cs.
 
virtual void validateTests ()
 Alias check functions to verify correctness of pointer analysis.
 
virtual void validateSuccessTests (std::string fun)
 
virtual void validateExpectedFailureTests (std::string fun)
 
void resetObjFieldSensitive ()
 Reset all object node as field-sensitive.
 

Protected Attributes

NodeSet sccCandidates
 
NodeToNodeMap pwcReps
 
- Protected Attributes inherited from SVF::Andersen
CallSite2DummyValPN callsite2DummyValPN
 Map an instruction to a dummy obj which created at an indirect callsite, which invokes a heap allocator.
 
- Protected Attributes inherited from SVF::AndersenBase
ConstraintGraphconsCG
 Constraint Graph.
 
CallSite2DummyValPN callsite2DummyValPN
 
- Protected Attributes inherited from SVF::WPASolver< GraphType >
bool reanalyze
 Reanalyze if any constraint value changed.
 
u32_t iterationForPrintStat
 print out statistics for i-th iteration
 
GraphType _graph
 Graph.
 
std::unique_ptr< SCCscc
 SCC.
 
WorkList worklist
 Worklist for resolution.
 
- Protected Attributes inherited from SVF::PointerAnalysis
bool print_stat
 User input flags.
 
bool alias_validation
 Flag for validating points-to/alias results.
 
u32_t OnTheFlyIterBudgetForStat
 Flag for iteration budget for on-the-fly statistics.
 
SVFModulesvfMod
 Module.
 
PTATY ptaTy
 Pointer analysis Type.
 
PTAImplTy ptaImplTy
 PTA implementation type.
 
PTAStatstat
 Statistics.
 
PTACallGraphcallgraph
 Call graph used for pointer analysis.
 
CallGraphSCCcallGraphSCC
 SCC for PTACallGraph.
 
ICFGicfg
 Interprocedural control-flow graph.
 
CommonCHGraphchgraph
 CHGraph.
 

Static Protected Attributes

static AndersenSCDscdAndersen = nullptr
 
- Static Protected Attributes inherited from SVF::PointerAnalysis
static SVFIRpag = nullptr
 SVFIR.
 

Additional Inherited Members

- Public Attributes inherited from SVF::AndersenBase
NodeBS redundantGepNodes
 
- Public Attributes inherited from SVF::WPASolver< GraphType >
u32_t numOfIteration
 num of iterations during constraint solving
 
- Static Public Attributes inherited from SVF::AndersenBase
static u32_t numOfProcessedAddr = 0
 Statistics.
 
static u32_t numOfProcessedCopy = 0
 Number of processed Addr edge.
 
static u32_t numOfProcessedGep = 0
 Number of processed Copy edge.
 
static u32_t numOfProcessedLoad = 0
 Number of processed Gep edge.
 
static u32_t numOfProcessedStore = 0
 Number of processed Load edge.
 
static u32_t numOfSfrs = 0
 Number of processed Store edge.
 
static u32_t numOfFieldExpand = 0
 
static u32_t numOfSCCDetection = 0
 
static double timeOfSCCDetection = 0
 
static double timeOfSCCMerges = 0
 
static double timeOfCollapse = 0
 
static u32_t AveragePointsToSetSize = 0
 
static u32_t MaxPointsToSetSize = 0
 
static double timeOfProcessCopyGep = 0
 
static double timeOfProcessLoadStore = 0
 
static double timeOfUpdateCallGraph = 0
 
- Static Public Attributes inherited from SVF::PointerAnalysis
static const std::string aliasTestMayAlias = "MAYALIAS"
 
static const std::string aliasTestMayAliasMangled = "_Z8MAYALIASPvS_"
 
static const std::string aliasTestNoAlias = "NOALIAS"
 
static const std::string aliasTestNoAliasMangled = "_Z7NOALIASPvS_"
 
static const std::string aliasTestPartialAlias = "PARTIALALIAS"
 
static const std::string aliasTestPartialAliasMangled = "_Z12PARTIALALIASPvS_"
 
static const std::string aliasTestMustAlias = "MUSTALIAS"
 
static const std::string aliasTestMustAliasMangled = "_Z9MUSTALIASPvS_"
 
static const std::string aliasTestFailMayAlias = "EXPECTEDFAIL_MAYALIAS"
 
static const std::string aliasTestFailMayAliasMangled = "_Z21EXPECTEDFAIL_MAYALIASPvS_"
 
static const std::string aliasTestFailNoAlias = "EXPECTEDFAIL_NOALIAS"
 
static const std::string aliasTestFailNoAliasMangled = "_Z20EXPECTEDFAIL_NOALIASPvS_"
 

Detailed Description

Selective Cycle Detection Based Andersen Analysis

Definition at line 44 of file AndersenPWC.h.

Member Typedef Documentation

◆ NodeToNodeMap

Definition at line 47 of file AndersenPWC.h.

Constructor & Destructor Documentation

◆ AndersenSCD()

SVF::AndersenSCD::AndersenSCD ( SVFIR _pag,
PTATY  type = AndersenSCD_WPA 
)
inline

Definition at line 55 of file AndersenPWC.h.

55 :
56 Andersen(_pag,type)
57 {
58 }
newitem type
Definition cJSON.cpp:2739
Andersen(SVFIR *_pag, PTATY type=Andersen_WPA, bool alias_check=true)
Constructor.
Definition Andersen.h:197

Member Function Documentation

◆ addCopyEdge()

bool AndersenSCD::addCopyEdge ( NodeID  src,
NodeID  dst 
)
protectedvirtual

If one copy edge is successful added, the src node should be added into SCC detection

Reimplemented from SVF::Andersen.

Definition at line 261 of file AndersenSCD.cpp.

262{
263 if (Andersen::addCopyEdge(src, dst))
264 {
265 addSccCandidate(src);
266 return true;
267 }
268 return false;
269}
void addSccCandidate(NodeID nodeId)
Definition AndersenPWC.h:80
virtual bool addCopyEdge(NodeID src, NodeID dst)
Add copy edge on constraint graph.
Definition Andersen.h:323

◆ addSccCandidate()

void SVF::AndersenSCD::addSccCandidate ( NodeID  nodeId)
inlineprotected

Definition at line 80 of file AndersenPWC.h.

81 {
83 }
NodeID sccRepNode(NodeID id) const override
SCC methods.
Definition Andersen.h:129
NodeSet sccCandidates
Definition AndersenPWC.h:51
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ createAndersenSCD()

static AndersenSCD * SVF::AndersenSCD::createAndersenSCD ( SVFIR _pag)
inlinestatic

Create an singleton instance directly instead of invoking llvm pass manager.

Definition at line 61 of file AndersenPWC.h.

62 {
63 if (scdAndersen == nullptr)
64 {
65 scdAndersen = new AndersenSCD(_pag);
67 return scdAndersen;
68 }
69 return scdAndersen;
70 }
virtual void analyze() override
Andersen analysis.
Definition Andersen.cpp:133
static AndersenSCD * scdAndersen
Definition AndersenPWC.h:50
AndersenSCD(SVFIR *_pag, PTATY type=AndersenSCD_WPA)
Definition AndersenPWC.h:55

◆ handleCopyGep()

void AndersenSCD::handleCopyGep ( ConstraintNode node)
protectedvirtual

Compute diff points-to set before propagation

Reimplemented from SVF::Andersen.

Definition at line 149 of file AndersenSCD.cpp.

150{
151 NodeID nodeId = node->getId();
152
153 if (!Options::DetectPWC() && getSCCDetector()->subNodes(nodeId).count() > 1)
154 processPWC(node);
155 else if(isInWorklist(nodeId))
157}
int count
Definition cJSON.h:216
virtual void processPWC(ConstraintNode *rep)
virtual void handleCopyGep(ConstraintNode *node)
Definition Andersen.cpp:476
static Option< bool > DetectPWC
Definition Options.h:216
NodeID getId() const
Get ID.
bool isInWorklist(NodeID id)
Definition WPASolver.h:164
SCC * getSCCDetector() const
Get SCC detector.
Definition WPASolver.h:67
u32_t NodeID
Definition GeneralType.h:55

◆ handleLoadStore()

void AndersenSCD::handleLoadStore ( ConstraintNode node)
protectedvirtual

Source nodes of new added edges are pushed into sccCandidates. Source nodes of new added edges whose pts differ from those of dst nodes are pushed into worklist.

Reimplemented from SVF::Andersen.

Definition at line 208 of file AndersenSCD.cpp.

209{
210 double insertStart = stat->getClk();
211
212 NodeID nodeId = node->getId();
213 // handle load
215 eit = node->outgoingLoadsEnd(); it != eit; ++it)
217 getPts(nodeId).end(); piter != epiter; ++piter)
218 {
219 NodeID ptd = *piter;
220 if (processLoad(ptd, *it))
221 {
222 reanalyze = true;
223 }
224 }
225
226 // handle store
228 eit = node->incomingStoresEnd(); it != eit; ++it)
230 getPts(nodeId).end(); piter != epiter; ++piter)
231 {
232 NodeID ptd = *piter;
233 if (processStore(ptd, *it))
234 {
235 reanalyze = true;
236 }
237 }
238
239 double insertEnd = stat->getClk();
241}
#define TIMEINTERVAL
Definition SVFType.h:512
static double timeOfProcessLoadStore
Definition Andersen.h:172
virtual bool processLoad(NodeID node, const ConstraintEdge *load)
Definition Andersen.cpp:553
virtual const PointsTo & getPts(NodeID id)
Operation of points-to set.
Definition Andersen.h:239
virtual bool processStore(NodeID node, const ConstraintEdge *load)
Definition Andersen.cpp:573
const_iterator outgoingLoadsEnd() const
Definition ConsGNode.h:194
const_iterator incomingStoresBegin() const
Definition ConsGNode.h:215
const_iterator incomingStoresEnd() const
Definition ConsGNode.h:219
ConstraintEdge::ConstraintEdgeSetTy::const_iterator const_iterator
Definition ConsGNode.h:45
const_iterator outgoingLoadsBegin() const
Definition ConsGNode.h:190
PTAStat * stat
Statistics.
const_iterator end() const
Definition PointsTo.h:132
const_iterator begin() const
Definition PointsTo.h:128
static double getClk(bool mark=false)
Definition SVFStat.cpp:48
bool reanalyze
Reanalyze if any constraint value changed.
Definition WPASolver.h:171

◆ processAddr()

void AndersenSCD::processAddr ( const AddrCGEdge addr)
protectedvirtual

Initialize worklist via processing addrs

Reimplemented from SVF::Andersen.

Definition at line 247 of file AndersenSCD.cpp.

248{
250
251 NodeID dst = addr->getDstID();
252 NodeID src = addr->getSrcID();
253 addPts(dst,src);
254 addSccCandidate(dst);
255}
static u32_t numOfProcessedAddr
Statistics.
Definition Andersen.h:157
virtual bool addPts(NodeID id, NodeID ptd)

◆ processPWC()

void AndersenSCD::processPWC ( ConstraintNode rep)
protectedvirtual

Definition at line 163 of file AndersenSCD.cpp.

164{
165 NodeID repId = rep->getId();
166
168 for (NodeID nId : getSCCDetector()->subNodes(repId))
169 pwcNodes.insert(nId);
170
172 for (NodeID subId : pwcNodes)
174 tmpWorkList.push(subId);
175
176 while (!tmpWorkList.empty())
177 {
180
181 if (!getDiffPts(nodeId).empty())
182 {
184 for (ConstraintEdge* edge : node->getCopyOutEdges())
185 {
187 if (changed && pwcNodes.find(edge->getDstID()) != pwcNodes.end())
188 tmpWorkList.push(edge->getDstID());
189 }
190 for (ConstraintEdge* edge : node->getGepOutEdges())
191 {
192 if (GepCGEdge *gepEdge = SVFUtil::dyn_cast<GepCGEdge>(edge))
193 {
195 if (changed && pwcNodes.find(edge->getDstID()) != pwcNodes.end())
196 tmpWorkList.push(edge->getDstID());
197 }
198 }
199 }
200 }
201}
if(prebuffer< 0)
Definition cJSON.cpp:1269
ConstraintGraph * consCG
Constraint Graph.
Definition Andersen.h:178
virtual void computeDiffPts(NodeID id)
Handle diff points-to set.
Definition Andersen.h:268
virtual const PointsTo & getDiffPts(NodeID id)
Definition Andersen.h:276
virtual bool processGep(NodeID node, const GepCGEdge *edge)
Definition Andersen.cpp:613
virtual bool processCopy(NodeID node, const ConstraintEdge *edge)
Definition Andersen.cpp:593
ConstraintNode * getConstraintNode(NodeID id) const
Get/add/remove constraint node.
Definition ConsG.h:109
FIFOWorkList< NodeID > WorkList
Definition WPASolver.h:55
Set< NodeID > NodeSet

◆ PWCDetect()

void AndersenSCD::PWCDetect ( )
protectedvirtual

Reimplemented in SVF::AndersenSFR.

Definition at line 126 of file AndersenSCD.cpp.

127{
128 // replace scc candidates by their reps
130 sccCandidates.clear();
133 tmpSccCandidates.clear();
134
135 // set scc edge type as direct edge
137 setDetectPWC(true);
138
140
141 // reset scc edge type
143}
void setDetectPWC(bool flag)
Definition Andersen.h:258

◆ releaseAndersenSCD()

static void SVF::AndersenSCD::releaseAndersenSCD ( )
inlinestatic

Definition at line 72 of file AndersenPWC.h.

73 {
74 if (scdAndersen)
75 delete scdAndersen;
76 scdAndersen = nullptr;
77 }

◆ SCCDetect()

NodeStack & AndersenSCD::SCCDetect ( )
protectedvirtual

SCC detection for SCD

Reimplemented from SVF::Andersen.

Definition at line 97 of file AndersenSCD.cpp.

98{
100
101 double sccStart = stat->getClk();
103 double sccEnd = stat->getClk();
105
106 double mergeStart = stat->getClk();
108 double mergeEnd = stat->getClk();
110
111 if (!Options::DetectPWC())
112 {
113 sccStart = stat->getClk();
114 PWCDetect();
115 sccEnd = stat->getClk();
117 }
118
119 return getSCCDetector()->topoNodeStack();
120}
static double timeOfSCCMerges
Definition Andersen.h:167
static u32_t numOfSCCDetection
Definition Andersen.h:165
static double timeOfSCCDetection
Definition Andersen.h:166
virtual void PWCDetect()
void mergeSccCycle()
Definition Andersen.cpp:710

◆ solveWorklist()

void AndersenSCD::solveWorklist ( )
protectedvirtual

Reimplemented from SVF::WPASolver< GraphType >.

Definition at line 44 of file AndersenSCD.cpp.

45{
46 // Initialize the nodeStack via a whole SCC detection
47 // Nodes in nodeStack are in topological order by default.
48 NodeStack& nodeStack = SCCDetect();
49
52 sccCandidates.clear();
53
54 // propagate point-to sets
55 while (!nodeStack.empty())
56 {
57 NodeID nodeId = nodeStack.top();
58 nodeStack.pop();
59
60 if (sccRepNode(nodeId) == nodeId)
61 {
63
65 // push the rep of node into worklist
67
68 double propStart = stat->getClk();
69 // propagate pts through copy and gep edges
71 handleCopyGep(node);
72 double propEnd = stat->getClk();
74
76 }
77 }
78
79 // New nodes will be inserted into workList during processing.
80 while (!isWorklistEmpty())
81 {
83
84 double insertStart = stat->getClk();
85 // add copy edges via processing load or store edges
87 handleLoadStore(node);
88 double insertEnd = stat->getClk();
90 }
91}
static double timeOfProcessCopyGep
Definition Andersen.h:171
virtual NodeStack & SCCDetect()
virtual void handleLoadStore(ConstraintNode *node)
virtual void handleCopyGep(ConstraintNode *node)
void collapseFields()
collapse positive weight cycles of a graph
Definition Andersen.cpp:695
virtual void collapsePWCNode(NodeID nodeId)
Collapse a field object into its base for field insensitive analysis.
Definition Andersen.cpp:686
NodeID popFromWorklist()
Worklist operations.
Definition WPASolver.h:151
virtual void pushIntoWorklist(NodeID id)
Definition WPASolver.h:156
bool isWorklistEmpty()
Definition WPASolver.h:160
std::stack< NodeID > NodeStack

◆ updateCallGraph()

bool AndersenSCD::updateCallGraph ( const CallSiteToFunPtrMap callsites)
protectedvirtual

Update call graph for the input indirect callsites

nodes as a src of a generated new copy edge

Reimplemented from SVF::AndersenBase.

Definition at line 275 of file AndersenSCD.cpp.

276{
277 double cgUpdateStart = stat->getClk();
278
282 for(CallEdgeMap::iterator it = newEdges.begin(), eit = newEdges.end(); it!=eit; ++it )
283 {
284 for(FunctionSet::iterator cit = it->second.begin(), ecit = it->second.end(); cit!=ecit; ++cit)
285 {
287 }
288 }
289
290 double cgUpdateEnd = stat->getClk();
292
293 return (!newEdges.empty());
294}
static double timeOfUpdateCallGraph
Definition Andersen.h:173
virtual void connectCaller2CalleeParams(const CallICFGNode *cs, const SVFFunction *F, NodePairSet &cpySrcNodes)
Connect formal and actual parameters for indirect callsites.
virtual void onTheFlyCallGraphSolve(const CallSiteToFunPtrMap &callsites, CallEdgeMap &newEdges)
On the fly call graph construction.
OrderedMap< const CallICFGNode *, FunctionSet > CallEdgeMap
Set< NodePair > NodePairSet

Member Data Documentation

◆ pwcReps

NodeToNodeMap SVF::AndersenSCD::pwcReps
protected

Definition at line 52 of file AndersenPWC.h.

◆ sccCandidates

NodeSet SVF::AndersenSCD::sccCandidates
protected

Definition at line 51 of file AndersenPWC.h.

◆ scdAndersen

AndersenSCD * AndersenSCD::scdAndersen = nullptr
staticprotected

Definition at line 50 of file AndersenPWC.h.


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