Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVF::WPASCCSolver< GraphType > Class Template Reference

#include <WPAFSSolver.h>

Inheritance diagram for SVF::WPASCCSolver< GraphType >:
SVF::WPAFSSolver< GraphType > SVF::WPASolver< GraphType > SVF::WPAMinimumSolver< GraphType >

Public Types

typedef WPASolver< GraphType >::GTraits GTraits
typedef WPASolver< GraphType >::GNODE GNODE
typedef WPASolver< GraphType >::child_iterator child_iterator
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< NodeID > WorkList

Public Member Functions

 WPASCCSolver ()
virtual ~WPASCCSolver ()
Public Member Functions inherited from SVF::WPAFSSolver< GraphType >
 WPAFSSolver ()
 Constructor.
virtual ~WPAFSSolver ()
 Destructor.
virtual NodeID sccRepNode (NodeID id) const
 SCC methods.

Protected Member Functions

virtual void solve ()
virtual void propagate (GNODE *v)
 Propagation for the solving, to be implemented in the child class.
virtual void addNodeIntoWorkList (NodeID node)
bool isInCurrentSCC (NodeID node)
void setCurrentSCC (NodeID id)
Protected Member Functions inherited from SVF::WPAFSSolver< GraphType >
virtual NodeStack & SCCDetect ()
 SCC detection.
Protected Member Functions inherited from SVF::WPASolver< GraphType >
 WPASolver ()
 Constructor.
virtual ~WPASolver ()=default
 Destructor.
SCC * getSCCDetector () const
 Get SCC detector.
const GraphType graph ()
 Get/Set graph methods.
void setGraph (GraphType g)
virtual NodeStack & SCCDetect (NodeSet &candidates)
virtual void initWorklist ()
virtual void solveWorklist ()
virtual void processNode (NodeID)
 Following methods are to be implemented in child class, in order to achieve a fully worked PTA.
virtual void collapseFields ()
 collapse positive weight cycles of a graph
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)
GNODE * Node (NodeID id)
 Get node on the graph.
NodeID Node_Index (GNODE node)
 Get node ID.

Protected Attributes

NodeID curSCCID
 index of current SCC.
Protected Attributes inherited from SVF::WPAFSSolver< GraphType >
NodeStack nodeStack
 stack used for processing nodes.
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< SCC > scc
 SCC.
WorkList worklist
 Worklist for resolution.

Additional Inherited Members

Public Attributes inherited from SVF::WPASolver< GraphType >
u32_t numOfIteration
 num of iterations during constraint solving

Detailed Description

template<class GraphType>
class SVF::WPASCCSolver< GraphType >

Solver based on SCC cycles.

Definition at line 100 of file WPAFSSolver.h.

Member Typedef Documentation

◆ child_iterator

template<class GraphType>
typedef WPASolver<GraphType>::child_iterator SVF::WPASCCSolver< GraphType >::child_iterator

Definition at line 105 of file WPAFSSolver.h.

◆ GNODE

template<class GraphType>
typedef WPASolver<GraphType>::GNODE SVF::WPASCCSolver< GraphType >::GNODE

Definition at line 104 of file WPAFSSolver.h.

◆ GTraits

template<class GraphType>
typedef WPASolver<GraphType>::GTraits SVF::WPASCCSolver< GraphType >::GTraits

Definition at line 103 of file WPAFSSolver.h.

Constructor & Destructor Documentation

◆ WPASCCSolver()

template<class GraphType>
SVF::WPASCCSolver< GraphType >::WPASCCSolver ( )
inline

Definition at line 107 of file WPAFSSolver.h.

WPAFSSolver()
Constructor.
Definition WPAFSSolver.h:53

◆ ~WPASCCSolver()

template<class GraphType>
virtual SVF::WPASCCSolver< GraphType >::~WPASCCSolver ( )
inlinevirtual

Definition at line 109 of file WPAFSSolver.h.

109{}

Member Function Documentation

◆ addNodeIntoWorkList()

template<class GraphType>
virtual void SVF::WPASCCSolver< GraphType >::addNodeIntoWorkList ( NodeID node)
inlineprotectedvirtual

