Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Types | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
SVF::WPASolver< GraphType > Class Template Reference

#include <WPASolver.h>

Inheritance diagram for SVF::WPASolver< GraphType >:
SVF::AndersenBase SVF::WPAFSSolver< GraphType > SVF::Andersen SVF::Steensgaard SVF::TypeAnalysis SVF::FlowSensitive SVF::WPASCCSolver< GraphType > SVF::AndersenSCD SVF::AndersenWaveDiff SVF::FSMPTA< SVFGGraph > SVF::VersionedFlowSensitive SVF::WPAMinimumSolver< GraphType > SVF::AndersenSFR

Public Types

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 Attributes

u32_t numOfIteration
 num of iterations during constraint solving
 

Protected Member Functions

 WPASolver ()
 Constructor.
 
virtual ~WPASolver ()=default
 Destructor.
 
SCCgetSCCDetector () const
 Get SCC detector.
 
const GraphType graph ()
 Get/Set graph methods.
 
void setGraph (GraphType g)
 
virtual NodeStackSCCDetect ()
 SCC detection.
 
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 void propagate (GNODE *v)
 
virtual bool propFromSrcToDst (GEDGE *)
 Propagate information from source to destination node, to be implemented in the child class.
 
virtual NodeID sccRepNode (NodeID id) const
 
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

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::WPASolver< GraphType >

Definition at line 44 of file WPASolver.h.

Member Typedef Documentation

◆ child_iterator

template<class GraphType >
typedef GTraits::ChildIteratorType SVF::WPASolver< GraphType >::child_iterator

Definition at line 52 of file WPASolver.h.

◆ GEDGE

template<class GraphType >
typedef GTraits::EdgeType SVF::WPASolver< GraphType >::GEDGE

Definition at line 51 of file WPASolver.h.

◆ GNODE

Definition at line 50 of file WPASolver.h.

◆ GTraits

Define the GTraits and node iterator for printing.

Definition at line 49 of file WPASolver.h.

◆ SCC

Definition at line 54 of file WPASolver.h.

◆ WorkList

Definition at line 56 of file WPASolver.h.

Constructor & Destructor Documentation

◆ WPASolver()

template<class GraphType >
SVF::WPASolver< GraphType >::WPASolver ( )
inlineprotected

Constructor.

Definition at line 61 of file WPASolver.h.

61 : reanalyze(false), iterationForPrintStat(1000), _graph(nullptr), numOfIteration(0)
62 {
63 }
GraphType _graph
Graph.
Definition WPASolver.h:191
u32_t iterationForPrintStat
print out statistics for i-th iteration
Definition WPASolver.h:174
u32_t numOfIteration
num of iterations during constraint solving
Definition WPASolver.h:201
bool reanalyze
Reanalyze if any constraint value changed.
Definition WPASolver.h:172

◆ ~WPASolver()

template<class GraphType >
virtual SVF::WPASolver< GraphType >::~WPASolver ( )
protectedvirtualdefault

Destructor.

Member Function Documentation

◆ collapseFields()

template<class GraphType >
virtual void SVF::WPASolver< GraphType >::collapseFields ( )
inlineprotectedvirtual

collapse positive weight cycles of a graph

Reimplemented in SVF::Andersen.

Definition at line 125 of file WPASolver.h.

125{}

◆ getSCCDetector()

template<class GraphType >
SCC * SVF::WPASolver< GraphType >::getSCCDetector ( ) const
inlineprotected

Get SCC detector.

Definition at line 68 of file WPASolver.h.

69 {
70 return scc.get();
71 }
std::unique_ptr< SCC > scc
SCC.
Definition WPASolver.h:194

◆ graph()

template<class GraphType >
const GraphType SVF::WPASolver< GraphType >::graph ( )
inlineprotected

Get/Set graph methods.

Definition at line 75 of file WPASolver.h.

76 {
77 return _graph;
78 }

◆ initWorklist()

template<class GraphType >
virtual void SVF::WPASolver< GraphType >::initWorklist ( )
inlineprotectedvirtual

Reimplemented in SVF::Andersen.

Definition at line 98 of file WPASolver.h.

99 {
100 NodeStack& nodeStack = SCCDetect();
101 while (!nodeStack.empty())
102 {
103 NodeID nodeId = nodeStack.top();
104 nodeStack.pop();
106 }
107 }
virtual void pushIntoWorklist(NodeID id)
Definition WPASolver.h:157
virtual NodeStack & SCCDetect()
SCC detection.
Definition WPASolver.h:87
std::stack< NodeID > NodeStack
Definition GeneralType.h:92
u32_t NodeID
Definition GeneralType.h:76
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

◆ isInWorklist()

template<class GraphType >
bool SVF::WPASolver< GraphType >::isInWorklist ( NodeID  id)
inlineprotected

Definition at line 165 of file WPASolver.h.

166 {
167 return worklist.find(id);
168 }
bool find(const Data &data) const
Definition WorkList.h:172
WorkList worklist
Worklist for resolution.
Definition WPASolver.h:197

◆ isWorklistEmpty()

template<class GraphType >
bool SVF::WPASolver< GraphType >::isWorklistEmpty ( )
inlineprotected

Definition at line 161 of file WPASolver.h.

162 {
163 return worklist.empty();
164 }
bool empty() const
Definition WorkList.h:161

◆ Node()

template<class GraphType >
GNODE * SVF::WPASolver< GraphType >::Node ( NodeID  id)
inlineprotected

Get node on the graph.

Definition at line 178 of file WPASolver.h.

179 {
180 return GTraits::getNode(_graph, id);
181 }

◆ Node_Index()

template<class GraphType >
NodeID SVF::WPASolver< GraphType >::Node_Index ( GNODE  node)
inlineprotected

Get node ID.

Definition at line 184 of file WPASolver.h.

185 {
186 return GTraits::getNodeID(node);
187 }

◆ popFromWorklist()

template<class GraphType >
NodeID SVF::WPASolver< GraphType >::popFromWorklist ( )
inlineprotected

Worklist operations.

Definition at line 152 of file WPASolver.h.

153 {
154 return sccRepNode(worklist.pop());
155 }
virtual NodeID sccRepNode(NodeID id) const
Definition WPASolver.h:145

◆ processNode()

template<class GraphType >
virtual void SVF::WPASolver< GraphType >::processNode ( NodeID  )
inlineprotectedvirtual

Following methods are to be implemented in child class, in order to achieve a fully worked PTA.

Process each node on the graph, to be implemented in the child class

Reimplemented in SVF::VersionedFlowSensitive, SVF::Andersen, SVF::AndersenWaveDiff, SVF::FSMPTA< SVFGGraph >, and SVF::FlowSensitive.

Definition at line 123 of file WPASolver.h.

123{}

◆ propagate()

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

dump statistics Propagation for the solving, to be implemented in the child class

Reimplemented in SVF::WPASCCSolver< GraphType >.

Definition at line 128 of file WPASolver.h.

129 {
130 child_iterator EI = GTraits::direct_child_begin(*v);
131 child_iterator EE = GTraits::direct_child_end(*v);
132 for (; EI != EE; ++EI)
133 {
134 if (propFromSrcToDst(*(EI.getCurrent())))
136 }
137 }
NodeID Node_Index(GNODE node)
Get node ID.
Definition WPASolver.h:184
GTraits::ChildIteratorType child_iterator
Definition WPASolver.h:52
virtual bool propFromSrcToDst(GEDGE *)
Propagate information from source to destination node, to be implemented in the child class.
Definition WPASolver.h:139

◆ propFromSrcToDst()

template<class GraphType >
virtual bool SVF::WPASolver< GraphType >::propFromSrcToDst ( GEDGE )
inlineprotectedvirtual

Propagate information from source to destination node, to be implemented in the child class.

Definition at line 139 of file WPASolver.h.

140 {
141 return false;
142 }

◆ pushIntoWorklist()

template<class GraphType >
virtual void SVF::WPASolver< GraphType >::pushIntoWorklist ( NodeID  id)
inlineprotectedvirtual

Definition at line 157 of file WPASolver.h.

158 {
160 }
bool push(const Data &data)
Definition WorkList.h:180

◆ SCCDetect() [1/2]

template<class GraphType >
virtual NodeStack & SVF::WPASolver< GraphType >::SCCDetect ( )
inlineprotectedvirtual

SCC detection.

Reimplemented in SVF::Andersen, SVF::AndersenSCD, SVF::WPAFSSolver< GraphType >, and SVF::FlowSensitive.

Definition at line 87 of file WPASolver.h.

88 {
89 getSCCDetector()->find();
90 return getSCCDetector()->topoNodeStack();
91 }
SCC * getSCCDetector() const
Get SCC detector.
Definition WPASolver.h:68

◆ SCCDetect() [2/2]

template<class GraphType >
virtual NodeStack & SVF::WPASolver< GraphType >::SCCDetect ( NodeSet candidates)
inlineprotectedvirtual

Definition at line 92 of file WPASolver.h.

93 {
94 getSCCDetector()->find(candidates);
95 return getSCCDetector()->topoNodeStack();
96 }

◆ sccRepNode()

template<class GraphType >
virtual NodeID SVF::WPASolver< GraphType >::sccRepNode ( NodeID  id) const
inlineprotectedvirtual

Reimplemented in SVF::WPAFSSolver< GraphType >, SVF::AndersenBase, and SVF::Steensgaard.

Definition at line 145 of file WPASolver.h.

146 {
147 return getSCCDetector()->repNode(id);
148 }

◆ setGraph()

template<class GraphType >
void SVF::WPASolver< GraphType >::setGraph ( GraphType  g)
inlineprotected

Definition at line 79 of file WPASolver.h.

80 {
81 _graph = g;
82 scc = std::make_unique<SCC>(_graph);
83 }

◆ solveWorklist()

template<class GraphType >
virtual void SVF::WPASolver< GraphType >::solveWorklist ( )
inlineprotectedvirtual

Reimplemented in SVF::AndersenWaveDiff, SVF::AndersenSCD, and SVF::Steensgaard.

Definition at line 109 of file WPASolver.h.

110 {
111 while (!isWorklistEmpty())
112 {
114 // Keep solving until workList is empty.
117 }
118 }
NodeID popFromWorklist()
Worklist operations.
Definition WPASolver.h:152
virtual void collapseFields()
collapse positive weight cycles of a graph
Definition WPASolver.h:125
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

◆ _graph

template<class GraphType >
GraphType SVF::WPASolver< GraphType >::_graph
protected

Graph.

Definition at line 191 of file WPASolver.h.

◆ iterationForPrintStat

template<class GraphType >
u32_t SVF::WPASolver< GraphType >::iterationForPrintStat
protected

print out statistics for i-th iteration

Definition at line 174 of file WPASolver.h.

◆ numOfIteration

template<class GraphType >
u32_t SVF::WPASolver< GraphType >::numOfIteration

num of iterations during constraint solving

Definition at line 201 of file WPASolver.h.

◆ reanalyze

template<class GraphType >
bool SVF::WPASolver< GraphType >::reanalyze
protected

Reanalyze if any constraint value changed.

Definition at line 172 of file WPASolver.h.

◆ scc

template<class GraphType >
std::unique_ptr<SCC> SVF::WPASolver< GraphType >::scc
protected

SCC.

Definition at line 194 of file WPASolver.h.

◆ worklist

template<class GraphType >
WorkList SVF::WPASolver< GraphType >::worklist
protected

Worklist for resolution.

Definition at line 197 of file WPASolver.h.


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