Static Value-Flow Analysis
Loading...
Searching...
No Matches
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< GraphTypeGTraits
 Define the GTraits and node iterator for printing.
 
typedef GTraits::NodeRef GNODE
 
typedef GTraits::EdgeType GEDGE
 
typedef GTraits::ChildIteratorType child_iterator
 
typedef SCCDetection< GraphTypeSCC
 
typedef FIFOWorkList< NodeIDWorkList
 

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 NodeStackSCCDetect ()
 SCC detection.
 
- 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 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)
 
GNODENode (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< SCCscc
 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

Definition at line 104 of file WPAFSSolver.h.

◆ 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.

llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

◆ ~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
SparseBitVector NodeBS
Definition GeneralType.h:82

◆ 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 {
140 child_iterator EI = GTraits::direct_child_begin(v);
141 child_iterator EE = GTraits::direct_child_end(v);
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 }

◆ 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
126 setCurrentSCC(rep);
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 }
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
std::stack< NodeID > NodeStack
Definition GeneralType.h:92
u32_t NodeID
Definition GeneralType.h:76

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: