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

#include <SrcSnkSolver.h>

Public Types

typedef SVF::GenericGraphTraits< GraphType > GTraits
 Define the GTraits and node iterator. More...
 
typedef GTraits::NodeType GNODE
 
typedef GTraits::EdgeType GEDGE
 
typedef GTraits::nodes_iterator node_iterator
 
typedef GTraits::ChildIteratorType child_iterator
 
typedef SVF::GenericGraphTraits< SVF::Inverse< GNODE * > > InvGTraits
 Define inverse GTraits and note iterator. More...
 
typedef InvGTraits::ChildIteratorType inv_child_iterator
 
typedef FIFOWorkList< DPIm > WorkList
 Define worklist. More...
 

Protected Member Functions

 SrcSnkSolver ()
 Constructor. More...
 
virtual ~SrcSnkSolver ()
 Destructor. More...
 
const GraphType graph () const
 Get/Set graph methods. More...
 
void setGraph (GraphType g)
 
GNODEgetNode (NodeID id) const
 
virtual NodeID getNodeIDFromItem (const DPIm &item) const
 
virtual void forwardTraverse (DPIm &it)
 CFL forward traverse solve. More...
 
virtual void backwardTraverse (DPIm &it)
 CFL forward traverse solve. More...
 
virtual void FWProcessCurNode (const DPIm &)
 Process the DP item. More...
 
virtual void BWProcessCurNode (const DPIm &)
 
virtual void FWProcessOutgoingEdge (const DPIm &item, GEDGE *edge)
 Propagation for the solving, to be implemented in the child class. More...
 
virtual void BWProcessIncomingEdge (const DPIm &item, GEDGE *edge)
 
DPIm popFromWorklist ()
 Worklist operations. More...
 
bool pushIntoWorklist (DPIm &item)
 
bool isWorklistEmpty ()
 
bool isInWorklist (DPIm &item)
 

Private Attributes

GraphType _graph
 Graph. More...
 
WorkList worklist
 Worklist for resolution. More...
 

Detailed Description

template<class GraphType, class DPIm = DPItem>
class SVF::SrcSnkSolver< GraphType, DPIm >

Definition at line 44 of file SrcSnkSolver.h.

Member Typedef Documentation

◆ child_iterator

template<class GraphType , class DPIm = DPItem>
typedef GTraits::ChildIteratorType SVF::SrcSnkSolver< GraphType, DPIm >::child_iterator

Definition at line 53 of file SrcSnkSolver.h.

◆ GEDGE

template<class GraphType , class DPIm = DPItem>
typedef GTraits::EdgeType SVF::SrcSnkSolver< GraphType, DPIm >::GEDGE

Definition at line 51 of file SrcSnkSolver.h.

◆ GNODE

template<class GraphType , class DPIm = DPItem>
typedef GTraits::NodeType SVF::SrcSnkSolver< GraphType, DPIm >::GNODE

Definition at line 50 of file SrcSnkSolver.h.

◆ GTraits

template<class GraphType , class DPIm = DPItem>
typedef SVF::GenericGraphTraits<GraphType> SVF::SrcSnkSolver< GraphType, DPIm >::GTraits

Define the GTraits and node iterator.

Definition at line 49 of file SrcSnkSolver.h.

◆ inv_child_iterator

template<class GraphType , class DPIm = DPItem>
typedef InvGTraits::ChildIteratorType SVF::SrcSnkSolver< GraphType, DPIm >::inv_child_iterator

Definition at line 57 of file SrcSnkSolver.h.

◆ InvGTraits

template<class GraphType , class DPIm = DPItem>
typedef SVF::GenericGraphTraits<SVF::Inverse<GNODE *> > SVF::SrcSnkSolver< GraphType, DPIm >::InvGTraits

Define inverse GTraits and note iterator.

Definition at line 56 of file SrcSnkSolver.h.

◆ node_iterator

template<class GraphType , class DPIm = DPItem>
typedef GTraits::nodes_iterator SVF::SrcSnkSolver< GraphType, DPIm >::node_iterator

Definition at line 52 of file SrcSnkSolver.h.

◆ WorkList

template<class GraphType , class DPIm = DPItem>
typedef FIFOWorkList<DPIm> SVF::SrcSnkSolver< GraphType, DPIm >::WorkList

Define worklist.

Definition at line 60 of file SrcSnkSolver.h.

Constructor & Destructor Documentation

◆ SrcSnkSolver()

template<class GraphType , class DPIm = DPItem>
SVF::SrcSnkSolver< GraphType, DPIm >::SrcSnkSolver ( )
inlineprotected

Constructor.

Definition at line 65 of file SrcSnkSolver.h.

65  : _graph(nullptr)
66  {
67  }
GraphType _graph
Graph.
Definition: SrcSnkSolver.h:177

◆ ~SrcSnkSolver()

template<class GraphType , class DPIm = DPItem>
virtual SVF::SrcSnkSolver< GraphType, DPIm >::~SrcSnkSolver ( )
inlineprotectedvirtual

Destructor.

Definition at line 69 of file SrcSnkSolver.h.

70  {
71  }

Member Function Documentation

◆ backwardTraverse()

template<class GraphType , class DPIm = DPItem>
virtual void SVF::SrcSnkSolver< GraphType, DPIm >::backwardTraverse ( DPIm &  it)
inlineprotectedvirtual

CFL forward traverse solve.

Definition at line 112 of file SrcSnkSolver.h.

113  {
114  pushIntoWorklist(it);
115 
116  while (!isWorklistEmpty())
117  {
118  DPIm item = popFromWorklist();
120 
122  inv_child_iterator EI = InvGTraits::child_begin(v);
123  inv_child_iterator EE = InvGTraits::child_end(v);
124  for (; EI != EE; ++EI)
125  {
126  BWProcessIncomingEdge(item,*(EI.getCurrent()) );
127  }
128  }
129  }
cJSON * item
Definition: cJSON.h:222
GNODE * getNode(NodeID id) const
Definition: SrcSnkSolver.h:84
bool pushIntoWorklist(DPIm &item)
Definition: SrcSnkSolver.h:160
virtual void BWProcessCurNode(const DPIm &)
Definition: SrcSnkSolver.h:135
virtual void BWProcessIncomingEdge(const DPIm &item, GEDGE *edge)
Definition: SrcSnkSolver.h:147
DPIm popFromWorklist()
Worklist operations.
Definition: SrcSnkSolver.h:156
GTraits::NodeType GNODE
Definition: SrcSnkSolver.h:50
virtual NodeID getNodeIDFromItem(const DPIm &item) const
Definition: SrcSnkSolver.h:88
InvGTraits::ChildIteratorType inv_child_iterator
Definition: SrcSnkSolver.h:57

◆ BWProcessCurNode()

template<class GraphType , class DPIm = DPItem>
virtual void SVF::SrcSnkSolver< GraphType, DPIm >::BWProcessCurNode ( const DPIm &  )
inlineprotectedvirtual

Definition at line 135 of file SrcSnkSolver.h.

136  {
137  }

◆ BWProcessIncomingEdge()

template<class GraphType , class DPIm = DPItem>
virtual void SVF::SrcSnkSolver< GraphType, DPIm >::BWProcessIncomingEdge ( const DPIm &  item,
GEDGE edge 
)
inlineprotectedvirtual

Definition at line 147 of file SrcSnkSolver.h.

148  {
149  DPIm newItem(item);
150  newItem.setCurNodeID(edge->getSrcID());
151  pushIntoWorklist(newItem);
152  }

◆ forwardTraverse()

template<class GraphType , class DPIm = DPItem>
virtual void SVF::SrcSnkSolver< GraphType, DPIm >::forwardTraverse ( DPIm &  it)
inlineprotectedvirtual

CFL forward traverse solve.

Definition at line 93 of file SrcSnkSolver.h.

94  {
95  pushIntoWorklist(it);
96 
97  while (!isWorklistEmpty())
98  {
99  DPIm item = popFromWorklist();
101 
103  child_iterator EI = GTraits::child_begin(v);
104  child_iterator EE = GTraits::child_end(v);
105  for (; EI != EE; ++EI)
106  {
107  FWProcessOutgoingEdge(item,*(EI.getCurrent()) );
108  }
109  }
110  }
GTraits::ChildIteratorType child_iterator
Definition: SrcSnkSolver.h:53
virtual void FWProcessOutgoingEdge(const DPIm &item, GEDGE *edge)
Propagation for the solving, to be implemented in the child class.
Definition: SrcSnkSolver.h:141
virtual void FWProcessCurNode(const DPIm &)
Process the DP item.
Definition: SrcSnkSolver.h:132

