Static Value-Flow Analysis
Loading...
Searching...
No Matches
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.
 
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.
 
virtual ~WPAFSSolver ()
 Destructor.
 
virtual NodeID sccRepNode (NodeID id) const
 SCC methods.
 

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

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.
 

Additional Inherited Members

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

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.

llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

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

◆ 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)
bool isInCurrentSCC(NodeID node)
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)

◆ 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)
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 }
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
void removeCandidates(const NodeBS &nodes)
void setCurrentSCC(NodeID id)
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
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: