Static Value-Flow Analysis
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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. More...
 
typedef GTraits::NodeRef GNODE
 
typedef GTraits::EdgeType GEDGE
 
typedef GTraits::ChildIteratorType child_iterator
 
typedef SCCDetection< GraphType > SCC
 
typedef FIFOWorkList< NodeIDWorkList
 

Public Member Functions

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

Protected Member Functions

virtual void solve ()
 
virtual void propagate (GNODE *v)
 Propagation for the solving, to be implemented in the child class. More...
 
virtual void addNodeIntoWorkList (NodeID node)
 
bool isInCurrentSCC (NodeID node)
 
void setCurrentSCC (NodeID id)
 
- Protected Member Functions inherited from SVF::WPAFSSolver< GraphType >
virtual NodeStackSCCDetect ()
 SCC detection. More...
 
- Protected Member Functions inherited from SVF::WPASolver< GraphType >
 WPASolver ()
 Constructor. More...
 
virtual ~WPASolver ()=default
 Destructor. More...
 
SCCgetSCCDetector () const
 Get SCC detector. More...
 
const GraphType graph ()
 Get/Set graph methods. More...
 
void setGraph (GraphType g)
 
virtual NodeStackSCCDetect (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. More...
 
virtual void collapseFields ()
 collapse positive weight cycles of a graph More...
 
virtual bool propFromSrcToDst (GEDGE *)
 Propagate information from source to destination node, to be implemented in the child class. More...
 
NodeID popFromWorklist ()
 Worklist operations. More...
 
virtual void pushIntoWorklist (NodeID id)
 
bool isWorklistEmpty ()
 
bool isInWorklist (NodeID id)
 
GNODENode (NodeID id)
 Get node on the graph. More...
 
NodeID Node_Index (GNODE node)
 Get node ID. More...
 

Protected Attributes

NodeID curSCCID
 index of current SCC. More...
 
- Protected Attributes inherited from SVF::WPAFSSolver< GraphType >
NodeStack nodeStack
 stack used for processing nodes. More...
 
- Protected Attributes inherited from SVF::WPASolver< GraphType >
bool reanalyze
 Reanalyze if any constraint value changed. More...
 
u32_t iterationForPrintStat
 print out statistics for i-th iteration More...
 
GraphType _graph
 Graph. More...
 
std::unique_ptr< SCCscc
 SCC. More...
 
WorkList worklist
 Worklist for resolution. More...
 

Additional Inherited Members

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

Detailed Description

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

Solver based on SCC cycles.

Definition at line 107 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 112 of file WPAFSSolver.h.

◆ GNODE

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

Definition at line 111 of file WPAFSSolver.h.

◆ GTraits

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

Definition at line 110 of file WPAFSSolver.h.

Constructor & Destructor Documentation

◆ WPASCCSolver()

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

Definition at line 114 of file WPAFSSolver.h.

114 : WPAFSSolver<GraphType>() {}

◆ ~WPASCCSolver()

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

Definition at line 116 of file WPAFSSolver.h.

116 {}

Member Function Documentation

◆ addNodeIntoWorkList()

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

Reimplemented in SVF::WPAMinimumSolver< GraphType >.

Definition at line 156 of file WPAFSSolver.h.

157  {
158  if (isInCurrentSCC(node))
159  this->pushIntoWorklist(node);
160  }
bool isInCurrentSCC(NodeID node)
Definition: WPAFSSolver.h:162
virtual void pushIntoWorklist(NodeID id)
Definition: WPASolver.h:156

◆ isInCurrentSCC()

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

Definition at line 162 of file WPAFSSolver.h.

163  {
164  return (const_cast<NodeBS&>(this->getSCCDetector()->subNodes(curSCCID))).test(node);
165  }
NodeID curSCCID
index of current SCC.
Definition: WPAFSSolver.h:171
SCC * getSCCDetector() const
Get SCC detector.
Definition: WPASolver.h:67
SparseBitVector NodeBS
Definition: GeneralType.h:62

◆ 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 145 of file WPAFSSolver.h.

146  {
147  child_iterator EI = GTraits::direct_child_begin(v);
148  child_iterator EE = GTraits::direct_child_end(v);
149  for (; EI != EE; ++EI)
150  {
151  if (this->propFromSrcToDst(*(EI.getCurrent())))
152  addNodeIntoWorkList(this->Node_Index(*EI));
153  }
154  }
virtual void addNodeIntoWorkList(NodeID node)
Definition: WPAFSSolver.h:156
WPASolver< GraphType >::child_iterator child_iterator
Definition: WPAFSSolver.h:112
NodeID Node_Index(GNODE node)
Get node ID.
Definition: WPASolver.h:183
virtual bool propFromSrcToDst(GEDGE *)
Propagate information from source to destination node, to be implemented in the child class.
Definition: WPASolver.h:138

◆ setCurrentSCC()

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

Definition at line 166 of file WPAFSSolver.h.

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

◆ 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 119 of file WPAFSSolver.h.

120  {
123  while (!this->isWorklistEmpty())
124  this->popFromWorklist();
125 
126  NodeStack& nodeStack = this->SCCDetect();
127 
128  while (!nodeStack.empty())
129  {
130  NodeID rep = nodeStack.top();
131  nodeStack.pop();
132 
133  setCurrentSCC(rep);
134 
135  const NodeBS& sccNodes = this->getSCCDetector()->subNodes(rep);
136  for (NodeBS::iterator it = sccNodes.begin(), eit = sccNodes.end(); it != eit; ++it)
137  this->pushIntoWorklist(*it);
138 
139  while (!this->isWorklistEmpty())
140  this->processNode(this->popFromWorklist());
141  }
142  }
const NodeBS & subNodes(NodeID n) const
get all subnodes in one scc, if size is empty insert itself into the set
Definition: SCC.h:173
SparseBitVectorIterator iterator
NodeStack nodeStack
stack used for processing nodes.
Definition: WPAFSSolver.h:64
virtual NodeStack & SCCDetect()
SCC detection.
Definition: WPAFSSolver.h:67
void setCurrentSCC(NodeID id)
Definition: WPAFSSolver.h:166
NodeID popFromWorklist()
Worklist operations.
Definition: WPASolver.h:151
bool isWorklistEmpty()
Definition: WPASolver.h:160
virtual void processNode(NodeID)
Following methods are to be implemented in child class, in order to achieve a fully worked PTA.
Definition: WPASolver.h:122
std::stack< NodeID > NodeStack
Definition: GeneralType.h:118
u32_t NodeID
Definition: GeneralType.h:55

Member Data Documentation

◆ curSCCID

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

index of current SCC.

Definition at line 171 of file WPAFSSolver.h.


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