◆ FWProcessCurNode()

template<class GraphType , class DPIm = DPItem>
virtual void SVF::SrcSnkSolver< GraphType, DPIm >::FWProcessCurNode ( const DPIm &  )
inlineprotectedvirtual

Process the DP item.

Definition at line 132 of file SrcSnkSolver.h.

133  {
134  }

◆ FWProcessOutgoingEdge()

template<class GraphType , class DPIm = DPItem>
virtual void SVF::SrcSnkSolver< GraphType, DPIm >::FWProcessOutgoingEdge ( const DPIm &  item,
GEDGE edge 
)
inlineprotectedvirtual

Propagation for the solving, to be implemented in the child class.

Definition at line 141 of file SrcSnkSolver.h.

142  {
143  DPIm newItem(item);
144  newItem.setCurNodeID(edge->getDstID());
145  pushIntoWorklist(newItem);
146  }

◆ getNode()

template<class GraphType , class DPIm = DPItem>
GNODE* SVF::SrcSnkSolver< GraphType, DPIm >::getNode ( NodeID  id) const
inlineprotected

Definition at line 84 of file SrcSnkSolver.h.

85  {
86  return _graph->getGNode(id);
87  }

◆ getNodeIDFromItem()

template<class GraphType , class DPIm = DPItem>
virtual NodeID SVF::SrcSnkSolver< GraphType, DPIm >::getNodeIDFromItem ( const DPIm &  item) const
inlineprotectedvirtual

Definition at line 88 of file SrcSnkSolver.h.

89  {
90  return item.getCurNodeID();
91  }

◆ graph()

template<class GraphType , class DPIm = DPItem>
const GraphType SVF::SrcSnkSolver< GraphType, DPIm >::graph ( ) const
inlineprotected

Get/Set graph methods.

Definition at line 74 of file SrcSnkSolver.h.

75  {
76  return _graph;
77  }

◆ isInWorklist()

template<class GraphType , class DPIm = DPItem>
bool SVF::SrcSnkSolver< GraphType, DPIm >::isInWorklist ( DPIm &  item)
inlineprotected

Definition at line 168 of file SrcSnkSolver.h.

169  {
170  return worklist.find(item);
171  }
bool find(const Data &data) const
Definition: WorkList.h:157
WorkList worklist
Worklist for resolution.
Definition: SrcSnkSolver.h:180

◆ isWorklistEmpty()

template<class GraphType , class DPIm = DPItem>
bool SVF::SrcSnkSolver< GraphType, DPIm >::isWorklistEmpty ( )
inlineprotected

Definition at line 164 of file SrcSnkSolver.h.

165  {
166  return worklist.empty();
167  }
bool empty() const
Definition: WorkList.h:146

◆ popFromWorklist()

template<class GraphType , class DPIm = DPItem>
DPIm SVF::SrcSnkSolver< GraphType, DPIm >::popFromWorklist ( )
inlineprotected

Worklist operations.

Definition at line 156 of file SrcSnkSolver.h.

157  {
158  return worklist.pop();
159  }

◆ pushIntoWorklist()

template<class GraphType , class DPIm = DPItem>
bool SVF::SrcSnkSolver< GraphType, DPIm >::pushIntoWorklist ( DPIm &  item)
inlineprotected

Definition at line 160 of file SrcSnkSolver.h.

161  {
162  return worklist.push(item);
163  }
bool push(const Data &data)
Definition: WorkList.h:165

◆ setGraph()

template<class GraphType , class DPIm = DPItem>
void SVF::SrcSnkSolver< GraphType, DPIm >::setGraph ( GraphType  g)
inlineprotected

Definition at line 78 of file SrcSnkSolver.h.

79  {
80  _graph = g;
81  }

Member Data Documentation

◆ _graph

template<class GraphType , class DPIm = DPItem>
GraphType SVF::SrcSnkSolver< GraphType, DPIm >::_graph
private

Graph.

Definition at line 177 of file SrcSnkSolver.h.

◆ worklist

template<class GraphType , class DPIm = DPItem>
WorkList SVF::SrcSnkSolver< GraphType, DPIm >::worklist
private

Worklist for resolution.

Definition at line 180 of file SrcSnkSolver.h.


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