Static Value-Flow Analysis
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
SVF::WPAMinimumSolver< GraphType > Class Template Reference

#include <WPAFSSolver.h>

Inheritance diagram for SVF::WPAMinimumSolver< GraphType >:
SVF::WPASCCSolver< GraphType > SVF::WPAFSSolver< GraphType > SVF::WPASolver< 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::WPASCCSolver< GraphType >
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

 WPAMinimumSolver ()
 
virtual ~WPAMinimumSolver ()
 
- Public Member Functions inherited from SVF::WPASCCSolver< GraphType >
 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 addNodeIntoWorkList (NodeID node)
 
- Protected Member Functions inherited from SVF::WPASCCSolver< GraphType >
virtual void propagate (GNODE *v)
 Propagation for the solving, to be implemented in the child class. More...
 
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...
 

Private Member Functions

void addNewCandidate (NodeID node)
 
const NodeBSgetCandidates () const
 
void removeCandidates (const NodeBS &nodes)
 

Private Attributes

NodeBS candidates
 nodes which need to be analyzed in current iteration. More...
 

Additional Inherited Members

- Public Attributes inherited from SVF::WPASolver< GraphType >
u32_t numOfIteration
 num of iterations during constraint solving More...
 
- Protected Attributes inherited from SVF::WPASCCSolver< GraphType >
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...
 

Detailed Description

template<class GraphType>
class SVF::WPAMinimumSolver< GraphType >

Only solve nodes which need to be analyzed.

Definition at line 180 of file WPAFSSolver.h.

Member Typedef Documentation

◆ child_iterator

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

Definition at line 185 of file WPAFSSolver.h.

◆ GNODE

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

Definition at line 184 of file WPAFSSolver.h.

◆ GTraits

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

Definition at line 183 of file WPAFSSolver.h.

Constructor & Destructor Documentation

◆ WPAMinimumSolver()

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

Definition at line 187 of file WPAFSSolver.h.

187 : WPASCCSolver<GraphType>() {}

◆ ~WPAMinimumSolver()

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

Definition at line 189 of file WPAFSSolver.h.

189 {}

Member Function Documentation

◆ addNewCandidate()

template<class GraphType >
void SVF::WPAMinimumSolver< GraphType >::addNewCandidate ( NodeID  node)
inlineprivate

Definition at line 236 of file WPAFSSolver.h.

237  {
238  candidates.set(node);
239  }
void set(unsigned Idx)
NodeBS candidates
nodes which need to be analyzed in current iteration.
Definition: WPAFSSolver.h:249

◆ addNodeIntoWorkList()

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

Reimplemented from SVF::WPASCCSolver< GraphType >.

Definition at line 227 of file WPAFSSolver.h.

228  {
229  if (this->isInCurrentSCC(node))
230  this->pushIntoWorklist(node);
231  else
232  addNewCandidate(node);
233  }
void addNewCandidate(NodeID node)
Definition: WPAFSSolver.h:236
bool isInCurrentSCC(NodeID node)
Definition: WPAFSSolver.h:162
virtual void pushIntoWorklist(NodeID id)
Definition: WPASolver.h:156

◆ getCandidates()

template<class GraphType >
const NodeBS& SVF::WPAMinimumSolver< GraphType >::getCandidates ( ) const
inlineprivate

Definition at line 240 of file WPAFSSolver.h.

241  {
242  return candidates;
243  }

◆ removeCandidates()

template<class GraphType >
void SVF::WPAMinimumSolver< GraphType >::removeCandidates ( const NodeBS nodes)
inlineprivate

Definition at line 244 of file WPAFSSolver.h.

245  {
247  }
bool intersectWithComplement(const SparseBitVector &RHS)
iter_range< typename GenericGraphTraits< GraphType >::nodes_iterator > nodes(const GraphType &G)
Definition: GraphTraits.h:111

◆ solve()

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

If the worklist is not empty, then only solve these nodes contained in worklist. Otherwise all nodes in the graph will be processed.

get nodes which need to be processed in this SCC cycle

remove nodes which have been processed from the candidate set

Reimplemented from SVF::WPASCCSolver< GraphType >.

Definition at line 192 of file WPAFSSolver.h.

193  {
194  bool solveAll = true;
197  if (!this->isWorklistEmpty())
198  {
199  solveAll = false;
200  while (!this->isWorklistEmpty())
202  }
203 
204  NodeStack& nodeStack = this->SCCDetect();
205 
206  while (!nodeStack.empty())
207  {
208  NodeID rep = nodeStack.top();
209  nodeStack.pop();
210 
211  this->setCurrentSCC(rep);
212 
213  NodeBS sccNodes = this->getSCCDetector()->subNodes(rep);
214  if (solveAll == false)
215  sccNodes &= getCandidates();
216 
217  for (NodeBS::iterator it = sccNodes.begin(), eit = sccNodes.end(); it != eit; ++it)
218  this->pushIntoWorklist(*it);
219 
220  while (!this->isWorklistEmpty())
221  this->processNode(this->popFromWorklist());
222 
223  removeCandidates(sccNodes);
224  }
225  }
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
const NodeBS & getCandidates() const
Definition: WPAFSSolver.h:240
void removeCandidates(const NodeBS &nodes)
Definition: WPAFSSolver.h:244
void setCurrentSCC(NodeID id)
Definition: WPAFSSolver.h:166
NodeID popFromWorklist()
Worklist operations.
Definition: WPASolver.h:151
SCC * getSCCDetector() const
Get SCC detector.
Definition: WPASolver.h:67
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
SparseBitVector NodeBS
Definition: GeneralType.h:62

Member Data Documentation

◆ candidates

template<class GraphType >
NodeBS SVF::WPAMinimumSolver< GraphType >::candidates
private

nodes which need to be analyzed in current iteration.

Definition at line 249 of file WPAFSSolver.h.


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