Reimplemented in SVF::WPAMinimumSolver< GraphType >.

Definition at line 149 of file WPAFSSolver.h.

150 {
151 if (isInCurrentSCC(node))
152 this->pushIntoWorklist(node);
153 }
bool isInCurrentSCC(NodeID node)
virtual void pushIntoWorklist(NodeID id)
Definition WPASolver.h:157

◆ isInCurrentSCC()

template<class GraphType>
bool SVF::WPASCCSolver< GraphType >::isInCurrentSCC ( NodeID node)
inlineprotected

Definition at line 155 of file WPAFSSolver.h.

156 {
157 return (const_cast<NodeBS&>(this->getSCCDetector()->subNodes(curSCCID))).test(node);
158 }
NodeID curSCCID
index of current SCC.
SCC * getSCCDetector() const
Get SCC detector.
Definition WPASolver.h:68

◆ propagate()

template<class GraphType>
virtual void SVF::WPASCCSolver< GraphType >::propagate ( GNODE * v)
inlineprotectedvirtual

Propagation for the solving, to be implemented in the child class.

Reimplemented from SVF::WPASolver< GraphType >.

Definition at line 138 of file WPAFSSolver.h.

139 {
142 for (; EI != EE; ++EI)
143 {
144 if (this->propFromSrcToDst(*(EI.getCurrent())))
146 }
147 }
virtual void addNodeIntoWorkList(NodeID node)
WPASolver< GraphType >::child_iterator child_iterator
NodeID Node_Index(GNODE node)
Get node ID.
Definition WPASolver.h:184
virtual bool propFromSrcToDst(GEDGE *)
Propagate information from source to destination node, to be implemented in the child class.
Definition WPASolver.h:139

◆ setCurrentSCC()

template<class GraphType>
void SVF::WPASCCSolver< GraphType >::setCurrentSCC ( NodeID id)
inlineprotected

Definition at line 159 of file WPAFSSolver.h.

160 {
161 curSCCID = this->getSCCDetector()->repNode(id);
162 }
NodeID repNode(NodeID n) const
get the rep node if not found return itself
Definition SCC.h:162

◆ solve()

template<class GraphType>
virtual void SVF::WPASCCSolver< GraphType >::solve ( )
inlineprotectedvirtual

All nodes will be solved afterwards, so the worklist can be cleared before each solve iteration.

Reimplemented in SVF::WPAMinimumSolver< GraphType >.

Definition at line 112 of file WPAFSSolver.h.

113 {
116 while (!this->isWorklistEmpty())
117 this->popFromWorklist();
118
119 NodeStack& nodeStack = this->SCCDetect();
120
121 while (!nodeStack.empty())
122 {
123 NodeID rep = nodeStack.top();
124 nodeStack.pop();
125
127
128 const NodeBS& sccNodes = this->getSCCDetector()->subNodes(rep);
129 for (NodeBS::iterator it = sccNodes.begin(), eit = sccNodes.end(); it != eit; ++it)
130 this->pushIntoWorklist(*it);
131
132 while (!this->isWorklistEmpty())
133 this->processNode(this->popFromWorklist());
134 }
135 }
const NodeBS & subNodes(NodeID n) const
get all subnodes in one scc, if size is empty insert itself into the set
Definition SCC.h:196
SparseBitVectorIterator iterator
NodeStack nodeStack
stack used for processing nodes.
Definition WPAFSSolver.h:65
virtual NodeStack & SCCDetect()
SCC detection.
Definition WPAFSSolver.h:68
void setCurrentSCC(NodeID id)
NodeID popFromWorklist()
Worklist operations.
Definition WPASolver.h:152
bool isWorklistEmpty()
Definition WPASolver.h:161
virtual void processNode(NodeID)
Following methods are to be implemented in child class, in order to achieve a fully worked PTA.
Definition WPASolver.h:123

Member Data Documentation

◆ curSCCID

template<class GraphType>
NodeID SVF::WPASCCSolver< GraphType >::curSCCID
protected

index of current SCC.

Definition at line 164 of file WPAFSSolver.h.


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